express-sweet 1.0.40 → 1.0.42
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 +72 -6
- package/INSTALL-Redis.md +65 -39
- package/README.md +7 -0
- package/dist/build.common.js +66 -19
- package/dist/build.esm.js +66 -19
- package/docs/index.html +11 -3
- package/package.json +12 -20
- package/types/database/Database.d.ts +181 -181
- package/types/database/Model.d.ts +221 -221
- package/types/database/index.d.ts +3 -4
- package/types/database/loadModels.d.ts +6 -6
- package/types/exceptions/FaceCollectionCreateFailed.d.ts +25 -25
- package/types/exceptions/FaceCollectionDeleteFailed.d.ts +25 -25
- package/types/exceptions/FaceIndexFailed.d.ts +20 -20
- package/types/exceptions/FaceMissingInPhoto.d.ts +11 -11
- package/types/exceptions/FacesMultipleInPhoto.d.ts +11 -11
- package/types/exceptions/index.d.ts +5 -6
- package/types/handlebars_helpers/comparison.d.ts +351 -351
- package/types/handlebars_helpers/date.d.ts +19 -19
- package/types/handlebars_helpers/html.d.ts +12 -12
- package/types/handlebars_helpers/index.d.ts +7 -8
- package/types/handlebars_helpers/math.d.ts +81 -81
- package/types/handlebars_helpers/number.d.ts +18 -18
- package/types/handlebars_helpers/object.d.ts +21 -21
- package/types/handlebars_helpers/string.d.ts +50 -50
- package/types/index.d.ts +7 -8
- package/types/interfaces/AuthenticationConfig.d.ts +108 -108
- package/types/interfaces/BasicConfig.d.ts +74 -74
- package/types/interfaces/BoundingBox.d.ts +25 -25
- package/types/interfaces/DatabaseConfig.d.ts +7 -7
- package/types/interfaces/FaceDetails.d.ts +30 -0
- package/types/interfaces/FaceDetailsEmotions.d.ts +40 -40
- package/types/interfaces/FaceMatch.d.ts +31 -31
- package/types/interfaces/IndexFaceDetails.d.ts +29 -0
- package/types/interfaces/RekognitionOptions.d.ts +26 -26
- package/types/interfaces/SesOptions.d.ts +27 -27
- package/types/interfaces/ViewConfig.d.ts +44 -44
- package/types/interfaces/index.d.ts +8 -9
- package/types/middlewares/Authentication.d.ts +13 -13
- package/types/middlewares/CORS.d.ts +10 -10
- package/types/middlewares/Environment.d.ts +10 -10
- package/types/middlewares/ErrorHandler.d.ts +10 -10
- package/types/middlewares/Global.d.ts +13 -13
- package/types/middlewares/Http.d.ts +10 -10
- package/types/middlewares/Local.d.ts +13 -13
- package/types/middlewares/View.d.ts +14 -14
- package/types/middlewares/index.d.ts +7 -8
- package/types/mount.d.ts +7 -7
- package/types/routing/Router.d.ts +13 -13
- package/types/routing/index.d.ts +1 -2
- package/types/services/AWSRekognitionClient.d.ts +126 -118
- package/types/services/AWSSesClient.d.ts +57 -57
- package/types/services/Authentication.d.ts +34 -34
- package/types/services/index.d.ts +3 -4
- package/types/utils/Types.d.ts +24 -24
- package/types/utils/index.d.ts +9 -12
- package/types/utils/isArray.d.ts +8 -8
- package/types/utils/isAsyncFunction.d.ts +12 -12
- package/types/utils/isFunction.d.ts +13 -13
- package/types/utils/isObject.d.ts +8 -8
- package/types/utils/isString.d.ts +8 -8
- package/types/utils/loadAuthenticationConfig.d.ts +8 -8
- package/types/utils/loadBasicConfig.d.ts +8 -8
- package/types/utils/loadDatabaseConfig.d.ts +8 -8
- package/types/utils/loadViewConfig.d.ts +8 -8
- package/types/services/RedisClient.d.ts +0 -80
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [1.0.42] - 2023/8/31
|
|
5
|
+
### Changed
|
|
6
|
+
- Update TypeScript version from 4.8.4 to 5.2.2.
|
|
7
|
+
- Update redis dependency package used for user authentication.
|
|
8
|
+
- Updated redis package version from 4.3.1 to 4.6.8.
|
|
9
|
+
[Here](https://github.com/redis/node-redis/blob/master/CHANGELOG.md) are the changes.
|
|
10
|
+
- Updated connect-redis package version from 6.1.3 to 7.1.0.
|
|
11
|
+
[Here](https://github.com/tj/connect-redis/releases) are the changes.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.41] - 2023/8/4
|
|
15
|
+
### Changed
|
|
16
|
+
- Added an option to the method that searches for faces in the collection to throw an exception if a face is not found or if multiple faces are found.
|
|
17
|
+
<table>
|
|
18
|
+
<thead>
|
|
19
|
+
<tr>
|
|
20
|
+
<th>Option</th>
|
|
21
|
+
<th>Type</th>
|
|
22
|
+
<th>Description</th>
|
|
23
|
+
</tr>
|
|
24
|
+
</thead>
|
|
25
|
+
<tbody>
|
|
26
|
+
<tr>
|
|
27
|
+
<td>throwNotFoundFaceException</td>
|
|
28
|
+
<td>boolean</td>
|
|
29
|
+
<td>If true, throws a <code>FaceMissingInPhoto</code> exception when a face is not found in the image; if false, returns null. Default is false.</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td>throwTooManyFaceException</td>
|
|
33
|
+
<td>boolean</td>
|
|
34
|
+
<td>If true, throws a <code>FacesMultipleInPhoto</code> exception when more than one face is found in the image. Default is false.</td>
|
|
35
|
+
</tr>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
```js
|
|
41
|
+
const {services: {AWSRekognitionClient}, exceptions: {FaceMissingInPhoto, FacesMultipleInPhoto}} = require('express-sweet');
|
|
42
|
+
|
|
43
|
+
// Rekognition Client.
|
|
44
|
+
const client = new AWSRekognitionClient({
|
|
45
|
+
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
46
|
+
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
47
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Find a face in the collection.
|
|
51
|
+
const collectionId = 'MyCollection';
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await client.searchFaces(collectionId, 'face.jpg', {
|
|
55
|
+
throwNotFoundFaceException: true,
|
|
56
|
+
throwTooManyFaceException: true,
|
|
57
|
+
});
|
|
58
|
+
} catch (err) {
|
|
59
|
+
if (err instanceof FaceMissingInPhoto)
|
|
60
|
+
console.log('No face was found');
|
|
61
|
+
else if (err instanceof FacesMultipleInPhoto)
|
|
62
|
+
console.log('Multiple faces were found');
|
|
63
|
+
else
|
|
64
|
+
console.log('Other errors');
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
4
68
|
## [1.0.40] - 2023/8/4
|
|
5
69
|
### Changed
|
|
6
70
|
- Fixed to return null instead of throwing an error when looking for faces in the collection using images without faces (<code>AWSRekognitionClient.searchFaces()</code>).
|
|
@@ -446,7 +510,7 @@ All notable changes to this project will be documented in this file.
|
|
|
446
510
|
|
|
447
511
|
// Create a face and get the ID of the created face.
|
|
448
512
|
// results in: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
|
|
449
|
-
const faceId = await client.indexFace(collectionId, '
|
|
513
|
+
const faceId = await client.indexFace(collectionId, 'face4.jpg');
|
|
450
514
|
console.log(faceId);
|
|
451
515
|
|
|
452
516
|
// Create a face and get the details of the created face.
|
|
@@ -465,7 +529,7 @@ All notable changes to this project will be documented in this file.
|
|
|
465
529
|
// calm: 1.5354809761047363
|
|
466
530
|
// }
|
|
467
531
|
// }
|
|
468
|
-
const faceDetails = await client.indexFace(collectionId, '
|
|
532
|
+
const faceDetails = await client.indexFace(collectionId, 'face5.jpg', {returnDetails: true});
|
|
469
533
|
console.log(faceDetails);
|
|
470
534
|
```
|
|
471
535
|
|
|
@@ -495,7 +559,7 @@ All notable changes to this project will be documented in this file.
|
|
|
495
559
|
// top: 0.11531734466552734
|
|
496
560
|
// }
|
|
497
561
|
// ]
|
|
498
|
-
let res = await client.detectFaces('
|
|
562
|
+
let res = await client.detectFaces('face.jpg');
|
|
499
563
|
console.log(res);
|
|
500
564
|
|
|
501
565
|
// Detect facial details.
|
|
@@ -523,7 +587,7 @@ All notable changes to this project will be documented in this file.
|
|
|
523
587
|
// ]
|
|
524
588
|
const minConfidence = 90;
|
|
525
589
|
const withDetails = true;
|
|
526
|
-
res = await client.detectFaces('
|
|
590
|
+
res = await client.detectFaces('face.jpg', minConfidence, withDetails);
|
|
527
591
|
console.log(res);
|
|
528
592
|
})();
|
|
529
593
|
```
|
|
@@ -684,7 +748,7 @@ All notable changes to this project will be documented in this file.
|
|
|
684
748
|
// }
|
|
685
749
|
// ]
|
|
686
750
|
const collectionId = 'MyCollection';
|
|
687
|
-
const res = await client.searchFaces(collectionId, '
|
|
751
|
+
const res = await client.searchFaces(collectionId, 'face.jpg');
|
|
688
752
|
console.log('Face search results:', res);
|
|
689
753
|
```
|
|
690
754
|
|
|
@@ -773,4 +837,6 @@ All notable changes to this project will be documented in this file.
|
|
|
773
837
|
[1.0.37]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.36...v1.0.37
|
|
774
838
|
[1.0.38]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.37...v1.0.38
|
|
775
839
|
[1.0.39]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.38...v1.0.39
|
|
776
|
-
[1.0.40]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.39...v1.0.40
|
|
840
|
+
[1.0.40]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.39...v1.0.40
|
|
841
|
+
[1.0.41]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.40...v1.0.41
|
|
842
|
+
[1.0.42]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.41...v1.0.42
|
package/INSTALL-Redis.md
CHANGED
|
@@ -1,51 +1,77 @@
|
|
|
1
1
|
# Install Redis
|
|
2
2
|
==============
|
|
3
3
|
|
|
4
|
+
## Environment for this procedure
|
|
4
5
|
* OS: `Amazon Linux 2`
|
|
5
6
|
* Redis: `v6.2.6 or later`
|
|
6
7
|
* see more: https://redis.io/download#installation
|
|
7
8
|
|
|
8
|
-
Check the version of Redis that can be installed.
|
|
9
|
-
```sh
|
|
10
|
-
amazon-linux-extras list|grep redis
|
|
11
|
-
# Below is an example of the output.
|
|
12
|
-
# 56 redis6 available [ =stable ]
|
|
13
|
-
```
|
|
14
9
|
|
|
15
|
-
Install Redis
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
## Install Redis
|
|
11
|
+
1. Check the version of Redis that can be installed.
|
|
12
|
+
```sh
|
|
13
|
+
amazon-linux-extras list|grep redis
|
|
14
|
+
# Below is an example of the output.
|
|
15
|
+
# 56 redis6 available [ =stable ]
|
|
16
|
+
```
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
sudo
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
1. Install Redis by specifying the version.
|
|
19
|
+
```sh
|
|
20
|
+
sudo amazon-linux-extras install -y redis6
|
|
21
|
+
```
|
|
22
|
+
1. Configure and start Redis autostart.
|
|
23
|
+
```sh
|
|
24
|
+
sudo systemctl status redis.service
|
|
25
|
+
sudo systemctl start redis.service
|
|
26
|
+
sudo systemctl enable redis.service
|
|
27
|
+
sudo systemctl is-enabled redis.service
|
|
28
|
+
```
|
|
29
|
+
1. Check Redis process.
|
|
30
|
+
```sh
|
|
31
|
+
ps -ef | grep redis | grep -v grep
|
|
32
|
+
# Below is an example of the output.
|
|
33
|
+
# redis 5407 1 0 11:02 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
|
|
34
|
+
```
|
|
35
|
+
1. Check Redis behavior. If "redis-cli ping" returns PONG, it is success.
|
|
36
|
+
```sh
|
|
37
|
+
redis-cli ping
|
|
38
|
+
# Below is an example of the output.
|
|
39
|
+
# PONG
|
|
40
|
+
```
|
|
41
|
+
1. Test Redis read/write.
|
|
42
|
+
```sh
|
|
43
|
+
redis-cli
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ps -ef | grep redis | grep -v grep
|
|
31
|
-
# Below is an example of the output.
|
|
32
|
-
# redis 5407 1 0 11:02 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
|
|
33
|
-
```
|
|
45
|
+
set myMessage "hello world"
|
|
46
|
+
# OK
|
|
34
47
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# Below is an example of the output.
|
|
39
|
-
# PONG
|
|
40
|
-
```
|
|
48
|
+
get myMessage
|
|
49
|
+
# "hello world"
|
|
50
|
+
```
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
## Commonly used Redis commands
|
|
53
|
+
- Start Redis CLI
|
|
54
|
+
```sh
|
|
55
|
+
redis-cli
|
|
56
|
+
```
|
|
57
|
+
- Key List
|
|
58
|
+
```sh
|
|
59
|
+
redis-cli --raw keys \*
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
or
|
|
63
|
+
```sh
|
|
64
|
+
redis-cli --scan
|
|
65
|
+
```
|
|
66
|
+
- Value List
|
|
67
|
+
```sh
|
|
68
|
+
redis-cli --raw mget $(redis-cli --scan)
|
|
69
|
+
```
|
|
70
|
+
- Key and Value List
|
|
71
|
+
```sh
|
|
72
|
+
for i in $(redis-cli keys \*); do echo $i: $(redis-cli GET $i); done
|
|
73
|
+
```
|
|
74
|
+
- Delete key
|
|
75
|
+
```sh
|
|
76
|
+
redis-cli del myMessage
|
|
77
|
+
```
|
package/README.md
CHANGED