express-sweet 1.0.15 → 1.0.16

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 (43) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/dist/build.common.js +53 -0
  3. package/dist/build.esm.js +53 -0
  4. package/package.json +1 -1
  5. package/types/database/Database.d.ts +162 -0
  6. package/types/database/Model.d.ts +221 -0
  7. package/types/database/index.d.ts +4 -0
  8. package/types/database/loadModels.d.ts +6 -0
  9. package/types/exceptions/ApiError.d.ts +29 -0
  10. package/types/exceptions/index.d.ts +2 -0
  11. package/types/handlebars_helpers/comparison.d.ts +302 -0
  12. package/types/handlebars_helpers/html.d.ts +11 -0
  13. package/types/handlebars_helpers/index.d.ts +5 -0
  14. package/types/handlebars_helpers/object.d.ts +21 -0
  15. package/types/handlebars_helpers/string.d.ts +12 -0
  16. package/types/index.d.ts +9 -0
  17. package/types/interfaces/AuthenticationOptions.d.ts +84 -0
  18. package/types/interfaces/BoundingBox.d.ts +25 -0
  19. package/types/interfaces/Config.d.ts +66 -0
  20. package/types/interfaces/DatabaseOptions.d.ts +7 -0
  21. package/types/interfaces/FaceMatch.d.ts +31 -0
  22. package/types/interfaces/RekognitionOptions.d.ts +26 -0
  23. package/types/interfaces/ViewOptions.d.ts +30 -0
  24. package/types/interfaces/index.d.ts +8 -0
  25. package/types/middlewares/Authentication.d.ts +16 -0
  26. package/types/middlewares/CORS.d.ts +16 -0
  27. package/types/middlewares/Environment.d.ts +17 -0
  28. package/types/middlewares/ErrorHandling.d.ts +16 -0
  29. package/types/middlewares/Global.d.ts +13 -0
  30. package/types/middlewares/Http.d.ts +16 -0
  31. package/types/middlewares/Local.d.ts +20 -0
  32. package/types/middlewares/View.d.ts +16 -0
  33. package/types/middlewares/index.d.ts +8 -0
  34. package/types/mount.d.ts +7 -0
  35. package/types/package.d.ts +91 -0
  36. package/types/routing/Router.d.ts +19 -0
  37. package/types/routing/index.d.ts +2 -0
  38. package/types/services/AWSRekognitionClient.d.ts +359 -0
  39. package/types/services/Authentication.d.ts +39 -0
  40. package/types/services/RedisClient.d.ts +80 -0
  41. package/types/services/index.d.ts +3 -0
  42. package/types/utils/Types.d.ts +16 -0
  43. package/types/utils/index.d.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -0,0 +1,186 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [1.0.16] - 2022-02-14
6
+ ### Fixed
7
+ - I forgot to include the build file, so I added the build file.
8
+
9
+ ## [1.0.15] - 2022-02-14
10
+ ### Fixed
11
+ - Changed the type of 'config/authentication.js#allow_unauthenticated' from'string[]' to'(string|RegExp)[]}'.
12
+
13
+ ## [1.0.14] - 2022-01-17
14
+ ### Fixed
15
+ - empty view helper can now check any type. Previously I could only check arrays.
16
+ ```html
17
+ // If the value is an array.
18
+ let value = [5, 6];
19
+ {{empty value}} => false
20
+
21
+ {{#if (empty value)}}
22
+ Hello
23
+ {{/if}}
24
+
25
+ // If the value is a string.
26
+ let value = 'Hello';
27
+ {{empty value}} => false
28
+
29
+ let value = '';
30
+ {{empty value}} => true
31
+
32
+ let value = ' ';
33
+ {{empty value}} => true
34
+ ```
35
+
36
+ - Added not_empty view helper.
37
+ ```html
38
+ // If the value is an array.
39
+ let value = [5, 6];
40
+ {{not_empty value}} => true
41
+
42
+ {{#if (not_empty value)}}
43
+ Hello
44
+ {{/if}}
45
+
46
+ // If the value is a string.
47
+ let value = 'Hello';
48
+ {{not_empty value}} => true
49
+
50
+ let value = '';
51
+ {{not_empty value}} => false
52
+
53
+ let value = ' ';
54
+ {{not_empty value}} => false
55
+ ```
56
+
57
+ ## [1.0.13] - 2021-12-13
58
+ ### Fixed
59
+ - The model's begin method now accepts the transaction option.
60
+ See [Transaction | Sequelize](https://sequelize.org/master/class/lib/transaction.js~Transaction.html) for transaction options.
61
+ ```js
62
+ let transaction;
63
+ try {
64
+ transaction = await BookModel.begin({
65
+ isolationLevel: BookModel.Transaction.ISOLATION_LEVELS.REPEATABLE_READ,
66
+ type: BookModel.Transaction.TYPES.DEFERRED,
67
+ });
68
+ const book = await BookModel.findOne({where: {id: 1}}, {transaction});
69
+ book.title = 'When Im Gone';
70
+ await book.save({transaction});
71
+ await transaction.commit();
72
+
73
+ // Check the update result.
74
+ // Output: New title of book: When Im Gone
75
+ await book.reload();
76
+ console.log(`New title of book: ${book.title}`);
77
+ } catch (err) {
78
+ if (transaction)
79
+ await transaction.rollback();
80
+ }
81
+ ```
82
+
83
+ ## [1.0.12] - 2021-11-16
84
+ ### Fixed
85
+ - Added a method to the model that can execute raw SQL.
86
+ 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.
87
+
88
+ ```js
89
+ // By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
90
+ // Note that since this is a raw query, the metadata are dialect specific.
91
+ const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
92
+
93
+ // 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:
94
+ // We didn't need to destructure the result here - the results were returned directly
95
+ const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
96
+ ```
97
+
98
+ ## [1.0.11] - 2021-11-10
99
+ ### Fixed
100
+ - Fixed a bug that the database config was read before NODE_ENV was set and the database config matching NODE_ENV could not be read.
101
+
102
+ ## [1.0.10] - 2021-10-19
103
+ ### Fixed
104
+ - Added face similarity found to face search results in collection.
105
+
106
+ ```js
107
+ import * as sweet from 'express-sweet';
108
+
109
+ // Find a face from the collection.
110
+ // Output: Face search results: [
111
+ // {
112
+ // faceId: '385e1b00-4ede-4219-a7b0-0b9cbe4953e5',
113
+ // boundingBox: {
114
+ // width: 0.3204210102558136,
115
+ // height: 1.0046900510787964,
116
+ // left: 0.39145898818969727,
117
+ // top: 0.07936319708824158
118
+ // },
119
+ // similarity: 99.98941802978516
120
+ // }
121
+ // ]
122
+ const collectionId = 'MyCollection';
123
+ const res = await client.searchFaces(collectionId, 'img/face.jpg');
124
+ console.log('Face search results:', res);
125
+ ```
126
+
127
+ ## [1.0.9] - 2021-10-13
128
+ ### Fixed
129
+ - Updated dependent package'sharp'from 0.25.4 to 0.29.1.
130
+ This update statically links sharp's pre-built libvips binaries, eliminating the need to install Phton.
131
+ Click [here](https://sharp.pixelplumbing.com/changelog) for sharp change log.
132
+
133
+ ## [1.0.8] - 2021-09-25
134
+ ### Fixed
135
+ - Fixed a bug where the default router couldn't aqua from the endpoint URL.
136
+
137
+ ## [1.0.7] - 2021-08-13
138
+ ### Fixed
139
+ - Added where member functions to Model class. Please see [here](https://takuya-motoshima.github.io/express-sweet/#model-class) for details.
140
+
141
+ ## [1.0.6] - 2021-08-13
142
+ ### Fixed
143
+ - Added fn, col and literal member functions to Model class. Please see [here](https://takuya-motoshima.github.io/express-sweet/#model-class) for details.
144
+
145
+ ## [1.0.5] - 2021-08-12
146
+ ### Fixed
147
+ - Changed the maximum size per field for multipart (multipart/form-data) requests from 1MB to unlimited.
148
+
149
+ ## [1.0.4] - 2021-06-13
150
+ ### Fixed
151
+ - Fixed a bug where the referrer URL was set in app.locals.currentPath instead of the current URL.
152
+
153
+ ## [1.0.3] - 2021-06-13
154
+ ### Fixed
155
+ - Change the current URL path of a local variable.app.locals.currentPath is a USVString containing an initial '/' followed by the path of the URL not including the query string or fragment.
156
+
157
+ ```js
158
+ // For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
159
+ console.log(app.locals.currentPath);
160
+ ```
161
+
162
+ ## [1.0.2] - 2021-06-10
163
+ ### Fixed
164
+ - Updated rollup from version 2.44 to 2.51.
165
+ - Fixed a bug where preloading models failed in cjs.
166
+
167
+ ## [1.0.1] - 2021-06-02
168
+ ### Fixed
169
+ - Fixed a bug that caused an error when reading options defined in ESM's default Export.
170
+
171
+ [1.0.1]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.0...v1.0.1
172
+ [1.0.2]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.1...v1.0.2
173
+ [1.0.3]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.2...v1.0.3
174
+ [1.0.4]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.3...v1.0.4
175
+ [1.0.5]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.4...v1.0.5
176
+ [1.0.6]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.5...v1.0.6
177
+ [1.0.7]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.6...v1.0.7
178
+ [1.0.8]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.7...v1.0.8
179
+ [1.0.9]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.8...v1.0.9
180
+ [1.0.10]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.9...v1.0.10
181
+ [1.0.11]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.10...v1.0.11
182
+ [1.0.12]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.11...v1.0.12
183
+ [1.0.13]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.12...v1.0.13
184
+ [1.0.14]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.13...v1.0.14
185
+ [1.0.15]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.14...v1.0.15
186
+ [1.0.16]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.15...v1.0.16