express-sweet 1.0.10 → 1.0.14
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 +91 -1
- package/README.md +9 -38
- package/dist/build.common.js +2 -2
- package/dist/build.esm.js +3 -3
- package/docs/index.html +3288 -4092
- package/docs/styles/docs.css +18 -62
- package/package.json +1 -1
- package/types/database/Model.d.ts +81 -18
- package/types/handlebars_helpers/comparison.d.ts +48 -7
- 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/docs/styles/docs.css
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
line-height: 1.0;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
body {
|
|
8
|
-
font-size: 13px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
.topnav {
|
|
12
8
|
padding: .75rem 0;
|
|
13
|
-
background-color:
|
|
9
|
+
background-color: hsl(202deg, 100%, 39%);
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
.topnav .navbar-toggler {
|
|
@@ -28,10 +24,22 @@ body {
|
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
.topnav .navbar-nav-svg {
|
|
31
|
-
width:
|
|
32
|
-
height:
|
|
27
|
+
width: 1.5rem;
|
|
28
|
+
height: 1.5rem
|
|
33
29
|
}
|
|
34
30
|
|
|
31
|
+
.min-w-150px {
|
|
32
|
+
min-width: 150px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.min-w-200px {
|
|
36
|
+
min-width: 200px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.min-w-300px {
|
|
40
|
+
min-width: 300px;
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
ul li,
|
|
36
44
|
ol li {
|
|
37
45
|
margin-bottom: .25rem
|
|
@@ -50,18 +58,6 @@ table {
|
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
table.summary tbody td:nth-child(1) {
|
|
54
|
-
min-width: 150px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
table.summary tbody td:nth-last-child(1) {
|
|
58
|
-
min-width: 200px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
th {
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
61
|
.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5, h6 {
|
|
66
62
|
line-height: unset;
|
|
67
63
|
}
|
|
@@ -131,20 +127,14 @@ h4 {
|
|
|
131
127
|
margin-top: .125rem;
|
|
132
128
|
margin-left: 1.25rem;
|
|
133
129
|
width: fit-content;
|
|
134
|
-
color:
|
|
130
|
+
color: hsl(202deg, 100%, 20%);
|
|
135
131
|
text-decoration: none;
|
|
136
132
|
}
|
|
137
133
|
|
|
138
134
|
.sidenav a:hover,
|
|
139
|
-
.sidenav a:focus {
|
|
140
|
-
color: rgba(0,0,0,0.85);
|
|
141
|
-
background-color: rgba(121,82,179,0.1);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
135
|
.sidenav .nav-link.active {
|
|
145
136
|
font-weight: 600;
|
|
146
|
-
color: #
|
|
147
|
-
/* color: #0d6efd; */
|
|
137
|
+
color: #0d6efd;
|
|
148
138
|
background-color: transparent;
|
|
149
139
|
}
|
|
150
140
|
|
|
@@ -265,46 +255,12 @@ h4 {
|
|
|
265
255
|
margin-bottom: 0
|
|
266
256
|
}
|
|
267
257
|
|
|
268
|
-
.callout code {
|
|
269
|
-
border-radius: .25rem
|
|
270
|
-
}
|
|
271
|
-
|
|
272
258
|
.callout+.callout {
|
|
273
259
|
margin-top: -.25rem
|
|
274
260
|
}
|
|
275
261
|
|
|
276
|
-
code:not(.hljs),
|
|
277
|
-
.code {
|
|
278
|
-
/* font-family: Source Code Pro,Consolas,Liberation Mono,Menlo,Courier,monospace; */
|
|
279
|
-
font-size: 1em;
|
|
280
|
-
color: #d63384;
|
|
281
|
-
word-wrap: break-word;
|
|
282
|
-
font-style: normal;
|
|
283
|
-
background-color: rgba(70,94,105,.05);
|
|
284
|
-
text-shadow: 0 1px 0 hsl(0deg 0% 100% / 60%);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.method,
|
|
288
|
-
.member {
|
|
289
|
-
padding: 6px 10px;
|
|
290
|
-
width: fit-content;
|
|
291
|
-
background: #E8F4FF;
|
|
292
|
-
color: #212529;
|
|
293
|
-
font-size: 1.1rem;
|
|
294
|
-
font-family: Monaco, Consolas, Courier, monospace;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
262
|
.hljs {
|
|
298
|
-
|
|
299
|
-
background: #2e2e42;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.hljs-comment {
|
|
303
|
-
color: #9e8f9e;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.text-primary {
|
|
307
|
-
color: #b66dff !important;
|
|
263
|
+
background: #f8f9fa;
|
|
308
264
|
}
|
|
309
265
|
|
|
310
266
|
.example {
|
package/package.json
CHANGED
|
@@ -17,11 +17,22 @@ export default class Model extends sequelize.Model {
|
|
|
17
17
|
protected static attributes: sequelize.ModelAttributes;
|
|
18
18
|
/**
|
|
19
19
|
* Column type.
|
|
20
|
+
*
|
|
21
|
+
* @see https://sequelize.org/master/variable/index.html#static-variable-DataTypes
|
|
20
22
|
* @type {sequelize.DataTypes}
|
|
21
23
|
*/
|
|
22
24
|
static readonly DataTypes: {
|
|
23
25
|
[key: string]: any;
|
|
24
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* An enum of query types used by sequelize.query
|
|
29
|
+
*
|
|
30
|
+
* @see https://sequelize.org/master/variable/index.html#static-variable-QueryTypes
|
|
31
|
+
* @type {sequelize.QueryTypes}
|
|
32
|
+
*/
|
|
33
|
+
static readonly QueryTypes: {
|
|
34
|
+
[key: string]: string;
|
|
35
|
+
};
|
|
25
36
|
/**
|
|
26
37
|
* Operator.
|
|
27
38
|
*
|
|
@@ -29,8 +40,8 @@ export default class Model extends sequelize.Model {
|
|
|
29
40
|
* // Sequelize provides several operators.
|
|
30
41
|
* Post.findAll({
|
|
31
42
|
* where: {
|
|
32
|
-
* [this.Op.and]: [{
|
|
33
|
-
* [this.Op.or]: [{
|
|
43
|
+
* [this.Op.and]: [{a: 5}, {b: 6}], // (a = 5) AND (b = 6)
|
|
44
|
+
* [this.Op.or]: [{a: 5}, {b: 6}], // (a = 5) OR (b = 6)
|
|
34
45
|
* someAttribute: {
|
|
35
46
|
* // Basics
|
|
36
47
|
* [this.Op.eq]: 3, // = 3
|
|
@@ -67,7 +78,7 @@ export default class Model extends sequelize.Model {
|
|
|
67
78
|
* [this.Op.notIRegexp]: '^[h|a|t]', // !~* '^[h|a|t]' (PG only)
|
|
68
79
|
* [this.Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only)
|
|
69
80
|
* // In Postgres, this.Op.like/this.Op.iLike/this.Op.notLike can be combined to this.Op.any:
|
|
70
|
-
* [this.Op.like]: {
|
|
81
|
+
* [this.Op.like]: {[this.Op.any]: ['cat', 'hat']} // LIKE ANY ARRAY['cat', 'hat']
|
|
71
82
|
* // There are more postgres-only range operators, see below
|
|
72
83
|
* }
|
|
73
84
|
* }
|
|
@@ -111,6 +122,20 @@ export default class Model extends sequelize.Model {
|
|
|
111
122
|
* @type {sequelize.where}
|
|
112
123
|
*/
|
|
113
124
|
static readonly where: (attr: sequelize.AttributeType, comparator: string, logic: sequelize.LogicType) => sequelize.Utils.Where;
|
|
125
|
+
/**
|
|
126
|
+
* Reference to sequelize.Transaction.
|
|
127
|
+
* This includes properties such as isolation level enums used with the transaction option.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* BookModel.Transaction.ISOLATION_LEVELS.READ_UNCOMMITTED // "READ UNCOMMITTED"
|
|
131
|
+
* BookModel.Transaction.ISOLATION_LEVELS.READ_COMMITTED // "READ COMMITTED"
|
|
132
|
+
* BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ // "REPEATABLE READ"
|
|
133
|
+
* BookModel.Transaction.ISOLATION_LEVELS.SERIALIZABLE // "SERIALIZABLE"
|
|
134
|
+
*
|
|
135
|
+
* @see https://sequelize.org/master/class/lib/transaction.js~Transaction.html
|
|
136
|
+
* @type {sequelize.Transaction}
|
|
137
|
+
*/
|
|
138
|
+
static readonly Transaction: (typeof sequelize.Transaction);
|
|
114
139
|
/**
|
|
115
140
|
* Initialize the model that represents the table in the DB with attributes and options.
|
|
116
141
|
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
@@ -131,28 +156,66 @@ export default class Model extends sequelize.Model {
|
|
|
131
156
|
* Starts a transaction and returns a transaction object to identify the running transaction.
|
|
132
157
|
*
|
|
133
158
|
* @example
|
|
134
|
-
* //
|
|
135
|
-
*
|
|
159
|
+
* // Simple transaction usage example.
|
|
160
|
+
* let transaction;
|
|
161
|
+
* try {
|
|
162
|
+
* transaction = await BookModel.begin();
|
|
163
|
+
* const book = await BookModel.create({title: 'When Im Gone'}, {transaction});
|
|
164
|
+
* await transaction.commit();
|
|
165
|
+
* } catch(error) {
|
|
166
|
+
* if (transaction)
|
|
167
|
+
* await transaction.rollback();
|
|
168
|
+
* }
|
|
136
169
|
*
|
|
170
|
+
* // You can also use transaction options.
|
|
171
|
+
* let transaction;
|
|
137
172
|
* try {
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* }
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
173
|
+
* transaction = await BookModel.begin({
|
|
174
|
+
* isolationLevel: BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ,
|
|
175
|
+
* type: BookModel.Transaction.TYPES.DEFERRED,
|
|
176
|
+
* });
|
|
177
|
+
* const book = await BookModel.findOne({where: {id: 1}}, {transaction});
|
|
178
|
+
* book.title = 'When Im Gone';
|
|
179
|
+
* await book.save({transaction});
|
|
180
|
+
* await transaction.commit();
|
|
181
|
+
*
|
|
182
|
+
* // Check the update result.
|
|
183
|
+
* // Output: New title of book: When Im Gone
|
|
184
|
+
* await book.reload();
|
|
185
|
+
* console.log(`New title of book: ${book.title}`);
|
|
186
|
+
* } catch (err) {
|
|
187
|
+
* if (transaction)
|
|
188
|
+
* await transaction.rollback();
|
|
148
189
|
* }
|
|
149
|
-
* @see https://sequelize.org/master/manual/transactions.html
|
|
150
190
|
*
|
|
151
|
-
* @
|
|
191
|
+
* @see https://sequelize.org/master/manual/transactions.html
|
|
192
|
+
* @param {sequelize.TransactionOptions} opts? Options provided when the transaction is created.
|
|
193
|
+
* @return {Promise<sequelize.Transaction>} Returns a transaction object to identify the transaction being executed.
|
|
152
194
|
*/
|
|
153
|
-
static begin(): Promise<sequelize.Transaction>;
|
|
195
|
+
static begin(opts?: sequelize.TransactionOptions): Promise<sequelize.Transaction>;
|
|
154
196
|
/**
|
|
155
197
|
* Returns data that matches the ID.
|
|
156
198
|
*/
|
|
157
199
|
static findById(id: number): Promise<{} | null>;
|
|
200
|
+
/**
|
|
201
|
+
* Raw Queries.
|
|
202
|
+
* 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.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
|
|
206
|
+
* // Note that since this is a raw query, the metadata are dialect specific.
|
|
207
|
+
* const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
|
|
208
|
+
*
|
|
209
|
+
* // 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:
|
|
210
|
+
* // We didn't need to destructure the result here - the results were returned directly
|
|
211
|
+
* const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
|
|
212
|
+
*
|
|
213
|
+
* @see https://sequelize.org/master/manual/raw-queries.html
|
|
214
|
+
*
|
|
215
|
+
* @param {string} sql SQL string.
|
|
216
|
+
* @param {object} opts Query options.
|
|
217
|
+
* @return {Promise<any>} By default, the function will return two arguments: an array of results, and a metadata object, containing number of affected rows etc.
|
|
218
|
+
* If you are running a type of query where you don't need the metadata, for example a SELECT query, you can pass in a query type to make sequelize format the results:
|
|
219
|
+
*/
|
|
220
|
+
static query(sql: string, opts: sequelize.QueryOptionsWithType<sequelize.QueryTypes.UPDATE> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.BULKUPDATE> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.INSERT> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.UPSERT> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.DELETE> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.BULKDELETE> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.SHOWTABLES> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.DESCRIBE> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.SELECT> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.SELECT> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.RAW> | sequelize.QueryOptionsWithType<sequelize.QueryTypes.RAW>): Promise<any>;
|
|
158
221
|
}
|
|
@@ -153,20 +153,61 @@ export declare function not(expression: any): boolean;
|
|
|
153
153
|
*/
|
|
154
154
|
export declare function ifx(condition: boolean, value1: any, value2: any): any;
|
|
155
155
|
/**
|
|
156
|
-
* Check if
|
|
156
|
+
* Check if it is empty.
|
|
157
|
+
* If the value is an array, returns true if there are no elements.
|
|
158
|
+
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
157
159
|
*
|
|
158
160
|
* @example
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
+
* // If the value is an array.
|
|
162
|
+
* let value = [5, 6];
|
|
163
|
+
* {{empty value}} => false
|
|
161
164
|
*
|
|
162
|
-
* {{#if (empty
|
|
165
|
+
* {{#if (empty value)}}
|
|
163
166
|
* Hello
|
|
164
167
|
* {{/if}}
|
|
165
168
|
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
169
|
+
* // If the value is a string.
|
|
170
|
+
* let value = 'Hello';
|
|
171
|
+
* {{empty value}} => false
|
|
172
|
+
*
|
|
173
|
+
* let value = '';
|
|
174
|
+
* {{empty value}} => true
|
|
175
|
+
*
|
|
176
|
+
* let value = ' ';
|
|
177
|
+
* {{empty value}} => true
|
|
178
|
+
*
|
|
179
|
+
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
180
|
+
* @returns {boolean} Returns true if the value is empty, false otherwise.
|
|
181
|
+
*/
|
|
182
|
+
export declare function empty(value: any): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Check that it is not empty.
|
|
185
|
+
* If the value is an array, returns true if there is an element.
|
|
186
|
+
* If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* // If the value is an array.
|
|
190
|
+
* let value = [5, 6];
|
|
191
|
+
* {{not_empty value}} => true
|
|
192
|
+
*
|
|
193
|
+
* {{#if (not_empty value)}}
|
|
194
|
+
* Hello
|
|
195
|
+
* {{/if}}
|
|
196
|
+
*
|
|
197
|
+
* // If the value is a string.
|
|
198
|
+
* let value = 'Hello';
|
|
199
|
+
* {{not_empty value}} => true
|
|
200
|
+
*
|
|
201
|
+
* let value = '';
|
|
202
|
+
* {{not_empty value}} => false
|
|
203
|
+
*
|
|
204
|
+
* let value = ' ';
|
|
205
|
+
* {{not_empty value}} => false
|
|
206
|
+
*
|
|
207
|
+
* @param {any} value Character strings, arrays, objects, etc. to be checked.
|
|
208
|
+
* @returns {boolean} Returns true if the value is not empty, false otherwise.
|
|
168
209
|
*/
|
|
169
|
-
export declare function
|
|
210
|
+
export declare function not_empty(value: any): boolean;
|
|
170
211
|
/**
|
|
171
212
|
* Determine the length of an array.
|
|
172
213
|
*
|
|
@@ -13,7 +13,7 @@ export default class {
|
|
|
13
13
|
/**
|
|
14
14
|
* Constructs a rekognition client object.
|
|
15
15
|
*/
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(opts: RekognitionOptions);
|
|
17
17
|
/**
|
|
18
18
|
* Detects faces within an image that is provided as input.
|
|
19
19
|
* For each face detected, the operation returns a bounding box of the face.
|
|
@@ -100,11 +100,11 @@ export default class {
|
|
|
100
100
|
* try {
|
|
101
101
|
* // Creates a collection.
|
|
102
102
|
* await client.createCollection('MyCollection');
|
|
103
|
-
* } catch
|
|
103
|
+
* } catch(err) {
|
|
104
104
|
* // You can get the resulting HTTP status code from the exception.
|
|
105
|
-
* console.log(`name: ${
|
|
106
|
-
* console.log(`statusCode: ${
|
|
107
|
-
* console.log(`message: ${
|
|
105
|
+
* console.log(`name: ${err.name}`);
|
|
106
|
+
* console.log(`statusCode: ${err.statusCode}`);
|
|
107
|
+
* console.log(`message: ${err.message}`);
|
|
108
108
|
* }
|
|
109
109
|
*
|
|
110
110
|
* @param {string} collectionId ID for the collection that you are creating.
|
|
@@ -175,11 +175,11 @@ export default class {
|
|
|
175
175
|
* // message: No face was found in the image
|
|
176
176
|
* try {
|
|
177
177
|
* await client.indexFace('MyCollection', 'img.jpg');
|
|
178
|
-
* } catch
|
|
178
|
+
* } catch(err) {
|
|
179
179
|
* // You can get the resulting HTTP status code from the exception.
|
|
180
|
-
* console.log(`name: ${
|
|
181
|
-
* console.log(`statusCode: ${
|
|
182
|
-
* console.log(`message: ${
|
|
180
|
+
* console.log(`name: ${err.name}`);
|
|
181
|
+
* console.log(`statusCode: ${err.statusCode}`);
|
|
182
|
+
* console.log(`message: ${err.message}`);
|
|
183
183
|
* }
|
|
184
184
|
*
|
|
185
185
|
* // If multiple faces are found in the image, throw an error.
|
|
@@ -188,11 +188,11 @@ export default class {
|
|
|
188
188
|
* // message: Multiple faces found in the image
|
|
189
189
|
* try {
|
|
190
190
|
* await client.indexFace('MyCollection', 'img.jpg');
|
|
191
|
-
* } catch
|
|
191
|
+
* } catch(err) {
|
|
192
192
|
* // You can get the resulting HTTP status code from the exception.
|
|
193
|
-
* console.log(`name: ${
|
|
194
|
-
* console.log(`statusCode: ${
|
|
195
|
-
* console.log(`message: ${
|
|
193
|
+
* console.log(`name: ${err.name}`);
|
|
194
|
+
* console.log(`statusCode: ${err.statusCode}`);
|
|
195
|
+
* console.log(`message: ${err.message}`);
|
|
196
196
|
* }
|
|
197
197
|
*
|
|
198
198
|
* @param {string} collectionId The ID of an existing collection to which you want to add the faces that are detected in the input images.
|
|
@@ -268,7 +268,7 @@ export default class {
|
|
|
268
268
|
* If options.maxFaces is 2 or more, the list of face information found is returned.
|
|
269
269
|
* Returns null if no face is found.
|
|
270
270
|
*/
|
|
271
|
-
searchFaces(collectionId: string, img: string,
|
|
271
|
+
searchFaces(collectionId: string, img: string, opts?: {
|
|
272
272
|
minConfidence?: number;
|
|
273
273
|
maxFaces?: number;
|
|
274
274
|
}): Promise<FaceMatch[] | FaceMatch | null>;
|
|
@@ -76,5 +76,5 @@ export default class extends IORedis.Redis {
|
|
|
76
76
|
* const unixSocketRedis = new RedisClient({path: "/tmp/echo.sock"});
|
|
77
77
|
* const redis = new RedisClient({host: 'localhost', port: 6379});
|
|
78
78
|
*/
|
|
79
|
-
constructor(
|
|
79
|
+
constructor(opts: IORedis.IRedisOptions);
|
|
80
80
|
}
|