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
|
@@ -1,221 +1,221 @@
|
|
|
1
|
-
import sequelize from 'sequelize';
|
|
2
|
-
/**
|
|
3
|
-
* Model base class.
|
|
4
|
-
*/
|
|
5
|
-
export default class Model extends sequelize.Model {
|
|
6
|
-
/**
|
|
7
|
-
* The name of the table that the model accesses.
|
|
8
|
-
* This member must be defined in a subclass.
|
|
9
|
-
* @type {string}
|
|
10
|
-
*/
|
|
11
|
-
protected static table: string;
|
|
12
|
-
/**
|
|
13
|
-
* List of columns in the table accessed by this model.
|
|
14
|
-
* This member must be defined in a subclass.
|
|
15
|
-
* @type {sequelize.ModelAttributes}
|
|
16
|
-
*/
|
|
17
|
-
protected static attributes: sequelize.ModelAttributes;
|
|
18
|
-
/**
|
|
19
|
-
* Column type.
|
|
20
|
-
*
|
|
21
|
-
* @see https://sequelize.org/master/variable/index.html#static-variable-DataTypes
|
|
22
|
-
* @type {sequelize.DataTypes}
|
|
23
|
-
*/
|
|
24
|
-
static readonly DataTypes: {
|
|
25
|
-
[key: string]: any;
|
|
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
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Operator.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* // Sequelize provides several operators.
|
|
41
|
-
* Post.findAll({
|
|
42
|
-
* where: {
|
|
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
|
-
* someAttribute: {
|
|
46
|
-
* // Basics
|
|
47
|
-
* [this.Op.eq]: 3, // = 3
|
|
48
|
-
* [this.Op.ne]: 20, // != 20
|
|
49
|
-
* [this.Op.is]: null, // IS NULL
|
|
50
|
-
* [this.Op.not]: true, // IS NOT TRUE
|
|
51
|
-
* [this.Op.or]: [5, 6], // (someAttribute = 5) OR (someAttribute = 6)
|
|
52
|
-
*
|
|
53
|
-
* // Using dialect specific column identifiers (PG in the following example):
|
|
54
|
-
* [this.Op.col]: 'user.organization_id', // = "user"."organization_id"
|
|
55
|
-
*
|
|
56
|
-
* // Number comparisons
|
|
57
|
-
* [this.Op.gt]: 6, // > 6
|
|
58
|
-
* [this.Op.gte]: 6, // >= 6
|
|
59
|
-
* [this.Op.lt]: 10, // < 10
|
|
60
|
-
* [this.Op.lte]: 10, // <= 10
|
|
61
|
-
* [this.Op.between]: [6, 10], // BETWEEN 6 AND 10
|
|
62
|
-
* [this.Op.notBetween]: [11, 15], // NOT BETWEEN 11 AND 15
|
|
63
|
-
*
|
|
64
|
-
* // Other operators
|
|
65
|
-
* [this.Op.all]: this.literal('SELECT 1'), // > ALL (SELECT 1)
|
|
66
|
-
* [this.Op.in]: [1, 2], // IN [1, 2]
|
|
67
|
-
* [this.Op.notIn]: [1, 2], // NOT IN [1, 2]
|
|
68
|
-
* [this.Op.like]: '%hat', // LIKE '%hat'
|
|
69
|
-
* [this.Op.notLike]: '%hat', // NOT LIKE '%hat'
|
|
70
|
-
* [this.Op.startsWith]: 'hat', // LIKE 'hat%'
|
|
71
|
-
* [this.Op.endsWith]: 'hat', // LIKE '%hat'
|
|
72
|
-
* [this.Op.substring]: 'hat', // LIKE '%hat%'
|
|
73
|
-
* [this.Op.iLike]: '%hat', // ILIKE '%hat' (case insensitive) (PG only)
|
|
74
|
-
* [this.Op.notILike]: '%hat', // NOT ILIKE '%hat' (PG only)
|
|
75
|
-
* [this.Op.regexp]: '^[h|a|t]', // REGEXP/~ '^[h|a|t]' (MySQL/PG only)
|
|
76
|
-
* [this.Op.notRegexp]: '^[h|a|t]', // NOT REGEXP/!~ '^[h|a|t]' (MySQL/PG only)
|
|
77
|
-
* [this.Op.iRegexp]: '^[h|a|t]', // ~* '^[h|a|t]' (PG only)
|
|
78
|
-
* [this.Op.notIRegexp]: '^[h|a|t]', // !~* '^[h|a|t]' (PG only)
|
|
79
|
-
* [this.Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only)
|
|
80
|
-
* // In Postgres, this.Op.like/this.Op.iLike/this.Op.notLike can be combined to this.Op.any:
|
|
81
|
-
* [this.Op.like]: {[this.Op.any]: ['cat', 'hat']} // LIKE ANY ARRAY['cat', 'hat']
|
|
82
|
-
* // There are more postgres-only range operators, see below
|
|
83
|
-
* }
|
|
84
|
-
* }
|
|
85
|
-
* });
|
|
86
|
-
*
|
|
87
|
-
* @type {sequelize.Op}
|
|
88
|
-
*/
|
|
89
|
-
static readonly Op: {
|
|
90
|
-
[key: string]: any;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Creates a object representing a database function. This can be used in search queries, both in where and
|
|
94
|
-
* order parts, and as default values in column definitions. If you want to refer to columns in your
|
|
95
|
-
* function, you should use `sequelize.col`, so that the columns are properly interpreted as columns and not a strings.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* // Convert a user's username to upper case
|
|
99
|
-
* Post.update({
|
|
100
|
-
* username: this.fn('upper', this.col('username'))
|
|
101
|
-
* })
|
|
102
|
-
*
|
|
103
|
-
* @type {sequelize.fn}
|
|
104
|
-
*/
|
|
105
|
-
static readonly fn: (fn: string, ...args: unknown[]) => any;
|
|
106
|
-
/**
|
|
107
|
-
* Creates a object representing a column in the DB. This is often useful in conjunction with
|
|
108
|
-
* `sequelize.fn`, since raw string arguments to fn will be escaped.
|
|
109
|
-
*
|
|
110
|
-
* @type {sequelize.col}
|
|
111
|
-
*/
|
|
112
|
-
static readonly col: (col: string) => any;
|
|
113
|
-
/**
|
|
114
|
-
* Creates a object representing a literal, i.e. something that will not be escaped.
|
|
115
|
-
*
|
|
116
|
-
* @type {sequelize.literal}
|
|
117
|
-
*/
|
|
118
|
-
static readonly literal: (val: string) => any;
|
|
119
|
-
/**
|
|
120
|
-
* A way of specifying attr = condition.
|
|
121
|
-
*
|
|
122
|
-
* @type {sequelize.where}
|
|
123
|
-
*/
|
|
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);
|
|
139
|
-
/**
|
|
140
|
-
* Initialize the model that represents the table in the DB with attributes and options.
|
|
141
|
-
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
142
|
-
*
|
|
143
|
-
* @return {typeof Model} Returns this model class itself.
|
|
144
|
-
*/
|
|
145
|
-
static initialize(): (typeof Model);
|
|
146
|
-
/**
|
|
147
|
-
* Associate the model.
|
|
148
|
-
* Define associations with other models such as "hasOne", "hasMany", "belongsTo", "belongsToMany".
|
|
149
|
-
* If you omit the alias (as) option, the associated name will be hasOne, singular for belongsTo, and plural for hasMany.
|
|
150
|
-
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
151
|
-
*
|
|
152
|
-
* @see https://sequelize.org/master/manual/assocs.html
|
|
153
|
-
*/
|
|
154
|
-
static association(): void;
|
|
155
|
-
/**
|
|
156
|
-
* Starts a transaction and returns a transaction object to identify the running transaction.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
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 {
|
|
166
|
-
* if (transaction)
|
|
167
|
-
* await transaction.rollback();
|
|
168
|
-
* }
|
|
169
|
-
*
|
|
170
|
-
* // You can also use transaction options.
|
|
171
|
-
* let transaction;
|
|
172
|
-
* try {
|
|
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
|
-
* // results in: 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();
|
|
189
|
-
* }
|
|
190
|
-
*
|
|
191
|
-
* @see https://sequelize.org/master/manual/transactions.html
|
|
192
|
-
* @param {sequelize.TransactionOptions} options? Options provided when the transaction is created.
|
|
193
|
-
* @return {Promise<sequelize.Transaction>} Returns a transaction object to identify the transaction being executed.
|
|
194
|
-
*/
|
|
195
|
-
static begin(options?: sequelize.TransactionOptions): Promise<sequelize.Transaction>;
|
|
196
|
-
/**
|
|
197
|
-
* Returns data that matches the ID.
|
|
198
|
-
*/
|
|
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} options 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, options: 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>;
|
|
221
|
-
}
|
|
1
|
+
import sequelize from 'sequelize';
|
|
2
|
+
/**
|
|
3
|
+
* Model base class.
|
|
4
|
+
*/
|
|
5
|
+
export default class Model extends sequelize.Model {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the table that the model accesses.
|
|
8
|
+
* This member must be defined in a subclass.
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
protected static table: string;
|
|
12
|
+
/**
|
|
13
|
+
* List of columns in the table accessed by this model.
|
|
14
|
+
* This member must be defined in a subclass.
|
|
15
|
+
* @type {sequelize.ModelAttributes}
|
|
16
|
+
*/
|
|
17
|
+
protected static attributes: sequelize.ModelAttributes;
|
|
18
|
+
/**
|
|
19
|
+
* Column type.
|
|
20
|
+
*
|
|
21
|
+
* @see https://sequelize.org/master/variable/index.html#static-variable-DataTypes
|
|
22
|
+
* @type {sequelize.DataTypes}
|
|
23
|
+
*/
|
|
24
|
+
static readonly DataTypes: {
|
|
25
|
+
[key: string]: any;
|
|
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
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Operator.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Sequelize provides several operators.
|
|
41
|
+
* Post.findAll({
|
|
42
|
+
* where: {
|
|
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
|
+
* someAttribute: {
|
|
46
|
+
* // Basics
|
|
47
|
+
* [this.Op.eq]: 3, // = 3
|
|
48
|
+
* [this.Op.ne]: 20, // != 20
|
|
49
|
+
* [this.Op.is]: null, // IS NULL
|
|
50
|
+
* [this.Op.not]: true, // IS NOT TRUE
|
|
51
|
+
* [this.Op.or]: [5, 6], // (someAttribute = 5) OR (someAttribute = 6)
|
|
52
|
+
*
|
|
53
|
+
* // Using dialect specific column identifiers (PG in the following example):
|
|
54
|
+
* [this.Op.col]: 'user.organization_id', // = "user"."organization_id"
|
|
55
|
+
*
|
|
56
|
+
* // Number comparisons
|
|
57
|
+
* [this.Op.gt]: 6, // > 6
|
|
58
|
+
* [this.Op.gte]: 6, // >= 6
|
|
59
|
+
* [this.Op.lt]: 10, // < 10
|
|
60
|
+
* [this.Op.lte]: 10, // <= 10
|
|
61
|
+
* [this.Op.between]: [6, 10], // BETWEEN 6 AND 10
|
|
62
|
+
* [this.Op.notBetween]: [11, 15], // NOT BETWEEN 11 AND 15
|
|
63
|
+
*
|
|
64
|
+
* // Other operators
|
|
65
|
+
* [this.Op.all]: this.literal('SELECT 1'), // > ALL (SELECT 1)
|
|
66
|
+
* [this.Op.in]: [1, 2], // IN [1, 2]
|
|
67
|
+
* [this.Op.notIn]: [1, 2], // NOT IN [1, 2]
|
|
68
|
+
* [this.Op.like]: '%hat', // LIKE '%hat'
|
|
69
|
+
* [this.Op.notLike]: '%hat', // NOT LIKE '%hat'
|
|
70
|
+
* [this.Op.startsWith]: 'hat', // LIKE 'hat%'
|
|
71
|
+
* [this.Op.endsWith]: 'hat', // LIKE '%hat'
|
|
72
|
+
* [this.Op.substring]: 'hat', // LIKE '%hat%'
|
|
73
|
+
* [this.Op.iLike]: '%hat', // ILIKE '%hat' (case insensitive) (PG only)
|
|
74
|
+
* [this.Op.notILike]: '%hat', // NOT ILIKE '%hat' (PG only)
|
|
75
|
+
* [this.Op.regexp]: '^[h|a|t]', // REGEXP/~ '^[h|a|t]' (MySQL/PG only)
|
|
76
|
+
* [this.Op.notRegexp]: '^[h|a|t]', // NOT REGEXP/!~ '^[h|a|t]' (MySQL/PG only)
|
|
77
|
+
* [this.Op.iRegexp]: '^[h|a|t]', // ~* '^[h|a|t]' (PG only)
|
|
78
|
+
* [this.Op.notIRegexp]: '^[h|a|t]', // !~* '^[h|a|t]' (PG only)
|
|
79
|
+
* [this.Op.any]: [2, 3], // ANY ARRAY[2, 3]::INTEGER (PG only)
|
|
80
|
+
* // In Postgres, this.Op.like/this.Op.iLike/this.Op.notLike can be combined to this.Op.any:
|
|
81
|
+
* [this.Op.like]: {[this.Op.any]: ['cat', 'hat']} // LIKE ANY ARRAY['cat', 'hat']
|
|
82
|
+
* // There are more postgres-only range operators, see below
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* @type {sequelize.Op}
|
|
88
|
+
*/
|
|
89
|
+
static readonly Op: {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Creates a object representing a database function. This can be used in search queries, both in where and
|
|
94
|
+
* order parts, and as default values in column definitions. If you want to refer to columns in your
|
|
95
|
+
* function, you should use `sequelize.col`, so that the columns are properly interpreted as columns and not a strings.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* // Convert a user's username to upper case
|
|
99
|
+
* Post.update({
|
|
100
|
+
* username: this.fn('upper', this.col('username'))
|
|
101
|
+
* })
|
|
102
|
+
*
|
|
103
|
+
* @type {sequelize.fn}
|
|
104
|
+
*/
|
|
105
|
+
static readonly fn: (fn: string, ...args: unknown[]) => any;
|
|
106
|
+
/**
|
|
107
|
+
* Creates a object representing a column in the DB. This is often useful in conjunction with
|
|
108
|
+
* `sequelize.fn`, since raw string arguments to fn will be escaped.
|
|
109
|
+
*
|
|
110
|
+
* @type {sequelize.col}
|
|
111
|
+
*/
|
|
112
|
+
static readonly col: (col: string) => any;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a object representing a literal, i.e. something that will not be escaped.
|
|
115
|
+
*
|
|
116
|
+
* @type {sequelize.literal}
|
|
117
|
+
*/
|
|
118
|
+
static readonly literal: (val: string) => any;
|
|
119
|
+
/**
|
|
120
|
+
* A way of specifying attr = condition.
|
|
121
|
+
*
|
|
122
|
+
* @type {sequelize.where}
|
|
123
|
+
*/
|
|
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);
|
|
139
|
+
/**
|
|
140
|
+
* Initialize the model that represents the table in the DB with attributes and options.
|
|
141
|
+
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
142
|
+
*
|
|
143
|
+
* @return {typeof Model} Returns this model class itself.
|
|
144
|
+
*/
|
|
145
|
+
static initialize(): (typeof Model);
|
|
146
|
+
/**
|
|
147
|
+
* Associate the model.
|
|
148
|
+
* Define associations with other models such as "hasOne", "hasMany", "belongsTo", "belongsToMany".
|
|
149
|
+
* If you omit the alias (as) option, the associated name will be hasOne, singular for belongsTo, and plural for hasMany.
|
|
150
|
+
* This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
|
|
151
|
+
*
|
|
152
|
+
* @see https://sequelize.org/master/manual/assocs.html
|
|
153
|
+
*/
|
|
154
|
+
static association(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Starts a transaction and returns a transaction object to identify the running transaction.
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
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 {
|
|
166
|
+
* if (transaction)
|
|
167
|
+
* await transaction.rollback();
|
|
168
|
+
* }
|
|
169
|
+
*
|
|
170
|
+
* // You can also use transaction options.
|
|
171
|
+
* let transaction;
|
|
172
|
+
* try {
|
|
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
|
+
* // results in: 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();
|
|
189
|
+
* }
|
|
190
|
+
*
|
|
191
|
+
* @see https://sequelize.org/master/manual/transactions.html
|
|
192
|
+
* @param {sequelize.TransactionOptions} options? Options provided when the transaction is created.
|
|
193
|
+
* @return {Promise<sequelize.Transaction>} Returns a transaction object to identify the transaction being executed.
|
|
194
|
+
*/
|
|
195
|
+
static begin(options?: sequelize.TransactionOptions): Promise<sequelize.Transaction>;
|
|
196
|
+
/**
|
|
197
|
+
* Returns data that matches the ID.
|
|
198
|
+
*/
|
|
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} options 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, options: 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>;
|
|
221
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { Database, Model, loadModels };
|
|
1
|
+
export { default as Database } from '~/database/Database';
|
|
2
|
+
export { default as Model } from '~/database/Model';
|
|
3
|
+
export { default as loadModels } from '~/database/loadModels';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model initialization and association.
|
|
3
|
-
* All models must be pre-loaded before associating models.So it loads and caches all defined models in advance.
|
|
4
|
-
* This must be done before any method that may load other models is called.
|
|
5
|
-
*/
|
|
6
|
-
export default function (): void;
|
|
1
|
+
/**
|
|
2
|
+
* Model initialization and association.
|
|
3
|
+
* All models must be pre-loaded before associating models.So it loads and caches all defined models in advance.
|
|
4
|
+
* This must be done before any method that may load other models is called.
|
|
5
|
+
*/
|
|
6
|
+
export default function (): void;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Face collection creation failed.
|
|
3
|
-
*/
|
|
4
|
-
export default class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* Error Name.
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Collection ID.
|
|
12
|
-
* @type {string}
|
|
13
|
-
*/
|
|
14
|
-
collectionId: string;
|
|
15
|
-
/**
|
|
16
|
-
* HTTP status code.
|
|
17
|
-
* @type {number}
|
|
18
|
-
*/
|
|
19
|
-
httpStatusCode: number;
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} collectionId Collection ID.
|
|
22
|
-
* @param {number} httpStatusCode HTTP status code.
|
|
23
|
-
*/
|
|
24
|
-
constructor(collectionId: string, httpStatusCode: number);
|
|
25
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Face collection creation failed.
|
|
3
|
+
*/
|
|
4
|
+
export default class extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Error Name.
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Collection ID.
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
collectionId: string;
|
|
15
|
+
/**
|
|
16
|
+
* HTTP status code.
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
httpStatusCode: number;
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} collectionId Collection ID.
|
|
22
|
+
* @param {number} httpStatusCode HTTP status code.
|
|
23
|
+
*/
|
|
24
|
+
constructor(collectionId: string, httpStatusCode: number);
|
|
25
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collection deletion error.
|
|
3
|
-
*/
|
|
4
|
-
export default class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* Error Name.
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Collection ID.
|
|
12
|
-
* @type {string}
|
|
13
|
-
*/
|
|
14
|
-
collectionId: string;
|
|
15
|
-
/**
|
|
16
|
-
* HTTP status code.
|
|
17
|
-
* @type {number}
|
|
18
|
-
*/
|
|
19
|
-
httpStatusCode: number;
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} collectionId Collection ID.
|
|
22
|
-
* @param {number} httpStatusCode HTTP status code.
|
|
23
|
-
*/
|
|
24
|
-
constructor(collectionId: string, httpStatusCode: number);
|
|
25
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Collection deletion error.
|
|
3
|
+
*/
|
|
4
|
+
export default class extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Error Name.
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Collection ID.
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
collectionId: string;
|
|
15
|
+
/**
|
|
16
|
+
* HTTP status code.
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
httpStatusCode: number;
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} collectionId Collection ID.
|
|
22
|
+
* @param {number} httpStatusCode HTTP status code.
|
|
23
|
+
*/
|
|
24
|
+
constructor(collectionId: string, httpStatusCode: number);
|
|
25
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Face indexing failed.
|
|
3
|
-
*/
|
|
4
|
-
export default class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* Error Name.
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
/**
|
|
11
|
-
* Collection ID.
|
|
12
|
-
* @type {string}
|
|
13
|
-
*/
|
|
14
|
-
collectionId: string;
|
|
15
|
-
/**
|
|
16
|
-
* @param {string} collectionId Collection ID.
|
|
17
|
-
* @param {number} httpStatusCode HTTP status code.
|
|
18
|
-
*/
|
|
19
|
-
constructor(collectionId: string);
|
|
20
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Face indexing failed.
|
|
3
|
+
*/
|
|
4
|
+
export default class extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Error Name.
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Collection ID.
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
collectionId: string;
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} collectionId Collection ID.
|
|
17
|
+
* @param {number} httpStatusCode HTTP status code.
|
|
18
|
+
*/
|
|
19
|
+
constructor(collectionId: string);
|
|
20
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Missing face in photo.
|
|
3
|
-
*/
|
|
4
|
-
export default class extends Error {
|
|
5
|
-
/**
|
|
6
|
-
* Error Name.
|
|
7
|
-
* @type {string}
|
|
8
|
-
*/
|
|
9
|
-
name: string;
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Missing face in photo.
|
|
3
|
+
*/
|
|
4
|
+
export default class extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Error Name.
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
constructor();
|
|
11
|
+
}
|