express-sweet 1.0.26 → 1.0.28
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 +48 -1
- package/dist/build.common.js +6 -6
- package/dist/build.esm.js +6 -6
- package/docs/index.html +14 -6
- package/package.json +4 -3
- package/types/exceptions/CollectionCreationError.d.ts +13 -0
- package/types/exceptions/CollectionDeletionError.d.ts +13 -0
- package/types/exceptions/FaceIndexError.d.ts +13 -0
- package/types/exceptions/MissingFaceInImageError.d.ts +13 -0
- package/types/exceptions/MultipleFacesInImageError.d.ts +13 -0
- package/types/exceptions/index.d.ts +6 -2
- package/types/interfaces/ViewOptions.d.ts +2 -2
- package/types/services/AWSRekognitionClient.d.ts +8 -9
- package/types/exceptions/ApiError.d.ts +0 -29
package/docs/index.html
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<!--begin::Title-->
|
|
77
77
|
<h1 class="page-heading d-flex text-dark fw-bold fs-3 justify-content-center align-items-baseline my-0">
|
|
78
78
|
<!-- <h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0"> -->
|
|
79
|
-
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.
|
|
79
|
+
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.28</a>
|
|
80
80
|
</h1>
|
|
81
81
|
<!--end::Title-->
|
|
82
82
|
</div>
|
|
@@ -1782,7 +1782,7 @@ module.exports = router;</code></pre>
|
|
|
1782
1782
|
<td>Extension for templates and partials files.<br>The default is <code>.hbs</code>.</td>
|
|
1783
1783
|
</tr>
|
|
1784
1784
|
<tr>
|
|
1785
|
-
<td class="mw-250px"><code>beforeRender: (res: express.Response) => void</code></td>
|
|
1785
|
+
<td class="mw-250px"><code>beforeRender: (req: express.Request, res: express.Response) => void</code></td>
|
|
1786
1786
|
<td>
|
|
1787
1787
|
Hook function just before the view is rendered.<br>
|
|
1788
1788
|
For example, you can set your own local variables that can be used within the view.<br>
|
|
@@ -1798,13 +1798,13 @@ module.exports = router;</code></pre>
|
|
|
1798
1798
|
*
|
|
1799
1799
|
* @example
|
|
1800
1800
|
* // The message set here can be referenced in the view as {{message}}.
|
|
1801
|
-
* beforeRender: res => {
|
|
1801
|
+
* beforeRender: (req, res) => {
|
|
1802
1802
|
* res.locals.message = 'Hello World';
|
|
1803
1803
|
* }
|
|
1804
1804
|
*
|
|
1805
1805
|
* @type {(res: express.Response) => void}
|
|
1806
1806
|
*/
|
|
1807
|
-
beforeRender: res => {
|
|
1807
|
+
beforeRender: (req, res) => {
|
|
1808
1808
|
res.locals.message = 'Hello World';
|
|
1809
1809
|
}</code></pre>
|
|
1810
1810
|
</div>
|
|
@@ -6342,7 +6342,7 @@ await client.listCollections();</code></pre>
|
|
|
6342
6342
|
</td>
|
|
6343
6343
|
</tr>
|
|
6344
6344
|
<tr>
|
|
6345
|
-
<td class="mw-250px"><code>public async deleteCollection(collectionId: string): Promise<
|
|
6345
|
+
<td class="mw-250px"><code>public async deleteCollection(collectionId: string): Promise<boolean></code></td>
|
|
6346
6346
|
<td>
|
|
6347
6347
|
Deletes the specified collection.<br>
|
|
6348
6348
|
Note that this operation removes all faces in the collection.
|
|
@@ -6352,6 +6352,10 @@ await client.listCollections();</code></pre>
|
|
|
6352
6352
|
<li class="py-2"><code>collectionId: string</code> ID of the collection to delete.</li>
|
|
6353
6353
|
</ul>
|
|
6354
6354
|
</div>
|
|
6355
|
+
<div class="py-5">
|
|
6356
|
+
<p class="mb-0">Return value:</p>
|
|
6357
|
+
<code>Promise<boolean></code> True on success.
|
|
6358
|
+
</div>
|
|
6355
6359
|
<!--begin::Code-->
|
|
6356
6360
|
<div class="py-5">
|
|
6357
6361
|
<!--begin::Highlight-->
|
|
@@ -6833,7 +6837,7 @@ console.log(result);</code></pre>
|
|
|
6833
6837
|
</td>
|
|
6834
6838
|
</tr>
|
|
6835
6839
|
<tr>
|
|
6836
|
-
<td class="mw-250px"><code>public async deleteFaces(collectionId: string, faceIds: string[]): Promise<
|
|
6840
|
+
<td class="mw-250px"><code>public async deleteFaces(collectionId: string, faceIds: string[]): Promise<boolean></code></td>
|
|
6837
6841
|
<td>
|
|
6838
6842
|
Deletes faces from a collection.<br>
|
|
6839
6843
|
You specify a collection ID and an array of face IDs to remove from the collection.
|
|
@@ -6844,6 +6848,10 @@ console.log(result);</code></pre>
|
|
|
6844
6848
|
<li class="py-2"><code>faceIds: string[]</code> An array of face IDs to delete.</li>
|
|
6845
6849
|
</ul>
|
|
6846
6850
|
</div>
|
|
6851
|
+
<div class="py-5">
|
|
6852
|
+
<p class="mb-0">Return value:</p>
|
|
6853
|
+
<code>Promise<boolean></code> True on success.
|
|
6854
|
+
</div>
|
|
6847
6855
|
<!--begin::Code-->
|
|
6848
6856
|
<div class="py-5">
|
|
6849
6857
|
<!--begin::Highlight-->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-sweet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "Express framework extension.",
|
|
5
5
|
"main": "dist/build.common.js",
|
|
6
6
|
"module": "dist/build.esm.js",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/takuya-motoshima/express-sweet#readme",
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"aws-sdk": "^
|
|
68
|
+
"@aws-sdk/client-rekognition": "^3.352.0",
|
|
69
|
+
"@aws-sdk/node-http-handler": "^3.350.0",
|
|
69
70
|
"body-parser": "^1.19.0",
|
|
70
71
|
"class-transformer": "^0.2.3",
|
|
71
72
|
"class-validator": "^0.12.2",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
"uniqid": "^5.2.0"
|
|
98
99
|
},
|
|
99
100
|
"devDependencies": {
|
|
100
|
-
"@
|
|
101
|
+
"@aws-sdk/types": "^3.347.0",
|
|
101
102
|
"@types/connect-redis": "^0.0.18",
|
|
102
103
|
"@types/cookie-parser": "^1.4.2",
|
|
103
104
|
"@types/debug": "^4.1.5",
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import CollectionCreationError from './CollectionCreationError';
|
|
2
|
+
import CollectionDeletionError from './CollectionDeletionError';
|
|
3
|
+
import FaceIndexError from './FaceIndexError';
|
|
4
|
+
import MissingFaceInImageError from './MissingFaceInImageError';
|
|
5
|
+
import MultipleFacesInImageError from './MultipleFacesInImageError';
|
|
6
|
+
export { CollectionCreationError, CollectionDeletionError, FaceIndexError, MissingFaceInImageError, MultipleFacesInImageError, };
|
|
@@ -34,11 +34,11 @@ export default interface {
|
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* // The message set here can be referenced in the view as {{message}}.
|
|
37
|
-
* beforeRender: res => {
|
|
37
|
+
* beforeRender: (req, res) => {
|
|
38
38
|
* res.locals.message = 'Hello World';
|
|
39
39
|
* }
|
|
40
40
|
*
|
|
41
41
|
* @type {(res: express.Response) => void}
|
|
42
42
|
*/
|
|
43
|
-
beforeRender?: (res: express.Response) => void;
|
|
43
|
+
beforeRender?: (req: express.Request, res: express.Response) => void;
|
|
44
44
|
}
|
|
@@ -9,7 +9,7 @@ import IndexFaceDetails from '~/interfaces/IndexFaceDetails';
|
|
|
9
9
|
export default class {
|
|
10
10
|
/**
|
|
11
11
|
* Rekognition Client.
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {RekognitionClient}
|
|
13
13
|
*/
|
|
14
14
|
private client;
|
|
15
15
|
/**
|
|
@@ -21,11 +21,8 @@ export default class {
|
|
|
21
21
|
* For each face detected, the operation returns a bounding box of the face.
|
|
22
22
|
*
|
|
23
23
|
* @param {string} img Image path or Data Url or image buffer.
|
|
24
|
-
* @param {number} minConfidence The minimum confidence of the detected face.
|
|
25
|
-
*
|
|
26
|
-
* @param {boolean} withDetails If false, returns only the face bounding box.
|
|
27
|
-
* When true, returns the age group, gender, and emotion in addition to the face bounding box.
|
|
28
|
-
*
|
|
24
|
+
* @param {number} minConfidence The minimum confidence of the detected face. Faces with a confidence lower than this value will not be returned as a result.
|
|
25
|
+
* @param {boolean} withDetails If false, returns only the face bounding box.When true, returns the age group, gender, and emotion in addition to the face bounding box.
|
|
29
26
|
* @return {Promise<BoundingBox[]|FaceDetails[]>}
|
|
30
27
|
*/
|
|
31
28
|
detectFaces(img: string, minConfidence?: number, withDetails?: boolean): Promise<BoundingBox[] | FaceDetails[]>;
|
|
@@ -111,20 +108,22 @@ export default class {
|
|
|
111
108
|
*
|
|
112
109
|
* @param {string} collectionId Collection from which to remove the specific faces.
|
|
113
110
|
* @param {string[]} faceIds An array of face IDs to delete.
|
|
111
|
+
* @return {Promise<boolean>} True on success.
|
|
114
112
|
*/
|
|
115
|
-
deleteFaces(collectionId: string, faceIds: string[]): Promise<
|
|
113
|
+
deleteFaces(collectionId: string, faceIds: string[]): Promise<boolean>;
|
|
116
114
|
/**
|
|
117
115
|
* Deletes the specified collection.
|
|
118
116
|
* Note that this operation removes all faces in the collection.
|
|
119
117
|
*
|
|
120
118
|
* @param {string} collectionId ID of the collection to delete.
|
|
119
|
+
* @return {Promise<boolean>} True on success.
|
|
121
120
|
*/
|
|
122
|
-
deleteCollection(collectionId: string): Promise<
|
|
121
|
+
deleteCollection(collectionId: string): Promise<boolean>;
|
|
123
122
|
/**
|
|
124
123
|
* Returns a buffer of images.
|
|
125
124
|
*
|
|
126
125
|
* @param {string|Buffer} img Image path or Data Url or image buffer.
|
|
127
126
|
* @return {Buffer} Image buffer.
|
|
128
127
|
*/
|
|
129
|
-
private
|
|
128
|
+
private image2buffer;
|
|
130
129
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API error.
|
|
3
|
-
*/
|
|
4
|
-
export default class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* Error name.
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* HTTP status code.
|
|
12
|
-
* @type {number}
|
|
13
|
-
*/
|
|
14
|
-
statusCode: number;
|
|
15
|
-
/**
|
|
16
|
-
* Constructs a API error.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* const ApiError = require('express-sweet').exceptions.ApiError;
|
|
20
|
-
*
|
|
21
|
-
* // Throw an API error.
|
|
22
|
-
* throw new ApiError('UserNotFount', 400, 'user not found');
|
|
23
|
-
*
|
|
24
|
-
* @param {string} name Error name.
|
|
25
|
-
* @param {number} statusCode HTTP status code.
|
|
26
|
-
* @param {string} message Error message.
|
|
27
|
-
*/
|
|
28
|
-
constructor(name: string, statusCode: number, message?: string);
|
|
29
|
-
}
|