express-sweet 1.0.9 → 1.0.13
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 +75 -1
- package/README.md +9 -38
- package/dist/build.common.js +2 -2
- package/dist/build.esm.js +3 -3
- package/docs/index.html +3242 -4088
- package/docs/styles/docs.css +18 -62
- package/package.json +1 -1
- package/types/database/Model.d.ts +81 -18
- package/types/interfaces/FaceMatch.d.ts +6 -0
- package/types/middlewares/Environment.d.ts +1 -1
- package/types/services/AWSRekognitionClient.d.ts +14 -14
- package/types/services/RedisClient.d.ts +1 -1
- package/docs/styles/docs.bk.css +0 -2200
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,76 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.13] - 2021-12-13
|
|
6
|
+
### Fixed
|
|
7
|
+
- The model's begin method now accepts the transaction option.
|
|
8
|
+
See [Transaction | Sequelize](https://sequelize.org/master/class/lib/transaction.js~Transaction.html) for transaction options.
|
|
9
|
+
```js
|
|
10
|
+
let transaction;
|
|
11
|
+
try {
|
|
12
|
+
transaction = await BookModel.begin({
|
|
13
|
+
isolationLevel: BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ,
|
|
14
|
+
type: BookModel.Transaction.TYPES.DEFERRED,
|
|
15
|
+
});
|
|
16
|
+
const book = await BookModel.findOne({where: {id: 1}}, {transaction});
|
|
17
|
+
book.title = 'When Im Gone';
|
|
18
|
+
await book.save({transaction});
|
|
19
|
+
await transaction.commit();
|
|
20
|
+
|
|
21
|
+
// Check the update result.
|
|
22
|
+
// Output: New title of book: When Im Gone
|
|
23
|
+
await book.reload();
|
|
24
|
+
console.log(`New title of book: ${book.title}`);
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (transaction)
|
|
27
|
+
await transaction.rollback();
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## [1.0.12] - 2021-11-16
|
|
32
|
+
### Fixed
|
|
33
|
+
- Added a method to the model that can execute raw SQL.
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
|
|
38
|
+
// Note that since this is a raw query, the metadata are dialect specific.
|
|
39
|
+
const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
|
|
40
|
+
|
|
41
|
+
// In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
|
|
42
|
+
// We didn't need to destructure the result here - the results were returned directly
|
|
43
|
+
const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## [1.0.11] - 2021-11-10
|
|
47
|
+
### Fixed
|
|
48
|
+
- 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.
|
|
49
|
+
|
|
50
|
+
## [1.0.10] - 2021-10-19
|
|
51
|
+
### Fixed
|
|
52
|
+
- Added face similarity found to face search results in collection.
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import * as sweet from 'express-sweet';
|
|
56
|
+
|
|
57
|
+
// Find a face from the collection.
|
|
58
|
+
// Output: Face search results: [
|
|
59
|
+
// {
|
|
60
|
+
// faceId: '385e1b00-4ede-4219-a7b0-0b9cbe4953e5',
|
|
61
|
+
// boundingBox: {
|
|
62
|
+
// width: 0.3204210102558136,
|
|
63
|
+
// height: 1.0046900510787964,
|
|
64
|
+
// left: 0.39145898818969727,
|
|
65
|
+
// top: 0.07936319708824158
|
|
66
|
+
// },
|
|
67
|
+
// similarity: 99.98941802978516
|
|
68
|
+
// }
|
|
69
|
+
// ]
|
|
70
|
+
const collectionId = 'MyCollection';
|
|
71
|
+
const res = await client.searchFaces(collectionId, 'img/face.jpg');
|
|
72
|
+
console.log('Face search results:', res);
|
|
73
|
+
```
|
|
74
|
+
|
|
5
75
|
## [1.0.9] - 2021-10-13
|
|
6
76
|
### Fixed
|
|
7
77
|
- Updated dependent package'sharp'from 0.25.4 to 0.29.1.
|
|
@@ -53,4 +123,8 @@ All notable changes to this project will be documented in this file.
|
|
|
53
123
|
[1.0.5]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.4...v1.0.5
|
|
54
124
|
[1.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.5...v1.0.6
|
|
55
125
|
[1.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.6...v1.0.7
|
|
56
|
-
[1.0.8]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.7...v1.0.8
|
|
126
|
+
[1.0.8]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.7...v1.0.8
|
|
127
|
+
[1.0.9]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.8...v1.0.9
|
|
128
|
+
[1.0.10]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.9...v1.0.10
|
|
129
|
+
[1.0.11]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.10...v1.0.11
|
|
130
|
+
[1.0.12]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.11...v1.0.12
|
package/README.md
CHANGED
|
@@ -7,50 +7,13 @@ Extend Express functionality with Express Sweet and start developing fast, minim
|
|
|
7
7
|
* <a href="https://takuya-motoshima.github.io/express-sweet/" target="_blank">Website and Documentation</a> - <a href="https://github.com/takuya-motoshima/express-sweet" target="_blank">[website repo]</a>
|
|
8
8
|
* <a href="https://github.com/takuya-motoshima/express-sweet/blob/main/CHANGELOG.md" target="_blank">Changelog</a>
|
|
9
9
|
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
Extend Express functionality with Express Sweet and start developing fast, minimal web applications. The package elements that make up this extension.
|
|
13
|
-
In addition, some packages have been customized to make them easier for developers to use.
|
|
14
|
-
|
|
15
|
-
* Framework
|
|
16
|
-
The framework uses <a href="https://expressjs.com/" target="_blank">Expess v4</a>.
|
|
17
|
-
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
|
|
18
|
-
* Automatic URL routing
|
|
19
|
-
Express Sweet automatically maps the URL to express.Router defined in the routes directory.
|
|
20
|
-
See <a href="https://takuya-motoshima.github.io/express-sweet/#routing" target="_blank">"Routing reference"</a> for details.
|
|
21
|
-
* Model
|
|
22
|
-
The model uses <a href="https://sequelize.org/master/" target="_blank">Sequelize v6</a>.
|
|
23
|
-
Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.
|
|
24
|
-
It features solid transaction support, relations, eager and lazy loading, read replication and more.
|
|
25
|
-
See the <a href="https://takuya-motoshima.github.io/express-sweet/#model" target="_blank">"Model reference"</a> for details.
|
|
26
|
-
* View
|
|
27
|
-
The view template engine uses <a href="https://handlebarsjs.com/" target="_blank">Handlebars v4</a>.
|
|
28
|
-
Handlebars is a simple templating language.
|
|
29
|
-
It uses a template and an input object to generate HTML or other text formats.
|
|
30
|
-
Handlebars templates look like regular text with embedded Handlebars expressions.
|
|
31
|
-
See the <a href="https://takuya-motoshima.github.io/express-sweet/#views" target="_blank">"View reference"</a> for more details.
|
|
32
|
-
* User authentication
|
|
33
|
-
User authentication uses <a href="https://www.passportjs.org/docs/" target="_blank">Passport v0.4.1</a>.
|
|
34
|
-
Passport is Express-compatible authentication middleware for Node.js.
|
|
35
|
-
See the <a href="https://takuya-motoshima.github.io/express-sweet/#user-authentication" target="_blank">"Authentication Reference"</a> for more information.
|
|
36
|
-
* Service
|
|
37
|
-
Express Sweet includes convenient classes for developing applications using <a href="https://docs.aws.amazon.com/rekognition/latest/dg/what-is.html" target="_blank">"Amazon Rekognition"</a> and classes for easy user authentication.
|
|
38
|
-
For more information on Rekognition, see <a href="https://takuya-motoshima.github.io/express-sweet/#rekognition" target="_blank">"Rekognition Reference"</a>.
|
|
39
|
-
|
|
40
10
|
## Installation
|
|
41
11
|
|
|
42
12
|
This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/).
|
|
43
13
|
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
|
44
14
|
Node.js 0.10 or higher is required.
|
|
45
15
|
|
|
46
|
-
For details on installing Express Sweet, see the <a href="https://takuya-motoshima.github.io/express-sweet/#
|
|
47
|
-
|
|
48
|
-
## Quick Start
|
|
49
|
-
|
|
50
|
-
The easiest way to get started with Express Sweet is to install express-sweet-generator and automatically create a template application.
|
|
51
|
-
From the beginning, the template includes the following screen and sample programs such as router, model class, and authentication.
|
|
52
|
-
Please refer to these and start developing your application.
|
|
53
|
-
See <a href="https://takuya-motoshima.github.io/express-sweet/#started-generator" target="_blank">"Express Sweet app generator"</a> for more information on how to use express-sweet-generator.
|
|
16
|
+
For details on installing Express Sweet, see the <a href="https://takuya-motoshima.github.io/express-sweet/#instl" target="_blank">"installation reference"</a>.
|
|
54
17
|
|
|
55
18
|
<table>
|
|
56
19
|
<tr>
|
|
@@ -81,6 +44,14 @@ See <a href="https://takuya-motoshima.github.io/express-sweet/#started-generator
|
|
|
81
44
|
</tr>
|
|
82
45
|
</table>
|
|
83
46
|
|
|
47
|
+
## Author
|
|
48
|
+
|
|
49
|
+
**Takuya Motoshima**
|
|
50
|
+
|
|
51
|
+
* [github/takuya-motoshima](https://github.com/takuya-motoshima)
|
|
52
|
+
* [twitter/TakuyaMotoshima](https://twitter.com/TakuyaMotoshima)
|
|
53
|
+
* [facebook/takuya.motoshima.7](https://www.facebook.com/takuya.motoshima.7)
|
|
54
|
+
|
|
84
55
|
## License
|
|
85
56
|
|
|
86
57
|
[MIT](LICENSE)
|