@vitnode/core 1.2.0-canary.47 → 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,175 +1,336 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaults, getNestedParam, getZodInputParams } from "./auto-form.js";
|
|
4
4
|
describe('auto-form helpers', ()=>{
|
|
5
|
-
describe('
|
|
6
|
-
it('should
|
|
7
|
-
|
|
8
|
-
name: z.string(),
|
|
9
|
-
age: z.number()
|
|
10
|
-
});
|
|
11
|
-
const shape = getShapeFromSchema(schema, 'name');
|
|
12
|
-
expect(shape?._def.typeName).toBe('ZodString');
|
|
5
|
+
describe('getDefaults', ()=>{
|
|
6
|
+
it('should return empty object when no schema provided', ()=>{
|
|
7
|
+
expect(getDefaults()).toEqual({});
|
|
13
8
|
});
|
|
14
|
-
it('should
|
|
15
|
-
const schema =
|
|
16
|
-
|
|
17
|
-
age: z.number()
|
|
18
|
-
}).refine(()=>true);
|
|
19
|
-
const shape = getShapeFromSchema(schema, 'name');
|
|
20
|
-
expect(shape?._def.typeName).toBe('ZodString');
|
|
9
|
+
it('should return empty object when schema has no properties', ()=>{
|
|
10
|
+
const schema = {};
|
|
11
|
+
expect(getDefaults(schema)).toEqual({});
|
|
21
12
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
it('should extract default values from simple Zod schema', ()=>{
|
|
14
|
+
const zodSchema = z.object({
|
|
15
|
+
name: z.string().default('John Doe'),
|
|
16
|
+
age: z.number().default(25),
|
|
17
|
+
active: z.boolean().default(true)
|
|
18
|
+
});
|
|
19
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
20
|
+
const result = getDefaults(jsonSchema);
|
|
21
|
+
expect(result).toEqual({
|
|
22
|
+
name: 'John Doe',
|
|
23
|
+
age: 25,
|
|
24
|
+
active: true
|
|
27
25
|
});
|
|
28
|
-
const result = getObjectFormSchema(schema);
|
|
29
|
-
expect(result).toBe(schema);
|
|
30
26
|
});
|
|
31
|
-
it('should
|
|
32
|
-
const
|
|
33
|
-
|
|
27
|
+
it('should handle nested Zod objects with defaults', ()=>{
|
|
28
|
+
const zodSchema = z.object({
|
|
29
|
+
user: z.object({
|
|
30
|
+
name: z.string().default('Jane'),
|
|
31
|
+
settings: z.object({
|
|
32
|
+
theme: z.string().default('dark'),
|
|
33
|
+
notifications: z.boolean().default(false)
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
title: z.string().default('Hello')
|
|
37
|
+
});
|
|
38
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
39
|
+
const result = getDefaults(jsonSchema);
|
|
40
|
+
expect(result).toEqual({
|
|
41
|
+
user: {
|
|
42
|
+
name: 'Jane',
|
|
43
|
+
settings: {
|
|
44
|
+
theme: 'dark',
|
|
45
|
+
notifications: false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
title: 'Hello'
|
|
34
49
|
});
|
|
35
|
-
const schema = innerSchema.refine(()=>true);
|
|
36
|
-
const result = getObjectFormSchema(schema);
|
|
37
|
-
expect(result).toBe(innerSchema);
|
|
38
50
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
const result =
|
|
49
|
-
expect(result
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
it('should skip nested objects with no default values', ()=>{
|
|
52
|
+
const zodSchema = z.object({
|
|
53
|
+
user: z.object({
|
|
54
|
+
name: z.string(),
|
|
55
|
+
email: z.string()
|
|
56
|
+
}),
|
|
57
|
+
title: z.string().default('Hello')
|
|
58
|
+
});
|
|
59
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
60
|
+
const result = getDefaults(jsonSchema);
|
|
61
|
+
expect(result).toEqual({
|
|
62
|
+
title: 'Hello'
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('should handle mixed properties with and without defaults', ()=>{
|
|
66
|
+
const zodSchema = z.object({
|
|
67
|
+
name: z.string().default('Test'),
|
|
68
|
+
email: z.string(),
|
|
69
|
+
age: z.number().default(30),
|
|
70
|
+
bio: z.string()
|
|
71
|
+
});
|
|
72
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
73
|
+
const result = getDefaults(jsonSchema);
|
|
74
|
+
expect(result).toEqual({
|
|
75
|
+
name: 'Test',
|
|
76
|
+
age: 30
|
|
77
|
+
});
|
|
55
78
|
});
|
|
56
79
|
});
|
|
57
|
-
describe('
|
|
58
|
-
it('should return
|
|
59
|
-
|
|
60
|
-
expect(getBaseType(schema)).toBe('ZodString');
|
|
80
|
+
describe('getZodInputParams', ()=>{
|
|
81
|
+
it('should return empty object when no schema provided', ()=>{
|
|
82
|
+
expect(getZodInputParams()).toEqual({});
|
|
61
83
|
});
|
|
62
|
-
it('should return
|
|
63
|
-
const schema =
|
|
64
|
-
expect(
|
|
84
|
+
it('should return empty object when schema has no properties', ()=>{
|
|
85
|
+
const schema = {};
|
|
86
|
+
expect(getZodInputParams(schema)).toEqual({});
|
|
65
87
|
});
|
|
66
|
-
it('should
|
|
67
|
-
const
|
|
68
|
-
|
|
88
|
+
it('should extract basic string field parameters from Zod schema', ()=>{
|
|
89
|
+
const zodSchema = z.object({
|
|
90
|
+
name: z.string().min(2).max(50).regex(/^[a-zA-Z]+$/).describe('User name')
|
|
91
|
+
});
|
|
92
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
93
|
+
const result = getZodInputParams(jsonSchema, [
|
|
94
|
+
'name'
|
|
95
|
+
]);
|
|
96
|
+
expect(result).toEqual({
|
|
97
|
+
name: {
|
|
98
|
+
type: 'text',
|
|
99
|
+
minLength: 2,
|
|
100
|
+
maxLength: 50,
|
|
101
|
+
pattern: '^[a-zA-Z]+$',
|
|
102
|
+
description: 'User name',
|
|
103
|
+
required: true
|
|
104
|
+
}
|
|
105
|
+
});
|
|
69
106
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
107
|
+
it('should handle email format from Zod schema', ()=>{
|
|
108
|
+
const zodSchema = z.object({
|
|
109
|
+
email: z.email().describe('Email address')
|
|
110
|
+
});
|
|
111
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
112
|
+
const result = getZodInputParams(jsonSchema, [
|
|
113
|
+
'email'
|
|
114
|
+
]);
|
|
115
|
+
expect(result.email).toHaveProperty('type', 'email');
|
|
116
|
+
expect(result.email).toHaveProperty('description', 'Email address');
|
|
117
|
+
expect(result.email).toHaveProperty('required', true);
|
|
118
|
+
expect(result.email).toHaveProperty('pattern'); // Email pattern is generated
|
|
75
119
|
});
|
|
76
|
-
it('should
|
|
77
|
-
const
|
|
78
|
-
|
|
120
|
+
it('should infer password type from field name', ()=>{
|
|
121
|
+
const zodSchema = z.object({
|
|
122
|
+
password: z.string(),
|
|
123
|
+
confirmPassword: z.string(),
|
|
124
|
+
userPassword: z.string()
|
|
125
|
+
});
|
|
126
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
127
|
+
const result = getZodInputParams(jsonSchema);
|
|
128
|
+
expect(result.password).toHaveProperty('type', 'password');
|
|
129
|
+
expect(result.password).toHaveProperty('required', true);
|
|
130
|
+
expect(result.confirmPassword).toHaveProperty('type', 'password');
|
|
131
|
+
expect(result.confirmPassword).toHaveProperty('required', true);
|
|
132
|
+
expect(result.userPassword).toHaveProperty('type', 'password');
|
|
133
|
+
expect(result.userPassword).toHaveProperty('required', true);
|
|
79
134
|
});
|
|
80
|
-
it('should
|
|
81
|
-
const
|
|
82
|
-
|
|
135
|
+
it('should handle number and boolean types from Zod schema', ()=>{
|
|
136
|
+
const zodSchema = z.object({
|
|
137
|
+
age: z.number(),
|
|
138
|
+
count: z.number().int(),
|
|
139
|
+
active: z.boolean()
|
|
140
|
+
});
|
|
141
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
142
|
+
const result = getZodInputParams(jsonSchema);
|
|
143
|
+
expect(result.age).toHaveProperty('type', 'number');
|
|
144
|
+
expect(result.age).toHaveProperty('required', true);
|
|
145
|
+
expect(result.count).toHaveProperty('type', 'number');
|
|
146
|
+
expect(result.count).toHaveProperty('required', true);
|
|
147
|
+
expect(result.active).toHaveProperty('type', 'checkbox');
|
|
148
|
+
expect(result.active).toHaveProperty('required', true);
|
|
83
149
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
150
|
+
it('should handle enum values from Zod schema', ()=>{
|
|
151
|
+
const zodSchema = z.object({
|
|
152
|
+
role: z.enum([
|
|
153
|
+
'admin',
|
|
154
|
+
'user',
|
|
155
|
+
'guest'
|
|
156
|
+
])
|
|
90
157
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
158
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
159
|
+
const result = getZodInputParams(jsonSchema);
|
|
160
|
+
expect(result.role).toHaveProperty('type', 'text');
|
|
161
|
+
expect(result.role).toHaveProperty('enum', [
|
|
162
|
+
'admin',
|
|
163
|
+
'user',
|
|
164
|
+
'guest'
|
|
165
|
+
]);
|
|
166
|
+
expect(result.role).toHaveProperty('required', true);
|
|
167
|
+
});
|
|
168
|
+
it('should handle complex password validation', ()=>{
|
|
169
|
+
const zodSchema = z.object({
|
|
170
|
+
password: z.string().min(8).regex(/(?=.*[a-z])/, 'Must contain lowercase').regex(/(?=.*[A-Z])/, 'Must contain uppercase').regex(/(?=.*\d)/, 'Must contain number')
|
|
95
171
|
});
|
|
172
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
173
|
+
const result = getZodInputParams(jsonSchema);
|
|
174
|
+
expect(result.password).toHaveProperty('type', 'password');
|
|
175
|
+
expect(result.password).toHaveProperty('minLength', 8);
|
|
96
176
|
});
|
|
97
|
-
it('should
|
|
98
|
-
const
|
|
177
|
+
it('should handle nested objects from Zod schema', ()=>{
|
|
178
|
+
const zodSchema = z.object({
|
|
99
179
|
user: z.object({
|
|
100
|
-
name: z.string()
|
|
101
|
-
|
|
180
|
+
name: z.string(),
|
|
181
|
+
email: z.email()
|
|
182
|
+
}),
|
|
183
|
+
settings: z.object({
|
|
184
|
+
theme: z.enum([
|
|
185
|
+
'light',
|
|
186
|
+
'dark'
|
|
187
|
+
]),
|
|
188
|
+
notifications: z.boolean()
|
|
102
189
|
})
|
|
103
190
|
});
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
user
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
191
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
192
|
+
const result = getZodInputParams(jsonSchema, [
|
|
193
|
+
'user'
|
|
194
|
+
]);
|
|
195
|
+
expect(result.user).toHaveProperty('name');
|
|
196
|
+
expect(result.user).toHaveProperty('email');
|
|
197
|
+
expect(result.settings).toHaveProperty('theme');
|
|
198
|
+
expect(result.settings).toHaveProperty('notifications');
|
|
199
|
+
});
|
|
200
|
+
it('should handle required fields from Zod schema', ()=>{
|
|
201
|
+
const zodSchema = z.object({
|
|
202
|
+
name: z.string(),
|
|
203
|
+
email: z.string(),
|
|
204
|
+
age: z.number().optional()
|
|
110
205
|
});
|
|
206
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
207
|
+
const result = getZodInputParams(jsonSchema, [
|
|
208
|
+
'name',
|
|
209
|
+
'email'
|
|
210
|
+
]);
|
|
211
|
+
expect(result.name).toHaveProperty('required', true);
|
|
212
|
+
expect(result.email).toHaveProperty('required', true);
|
|
213
|
+
expect(result.age).not.toHaveProperty('required');
|
|
111
214
|
});
|
|
112
|
-
it('should handle
|
|
113
|
-
const
|
|
215
|
+
it('should handle optional fields from Zod schema', ()=>{
|
|
216
|
+
const zodSchema = z.object({
|
|
114
217
|
name: z.string(),
|
|
115
|
-
|
|
218
|
+
email: z.string().optional(),
|
|
219
|
+
age: z.number().optional()
|
|
116
220
|
});
|
|
117
|
-
const
|
|
118
|
-
|
|
221
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
222
|
+
const result = getZodInputParams(jsonSchema, [
|
|
223
|
+
'name'
|
|
224
|
+
]);
|
|
225
|
+
expect(result.name).toHaveProperty('required', true);
|
|
226
|
+
expect(result.email).not.toHaveProperty('required');
|
|
227
|
+
expect(result.age).not.toHaveProperty('required');
|
|
119
228
|
});
|
|
120
|
-
it('should handle
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const schema = z.object({
|
|
128
|
-
title: z.string().default('Default Title'),
|
|
129
|
-
categoryId: z.object({
|
|
130
|
-
value: z.string(),
|
|
131
|
-
label: z.string()
|
|
132
|
-
}).default(data?.category ? {
|
|
133
|
-
value: data.category.id.toString(),
|
|
134
|
-
label: data.category.title
|
|
135
|
-
} : {
|
|
136
|
-
value: '',
|
|
137
|
-
label: ''
|
|
138
|
-
})
|
|
229
|
+
it('should handle union types from Zod schema', ()=>{
|
|
230
|
+
const zodSchema = z.object({
|
|
231
|
+
status: z.union([
|
|
232
|
+
z.literal('active'),
|
|
233
|
+
z.literal('inactive')
|
|
234
|
+
]),
|
|
235
|
+
priority: z.number().or(z.string())
|
|
139
236
|
});
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
237
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
238
|
+
const result = getZodInputParams(jsonSchema);
|
|
239
|
+
expect(result).toHaveProperty('status');
|
|
240
|
+
expect(result).toHaveProperty('priority');
|
|
241
|
+
});
|
|
242
|
+
it('should handle array types from Zod schema', ()=>{
|
|
243
|
+
const zodSchema = z.object({
|
|
244
|
+
tags: z.array(z.string()),
|
|
245
|
+
numbers: z.array(z.number())
|
|
147
246
|
});
|
|
247
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
248
|
+
const result = getZodInputParams(jsonSchema);
|
|
249
|
+
expect(result).toHaveProperty('tags');
|
|
250
|
+
expect(result).toHaveProperty('numbers');
|
|
148
251
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
252
|
+
});
|
|
253
|
+
describe('getNestedParam', ()=>{
|
|
254
|
+
const testObj = {
|
|
255
|
+
user: {
|
|
256
|
+
name: {
|
|
257
|
+
type: 'text',
|
|
258
|
+
required: true
|
|
259
|
+
},
|
|
260
|
+
email: {
|
|
261
|
+
type: 'email'
|
|
262
|
+
},
|
|
263
|
+
settings: {
|
|
264
|
+
theme: {
|
|
265
|
+
type: 'text',
|
|
266
|
+
enum: [
|
|
267
|
+
'light',
|
|
268
|
+
'dark'
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
notifications: {
|
|
272
|
+
type: 'checkbox'
|
|
273
|
+
}
|
|
166
274
|
}
|
|
275
|
+
},
|
|
276
|
+
title: {
|
|
277
|
+
type: 'text',
|
|
278
|
+
default: 'Hello'
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
it('should get top-level properties', ()=>{
|
|
282
|
+
const result = getNestedParam(testObj, 'title');
|
|
283
|
+
expect(result).toEqual({
|
|
284
|
+
type: 'text',
|
|
285
|
+
default: 'Hello'
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
it('should get nested properties', ()=>{
|
|
289
|
+
const result = getNestedParam(testObj, 'user.name');
|
|
290
|
+
expect(result).toEqual({
|
|
291
|
+
type: 'text',
|
|
292
|
+
required: true
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
it('should get deeply nested properties', ()=>{
|
|
296
|
+
const result = getNestedParam(testObj, 'user.settings.theme');
|
|
297
|
+
expect(result).toEqual({
|
|
298
|
+
type: 'text',
|
|
299
|
+
enum: [
|
|
300
|
+
'light',
|
|
301
|
+
'dark'
|
|
302
|
+
]
|
|
167
303
|
});
|
|
168
304
|
});
|
|
169
|
-
it('should return
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
expect(
|
|
305
|
+
it('should return undefined for non-existent paths', ()=>{
|
|
306
|
+
expect(getNestedParam(testObj, 'nonexistent')).toBeUndefined();
|
|
307
|
+
expect(getNestedParam(testObj, 'user.nonexistent')).toBeUndefined();
|
|
308
|
+
expect(getNestedParam(testObj, 'user.settings.nonexistent')).toBeUndefined();
|
|
309
|
+
});
|
|
310
|
+
it('should return undefined for invalid paths', ()=>{
|
|
311
|
+
expect(getNestedParam(testObj, 'title.invalid')).toBeUndefined();
|
|
312
|
+
expect(getNestedParam(testObj, 'user.name.invalid')).toBeUndefined();
|
|
313
|
+
});
|
|
314
|
+
it('should handle empty path', ()=>{
|
|
315
|
+
const result = getNestedParam(testObj, '');
|
|
316
|
+
expect(result).toBeUndefined(); // Empty string path returns undefined
|
|
317
|
+
});
|
|
318
|
+
it('should handle paths with array values safely', ()=>{
|
|
319
|
+
const objWithArray = {
|
|
320
|
+
items: {
|
|
321
|
+
enum: [
|
|
322
|
+
'a',
|
|
323
|
+
'b',
|
|
324
|
+
'c'
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const result = getNestedParam(objWithArray, 'items.enum');
|
|
329
|
+
expect(result).toEqual([
|
|
330
|
+
'a',
|
|
331
|
+
'b',
|
|
332
|
+
'c'
|
|
333
|
+
]); // Arrays are accessible as normal properties
|
|
173
334
|
});
|
|
174
335
|
});
|
|
175
336
|
});
|
|
@@ -4,7 +4,7 @@ declare const Link: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
4
4
|
slot?: string | undefined | undefined;
|
|
5
5
|
style?: import("react").CSSProperties | undefined;
|
|
6
6
|
title?: string | undefined | undefined;
|
|
7
|
-
locale?: import("
|
|
7
|
+
locale?: import("use-intl").Locale | undefined;
|
|
8
8
|
onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
|
|
9
9
|
children?: import("react").ReactNode;
|
|
10
10
|
ref?: import("react").Ref<HTMLAnchorElement> | undefined;
|
|
@@ -306,19 +306,19 @@ declare const Link: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
306
306
|
pathname: string;
|
|
307
307
|
query?: QueryParams;
|
|
308
308
|
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
309
|
-
locale?: import("
|
|
309
|
+
locale?: import("use-intl").Locale;
|
|
310
310
|
}) | undefined) => void;
|
|
311
311
|
replace: (href: string | {
|
|
312
312
|
pathname: string;
|
|
313
313
|
query?: QueryParams;
|
|
314
314
|
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions> & {
|
|
315
|
-
locale?: import("
|
|
315
|
+
locale?: import("use-intl").Locale;
|
|
316
316
|
}) | undefined) => void;
|
|
317
317
|
prefetch: (href: string | {
|
|
318
318
|
pathname: string;
|
|
319
319
|
query?: QueryParams;
|
|
320
320
|
}, options?: (Partial<import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions> & {
|
|
321
|
-
locale?: import("
|
|
321
|
+
locale?: import("use-intl").Locale;
|
|
322
322
|
}) | undefined) => void;
|
|
323
323
|
back(): void;
|
|
324
324
|
forward(): void;
|
|
@@ -328,7 +328,7 @@ declare const Link: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
328
328
|
pathname: string;
|
|
329
329
|
query?: QueryParams;
|
|
330
330
|
};
|
|
331
|
-
locale: import("
|
|
331
|
+
locale: import("use-intl").Locale;
|
|
332
332
|
forcePrefix?: boolean;
|
|
333
333
|
}) => string;
|
|
334
334
|
declare const redirect: (href: string | {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const ContentMoreActionSystemLogs: React.ComponentType<{
|
|
3
|
-
|
|
3
|
+
id: number;
|
|
4
|
+
pluginId: string;
|
|
5
|
+
type: "warn" | "error" | "debug";
|
|
6
|
+
content: string;
|
|
7
|
+
createdAt: Date;
|
|
4
8
|
ipAddress: string;
|
|
9
|
+
method: string;
|
|
10
|
+
path: string;
|
|
11
|
+
userAgent: string | null;
|
|
12
|
+
statusCode: number;
|
|
5
13
|
user: {
|
|
6
14
|
id: number;
|
|
7
15
|
name: string;
|
|
8
16
|
nameCode: string;
|
|
9
17
|
} | null;
|
|
10
|
-
id: number;
|
|
11
|
-
content: string;
|
|
12
|
-
type: "warn" | "error" | "debug";
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
userAgent: string | null;
|
|
15
|
-
path: string;
|
|
16
|
-
pluginId: string;
|
|
17
|
-
statusCode: number;
|
|
18
18
|
}>;
|
|
19
19
|
export declare const MoreActionSystemLogs: (props: React.ComponentProps<typeof ContentMoreActionSystemLogs>) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export declare const getSystemLogsData: (query: Record<string, string | string[] | undefined>) => Promise<{
|
|
2
2
|
edges: {
|
|
3
|
-
|
|
3
|
+
id: number;
|
|
4
|
+
pluginId: string;
|
|
5
|
+
type: "warn" | "error" | "debug";
|
|
6
|
+
content: string;
|
|
7
|
+
createdAt: Date;
|
|
4
8
|
ipAddress: string;
|
|
9
|
+
method: string;
|
|
10
|
+
path: string;
|
|
11
|
+
userAgent: string | null;
|
|
12
|
+
statusCode: number;
|
|
5
13
|
user: {
|
|
6
14
|
id: number;
|
|
7
15
|
name: string;
|
|
8
16
|
nameCode: string;
|
|
9
17
|
} | null;
|
|
10
|
-
id: number;
|
|
11
|
-
content: string;
|
|
12
|
-
type: "warn" | "error" | "debug";
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
userAgent: string | null;
|
|
15
|
-
path: string;
|
|
16
|
-
pluginId: string;
|
|
17
|
-
statusCode: number;
|
|
18
18
|
}[];
|
|
19
19
|
pageInfo: {
|
|
20
|
-
count: number;
|
|
21
20
|
totalCount: number;
|
|
21
|
+
count: number;
|
|
22
22
|
hasNextPage: boolean;
|
|
23
23
|
hasPreviousPage: boolean;
|
|
24
24
|
startCursor: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/views/core/test.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,QAAQ,+
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/views/admin/views/core/test.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,QAAQ,+CA0JpB,CAAC"}
|
|
@@ -14,13 +14,13 @@ export const TestView = ()=>{
|
|
|
14
14
|
const formSchema = z.object({
|
|
15
15
|
provider: z.string().min(1, {
|
|
16
16
|
message: 'Provider is required'
|
|
17
|
-
}),
|
|
17
|
+
}).describe('This is the provider for your application. It should be a valid provider name.'),
|
|
18
18
|
client_secret: z.string().min(1, {
|
|
19
19
|
message: 'Client Secret is required'
|
|
20
|
-
}),
|
|
20
|
+
}).describe('This is the client secret for your application. It should be kept secret and not shared with anyone.'),
|
|
21
21
|
terms: z.boolean().refine((val)=>val, {
|
|
22
22
|
message: 'You must accept the terms and conditions'
|
|
23
|
-
}),
|
|
23
|
+
}).describe('By checking this box, you agree to the terms and conditions.'),
|
|
24
24
|
options: z.enum([
|
|
25
25
|
'option1',
|
|
26
26
|
'option2',
|
|
@@ -31,7 +31,7 @@ export const TestView = ()=>{
|
|
|
31
31
|
'option2',
|
|
32
32
|
'option3'
|
|
33
33
|
]).default('option2'),
|
|
34
|
-
switch: z.boolean().default(false),
|
|
34
|
+
switch: z.boolean().default(false).describe('elo'),
|
|
35
35
|
type: z.enum([
|
|
36
36
|
'option-one',
|
|
37
37
|
'option-two'
|
|
@@ -115,9 +115,9 @@ export const TestView = ()=>{
|
|
|
115
115
|
{
|
|
116
116
|
id: 'switch',
|
|
117
117
|
component: (props)=>/*#__PURE__*/ _jsx(AutoFormSwitch, {
|
|
118
|
+
...props,
|
|
118
119
|
description: "By checking this box, you agree to the terms and conditions.",
|
|
119
|
-
label: "I agree to the terms and conditions"
|
|
120
|
-
...props
|
|
120
|
+
label: "I agree to the terms and conditions"
|
|
121
121
|
})
|
|
122
122
|
},
|
|
123
123
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ItemAutoFormComponentProps } from '../../../components/form/auto-form';
|
|
2
3
|
import { Input } from '../../../components/ui/input';
|
|
3
|
-
export declare const PasswordInput: ({
|
|
4
|
+
export declare const PasswordInput: ({ label, description: _, field, otherProps: { maxLength, minLength, pattern }, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Input>, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
//# sourceMappingURL=password-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-input.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/components/password-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"password-input.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/components/password-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAI9E,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ9C,eAAO,MAAM,aAAa,GAAI,2FAO3B,0BAA0B,GAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,MAAM,CAAC,4CA+EjD,CAAC"}
|