express-sweet 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +66 -457
  2. package/README.md +2107 -23
  3. package/configuration_sample/cjs/authentication.js +103 -0
  4. package/configuration_sample/cjs/config.js +76 -0
  5. package/configuration_sample/cjs/database.js +35 -0
  6. package/configuration_sample/cjs/view.js +36 -0
  7. package/configuration_sample/esm/authentication.js +103 -0
  8. package/configuration_sample/esm/config.js +76 -0
  9. package/configuration_sample/esm/database.js +35 -0
  10. package/configuration_sample/esm/view.js +36 -0
  11. package/dist/build.cjs +151 -0
  12. package/dist/build.mjs +151 -0
  13. package/package.json +27 -29
  14. package/screencaps/belongs-to-many.png +0 -0
  15. package/screencaps/belongs-to.png +0 -0
  16. package/screencaps/demonstration.webp +0 -0
  17. package/screencaps/has-many.png +0 -0
  18. package/screencaps/has-one.png +0 -0
  19. package/types/database/Database.d.ts +3 -171
  20. package/types/database/Model.d.ts +9 -6
  21. package/types/database/loadModels.d.ts +3 -1
  22. package/types/handlebars_helpers/comparison.d.ts +58 -188
  23. package/types/handlebars_helpers/date.d.ts +1 -1
  24. package/types/handlebars_helpers/html.d.ts +1 -1
  25. package/types/handlebars_helpers/index.d.ts +1 -0
  26. package/types/handlebars_helpers/layouts.d.ts +21 -0
  27. package/types/handlebars_helpers/math.d.ts +7 -14
  28. package/types/handlebars_helpers/number.d.ts +1 -1
  29. package/types/handlebars_helpers/object.d.ts +4 -4
  30. package/types/handlebars_helpers/string.d.ts +4 -9
  31. package/types/index.d.ts +0 -1
  32. package/types/interfaces/AuthenticationConfig.d.ts +0 -5
  33. package/types/interfaces/BasicConfig.d.ts +1 -5
  34. package/types/interfaces/ViewConfig.d.ts +0 -2
  35. package/types/middlewares/Authentication.d.ts +3 -1
  36. package/types/middlewares/CORS.d.ts +3 -1
  37. package/types/middlewares/Environment.d.ts +3 -3
  38. package/types/middlewares/ErrorHandler.d.ts +3 -1
  39. package/types/middlewares/Http.d.ts +3 -1
  40. package/types/middlewares/Local.d.ts +3 -1
  41. package/types/middlewares/View.d.ts +6 -2
  42. package/types/mount.d.ts +4 -2
  43. package/types/routing/Router.d.ts +3 -1
  44. package/types/services/Authentication.d.ts +4 -3
  45. package/types/types/global.d.ts +17 -0
  46. package/types/utils/loadAuthenticationConfig.d.ts +2 -2
  47. package/types/utils/loadBasicConfig.d.ts +2 -2
  48. package/types/utils/loadDatabaseConfig.d.ts +2 -2
  49. package/types/utils/loadViewConfig.d.ts +2 -2
  50. package/INSTALL-Redis.md +0 -77
  51. package/QUICK_START.md +0 -149
  52. package/dist/build.common.js +0 -378
  53. package/dist/build.esm.js +0 -378
  54. package/screencaps/login.jpg +0 -0
  55. package/screencaps/personal.jpg +0 -0
  56. package/screencaps/user-editing.jpg +0 -0
  57. package/screencaps/users.jpg +0 -0
  58. package/types/exceptions/FaceCollectionCreateFailed.d.ts +0 -25
  59. package/types/exceptions/FaceCollectionDeleteFailed.d.ts +0 -25
  60. package/types/exceptions/FaceIndexFailed.d.ts +0 -20
  61. package/types/exceptions/FaceMissingInPhoto.d.ts +0 -11
  62. package/types/exceptions/FacesMultipleInPhoto.d.ts +0 -11
  63. package/types/exceptions/index.d.ts +0 -5
@@ -1,316 +1,186 @@
1
1
  /**
2
2
  * Determine whether or not two values are equal (===).
3
3
  * @example
4
- * {{!-- results in: false --}}
5
- * {{eq '3' 3}}
6
- *
7
- * {{#if (eqw foo 'bar')}}
8
- * Hello
9
- * {{/if}}
4
+ * {{eq val1 val2}}
5
+ * {{#if (eqw val1 val2)}}...{{/if}}
10
6
  * @param {any} value1 First value to be compared with second.
11
7
  * @param {any} value2 Second value to be compared with first.
12
8
  * @return {boolean} Returns true if the value and type are the same, false if they are different.
13
9
  */
14
- export declare function eq(value1: any, value2: any): boolean;
10
+ export declare const eq: (value1: any, value2: any) => boolean;
15
11
  /**
16
12
  * Determine whether or not two values are equal (==) i.e weak checking.
17
13
  * @example
18
- * {{!-- results in: true --}}
19
- * {{eqw '3' 3}}
20
- *
21
- * {{#if (eqw foo 'bar')}}
22
- * Hello
23
- * {/if}}
14
+ * {{eqw val1 val2}}
15
+ * {{#if (eqw val1 val2)}}...{{/if}}
24
16
  * @param {any} value1 First value to be compared with second.
25
17
  * @param {any} value2 Second value to be compared with first.
26
18
  * @return {boolean} Returns true if the values are the same, false if they are different.
27
19
  */
28
- export declare function eqw(value1: any, value2: any): boolean;
20
+ export declare const eqw: (value1: any, value2: any) => boolean;
29
21
  /**
30
22
  * Determine whether or not two values are not equal (!==).
31
23
  * @example
32
- * {{!-- results in: true --}}
33
- * {{neq 4 3}}
34
- *
35
- * {{#if (neq foo 'bar')}}
36
- * Hello
37
- * {{/if}}
24
+ * {{neq val1 val2}}
25
+ * {{#if (neq val1 val2)}}...{{/if}}
38
26
  * @param {any} value1 First value to be compared with second.
39
27
  * @param {any} value2 Second value to be compared with first.
40
28
  * @return {boolean} Returns true if the value and type are different, false if they are the same.
41
29
  */
42
- export declare function neq(value1: any, value2: any): boolean;
30
+ export declare const neq: (value1: any, value2: any) => boolean;
43
31
  /**
44
32
  * Determine whether or not two values are not equal (!=) weak checking.
45
33
  * @example
46
- * {{!-- results in: false --}}
47
- * {{neqw '3' 3}}
48
- *
49
- * {{#if (neqw foo 'bar')}}
50
- * Hello
51
- * {{/if}}
34
+ * {{neqw val1 val2}}
35
+ * {{#if (neqw val1 val2)}}...{{/if}}
52
36
  * @param {any} value1 First value to be compared with second.
53
37
  * @param {any} value2 Second value to be compared with first.
54
38
  * @return {boolean} Returns true if the values are different, false if they are the same.
55
39
  */
56
- export declare function neqw(value1: any, value2: any): boolean;
40
+ export declare const neqw: (value1: any, value2: any) => boolean;
57
41
  /**
58
42
  * Check for less than condition (a < b).
59
43
  * @example
60
- * {{!-- results in: true --}}
61
- * {{lt 2 3}}
62
- *
63
- * {{#if (lt 2 5)}}
64
- * Hello
65
- * {{/if}}
44
+ * {{lt val1 val2}}
45
+ * {{#if (lt val1 val2)}}...{{/if}}
66
46
  * @param {any} value1 First value to be compared with second.
67
47
  * @param {any} value2 Second value to be compared with first.
68
48
  * @return {boolean} Returns true if the first value is less than the second value, false otherwise.
69
49
  */
70
- export declare function lt(value1: any, value2: any): boolean;
50
+ export declare const lt: (value1: any, value2: any) => boolean;
71
51
  /**
72
52
  * Check for less than or equals condition (a <= b).
73
53
  * @example
74
- * {{!-- results in: true --}}
75
- * {{lte 2 3}}
76
- *
77
- * {{#if (lte 2 5)}}
78
- * Hello
79
- * {{/if}}
54
+ * {{lte val1 val2}}
55
+ * {{#if (lte val1 val2)}}...{{/if}}
80
56
  * @param {any} value1 First value to be compared with second.
81
57
  * @param {any} value2 Second value to be compared with first.
82
58
  * @return {boolean} Returns true if the first value is less than or equal to the second value, false otherwise.
83
59
  */
84
- export declare function lte(value1: any, value2: any): boolean;
60
+ export declare const lte: (value1: any, value2: any) => boolean;
85
61
  /**
86
62
  * Check for greater than condition (a > b).
87
63
  * @example
88
- * {{!-- results in: false --}}
89
- * {{gt 2 3}}
90
- *
91
- * {{#if (gt 5 6)}}
92
- * Hello
93
- * {{/if}}
64
+ * {{gt val1 val2}}
65
+ * {{#if (gt val1 val2)}}...{{/if}}
94
66
  * @param {any} value1 First value to be compared with second.
95
67
  * @param {any} value2 Second value to be compared with first.
96
68
  * @return {boolean} Returns true if the first value exceeds the second value, false otherwise.
97
69
  */
98
- export declare function gt(value1: any, value2: any): boolean;
70
+ export declare const gt: (value1: any, value2: any) => boolean;
99
71
  /**
100
72
  * Check for greater than or equals condition (a >= b).
101
73
  * @example
102
- * {{!-- results in: true --}}
103
- * {{gte 3 3}}
104
- *
105
- * {{#if (gte 10 2)}}
106
- * Hello
107
- * {{/if}}
74
+ * {{gte val1 val2}}
75
+ * {{#if (gte val1 val2)}}...{{/if}}
108
76
  * @param {any} value1 First value to be compared with second.
109
77
  * @param {any} value2 Second value to be compared with first.
110
78
  * @return {boolean} Returns true if the first value is greater than or equal to the second value, false otherwise.
111
79
  */
112
- export declare function gte(value1: any, value2: any): boolean;
80
+ export declare const gte: (value1: any, value2: any) => boolean;
113
81
  /**
114
82
  * Logical NOT of any expression.
115
83
  * @example
116
- * {{!-- results in: false --}}
117
- * {{not true}}
118
- *
119
- * {{!-- results in: true --}}
120
- * {{not false}}
121
- *
122
- * {{#if (not (eq foo 'bar'))}}
123
- * Hello
124
- * {{/if}}
84
+ * {{not val}}
85
+ * {{#if (not (eq val1 val2))}}...{{/if}}
125
86
  * @param {any} expression Any expression.
126
87
  * @return {boolean} Returns the logical negation of the value.
127
88
  */
128
- export declare function not(expression: any): boolean;
89
+ export declare const not: (expression: any) => boolean;
129
90
  /**
130
91
  * Helper to imitate the ternary '?:' conditional operator.
131
92
  * @example
132
- * {{!-- results in: foo --}}
133
- * {{ifx true 'foo' 'bar'}}
134
- *
135
- * {{!-- results in: bar --}}
136
- * {{ifx false 'foo' 'bar'}}
137
- *
138
- * {{!-- results in: 6 --}}
139
- * {{ifx (eq value 1) 5 6}}
140
- *
141
- * {{!-- results in: 6 --}}
142
- * {{ifx (not (eq value 1)) 5 6}}
143
- *
144
- * {{!-- The third parameter is optional, and by default it will be blank string ('') --}}
145
- * {{!-- results in: active --}}
146
- * {{ifx true 'active'}}
147
- *
148
- * {{!-- results in: '' --}}
149
- * {{ifx false 'active'}}
93
+ * {{ifx true val1 val2}}
94
+ * {{ifx false val1 val2}}
95
+ * {{ifx (eq val1 val2) val3 val4}}
96
+ * {{ifx (not (eq val1 val2)) val3 val4}}
97
+ * {{ifx true val}}
98
+ * {{ifx false val}}
150
99
  * @param {boolean} condition Satisfying condition for getting first value. Either true of false.
151
100
  * @param {any} value1 First value to be displayed as result..
152
101
  * @param {any} value2 Second value to be displayed as result. Defaults to an empty string.
153
102
  * @return {any} Returns the result of the ternary operator.
154
103
  */
155
- export declare function ifx(condition: boolean, value1: any, value2: any): any;
104
+ export declare const ifx: (condition: boolean, value1: any, value2: any) => any;
156
105
  /**
157
106
  * Check if it is empty.
158
107
  * If the value is an array, returns true if there are no elements.
159
108
  * If the value is a string, the leading and trailing spaces are trimmed and then checked.
160
109
  * @example
161
- * {{!-- results in: false --}}
162
- * {{empty [5, 6]}}
163
- *
164
- * {{#if (empty 'foo')}}
165
- * Hello
166
- * {{/if}}
167
- *
168
- * {{!-- results in: false --}}
169
- * {{empty 'Hello'}}
170
- *
171
- * {{!-- results in: true --}}
172
- * {{empty ''}}
173
- *
174
- * {{!-- results in: true --}}
175
- * {{empty ' '}}
110
+ * {{empty val}}
111
+ * {{#if (empty val)}}...{{/if}}
176
112
  * @param {any} value Character strings, arrays, objects, etc. to be checked.
177
113
  * @return {boolean} Returns true if the value is empty, false otherwise.
178
114
  */
179
- export declare function empty(value: any): boolean;
115
+ export declare const empty: (value: any) => boolean;
180
116
  /**
181
117
  * Check that it is not empty.
182
118
  * If the value is an array, returns true if there is an element.
183
119
  * If the value is a string, the leading and trailing spaces are trimmed and then checked.
184
120
  * @example
185
- * {{!-- results in: true --}}
186
- * {{notEmpty [5, 6]}}
187
- *
188
- * {{#if (notEmpty 'foo')}}
189
- * Hello
190
- * {{/if}}
191
- *
192
- * {{!-- results in: true --}}
193
- * {{notEmpty 'Hello'}}
194
- *
195
- * {{!-- results in: false --}}
196
- * {{notEmpty ''}}
197
- *
198
- * {{!-- results in: false --}}
199
- * {{notEmpty ' '}}
121
+ * {{notEmpty val}}
122
+ * {{#if (notEmpty val)}}...{{/if}}
200
123
  * @param {any} value Character strings, arrays, objects, etc. to be checked.
201
124
  * @return {boolean} Returns true if the value is not empty, false otherwise.
202
125
  */
203
- export declare function notEmpty(value: any): boolean;
126
+ export declare const notEmpty: (value: any) => boolean;
204
127
  /**
205
128
  * Determine the length of an array.
206
- *
207
129
  * @example
208
- * {{!-- results in: 2 --}}
209
- * {{count [5, 6]}}
130
+ * {{count val}}
210
131
  * @param {any[]} items Array whose elements to be counted.
211
132
  * @return {number|false} Returns the length of the array if the value is an array, false if the value is not an array.
212
133
  */
213
- export declare function count(items: any[]): number | false;
134
+ export declare const count: (items: any[]) => number | false;
214
135
  /**
215
136
  * Returns the boolean AND of two or more parameters passed i.e it is true iff all the parameters are true.
216
137
  * @example
217
- * {{!-- results in: true --}}
218
- * {{and true true}}
219
- *
220
- * {{!-- results in: false --}}
221
- * {{and false true}}
222
- *
223
- * {{#if (and value1 value2)}}
224
- * {{!-- do something --}}
225
- * {{else}}
226
- * {{!-- do something else --}}
227
- * {{/if}}
138
+ * {{and val1 val2}}
139
+ * {{#if (and val1 val2)}}...{{/if}}
228
140
  * @param {...any} params Any number of boolean parameters.
229
141
  * @return {boolean} Returns the result of the logical product.
230
142
  */
231
- export declare function and(...params: any[]): boolean;
143
+ export declare const and: (...params: any[]) => boolean;
232
144
  /**
233
145
  * Returns the boolean OR of two or more parameters passed i.e it is true if any of the parameters is true.
234
146
  * @example
235
- * {{!-- results in: true --}}
236
- * {{or true false}}
237
- *
238
- * {{!-- results in: false --}}
239
- * {{or false false}}
240
- *
241
- * {{#if (or value1 value2)}}
242
- * {{!-- do something --}}
243
- * {{else}}
244
- * {{!-- do something else --}}
245
- * {{/if}}
147
+ * {{or val1 val2}}
148
+ * {{#if (or val1 val2)}}...{{/if}}
246
149
  * @param {...any} params Any number of boolean parameters.
247
150
  * @return {boolean} Returns the result of the OR.
248
151
  */
249
- export declare function or(...params: any[]): boolean;
152
+ export declare const or: (...params: any[]) => boolean;
250
153
  /**
251
154
  * Returns the first non-falsy value from the parameter list.
252
155
  * Works quite similar to the SQL's "COALESCE()" function, but unlike this checks for the first non-false parameter.
253
156
  * @example
254
- * {{!-- results in: foo bar --}}
255
- * {{coalesce 'foo bar' 'foob' 'unknown'}}
256
- *
257
- * {{!-- results in: foob --}}
258
- * {{coalesce '' 'foob' 'unknown'}}
157
+ * {{coalesce val1 val2}}
259
158
  * @param {...any} params Any number of parameters.
260
159
  * @return {any} Returns the first non-false element of the parameter.
261
160
  */
262
- export declare function coalesce(...params: any[]): any;
161
+ export declare const coalesce: (...params: any[]) => any;
263
162
  /**
264
163
  * Returns boolean if the array contains the element strictly or non-strictly.
265
164
  * @example
266
- * {{!-- results in: true --}}
267
165
  * {{includes [1, 2, 3] 2}}
268
- *
269
- * {{!-- results in: false --}}
270
- * {{includes [1, 2, 3] '2'}}
271
- *
272
- * {{!-- results in: false --}}
273
- * {{includes [1, 2, 3] '2' true}}
274
- *
275
- * {{!-- results in: true --}}
276
- * {{includes [1, 2, 3] '2' false}}
277
- *
278
- * {{#if (includes [1, 2, 3] '2')}}
279
- * {{!-- Do something --}}
280
- * {{/if}}
281
- *
282
- * {{ifx (includes [1, 2, 3] '2') 'yes' 'no'}}
166
+ * {{includes [1, 2, 3] 2 true}}
167
+ * {{#if (includes [1, 2, 3] 2)}}...{{/if}}
168
+ * {{ifx (includes [1, 2, 3] 2) true false}}
283
169
  * @param {any[]} items The array.
284
170
  * @param {any} value The value to be checked for existence in the array.
285
171
  * @param {boolean} strict FALSE for non-strict checking. TRUE by default.
286
172
  * @return {boolean} Returns true if the array contains the specified value, false otherwise.
287
173
  */
288
- export declare function includes(items: any[], value: any, strict?: boolean): boolean;
174
+ export declare const includes: (items: any[], value: any, strict?: boolean) => boolean;
289
175
  /**
290
176
  * Returns true if the given str matches the given regex.
291
177
  * @example
292
- * {{!-- results in: true --}}
293
- * {{regexMatch 'foobar' 'foo'}}
294
- *
295
- * {{!-- results in: false --}}
296
- * {{regexMatch 'bar' 'foo'}}
297
- *
298
- * {{!-- results in: false --}}
299
- * {{regexMatch 'foobar' '^foo$'}}
300
- *
301
- * {{!-- results in: true --}}
302
- * {{regexMatch 'Visit Here' 'here' 'i'}}
303
- *
304
- * {{!-- results in: false --}}
305
- * {{regexMatch 'Visit Here' 'here'}}
306
- *
307
- * {{!-- results in: Match --}}
308
- * {{#if (regexMatch 'foobar' 'foo')}}
309
- * Match
310
- * {{/if}}
178
+ * {{regexMatch 'Hello, world!' 'Hello'}}
179
+ * {{regexMatch 'Hello, world!' 'Hello' 'i'}}
180
+ * {{#if (regexMatch 'Hello, world!' 'Hello')}}...{{/if}}
311
181
  * @param {string} val The string against which to match the regular expression.
312
182
  * @param {string} pattern The text of the regular expression.
313
183
  * @param {string} flags? Regular expression flags, such as global and case-insensitive searches. The default is none (undefined).
314
184
  * @return {boolean} true if there is a match between the regular expression and the string str. Otherwise, false.
315
185
  */
316
- export declare function regexMatch(val: string, pattern: string, flags?: string): boolean;
186
+ export declare const regexMatch: (val: string, pattern: string, flags?: string) => boolean;
@@ -14,4 +14,4 @@
14
14
  * @param {string|string[]} locale Language or language-country locale string (or array of strings) available in https://github.com/moment/moment/tree/develop/locale .
15
15
  * @return {string} Returns formatted date.
16
16
  */
17
- export declare function formatDate(format: string, date: string, locale: string | string[]): string;
17
+ export declare const formatDate: (format: string, date: string, locale: string | string[]) => string;
@@ -7,4 +7,4 @@
7
7
  * @param {string} baseUrl Application Origin URL. The default is none (undefined).
8
8
  * @return {string} Returns the Assets file path with the update date and time parameters.
9
9
  */
10
- export declare function cacheBusting(filePath: string, baseUrl?: string): string;
10
+ export declare const cacheBusting: (filePath: string, baseUrl?: string) => string;
@@ -5,3 +5,4 @@ export * as comparison from '~/handlebars_helpers/comparison';
5
5
  export * as date from '~/handlebars_helpers/date';
6
6
  export * as number from '~/handlebars_helpers/number';
7
7
  export * as math from '~/handlebars_helpers/math';
8
+ export * as layouts from '~/handlebars_helpers/layouts';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Declare block race holders in layout.
3
+ * Imported from {@link https://github.com/TryGhost/express-hbs|express-hbs}
4
+ * @example
5
+ * {{{block "pageScripts"}}}
6
+ * @param {string} name Block Name.
7
+ * @param {Handlebars.HelperOptions} options Helper Options.
8
+ * @return {string} String.
9
+ */
10
+ export declare const block: (this: any, name: string, options: Handlebars.HelperOptions) => any;
11
+ /**
12
+ * Define block content within a page.
13
+ * Imported from {@link https://github.com/TryGhost/express-hbs|express-hbs}
14
+ * @example
15
+ * {{#contentFor "pageScripts"}}
16
+ * CONTENT HERE
17
+ * {{/contentFor}}
18
+ * @param {string} name Block Name.
19
+ * @param {Handlebars.HelperOptions} options Helper Options.
20
+ */
21
+ export declare const contentFor: (this: any, name: string, options: any) => void;
@@ -1,67 +1,60 @@
1
1
  /**
2
2
  * Calculates the sum of two numbers.
3
3
  * @example
4
- * {{!-- results in: 3 --}}
5
4
  * {{add 1 2}}
6
5
  * @param {number|string} val1 The first number.
7
6
  * @param {number|string} val2 The second number.
8
7
  * @return {number}
9
8
  */
10
- export declare function add(val1: number | string, val2: number | string): number;
9
+ export declare const add: (val1: number | string, val2: number | string) => number;
11
10
  /**
12
11
  * Calculates the difference of the given values.
13
12
  * @example
14
- * {{!-- results in: 3 --}}
15
13
  * {{sub 5 2}}
16
14
  * @param {number|string} val1 The first number.
17
15
  * @param {number|string} val2 The second number.
18
16
  * @return {number}
19
17
  */
20
- export declare function sub(val1: number | string, val2: number | string): number;
18
+ export declare const sub: (val1: number | string, val2: number | string) => number;
21
19
  /**
22
20
  * Calculate the multiplication of the given values.
23
21
  * @example
24
- * {{!-- results in: 10 --}}
25
22
  * {{multiply 5 2}}
26
23
  * @param {number|string} val1 The first number.
27
24
  * @param {number|string} val2 The second number.
28
25
  * @return {number}
29
26
  */
30
- export declare function multiply(val1: number | string, val2: number | string): number;
27
+ export declare const multiply: (val1: number | string, val2: number | string) => number;
31
28
  /**
32
29
  * Compute the division of the given values.
33
30
  * @example
34
- * {{!-- results in: 5 --}}
35
31
  * {{divide 10 2}}
36
32
  * @param {number|string} val1 The first number.
37
33
  * @param {number|string} val2 The second number.
38
34
  * @return {number}
39
35
  */
40
- export declare function divide(val1: number | string, val2: number | string): number;
36
+ export declare const divide: (val1: number | string, val2: number | string) => number;
41
37
  /**
42
38
  * Round up the value.
43
39
  * @example
44
- * {{!-- results in: 6 --}}
45
40
  * {{ceil 5.6}}
46
41
  * @param {number|string} val Number to be rounded to nearest greater integer.
47
42
  * @return {number}
48
43
  */
49
- export declare function ceil(val: number | string): number;
44
+ export declare const ceil: (val: number | string) => number;
50
45
  /**
51
46
  * Rounds down a number.
52
47
  * @example
53
- * {{!-- results in: 5 --}}
54
48
  * {{floor 5.6}}
55
49
  * @param {number|string} val Number to be rounded to nearest lower integer.
56
50
  * @return {number}
57
51
  */
58
- export declare function floor(val: number | string): number;
52
+ export declare const floor: (val: number | string) => number;
59
53
  /**
60
54
  * Returns an absolute value.
61
55
  * @example
62
- * {{!-- results in: 5.6 --}}
63
56
  * {{abs -5.6}}
64
57
  * @param {number} val Number to perform absolute value operation on.
65
58
  * @return {number}
66
59
  */
67
- export declare function abs(val: number | string): number;
60
+ export declare const abs: (val: number | string) => number;
@@ -13,4 +13,4 @@
13
13
  * In implementations without Intl.NumberFormat support, this parameter is ignored and the host's locale is usually used.
14
14
  * @return {string} A string with a language-sensitive representation of the given number.
15
15
  */
16
- export declare function number2locale(val: number | string, locales?: string): string;
16
+ export declare const number2locale: (val: number | string, locales?: string) => string;
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * Stringify an object using JSON.stringify.
3
3
  * @example
4
- * {{jsonStringify value}}
4
+ * {{jsonStringify val}}
5
5
  * @param {any} value The value to convert to a JSON string.
6
6
  * @param {number} indent The number of space characters to use as whitespace.
7
7
  * @return {string} A JSON string representing the given value, or undefined.
8
8
  */
9
- export declare function jsonStringify(value: any, indent?: number | string): string | undefined;
9
+ export declare const jsonStringify: (value: any, indent?: number | string) => string | undefined;
10
10
  /**
11
11
  * Parses the given string using JSON.parse.
12
12
  * @example
13
- * {{jsonParse value}}
13
+ * {{jsonParse val}}
14
14
  * @param {any} value Object to stringify.
15
15
  * @return {any} JavaScript value or object described by a string.
16
16
  */
17
- export declare function jsonParse(value: any): any;
17
+ export declare const jsonParse: (value: any) => any;
@@ -7,22 +7,17 @@
7
7
  * @param {string} replace The string to replace.
8
8
  * @return {string} Character string after replacement.
9
9
  */
10
- export declare function replace(value: string, find: string, replace: string): string;
10
+ export declare const replace: (value: string, find: string, replace: string) => string;
11
11
  /**
12
12
  * Split `string` by the given `character`.
13
13
  * @example
14
- * {{!-- results in: ['a', 'b', 'c'] --}}
15
14
  * {{split "a,b,c" ","}}
16
- *
17
- * {{!-- results in: <div>a</div><div>b</div><div>c</div> --}}
18
- * {{#each (split list ',')}}
19
- * <div>{{this}}</div>
20
- * {{/each}}
15
+ * {{#each (split list ',')}}<div>{{this}}</div>{{/each}}
21
16
  * @param {string} value String.
22
17
  * @param {string} separator A character that delimits the substrings in this string. Default is a comma.
23
18
  * @return {string[]} An Array of strings, split at each point where the separator occurs in the given string. The default is a comma.
24
19
  */
25
- export declare function split(value: string, separator: string): string[];
20
+ export declare const split: (value: string, separator: string) => string[];
26
21
  /**
27
22
  * Convert bytes to just the right units(KB, MB, GB, TB, PB, EB, ZB, YB).
28
23
  * @example
@@ -41,4 +36,4 @@ export declare function split(value: string, separator: string): string[];
41
36
  * @param {number} decimals Number of decimal places to display. Default is 0.
42
37
  * @return {string} Returns a value with units.
43
38
  */
44
- export declare function formatBytes(bytes: number, decimals?: number): string;
39
+ export declare const formatBytes: (bytes: number, decimals?: number) => string;
package/types/index.d.ts CHANGED
@@ -3,5 +3,4 @@ export * as database from '~/database';
3
3
  export * as services from '~/services';
4
4
  export * as utils from '~/utils';
5
5
  export * as middlewares from '~/middlewares';
6
- export * as exceptions from '~/exceptions';
7
6
  export * as interfaces from '~/interfaces';
@@ -1,4 +1,3 @@
1
- /// <reference types="cookie-parser" />
2
1
  import express from 'express';
3
2
  /**
4
3
  * User authentication configuration interface.
@@ -57,7 +56,6 @@ export default interface AuthenticationConfig {
57
56
  success_redirect: string;
58
57
  /**
59
58
  * URL to redirect after log off, defaults to `/login`.
60
- *
61
59
  * @example
62
60
  * // Set the URL to redirect to in case of login failure as a string.
63
61
  * failure_redirect: '/login',
@@ -75,9 +73,7 @@ export default interface AuthenticationConfig {
75
73
  * This hook is called when authenticating a user.
76
74
  * Please find the user information that owns the credentials based on the user name and password you received and return it.
77
75
  * If the user who owns the credentials cannot be found, return null.
78
- *
79
76
  * Note that the user information must include an ID value that can identify the user.
80
- *
81
77
  * @example
82
78
  * authenticate_user: async (username, password, req) => {
83
79
  * const UserModel = require('../models/UserModel');
@@ -99,7 +95,6 @@ export default interface AuthenticationConfig {
99
95
  * This hook is called when user authentication is successful.
100
96
  * Please search and return the authenticated user information to be set in the session based on the user ID of the parameter.
101
97
  * The returned data will be set in the req.user property and the view's session variable.
102
- *
103
98
  * @example
104
99
  * subscribe_user: async (id) => {
105
100
  * const UserModel = require('../models/UserModel');
@@ -1,7 +1,6 @@
1
- /// <reference types="cookie-parser" />
2
1
  import express from 'express';
3
2
  /**
4
- * Express Sweet basic configuration interface.
3
+ * EXPRESS SWEET basic configuration interface.
5
4
  */
6
5
  export default interface BasicConfig {
7
6
  /**
@@ -33,7 +32,6 @@ export default interface BasicConfig {
33
32
  * This is a hook that rewrites the base URL.
34
33
  * 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.
35
34
  * The default value is the referrer's origin (eg https://example.com).
36
- *
37
35
  * @example
38
36
  * rewrite_base_url: baseUrl => {
39
37
  * return `${baseUrl}/admin`;
@@ -46,7 +44,6 @@ export default interface BasicConfig {
46
44
  * How to determine if it is an ajax request.
47
45
  * The default is that if there is an XMLHttpRequest in the request header (req.xhr) returns true.
48
46
  * For example, if there is no XMLHttpRequest in req(express.Request) and the Ajax endpoint starts with /api, a custom Ajax decision can be made like "return /^\/api\//.test(req.path)".
49
- *
50
47
  * @type {(req: express.Request) => boolean}
51
48
  * @example
52
49
  * is_ajax: req => {
@@ -59,7 +56,6 @@ export default interface BasicConfig {
59
56
  /**
60
57
  * Hooks the default behavior on request errors.
61
58
  * If unset, simply returns an error HTTP status. (<code>res.status(err.status||500).end();</code>)
62
- *
63
59
  * @type {(err: any, req: express.Request, res: express.Response, next: express.NextFunction) => void}
64
60
  * @example
65
61
  * hook_handle_error: (err, req, res, next) => {
@@ -1,4 +1,3 @@
1
- /// <reference types="cookie-parser" />
2
1
  import express from 'express';
3
2
  /**
4
3
  * View's configuration interface.
@@ -32,7 +31,6 @@ export default interface SesOptions {
32
31
  /**
33
32
  * Hook function just before the view is rendered.
34
33
  * For example, you can set your own local variables that can be used within the view.
35
- *
36
34
  * @example
37
35
  * // The message set here can be referenced in the view as {{message}}.
38
36
  * beforeRender: (req, res) => {
@@ -8,6 +8,8 @@ export default class {
8
8
  #private;
9
9
  /**
10
10
  * Mount on application.
11
+ * @param {express.Express} app Express application instance.
12
+ * @return {Promise<void>}
11
13
  */
12
- static mount(app: express.Express): undefined;
14
+ static mount(app: express.Express): Promise<void>;
13
15
  }
@@ -5,6 +5,8 @@ import express from 'express';
5
5
  export default class {
6
6
  /**
7
7
  * Mount on application.
8
+ * @param {express.Express} app Express application instance.
9
+ * @return {Promise<void>}
8
10
  */
9
- static mount(app: express.Express): void;
11
+ static mount(app: express.Express): Promise<void>;
10
12
  }