express-sweet 1.0.12 → 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 +28 -2
- package/dist/build.common.js +2 -2
- package/dist/build.esm.js +2 -2
- package/docs/index.html +257 -288
- package/docs/styles/docs.css +5 -10
- package/package.json +1 -1
- package/types/database/Model.d.ts +51 -20
- package/types/services/AWSRekognitionClient.d.ts +12 -12
package/docs/styles/docs.css
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.topnav {
|
|
8
8
|
padding: .75rem 0;
|
|
9
|
-
background-color: hsl(
|
|
9
|
+
background-color: hsl(202deg, 100%, 39%);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.topnav .navbar-toggler {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.topnav .navbar-nav-svg {
|
|
27
|
-
width:
|
|
28
|
-
height:
|
|
27
|
+
width: 1.5rem;
|
|
28
|
+
height: 1.5rem
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.min-w-150px {
|
|
@@ -127,7 +127,7 @@ h4 {
|
|
|
127
127
|
margin-top: .125rem;
|
|
128
128
|
margin-left: 1.25rem;
|
|
129
129
|
width: fit-content;
|
|
130
|
-
color: hsl(
|
|
130
|
+
color: hsl(202deg, 100%, 20%);
|
|
131
131
|
text-decoration: none;
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -260,14 +260,9 @@ h4 {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
.hljs {
|
|
263
|
-
|
|
264
|
-
background: #2e2e42;
|
|
263
|
+
background: #f8f9fa;
|
|
265
264
|
}
|
|
266
265
|
|
|
267
|
-
.hljs-comment {
|
|
268
|
-
color: #9e8f9e;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
266
|
.example {
|
|
272
267
|
margin-bottom: 1rem;
|
|
273
268
|
}
|
package/package.json
CHANGED
|
@@ -40,8 +40,8 @@ export default class Model extends sequelize.Model {
|
|
|
40
40
|
* // Sequelize provides several operators.
|
|
41
41
|
* Post.findAll({
|
|
42
42
|
* where: {
|
|
43
|
-
* [this.Op.and]: [{
|
|
44
|
-
* [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)
|
|
45
45
|
* someAttribute: {
|
|
46
46
|
* // Basics
|
|
47
47
|
* [this.Op.eq]: 3, // = 3
|
|
@@ -78,7 +78,7 @@ export default class Model extends sequelize.Model {
|
|
|
78
78
|
* [this.Op.notIRegexp]: '^[h|a|t]', // !~* '^[h|a|t]' (PG only)
|
|
79
79
|
* [this.Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only)
|
|
80
80
|
* // In Postgres, this.Op.like/this.Op.iLike/this.Op.notLike can be combined to this.Op.any:
|
|
81
|
-
* [this.Op.like]: {
|
|
81
|
+
* [this.Op.like]: {[this.Op.any]: ['cat', 'hat']} // LIKE ANY ARRAY['cat', 'hat']
|
|
82
82
|
* // There are more postgres-only range operators, see below
|
|
83
83
|
* }
|
|
84
84
|
* }
|
|
@@ -122,6 +122,20 @@ export default class Model extends sequelize.Model {
|
|
|
122
122
|
* @type {sequelize.where}
|
|
123
123
|
*/
|
|
124
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);
|
|
125
139
|
/**
|
|
126
140
|
* Initialize the model that represents the table in the DB with attributes and options.
|
|
127
141
|
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
@@ -142,26 +156,43 @@ export default class Model extends sequelize.Model {
|
|
|
142
156
|
* Starts a transaction and returns a transaction object to identify the running transaction.
|
|
143
157
|
*
|
|
144
158
|
* @example
|
|
145
|
-
* //
|
|
146
|
-
*
|
|
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
|
+
* }
|
|
147
169
|
*
|
|
170
|
+
* // You can also use transaction options.
|
|
171
|
+
* let transaction;
|
|
148
172
|
* try {
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* }
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
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();
|
|
159
189
|
* }
|
|
160
|
-
* @see https://sequelize.org/master/manual/transactions.html
|
|
161
190
|
*
|
|
162
|
-
* @
|
|
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.
|
|
163
194
|
*/
|
|
164
|
-
static begin(): Promise<sequelize.Transaction>;
|
|
195
|
+
static begin(opts?: sequelize.TransactionOptions): Promise<sequelize.Transaction>;
|
|
165
196
|
/**
|
|
166
197
|
* Returns data that matches the ID.
|
|
167
198
|
*/
|
|
@@ -173,11 +204,11 @@ export default class Model extends sequelize.Model {
|
|
|
173
204
|
* @example
|
|
174
205
|
* // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
|
|
175
206
|
* // Note that since this is a raw query, the metadata are dialect specific.
|
|
176
|
-
* const [results, metadata] = await
|
|
207
|
+
* const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
|
|
177
208
|
*
|
|
178
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:
|
|
179
210
|
* // We didn't need to destructure the result here - the results were returned directly
|
|
180
|
-
* const users = await
|
|
211
|
+
* const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
|
|
181
212
|
*
|
|
182
213
|
* @see https://sequelize.org/master/manual/raw-queries.html
|
|
183
214
|
*
|
|
@@ -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.
|