express-sweet 1.0.6 → 1.0.10

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/docs/index.html CHANGED
@@ -2510,6 +2510,17 @@ const isConnected = await database.isConnect();</code></pre>
2510
2510
  </p>
2511
2511
  </td>
2512
2512
  </tr>
2513
+ <tr>
2514
+ <td class="text-nowrap">public static readonly</td>
2515
+ <td class="w-100">
2516
+ <code class="text-body"><a href="#model-member-where">where</a>: (attr: sequelize.AttributeType, comparator: string, logic: sequelize.LogicType) =&gt; sequelize.Utils.Where</code>
2517
+ <p class="mb-0 ms-3 mt-1">
2518
+ A way of specifying attr = condition.<br>
2519
+ This is an alias for &quot;sequelize.where&quot;.<br>
2520
+ See <a href="https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#static-method-where" target="_blank">here</a> for details.
2521
+ </p>
2522
+ </td>
2523
+ </tr>
2513
2524
  </tbody>
2514
2525
  </table>
2515
2526
 
@@ -2996,6 +3007,61 @@ console.log(&#39;books=&#39;, books);</code></pre>
2996
3007
  </div>
2997
3008
  </div>
2998
3009
 
3010
+ <h4 id="model-member-where"><code class="member">public static readonly where: (attr: sequelize.AttributeType, comparator: string, logic: sequelize.LogicType) =&gt; sequelize.Utils.Where</code></h4>
3011
+ <p>
3012
+ A way of specifying attr = condition.<br>
3013
+ The attr can either be an object taken from Model.rawAttributes (for example Model.rawAttributes.id or Model.rawAttributes.name).<br>
3014
+ The attribute should be defined in your model definition.<br>
3015
+ The attribute can also be an object from one of the sequelize utility functions (sequelize.fn, sequelize.col etc.)<br>
3016
+ For string attributes, use the regular { where: { attr: something }} syntax.<br>
3017
+ If you don't want your string to be escaped, use sequelize.literal.<br>
3018
+ See <a href="https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#static-method-where" target="_blank">here</a> for details.
3019
+ </p>
3020
+ <div class="example">
3021
+ <ul class="nav nav-tabs" role="tablist">
3022
+ <li class="nav-item" role="presentation">
3023
+ <a class="nav-link active" id="model-where-esm-tab" data-bs-toggle="tab" href="#model-where-esm" role="tab" aria-controls="model-where-esm" aria-selected="true">ESM</a>
3024
+ </li>
3025
+ <li class="nav-item" role="presentation">
3026
+ <a class="nav-link" id="model-where-cjs-tab" data-bs-toggle="tab" href="#model-where-cjs" role="tab" aria-controls="model-where-cjs" aria-selected="false">CJS</a>
3027
+ </li>
3028
+ </ul>
3029
+ <div class="tab-content">
3030
+ <div class="tab-pane fade show active" id="model-where-esm" role="tabpanel" aria-labelledby="model-where-esm-tab">
3031
+ <pre><code class="js">import BookModel from &#39;../models/BookModel&#39;;
3032
+
3033
+ // SELECT `title` FROM `book` AS `book` WHERE CHAR_LENGTH(`title`) &lt;= 10;
3034
+ const books = await BookModel.findAll({
3035
+ attributes: [&#39;title&#39;],
3036
+ where: BookModel.where(
3037
+ BookModel.fn(&#39;CHAR_LENGTH&#39;, BookModel.col(&#39;title&#39;)),
3038
+ {[BookModel.Op.lte]: 10}
3039
+ ),
3040
+ raw: true
3041
+ });
3042
+
3043
+ // Output: books= [ { title: &#39;Moby Dick&#39; } ]
3044
+ console.log(&#39;books=&#39;, books);</code></pre>
3045
+ </div>
3046
+ <div class="tab-pane fade" id="model-where-cjs" role="tabpanel" aria-labelledby="model-where-cjs-tab">
3047
+ <pre><code class="js">const BookModel = require(&#39;../models/BookModel&#39;);
3048
+
3049
+ // SELECT `title` FROM `book` AS `book` WHERE CHAR_LENGTH(`title`) &lt;= 10;
3050
+ const books = await BookModel.findAll({
3051
+ attributes: [&#39;title&#39;],
3052
+ where: BookModel.where(
3053
+ BookModel.fn(&#39;CHAR_LENGTH&#39;, BookModel.col(&#39;title&#39;)),
3054
+ {[BookModel.Op.lte]: 10}
3055
+ ),
3056
+ raw: true
3057
+ });
3058
+
3059
+ // Output: books= [ { title: &#39;Moby Dick&#39; } ]
3060
+ console.log(&#39;books=&#39;, books);</code></pre>
3061
+ </div>
3062
+ </div>
3063
+ </div>
3064
+
2999
3065
  <h3>Methods</h3>
3000
3066
  <h4 id="model-method-association"><code class="method">public static association(): void</code></h4>
3001
3067
  <p>
@@ -5485,7 +5551,8 @@ const client = new sweet.services.AWSRekognitionClient({
5485
5551
  // left: 0.2928670048713684,
5486
5552
  // top: 0.09095799922943115
5487
5553
  // },
5488
- // externalImageId: &#039;img.jpg&#039;
5554
+ // externalImageId: &#039;img.jpg&#039;,
5555
+ // similarity: 99.98941802978516
5489
5556
  // }
5490
5557
  const match = await client.searchFaces(&#039;MyCollection&#039;, &#039;img.jpg&#039;, {minConfidence: 99, maxFaces: 1});
5491
5558
  console.log(match);
@@ -5501,7 +5568,8 @@ console.log(match);
5501
5568
  // left: 0.2928670048713684,
5502
5569
  // top: 0.09095799922943115
5503
5570
  // },
5504
- // externalImageId: &#039;img.jpg&#039;
5571
+ // externalImageId: &#039;img.jpg&#039;,
5572
+ // similarity: 99.98941802978516
5505
5573
  // }
5506
5574
  // ]
5507
5575
  const matches = await client.searchFaces(&#039;MyCollection&#039;, &#039;img.jpg&#039;, {minConfidence: 99, maxFaces: 5});
@@ -5532,7 +5600,8 @@ const client = new AWSRekognitionClient({
5532
5600
  // left: 0.2928670048713684,
5533
5601
  // top: 0.09095799922943115
5534
5602
  // },
5535
- // externalImageId: &#039;img.jpg&#039;
5603
+ // externalImageId: &#039;img.jpg&#039;,
5604
+ // similarity: 99.98941802978516
5536
5605
  // }
5537
5606
  const match = await client.searchFaces(&#039;MyCollection&#039;, &#039;img.jpg&#039;, {minConfidence: 99, maxFaces: 1});
5538
5607
  console.log(match);
@@ -5548,7 +5617,8 @@ console.log(match);
5548
5617
  // left: 0.2928670048713684,
5549
5618
  // top: 0.09095799922943115
5550
5619
  // },
5551
- // externalImageId: &#039;img.jpg&#039;
5620
+ // externalImageId: &#039;img.jpg&#039;,
5621
+ // similarity: 99.98941802978516
5552
5622
  // }
5553
5623
  // ]
5554
5624
  const matches = await client.searchFaces(&#039;MyCollection&#039;, &#039;img.jpg&#039;, {minConfidence: 99, maxFaces: 5});
@@ -5769,6 +5839,10 @@ const client = new AWSRekognitionClient({
5769
5839
  <td class="text-nowrap">externalImageId?: string</td>
5770
5840
  <td class="w-100">Identifier that you assign to all the faces in the input image.</td>
5771
5841
  </tr>
5842
+ <tr>
5843
+ <td class="text-nowrap">similarity?: number</td>
5844
+ <td class="w-100">Confidence in the match of this face with the input face.<br>Valid Range: Minimum value of 0. Maximum value of 100.</td>
5845
+ </tr>
5772
5846
  </tbody>
5773
5847
  </table>
5774
5848
  <!--end::Interface FaceMatch-->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-sweet",
3
- "version": "1.0.6",
3
+ "version": "1.0.10",
4
4
  "description": "Extend Express functionality with Express Sweet and start developing fast, minimal web applications.",
5
5
  "main": "dist/build.common.js",
6
6
  "module": "dist/build.esm.js",
@@ -87,7 +87,7 @@
87
87
  "moment": "^2.26.0",
88
88
  "morgan": "~1.9.1",
89
89
  "multer": "^1.4.2",
90
- "nodejs-shared": "^1.0.0",
90
+ "nodejs-shared": "^1.0.2",
91
91
  "passport": "^0.4.1",
92
92
  "passport-local": "^1.0.0",
93
93
  "reflect-metadata": "^0.1.13",
@@ -105,6 +105,12 @@ export default class Model extends sequelize.Model {
105
105
  * @type {sequelize.literal}
106
106
  */
107
107
  static readonly literal: (val: string) => any;
108
+ /**
109
+ * A way of specifying attr = condition.
110
+ *
111
+ * @type {sequelize.where}
112
+ */
113
+ static readonly where: (attr: sequelize.AttributeType, comparator: string, logic: sequelize.LogicType) => sequelize.Utils.Where;
108
114
  /**
109
115
  * Initialize the model that represents the table in the DB with attributes and options.
110
116
  * This method is called automatically from within the "express-sweet.mount" method, so you don't have to run it yourself.
@@ -22,4 +22,10 @@ export default interface {
22
22
  * @type {string}
23
23
  */
24
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;
25
31
  }