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.
Files changed (66) hide show
  1. package/CHANGELOG.md +72 -6
  2. package/INSTALL-Redis.md +65 -39
  3. package/README.md +7 -0
  4. package/dist/build.common.js +66 -19
  5. package/dist/build.esm.js +66 -19
  6. package/docs/index.html +11 -3
  7. package/package.json +12 -20
  8. package/types/database/Database.d.ts +181 -181
  9. package/types/database/Model.d.ts +221 -221
  10. package/types/database/index.d.ts +3 -4
  11. package/types/database/loadModels.d.ts +6 -6
  12. package/types/exceptions/FaceCollectionCreateFailed.d.ts +25 -25
  13. package/types/exceptions/FaceCollectionDeleteFailed.d.ts +25 -25
  14. package/types/exceptions/FaceIndexFailed.d.ts +20 -20
  15. package/types/exceptions/FaceMissingInPhoto.d.ts +11 -11
  16. package/types/exceptions/FacesMultipleInPhoto.d.ts +11 -11
  17. package/types/exceptions/index.d.ts +5 -6
  18. package/types/handlebars_helpers/comparison.d.ts +351 -351
  19. package/types/handlebars_helpers/date.d.ts +19 -19
  20. package/types/handlebars_helpers/html.d.ts +12 -12
  21. package/types/handlebars_helpers/index.d.ts +7 -8
  22. package/types/handlebars_helpers/math.d.ts +81 -81
  23. package/types/handlebars_helpers/number.d.ts +18 -18
  24. package/types/handlebars_helpers/object.d.ts +21 -21
  25. package/types/handlebars_helpers/string.d.ts +50 -50
  26. package/types/index.d.ts +7 -8
  27. package/types/interfaces/AuthenticationConfig.d.ts +108 -108
  28. package/types/interfaces/BasicConfig.d.ts +74 -74
  29. package/types/interfaces/BoundingBox.d.ts +25 -25
  30. package/types/interfaces/DatabaseConfig.d.ts +7 -7
  31. package/types/interfaces/FaceDetails.d.ts +30 -0
  32. package/types/interfaces/FaceDetailsEmotions.d.ts +40 -40
  33. package/types/interfaces/FaceMatch.d.ts +31 -31
  34. package/types/interfaces/IndexFaceDetails.d.ts +29 -0
  35. package/types/interfaces/RekognitionOptions.d.ts +26 -26
  36. package/types/interfaces/SesOptions.d.ts +27 -27
  37. package/types/interfaces/ViewConfig.d.ts +44 -44
  38. package/types/interfaces/index.d.ts +8 -9
  39. package/types/middlewares/Authentication.d.ts +13 -13
  40. package/types/middlewares/CORS.d.ts +10 -10
  41. package/types/middlewares/Environment.d.ts +10 -10
  42. package/types/middlewares/ErrorHandler.d.ts +10 -10
  43. package/types/middlewares/Global.d.ts +13 -13
  44. package/types/middlewares/Http.d.ts +10 -10
  45. package/types/middlewares/Local.d.ts +13 -13
  46. package/types/middlewares/View.d.ts +14 -14
  47. package/types/middlewares/index.d.ts +7 -8
  48. package/types/mount.d.ts +7 -7
  49. package/types/routing/Router.d.ts +13 -13
  50. package/types/routing/index.d.ts +1 -2
  51. package/types/services/AWSRekognitionClient.d.ts +126 -118
  52. package/types/services/AWSSesClient.d.ts +57 -57
  53. package/types/services/Authentication.d.ts +34 -34
  54. package/types/services/index.d.ts +3 -4
  55. package/types/utils/Types.d.ts +24 -24
  56. package/types/utils/index.d.ts +9 -12
  57. package/types/utils/isArray.d.ts +8 -8
  58. package/types/utils/isAsyncFunction.d.ts +12 -12
  59. package/types/utils/isFunction.d.ts +13 -13
  60. package/types/utils/isObject.d.ts +8 -8
  61. package/types/utils/isString.d.ts +8 -8
  62. package/types/utils/loadAuthenticationConfig.d.ts +8 -8
  63. package/types/utils/loadBasicConfig.d.ts +8 -8
  64. package/types/utils/loadDatabaseConfig.d.ts +8 -8
  65. package/types/utils/loadViewConfig.d.ts +8 -8
  66. package/types/services/RedisClient.d.ts +0 -80
@@ -1,108 +1,108 @@
1
- import express from 'express';
2
- /**
3
- * User authentication configuration interface.
4
- */
5
- export default interface {
6
- /**
7
- * Enable user authentication, defaults to disabled (false).
8
- * @type {boolean}
9
- */
10
- enabled: boolean;
11
- /**
12
- * The session store instance, defaults to a new MemoryStore(memory) instance.
13
- * @type {'memory'|'redis'}
14
- */
15
- session_store: 'memory' | 'redis';
16
- /**
17
- * If the session is stored in "redis", this field is required and should be set to the hostname of the Redis server.
18
- * For example, to connect to redis on localhost on port 6379, set "redis://localhost:6379".
19
- * To connect to a different host or port, use a connection string in the format "redis[s]://[[username][:password]@][host][:port][/db-number]".
20
- * For example, "redis://alice:foobared@awesome.redis.server:6380".
21
- * @type {string|undefined}
22
- */
23
- redis_host?: string;
24
- /**
25
- * Authentication user ID field name, defaults to `username`.
26
- * @type {string}
27
- */
28
- username: string;
29
- /**
30
- * Authentication password field name, defaults to `password`.
31
- * @type {string}
32
- */
33
- password: string;
34
- /**
35
- * URL to redirect after successful authentication, defaults to `/`.
36
- * @type {string}
37
- */
38
- success_redirect: string;
39
- /**
40
- * URL to redirect after log off, defaults to `/login`.
41
- *
42
- * @example
43
- * // Set the URL to redirect to in case of login failure as a string.
44
- * failure_redirect: '/login',
45
- *
46
- * // Dynamically set the url to redirect to on login failure.
47
- * failure_redirect: (req, res) => {
48
- * // If the role stored in the cookie is admin, redirect to the admin login screen.
49
- * return req.cookies.role === 'admin' ? '/adminlogin' : 'login';
50
- * },
51
- *
52
- * @type {string|((req: express.Request, res: express.Response) => string)}
53
- */
54
- failure_redirect: string | ((req: express.Request, res: express.Response) => string);
55
- /**
56
- * This hook is called when authenticating a user.
57
- * Please find the user information that owns the credentials based on the user name and password you received and return it.
58
- * If the user who owns the credentials cannot be found, return null.
59
- *
60
- * Note that the user information must include an ID value that can identify the user.
61
- *
62
- * @example
63
- * authenticate_user: async (username, password, req) => {
64
- * const UserModel = require('../models/UserModel');
65
- * return UserModel.findOne({
66
- * where: {
67
- * email: username,
68
- * password
69
- * },
70
- * raw: true
71
- * });
72
- * }
73
- *
74
- * @type {(username: string, password: string, req: express.Request) => Promise<{[key: string]: any}|null>}
75
- */
76
- authenticate_user: (username: string, password: string, req: express.Request) => Promise<{
77
- [key: string]: any;
78
- } | null>;
79
- /**
80
- * This hook is called when user authentication is successful.
81
- * Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.
82
- * The returned data will be set in the req.user property and the view's session variable.
83
- *
84
- * @example
85
- * subscribe_user: async (id) => {
86
- * const UserModel = require('../models/UserModel');
87
- * return UserModel.findOne({
88
- * where: {id},
89
- * raw: true
90
- * });
91
- * }
92
- *
93
- * @type {(id: number|string) => Promise<{[key: string]: any}>}
94
- */
95
- subscribe_user: (id: number | string) => Promise<{
96
- [key: string]: any;
97
- }>;
98
- /**
99
- * URL without authentication. If the URL described in the access URL partially matches, authentication will not be performed, defaults to none.
100
- * @type {(string|RegExp)[]}
101
- */
102
- allow_unauthenticated: (string | RegExp)[];
103
- /**
104
- * Authenticated user session expiration, defaults to 24 hours (24 * 3600000).
105
- * @type {number}
106
- */
107
- expiration: number;
108
- }
1
+ import express from 'express';
2
+ /**
3
+ * User authentication configuration interface.
4
+ */
5
+ export default interface AuthenticationConfig {
6
+ /**
7
+ * Enable user authentication, defaults to disabled (false).
8
+ * @type {boolean}
9
+ */
10
+ enabled: boolean;
11
+ /**
12
+ * The session store instance, defaults to a new MemoryStore(memory) instance.
13
+ * @type {'memory'|'redis'}
14
+ */
15
+ session_store: 'memory' | 'redis';
16
+ /**
17
+ * If the session is stored in "redis", this field is required and should be set to the hostname of the Redis server.
18
+ * For example, to connect to redis on localhost on port 6379, set "redis://localhost:6379".
19
+ * To connect to a different host or port, use a connection string in the format "redis[s]://[[username][:password]@][host][:port][/db-number]".
20
+ * For example, "redis://alice:foobared@awesome.redis.server:6380".
21
+ * @type {string|undefined}
22
+ */
23
+ redis_host?: string;
24
+ /**
25
+ * Authentication user ID field name, defaults to `username`.
26
+ * @type {string}
27
+ */
28
+ username: string;
29
+ /**
30
+ * Authentication password field name, defaults to `password`.
31
+ * @type {string}
32
+ */
33
+ password: string;
34
+ /**
35
+ * URL to redirect after successful authentication, defaults to `/`.
36
+ * @type {string}
37
+ */
38
+ success_redirect: string;
39
+ /**
40
+ * URL to redirect after log off, defaults to `/login`.
41
+ *
42
+ * @example
43
+ * // Set the URL to redirect to in case of login failure as a string.
44
+ * failure_redirect: '/login',
45
+ *
46
+ * // Dynamically set the url to redirect to on login failure.
47
+ * failure_redirect: (req, res) => {
48
+ * // If the role stored in the cookie is admin, redirect to the admin login screen.
49
+ * return req.cookies.role === 'admin' ? '/adminlogin' : 'login';
50
+ * },
51
+ *
52
+ * @type {string|((req: express.Request, res: express.Response) => string)}
53
+ */
54
+ failure_redirect: string | ((req: express.Request, res: express.Response) => string);
55
+ /**
56
+ * This hook is called when authenticating a user.
57
+ * Please find the user information that owns the credentials based on the user name and password you received and return it.
58
+ * If the user who owns the credentials cannot be found, return null.
59
+ *
60
+ * Note that the user information must include an ID value that can identify the user.
61
+ *
62
+ * @example
63
+ * authenticate_user: async (username, password, req) => {
64
+ * const UserModel = require('../models/UserModel');
65
+ * return UserModel.findOne({
66
+ * where: {
67
+ * email: username,
68
+ * password
69
+ * },
70
+ * raw: true
71
+ * });
72
+ * }
73
+ *
74
+ * @type {(username: string, password: string, req: express.Request) => Promise<{[key: string]: any}|null>}
75
+ */
76
+ authenticate_user: (username: string, password: string, req: express.Request) => Promise<{
77
+ [key: string]: any;
78
+ } | null>;
79
+ /**
80
+ * This hook is called when user authentication is successful.
81
+ * Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.
82
+ * The returned data will be set in the req.user property and the view's session variable.
83
+ *
84
+ * @example
85
+ * subscribe_user: async (id) => {
86
+ * const UserModel = require('../models/UserModel');
87
+ * return UserModel.findOne({
88
+ * where: {id},
89
+ * raw: true
90
+ * });
91
+ * }
92
+ *
93
+ * @type {(id: number|string) => Promise<{[key: string]: any}>}
94
+ */
95
+ subscribe_user: (id: number | string) => Promise<{
96
+ [key: string]: any;
97
+ }>;
98
+ /**
99
+ * URL without authentication. If the URL described in the access URL partially matches, authentication will not be performed, defaults to none.
100
+ * @type {(string|RegExp)[]}
101
+ */
102
+ allow_unauthenticated: (string | RegExp)[];
103
+ /**
104
+ * Authenticated user session expiration, defaults to 24 hours (24 * 3600000).
105
+ * @type {number}
106
+ */
107
+ expiration: number;
108
+ }
@@ -1,74 +1,74 @@
1
- import express from 'express';
2
- /**
3
- * Express Sweet basic configuration interface.
4
- */
5
- export default interface {
6
- /**
7
- * Environment variable file (.env) path, defaults to none (undefined).
8
- * @type {string}
9
- */
10
- env_path?: string;
11
- /**
12
- * CORS permission, defaults to invalid (false).
13
- * @type {{enabled: boolean}}
14
- */
15
- cors_enabled?: boolean;
16
- /**
17
- * Maximum body size you can request, defaults to `100kb`.
18
- * @type {string|number}
19
- */
20
- max_body_size?: string | number;
21
- /**
22
- * Absolute path to the router directory, defaults to `<application root directory>/routes`.
23
- * @type {string}
24
- */
25
- router_dir?: string;
26
- /**
27
- * The endpoint to run when the root URL is requested, defaults to none (undefined).
28
- * @type {string}
29
- */
30
- default_router?: string;
31
- /**
32
- * This is a hook that rewrites the base URL.
33
- * If you want to rewrite the app.locals.baseUrl property and the view's baseUrl variable, use this hook to return a new base URL.
34
- * The default value is the referrer's origin (eg https://example.com).
35
- *
36
- * @example
37
- * rewrite_base_url: baseUrl => {
38
- * return `${baseUrl}/admin`;
39
- * }
40
- *
41
- * @type {(baseUrl: string): string}
42
- */
43
- rewrite_base_url?: (baseUrl: string) => string;
44
- /**
45
- * How to determine if it is an ajax request.
46
- * The default is that if there is an XMLHttpRequest in the request header (req.xhr) returns true.
47
- * 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)".
48
- *
49
- * @type {(req: express.Request) => boolean}
50
- * @example
51
- * is_ajax: req => {
52
- * // If the request URL begins with /api, it is assumed to be Ajax.
53
- * return /^\/api/.test(req.path);
54
- * // return !!req.xhr;
55
- * }
56
- */
57
- is_ajax: (req: express.Request) => boolean;
58
- /**
59
- * Hooks the default behavior on request errors.
60
- * If unset, simply returns an error HTTP status. (<code>res.status(err.status||500).end();</code>)
61
- *
62
- * @type {(err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void}
63
- * @example
64
- * hook_handle_error: (err, req, res, next) => {
65
- * if (err.status === 404)
66
- * // If the URL cannot be found, a 404 error screen (views/error-404.hbs) is displayed.
67
- * res.render('error-404');
68
- * else
69
- * // For other errors, unknown error screen (views/error-unknown.hbs) is displayed.
70
- * res.render('error-unknown');
71
- * },
72
- */
73
- hook_handle_error?: (err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void;
74
- }
1
+ import express from 'express';
2
+ /**
3
+ * Express Sweet basic configuration interface.
4
+ */
5
+ export default interface BasicConfig {
6
+ /**
7
+ * Environment variable file (.env) path, defaults to none (undefined).
8
+ * @type {string}
9
+ */
10
+ env_path?: string;
11
+ /**
12
+ * CORS permission, defaults to invalid (false).
13
+ * @type {{enabled: boolean}}
14
+ */
15
+ cors_enabled?: boolean;
16
+ /**
17
+ * Maximum body size you can request, defaults to `100kb`.
18
+ * @type {string|number}
19
+ */
20
+ max_body_size?: string | number;
21
+ /**
22
+ * Absolute path to the router directory, defaults to `<application root directory>/routes`.
23
+ * @type {string}
24
+ */
25
+ router_dir?: string;
26
+ /**
27
+ * The endpoint to run when the root URL is requested, defaults to none (undefined).
28
+ * @type {string}
29
+ */
30
+ default_router?: string;
31
+ /**
32
+ * This is a hook that rewrites the base URL.
33
+ * If you want to rewrite the app.locals.baseUrl property and the view's baseUrl variable, use this hook to return a new base URL.
34
+ * The default value is the referrer's origin (eg https://example.com).
35
+ *
36
+ * @example
37
+ * rewrite_base_url: baseUrl => {
38
+ * return `${baseUrl}/admin`;
39
+ * }
40
+ *
41
+ * @type {(baseUrl: string): string}
42
+ */
43
+ rewrite_base_url?: (baseUrl: string) => string;
44
+ /**
45
+ * How to determine if it is an ajax request.
46
+ * The default is that if there is an XMLHttpRequest in the request header (req.xhr) returns true.
47
+ * 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)".
48
+ *
49
+ * @type {(req: express.Request) => boolean}
50
+ * @example
51
+ * is_ajax: req => {
52
+ * // If the request URL begins with /api, it is assumed to be Ajax.
53
+ * return /^\/api/.test(req.path);
54
+ * // return !!req.xhr;
55
+ * }
56
+ */
57
+ is_ajax: (req: express.Request) => boolean;
58
+ /**
59
+ * Hooks the default behavior on request errors.
60
+ * If unset, simply returns an error HTTP status. (<code>res.status(err.status||500).end();</code>)
61
+ *
62
+ * @type {(err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void}
63
+ * @example
64
+ * hook_handle_error: (err, req, res, next) => {
65
+ * if (err.status === 404)
66
+ * // If the URL cannot be found, a 404 error screen (views/error-404.hbs) is displayed.
67
+ * res.render('error-404');
68
+ * else
69
+ * // For other errors, unknown error screen (views/error-unknown.hbs) is displayed.
70
+ * res.render('error-unknown');
71
+ * },
72
+ */
73
+ hook_handle_error?: (err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void;
74
+ }
@@ -1,25 +1,25 @@
1
- /**
2
- * Bounding box of the face.
3
- */
4
- export default interface {
5
- /**
6
- * The width of the bounding box.
7
- * @type {number}
8
- */
9
- width: number;
10
- /**
11
- * The height of the bounding box.
12
- * @type {number}
13
- */
14
- height: number;
15
- /**
16
- * The x coordinate of the bounding box with the origin (0,0) in the upper left corner.
17
- * @type {number}
18
- */
19
- left: number;
20
- /**
21
- * The y coordinate of the bounding box with the origin (0,0) in the upper left corner.
22
- * @type {number}
23
- */
24
- top: number;
25
- }
1
+ /**
2
+ * Bounding box of the face.
3
+ */
4
+ export default interface BoundingBox {
5
+ /**
6
+ * The width of the bounding box.
7
+ * @type {number}
8
+ */
9
+ width: number;
10
+ /**
11
+ * The height of the bounding box.
12
+ * @type {number}
13
+ */
14
+ height: number;
15
+ /**
16
+ * The x coordinate of the bounding box with the origin (0,0) in the upper left corner.
17
+ * @type {number}
18
+ */
19
+ left: number;
20
+ /**
21
+ * The y coordinate of the bounding box with the origin (0,0) in the upper left corner.
22
+ * @type {number}
23
+ */
24
+ top: number;
25
+ }
@@ -1,7 +1,7 @@
1
- import sequelize from 'sequelize';
2
- /**
3
- * Database configuration.
4
- */
5
- export default interface {
6
- [key: string]: sequelize.Options;
7
- }
1
+ import sequelize from 'sequelize';
2
+ /**
3
+ * Database configuration.
4
+ */
5
+ export default interface DatabaseConfig {
6
+ [key: string]: sequelize.Options;
7
+ }
@@ -0,0 +1,30 @@
1
+ import BoundingBox from '~/interfaces/BoundingBox';
2
+ import FaceDetailsEmotions from '~/interfaces/FaceDetailsEmotions';
3
+ /**
4
+ * Details of each face found in the image.
5
+ */
6
+ export default interface FaceDetails {
7
+ /**
8
+ * Bounding box of the face.
9
+ * @type {BoundingBox}
10
+ */
11
+ boundingBox: BoundingBox;
12
+ /**
13
+ * The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.
14
+ * @type {{high: number, low: number}}
15
+ */
16
+ ageRange?: {
17
+ high: number;
18
+ low: number;
19
+ };
20
+ /**
21
+ * The predicted gender of a detected face.
22
+ * @type {'male'|'female'}
23
+ */
24
+ gender?: 'male' | 'female';
25
+ /**
26
+ * The emotions that appear to be expressed on the face, and the confidence level in the determination.
27
+ * @type {FaceDetailsEmotions}
28
+ */
29
+ emotions?: FaceDetailsEmotions;
30
+ }
@@ -1,40 +1,40 @@
1
- /**
2
- * The emotions that appear to be expressed on the face, and the confidence level in the determination.
3
- */
4
- export default interface {
5
- /**
6
- * Confidence level of "disgusted" predicted from the face.
7
- * @type {number}
8
- */
9
- disgusted: number;
10
- /**
11
- * Confidence level of "happy" predicted from the face.
12
- * @type {number}
13
- */
14
- happy: number;
15
- /**
16
- * Confidence level of "surprised" predicted from the face.
17
- * @type {number}
18
- */
19
- surprised: number;
20
- /**
21
- * Confidence level of "angry" predicted from the face.
22
- * @type {number}
23
- */
24
- angry: number;
25
- /**
26
- * Confidence level of "confused" predicted from the face.
27
- * @type {number}
28
- */
29
- confused: number;
30
- /**
31
- * Confidence level of "calm" predicted from the face.
32
- * @type {number}
33
- */
34
- calm: number;
35
- /**
36
- * Confidence level of "sad" predicted from the face.
37
- * @type {number}
38
- */
39
- sad: number;
40
- }
1
+ /**
2
+ * The emotions that appear to be expressed on the face, and the confidence level in the determination.
3
+ */
4
+ export default interface FaceDetailsEmotions {
5
+ /**
6
+ * Confidence level of "disgusted" predicted from the face.
7
+ * @type {number}
8
+ */
9
+ disgusted: number;
10
+ /**
11
+ * Confidence level of "happy" predicted from the face.
12
+ * @type {number}
13
+ */
14
+ happy: number;
15
+ /**
16
+ * Confidence level of "surprised" predicted from the face.
17
+ * @type {number}
18
+ */
19
+ surprised: number;
20
+ /**
21
+ * Confidence level of "angry" predicted from the face.
22
+ * @type {number}
23
+ */
24
+ angry: number;
25
+ /**
26
+ * Confidence level of "confused" predicted from the face.
27
+ * @type {number}
28
+ */
29
+ confused: number;
30
+ /**
31
+ * Confidence level of "calm" predicted from the face.
32
+ * @type {number}
33
+ */
34
+ calm: number;
35
+ /**
36
+ * Confidence level of "sad" predicted from the face.
37
+ * @type {number}
38
+ */
39
+ sad: number;
40
+ }
@@ -1,31 +1,31 @@
1
- import BoundingBox from '~/interfaces/BoundingBox';
2
- /**
3
- * This is the metadata structure of the bounding box coordinates, reliability (the bounding box contains a face), face ID, etc. returned by the searchFaces(), listFaces() methods, etc.
4
- */
5
- export default interface {
6
- /**
7
- * A unique identifier assigned to the face.
8
- * @type {string}
9
- */
10
- faceId: string;
11
- /**
12
- * Bounding box of the face.
13
- * width : Width of the bounding box as a ratio of the overall image width.
14
- * height : Height of the bounding box as a ratio of the overall image height.
15
- * left : Left coordinate of the bounding box as a ratio of overall image width.
16
- * top : Top coordinate of the bounding box as a ratio of overall image height.
17
- * @type {BoundingBox}
18
- */
19
- boundingBox: BoundingBox;
20
- /**
21
- * Identifier that you assign to all the faces in the input image.
22
- * @type {string}
23
- */
24
- externalImageId?: string;
25
- /**
26
- * Confidence in the match of this face with the input face.
27
- * Valid Range: Minimum value of 0. Maximum value of 100.
28
- * @type {number}
29
- */
30
- similarity?: number;
31
- }
1
+ import BoundingBox from '~/interfaces/BoundingBox';
2
+ /**
3
+ * This is the metadata structure of the bounding box coordinates, reliability (the bounding box contains a face), face ID, etc. returned by the searchFaces(), listFaces() methods, etc.
4
+ */
5
+ export default interface FaceMatch {
6
+ /**
7
+ * A unique identifier assigned to the face.
8
+ * @type {string}
9
+ */
10
+ faceId: string;
11
+ /**
12
+ * Bounding box of the face.
13
+ * width : Width of the bounding box as a ratio of the overall image width.
14
+ * height : Height of the bounding box as a ratio of the overall image height.
15
+ * left : Left coordinate of the bounding box as a ratio of overall image width.
16
+ * top : Top coordinate of the bounding box as a ratio of overall image height.
17
+ * @type {BoundingBox}
18
+ */
19
+ boundingBox: BoundingBox;
20
+ /**
21
+ * Identifier that you assign to all the faces in the input image.
22
+ * @type {string}
23
+ */
24
+ externalImageId?: string;
25
+ /**
26
+ * Confidence in the match of this face with the input face.
27
+ * Valid Range: Minimum value of 0. Maximum value of 100.
28
+ * @type {number}
29
+ */
30
+ similarity?: number;
31
+ }
@@ -0,0 +1,29 @@
1
+ import FaceDetailsEmotions from '~/interfaces/FaceDetailsEmotions';
2
+ /**
3
+ * Detail of indexed face.
4
+ */
5
+ export default interface IndexFaceDetails {
6
+ /**
7
+ * A unique identifier assigned to the face.
8
+ * @type {string}
9
+ */
10
+ faceId: string;
11
+ /**
12
+ * The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.
13
+ * @type {{high: number, low: number}}
14
+ */
15
+ ageRange: {
16
+ high: number;
17
+ low: number;
18
+ };
19
+ /**
20
+ * The predicted gender of a detected face.
21
+ * @type {'male'|'female'}
22
+ */
23
+ gender: 'male' | 'female';
24
+ /**
25
+ * The emotions that appear to be expressed on the face, and the confidence level in the determination.
26
+ * @type {FaceDetailsEmotions}
27
+ */
28
+ emotions: FaceDetailsEmotions;
29
+ }