express-sweet 1.0.28 → 1.0.30
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 +47 -3
- package/dist/build.common.js +18 -14
- package/dist/build.esm.js +18 -14
- package/docs/index.html +972 -424
- package/package.json +7 -3
- package/types/interfaces/SesOptions.d.ts +27 -0
- package/types/interfaces/index.d.ts +2 -1
- package/types/middlewares/Authentication.d.ts +1 -14
- package/types/middlewares/CORS.d.ts +1 -6
- package/types/middlewares/Environment.d.ts +1 -6
- package/types/middlewares/ErrorHandling.d.ts +1 -6
- package/types/middlewares/Http.d.ts +1 -6
- package/types/middlewares/Local.d.ts +1 -6
- package/types/middlewares/View.d.ts +1 -6
- package/types/routing/Router.d.ts +1 -6
- package/types/services/AWSRekognitionClient.d.ts +1 -12
- package/types/services/AWSSesClient.d.ts +57 -0
- package/types/services/Authentication.d.ts +1 -6
- package/types/services/index.d.ts +2 -1
package/docs/index.html
CHANGED
|
@@ -18,12 +18,17 @@
|
|
|
18
18
|
<!--end::Global Stylesheets Bundle-->
|
|
19
19
|
<!--begin::Custom CSS(used by this page)-->
|
|
20
20
|
<style>
|
|
21
|
-
|
|
22
|
-
color: #
|
|
23
|
-
|
|
21
|
+
[data-theme=dark] {
|
|
22
|
+
--bs-link-hover-color: #33b1f9;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
code:not([class*=language-]) {
|
|
26
|
+
color: #b362ff;
|
|
27
|
+
/* color: #9efeff; */
|
|
28
|
+
background-color: transparent;
|
|
24
29
|
padding: 0.1rem 0;
|
|
25
30
|
margin: 0;
|
|
26
|
-
|
|
31
|
+
}
|
|
27
32
|
</style>
|
|
28
33
|
<!--end::Custom CSS-->
|
|
29
34
|
</head>
|
|
@@ -76,7 +81,7 @@
|
|
|
76
81
|
<!--begin::Title-->
|
|
77
82
|
<h1 class="page-heading d-flex text-dark fw-bold fs-3 justify-content-center align-items-baseline my-0">
|
|
78
83
|
<!-- <h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0"> -->
|
|
79
|
-
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.
|
|
84
|
+
DevDocs<a href="#changelog" class="badge fw-semibold fs-7 px-2 ms-2 bg-body text-dark text-hover-primary shadow-sm">v1.0.29</a>
|
|
80
85
|
</h1>
|
|
81
86
|
<!--end::Title-->
|
|
82
87
|
</div>
|
|
@@ -691,6 +696,32 @@
|
|
|
691
696
|
</div>
|
|
692
697
|
<!--end:Menu item-->
|
|
693
698
|
<!--begin:Menu item-->
|
|
699
|
+
<div data-kt-menu-trigger="click" class="menu-item menu-accordion">
|
|
700
|
+
<!--begin:Menu link-->
|
|
701
|
+
<span class="menu-link">
|
|
702
|
+
<span class="menu-title">SES</span>
|
|
703
|
+
<span class="menu-arrow"></span>
|
|
704
|
+
</span>
|
|
705
|
+
<!--end:Menu link-->
|
|
706
|
+
<!--begin:Menu sub-->
|
|
707
|
+
<div class="menu-sub menu-sub-accordion">
|
|
708
|
+
<!--begin:Menu item-->
|
|
709
|
+
<div class="menu-item">
|
|
710
|
+
<!--begin:Menu link-->
|
|
711
|
+
<a class="menu-link" href="#ses-class">
|
|
712
|
+
<span class="menu-bullet">
|
|
713
|
+
<span class="bullet bullet-dot"></span>
|
|
714
|
+
</span>
|
|
715
|
+
<span class="menu-title">SES Class</span>
|
|
716
|
+
</a>
|
|
717
|
+
<!--end:Menu link-->
|
|
718
|
+
</div>
|
|
719
|
+
<!--end:Menu item-->
|
|
720
|
+
</div>
|
|
721
|
+
<!--end:Menu sub-->
|
|
722
|
+
</div>
|
|
723
|
+
<!--end:Menu item-->
|
|
724
|
+
<!--begin:Menu item-->
|
|
694
725
|
<div class="menu-item">
|
|
695
726
|
<!--begin:Menu link-->
|
|
696
727
|
<a class="menu-link" href="#changelog">
|
|
@@ -714,7 +745,8 @@
|
|
|
714
745
|
<!--begin::Content-->
|
|
715
746
|
<div id="kt_app_content" class="app-content flex-column-fluid">
|
|
716
747
|
<!--begin::Content container-->
|
|
717
|
-
<div id="kt_app_content_container" class="app-container container-
|
|
748
|
+
<div id="kt_app_content_container" class="app-container container-fluid">
|
|
749
|
+
<!-- <div id="kt_app_content_container" class="app-container container-xxl"> -->
|
|
718
750
|
<!--begin::Card-->
|
|
719
751
|
<div id="overview" data-search-item="true" data-search-title="Overview" data-search-description="Introduction & Getting Started" class="card card-docs flex-row-fluid mb-12">
|
|
720
752
|
<!--begin::Card Body-->
|
|
@@ -1238,7 +1270,7 @@ npm start</code></pre>
|
|
|
1238
1270
|
<!--begin::Head-->
|
|
1239
1271
|
<thead>
|
|
1240
1272
|
<tr class="fs-4 fw-bold p-6">
|
|
1241
|
-
<th class="min-w-200px">Name</th>
|
|
1273
|
+
<th class="min-w-200px">Item Name</th>
|
|
1242
1274
|
<th>Description</th>
|
|
1243
1275
|
</tr>
|
|
1244
1276
|
</thead>
|
|
@@ -1246,7 +1278,7 @@ npm start</code></pre>
|
|
|
1246
1278
|
<!--begin::Body-->
|
|
1247
1279
|
<tbody>
|
|
1248
1280
|
<tr>
|
|
1249
|
-
<td class="
|
|
1281
|
+
<td class="w-250px"><code>env_path</code></td>
|
|
1250
1282
|
<td>
|
|
1251
1283
|
The path to the environment configuration file (<code>.env</code>).<br>
|
|
1252
1284
|
When you start the Express Sweet application, the contents of the environment configuration file are automatically read and saved in <code>process.env</code>.<br>
|
|
@@ -1254,11 +1286,11 @@ npm start</code></pre>
|
|
|
1254
1286
|
</td>
|
|
1255
1287
|
</tr>
|
|
1256
1288
|
<tr>
|
|
1257
|
-
<td class="
|
|
1289
|
+
<td class="w-250px"><code>cors_enabled</code></td>
|
|
1258
1290
|
<td>Set to true to allow requests from another domain to the application.<br>The default is <code>false</code>.</td>
|
|
1259
1291
|
</tr>
|
|
1260
1292
|
<tr>
|
|
1261
|
-
<td class="
|
|
1293
|
+
<td class="w-250px"><code>max_body_size</code></td>
|
|
1262
1294
|
<td>
|
|
1263
1295
|
Controls the maximum request body size.<br>
|
|
1264
1296
|
If this is a number, then the value specifies the number of bytes.<br>
|
|
@@ -1267,11 +1299,11 @@ npm start</code></pre>
|
|
|
1267
1299
|
</td>
|
|
1268
1300
|
</tr>
|
|
1269
1301
|
<tr>
|
|
1270
|
-
<td class="
|
|
1302
|
+
<td class="w-250px"><code>router_dir</code></td>
|
|
1271
1303
|
<td>The directory path where the routes module is located.<br>The default is the <code>routes</code> directory directly under the application root.</td>
|
|
1272
1304
|
</tr>
|
|
1273
1305
|
<tr>
|
|
1274
|
-
<td class="
|
|
1306
|
+
<td class="w-250px"><code>default_router</code></td>
|
|
1275
1307
|
<td>
|
|
1276
1308
|
Express Sweet can be told to load a default router when a URI is not present, as will be the case when root URL (<code>/</code>) is requested.<br>
|
|
1277
1309
|
For example, to specify a default route, set <code>default_router</code> as follows.<br>
|
|
@@ -1322,7 +1354,7 @@ module.exports = router;</code></pre>
|
|
|
1322
1354
|
</td>
|
|
1323
1355
|
</tr>
|
|
1324
1356
|
<tr>
|
|
1325
|
-
<td class="
|
|
1357
|
+
<td class="w-250px"><code>rewrite_base_url</code></td>
|
|
1326
1358
|
<td>
|
|
1327
1359
|
This is a hook that rewrites the base URL.<br>
|
|
1328
1360
|
If you want to rewrite the app.locals.baseUrl property and the view's baseUrl variable, use this hook to return a new base URL.<br>
|
|
@@ -1345,7 +1377,7 @@ module.exports = router;</code></pre>
|
|
|
1345
1377
|
</td>
|
|
1346
1378
|
</tr>
|
|
1347
1379
|
<tr>
|
|
1348
|
-
<td class="
|
|
1380
|
+
<td class="w-250px"><code>error_handler</code></td>
|
|
1349
1381
|
<td>
|
|
1350
1382
|
This is a hook for error handling.<br>
|
|
1351
1383
|
For example, you can use it when you want to send an external notification of the error received by this hook.
|
|
@@ -1394,11 +1426,11 @@ module.exports = router;</code></pre>
|
|
|
1394
1426
|
Each route can have one or more handler functions, which are executed when the route is matched.<br>
|
|
1395
1427
|
Route definition takes the following structure.<br>
|
|
1396
1428
|
<div class="py-5">
|
|
1397
|
-
<ul
|
|
1398
|
-
<li
|
|
1399
|
-
<li
|
|
1400
|
-
<li
|
|
1401
|
-
<li
|
|
1429
|
+
<ul>
|
|
1430
|
+
<li>app is an instance of express.</li>
|
|
1431
|
+
<li>METHOD is an <a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" target="_blank">HTTP request method</a>, in lowercase.</li>
|
|
1432
|
+
<li>PATH is a path on the server.</li>
|
|
1433
|
+
<li>HANDLER is the function executed when the route is matched.</li>
|
|
1402
1434
|
</ul>
|
|
1403
1435
|
</div>
|
|
1404
1436
|
</div>
|
|
@@ -1640,41 +1672,41 @@ module.exports = router;</code></pre>
|
|
|
1640
1672
|
<!--begin::Col-->
|
|
1641
1673
|
<div class="col-6 col-md-4 pe-md-10 mb-10 mb-md-0">
|
|
1642
1674
|
<ul>
|
|
1643
|
-
<li
|
|
1644
|
-
<li
|
|
1645
|
-
<li
|
|
1646
|
-
<li
|
|
1647
|
-
<li
|
|
1648
|
-
<li
|
|
1649
|
-
<li
|
|
1650
|
-
<li
|
|
1675
|
+
<li><code>checkout</code></li>
|
|
1676
|
+
<li><code>copy</code></li>
|
|
1677
|
+
<li><code>delete</code></li>
|
|
1678
|
+
<li><code>get</code></li>
|
|
1679
|
+
<li><code>head</code></li>
|
|
1680
|
+
<li><code>lock</code></li>
|
|
1681
|
+
<li><code>merge</code></li>
|
|
1682
|
+
<li><code>mkactivity</code></li>
|
|
1651
1683
|
</ul>
|
|
1652
1684
|
</div>
|
|
1653
1685
|
<!--end::Col-->
|
|
1654
1686
|
<!--begin::Col-->
|
|
1655
1687
|
<div class="col-6 col-md-4 pe-md-10 mb-10 mb-md-0">
|
|
1656
1688
|
<ul>
|
|
1657
|
-
<li
|
|
1658
|
-
<li
|
|
1659
|
-
<li
|
|
1660
|
-
<li
|
|
1661
|
-
<li
|
|
1662
|
-
<li
|
|
1663
|
-
<li
|
|
1689
|
+
<li><code>mkcol</code></li>
|
|
1690
|
+
<li><code>move</code></li>
|
|
1691
|
+
<li><code>m-search</code></li>
|
|
1692
|
+
<li><code>notify</code></li>
|
|
1693
|
+
<li><code>options</code></li>
|
|
1694
|
+
<li><code>patch</code></li>
|
|
1695
|
+
<li><code>post</code></li>
|
|
1664
1696
|
</ul>
|
|
1665
1697
|
</div>
|
|
1666
1698
|
<!--end::Col-->
|
|
1667
1699
|
<!--begin::Col-->
|
|
1668
1700
|
<div class="col-6 col-md-4 ps-md-10">
|
|
1669
1701
|
<ul>
|
|
1670
|
-
<li
|
|
1671
|
-
<li
|
|
1672
|
-
<li
|
|
1673
|
-
<li
|
|
1674
|
-
<li
|
|
1675
|
-
<li
|
|
1676
|
-
<li
|
|
1677
|
-
<li
|
|
1702
|
+
<li><code>purge</code></li>
|
|
1703
|
+
<li><code>put</code></li>
|
|
1704
|
+
<li><code>report</code></li>
|
|
1705
|
+
<li><code>search</code></li>
|
|
1706
|
+
<li><code>subscribe</code></li>
|
|
1707
|
+
<li><code>trace</code></li>
|
|
1708
|
+
<li><code>unlock</code></li>
|
|
1709
|
+
<li><code>unsubscribe</code></li>
|
|
1678
1710
|
</ul>
|
|
1679
1711
|
</div>
|
|
1680
1712
|
<!--end::Col-->
|
|
@@ -1746,7 +1778,7 @@ module.exports = router;</code></pre>
|
|
|
1746
1778
|
<!--begin::Head-->
|
|
1747
1779
|
<thead>
|
|
1748
1780
|
<tr class="fs-4 fw-bold p-6">
|
|
1749
|
-
<th class="min-w-200px">Name</th>
|
|
1781
|
+
<th class="min-w-200px">Item Name</th>
|
|
1750
1782
|
<th>Description</th>
|
|
1751
1783
|
</tr>
|
|
1752
1784
|
</thead>
|
|
@@ -1754,11 +1786,11 @@ module.exports = router;</code></pre>
|
|
|
1754
1786
|
<!--begin::Body-->
|
|
1755
1787
|
<tbody>
|
|
1756
1788
|
<tr>
|
|
1757
|
-
<td class="
|
|
1789
|
+
<td class="w-250px"><code>views_dir: string</code></td>
|
|
1758
1790
|
<td>The directory path where the view will be placed.<br>The default is the <code>views</code> directory directly under the application root.</td>
|
|
1759
1791
|
</tr>
|
|
1760
1792
|
<tr>
|
|
1761
|
-
<td class="
|
|
1793
|
+
<td class="w-250px"><code>partials_dir: string</code></td>
|
|
1762
1794
|
<td>
|
|
1763
1795
|
The directory path where the reusable templates are located.<br>
|
|
1764
1796
|
The default is the <code>views/partials</code> directory directly under the application root.<br>
|
|
@@ -1766,11 +1798,11 @@ module.exports = router;</code></pre>
|
|
|
1766
1798
|
</td>
|
|
1767
1799
|
</tr>
|
|
1768
1800
|
<tr>
|
|
1769
|
-
<td class="
|
|
1801
|
+
<td class="w-250px"><code>layouts_dir: string</code></td>
|
|
1770
1802
|
<td>The directory path where the reusable base template is located.<br>The default is the <code>views/layout</code> directory directly under the application root.</td>
|
|
1771
1803
|
</tr>
|
|
1772
1804
|
<tr>
|
|
1773
|
-
<td class="
|
|
1805
|
+
<td class="w-250px"><code>default_layout: string</code></td>
|
|
1774
1806
|
<td>
|
|
1775
1807
|
The path to the layout file used by default.<br>
|
|
1776
1808
|
The default is the <code>views/layout/default.*</code> File directly under the application root.<br>
|
|
@@ -1778,11 +1810,11 @@ module.exports = router;</code></pre>
|
|
|
1778
1810
|
</td>
|
|
1779
1811
|
</tr>
|
|
1780
1812
|
<tr>
|
|
1781
|
-
<td class="
|
|
1813
|
+
<td class="w-250px"><code>extension: string</code></td>
|
|
1782
1814
|
<td>Extension for templates and partials files.<br>The default is <code>.hbs</code>.</td>
|
|
1783
1815
|
</tr>
|
|
1784
1816
|
<tr>
|
|
1785
|
-
<td class="
|
|
1817
|
+
<td class="w-250px"><code>beforeRender: (req: express.Request, res: express.Response) => void</code></td>
|
|
1786
1818
|
<td>
|
|
1787
1819
|
Hook function just before the view is rendered.<br>
|
|
1788
1820
|
For example, you can set your own local variables that can be used within the view.<br>
|
|
@@ -2034,20 +2066,24 @@ Else
|
|
|
2034
2066
|
<!--begin::Body-->
|
|
2035
2067
|
<tbody>
|
|
2036
2068
|
<tr>
|
|
2037
|
-
<td class="
|
|
2069
|
+
<td class="w-250px"><code>eq()</code></td>
|
|
2038
2070
|
<td>
|
|
2039
2071
|
Determine whether or not two values are equal (===).
|
|
2072
|
+
<!--begin::Parameters-->
|
|
2040
2073
|
<div class="py-5">
|
|
2041
|
-
<p
|
|
2042
|
-
<ul
|
|
2043
|
-
<li
|
|
2044
|
-
<li
|
|
2074
|
+
<p>Parameters:</p>
|
|
2075
|
+
<ul>
|
|
2076
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2077
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2045
2078
|
</ul>
|
|
2046
2079
|
</div>
|
|
2080
|
+
<!--end::Parameters-->
|
|
2081
|
+
<!--begin::Return value-->
|
|
2047
2082
|
<div class="py-5">
|
|
2048
|
-
<p
|
|
2083
|
+
<p>Return value:</p>
|
|
2049
2084
|
<code>boolean</code> Returns true if the value and type are the same, false if they are different.
|
|
2050
2085
|
</div>
|
|
2086
|
+
<!--end::Return value-->
|
|
2051
2087
|
<!--begin::Code-->
|
|
2052
2088
|
<div class="py-5">
|
|
2053
2089
|
<!--begin::Highlight-->
|
|
@@ -2064,20 +2100,24 @@ Else
|
|
|
2064
2100
|
</td>
|
|
2065
2101
|
</tr>
|
|
2066
2102
|
<tr>
|
|
2067
|
-
<td class="
|
|
2103
|
+
<td class="w-250px"><code>eqw()</code></td>
|
|
2068
2104
|
<td>
|
|
2069
2105
|
Determine whether or not two values are equal (==) i.e. weak checking.
|
|
2106
|
+
<!--begin::Parameters-->
|
|
2070
2107
|
<div class="py-5">
|
|
2071
|
-
<p
|
|
2072
|
-
<ul
|
|
2073
|
-
<li
|
|
2074
|
-
<li
|
|
2108
|
+
<p>Parameters:</p>
|
|
2109
|
+
<ul>
|
|
2110
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2111
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2075
2112
|
</ul>
|
|
2076
2113
|
</div>
|
|
2114
|
+
<!--end::Parameters-->
|
|
2115
|
+
<!--begin::Return value-->
|
|
2077
2116
|
<div class="py-5">
|
|
2078
|
-
<p
|
|
2117
|
+
<p>Return value:</p>
|
|
2079
2118
|
<code>boolean</code> Returns true if the values are the same, false if they are different.
|
|
2080
2119
|
</div>
|
|
2120
|
+
<!--end::Return value-->
|
|
2081
2121
|
<!--begin::Code-->
|
|
2082
2122
|
<div class="py-5">
|
|
2083
2123
|
<!--begin::Highlight-->
|
|
@@ -2094,20 +2134,24 @@ Else
|
|
|
2094
2134
|
</td>
|
|
2095
2135
|
</tr>
|
|
2096
2136
|
<tr>
|
|
2097
|
-
<td class="
|
|
2137
|
+
<td class="w-250px"><code>neq()</code></td>
|
|
2098
2138
|
<td>
|
|
2099
2139
|
Determine whether or not two values are not equal (!==).
|
|
2140
|
+
<!--begin::Parameters-->
|
|
2100
2141
|
<div class="py-5">
|
|
2101
|
-
<p
|
|
2102
|
-
<ul
|
|
2103
|
-
<li
|
|
2104
|
-
<li
|
|
2142
|
+
<p>Parameters:</p>
|
|
2143
|
+
<ul>
|
|
2144
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2145
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2105
2146
|
</ul>
|
|
2106
2147
|
</div>
|
|
2148
|
+
<!--end::Parameters-->
|
|
2149
|
+
<!--begin::Return value-->
|
|
2107
2150
|
<div class="py-5">
|
|
2108
|
-
<p
|
|
2151
|
+
<p>Return value:</p>
|
|
2109
2152
|
<code>boolean</code> Returns true if the value and type are different, false if they are the same.
|
|
2110
2153
|
</div>
|
|
2154
|
+
<!--end::Return value-->
|
|
2111
2155
|
<!--begin::Code-->
|
|
2112
2156
|
<div class="py-5">
|
|
2113
2157
|
<!--begin::Highlight-->
|
|
@@ -2124,20 +2168,24 @@ Else
|
|
|
2124
2168
|
</td>
|
|
2125
2169
|
</tr>
|
|
2126
2170
|
<tr>
|
|
2127
|
-
<td class="
|
|
2171
|
+
<td class="w-250px"><code>neqw()</code></td>
|
|
2128
2172
|
<td>
|
|
2129
2173
|
Determine whether or not two values are not equal (!=) weak checking.
|
|
2174
|
+
<!--begin::Parameters-->
|
|
2130
2175
|
<div class="py-5">
|
|
2131
|
-
<p
|
|
2132
|
-
<ul
|
|
2133
|
-
<li
|
|
2134
|
-
<li
|
|
2176
|
+
<p>Parameters:</p>
|
|
2177
|
+
<ul>
|
|
2178
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2179
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2135
2180
|
</ul>
|
|
2136
2181
|
</div>
|
|
2182
|
+
<!--end::Parameters-->
|
|
2183
|
+
<!--begin::Return value-->
|
|
2137
2184
|
<div class="py-5">
|
|
2138
|
-
<p
|
|
2185
|
+
<p>Return value:</p>
|
|
2139
2186
|
<code>boolean</code> Returns true if the values are different, false if they are the same.
|
|
2140
2187
|
</div>
|
|
2188
|
+
<!--end::Return value-->
|
|
2141
2189
|
<!--begin::Code-->
|
|
2142
2190
|
<div class="py-5">
|
|
2143
2191
|
<!--begin::Highlight-->
|
|
@@ -2154,20 +2202,24 @@ Else
|
|
|
2154
2202
|
</td>
|
|
2155
2203
|
</tr>
|
|
2156
2204
|
<tr>
|
|
2157
|
-
<td class="
|
|
2205
|
+
<td class="w-250px"><code>lt()</code></td>
|
|
2158
2206
|
<td>
|
|
2159
2207
|
Check for less than condition (a < b).
|
|
2208
|
+
<!--begin::Parameters-->
|
|
2160
2209
|
<div class="py-5">
|
|
2161
|
-
<p
|
|
2162
|
-
<ul
|
|
2163
|
-
<li
|
|
2164
|
-
<li
|
|
2210
|
+
<p>Parameters:</p>
|
|
2211
|
+
<ul>
|
|
2212
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2213
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2165
2214
|
</ul>
|
|
2166
2215
|
</div>
|
|
2216
|
+
<!--end::Parameters-->
|
|
2217
|
+
<!--begin::Return value-->
|
|
2167
2218
|
<div class="py-5">
|
|
2168
|
-
<p
|
|
2219
|
+
<p>Return value:</p>
|
|
2169
2220
|
<code>boolean</code> Returns true if the first value is less than the second value, false otherwise.
|
|
2170
2221
|
</div>
|
|
2222
|
+
<!--end::Return value-->
|
|
2171
2223
|
<!--begin::Code-->
|
|
2172
2224
|
<div class="py-5">
|
|
2173
2225
|
<!--begin::Highlight-->
|
|
@@ -2184,20 +2236,24 @@ Else
|
|
|
2184
2236
|
</td>
|
|
2185
2237
|
</tr>
|
|
2186
2238
|
<tr>
|
|
2187
|
-
<td class="
|
|
2239
|
+
<td class="w-250px"><code>lte()</code></td>
|
|
2188
2240
|
<td>
|
|
2189
2241
|
Check for less than or equals condition (a <= b).
|
|
2242
|
+
<!--begin::Parameters-->
|
|
2190
2243
|
<div class="py-5">
|
|
2191
|
-
<p
|
|
2192
|
-
<ul
|
|
2193
|
-
<li
|
|
2194
|
-
<li
|
|
2244
|
+
<p>Parameters:</p>
|
|
2245
|
+
<ul>
|
|
2246
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2247
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2195
2248
|
</ul>
|
|
2196
2249
|
</div>
|
|
2250
|
+
<!--end::Parameters-->
|
|
2251
|
+
<!--begin::Return value-->
|
|
2197
2252
|
<div class="py-5">
|
|
2198
|
-
<p
|
|
2253
|
+
<p>Return value:</p>
|
|
2199
2254
|
<code>boolean</code> Returns true if the first value is less than or equal to the second value, false otherwise.
|
|
2200
2255
|
</div>
|
|
2256
|
+
<!--end::Return value-->
|
|
2201
2257
|
<!--begin::Code-->
|
|
2202
2258
|
<div class="py-5">
|
|
2203
2259
|
<!--begin::Highlight-->
|
|
@@ -2214,20 +2270,24 @@ Else
|
|
|
2214
2270
|
</td>
|
|
2215
2271
|
</tr>
|
|
2216
2272
|
<tr>
|
|
2217
|
-
<td class="
|
|
2273
|
+
<td class="w-250px"><code>gt()</code></td>
|
|
2218
2274
|
<td>
|
|
2219
2275
|
Check for greater than condition (a > b).
|
|
2276
|
+
<!--begin::Parameters-->
|
|
2220
2277
|
<div class="py-5">
|
|
2221
|
-
<p
|
|
2222
|
-
<ul
|
|
2223
|
-
<li
|
|
2224
|
-
<li
|
|
2278
|
+
<p>Parameters:</p>
|
|
2279
|
+
<ul>
|
|
2280
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2281
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2225
2282
|
</ul>
|
|
2226
2283
|
</div>
|
|
2284
|
+
<!--end::Parameters-->
|
|
2285
|
+
<!--begin::Return value-->
|
|
2227
2286
|
<div class="py-5">
|
|
2228
|
-
<p
|
|
2287
|
+
<p>Return value:</p>
|
|
2229
2288
|
<code>boolean</code> Returns true if the first value exceeds the second value, false otherwise.
|
|
2230
2289
|
</div>
|
|
2290
|
+
<!--end::Return value-->
|
|
2231
2291
|
<!--begin::Code-->
|
|
2232
2292
|
<div class="py-5">
|
|
2233
2293
|
<!--begin::Highlight-->
|
|
@@ -2244,20 +2304,24 @@ Else
|
|
|
2244
2304
|
</td>
|
|
2245
2305
|
</tr>
|
|
2246
2306
|
<tr>
|
|
2247
|
-
<td class="
|
|
2307
|
+
<td class="w-250px"><code>gte()</code></td>
|
|
2248
2308
|
<td>
|
|
2249
2309
|
Check for greater than or equals condition (a >= b).
|
|
2310
|
+
<!--begin::Parameters-->
|
|
2250
2311
|
<div class="py-5">
|
|
2251
|
-
<p
|
|
2252
|
-
<ul
|
|
2253
|
-
<li
|
|
2254
|
-
<li
|
|
2312
|
+
<p>Parameters:</p>
|
|
2313
|
+
<ul>
|
|
2314
|
+
<li><code>val1: any</code> First value to be compared with second.</li>
|
|
2315
|
+
<li><code>val2: any</code> Second value to be compared with first.</li>
|
|
2255
2316
|
</ul>
|
|
2256
2317
|
</div>
|
|
2318
|
+
<!--end::Parameters-->
|
|
2319
|
+
<!--begin::Return value-->
|
|
2257
2320
|
<div class="py-5">
|
|
2258
|
-
<p
|
|
2321
|
+
<p>Return value:</p>
|
|
2259
2322
|
<code>boolean</code> Returns true if the first value is greater than or equal to the second value, false otherwise.
|
|
2260
2323
|
</div>
|
|
2324
|
+
<!--end::Return value-->
|
|
2261
2325
|
<!--begin::Code-->
|
|
2262
2326
|
<div class="py-5">
|
|
2263
2327
|
<!--begin::Highlight-->
|
|
@@ -2274,19 +2338,23 @@ Else
|
|
|
2274
2338
|
</td>
|
|
2275
2339
|
</tr>
|
|
2276
2340
|
<tr>
|
|
2277
|
-
<td class="
|
|
2341
|
+
<td class="w-250px"><code>not()</code></td>
|
|
2278
2342
|
<td>
|
|
2279
2343
|
Logical NOT of any expression.
|
|
2344
|
+
<!--begin::Parameters-->
|
|
2280
2345
|
<div class="py-5">
|
|
2281
|
-
<p
|
|
2282
|
-
<ul
|
|
2283
|
-
<li
|
|
2346
|
+
<p>Parameters:</p>
|
|
2347
|
+
<ul>
|
|
2348
|
+
<li><code>val: any</code> Any expression.</li>
|
|
2284
2349
|
</ul>
|
|
2285
2350
|
</div>
|
|
2351
|
+
<!--end::Parameters-->
|
|
2352
|
+
<!--begin::Return value-->
|
|
2286
2353
|
<div class="py-5">
|
|
2287
|
-
<p
|
|
2354
|
+
<p>Return value:</p>
|
|
2288
2355
|
<code>boolean</code> Returns the logical negation of the value.
|
|
2289
2356
|
</div>
|
|
2357
|
+
<!--end::Return value-->
|
|
2290
2358
|
<!--begin::Code-->
|
|
2291
2359
|
<div class="py-5">
|
|
2292
2360
|
<!--begin::Highlight-->
|
|
@@ -2304,21 +2372,25 @@ Else
|
|
|
2304
2372
|
</td>
|
|
2305
2373
|
</tr>
|
|
2306
2374
|
<tr>
|
|
2307
|
-
<td class="
|
|
2375
|
+
<td class="w-250px"><code>ifx()</code></td>
|
|
2308
2376
|
<td>
|
|
2309
2377
|
Helper to imitate the ternary '?:' conditional operator.
|
|
2378
|
+
<!--begin::Parameters-->
|
|
2310
2379
|
<div class="py-5">
|
|
2311
|
-
<p
|
|
2312
|
-
<ul
|
|
2313
|
-
<li
|
|
2314
|
-
<li
|
|
2315
|
-
<li
|
|
2380
|
+
<p>Parameters:</p>
|
|
2381
|
+
<ul>
|
|
2382
|
+
<li><code>condition: boolean</code> Satisfying condition for getting first value. Either true of false.</li>
|
|
2383
|
+
<li><code>val1: any</code> First value to be displayed as result.</li>
|
|
2384
|
+
<li><code>val2: any</code> Second value to be displayed as result. Defaults to an empty string.</li>
|
|
2316
2385
|
</ul>
|
|
2317
2386
|
</div>
|
|
2387
|
+
<!--end::Parameters-->
|
|
2388
|
+
<!--begin::Return value-->
|
|
2318
2389
|
<div class="py-5">
|
|
2319
|
-
<p
|
|
2390
|
+
<p>Return value:</p>
|
|
2320
2391
|
<code>any</code> Returns the result of the ternary operator.
|
|
2321
2392
|
</div>
|
|
2393
|
+
<!--end::Return value-->
|
|
2322
2394
|
<!--begin::Code-->
|
|
2323
2395
|
<div class="py-5">
|
|
2324
2396
|
<!--begin::Highlight-->
|
|
@@ -2341,21 +2413,25 @@ Else
|
|
|
2341
2413
|
</td>
|
|
2342
2414
|
</tr>
|
|
2343
2415
|
<tr>
|
|
2344
|
-
<td class="
|
|
2416
|
+
<td class="w-250px"><code>empty()</code></td>
|
|
2345
2417
|
<td>
|
|
2346
2418
|
Check if it is empty.<br>
|
|
2347
2419
|
If the value is an array, returns true if there are no elements.<br>
|
|
2348
2420
|
If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
2421
|
+
<!--begin::Parameters-->
|
|
2349
2422
|
<div class="py-5">
|
|
2350
|
-
<p
|
|
2351
|
-
<ul
|
|
2352
|
-
<li
|
|
2423
|
+
<p>Parameters:</p>
|
|
2424
|
+
<ul>
|
|
2425
|
+
<li><code>value: any</code> Character strings, arrays, objects, etc. to be checked.</li>
|
|
2353
2426
|
</ul>
|
|
2354
2427
|
</div>
|
|
2428
|
+
<!--end::Parameters-->
|
|
2429
|
+
<!--begin::Return value-->
|
|
2355
2430
|
<div class="py-5">
|
|
2356
|
-
<p
|
|
2431
|
+
<p>Return value:</p>
|
|
2357
2432
|
<code>boolean</code> Returns true if the value is empty, false otherwise.
|
|
2358
2433
|
</div>
|
|
2434
|
+
<!--end::Return value-->
|
|
2359
2435
|
<!--begin::Code-->
|
|
2360
2436
|
<div class="py-5">
|
|
2361
2437
|
<!--begin::Highlight-->
|
|
@@ -2385,21 +2461,25 @@ let val = ' ';
|
|
|
2385
2461
|
</td>
|
|
2386
2462
|
</tr>
|
|
2387
2463
|
<tr>
|
|
2388
|
-
<td class="
|
|
2464
|
+
<td class="w-250px"><code>not_empty()</code></td>
|
|
2389
2465
|
<td>
|
|
2390
2466
|
Check that it is not empty.<br>
|
|
2391
2467
|
If the value is an array, returns true if there is an element.<br>
|
|
2392
2468
|
If the value is a string, the leading and trailing spaces are trimmed and then checked.
|
|
2469
|
+
<!--begin::Parameters-->
|
|
2393
2470
|
<div class="py-5">
|
|
2394
|
-
<p
|
|
2395
|
-
<ul
|
|
2396
|
-
<li
|
|
2471
|
+
<p>Parameters:</p>
|
|
2472
|
+
<ul>
|
|
2473
|
+
<li><code>val: any</code> Character strings, arrays, objects, etc. to be checked.</li>
|
|
2397
2474
|
</ul>
|
|
2398
2475
|
</div>
|
|
2476
|
+
<!--end::Parameters-->
|
|
2477
|
+
<!--begin::Return value-->
|
|
2399
2478
|
<div class="py-5">
|
|
2400
|
-
<p
|
|
2479
|
+
<p>Return value:</p>
|
|
2401
2480
|
<code>boolean</code> Returns true if the value is not empty, false otherwise.
|
|
2402
2481
|
</div>
|
|
2482
|
+
<!--end::Return value-->
|
|
2403
2483
|
<!--begin::Code-->
|
|
2404
2484
|
<div class="py-5">
|
|
2405
2485
|
<!--begin::Highlight-->
|
|
@@ -2429,19 +2509,23 @@ let val = ' ';
|
|
|
2429
2509
|
</td>
|
|
2430
2510
|
</tr>
|
|
2431
2511
|
<tr>
|
|
2432
|
-
<td class="
|
|
2512
|
+
<td class="w-250px"><code>count()</code></td>
|
|
2433
2513
|
<td>
|
|
2434
2514
|
Determine the length of an array.
|
|
2515
|
+
<!--begin::Parameters-->
|
|
2435
2516
|
<div class="py-5">
|
|
2436
|
-
<p
|
|
2437
|
-
<ul
|
|
2438
|
-
<li
|
|
2517
|
+
<p>Parameters:</p>
|
|
2518
|
+
<ul>
|
|
2519
|
+
<li><code>items: any[]</code> Array whose elements to be counted.</li>
|
|
2439
2520
|
</ul>
|
|
2440
2521
|
</div>
|
|
2522
|
+
<!--end::Parameters-->
|
|
2523
|
+
<!--begin::Return value-->
|
|
2441
2524
|
<div class="py-5">
|
|
2442
|
-
<p
|
|
2525
|
+
<p>Return value:</p>
|
|
2443
2526
|
<code>number|false</code> Returns the length of the array if the value is an array, false if the value is not an array.
|
|
2444
2527
|
</div>
|
|
2528
|
+
<!--end::Return value-->
|
|
2445
2529
|
<!--begin::Code-->
|
|
2446
2530
|
<div class="py-5">
|
|
2447
2531
|
<!--begin::Highlight-->
|
|
@@ -2458,19 +2542,23 @@ let val = ' ';
|
|
|
2458
2542
|
</td>
|
|
2459
2543
|
</tr>
|
|
2460
2544
|
<tr>
|
|
2461
|
-
<td class="
|
|
2545
|
+
<td class="w-250px"><code>and()</code></td>
|
|
2462
2546
|
<td>
|
|
2463
2547
|
Returns the boolean AND of two or more parameters passed i.e it is true iff all the parameters are true.
|
|
2548
|
+
<!--begin::Parameters-->
|
|
2464
2549
|
<div class="py-5">
|
|
2465
|
-
<p
|
|
2466
|
-
<ul
|
|
2467
|
-
<li
|
|
2550
|
+
<p>Parameters:</p>
|
|
2551
|
+
<ul>
|
|
2552
|
+
<li><code>...params: any[]</code> Any number of boolean parameters.</li>
|
|
2468
2553
|
</ul>
|
|
2469
2554
|
</div>
|
|
2555
|
+
<!--end::Parameters-->
|
|
2556
|
+
<!--begin::Return value-->
|
|
2470
2557
|
<div class="py-5">
|
|
2471
|
-
<p
|
|
2558
|
+
<p>Return value:</p>
|
|
2472
2559
|
<code>boolean</code> Returns the result of the logical product.
|
|
2473
2560
|
</div>
|
|
2561
|
+
<!--end::Return value-->
|
|
2474
2562
|
<!--begin::Code-->
|
|
2475
2563
|
<div class="py-5">
|
|
2476
2564
|
<!--begin::Highlight-->
|
|
@@ -2496,19 +2584,23 @@ let val1 = false, val2 = true;
|
|
|
2496
2584
|
</td>
|
|
2497
2585
|
</tr>
|
|
2498
2586
|
<tr>
|
|
2499
|
-
<td class="
|
|
2587
|
+
<td class="w-250px"><code>or()</code></td>
|
|
2500
2588
|
<td>
|
|
2501
2589
|
Returns the boolean OR of two or more parameters passed i.e it is true if any of the parameters is true.
|
|
2590
|
+
<!--begin::Parameters-->
|
|
2502
2591
|
<div class="py-5">
|
|
2503
|
-
<p
|
|
2504
|
-
<ul
|
|
2505
|
-
<li
|
|
2592
|
+
<p>Parameters:</p>
|
|
2593
|
+
<ul>
|
|
2594
|
+
<li><code>...params: any[]</code> Any number of boolean parameters.</li>
|
|
2506
2595
|
</ul>
|
|
2507
2596
|
</div>
|
|
2597
|
+
<!--end::Parameters-->
|
|
2598
|
+
<!--begin::Return value-->
|
|
2508
2599
|
<div class="py-5">
|
|
2509
|
-
<p
|
|
2600
|
+
<p>Return value:</p>
|
|
2510
2601
|
<code>boolean</code> Returns the result of the OR.
|
|
2511
2602
|
</div>
|
|
2603
|
+
<!--end::Return value-->
|
|
2512
2604
|
<!--begin::Code-->
|
|
2513
2605
|
<div class="py-5">
|
|
2514
2606
|
<!--begin::Highlight-->
|
|
@@ -2534,20 +2626,24 @@ let val = val2 = false;
|
|
|
2534
2626
|
</td>
|
|
2535
2627
|
</tr>
|
|
2536
2628
|
<tr>
|
|
2537
|
-
<td class="
|
|
2629
|
+
<td class="w-250px"><code>coalesce()</code></td>
|
|
2538
2630
|
<td>
|
|
2539
2631
|
Returns the first non-falsy value from the parameter list.<br>
|
|
2540
2632
|
Works quite similar to the SQL's <code>COALESCE()</code> function, but unlike this checks for the first non-false parameter.
|
|
2633
|
+
<!--begin::Parameters-->
|
|
2541
2634
|
<div class="py-5">
|
|
2542
|
-
<p
|
|
2543
|
-
<ul
|
|
2544
|
-
<li
|
|
2635
|
+
<p>Parameters:</p>
|
|
2636
|
+
<ul>
|
|
2637
|
+
<li><code>...params: any[]</code> Any number of parameters.</li>
|
|
2545
2638
|
</ul>
|
|
2546
2639
|
</div>
|
|
2640
|
+
<!--end::Parameters-->
|
|
2641
|
+
<!--begin::Return value-->
|
|
2547
2642
|
<div class="py-5">
|
|
2548
|
-
<p
|
|
2643
|
+
<p>Return value:</p>
|
|
2549
2644
|
<code>any</code> Returns the first non-false element of the parameter.
|
|
2550
2645
|
</div>
|
|
2646
|
+
<!--end::Return value-->
|
|
2551
2647
|
<!--begin::Code-->
|
|
2552
2648
|
<div class="py-5">
|
|
2553
2649
|
<!--begin::Highlight-->
|
|
@@ -2567,21 +2663,25 @@ let fullName = '', nickName = 'foob';
|
|
|
2567
2663
|
</td>
|
|
2568
2664
|
</tr>
|
|
2569
2665
|
<tr>
|
|
2570
|
-
<td class="
|
|
2666
|
+
<td class="w-250px"><code>includes()</code></td>
|
|
2571
2667
|
<td>
|
|
2572
2668
|
Returns boolean if the array contains the element strictly or non-strictly.
|
|
2669
|
+
<!--begin::Parameters-->
|
|
2573
2670
|
<div class="py-5">
|
|
2574
|
-
<p
|
|
2575
|
-
<ul
|
|
2576
|
-
<li
|
|
2577
|
-
<li
|
|
2578
|
-
<li
|
|
2671
|
+
<p>Parameters:</p>
|
|
2672
|
+
<ul>
|
|
2673
|
+
<li><code>items: any[]</code> The array.</li>
|
|
2674
|
+
<li><code>val: any</code> The value to be checked for existence in the array.</li>
|
|
2675
|
+
<li><code>strict: boolean</code> FALSE for non-strict checking. TRUE by default.</li>
|
|
2579
2676
|
</ul>
|
|
2580
2677
|
</div>
|
|
2678
|
+
<!--end::Parameters-->
|
|
2679
|
+
<!--begin::Return value-->
|
|
2581
2680
|
<div class="py-5">
|
|
2582
|
-
<p
|
|
2681
|
+
<p>Return value:</p>
|
|
2583
2682
|
<code>boolean</code> Returns true if the array contains the specified value, false otherwise.
|
|
2584
2683
|
</div>
|
|
2684
|
+
<!--end::Return value-->
|
|
2585
2685
|
<!--begin::Code-->
|
|
2586
2686
|
<div class="py-5">
|
|
2587
2687
|
<!--begin::Highlight-->
|
|
@@ -2638,20 +2738,24 @@ let val = '2'
|
|
|
2638
2738
|
<!--begin::Body-->
|
|
2639
2739
|
<tbody>
|
|
2640
2740
|
<tr>
|
|
2641
|
-
<td class="
|
|
2741
|
+
<td class="w-250px"><code>cache_busting()</code></td>
|
|
2642
2742
|
<td>
|
|
2643
2743
|
Returns the Assets path containing the file update time parameter.
|
|
2744
|
+
<!--begin::Parameters-->
|
|
2644
2745
|
<div class="py-5">
|
|
2645
|
-
<p
|
|
2646
|
-
<ul
|
|
2647
|
-
<li
|
|
2648
|
-
<li
|
|
2746
|
+
<p>Parameters:</p>
|
|
2747
|
+
<ul>
|
|
2748
|
+
<li><code>filePath: string</code> Paths of Assets files such as CSS and JS in public directories.</li>
|
|
2749
|
+
<li><code>baseUrl: string</code> Application Origin URL.</li>
|
|
2649
2750
|
</ul>
|
|
2650
2751
|
</div>
|
|
2752
|
+
<!--end::Parameters-->
|
|
2753
|
+
<!--begin::Return value-->
|
|
2651
2754
|
<div class="py-5">
|
|
2652
|
-
<p
|
|
2755
|
+
<p>Return value:</p>
|
|
2653
2756
|
<code>string</code> Returns the Assets file path with the update date and time parameters.
|
|
2654
2757
|
</div>
|
|
2758
|
+
<!--end::Return value-->
|
|
2655
2759
|
<!--begin::Code-->
|
|
2656
2760
|
<div class="py-5">
|
|
2657
2761
|
<!--begin::Highlight-->
|
|
@@ -2695,20 +2799,24 @@ let val = '2'
|
|
|
2695
2799
|
<!--begin::Body-->
|
|
2696
2800
|
<tbody>
|
|
2697
2801
|
<tr>
|
|
2698
|
-
<td class="
|
|
2802
|
+
<td class="w-250px"><code>json_stringify()</code></td>
|
|
2699
2803
|
<td>
|
|
2700
2804
|
Stringify an object using JSON.stringify.
|
|
2805
|
+
<!--begin::Parameters-->
|
|
2701
2806
|
<div class="py-5">
|
|
2702
|
-
<p
|
|
2703
|
-
<ul
|
|
2704
|
-
<li
|
|
2705
|
-
<li
|
|
2807
|
+
<p>Parameters:</p>
|
|
2808
|
+
<ul>
|
|
2809
|
+
<li><code>val: any</code> The value to convert to a JSON string.</li>
|
|
2810
|
+
<li><code>indent: number</code> The number of space characters to use as whitespace.</li>
|
|
2706
2811
|
</ul>
|
|
2707
2812
|
</div>
|
|
2813
|
+
<!--end::Parameters-->
|
|
2814
|
+
<!--begin::Return value-->
|
|
2708
2815
|
<div class="py-5">
|
|
2709
|
-
<p
|
|
2816
|
+
<p>Return value:</p>
|
|
2710
2817
|
<code>string</code> A JSON string representing the given value, or undefined.
|
|
2711
2818
|
</div>
|
|
2819
|
+
<!--end::Return value-->
|
|
2712
2820
|
<!--begin::Code-->
|
|
2713
2821
|
<div class="py-5">
|
|
2714
2822
|
<!--begin::Highlight-->
|
|
@@ -2724,19 +2832,23 @@ let val = '2'
|
|
|
2724
2832
|
</td>
|
|
2725
2833
|
</tr>
|
|
2726
2834
|
<tr>
|
|
2727
|
-
<td class="
|
|
2835
|
+
<td class="w-250px"><code>json_parse()</code></td>
|
|
2728
2836
|
<td>
|
|
2729
2837
|
Parses the given string using JSON.parse.
|
|
2838
|
+
<!--begin::Parameters-->
|
|
2730
2839
|
<div class="py-5">
|
|
2731
|
-
<p
|
|
2732
|
-
<ul
|
|
2733
|
-
<li
|
|
2840
|
+
<p>Parameters:</p>
|
|
2841
|
+
<ul>
|
|
2842
|
+
<li><code>val: any</code> Object to stringify.</li>
|
|
2734
2843
|
</ul>
|
|
2735
2844
|
</div>
|
|
2845
|
+
<!--end::Parameters-->
|
|
2846
|
+
<!--begin::Return value-->
|
|
2736
2847
|
<div class="py-5">
|
|
2737
|
-
<p
|
|
2848
|
+
<p>Return value:</p>
|
|
2738
2849
|
<code>any</code> JavaScript value or object described by a string.
|
|
2739
2850
|
</div>
|
|
2851
|
+
<!--end::Return value-->
|
|
2740
2852
|
<!--begin::Code-->
|
|
2741
2853
|
<div class="py-5">
|
|
2742
2854
|
<!--begin::Highlight-->
|
|
@@ -2778,21 +2890,25 @@ let val = '2'
|
|
|
2778
2890
|
<!--begin::Body-->
|
|
2779
2891
|
<tbody>
|
|
2780
2892
|
<tr>
|
|
2781
|
-
<td class="
|
|
2893
|
+
<td class="w-250px"><code>replace()</code></td>
|
|
2782
2894
|
<td>
|
|
2783
2895
|
Returns a new string with some or all matches of a pattern replaced by a replacement.
|
|
2896
|
+
<!--begin::Parameters-->
|
|
2784
2897
|
<div class="py-5">
|
|
2785
|
-
<p
|
|
2786
|
-
<ul
|
|
2787
|
-
<li
|
|
2788
|
-
<li
|
|
2789
|
-
<li
|
|
2898
|
+
<p>Parameters:</p>
|
|
2899
|
+
<ul>
|
|
2900
|
+
<li><code>val: string</code> String.</li>
|
|
2901
|
+
<li><code>find: string</code> The string to be replaced.</li>
|
|
2902
|
+
<li><code>replace: string</code> The string to replace.</li>
|
|
2790
2903
|
</ul>
|
|
2791
2904
|
</div>
|
|
2905
|
+
<!--end::Parameters-->
|
|
2906
|
+
<!--begin::Return value-->
|
|
2792
2907
|
<div class="py-5">
|
|
2793
|
-
<p
|
|
2908
|
+
<p>Return value:</p>
|
|
2794
2909
|
<code>string</code> Character string after replacement.
|
|
2795
2910
|
</div>
|
|
2911
|
+
<!--end::Return value-->
|
|
2796
2912
|
<!--begin::Code-->
|
|
2797
2913
|
<div class="py-5">
|
|
2798
2914
|
<!--begin::Highlight-->
|
|
@@ -2808,20 +2924,24 @@ let val = '2'
|
|
|
2808
2924
|
</td>
|
|
2809
2925
|
</tr>
|
|
2810
2926
|
<tr>
|
|
2811
|
-
<td class="
|
|
2927
|
+
<td class="w-250px"><code>split()</code></td>
|
|
2812
2928
|
<td>
|
|
2813
2929
|
Split `string` by the given `character`.
|
|
2930
|
+
<!--begin::Parameters-->
|
|
2814
2931
|
<div class="py-5">
|
|
2815
|
-
<p
|
|
2816
|
-
<ul
|
|
2817
|
-
<li
|
|
2818
|
-
<li
|
|
2932
|
+
<p>Parameters:</p>
|
|
2933
|
+
<ul>
|
|
2934
|
+
<li><code>val: string</code> String.</li>
|
|
2935
|
+
<li><code>separator: string</code> A character that delimits the substrings in this string. Default is a comma.</li>
|
|
2819
2936
|
</ul>
|
|
2820
2937
|
</div>
|
|
2938
|
+
<!--end::Parameters-->
|
|
2939
|
+
<!--begin::Return value-->
|
|
2821
2940
|
<div class="py-5">
|
|
2822
|
-
<p
|
|
2941
|
+
<p>Return value:</p>
|
|
2823
2942
|
<code>string[]</code> An Array of strings, split at each point where the separator occurs in the given string. The default is a comma.
|
|
2824
2943
|
</div>
|
|
2944
|
+
<!--end::Return value-->
|
|
2825
2945
|
<!--begin::Code-->
|
|
2826
2946
|
<div class="py-5">
|
|
2827
2947
|
<!--begin::Highlight-->
|
|
@@ -2846,20 +2966,24 @@ let val = '2'
|
|
|
2846
2966
|
</td>
|
|
2847
2967
|
</tr>
|
|
2848
2968
|
<tr>
|
|
2849
|
-
<td class="
|
|
2969
|
+
<td class="w-250px"><code>format_bytes()</code></td>
|
|
2850
2970
|
<td>
|
|
2851
2971
|
Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).
|
|
2972
|
+
<!--begin::Parameters-->
|
|
2852
2973
|
<div class="py-5">
|
|
2853
|
-
<p
|
|
2854
|
-
<ul
|
|
2855
|
-
<li
|
|
2856
|
-
<li
|
|
2974
|
+
<p>Parameters:</p>
|
|
2975
|
+
<ul>
|
|
2976
|
+
<li><code>bytes: number</code> Bytes.</li>
|
|
2977
|
+
<li><code>decimals?: number</code> Number of decimal places to display. Default is 0.</li>
|
|
2857
2978
|
</ul>
|
|
2858
2979
|
</div>
|
|
2980
|
+
<!--end::Parameters-->
|
|
2981
|
+
<!--begin::Return value-->
|
|
2859
2982
|
<div class="py-5">
|
|
2860
|
-
<p
|
|
2983
|
+
<p>Return value:</p>
|
|
2861
2984
|
<code>string</code> Returns a value with units.
|
|
2862
2985
|
</div>
|
|
2986
|
+
<!--end::Return value-->
|
|
2863
2987
|
<!--begin::Code-->
|
|
2864
2988
|
<div class="py-5">
|
|
2865
2989
|
<!--begin::Highlight-->
|
|
@@ -2905,21 +3029,25 @@ let val = '2'
|
|
|
2905
3029
|
<!--begin::Body-->
|
|
2906
3030
|
<tbody>
|
|
2907
3031
|
<tr>
|
|
2908
|
-
<td class="
|
|
3032
|
+
<td class="w-250px"><code>format_date()</code></td>
|
|
2909
3033
|
<td>
|
|
2910
3034
|
Use moment to format the date.
|
|
3035
|
+
<!--begin::Parameters-->
|
|
2911
3036
|
<div class="py-5">
|
|
2912
|
-
<p
|
|
2913
|
-
<ul
|
|
2914
|
-
<li
|
|
2915
|
-
<li
|
|
2916
|
-
<li
|
|
3037
|
+
<p>Parameters:</p>
|
|
3038
|
+
<ul>
|
|
3039
|
+
<li><code>format: string</code> A format string based on moment.</li>
|
|
3040
|
+
<li><code>date: string</code> Date string to format.</li>
|
|
3041
|
+
<li><code>locale: string|string[]</code> Language or language-country locale string (or array of strings) available in <a href="https://github.com/moment/moment/tree/develop/locale" class="fw-semibold" target="_blank">https://github.com/moment/moment/tree/develop/locale</a>.</li>
|
|
2917
3042
|
</ul>
|
|
2918
3043
|
</div>
|
|
3044
|
+
<!--end::Parameters-->
|
|
3045
|
+
<!--begin::Return value-->
|
|
2919
3046
|
<div class="py-5">
|
|
2920
|
-
<p
|
|
3047
|
+
<p>Return value:</p>
|
|
2921
3048
|
<code>string</code> Returns formatted date.
|
|
2922
3049
|
</div>
|
|
3050
|
+
<!--end::Return value-->
|
|
2923
3051
|
<!--begin::Code-->
|
|
2924
3052
|
<div class="py-5">
|
|
2925
3053
|
<!--begin::Highlight-->
|
|
@@ -2964,10 +3092,10 @@ let val = '2'
|
|
|
2964
3092
|
Models provide a way to interact with a specific table in your database.<br>
|
|
2965
3093
|
Express Sweet provides a <a href="https://sequelize.org/docs/v6/" target="_blank">Sequelize</a> based model class that offers some great features, including.
|
|
2966
3094
|
<div class="py-5">
|
|
2967
|
-
<ul
|
|
2968
|
-
<li
|
|
2969
|
-
<li
|
|
2970
|
-
<li
|
|
3095
|
+
<ul>
|
|
3096
|
+
<li>Automatic database connection.</li>
|
|
3097
|
+
<li>Basic CRUD methods.</li>
|
|
3098
|
+
<li>And more.</li>
|
|
2971
3099
|
</ul>
|
|
2972
3100
|
</div>
|
|
2973
3101
|
This class provides a solid base from which to build your own models, allowing you to rapidly build out your application’s model layer.
|
|
@@ -3017,7 +3145,7 @@ let val = '2'
|
|
|
3017
3145
|
<!--begin::Head-->
|
|
3018
3146
|
<thead>
|
|
3019
3147
|
<tr class="fs-4 fw-bold p-6">
|
|
3020
|
-
<th class="min-w-200px">Name</th>
|
|
3148
|
+
<th class="min-w-200px">Item Name</th>
|
|
3021
3149
|
<th>Description</th>
|
|
3022
3150
|
</tr>
|
|
3023
3151
|
</thead>
|
|
@@ -3025,44 +3153,44 @@ let val = '2'
|
|
|
3025
3153
|
<!--begin::Body-->
|
|
3026
3154
|
<tbody>
|
|
3027
3155
|
<tr>
|
|
3028
|
-
<td class="
|
|
3156
|
+
<td class="w-250px"><code>username: string</code></td>
|
|
3029
3157
|
<td>The username which is used to authenticate against the database.</td>
|
|
3030
3158
|
</tr>
|
|
3031
3159
|
<tr>
|
|
3032
|
-
<td class="
|
|
3160
|
+
<td class="w-250px"><code>password: string|null</code></td>
|
|
3033
3161
|
<td>
|
|
3034
3162
|
The password which is used to authenticate against the database.<br>
|
|
3035
3163
|
The default is no password (<code>null</code>).
|
|
3036
3164
|
</td>
|
|
3037
3165
|
</tr>
|
|
3038
3166
|
<tr>
|
|
3039
|
-
<td class="
|
|
3167
|
+
<td class="w-250px"><code>database: string</code></td>
|
|
3040
3168
|
<td>The name of the database.</td>
|
|
3041
3169
|
</tr>
|
|
3042
3170
|
<tr>
|
|
3043
|
-
<td class="
|
|
3171
|
+
<td class="w-250px"><code>host: string</code></td>
|
|
3044
3172
|
<td>The host of the relational database.</td>
|
|
3045
3173
|
</tr>
|
|
3046
3174
|
<tr>
|
|
3047
|
-
<td class="
|
|
3175
|
+
<td class="w-250px"><code>port: number|null</code></td>
|
|
3048
3176
|
<td>The port of the relational database.<br>The default is automatic selection (<code>null</code>).</td>
|
|
3049
3177
|
</tr>
|
|
3050
3178
|
<tr>
|
|
3051
|
-
<td class="
|
|
3179
|
+
<td class="w-250px"><code>dialect: string</code></td>
|
|
3052
3180
|
<td>
|
|
3053
3181
|
The dialect of the database you are connecting to.<br>
|
|
3054
3182
|
One of <code>mariadb</code>, <code>mysql</code>, <code>postgres</code>, <code>sqlite</code> and <code>mssql</code>.
|
|
3055
3183
|
</td>
|
|
3056
3184
|
</tr>
|
|
3057
3185
|
<tr>
|
|
3058
|
-
<td class="
|
|
3186
|
+
<td class="w-250px"><code>logging: boolean|(...message: any[]) => void</code></td>
|
|
3059
3187
|
<td>
|
|
3060
3188
|
Set true to output the executed query etc. to the log.<br>
|
|
3061
3189
|
The default is no log output (<code>false</code>).
|
|
3062
3190
|
</td>
|
|
3063
3191
|
</tr>
|
|
3064
3192
|
<tr>
|
|
3065
|
-
<td class="
|
|
3193
|
+
<td class="w-250px"><code>timezone</code></td>
|
|
3066
3194
|
<td>
|
|
3067
3195
|
Time zone dedicated to writing to the database.<br>
|
|
3068
3196
|
For example, for the Japanese time zone, do the following.<br>
|
|
@@ -3286,17 +3414,19 @@ module.exports = class extends Model {
|
|
|
3286
3414
|
<!--begin::Body-->
|
|
3287
3415
|
<tbody>
|
|
3288
3416
|
<tr>
|
|
3289
|
-
<td class="
|
|
3417
|
+
<td class="w-250px"><code>constructor()</code></td>
|
|
3290
3418
|
<td>Instantiate sequelize with name of database, username and password.</td>
|
|
3291
3419
|
</tr>
|
|
3292
3420
|
<tr>
|
|
3293
|
-
<td class="
|
|
3421
|
+
<td class="w-250px"><code>isConnect()</code></td>
|
|
3294
3422
|
<td>
|
|
3295
3423
|
Test the connection by trying to authenticate. It runs <code>SELECT 1+1 AS result</code> query.
|
|
3424
|
+
<!--begin::Return value-->
|
|
3296
3425
|
<div class="py-5">
|
|
3297
|
-
<p
|
|
3426
|
+
<p>Return value:</p>
|
|
3298
3427
|
<code>Promise<boolean></code> Returns <code>true</code> if it can connect to the database, <code>false</code> if it cannot.
|
|
3299
3428
|
</div>
|
|
3429
|
+
<!--end::Return value-->
|
|
3300
3430
|
<!--begin::Code-->
|
|
3301
3431
|
<div class="py-5">
|
|
3302
3432
|
<!--begin::Highlight-->
|
|
@@ -3371,7 +3501,7 @@ const isConnected = await database.isConnect();</code></pre>
|
|
|
3371
3501
|
<!--begin::Body-->
|
|
3372
3502
|
<tbody>
|
|
3373
3503
|
<tr>
|
|
3374
|
-
<td class="
|
|
3504
|
+
<td class="w-250px"><code>protected static table: string</code></td>
|
|
3375
3505
|
<td>The name of the table that the model accesses. This member must be defined in a subclass.
|
|
3376
3506
|
<!--begin::Code-->
|
|
3377
3507
|
<div class="py-5">
|
|
@@ -3417,7 +3547,7 @@ module.exports = class extends Model {
|
|
|
3417
3547
|
</td>
|
|
3418
3548
|
</tr>
|
|
3419
3549
|
<tr>
|
|
3420
|
-
<td class="
|
|
3550
|
+
<td class="w-250px"><code>protected static attributes: sequelize.ModelAttributes</code></td>
|
|
3421
3551
|
<td>List of columns in the table accessed by this model. This member must be defined in a subclass.
|
|
3422
3552
|
<!--begin::Code-->
|
|
3423
3553
|
<div class="py-5">
|
|
@@ -3487,7 +3617,7 @@ module.exports = class extends Model {
|
|
|
3487
3617
|
</td>
|
|
3488
3618
|
</tr>
|
|
3489
3619
|
<tr>
|
|
3490
|
-
<td class="
|
|
3620
|
+
<td class="w-250px"><code>static readonly DataTypes: {[key: string]: any}</code></td>
|
|
3491
3621
|
<td>
|
|
3492
3622
|
A convenience class holding commonly used data types.<br>
|
|
3493
3623
|
This is an alias for <code>sequelize.DataTypes</code>.<br>
|
|
@@ -3507,7 +3637,7 @@ module.exports = class extends Model {
|
|
|
3507
3637
|
</td>
|
|
3508
3638
|
</tr>
|
|
3509
3639
|
<tr>
|
|
3510
|
-
<td class="
|
|
3640
|
+
<td class="w-250px"><code>static readonly Op: {[key: string]: any}</code></td>
|
|
3511
3641
|
<td>
|
|
3512
3642
|
Operator symbols to be used when querying data. This is an alias for <code>sequelize.Op</code>.<br>
|
|
3513
3643
|
See <a href="https://sequelize.org/v5/variable/index.html#static-variable-Op" class="fw-semibold" target="_blank">here</a> for details.
|
|
@@ -3597,7 +3727,7 @@ BookModel.destroy({
|
|
|
3597
3727
|
</td>
|
|
3598
3728
|
</tr>
|
|
3599
3729
|
<tr>
|
|
3600
|
-
<td class="
|
|
3730
|
+
<td class="w-250px"><code>static readonly fn: (fn: string, ...args: unknown[]) => any</code></td>
|
|
3601
3731
|
<td>
|
|
3602
3732
|
Creates an object representing a database function.<br>
|
|
3603
3733
|
This can be used in search queries, both in where and order parts, and as default values in column definitions.<br>
|
|
@@ -3659,7 +3789,7 @@ console.log('books=', books);</code></pre>
|
|
|
3659
3789
|
</td>
|
|
3660
3790
|
</tr>
|
|
3661
3791
|
<tr>
|
|
3662
|
-
<td class="
|
|
3792
|
+
<td class="w-250px"><code>static readonly col: (col: string) => any</code></td>
|
|
3663
3793
|
<td>
|
|
3664
3794
|
Creates an object which represents a column in the DB, this allows referencing another column in your query.<br>
|
|
3665
3795
|
This is often useful in conjunction with sequelize.fn, since raw string arguments to fn will be escaped.<br>
|
|
@@ -3667,7 +3797,7 @@ console.log('books=', books);</code></pre>
|
|
|
3667
3797
|
</td>
|
|
3668
3798
|
</tr>
|
|
3669
3799
|
<tr>
|
|
3670
|
-
<td class="
|
|
3800
|
+
<td class="w-250px"><code>static readonly literal: (val: string) => any</code></td>
|
|
3671
3801
|
<td>
|
|
3672
3802
|
Creates an object representing a literal, i.e. something that will not be escaped.<br>
|
|
3673
3803
|
See <a href="https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#static-method-literal" class="fw-semibold" target="_blank">here</a> for details.
|
|
@@ -3743,7 +3873,7 @@ console.log('books=', books);</code></pre>
|
|
|
3743
3873
|
</td>
|
|
3744
3874
|
</tr>
|
|
3745
3875
|
<tr>
|
|
3746
|
-
<td class="
|
|
3876
|
+
<td class="w-250px"><code>static readonly where: (attr: sequelize.AttributeType, comparator: string, logic: sequelize.LogicType) => sequelize.Utils.Where</code></td>
|
|
3747
3877
|
<td>
|
|
3748
3878
|
A way of specifying attr = condition.<br>
|
|
3749
3879
|
The attr can either be an object taken from Model.rawAttributes (for example Model.rawAttributes.id or Model.rawAttributes.name).<br>
|
|
@@ -3808,14 +3938,14 @@ console.log('books=', books);</code></pre>
|
|
|
3808
3938
|
</td>
|
|
3809
3939
|
</tr>
|
|
3810
3940
|
<tr>
|
|
3811
|
-
<td class="
|
|
3941
|
+
<td class="w-250px"><code>static readonly QueryTypes: {[key: string]: string}</code></td>
|
|
3812
3942
|
<td>
|
|
3813
3943
|
An enum of query types used by sequelize.query<br>
|
|
3814
3944
|
See <a href="https://sequelize.org/master/variable/index.html#static-variable-QueryTypes" class="fw-semibold" target="_blank">here</a> for details.
|
|
3815
3945
|
</td>
|
|
3816
3946
|
</tr>
|
|
3817
3947
|
<tr>
|
|
3818
|
-
<td class="
|
|
3948
|
+
<td class="w-250px"><code>static readonly Transaction: (typeof <a href="https://sequelize.org/docs/v6/other-topics/transactions/" class="fw-semibold" target="_blank">sequelize.Transaction</a>)</code></td>
|
|
3819
3949
|
<td>
|
|
3820
3950
|
Reference to <a href="https://sequelize.org/docs/v6/other-topics/transactions/" class="fw-semibold" target="_blank">sequelize.Transaction</a>.<br>
|
|
3821
3951
|
This includes properties such as isolation level enums used with the transaction option.<br>
|
|
@@ -3864,7 +3994,7 @@ BookModel.Transaction.ISOLATION_LEVELS.SERIALIZABLE // "SERIALIZABLE"<
|
|
|
3864
3994
|
<!--begin::Body-->
|
|
3865
3995
|
<tbody>
|
|
3866
3996
|
<tr>
|
|
3867
|
-
<td class="
|
|
3997
|
+
<td class="w-250px"><code>static association()</code></td>
|
|
3868
3998
|
<td>
|
|
3869
3999
|
Associate the model.<br>
|
|
3870
4000
|
Define associations with other models such as <code>hasOne</code>, <code>hasMany</code>, <code>belongsTo</code>, <code>belongsToMany</code>.<br>
|
|
@@ -3927,22 +4057,26 @@ module.exports = class extends Model {
|
|
|
3927
4057
|
</td>
|
|
3928
4058
|
</tr>
|
|
3929
4059
|
<tr>
|
|
3930
|
-
<td class="
|
|
4060
|
+
<td class="w-250px"><code>static begin()</code></td>
|
|
3931
4061
|
<td>
|
|
3932
4062
|
Starts a transaction and returns a transaction object to identify the running transaction.<br>
|
|
3933
4063
|
This is an alias for the <code>"sequelize.Sequelize.transaction()"</code> method.<br>
|
|
3934
4064
|
See <a href="https://sequelize.org/master/class/lib/sequelize.js~Sequelize.html#instance-method-transaction" class="fw-semibold" target="_blank">here</a><br>
|
|
3935
4065
|
and <a href="https://sequelize.org/master/class/lib/transaction.js~Transaction.html" class="fw-semibold" target="_blank">here</a> for more information.
|
|
4066
|
+
<!--begin::Parameters-->
|
|
3936
4067
|
<div class="py-5">
|
|
3937
|
-
<p
|
|
3938
|
-
<ul
|
|
3939
|
-
<li
|
|
4068
|
+
<p>Parameters:</p>
|
|
4069
|
+
<ul>
|
|
4070
|
+
<li><code>options?: sequelize.TransactionOptions</code> Options provided when the transaction is created.</li>
|
|
3940
4071
|
</ul>
|
|
3941
4072
|
</div>
|
|
4073
|
+
<!--end::Parameters-->
|
|
4074
|
+
<!--begin::Return value-->
|
|
3942
4075
|
<div class="py-5">
|
|
3943
|
-
<p
|
|
4076
|
+
<p>Return value:</p>
|
|
3944
4077
|
<code>Promise<sequelize.Transaction></code> Returns a transaction object to identify the transaction being executed.
|
|
3945
4078
|
</div>
|
|
4079
|
+
<!--end::Return value-->
|
|
3946
4080
|
<!--begin::Code-->
|
|
3947
4081
|
<div class="py-5">
|
|
3948
4082
|
<!--begin::Highlight-->
|
|
@@ -4039,21 +4173,25 @@ try {
|
|
|
4039
4173
|
</td>
|
|
4040
4174
|
</tr>
|
|
4041
4175
|
<tr>
|
|
4042
|
-
<td class="
|
|
4176
|
+
<td class="w-250px"><code>static create()</code></td>
|
|
4043
4177
|
<td>
|
|
4044
4178
|
Builds a new model instance and calls <code>save</code> on it.<br>
|
|
4045
4179
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-create" class="fw-semibold" target="_blank">here</a> for details.
|
|
4180
|
+
<!--begin::Parameters-->
|
|
4046
4181
|
<div class="py-5">
|
|
4047
|
-
<p
|
|
4048
|
-
<ul
|
|
4049
|
-
<li
|
|
4050
|
-
<li
|
|
4182
|
+
<p>Parameters:</p>
|
|
4183
|
+
<ul>
|
|
4184
|
+
<li><code>values: object</code> Hash of data values to create new record with.</li>
|
|
4185
|
+
<li><code>options: object</code> Build and query options.</li>
|
|
4051
4186
|
</ul>
|
|
4052
4187
|
</div>
|
|
4188
|
+
<!--end::Parameters-->
|
|
4189
|
+
<!--begin::Return value-->
|
|
4053
4190
|
<div class="py-5">
|
|
4054
|
-
<p
|
|
4191
|
+
<p>Return value:</p>
|
|
4055
4192
|
<code>Promise<Model></code> Returns a model that contains the data for the added record.
|
|
4056
4193
|
</div>
|
|
4194
|
+
<!--end::Return value-->
|
|
4057
4195
|
<!--begin::Code-->
|
|
4058
4196
|
<div class="py-5">
|
|
4059
4197
|
<!--begin::Highlight-->
|
|
@@ -4092,20 +4230,24 @@ await BookModel.create({title: 'Beautiful'});</code></pre>
|
|
|
4092
4230
|
</td>
|
|
4093
4231
|
</tr>
|
|
4094
4232
|
<tr>
|
|
4095
|
-
<td class="
|
|
4233
|
+
<td class="w-250px"><code>static save()</code></td>
|
|
4096
4234
|
<td>
|
|
4097
4235
|
Validates this instance, and if the validation passes, persists it to the database.<br>
|
|
4098
4236
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#instance-method-save" class="fw-semibold target="_blank">here</a> for details.
|
|
4237
|
+
<!--begin::Parameters-->
|
|
4099
4238
|
<div class="py-5">
|
|
4100
|
-
<p
|
|
4101
|
-
<ul
|
|
4102
|
-
<li
|
|
4239
|
+
<p>Parameters:</p>
|
|
4240
|
+
<ul>
|
|
4241
|
+
<li><code>options: object</code> save options.</li>
|
|
4103
4242
|
</ul>
|
|
4104
4243
|
</div>
|
|
4244
|
+
<!--end::Parameters-->
|
|
4245
|
+
<!--begin::Return value-->
|
|
4105
4246
|
<div class="py-5">
|
|
4106
|
-
<p
|
|
4247
|
+
<p>Return value:</p>
|
|
4107
4248
|
<code>Promise<Model></code> Returns a model that contains data for manipulated records such as add and update.
|
|
4108
4249
|
</div>
|
|
4250
|
+
<!--end::Return value-->
|
|
4109
4251
|
<!--begin::Code-->
|
|
4110
4252
|
<div class="py-5">
|
|
4111
4253
|
<!--begin::Highlight-->
|
|
@@ -4154,21 +4296,25 @@ await book.save();</code></pre>
|
|
|
4154
4296
|
</td>
|
|
4155
4297
|
</tr>
|
|
4156
4298
|
<tr>
|
|
4157
|
-
<td class="
|
|
4299
|
+
<td class="w-250px"><code>static findOne()</code></td>
|
|
4158
4300
|
<td>
|
|
4159
4301
|
Search for a single instance.<br>
|
|
4160
4302
|
Returns the first instance found, or null if none can be found.<br>
|
|
4161
4303
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-findOne" class="fw-semibold" target="_blank">here</a> for details.
|
|
4304
|
+
<!--begin::Parameters-->
|
|
4162
4305
|
<div class="py-5">
|
|
4163
|
-
<p
|
|
4164
|
-
<ul
|
|
4165
|
-
<li
|
|
4306
|
+
<p>Parameters:</p>
|
|
4307
|
+
<ul>
|
|
4308
|
+
<li><code>options: object</code> A hash of options to describe the scope of the search.</li>
|
|
4166
4309
|
</ul>
|
|
4167
4310
|
</div>
|
|
4311
|
+
<!--end::Parameters-->
|
|
4312
|
+
<!--begin::Return value-->
|
|
4168
4313
|
<div class="py-5">
|
|
4169
|
-
<p
|
|
4314
|
+
<p>Return value:</p>
|
|
4170
4315
|
<code>Promise<Model|null></code> Returns a Model containing the first data found in the database.
|
|
4171
4316
|
</div>
|
|
4317
|
+
<!--end::Return value-->
|
|
4172
4318
|
<!--begin::Code-->
|
|
4173
4319
|
<div class="py-5">
|
|
4174
4320
|
<!--begin::Highlight-->
|
|
@@ -4207,20 +4353,24 @@ await BookModel.findOne();</code></pre>
|
|
|
4207
4353
|
</td>
|
|
4208
4354
|
</tr>
|
|
4209
4355
|
<tr>
|
|
4210
|
-
<td class="
|
|
4356
|
+
<td class="w-250px"><code>static findAll()</code></td>
|
|
4211
4357
|
<td>
|
|
4212
4358
|
Search for multiple instances.<br>
|
|
4213
4359
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-findAll" class="fw-semibold target="_blank">here</a> for details.
|
|
4360
|
+
<!--begin::Parameters-->
|
|
4214
4361
|
<div class="py-5">
|
|
4215
|
-
<p
|
|
4216
|
-
<ul
|
|
4217
|
-
<li
|
|
4362
|
+
<p>Parameters:</p>
|
|
4363
|
+
<ul>
|
|
4364
|
+
<li><code>options: object</code> A hash of options to describe the scope of the search.</li>
|
|
4218
4365
|
</ul>
|
|
4219
4366
|
</div>
|
|
4367
|
+
<!--end::Parameters-->
|
|
4368
|
+
<!--begin::Return value-->
|
|
4220
4369
|
<div class="py-5">
|
|
4221
|
-
<p
|
|
4370
|
+
<p>Return value:</p>
|
|
4222
4371
|
<code>Promise<Array<Model>></code> Returns a model containing the data found in the database.
|
|
4223
4372
|
</div>
|
|
4373
|
+
<!--end::Return value-->
|
|
4224
4374
|
<!--begin::Code-->
|
|
4225
4375
|
<div class="py-5">
|
|
4226
4376
|
<!--begin::Highlight-->
|
|
@@ -4271,20 +4421,24 @@ await BookModel.findAll({
|
|
|
4271
4421
|
</td>
|
|
4272
4422
|
</tr>
|
|
4273
4423
|
<tr>
|
|
4274
|
-
<td class="
|
|
4424
|
+
<td class="w-250px"><code>static count()</code></td>
|
|
4275
4425
|
<td>
|
|
4276
4426
|
Count the number of records matching the provided where clause.<br>
|
|
4277
4427
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-count" class="fw-semibold target="_blank">here</a> for details.
|
|
4428
|
+
<!--begin::Parameters-->
|
|
4278
4429
|
<div class="py-5">
|
|
4279
|
-
<p
|
|
4280
|
-
<ul
|
|
4281
|
-
<li
|
|
4430
|
+
<p>Parameters:</p>
|
|
4431
|
+
<ul>
|
|
4432
|
+
<li><code>options: object</code> A hash of options to describe the scope of the search.</li>
|
|
4282
4433
|
</ul>
|
|
4283
4434
|
</div>
|
|
4435
|
+
<!--end::Parameters-->
|
|
4436
|
+
<!--begin::Return value-->
|
|
4284
4437
|
<div class="py-5">
|
|
4285
|
-
<p
|
|
4438
|
+
<p>Return value:</p>
|
|
4286
4439
|
<code>Promise<number></code> Returns the count of records that match the condition.
|
|
4287
4440
|
</div>
|
|
4441
|
+
<!--end::Return value-->
|
|
4288
4442
|
<!--begin::Code-->
|
|
4289
4443
|
<div class="py-5">
|
|
4290
4444
|
<!--begin::Highlight-->
|
|
@@ -4323,21 +4477,25 @@ await BookModel.count();</code></pre>
|
|
|
4323
4477
|
</td>
|
|
4324
4478
|
</tr>
|
|
4325
4479
|
<tr>
|
|
4326
|
-
<td class="
|
|
4480
|
+
<td class="w-250px"><code>static update()</code></td>
|
|
4327
4481
|
<td>
|
|
4328
4482
|
Update multiple instances that match the where options.<br>
|
|
4329
4483
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-update" class="fw-semibold" target="_blank">here</a> for details.
|
|
4484
|
+
<!--begin::Parameters-->
|
|
4330
4485
|
<div class="py-5">
|
|
4331
|
-
<p
|
|
4332
|
-
<ul
|
|
4333
|
-
<li
|
|
4334
|
-
<li
|
|
4486
|
+
<p>Parameters:</p>
|
|
4487
|
+
<ul>
|
|
4488
|
+
<li><code>values: object</code> hash of values to update.</li>
|
|
4489
|
+
<li><code>options: object</code> update options.</li>
|
|
4335
4490
|
</ul>
|
|
4336
4491
|
</div>
|
|
4492
|
+
<!--end::Parameters-->
|
|
4493
|
+
<!--begin::Return value-->
|
|
4337
4494
|
<div class="py-5">
|
|
4338
|
-
<p
|
|
4495
|
+
<p>Return value:</p>
|
|
4339
4496
|
<code>Promise<Array<number, number>></code> The first element is always the number of affected rows, while the second element is the actual affected rows (only supported in postgres with <code>options.returning</code> true).
|
|
4340
4497
|
</div>
|
|
4498
|
+
<!--end::Return value-->
|
|
4341
4499
|
<!--begin::Code-->
|
|
4342
4500
|
<div class="py-5">
|
|
4343
4501
|
<!--begin::Highlight-->
|
|
@@ -4376,24 +4534,28 @@ await BookModel.update({title: 'Lose Yourself'}, {where: {id: 1}});</c
|
|
|
4376
4534
|
</td>
|
|
4377
4535
|
</tr>
|
|
4378
4536
|
<tr>
|
|
4379
|
-
<td class="
|
|
4537
|
+
<td class="w-250px"><code>static upsert()</code></td>
|
|
4380
4538
|
<td>
|
|
4381
4539
|
Insert or update a single row.<br>
|
|
4382
4540
|
An update will be executed if a row which matches the supplied values on either the primary key or a unique key is found.<br>
|
|
4383
4541
|
Note that the unique index must be defined in your sequelize model and not just in the table.<br>
|
|
4384
4542
|
Otherwise you may experience a unique constraint violation, because sequelize fails to identify the row that should be updated.<br>
|
|
4385
4543
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-upsert" class="fw-semibold" target="_blank">here</a> for details.
|
|
4544
|
+
<!--begin::Parameters-->
|
|
4386
4545
|
<div class="py-5">
|
|
4387
|
-
<p
|
|
4388
|
-
<ul
|
|
4389
|
-
<li
|
|
4390
|
-
<li
|
|
4546
|
+
<p>Parameters:</p>
|
|
4547
|
+
<ul>
|
|
4548
|
+
<li><code>values: object</code> hash of values to upsert.</li>
|
|
4549
|
+
<li><code>options: object</code> upsert options.</li>
|
|
4391
4550
|
</ul>
|
|
4392
4551
|
</div>
|
|
4552
|
+
<!--end::Parameters-->
|
|
4553
|
+
<!--begin::Return value-->
|
|
4393
4554
|
<div class="py-5">
|
|
4394
|
-
<p
|
|
4555
|
+
<p>Return value:</p>
|
|
4395
4556
|
<code>Promise<Model, boolean|null></code> returns record and whether row was created or updated as boolean. For Postgres/SQLite dialects boolean value is always null.
|
|
4396
4557
|
</div>
|
|
4558
|
+
<!--end::Return value-->
|
|
4397
4559
|
<!--begin::Code-->
|
|
4398
4560
|
<div class="py-5">
|
|
4399
4561
|
<!--begin::Highlight-->
|
|
@@ -4432,20 +4594,24 @@ await BookModel.upsert({title: 'Lose Yourself'});</code></pre>
|
|
|
4432
4594
|
</td>
|
|
4433
4595
|
</tr>
|
|
4434
4596
|
<tr>
|
|
4435
|
-
<td class="
|
|
4597
|
+
<td class="w-250px"><code>static destroy()</code></td>
|
|
4436
4598
|
<td>
|
|
4437
4599
|
Delete multiple instances, or set their deletedAt timestamp to the current time if paranoid is enabled.<br>
|
|
4438
4600
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-destroy" class="fw-semibold" target="_blank">here</a> for details.
|
|
4601
|
+
<!--begin::Parameters-->
|
|
4439
4602
|
<div class="py-5">
|
|
4440
|
-
<p
|
|
4441
|
-
<ul
|
|
4442
|
-
<li
|
|
4603
|
+
<p>Parameters:</p>
|
|
4604
|
+
<ul>
|
|
4605
|
+
<li><code>options: object</code> destroy options.</li>
|
|
4443
4606
|
</ul>
|
|
4444
4607
|
</div>
|
|
4608
|
+
<!--end::Parameters-->
|
|
4609
|
+
<!--begin::Return value-->
|
|
4445
4610
|
<div class="py-5">
|
|
4446
|
-
<p
|
|
4611
|
+
<p>Return value:</p>
|
|
4447
4612
|
<code>Promise<number></code> The number of destroyed rows.
|
|
4448
4613
|
</div>
|
|
4614
|
+
<!--end::Return value-->
|
|
4449
4615
|
<!--begin::Code-->
|
|
4450
4616
|
<div class="py-5">
|
|
4451
4617
|
<!--begin::Highlight-->
|
|
@@ -4484,23 +4650,26 @@ await BookModel.destroy({where: {id :1}});</code></pre>
|
|
|
4484
4650
|
</td>
|
|
4485
4651
|
</tr>
|
|
4486
4652
|
<tr>
|
|
4487
|
-
<td class="
|
|
4653
|
+
<td class="w-250px"><code>static hasOne()</code></td>
|
|
4488
4654
|
<td>
|
|
4489
4655
|
Creates an association between this (the source) and the provided target.<br>
|
|
4490
4656
|
The foreign key is added on the target.<br>
|
|
4491
4657
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-hasOne" class="fw-semibold" target="_blank">here</a> for details.
|
|
4658
|
+
<!--begin::Parameters-->
|
|
4492
4659
|
<div class="py-5">
|
|
4493
|
-
<p
|
|
4494
|
-
<ul
|
|
4495
|
-
<li
|
|
4496
|
-
<li
|
|
4660
|
+
<p>Parameters:</p>
|
|
4661
|
+
<ul>
|
|
4662
|
+
<li><code>target: Model</code> The target model.</li>
|
|
4663
|
+
<li><code>options: object</code> hasOne association options.</li>
|
|
4497
4664
|
</ul>
|
|
4498
4665
|
</div>
|
|
4666
|
+
<!--end::Parameters-->
|
|
4667
|
+
<!--begin::Return value-->
|
|
4499
4668
|
<div class="py-5">
|
|
4500
|
-
<p
|
|
4669
|
+
<p>Return value:</p>
|
|
4501
4670
|
<code><a href="https://sequelize.org/master/class/lib/associations/has-one.js~HasOne.html" class="fw-semibold" target="_blank">sequelize.HasOne</a></code> One-to-one association.
|
|
4502
4671
|
</div>
|
|
4503
|
-
|
|
4672
|
+
<!--end::Return value-->
|
|
4504
4673
|
For one-to-one association we will use two tables as an example they are User and Profile table.<br>
|
|
4505
4674
|
User table has one Profile table and Profile table belongs to the User table.<br>
|
|
4506
4675
|
Here's the relation diagram for it.
|
|
@@ -4659,22 +4828,26 @@ await UserModel.findAll({
|
|
|
4659
4828
|
</td>
|
|
4660
4829
|
</tr>
|
|
4661
4830
|
<tr>
|
|
4662
|
-
<td class="
|
|
4831
|
+
<td class="w-250px"><code>static belongsTo()</code></td>
|
|
4663
4832
|
<td>
|
|
4664
4833
|
Creates an association between this (the source) and the provided target.<br>
|
|
4665
4834
|
The foreign key is added on the source.<br>
|
|
4666
4835
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-belongsTo" class="fw-semibold" target="_blank">here</a> for details.
|
|
4836
|
+
<!--begin::Parameters-->
|
|
4667
4837
|
<div class="py-5">
|
|
4668
|
-
<p
|
|
4669
|
-
<ul
|
|
4670
|
-
<li
|
|
4671
|
-
<li
|
|
4838
|
+
<p>Parameters:</p>
|
|
4839
|
+
<ul>
|
|
4840
|
+
<li><code>target: Model</code> The target model.</li>
|
|
4841
|
+
<li><code>options: object</code> belongsTo association options.</li>
|
|
4672
4842
|
</ul>
|
|
4673
4843
|
</div>
|
|
4844
|
+
<!--end::Parameters-->
|
|
4845
|
+
<!--begin::Return value-->
|
|
4674
4846
|
<div class="py-5">
|
|
4675
|
-
<p
|
|
4847
|
+
<p>Return value:</p>
|
|
4676
4848
|
<code><a href="https://sequelize.org/master/class/lib/associations/belongs-to.js~BelongsTo.html" class="fw-semibold target="_blank">sequelize.BelongsTo</a></code> One-to-one association.
|
|
4677
4849
|
</div>
|
|
4850
|
+
<!--end::Return value-->
|
|
4678
4851
|
For one-to-one association we will use two tables as an example they are User and Profile table.<br>
|
|
4679
4852
|
User table has one Profile table and Profile table belongs to the User table.<br>
|
|
4680
4853
|
Here's the relation diagram for it.
|
|
@@ -4833,22 +5006,26 @@ await ProfileModel.findAll({
|
|
|
4833
5006
|
</td>
|
|
4834
5007
|
</tr>
|
|
4835
5008
|
<tr>
|
|
4836
|
-
<td class="
|
|
5009
|
+
<td class="w-250px"><code>static hasMany()</code></td>
|
|
4837
5010
|
<td>
|
|
4838
5011
|
Creates a 1:m association between this (the source) and the provided target.<br>
|
|
4839
5012
|
The foreign key is added on the target.<br>
|
|
4840
5013
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-hasMany" class="fw-semibold" target="_blank">here</a> for details.
|
|
5014
|
+
<!--begin::Parameters-->
|
|
4841
5015
|
<div class="py-5">
|
|
4842
|
-
<p
|
|
4843
|
-
<ul
|
|
4844
|
-
<li
|
|
4845
|
-
<li
|
|
5016
|
+
<p>Parameters:</p>
|
|
5017
|
+
<ul>
|
|
5018
|
+
<li><code>target: Model</code> The target model.</li>
|
|
5019
|
+
<li><code>options: object</code> hasMany association options.</li>
|
|
4846
5020
|
</ul>
|
|
4847
5021
|
</div>
|
|
5022
|
+
<!--end::Parameters-->
|
|
5023
|
+
<!--begin::Return value-->
|
|
4848
5024
|
<div class="py-5">
|
|
4849
|
-
<p
|
|
5025
|
+
<p>Return value:</p>
|
|
4850
5026
|
<code><a href="https://sequelize.org/master/class/lib/associations/has-many.js~HasMany.html" class="fw-semibold" target="_blank">sequelize.HasMany</a></code> One-to-many association.
|
|
4851
5027
|
</div>
|
|
5028
|
+
<!--end::Return value-->
|
|
4852
5029
|
For one-to-many association we will use two tables as an example they are User and Comment table.<br>
|
|
4853
5030
|
User table has many Comment table and Comment table belongs to the User table.<br>
|
|
4854
5031
|
Here's the relation diagram for it.
|
|
@@ -5013,22 +5190,26 @@ await UserModel.findAll({
|
|
|
5013
5190
|
</td>
|
|
5014
5191
|
</tr>
|
|
5015
5192
|
<tr>
|
|
5016
|
-
<td class="
|
|
5193
|
+
<td class="w-250px"><code>static belongsToMany()</code></td>
|
|
5017
5194
|
<td>
|
|
5018
5195
|
Create an N:M association with a join table.<br>
|
|
5019
5196
|
Defining through is required.<br>
|
|
5020
5197
|
See <a href="https://sequelize.org/master/class/lib/model.js~Model.html#static-method-belongsToMany" class="fw-semibold" target="_blank">here</a> for details.
|
|
5198
|
+
<!--begin::Parameters-->
|
|
5021
5199
|
<div class="py-5">
|
|
5022
|
-
<p
|
|
5023
|
-
<ul
|
|
5024
|
-
<li
|
|
5025
|
-
<li
|
|
5200
|
+
<p>Parameters:</p>
|
|
5201
|
+
<ul>
|
|
5202
|
+
<li><code>target: Model</code> The target model.</li>
|
|
5203
|
+
<li><code>options: object</code> belongsToMany association options.</li>
|
|
5026
5204
|
</ul>
|
|
5027
5205
|
</div>
|
|
5206
|
+
<!--end::Parameters-->
|
|
5207
|
+
<!--begin::Return value-->
|
|
5028
5208
|
<div class="py-5">
|
|
5029
|
-
<p
|
|
5209
|
+
<p>Return value:</p>
|
|
5030
5210
|
<code><a href="https://sequelize.org/master/class/lib/associations/belongs-to-many.js~BelongsToMany.html" class="fw-semibold" target="_blank">sequelize.BelongsToMany</a></code> Many-to-many association with a join table.
|
|
5031
5211
|
</div>
|
|
5212
|
+
<!--end::Return value-->
|
|
5032
5213
|
For many-to-many association we will use two tables as an example they are User and Book table.<br>
|
|
5033
5214
|
User is marking down Books that he has read. Each user can mark as many books as they want, creating a many to many association between User and Books.<br>
|
|
5034
5215
|
Books can belong to many users.<br>
|
|
@@ -5194,20 +5375,24 @@ await UserModel.findAll({
|
|
|
5194
5375
|
</td>
|
|
5195
5376
|
</tr>
|
|
5196
5377
|
<tr>
|
|
5197
|
-
<td class="
|
|
5378
|
+
<td class="w-250px"><code>static query()</code></td>
|
|
5198
5379
|
<td>
|
|
5199
5380
|
Raw Queries.<br>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.
|
|
5381
|
+
<!--begin::Parameters-->
|
|
5200
5382
|
<div class="py-5">
|
|
5201
|
-
<p
|
|
5202
|
-
<ul
|
|
5203
|
-
<li
|
|
5204
|
-
<li
|
|
5383
|
+
<p>Parameters:</p>
|
|
5384
|
+
<ul>
|
|
5385
|
+
<li><code>sql: string</code> SQL string.</li>
|
|
5386
|
+
<li><code>options: object</code> Query options.</li>
|
|
5205
5387
|
</ul>
|
|
5206
5388
|
</div>
|
|
5389
|
+
<!--end::Parameters-->
|
|
5390
|
+
<!--begin::Return value-->
|
|
5207
5391
|
<div class="py-5">
|
|
5208
|
-
<p
|
|
5392
|
+
<p>Return value:</p>
|
|
5209
5393
|
<code>Promise<any></code> By default, the function will return two arguments: an array of results, and a metadata object, containing number of affected rows etc. 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.
|
|
5210
5394
|
</div>
|
|
5395
|
+
<!--end::Return value-->
|
|
5211
5396
|
<!--begin::Code-->
|
|
5212
5397
|
<div class="py-5">
|
|
5213
5398
|
<!--begin::Highlight-->
|
|
@@ -5327,7 +5512,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5327
5512
|
<!--begin::Head-->
|
|
5328
5513
|
<thead>
|
|
5329
5514
|
<tr class="fs-4 fw-bold p-6">
|
|
5330
|
-
<th class="min-w-200px">Name</th>
|
|
5515
|
+
<th class="min-w-200px">Item Name</th>
|
|
5331
5516
|
<th>Description</th>
|
|
5332
5517
|
</tr>
|
|
5333
5518
|
</thead>
|
|
@@ -5335,18 +5520,18 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5335
5520
|
<!--begin::Body-->
|
|
5336
5521
|
<tbody>
|
|
5337
5522
|
<tr>
|
|
5338
|
-
<td class="
|
|
5523
|
+
<td class="w-250px"><code>enabled: boolean</code></td>
|
|
5339
5524
|
<td>
|
|
5340
5525
|
Set to true to enable user authentication using <a href="https://www.passportjs.org/docs/" class="fw-semibold" target="_blank">Passport middleware</a>.<br>
|
|
5341
5526
|
User authentication is enabled (<code>true</code>) by default.
|
|
5342
5527
|
</td>
|
|
5343
5528
|
</tr>
|
|
5344
5529
|
<tr>
|
|
5345
|
-
<td class="
|
|
5530
|
+
<td class="w-250px"><code>session_store: 'memory'|'redis'</code></td>
|
|
5346
5531
|
<td>The session store instance, defaults to a new MemoryStore(<code>memory</code>) instance.</td>
|
|
5347
5532
|
</tr>
|
|
5348
5533
|
<tr>
|
|
5349
|
-
<td class="
|
|
5534
|
+
<td class="w-250px"><code>redis_host?: string|undefined</code></td>
|
|
5350
5535
|
<td>
|
|
5351
5536
|
If the session is stored in <code>"redis"</code>, this field is required and should be set to the hostname of the Redis server.<br>
|
|
5352
5537
|
For example, to connect to redis on localhost on port <code>6379</code>, set <code>"redis://localhost:6379"</code>.<br>
|
|
@@ -5355,28 +5540,28 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5355
5540
|
</td>
|
|
5356
5541
|
</tr>
|
|
5357
5542
|
<tr>
|
|
5358
|
-
<td class="
|
|
5543
|
+
<td class="w-250px"><code>username: string</code></td>
|
|
5359
5544
|
<td>
|
|
5360
5545
|
The login username field name used for authentication.<br>
|
|
5361
5546
|
This should be set to the same value as the user field name in the POST body sent to the server and the user example name in the login user table.
|
|
5362
5547
|
</td>
|
|
5363
5548
|
</tr>
|
|
5364
5549
|
<tr>
|
|
5365
|
-
<td class="
|
|
5550
|
+
<td class="w-250px"><code>password: string</code></td>
|
|
5366
5551
|
<td>
|
|
5367
5552
|
The login password field name used for authentication.<br>
|
|
5368
5553
|
This should be set to the same value as the password field name in the POST body sent to the server and the password column name in the login user table.
|
|
5369
5554
|
</td>
|
|
5370
5555
|
</tr>
|
|
5371
5556
|
<tr>
|
|
5372
|
-
<td class="
|
|
5557
|
+
<td class="w-250px"><code>success_redirect: string</code></td>
|
|
5373
5558
|
<td>
|
|
5374
5559
|
The URL to redirect to after successful authentication.<br>
|
|
5375
5560
|
The default is the root URL (<code>/</code>).
|
|
5376
5561
|
</td>
|
|
5377
5562
|
</tr>
|
|
5378
5563
|
<tr>
|
|
5379
|
-
<td class="
|
|
5564
|
+
<td class="w-250px"><code>failure_redirect: string</code></td>
|
|
5380
5565
|
<td>
|
|
5381
5566
|
Specify the URL to redirect after logging out, or the URL to redirect when the logoff user requests a URL that only the logged-in user can access.<br>
|
|
5382
5567
|
This usually specifies the URL of the login page.<br>
|
|
@@ -5384,7 +5569,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5384
5569
|
</td>
|
|
5385
5570
|
</tr>
|
|
5386
5571
|
<tr>
|
|
5387
|
-
<td class="
|
|
5572
|
+
<td class="w-250px"><code>authenticate_user: (username: string, password: string, req: express.Request): Promise<object|null></code></td>
|
|
5388
5573
|
<td>
|
|
5389
5574
|
This hook is called when authenticating a user.<br>
|
|
5390
5575
|
Please find the user information that owns the credentials based on the user name and password you received and return it.<br>
|
|
@@ -5436,7 +5621,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5436
5621
|
</td>
|
|
5437
5622
|
</tr>
|
|
5438
5623
|
<tr>
|
|
5439
|
-
<td class="
|
|
5624
|
+
<td class="w-250px"><code>subscribe_user: (id: number): Promise<object></code></td>
|
|
5440
5625
|
<td>
|
|
5441
5626
|
This hook is called when user authentication is successful.<br>
|
|
5442
5627
|
Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.<br>
|
|
@@ -5465,7 +5650,7 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5465
5650
|
</td>
|
|
5466
5651
|
</tr>
|
|
5467
5652
|
<tr>
|
|
5468
|
-
<td class="
|
|
5653
|
+
<td class="w-250px"><code>allow_unauthenticated: (string|RegExp)[]</code></td>
|
|
5469
5654
|
<td>
|
|
5470
5655
|
By default, it requires an authenticated user for all requests.<br>
|
|
5471
5656
|
You can use the <code>allow_unauthenticated</code> option to disable this behavior on certain requests.<br>
|
|
@@ -5498,14 +5683,14 @@ await BookModel.query("SELECT * FROM book", {type: BookModel.QueryType
|
|
|
5498
5683
|
</td>
|
|
5499
5684
|
</tr>
|
|
5500
5685
|
<tr>
|
|
5501
|
-
<td class="
|
|
5686
|
+
<td class="w-250px"><code>expiration: number</code></td>
|
|
5502
5687
|
<td>
|
|
5503
5688
|
Specifies the time, in milliseconds, before the session expires.<br>
|
|
5504
5689
|
The default is 24 hours (<code>86400000</code> milliseconds).
|
|
5505
5690
|
</td>
|
|
5506
5691
|
</tr>
|
|
5507
5692
|
<tr>
|
|
5508
|
-
<td class="
|
|
5693
|
+
<td class="w-250px"><code>is_ajax: (req: express.Request) => boolean</code></td>
|
|
5509
5694
|
<td>
|
|
5510
5695
|
How to determine if it is an ajax request.<br>
|
|
5511
5696
|
The default is that if there is an XMLHttpRequest in the request header (<code>req.xhr</code>) returns <code>true</code>.<br><br>
|
|
@@ -5819,7 +6004,6 @@ module.exports = router;</code></pre>
|
|
|
5819
6004
|
<!--end::Card Body-->
|
|
5820
6005
|
</div>
|
|
5821
6006
|
<!--end::Card-->
|
|
5822
|
-
|
|
5823
6007
|
<!--begin::Card-->
|
|
5824
6008
|
<div id="rekognition" data-search-item="true" data-search-title="Rekognition" data-search-description="How to use Rekognition" class="card card-docs flex-row-fluid mb-12">
|
|
5825
6009
|
<!--begin::Card Body-->
|
|
@@ -5831,9 +6015,8 @@ module.exports = router;</code></pre>
|
|
|
5831
6015
|
<!--end::Heading-->
|
|
5832
6016
|
<!--begin::Block-->
|
|
5833
6017
|
<div class="py-5">
|
|
5834
|
-
|
|
5835
|
-
This
|
|
5836
|
-
If you want to know more about <code>Amazon Rekognition</code>, please see <a href="https://docs.aws.amazon.com/rekognition/latest/dg/what-is.html" class="fw-semibold" target="_blank">Amazon Rekognition Reference</a>.
|
|
6018
|
+
It recognizes, detects, and compares faces.<br>
|
|
6019
|
+
This is an extension of AWS Rekognition, learn more about AWS Rekognition <a href="https://docs.aws.amazon.com/rekognition/latest/dg/what-is.html" class="fw-semibold" target="_blank">here</a>.
|
|
5837
6020
|
</div>
|
|
5838
6021
|
<!--end::Block-->
|
|
5839
6022
|
</div>
|
|
@@ -5844,7 +6027,7 @@ module.exports = router;</code></pre>
|
|
|
5844
6027
|
<h1 class="fw-bold mb-5">Class Rekognition (express-sweet.services.AWSRekognitionClient)</h1>
|
|
5845
6028
|
<!--end::Heading-->
|
|
5846
6029
|
<!--begin::Block-->
|
|
5847
|
-
<div class="py-5">
|
|
6030
|
+
<div class="py-5">Analyzes faces on images and videos using machine learning.</div>
|
|
5848
6031
|
<!--end::Block-->
|
|
5849
6032
|
<h2 class="text-gray-700 py-5 fw-normal">Methods of the Rekognition</h2>
|
|
5850
6033
|
<!--begin::Table-->
|
|
@@ -5864,18 +6047,20 @@ module.exports = router;</code></pre>
|
|
|
5864
6047
|
<!--begin::Body-->
|
|
5865
6048
|
<tbody>
|
|
5866
6049
|
<tr>
|
|
5867
|
-
<td class="
|
|
6050
|
+
<td class="w-250px"><code>constructor()</code></td>
|
|
5868
6051
|
<td>
|
|
5869
6052
|
Constructs a rekognition client object.
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
<
|
|
5873
|
-
|
|
5874
|
-
<li
|
|
5875
|
-
<li
|
|
5876
|
-
<li
|
|
6053
|
+
<!--begin::Parameters-->
|
|
6054
|
+
<div class="py-5">
|
|
6055
|
+
<p>Parameters:</p>
|
|
6056
|
+
<ul>
|
|
6057
|
+
<li><code>options.region: string</code> The region to send service requests to.</li>
|
|
6058
|
+
<li><code>options.accessKeyId: string</code> AWS access key ID.</li>
|
|
6059
|
+
<li><code>options.secretAccessKey: string</code> AWS secret access key.</li>
|
|
6060
|
+
<li><code>options.timeout: number</code> Timeout period (milliseconds). Default is 5000.</li>
|
|
5877
6061
|
</ul>
|
|
5878
6062
|
</div>
|
|
6063
|
+
<!--end::Parameters-->
|
|
5879
6064
|
<!--begin::Code-->
|
|
5880
6065
|
<div class="py-5">
|
|
5881
6066
|
<!--begin::Highlight-->
|
|
@@ -5899,9 +6084,9 @@ sweet.middlewares.Environment.mount();
|
|
|
5899
6084
|
|
|
5900
6085
|
// Rekognition Client.
|
|
5901
6086
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6087
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
5902
6088
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
5903
6089
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
5904
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
5905
6090
|
});</code></pre>
|
|
5906
6091
|
</div>
|
|
5907
6092
|
</div>
|
|
@@ -5914,9 +6099,9 @@ sweet.middlewares.Environment.mount();
|
|
|
5914
6099
|
|
|
5915
6100
|
// Rekognition Client.
|
|
5916
6101
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6102
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
5917
6103
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
5918
6104
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
5919
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
5920
6105
|
});</code></pre>
|
|
5921
6106
|
</div>
|
|
5922
6107
|
</div>
|
|
@@ -5928,22 +6113,26 @@ const client = new sweet.services.AWSRekognitionClient({
|
|
|
5928
6113
|
</td>
|
|
5929
6114
|
</tr>
|
|
5930
6115
|
<tr>
|
|
5931
|
-
<td class="
|
|
6116
|
+
<td class="w-250px"><code>detectFaces()</code></td>
|
|
5932
6117
|
<td>
|
|
5933
6118
|
Detects faces within an image that is provided as input.<br>
|
|
5934
6119
|
For each face detected, the operation returns a bounding box of the face.
|
|
6120
|
+
<!--begin::Parameters-->
|
|
5935
6121
|
<div class="py-5">
|
|
5936
|
-
<p
|
|
5937
|
-
<ul
|
|
5938
|
-
<li
|
|
5939
|
-
<li
|
|
5940
|
-
<li
|
|
6122
|
+
<p>Parameters:</p>
|
|
6123
|
+
<ul>
|
|
6124
|
+
<li><code>img: string</code> Image path or Data Url or image buffer.</li>
|
|
6125
|
+
<li><code>minConfidence: number</code> The minimum confidence of the detected face. Faces with a confidence lower than this value will not be returned as a result.</li>
|
|
6126
|
+
<li><code>withDetails: boolean</code> If false, returns only the face bounding box. When true, returns the age group, gender, and emotion in addition to the face bounding box.</li>
|
|
5941
6127
|
</ul>
|
|
5942
6128
|
</div>
|
|
6129
|
+
<!--end::Parameters-->
|
|
6130
|
+
<!--begin::Return value-->
|
|
5943
6131
|
<div class="py-5">
|
|
5944
|
-
<p
|
|
6132
|
+
<p>Return value:</p>
|
|
5945
6133
|
<code>Promise<<a href="#rekognition-bbox-if">BoundingBox</a>[]|<a href="#rekognition-face-details-if">FaceDetails</a>[]></code> Returns the bounding box of the detected face.
|
|
5946
6134
|
</div>
|
|
6135
|
+
<!--end::Return value-->
|
|
5947
6136
|
<!--begin::Code-->
|
|
5948
6137
|
<div class="py-5">
|
|
5949
6138
|
<!--begin::Highlight-->
|
|
@@ -5968,9 +6157,9 @@ sweet.middlewares.Environment.mount();
|
|
|
5968
6157
|
|
|
5969
6158
|
// Rekognition Client.
|
|
5970
6159
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6160
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
5971
6161
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
5972
6162
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
5973
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
5974
6163
|
});
|
|
5975
6164
|
|
|
5976
6165
|
// Detects bounding boxes on faces.
|
|
@@ -6030,9 +6219,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6030
6219
|
|
|
6031
6220
|
// Rekognition Client.
|
|
6032
6221
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6222
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6033
6223
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6034
6224
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6035
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6036
6225
|
});
|
|
6037
6226
|
|
|
6038
6227
|
// Detects bounding boxes on faces.
|
|
@@ -6090,20 +6279,24 @@ await client.detectFaces(fs.readFileSync('img.jpg'));</code></pre>
|
|
|
6090
6279
|
</td>
|
|
6091
6280
|
</tr>
|
|
6092
6281
|
<tr>
|
|
6093
|
-
<td class="
|
|
6282
|
+
<td class="w-250px"><code>compareFaces()</code></td>
|
|
6094
6283
|
<td>
|
|
6095
6284
|
Compare the similarity of two faces.
|
|
6285
|
+
<!--begin::Parameters-->
|
|
6096
6286
|
<div class="py-5">
|
|
6097
|
-
<p
|
|
6098
|
-
<ul
|
|
6099
|
-
<li
|
|
6100
|
-
<li
|
|
6287
|
+
<p>Parameters:</p>
|
|
6288
|
+
<ul>
|
|
6289
|
+
<li><code>img1: string</code> Image path or Data Url or image buffer.</li>
|
|
6290
|
+
<li><code>img2: string</code> Image path or Data Url or image buffer.</li>
|
|
6101
6291
|
</ul>
|
|
6102
6292
|
</div>
|
|
6293
|
+
<!--end::Parameters-->
|
|
6294
|
+
<!--begin::Return value-->
|
|
6103
6295
|
<div class="py-5">
|
|
6104
|
-
<p
|
|
6296
|
+
<p>Return value:</p>
|
|
6105
6297
|
<code>Promise<number></code> Level of confidence that the faces match.
|
|
6106
6298
|
</div>
|
|
6299
|
+
<!--end::Return value-->
|
|
6107
6300
|
<!--begin::Code-->
|
|
6108
6301
|
<div class="py-5">
|
|
6109
6302
|
<!--begin::Highlight-->
|
|
@@ -6128,9 +6321,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6128
6321
|
|
|
6129
6322
|
// Rekognition Client.
|
|
6130
6323
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6324
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6131
6325
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6132
6326
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6133
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6134
6327
|
});
|
|
6135
6328
|
|
|
6136
6329
|
// Compare faces from path.
|
|
@@ -6153,9 +6346,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6153
6346
|
|
|
6154
6347
|
// Rekognition Client.
|
|
6155
6348
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6349
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6156
6350
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6157
6351
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6158
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6159
6352
|
});
|
|
6160
6353
|
|
|
6161
6354
|
// Compare faces from path.
|
|
@@ -6176,7 +6369,7 @@ await client.compareFaces(fs.readFileSync('img1.jpg'), fs.readFileSync
|
|
|
6176
6369
|
</td>
|
|
6177
6370
|
</tr>
|
|
6178
6371
|
<tr>
|
|
6179
|
-
<td class="
|
|
6372
|
+
<td class="w-250px"><code>createCollection()</code></td>
|
|
6180
6373
|
<td>
|
|
6181
6374
|
Add faces to the collection using the IndexFaces operation.<br>
|
|
6182
6375
|
For example, you might create collections, one for each of your application users.<br>
|
|
@@ -6204,12 +6397,14 @@ await client.compareFaces(fs.readFileSync('img1.jpg'), fs.readFileSync
|
|
|
6204
6397
|
<!--end::Information-->
|
|
6205
6398
|
</div>
|
|
6206
6399
|
<!--end::Notice-->
|
|
6400
|
+
<!--begin::Parameters-->
|
|
6207
6401
|
<div class="py-5">
|
|
6208
|
-
<p
|
|
6209
|
-
<ul
|
|
6210
|
-
<li
|
|
6402
|
+
<p>Parameters:</p>
|
|
6403
|
+
<ul>
|
|
6404
|
+
<li><code>collectionId: string</code> ID for the collection that you are creating. The maximum length is 255, and the characters that can be used are <code>[a-zA-Z0-9_.\-]+</code>.</li>
|
|
6211
6405
|
</ul>
|
|
6212
6406
|
</div>
|
|
6407
|
+
<!--end::Parameters-->
|
|
6213
6408
|
<!--begin::Code-->
|
|
6214
6409
|
<div class="py-5">
|
|
6215
6410
|
<!--begin::Highlight-->
|
|
@@ -6233,9 +6428,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6233
6428
|
|
|
6234
6429
|
// Rekognition Client.
|
|
6235
6430
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6431
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6236
6432
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6237
6433
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6238
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6239
6434
|
});
|
|
6240
6435
|
|
|
6241
6436
|
// Creates a collection.
|
|
@@ -6251,9 +6446,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6251
6446
|
|
|
6252
6447
|
// Rekognition Client.
|
|
6253
6448
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6449
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6254
6450
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6255
6451
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6256
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6257
6452
|
});
|
|
6258
6453
|
|
|
6259
6454
|
// Creates a collection.
|
|
@@ -6268,13 +6463,15 @@ await client.createCollection('MyCollection');</code></pre>
|
|
|
6268
6463
|
</td>
|
|
6269
6464
|
</tr>
|
|
6270
6465
|
<tr>
|
|
6271
|
-
<td class="
|
|
6466
|
+
<td class="w-250px"><code>listCollections()</code></td>
|
|
6272
6467
|
<td>
|
|
6273
6468
|
Returns list of collection IDs.
|
|
6469
|
+
<!--begin::Return value-->
|
|
6274
6470
|
<div class="py-5">
|
|
6275
|
-
<p
|
|
6471
|
+
<p>Return value:</p>
|
|
6276
6472
|
<code>Promise<string[]></code> An array of collection IDs.
|
|
6277
6473
|
</div>
|
|
6474
|
+
<!--end::Return value-->
|
|
6278
6475
|
<!--begin::Code-->
|
|
6279
6476
|
<div class="py-5">
|
|
6280
6477
|
<!--begin::Highlight-->
|
|
@@ -6299,9 +6496,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6299
6496
|
|
|
6300
6497
|
// Rekognition Client.
|
|
6301
6498
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6499
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6302
6500
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6303
6501
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6304
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6305
6502
|
});
|
|
6306
6503
|
|
|
6307
6504
|
// Find the collection IDs.
|
|
@@ -6321,9 +6518,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6321
6518
|
|
|
6322
6519
|
// Rekognition Client.
|
|
6323
6520
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6521
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6324
6522
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6325
6523
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6326
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6327
6524
|
});
|
|
6328
6525
|
|
|
6329
6526
|
// Find the collection IDs.
|
|
@@ -6342,20 +6539,24 @@ await client.listCollections();</code></pre>
|
|
|
6342
6539
|
</td>
|
|
6343
6540
|
</tr>
|
|
6344
6541
|
<tr>
|
|
6345
|
-
<td class="
|
|
6542
|
+
<td class="w-250px"><code>deleteCollection()</code></td>
|
|
6346
6543
|
<td>
|
|
6347
6544
|
Deletes the specified collection.<br>
|
|
6348
6545
|
Note that this operation removes all faces in the collection.
|
|
6546
|
+
<!--begin::Parameters-->
|
|
6349
6547
|
<div class="py-5">
|
|
6350
|
-
<p
|
|
6351
|
-
<ul
|
|
6352
|
-
<li
|
|
6548
|
+
<p>Parameters:</p>
|
|
6549
|
+
<ul>
|
|
6550
|
+
<li><code>collectionId: string</code> ID of the collection to delete.</li>
|
|
6353
6551
|
</ul>
|
|
6354
6552
|
</div>
|
|
6553
|
+
<!--end::Parameters-->
|
|
6554
|
+
<!--begin::Return value-->
|
|
6355
6555
|
<div class="py-5">
|
|
6356
|
-
<p
|
|
6556
|
+
<p>Return value:</p>
|
|
6357
6557
|
<code>Promise<boolean></code> True on success.
|
|
6358
6558
|
</div>
|
|
6559
|
+
<!--end::Return value-->
|
|
6359
6560
|
<!--begin::Code-->
|
|
6360
6561
|
<div class="py-5">
|
|
6361
6562
|
<!--begin::Highlight-->
|
|
@@ -6379,9 +6580,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6379
6580
|
|
|
6380
6581
|
// Rekognition Client.
|
|
6381
6582
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6583
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6382
6584
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6383
6585
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6384
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6385
6586
|
});
|
|
6386
6587
|
|
|
6387
6588
|
// Delete collection.
|
|
@@ -6397,9 +6598,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6397
6598
|
|
|
6398
6599
|
// Rekognition Client.
|
|
6399
6600
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6601
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6400
6602
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6401
6603
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6402
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6403
6604
|
});
|
|
6404
6605
|
|
|
6405
6606
|
// Delete collection.
|
|
@@ -6414,7 +6615,7 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
6414
6615
|
</td>
|
|
6415
6616
|
</tr>
|
|
6416
6617
|
<tr>
|
|
6417
|
-
<td class="
|
|
6618
|
+
<td class="w-250px"><code>indexFace()</code></td>
|
|
6418
6619
|
<td>
|
|
6419
6620
|
Detects one face in the input image and adds it to the specified collection.
|
|
6420
6621
|
<!--begin::Notice-->
|
|
@@ -6439,12 +6640,13 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
6439
6640
|
<!--end::Information-->
|
|
6440
6641
|
</div>
|
|
6441
6642
|
<!--end::Notice-->
|
|
6643
|
+
<!--begin::Parameters-->
|
|
6442
6644
|
<div class="py-5">
|
|
6443
|
-
<p
|
|
6444
|
-
<ul
|
|
6445
|
-
<li
|
|
6446
|
-
<li
|
|
6447
|
-
<li
|
|
6645
|
+
<p>Parameters:</p>
|
|
6646
|
+
<ul>
|
|
6647
|
+
<li><code>collectionId: string</code> The ID of an existing collection to which you want to add the faces that are detected in the input images.</li>
|
|
6648
|
+
<li><code>img: string</code> Image path or Data Url or image buffer.</li>
|
|
6649
|
+
<li>
|
|
6448
6650
|
<code>options.externalImageId: string|undefined</code>
|
|
6449
6651
|
The ID you want to assign to the faces detected in the image.<br>
|
|
6450
6652
|
When you call the <code>listFaces</code> operation, the response returns the external ID.<br>
|
|
@@ -6452,19 +6654,22 @@ await client.deleteCollection('MyCollection');</code></pre>
|
|
|
6452
6654
|
You can then use the index to find all faces in an image.<br>
|
|
6453
6655
|
The maximum length is 255, and the characters that can be used are <code>[a-zA-Z0-9_.\-:]+</code>.
|
|
6454
6656
|
</li>
|
|
6455
|
-
<li
|
|
6657
|
+
<li>
|
|
6456
6658
|
<code>options.returnDetails: boolean</code>
|
|
6457
6659
|
If <code>false</code>, only the face ID of the created face is returned.<br>
|
|
6458
6660
|
If <code>true</code>, returns the face ID of the created face, plus age range, gender, and emotion.
|
|
6459
6661
|
</li>
|
|
6460
6662
|
</ul>
|
|
6461
6663
|
</div>
|
|
6664
|
+
<!--end::Parameters-->
|
|
6665
|
+
<!--begin::Return value-->
|
|
6462
6666
|
<div class="py-5">
|
|
6463
|
-
<p
|
|
6667
|
+
<p>Return value:</p>
|
|
6464
6668
|
<code>Promise<string|<a href="#rekognition-index-face-if">IndexFaceDetails</a>></code>
|
|
6465
6669
|
If <code>options.returnDetails</code> is <code>false</code>, the face identifier is returned.<br>
|
|
6466
6670
|
If <code>options.returnDetails</code> is <code>true</code>, returns the gender, age group, and emotion in addition to the face identifier.
|
|
6467
6671
|
</div>
|
|
6672
|
+
<!--end::Return value-->
|
|
6468
6673
|
<!--begin::Code-->
|
|
6469
6674
|
<div class="py-5">
|
|
6470
6675
|
<!--begin::Highlight-->
|
|
@@ -6489,9 +6694,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6489
6694
|
|
|
6490
6695
|
// Rekognition Client.
|
|
6491
6696
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6697
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6492
6698
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6493
6699
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6494
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6495
6700
|
});
|
|
6496
6701
|
|
|
6497
6702
|
// Create a face and get the ID of the created face.
|
|
@@ -6535,9 +6740,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6535
6740
|
|
|
6536
6741
|
// Rekognition Client.
|
|
6537
6742
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6743
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6538
6744
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6539
6745
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6540
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6541
6746
|
});
|
|
6542
6747
|
|
|
6543
6748
|
// Create a face and get the ID of the created face.
|
|
@@ -6579,21 +6784,22 @@ await client.indexFace('MyCollection', fs.readFileSync('img.jpg&#
|
|
|
6579
6784
|
</td>
|
|
6580
6785
|
</tr>
|
|
6581
6786
|
<tr>
|
|
6582
|
-
<td class="
|
|
6787
|
+
<td class="w-250px"><code>searchFaces()</code></td>
|
|
6583
6788
|
<td>
|
|
6584
6789
|
For a given input image, first detects the largest face in the image, and then searches the specified collection for matching faces.<br>
|
|
6585
6790
|
The operation compares the features of the input face with faces in the specified collection.
|
|
6791
|
+
<!--begin::Parameters-->
|
|
6586
6792
|
<div class="py-5">
|
|
6587
|
-
<p
|
|
6588
|
-
<ul
|
|
6589
|
-
<li
|
|
6590
|
-
<li
|
|
6591
|
-
<li
|
|
6793
|
+
<p>Parameters:</p>
|
|
6794
|
+
<ul>
|
|
6795
|
+
<li><code>collectionId: string</code> ID of the collection to search.</li>
|
|
6796
|
+
<li><code>img: string</code> Image path or Data Url or image buffer.</li>
|
|
6797
|
+
<li>
|
|
6592
6798
|
<code>options.minConfidence: number</code>
|
|
6593
6799
|
Specifies the minimum confidence in the face match to return.<br>
|
|
6594
6800
|
The default value is 80%.
|
|
6595
6801
|
</li>
|
|
6596
|
-
<li
|
|
6802
|
+
<li>
|
|
6597
6803
|
<code>options.maxFaces: number</code>
|
|
6598
6804
|
Maximum number of faces to return.<br>
|
|
6599
6805
|
The operation returns the maximum number of faces with the highest confidence in the match.<br>
|
|
@@ -6601,13 +6807,16 @@ await client.indexFace('MyCollection', fs.readFileSync('img.jpg&#
|
|
|
6601
6807
|
</li>
|
|
6602
6808
|
</ul>
|
|
6603
6809
|
</div>
|
|
6810
|
+
<!--end::Parameters-->
|
|
6811
|
+
<!--begin::Return value-->
|
|
6604
6812
|
<div class="py-5">
|
|
6605
|
-
<p
|
|
6813
|
+
<p>Return value:</p>
|
|
6606
6814
|
<code>Promise<<a href="#rekognition-match-if">FaceMatch</a>[]|<a href="#rekognition-match-if">FaceMatch</a>|null></code>
|
|
6607
6815
|
If <code>options.maxFaces</code> is 1, the face information found is returned.<br>
|
|
6608
6816
|
If <code>options.maxFaces</code> is 2 or more, the list of face information found is returned.<br>
|
|
6609
6817
|
Returns <code>null</code> if no face is found.
|
|
6610
|
-
</div>
|
|
6818
|
+
</div>
|
|
6819
|
+
<!--end::Return value-->
|
|
6611
6820
|
<!--begin::Code-->
|
|
6612
6821
|
<div class="py-5">
|
|
6613
6822
|
<!--begin::Highlight-->
|
|
@@ -6632,9 +6841,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6632
6841
|
|
|
6633
6842
|
// Rekognition Client.
|
|
6634
6843
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6844
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6635
6845
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6636
6846
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6637
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6638
6847
|
});
|
|
6639
6848
|
|
|
6640
6849
|
// If you want to search for one face, specify 1 for the maxFaces option.
|
|
@@ -6686,9 +6895,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6686
6895
|
|
|
6687
6896
|
// Rekognition Client.
|
|
6688
6897
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6898
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6689
6899
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6690
6900
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6691
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6692
6901
|
});
|
|
6693
6902
|
|
|
6694
6903
|
// If you want to search for one face, specify 1 for the maxFaces option.
|
|
@@ -6738,21 +6947,25 @@ await client.searchFaces('MyCollection', fs.readFileSync('img.jpg
|
|
|
6738
6947
|
</td>
|
|
6739
6948
|
</tr>
|
|
6740
6949
|
<tr>
|
|
6741
|
-
<td class="
|
|
6950
|
+
<td class="w-250px"><code>listFaces()</code></td>
|
|
6742
6951
|
<td>
|
|
6743
6952
|
Returns metadata for faces in the specified collection.<br>
|
|
6744
6953
|
This metadata includes information such as the bounding box coordinates, and face ID.
|
|
6954
|
+
<!--begin::Parameters-->
|
|
6745
6955
|
<div class="py-5">
|
|
6746
|
-
<p
|
|
6747
|
-
<ul
|
|
6748
|
-
<li
|
|
6749
|
-
<li
|
|
6956
|
+
<p>Parameters:</p>
|
|
6957
|
+
<ul>
|
|
6958
|
+
<li><code>collectionId: string</code> ID of the collection from which to list the faces.</li>
|
|
6959
|
+
<li><code>maxResults: number</code> Maximum number of faces to return.The default value is 1000.</li>
|
|
6750
6960
|
</ul>
|
|
6751
6961
|
</div>
|
|
6962
|
+
<!--end::Parameters-->
|
|
6963
|
+
<!--begin::Return value-->
|
|
6752
6964
|
<div class="py-5">
|
|
6753
|
-
<p
|
|
6965
|
+
<p>Return value:</p>
|
|
6754
6966
|
<code>Promise<<a href="#rekognition-match-if">FaceMatch</a>[]></code> Returns all face metadata in the collection.
|
|
6755
6967
|
</div>
|
|
6968
|
+
<!--end::Return value-->
|
|
6756
6969
|
<!--begin::Code-->
|
|
6757
6970
|
<div class="py-5">
|
|
6758
6971
|
<!--begin::Highlight-->
|
|
@@ -6776,9 +6989,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6776
6989
|
|
|
6777
6990
|
// Rekognition Client.
|
|
6778
6991
|
const client = new sweet.services.AWSRekognitionClient({
|
|
6992
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6779
6993
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6780
6994
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6781
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6782
6995
|
});
|
|
6783
6996
|
|
|
6784
6997
|
// Find all face metadata in the collection.
|
|
@@ -6807,9 +7020,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6807
7020
|
|
|
6808
7021
|
// Rekognition Client.
|
|
6809
7022
|
const client = new sweet.services.AWSRekognitionClient({
|
|
7023
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6810
7024
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6811
7025
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6812
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6813
7026
|
});
|
|
6814
7027
|
|
|
6815
7028
|
// Find all face metadata in the collection.
|
|
@@ -6837,21 +7050,25 @@ console.log(result);</code></pre>
|
|
|
6837
7050
|
</td>
|
|
6838
7051
|
</tr>
|
|
6839
7052
|
<tr>
|
|
6840
|
-
<td class="
|
|
7053
|
+
<td class="w-250px"><code>deleteFaces()</code></td>
|
|
6841
7054
|
<td>
|
|
6842
7055
|
Deletes faces from a collection.<br>
|
|
6843
7056
|
You specify a collection ID and an array of face IDs to remove from the collection.
|
|
7057
|
+
<!--begin::Parameters-->
|
|
6844
7058
|
<div class="py-5">
|
|
6845
|
-
<p
|
|
6846
|
-
<ul
|
|
6847
|
-
<li
|
|
6848
|
-
<li
|
|
7059
|
+
<p>Parameters:</p>
|
|
7060
|
+
<ul>
|
|
7061
|
+
<li><code>collectionId: string</code> Collection from which to remove the specific faces.</li>
|
|
7062
|
+
<li><code>faceIds: string[]</code> An array of face IDs to delete.</li>
|
|
6849
7063
|
</ul>
|
|
6850
7064
|
</div>
|
|
7065
|
+
<!--end::Parameters-->
|
|
7066
|
+
<!--begin::Return value-->
|
|
6851
7067
|
<div class="py-5">
|
|
6852
|
-
<p
|
|
7068
|
+
<p>Return value:</p>
|
|
6853
7069
|
<code>Promise<boolean></code> True on success.
|
|
6854
7070
|
</div>
|
|
7071
|
+
<!--end::Return value-->
|
|
6855
7072
|
<!--begin::Code-->
|
|
6856
7073
|
<div class="py-5">
|
|
6857
7074
|
<!--begin::Highlight-->
|
|
@@ -6875,9 +7092,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6875
7092
|
|
|
6876
7093
|
// Rekognition Client.
|
|
6877
7094
|
const client = new sweet.services.AWSRekognitionClient({
|
|
7095
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6878
7096
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6879
7097
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6880
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6881
7098
|
});
|
|
6882
7099
|
|
|
6883
7100
|
// Delete a face from the collection.
|
|
@@ -6893,9 +7110,9 @@ sweet.middlewares.Environment.mount();
|
|
|
6893
7110
|
|
|
6894
7111
|
// Rekognition Client.
|
|
6895
7112
|
const client = new sweet.services.AWSRekognitionClient({
|
|
7113
|
+
region: process.env.AWS_REKOGNITION_REGION,
|
|
6896
7114
|
accessKeyId: process.env.AWS_REKOGNITION_ACCESS_KEY_ID,
|
|
6897
7115
|
secretAccessKey: process.env.AWS_REKOGNITION_SECRET_ACCESS_KEY,
|
|
6898
|
-
region: process.env.AWS_REKOGNITION_REGION
|
|
6899
7116
|
});
|
|
6900
7117
|
|
|
6901
7118
|
// Delete a face from the collection.
|
|
@@ -6945,27 +7162,27 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
6945
7162
|
<!--begin::Body-->
|
|
6946
7163
|
<tbody>
|
|
6947
7164
|
<tr>
|
|
6948
|
-
<td class="
|
|
7165
|
+
<td class="w-250px"><code>faceId: string</code></td>
|
|
6949
7166
|
<td>A unique identifier assigned to the face.</td>
|
|
6950
7167
|
</tr>
|
|
6951
7168
|
<tr>
|
|
6952
|
-
<td class="
|
|
7169
|
+
<td class="w-250px"><code>boundingBox: <a href="#rekognition-bbox-if">BoundingBox</a></code></td>
|
|
6953
7170
|
<td>
|
|
6954
7171
|
Bounding box of the face.
|
|
6955
|
-
<ul
|
|
6956
|
-
<li
|
|
6957
|
-
<li
|
|
6958
|
-
<li
|
|
6959
|
-
<li
|
|
7172
|
+
<ul>
|
|
7173
|
+
<li>width: Width of the bounding box as a ratio of the overall image width.</li>
|
|
7174
|
+
<li>height: Height of the bounding box as a ratio of the overall image height.</li>
|
|
7175
|
+
<li>left: Left coordinate of the bounding box as a ratio of overall image width.</li>
|
|
7176
|
+
<li>top: Top coordinate of the bounding box as a ratio of overall image height.</li>
|
|
6960
7177
|
</ul>
|
|
6961
7178
|
</td>
|
|
6962
7179
|
</tr>
|
|
6963
7180
|
<tr>
|
|
6964
|
-
<td class="
|
|
7181
|
+
<td class="w-250px"><code>externalImageId?: string</code></td>
|
|
6965
7182
|
<td>Identifier that you assign to all the faces in the input image.</td>
|
|
6966
7183
|
</tr>
|
|
6967
7184
|
<tr>
|
|
6968
|
-
<td class="
|
|
7185
|
+
<td class="w-250px"><code>similarity?: number</code></td>
|
|
6969
7186
|
<td>Confidence in the match of this face with the input face.<br>Valid Range: Minimum value of 0. Maximum value of 100.</td>
|
|
6970
7187
|
</tr>
|
|
6971
7188
|
</tbody>
|
|
@@ -7004,20 +7221,20 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
7004
7221
|
<!--begin::Body-->
|
|
7005
7222
|
<tbody>
|
|
7006
7223
|
<tr>
|
|
7007
|
-
<td class="
|
|
7224
|
+
<td class="w-250px"><code>boundingBox: <a href="#rekognition-bbox-if">BoundingBox</a></code></td>
|
|
7008
7225
|
<td>Bounding box of the face.</td>
|
|
7009
7226
|
</tr>
|
|
7010
7227
|
<tr>
|
|
7011
|
-
<td class="
|
|
7228
|
+
<td class="w-250px"><code>ageRange?: {high: UInteger, low: UInteger}</code></td>
|
|
7012
7229
|
<td>The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.</td>
|
|
7013
7230
|
</tr>
|
|
7014
7231
|
<tr>
|
|
7015
|
-
<td class="
|
|
7232
|
+
<td class="w-250px"><code>gender?: 'male'|'female'</code></td>
|
|
7016
7233
|
<td>The predicted gender of a detected face.</td>
|
|
7017
7234
|
</tr>
|
|
7018
7235
|
<tr>
|
|
7019
|
-
<td class="
|
|
7020
|
-
<td>
|
|
7236
|
+
<td class="w-250px"><code>emotions?: <a href="#rekognition-emotions-if">FaceDetailsEmotions</a></code></td>
|
|
7237
|
+
<td>Emotions detected from the face.</td>
|
|
7021
7238
|
</tr>
|
|
7022
7239
|
</tbody>
|
|
7023
7240
|
<!--end::Body-->
|
|
@@ -7055,20 +7272,20 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
7055
7272
|
<!--begin::Body-->
|
|
7056
7273
|
<tbody>
|
|
7057
7274
|
<tr>
|
|
7058
|
-
<td class="
|
|
7275
|
+
<td class="w-250px"><code>faceId: string</code></td>
|
|
7059
7276
|
<td>A unique identifier assigned to the face.</td>
|
|
7060
7277
|
</tr>
|
|
7061
7278
|
<tr>
|
|
7062
|
-
<td class="
|
|
7279
|
+
<td class="w-250px"><code>ageRange: {high: UInteger, low: UInteger}</code></td>
|
|
7063
7280
|
<td>The estimated age range, in years, for the face. Low represents the lowest estimated age and High represents the highest estimated age.</td>
|
|
7064
7281
|
</tr>
|
|
7065
7282
|
<tr>
|
|
7066
|
-
<td class="
|
|
7283
|
+
<td class="w-250px"><code>gender: 'male'|'female'</code></td>
|
|
7067
7284
|
<td>The predicted gender of a detected face.</td>
|
|
7068
7285
|
</tr>
|
|
7069
7286
|
<tr>
|
|
7070
|
-
<td class="
|
|
7071
|
-
<td>
|
|
7287
|
+
<td class="w-250px"><code>emotions: <a href="#rekognition-emotions-if">FaceDetailsEmotions</a></code></td>
|
|
7288
|
+
<td>Emotions detected from the face.</td>
|
|
7072
7289
|
</tr>
|
|
7073
7290
|
</tbody>
|
|
7074
7291
|
<!--end::Body-->
|
|
@@ -7106,31 +7323,31 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
7106
7323
|
<!--begin::Body-->
|
|
7107
7324
|
<tbody>
|
|
7108
7325
|
<tr>
|
|
7109
|
-
<td class="
|
|
7326
|
+
<td class="w-250px"><code>disgusted: number</code></td>
|
|
7110
7327
|
<td>Confidence level of "disgusted" predicted from the face.</td>
|
|
7111
7328
|
</tr>
|
|
7112
7329
|
<tr>
|
|
7113
|
-
<td class="
|
|
7330
|
+
<td class="w-250px"><code>happy: number</code></td>
|
|
7114
7331
|
<td>Confidence level of "happy" predicted from the face.</td>
|
|
7115
7332
|
</tr>
|
|
7116
7333
|
<tr>
|
|
7117
|
-
<td class="
|
|
7334
|
+
<td class="w-250px"><code>surprised: number</code></td>
|
|
7118
7335
|
<td>Confidence level of "surprised" predicted from the face.</td>
|
|
7119
7336
|
</tr>
|
|
7120
7337
|
<tr>
|
|
7121
|
-
<td class="
|
|
7338
|
+
<td class="w-250px"><code>angry: number</code></td>
|
|
7122
7339
|
<td>Confidence level of "angry" predicted from the face.</td>
|
|
7123
7340
|
</tr>
|
|
7124
7341
|
<tr>
|
|
7125
|
-
<td class="
|
|
7342
|
+
<td class="w-250px"><code>confused: number</code></td>
|
|
7126
7343
|
<td>Confidence level of "confused" predicted from the face.</td>
|
|
7127
7344
|
</tr>
|
|
7128
7345
|
<tr>
|
|
7129
|
-
<td class="
|
|
7346
|
+
<td class="w-250px"><code>calm: number</code></td>
|
|
7130
7347
|
<td>Confidence level of "calm" predicted from the face.</td>
|
|
7131
7348
|
</tr>
|
|
7132
7349
|
<tr>
|
|
7133
|
-
<td class="
|
|
7350
|
+
<td class="w-250px"><code>sad: number</code></td>
|
|
7134
7351
|
<td>Confidence level of "sad" predicted from the face.</td>
|
|
7135
7352
|
</tr>
|
|
7136
7353
|
</tbody>
|
|
@@ -7169,19 +7386,19 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
7169
7386
|
<!--begin::Body-->
|
|
7170
7387
|
<tbody>
|
|
7171
7388
|
<tr>
|
|
7172
|
-
<td class="
|
|
7389
|
+
<td class="w-250px"><code>width: number</code></td>
|
|
7173
7390
|
<td>The width of the bounding box.</td>
|
|
7174
7391
|
</tr>
|
|
7175
7392
|
<tr>
|
|
7176
|
-
<td class="
|
|
7393
|
+
<td class="w-250px"><code>height: number</code></td>
|
|
7177
7394
|
<td>The height of the bounding box.</td>
|
|
7178
7395
|
</tr>
|
|
7179
7396
|
<tr>
|
|
7180
|
-
<td class="
|
|
7397
|
+
<td class="w-250px"><code>left: number</code></td>
|
|
7181
7398
|
<td>The x coordinate of the bounding box with the origin (0,0) in the upper left corner.</td>
|
|
7182
7399
|
</tr>
|
|
7183
7400
|
<tr>
|
|
7184
|
-
<td class="
|
|
7401
|
+
<td class="w-250px"><code>top: number</code></td>
|
|
7185
7402
|
<td>The y coordinate of the bounding box with the origin (0,0) in the upper left corner.</td>
|
|
7186
7403
|
</tr>
|
|
7187
7404
|
</tbody>
|
|
@@ -7199,6 +7416,337 @@ await client.deleteFaces('MyCollection', ['f7befa24-3b83-43cc-b21
|
|
|
7199
7416
|
</div>
|
|
7200
7417
|
<!--end::Card-->
|
|
7201
7418
|
<!--begin::Card-->
|
|
7419
|
+
<div id="ses" data-search-item="true" data-search-title="SES" data-search-description="How to use SES" class="card card-docs flex-row-fluid mb-12">
|
|
7420
|
+
<!--begin::Card Body-->
|
|
7421
|
+
<div class="card-body fs-6 py-15 px-10 py-lg-15 px-lg-15 text-gray-700">
|
|
7422
|
+
<!--begin::Section-->
|
|
7423
|
+
<div class="pb-10">
|
|
7424
|
+
<!--begin::Heading-->
|
|
7425
|
+
<h1 class="fs-2tx fw-bold mb-5">SES</h1>
|
|
7426
|
+
<!--end::Heading-->
|
|
7427
|
+
<!--begin::Block-->
|
|
7428
|
+
<div class="py-5">
|
|
7429
|
+
Send an email.<br>
|
|
7430
|
+
This is an extension of AWS SES, learn more about AWS SES <a href="https://docs.aws.amazon.com/ses/latest/dg/Welcome.html" class="fw-semibold" target="_blank">here</a>.
|
|
7431
|
+
</div>
|
|
7432
|
+
<!--end::Block-->
|
|
7433
|
+
</div>
|
|
7434
|
+
<!--end::Section-->
|
|
7435
|
+
<!--begin::Section-->
|
|
7436
|
+
<div id="ses-class" class="py-10">
|
|
7437
|
+
<!--begin::Heading-->
|
|
7438
|
+
<h1 class="fw-bold mb-5">Class SES (express-sweet.services.AWSSesClient)</h1>
|
|
7439
|
+
<!--end::Heading-->
|
|
7440
|
+
<!--begin::Block-->
|
|
7441
|
+
<div class="py-5">Send an email.</div>
|
|
7442
|
+
<!--end::Block-->
|
|
7443
|
+
<h2 class="text-gray-700 py-5 fw-normal">Methods of the SES</h2>
|
|
7444
|
+
<!--begin::Table-->
|
|
7445
|
+
<div class="py-2">
|
|
7446
|
+
<!--begin::Table wrapper-->
|
|
7447
|
+
<div class="table-responsive border rounded">
|
|
7448
|
+
<!--begin::Table-->
|
|
7449
|
+
<table class="table table-striped mb-0 g-6">
|
|
7450
|
+
<!--begin::Head-->
|
|
7451
|
+
<thead>
|
|
7452
|
+
<tr class="fs-4 fw-bold p-6">
|
|
7453
|
+
<th class="min-w-200px">Method</th>
|
|
7454
|
+
<th>Description</th>
|
|
7455
|
+
</tr>
|
|
7456
|
+
</thead>
|
|
7457
|
+
<!--end::Head-->
|
|
7458
|
+
<!--begin::Body-->
|
|
7459
|
+
<tbody>
|
|
7460
|
+
<tr>
|
|
7461
|
+
<td class="w-250px"><code>constructor()</code></td>
|
|
7462
|
+
<td>
|
|
7463
|
+
Constructs a SES client object.
|
|
7464
|
+
<!--begin::Parameters-->
|
|
7465
|
+
<div class="py-5">
|
|
7466
|
+
<p>Parameters:</p>
|
|
7467
|
+
<ul>
|
|
7468
|
+
<li><code>options.apiVersion: string</code> API version in YYYYY-MM-DD format (or date). Specify 'latest' to use the latest possible version. The default is 'latest'.</li>
|
|
7469
|
+
<li><code>options.region: string</code> The region to send service requests to.</li>
|
|
7470
|
+
<li><code>options.accessKeyId: string</code> AWS access key ID.</li>
|
|
7471
|
+
<li><code>options.secretAccessKey: string</code> AWS secret access key.</li>
|
|
7472
|
+
</ul>
|
|
7473
|
+
</div>
|
|
7474
|
+
<!--end::Parameters-->
|
|
7475
|
+
<!--begin::Code-->
|
|
7476
|
+
<div class="py-5">
|
|
7477
|
+
<!--begin::Highlight-->
|
|
7478
|
+
<div class="highlight">
|
|
7479
|
+
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
7480
|
+
<ul class="nav nav-pills" role="tablist">
|
|
7481
|
+
<li class="nav-item">
|
|
7482
|
+
<a class="nav-link active" data-bs-toggle="tab" href="#ses-constructor-for-esm" role="tab">ESM</a>
|
|
7483
|
+
</li>
|
|
7484
|
+
<li class="nav-item">
|
|
7485
|
+
<a class="nav-link" data-bs-toggle="tab" href="#ses-constructor-for-cjs" role="tab">CJS</a>
|
|
7486
|
+
</li>
|
|
7487
|
+
</ul>
|
|
7488
|
+
<div class="tab-content">
|
|
7489
|
+
<div class="tab-pane fade show active" id="ses-constructor-for-esm" role="tabpanel">
|
|
7490
|
+
<div class="highlight-code">
|
|
7491
|
+
<pre class="language-javascript" style="max-height:400px"><code class="language-javascript">import * as sweet from 'express-sweet';
|
|
7492
|
+
|
|
7493
|
+
// Load environment variables.
|
|
7494
|
+
sweet.middlewares.Environment.mount();
|
|
7495
|
+
|
|
7496
|
+
// AWS SES Client.
|
|
7497
|
+
const client = new sweet.services.AWSSesClient({
|
|
7498
|
+
apiVersion: process.env.SES_API_VERSION,
|
|
7499
|
+
region: process.env.SES_REGION,
|
|
7500
|
+
accessKeyId: process.env.SES_ACCESS_KEY_ID,
|
|
7501
|
+
secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
|
|
7502
|
+
});</code></pre>
|
|
7503
|
+
</div>
|
|
7504
|
+
</div>
|
|
7505
|
+
<div class="tab-pane fade" id="ses-constructor-for-cjs" role="tabpanel">
|
|
7506
|
+
<div class="highlight-code">
|
|
7507
|
+
<pre class="language-javascript" style="max-height:400px"><code class="language-javascript">const sweet = require('express-sweet');
|
|
7508
|
+
|
|
7509
|
+
// Load environment variables.
|
|
7510
|
+
sweet.middlewares.Environment.mount();
|
|
7511
|
+
|
|
7512
|
+
// AWS SES Client.
|
|
7513
|
+
const client = new sweet.services.AWSSesClient({
|
|
7514
|
+
apiVersion: process.env.SES_API_VERSION,
|
|
7515
|
+
region: process.env.SES_REGION,
|
|
7516
|
+
accessKeyId: process.env.SES_ACCESS_KEY_ID,
|
|
7517
|
+
secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
|
|
7518
|
+
});</code></pre>
|
|
7519
|
+
</div>
|
|
7520
|
+
</div>
|
|
7521
|
+
</div>
|
|
7522
|
+
</div>
|
|
7523
|
+
<!--end::Highlight-->
|
|
7524
|
+
</div>
|
|
7525
|
+
<!--end::Code-->
|
|
7526
|
+
</td>
|
|
7527
|
+
</tr>
|
|
7528
|
+
<tr>
|
|
7529
|
+
<td class="w-250px"><code>send()</code></td>
|
|
7530
|
+
<td>
|
|
7531
|
+
Send email.
|
|
7532
|
+
<!--begin::Parameters-->
|
|
7533
|
+
<div class="py-5">
|
|
7534
|
+
<p>Parameters:</p>
|
|
7535
|
+
<ul>
|
|
7536
|
+
<li><code>type: 'text'|'html'</code> E-Mail type ('html': HTML mail, 'text': text mail). Default is 'text'.</li>
|
|
7537
|
+
</ul>
|
|
7538
|
+
</div>
|
|
7539
|
+
<!--end::Parameters-->
|
|
7540
|
+
<!--begin::Return value-->
|
|
7541
|
+
<div class="py-5">
|
|
7542
|
+
<p>Return value:</p>
|
|
7543
|
+
<code>Promise<string></code> Unique ID assigned by Amazon SES for a successfully sent email.
|
|
7544
|
+
</div>
|
|
7545
|
+
<!--end::Return value-->
|
|
7546
|
+
<!--begin::Code-->
|
|
7547
|
+
<div class="py-5">
|
|
7548
|
+
<!--begin::Highlight-->
|
|
7549
|
+
<div class="highlight">
|
|
7550
|
+
<button class="highlight-copy btn" data-bs-toggle="tooltip" title="Copy code">copy</button>
|
|
7551
|
+
<ul class="nav nav-pills" role="tablist">
|
|
7552
|
+
<li class="nav-item">
|
|
7553
|
+
<a class="nav-link active" data-bs-toggle="tab" href="#ses-send-for-esm" role="tab">ESM</a>
|
|
7554
|
+
</li>
|
|
7555
|
+
<li class="nav-item">
|
|
7556
|
+
<a class="nav-link" data-bs-toggle="tab" href="#ses-send-for-cjs" role="tab">CJS</a>
|
|
7557
|
+
</li>
|
|
7558
|
+
</ul>
|
|
7559
|
+
<div class="tab-content">
|
|
7560
|
+
<div class="tab-pane fade show active" id="ses-send-for-esm" role="tabpanel">
|
|
7561
|
+
<div class="highlight-code">
|
|
7562
|
+
<pre class="language-javascript" style="max-height:400px"><code class="language-javascript">import * as sweet from 'express-sweet';
|
|
7563
|
+
|
|
7564
|
+
// Load environment variables.
|
|
7565
|
+
sweet.middlewares.Environment.mount();
|
|
7566
|
+
|
|
7567
|
+
// AWS SES Client.
|
|
7568
|
+
const client = new sweet.services.AWSSesClient({
|
|
7569
|
+
apiVersion: process.env.SES_API_VERSION,
|
|
7570
|
+
region: process.env.SES_REGION,
|
|
7571
|
+
accessKeyId: process.env.SES_ACCESS_KEY_ID,
|
|
7572
|
+
secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
|
|
7573
|
+
});
|
|
7574
|
+
|
|
7575
|
+
// Send email.
|
|
7576
|
+
await client
|
|
7577
|
+
.from('user1@example.com', 'Sender Name')
|
|
7578
|
+
.to('user2@example.com')
|
|
7579
|
+
.subject('Test email')
|
|
7580
|
+
.body('Hi, this is a test email')
|
|
7581
|
+
.send();
|
|
7582
|
+
|
|
7583
|
+
// Use variables in the body of the e-mail.
|
|
7584
|
+
// The body can use the handlebars and handlebars-extd syntax.
|
|
7585
|
+
await client
|
|
7586
|
+
.from('user1@example.com', 'Sender Name')
|
|
7587
|
+
.to('user2@example.com')
|
|
7588
|
+
.subject('Test email')
|
|
7589
|
+
.body('Hello {{name}}', {name: 'Mason'})
|
|
7590
|
+
.send();</code></pre>
|
|
7591
|
+
</div>
|
|
7592
|
+
</div>
|
|
7593
|
+
<div class="tab-pane fade" id="ses-send-for-cjs" role="tabpanel">
|
|
7594
|
+
<div class="highlight-code">
|
|
7595
|
+
<pre class="language-javascript" style="max-height:400px"><code class="language-javascript">const sweet = require('express-sweet');
|
|
7596
|
+
|
|
7597
|
+
// Load environment variables.
|
|
7598
|
+
sweet.middlewares.Environment.mount();
|
|
7599
|
+
|
|
7600
|
+
// AWS SES Client.
|
|
7601
|
+
const client = new sweet.services.AWSSesClient({
|
|
7602
|
+
apiVersion: process.env.SES_API_VERSION,
|
|
7603
|
+
region: process.env.SES_REGION,
|
|
7604
|
+
accessKeyId: process.env.SES_ACCESS_KEY_ID,
|
|
7605
|
+
secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
|
|
7606
|
+
});
|
|
7607
|
+
|
|
7608
|
+
// Send email.
|
|
7609
|
+
await client
|
|
7610
|
+
.from('user1@example.com', 'Sender Name')
|
|
7611
|
+
.to('user2@example.com')
|
|
7612
|
+
.subject('Test email')
|
|
7613
|
+
.body('Hi, this is a test email')
|
|
7614
|
+
.send();
|
|
7615
|
+
|
|
7616
|
+
// Use variables in the body of the e-mail.
|
|
7617
|
+
// The body can use the handlebars and handlebars-extd syntax.
|
|
7618
|
+
await client
|
|
7619
|
+
.from('user1@example.com', 'Sender Name')
|
|
7620
|
+
.to('user2@example.com')
|
|
7621
|
+
.subject('Test email')
|
|
7622
|
+
.body('Hello {{name}}', {name: 'Mason'})
|
|
7623
|
+
.send();</code></pre>
|
|
7624
|
+
</div>
|
|
7625
|
+
</div>
|
|
7626
|
+
</div>
|
|
7627
|
+
</div>
|
|
7628
|
+
<!--end::Highlight-->
|
|
7629
|
+
</div>
|
|
7630
|
+
<!--end::Code-->
|
|
7631
|
+
</td>
|
|
7632
|
+
</tr>
|
|
7633
|
+
<tr>
|
|
7634
|
+
<td class="w-250px"><code>from()</code></td>
|
|
7635
|
+
<td>
|
|
7636
|
+
Set the sender's email address.
|
|
7637
|
+
<!--begin::Parameters-->
|
|
7638
|
+
<div class="py-5">
|
|
7639
|
+
<p>Parameters:</p>
|
|
7640
|
+
<ul>
|
|
7641
|
+
<li><code>from: string</code> Sender's email address.</li>
|
|
7642
|
+
<li><code>name?: string</code> Sender Name.</li>
|
|
7643
|
+
</ul>
|
|
7644
|
+
</div>
|
|
7645
|
+
<!--end::Parameters-->
|
|
7646
|
+
<!--begin::Return value-->
|
|
7647
|
+
<div class="py-5">
|
|
7648
|
+
<p>Return value:</p>
|
|
7649
|
+
<code>AWSSesClient</code>
|
|
7650
|
+
</div>
|
|
7651
|
+
<!--end::Return value-->
|
|
7652
|
+
</td>
|
|
7653
|
+
</tr>
|
|
7654
|
+
<tr>
|
|
7655
|
+
<td class="w-250px"><code>to()</code></td>
|
|
7656
|
+
<td>
|
|
7657
|
+
Set the destination email address.
|
|
7658
|
+
<!--begin::Parameters-->
|
|
7659
|
+
<div class="py-5">
|
|
7660
|
+
<p>Parameters:</p>
|
|
7661
|
+
<ul>
|
|
7662
|
+
<li><code>to: string|string[]</code> Email address to be sent to.</li>
|
|
7663
|
+
</ul>
|
|
7664
|
+
</div>
|
|
7665
|
+
<!--end::Parameters-->
|
|
7666
|
+
<!--begin::Return value-->
|
|
7667
|
+
<div class="py-5">
|
|
7668
|
+
<p>Return value:</p>
|
|
7669
|
+
<code>AWSSesClient</code>
|
|
7670
|
+
</div>
|
|
7671
|
+
<!--end::Return value-->
|
|
7672
|
+
</td>
|
|
7673
|
+
</tr>
|
|
7674
|
+
<tr>
|
|
7675
|
+
<td class="w-250px"><code>cc()</code></td>
|
|
7676
|
+
<td>
|
|
7677
|
+
Set CC email address.
|
|
7678
|
+
<!--begin::Parameters-->
|
|
7679
|
+
<div class="py-5">
|
|
7680
|
+
<p>Parameters:</p>
|
|
7681
|
+
<ul>
|
|
7682
|
+
<li><code>cc: string|string[]</code> CC email address.</li>
|
|
7683
|
+
</ul>
|
|
7684
|
+
</div>
|
|
7685
|
+
<!--end::Parameters-->
|
|
7686
|
+
<!--begin::Return value-->
|
|
7687
|
+
<div class="py-5">
|
|
7688
|
+
<p>Return value:</p>
|
|
7689
|
+
<code>AWSSesClient</code>
|
|
7690
|
+
</div>
|
|
7691
|
+
<!--end::Return value-->
|
|
7692
|
+
</td>
|
|
7693
|
+
</tr>
|
|
7694
|
+
<tr>
|
|
7695
|
+
<td class="w-250px"><code>subject()</code></td>
|
|
7696
|
+
<td>
|
|
7697
|
+
Set the email subject.
|
|
7698
|
+
<!--begin::Parameters-->
|
|
7699
|
+
<div class="py-5">
|
|
7700
|
+
<p>Parameters:</p>
|
|
7701
|
+
<ul>
|
|
7702
|
+
<li><code>subject: string</code> Email Subject.</li>
|
|
7703
|
+
</ul>
|
|
7704
|
+
</div>
|
|
7705
|
+
<!--end::Parameters-->
|
|
7706
|
+
<!--begin::Return value-->
|
|
7707
|
+
<div class="py-5">
|
|
7708
|
+
<p>Return value:</p>
|
|
7709
|
+
<code>AWSSesClient</code>
|
|
7710
|
+
</div>
|
|
7711
|
+
<!--end::Return value-->
|
|
7712
|
+
</td>
|
|
7713
|
+
</tr>
|
|
7714
|
+
<tr>
|
|
7715
|
+
<td class="w-250px"><code>body()</code></td>
|
|
7716
|
+
<td>
|
|
7717
|
+
Set the body of the email.
|
|
7718
|
+
<!--begin::Parameters-->
|
|
7719
|
+
<div class="py-5">
|
|
7720
|
+
<p>Parameters:</p>
|
|
7721
|
+
<ul>
|
|
7722
|
+
<li><code>body: string</code> Email Body. The body can use the <a href="https://handlebarsjs.com/" class="fw-semibold" target="_blank">handlebars</a> and <a href="https://www.npmjs.com/package/handlebars-extd" class="fw-semibold" target="_blank">handlebars-extd</a> syntax.</li>
|
|
7723
|
+
<li><code>vars: {[key: string]: any}</code> The value of a variable in the body of the e-mail.</li>
|
|
7724
|
+
</ul>
|
|
7725
|
+
</div>
|
|
7726
|
+
<!--end::Parameters-->
|
|
7727
|
+
<!--begin::Return value-->
|
|
7728
|
+
<div class="py-5">
|
|
7729
|
+
<p>Return value:</p>
|
|
7730
|
+
<code>AWSSesClient</code>
|
|
7731
|
+
</div>
|
|
7732
|
+
<!--end::Return value-->
|
|
7733
|
+
</td>
|
|
7734
|
+
</tr>
|
|
7735
|
+
</tbody>
|
|
7736
|
+
<!--end::Body-->
|
|
7737
|
+
</table>
|
|
7738
|
+
<!--end::Table-->
|
|
7739
|
+
</div>
|
|
7740
|
+
<!--end::Table wrapper-->
|
|
7741
|
+
</div>
|
|
7742
|
+
<!--end::Table-->
|
|
7743
|
+
</div>
|
|
7744
|
+
<!--end::Section-->
|
|
7745
|
+
</div>
|
|
7746
|
+
<!--end::Card Body-->
|
|
7747
|
+
</div>
|
|
7748
|
+
<!--end::Card-->
|
|
7749
|
+
<!--begin::Card-->
|
|
7202
7750
|
<div id="changelog" data-search-item="true" data-search-title="Changelog" data-search-description="Version Change History" class="card card-docs flex-row-fluid mb-12">
|
|
7203
7751
|
<!--begin::Card Body-->
|
|
7204
7752
|
<div class="card-body fs-6 py-15 px-10 py-lg-15 px-lg-15 text-gray-700">
|