@vitnode/core 1.2.0-canary.48 → 1.2.0-canary.49
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/dist/scripts/plugin.d.ts.map +1 -1
- package/dist/scripts/prepare-database.d.ts.map +1 -1
- package/dist/scripts/prepare-plugins-files.d.ts +1 -1
- package/dist/scripts/prepare-plugins-files.d.ts.map +1 -1
- package/dist/scripts/scripts.js +4 -4
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +3 -1
- package/dist/src/api/lib/check-plugin-id.d.ts.map +1 -1
- package/dist/src/api/lib/check-plugin-id.js +2 -0
- package/dist/src/api/lib/with-pagination.d.ts +2 -24
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.d.ts +7 -1
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +6 -2
- package/dist/src/api/models/email.d.ts +3 -1
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +25 -2
- package/dist/src/api/modules/admin/admin.module.d.ts +41 -288
- package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +23 -131
- package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts.map +1 -1
- package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +23 -131
- package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts.map +1 -1
- package/dist/src/api/modules/admin/routes/session.route.d.ts +2 -52
- package/dist/src/api/modules/admin/routes/session.route.d.ts.map +1 -1
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts +16 -105
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts.map +1 -1
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +18 -105
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts.map +1 -1
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts +16 -105
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts.map +1 -1
- package/dist/src/api/modules/middleware/middleware.module.d.ts +7 -36
- package/dist/src/api/modules/middleware/middleware.module.d.ts.map +1 -1
- package/dist/src/api/modules/middleware/route.d.ts +14 -72
- package/dist/src/api/modules/middleware/route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/session.route.d.ts +2 -54
- package/dist/src/api/modules/users/routes/session.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts +5 -27
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-in.route.js +1 -1
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts +1 -5
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +8 -36
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +2 -2
- package/dist/src/api/modules/users/routes/test.route.js +1 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +3 -19
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +2 -10
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/sso.module.d.ts +5 -29
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +16 -128
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.d.ts +28 -6
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +46 -12
- package/dist/src/components/form/fields/checkbox.d.ts +3 -7
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/checkbox.js +5 -4
- package/dist/src/components/form/fields/combobox-async.d.ts +3 -6
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +4 -4
- package/dist/src/components/form/fields/combobox.d.ts +3 -6
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +4 -5
- package/dist/src/components/form/fields/input.d.ts +3 -8
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +8 -4
- package/dist/src/components/form/fields/radio-group.d.ts +3 -6
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +4 -5
- package/dist/src/components/form/fields/select.d.ts +3 -6
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +4 -5
- package/dist/src/components/form/fields/switch.d.ts +2 -6
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/switch.js +9 -9
- package/dist/src/components/form/fields/textarea.d.ts +3 -4
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +5 -3
- package/dist/src/components/ui/button-client.d.ts +3 -0
- package/dist/src/components/ui/button-client.d.ts.map +1 -0
- package/dist/src/components/ui/button-client.js +57 -0
- package/dist/src/components/ui/button.d.ts +2 -3
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +5 -39
- package/dist/src/components/ui/form.d.ts +2 -2
- package/dist/src/components/ui/form.d.ts.map +1 -1
- package/dist/src/components/ui/form.js +2 -2
- package/dist/src/components/ui/loader.js +1 -1
- package/dist/src/emails/default-template.d.ts +5 -1
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +10 -11
- package/dist/src/lib/api/get-middleware-api.d.ts +1 -1
- package/dist/src/lib/api/get-session-admin-api.d.ts +2 -2
- package/dist/src/lib/api/get-session-api.d.ts +2 -2
- package/dist/src/lib/helpers/auto-form.d.ts +18 -8
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +90 -86
- package/dist/src/lib/helpers/auto-form.test.js +299 -138
- package/dist/src/lib/navigation.d.ts +5 -5
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +9 -9
- package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.d.ts +10 -10
- package/dist/src/views/admin/views/core/test.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/test.js +6 -6
- package/dist/src/views/auth/components/password-input.d.ts +2 -1
- package/dist/src/views/auth/components/password-input.d.ts.map +1 -1
- package/dist/src/views/auth/components/password-input.js +15 -8
- package/dist/src/views/auth/sign-in/form/use-form.d.ts +4 -16
- package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/use-form.js +1 -1
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +22 -9
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +18 -36
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.js +10 -7
- package/dist/src/vitnode.config.d.ts +3 -0
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -18
- package/dist/src/components/form/fields/item.d.ts +0 -14
- package/dist/src/components/form/fields/item.d.ts.map +0 -1
- package/dist/src/components/form/fields/item.js +0 -22
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const getSessionApi: () => Promise<{
|
|
2
2
|
user: {
|
|
3
|
-
email: string;
|
|
4
3
|
id: number;
|
|
4
|
+
email: string;
|
|
5
5
|
name: string;
|
|
6
|
-
createdAt: Date;
|
|
7
6
|
nameCode: string;
|
|
7
|
+
createdAt: Date;
|
|
8
8
|
newsletter: boolean;
|
|
9
9
|
avatarColor: string;
|
|
10
10
|
emailVerified: boolean;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import type { DefaultValues } from 'react-hook-form';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export declare
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
export declare function getDefaults<T extends z.ZodType>(jsonSchema?: z.core.JSONSchema.JSONSchema): DefaultValues<z.input<T>>;
|
|
4
|
+
export interface InputParams {
|
|
5
|
+
[key: string]: InputParams | {
|
|
6
|
+
description?: string;
|
|
7
|
+
enum?: string[];
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minLength?: number;
|
|
10
|
+
pattern?: string;
|
|
11
|
+
patterns?: string[];
|
|
12
|
+
required?: boolean;
|
|
13
|
+
type?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function getZodInputParams(jsonSchema?: z.core.JSONSchema.JSONSchema, parentRequired?: string[]): InputParams;
|
|
17
|
+
type NestedParamValue = InputParams[string] | undefined;
|
|
18
|
+
export declare function getNestedParam(obj: InputParams, path: string): NestedParamValue;
|
|
19
|
+
export {};
|
|
10
20
|
//# sourceMappingURL=auto-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-form.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/auto-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-form.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/auto-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAC7C,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,GACxC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CA6B3B;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GACR,WAAW,GACX;QACE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACP;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EACzC,cAAc,GAAE,MAAM,EAAO,GAC5B,WAAW,CA0Eb;AAED,KAAK,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAExD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,GACX,gBAAgB,CAkBlB"}
|
|
@@ -1,94 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return schema._def.schema.shape[id];
|
|
1
|
+
export function getDefaults(jsonSchema) {
|
|
2
|
+
if (!jsonSchema?.properties) {
|
|
3
|
+
return {};
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if ('schema' in schema._def) {
|
|
25
|
-
return getBaseSchema(schema._def.schema, isArray);
|
|
26
|
-
}
|
|
27
|
-
if ('type' in schema._def && isArray) {
|
|
28
|
-
return getBaseSchema(schema._def.type, isArray);
|
|
5
|
+
const defaultValues = {};
|
|
6
|
+
// Iterate over each property in the schema
|
|
7
|
+
for(const key in jsonSchema.properties){
|
|
8
|
+
const prop = jsonSchema.properties[key];
|
|
9
|
+
// Case 1: The property has a 'default' key.
|
|
10
|
+
if (prop.default !== undefined) {
|
|
11
|
+
defaultValues[key] = prop.default;
|
|
12
|
+
continue; // Move to the next property
|
|
13
|
+
}
|
|
14
|
+
// Case 2: The property is a nested object. Recurse into it.
|
|
15
|
+
if (prop.type === 'object' && prop.properties) {
|
|
16
|
+
const nestedDefaults = getDefaults(prop);
|
|
17
|
+
// Only add the nested object if it contains default values.
|
|
18
|
+
if (Object.keys(nestedDefaults).length > 0) {
|
|
19
|
+
defaultValues[key] = nestedDefaults;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
29
22
|
}
|
|
30
|
-
return
|
|
23
|
+
return defaultValues;
|
|
31
24
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const baseSchema = getBaseSchema(schema);
|
|
37
|
-
return baseSchema ? baseSchema._def.typeName : '';
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Search for a "ZodDefault" in the Zod stack and return its value.
|
|
41
|
-
*/ export function getDefaultValueInZodStack(schema) {
|
|
42
|
-
// Check if this is a ZodDefault and return its value
|
|
43
|
-
if (schema._def.typeName === z.ZodFirstPartyTypeKind.ZodDefault) {
|
|
44
|
-
const defaultValue = schema._def.defaultValue();
|
|
45
|
-
// If defaultValue is a function, call it to get the actual value
|
|
46
|
-
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
47
|
-
}
|
|
48
|
-
// Traverse through ZodEffects (like refinements) - check this first as it wraps the actual schema
|
|
49
|
-
if (schema._def.typeName === z.ZodFirstPartyTypeKind.ZodEffects) {
|
|
50
|
-
return getDefaultValueInZodStack(schema._def.schema);
|
|
51
|
-
}
|
|
52
|
-
// Traverse through other types that have schema property
|
|
53
|
-
if ('schema' in schema._def) {
|
|
54
|
-
return getDefaultValueInZodStack(schema._def.schema);
|
|
25
|
+
export function getZodInputParams(jsonSchema, parentRequired = []) {
|
|
26
|
+
// Base case: If there's no schema or properties, return an empty object.
|
|
27
|
+
if (!jsonSchema?.properties) {
|
|
28
|
+
return {};
|
|
55
29
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
30
|
+
const extractedParams = {};
|
|
31
|
+
const requiredFields = new Set(jsonSchema.required ?? parentRequired);
|
|
32
|
+
// Iterate over each property in the current schema level.
|
|
33
|
+
for(const key in jsonSchema.properties){
|
|
34
|
+
const prop = jsonSchema.properties[key];
|
|
35
|
+
const fieldParams = {};
|
|
36
|
+
// 1. Handle 'required' status
|
|
37
|
+
if (requiredFields.has(key)) {
|
|
38
|
+
fieldParams.required = true;
|
|
39
|
+
}
|
|
40
|
+
// 2. Handle standard string constraints
|
|
41
|
+
if (prop.minLength !== undefined) {
|
|
42
|
+
fieldParams.minLength = prop.minLength;
|
|
43
|
+
}
|
|
44
|
+
if (prop.maxLength !== undefined) {
|
|
45
|
+
fieldParams.maxLength = prop.maxLength;
|
|
46
|
+
}
|
|
47
|
+
if (prop.pattern !== undefined) {
|
|
48
|
+
fieldParams.pattern = prop.pattern;
|
|
49
|
+
}
|
|
50
|
+
if (prop.enum) {
|
|
51
|
+
fieldParams.enum = prop.enum;
|
|
52
|
+
}
|
|
53
|
+
// 3. Handle complex patterns from `allOf` (used for password)
|
|
54
|
+
if (prop.allOf) {
|
|
55
|
+
fieldParams.patterns = prop.allOf.map((p)=>p.pattern).filter(Boolean); // Filter out any undefined patterns
|
|
56
|
+
}
|
|
57
|
+
if (prop.description) {
|
|
58
|
+
fieldParams.description = prop.description;
|
|
59
|
+
}
|
|
60
|
+
// 4. Determine the input type based on schema type and format
|
|
61
|
+
switch(prop.type){
|
|
62
|
+
case 'boolean':
|
|
63
|
+
fieldParams.type = 'checkbox';
|
|
64
|
+
break;
|
|
65
|
+
case 'integer':
|
|
66
|
+
case 'number':
|
|
67
|
+
fieldParams.type = 'number';
|
|
68
|
+
break;
|
|
69
|
+
case 'string':
|
|
70
|
+
// Check format for special string types
|
|
71
|
+
if (prop.format === 'email') {
|
|
72
|
+
fieldParams.type = 'email';
|
|
73
|
+
} else if (key.toLowerCase().includes('password')) {
|
|
74
|
+
// Infer password type by key name for better UX
|
|
75
|
+
fieldParams.type = 'password';
|
|
76
|
+
} else {
|
|
77
|
+
fieldParams.type = 'text';
|
|
89
78
|
}
|
|
90
|
-
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
// 5. Handle nested objects by making a recursive call
|
|
82
|
+
if (prop.type === 'object') {
|
|
83
|
+
// Pass the 'required' array from the nested object itself.
|
|
84
|
+
extractedParams[key] = getZodInputParams(prop, prop.required);
|
|
85
|
+
} else {
|
|
86
|
+
extractedParams[key] = fieldParams;
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
|
-
return
|
|
89
|
+
return extractedParams;
|
|
90
|
+
}
|
|
91
|
+
export function getNestedParam(obj, path) {
|
|
92
|
+
return path.split('.').reduce((acc, key)=>{
|
|
93
|
+
if (acc && typeof acc === 'object' && !Array.isArray(acc) && key in acc) {
|
|
94
|
+
return acc[key];
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
}, obj);
|
|
94
98
|
}
|