express-sweet 1.0.32 → 1.0.34
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 +77 -38
- package/dist/build.common.js +2 -2
- package/dist/build.esm.js +2 -2
- package/docs/index.html +239 -126
- package/package.json +1 -1
- package/types/database/Model.d.ts +1 -1
- package/types/handlebars_helpers/comparison.d.ts +115 -66
- package/types/handlebars_helpers/date.d.ts +8 -3
- package/types/handlebars_helpers/html.d.ts +2 -1
- package/types/handlebars_helpers/number.d.ts +4 -2
- package/types/handlebars_helpers/object.d.ts +5 -5
- package/types/handlebars_helpers/string.d.ts +15 -11
- package/types/middlewares/Authentication.d.ts +1 -1
- package/types/middlewares/Environment.d.ts +0 -1
- package/types/middlewares/Local.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## [1.0.34] - 2023/7/1
|
|
5
|
+
- Changed the response status code from 403 to 401 when asynchronous communication requiring authentication fails to authenticate.
|
|
6
|
+
|
|
7
|
+
## [1.0.33] - 2023/7/1
|
|
8
|
+
- Added regular expression comparison view helper.
|
|
9
|
+
```html
|
|
10
|
+
{{!-- results in: true --}}
|
|
11
|
+
{{regexMatch 'foobar' 'foo'}}
|
|
12
|
+
|
|
13
|
+
{{!-- results in: false --}}
|
|
14
|
+
{{regexMatch 'bar' 'foo'}}
|
|
15
|
+
|
|
16
|
+
{{!-- results in: false --}}
|
|
17
|
+
{{regexMatch 'foobar' '^foo$'}}
|
|
18
|
+
|
|
19
|
+
{{!-- results in: true --}}
|
|
20
|
+
{{regexMatch 'Visit Here' 'here' 'i'}}
|
|
21
|
+
|
|
22
|
+
{{!-- results in: false --}}
|
|
23
|
+
{{regexMatch 'Visit Here' 'here'}}
|
|
24
|
+
|
|
25
|
+
{{!-- results in: Match --}}
|
|
26
|
+
{{#if (regexMatch 'foobar' 'foo')}}
|
|
27
|
+
Match
|
|
28
|
+
{{/if}}
|
|
29
|
+
```
|
|
30
|
+
|
|
4
31
|
## [1.0.32] - 2023/7/1
|
|
5
32
|
### Fixed
|
|
6
33
|
- Fixed a bug that cookies (req.cookies) cannot be referenced in the hook function before view rendering (config/view.js#beforeRender).
|
|
@@ -20,10 +47,12 @@ All notable changes to this project will be documented in this file.
|
|
|
20
47
|
### Added
|
|
21
48
|
- Added view helper to convert numeric values to strings with language-sensitive representations.
|
|
22
49
|
```html
|
|
23
|
-
{{
|
|
50
|
+
{{!-- results in: 123,456.789 --}}
|
|
51
|
+
{{number2locale 123456.789}}
|
|
24
52
|
|
|
25
53
|
{{!-- German uses comma as decimal separator and period for thousands. --}}
|
|
26
|
-
{{
|
|
54
|
+
{{!-- results in: 123.456,789 --}}
|
|
55
|
+
{{number2locale 123456.789 'de-DE'}}
|
|
27
56
|
```
|
|
28
57
|
|
|
29
58
|
## [1.0.30] - 2023/6/26
|
|
@@ -127,10 +156,17 @@ All notable changes to this project will be documented in this file.
|
|
|
127
156
|
### Added
|
|
128
157
|
- Added formatBytes view helper to convert bytes to appropriate units.
|
|
129
158
|
```html
|
|
130
|
-
{{
|
|
131
|
-
{{formatBytes
|
|
132
|
-
|
|
133
|
-
{{
|
|
159
|
+
{{!-- results in: 1 KB --}}
|
|
160
|
+
{{formatBytes 1024}}
|
|
161
|
+
|
|
162
|
+
{{!-- results in: 1.21 KB --}}
|
|
163
|
+
{{formatBytes 1234 2}}
|
|
164
|
+
|
|
165
|
+
{{!-- results in: 1.205 KB --}}
|
|
166
|
+
{{formatBytes 1234 3}}
|
|
167
|
+
|
|
168
|
+
{{!-- results in: 0 Bytes --}}
|
|
169
|
+
{{formatBytes 0}}
|
|
134
170
|
```
|
|
135
171
|
|
|
136
172
|
## [1.0.24] - 2022/10/24
|
|
@@ -230,12 +266,12 @@ All notable changes to this project will be documented in this file.
|
|
|
230
266
|
const collectionId = 'MyCollection';
|
|
231
267
|
|
|
232
268
|
// Create a face and get the ID of the created face.
|
|
233
|
-
//
|
|
269
|
+
// results in: e65d66cb-e7bc-4bbf-966c-b1b49ddf29f8
|
|
234
270
|
const faceId = await client.indexFace(collectionId, 'img/face4.jpg');
|
|
235
271
|
console.log(faceId);
|
|
236
272
|
|
|
237
273
|
// Create a face and get the details of the created face.
|
|
238
|
-
//
|
|
274
|
+
// results in: {
|
|
239
275
|
// faceId: '7f2dd321-f047-44ff-8856-864637e1d286',
|
|
240
276
|
// ageRange: { high: 29, low: 21 },
|
|
241
277
|
// gender: 'female',
|
|
@@ -272,7 +308,7 @@ All notable changes to this project will be documented in this file.
|
|
|
272
308
|
|
|
273
309
|
(async () => {
|
|
274
310
|
// Detects bounding boxes on faces.
|
|
275
|
-
//
|
|
311
|
+
// results in: [
|
|
276
312
|
// {
|
|
277
313
|
// width: 0.3099822998046875,
|
|
278
314
|
// height: 0.661512017250061,
|
|
@@ -284,7 +320,7 @@ All notable changes to this project will be documented in this file.
|
|
|
284
320
|
console.log(res);
|
|
285
321
|
|
|
286
322
|
// Detect facial details.
|
|
287
|
-
//
|
|
323
|
+
// results in: [
|
|
288
324
|
// {
|
|
289
325
|
// boundingBox: {
|
|
290
326
|
// width: 0.3099822998046875,
|
|
@@ -317,9 +353,14 @@ All notable changes to this project will be documented in this file.
|
|
|
317
353
|
### Added
|
|
318
354
|
- Add date format helper to view.
|
|
319
355
|
```html
|
|
320
|
-
{{
|
|
321
|
-
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"
|
|
322
|
-
|
|
356
|
+
{{!-- results in: 2021/10/24 --}}
|
|
357
|
+
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}}
|
|
358
|
+
|
|
359
|
+
{{!-- results in: 2021/10/24 --}}
|
|
360
|
+
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}}
|
|
361
|
+
|
|
362
|
+
{{!-- results in: 2021/10/24 --}}
|
|
363
|
+
{{formatDate 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}}
|
|
323
364
|
```
|
|
324
365
|
|
|
325
366
|
## [1.0.18] - 2022/5/18
|
|
@@ -362,44 +403,40 @@ All notable changes to this project will be documented in this file.
|
|
|
362
403
|
### Changed
|
|
363
404
|
- empty view helper can now check any type. Previously I could only check arrays.
|
|
364
405
|
```html
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
{{empty value}} => false
|
|
406
|
+
{{!-- results in: false --}}
|
|
407
|
+
{{empty [5, 6]}}
|
|
368
408
|
|
|
369
|
-
{{#if (empty
|
|
409
|
+
{{#if (empty 'foo')}}
|
|
370
410
|
Hello
|
|
371
411
|
{{/if}}
|
|
372
412
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
{{empty value}} => false
|
|
413
|
+
{{!-- results in: false --}}
|
|
414
|
+
{{empty 'Hello'}}
|
|
376
415
|
|
|
377
|
-
|
|
378
|
-
{{empty
|
|
416
|
+
{{!-- results in: true --}}
|
|
417
|
+
{{empty ''}}
|
|
379
418
|
|
|
380
|
-
|
|
381
|
-
{{empty value}}
|
|
419
|
+
{{!-- results in: true --}}
|
|
420
|
+
{{empty value}}
|
|
382
421
|
```
|
|
383
422
|
|
|
384
423
|
- Added notEmpty view helper.
|
|
385
424
|
```html
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
{{notEmpty value}} => true
|
|
425
|
+
{{!-- results in: true --}}
|
|
426
|
+
{{notEmpty [5, 6]}}
|
|
389
427
|
|
|
390
|
-
{{#if (notEmpty
|
|
428
|
+
{{#if (notEmpty 'foo')}}
|
|
391
429
|
Hello
|
|
392
430
|
{{/if}}
|
|
393
431
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
{{notEmpty value}} => true
|
|
432
|
+
{{!-- results in: true --}}
|
|
433
|
+
{{notEmpty 'Hello'}}
|
|
397
434
|
|
|
398
|
-
|
|
399
|
-
{{notEmpty
|
|
435
|
+
{{!-- results in: false --}}
|
|
436
|
+
{{notEmpty ''}}
|
|
400
437
|
|
|
401
|
-
|
|
402
|
-
{{notEmpty
|
|
438
|
+
{{!-- results in: false --}}
|
|
439
|
+
{{notEmpty ' '}}
|
|
403
440
|
```
|
|
404
441
|
|
|
405
442
|
## [1.0.13] - 2021/12/13
|
|
@@ -419,7 +456,7 @@ All notable changes to this project will be documented in this file.
|
|
|
419
456
|
await transaction.commit();
|
|
420
457
|
|
|
421
458
|
// Check the update result.
|
|
422
|
-
//
|
|
459
|
+
// results in: New title of book: When Im Gone
|
|
423
460
|
await book.reload();
|
|
424
461
|
console.log(`New title of book: ${book.title}`);
|
|
425
462
|
} catch (err) {
|
|
@@ -455,7 +492,7 @@ All notable changes to this project will be documented in this file.
|
|
|
455
492
|
import * as sweet from 'express-sweet';
|
|
456
493
|
|
|
457
494
|
// Find a face from the collection.
|
|
458
|
-
//
|
|
495
|
+
// results in: Face search results: [
|
|
459
496
|
// {
|
|
460
497
|
// faceId: '385e1b00-4ede-4219-a7b0-0b9cbe4953e5',
|
|
461
498
|
// boundingBox: {
|
|
@@ -549,4 +586,6 @@ All notable changes to this project will be documented in this file.
|
|
|
549
586
|
[1.0.29]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.28...v1.0.29
|
|
550
587
|
[1.0.30]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.29...v1.0.30
|
|
551
588
|
[1.0.31]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.30...v1.0.31
|
|
552
|
-
[1.0.32]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.31...v1.0.32
|
|
589
|
+
[1.0.32]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.31...v1.0.32
|
|
590
|
+
[1.0.33]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.32...v1.0.33
|
|
591
|
+
[1.0.34]: https://github.com/takuya-motoshima/express-sweet/compare/v1.0.33...v1.0.34
|