5htp-core 0.3.6-2 → 0.3.6-4
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5htp-core",
|
|
3
3
|
"description": "Convenient TypeScript framework designed for Performance and Productivity.",
|
|
4
|
-
"version": "0.3.6-
|
|
4
|
+
"version": "0.3.6-4",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -11,6 +11,9 @@ import type { Schema } from '@common/validation';
|
|
|
11
11
|
import type { TValidationResult } from '@common/validation/schema';
|
|
12
12
|
import useContext from '@/client/context';
|
|
13
13
|
|
|
14
|
+
// Exports
|
|
15
|
+
export type { TValidationResult, TSchemaData } from '@common/validation/schema';
|
|
16
|
+
|
|
14
17
|
/*----------------------------------
|
|
15
18
|
- TYPES
|
|
16
19
|
----------------------------------*/
|
|
@@ -23,7 +26,7 @@ type TFormOptions<TFormData extends {}> = {
|
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
type FieldsAttrs<TFormData extends {}> = {
|
|
29
|
+
export type FieldsAttrs<TFormData extends {}> = {
|
|
27
30
|
[fieldName in keyof TFormData]: {}
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -33,6 +33,9 @@ export type TValidationResult<TFields extends TSchemaFields> = {
|
|
|
33
33
|
erreurs: TListeErreursSaisie
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export type TSchemaData<TSchema extends Schema<{}>> =
|
|
37
|
+
TValidationResult<TSchema["fields"]>
|
|
38
|
+
|
|
36
39
|
export type TValidatedData<TFields extends TSchemaFields> = {
|
|
37
40
|
// For each field, the values returned by validator.validate()
|
|
38
41
|
[name in keyof TFields]: ReturnType<TFields[name]["validate"]>
|
|
@@ -176,15 +176,13 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
|
|
|
176
176
|
// TODO: do it via datatypes.ts
|
|
177
177
|
if (typeof data === 'object' && data !== null) {
|
|
178
178
|
|
|
179
|
+
// Object: stringify in JSON
|
|
179
180
|
if (data.constructor.name === "Object")
|
|
180
181
|
data = safeStringify(data);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (Array.isArray( data )) {
|
|
186
|
-
data = data.join(', ')
|
|
187
|
-
}
|
|
182
|
+
// Array: if for storage, reparate items with a comma
|
|
183
|
+
else if (forStorage && Array.isArray( data )) {
|
|
184
|
+
data = data.join(',')
|
|
185
|
+
}
|
|
188
186
|
}
|
|
189
187
|
|
|
190
188
|
return mysql.escape(data);
|
|
@@ -535,7 +533,7 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
|
|
|
535
533
|
const { '*': updateAll, ...customValuesToUpdate } = colsToUpdate;
|
|
536
534
|
|
|
537
535
|
for (const colKey in customValuesToUpdate)
|
|
538
|
-
valuesToUpdate[ colKey ] = this.esc(customValuesToUpdate[ colKey ]);
|
|
536
|
+
valuesToUpdate[ colKey ] = this.esc(customValuesToUpdate[ colKey ], true);
|
|
539
537
|
|
|
540
538
|
if (updateAll)
|
|
541
539
|
valuesNamesToUpdate = Object.keys(table.colonnes);//table.columnNamesButPk;
|