@zucker-framework/fe-types 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,22 @@
1
+ Zucker Framework
2
+ Copyright 2026 Lind and Zucker Framework contributors
3
+
4
+ Licensed under the Apache License, Version 2.0. See LICENSE.
5
+
6
+ The framework includes TypeScript adaptations and enhancements of concepts and
7
+ implementations from hsweb-framework and jetlinks-community, both distributed
8
+ under the Apache License, Version 2.0. Individual packages use different subsets
9
+ of the framework. The TypeScript adaptations and Node.js integrations were
10
+ modified for Zucker Framework; they are not the original upstream distribution.
11
+
12
+ hsweb-framework
13
+ https://github.com/hs-web/hsweb-framework
14
+ Copyright 2020 http://hsweb.me
15
+
16
+ jetlinks-community
17
+ https://github.com/jetlinks/jetlinks-community
18
+
19
+ See THIRD_PARTY_NOTICES for license texts and attribution for bundled dependencies
20
+ and reference implementations relevant to this package. External dependencies
21
+ remain subject to their own licenses. This NOTICE is informational and does not
22
+ modify any license or grant rights to upstream trademarks.
@@ -0,0 +1,4 @@
1
+ @zucker-framework/fe-types
2
+
3
+ No separately recorded third-party implementation is bundled in this package.
4
+ External dependencies retain their own licenses; see NOTICE for framework attribution.
@@ -0,0 +1,294 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ /**
4
+ * Zod Schemas — 前后端共享的 Single Source of Truth
5
+ *
6
+ * 对标 Claude Code 的 Tool inputSchema/outputSchema 模式:
7
+ * 一个定义同时提供运行时验证和 TypeScript 类型推断。
8
+ *
9
+ * 用法:
10
+ * ```ts
11
+ * // 后端 — DTO 验证
12
+ * const data = UserSchema.parse(req.body);
13
+ *
14
+ * // 前端 — 表单验证
15
+ * const result = UserSchema.safeParse(formValues);
16
+ *
17
+ * // 类型推断(无需手动维护 interface)
18
+ * type User = z.infer<typeof UserSchema>;
19
+ * ```
20
+ */
21
+
22
+ declare const UserSchema: z.ZodObject<{
23
+ id: z.ZodString;
24
+ username: z.ZodString;
25
+ name: z.ZodOptional<z.ZodString>;
26
+ email: z.ZodOptional<z.ZodString>;
27
+ status: z.ZodOptional<z.ZodBoolean>;
28
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
+ avatar: z.ZodOptional<z.ZodString>;
31
+ locale: z.ZodOptional<z.ZodString>;
32
+ createTime: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ declare const CreateUserSchema: z.ZodObject<{
35
+ name: z.ZodOptional<z.ZodString>;
36
+ username: z.ZodString;
37
+ email: z.ZodOptional<z.ZodString>;
38
+ status: z.ZodOptional<z.ZodBoolean>;
39
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ avatar: z.ZodOptional<z.ZodString>;
42
+ locale: z.ZodOptional<z.ZodString>;
43
+ password: z.ZodString;
44
+ }, z.core.$strip>;
45
+ declare const UpdateUserSchema: z.ZodObject<{
46
+ id: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
47
+ username: z.ZodOptional<z.ZodString>;
48
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
49
+ email: z.ZodOptional<z.ZodOptional<z.ZodString>>;
50
+ status: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
51
+ roles: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
52
+ permissions: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
53
+ avatar: z.ZodOptional<z.ZodOptional<z.ZodString>>;
54
+ locale: z.ZodOptional<z.ZodOptional<z.ZodString>>;
55
+ createTime: z.ZodOptional<z.ZodOptional<z.ZodString>>;
56
+ }, z.core.$strip>;
57
+ declare const PaginatedResponseSchema: <T extends z.ZodType>(itemSchema: T) => z.ZodObject<{
58
+ data: z.ZodArray<T>;
59
+ total: z.ZodNumber;
60
+ page: z.ZodNumber;
61
+ pageSize: z.ZodNumber;
62
+ totalPages: z.ZodNumber;
63
+ }, z.core.$strip>;
64
+ declare const ApiResponseSchema: <T extends z.ZodType>(resultSchema: T) => z.ZodObject<{
65
+ status: z.ZodNumber;
66
+ message: z.ZodString;
67
+ result: T;
68
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
69
+ }, z.core.$strip>;
70
+ declare const ApiErrorResponseSchema: z.ZodObject<{
71
+ status: z.ZodNumber;
72
+ code: z.ZodString;
73
+ message: z.ZodString;
74
+ result: z.ZodNullable<z.ZodUnknown>;
75
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
76
+ }, z.core.$strip>;
77
+ declare const TreeNodeSchema: z.ZodType<{
78
+ id: string;
79
+ name: string;
80
+ parentId?: string | null;
81
+ children?: Array<{
82
+ id: string;
83
+ name: string;
84
+ parentId?: string | null;
85
+ children?: unknown[];
86
+ }>;
87
+ }>;
88
+ declare const SelectOptionSchema: z.ZodType<{
89
+ label: string;
90
+ value: string | number;
91
+ disabled?: boolean;
92
+ children?: Array<{
93
+ label: string;
94
+ value: string | number;
95
+ disabled?: boolean;
96
+ children?: unknown[];
97
+ }>;
98
+ }>;
99
+ declare const MenuItemSchema: z.ZodObject<{
100
+ id: z.ZodString;
101
+ name: z.ZodString;
102
+ path: z.ZodOptional<z.ZodString>;
103
+ icon: z.ZodOptional<z.ZodString>;
104
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
+ sortOrder: z.ZodOptional<z.ZodNumber>;
106
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ children: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
108
+ }, z.core.$strip>;
109
+ declare const DictionaryItemSchema: z.ZodObject<{
110
+ id: z.ZodString;
111
+ label: z.ZodString;
112
+ value: z.ZodString;
113
+ sortOrder: z.ZodOptional<z.ZodNumber>;
114
+ }, z.core.$strip>;
115
+ declare const UploadFileSchema: z.ZodObject<{
116
+ id: z.ZodString;
117
+ name: z.ZodString;
118
+ url: z.ZodString;
119
+ size: z.ZodNumber;
120
+ mimeType: z.ZodString;
121
+ createdAt: z.ZodString;
122
+ }, z.core.$strip>;
123
+ declare const AuthStateSchema: z.ZodObject<{
124
+ isAuthenticated: z.ZodBoolean;
125
+ token: z.ZodNullable<z.ZodString>;
126
+ refreshToken: z.ZodNullable<z.ZodString>;
127
+ user: z.ZodNullable<z.ZodObject<{
128
+ id: z.ZodString;
129
+ username: z.ZodString;
130
+ name: z.ZodOptional<z.ZodString>;
131
+ email: z.ZodOptional<z.ZodString>;
132
+ status: z.ZodOptional<z.ZodBoolean>;
133
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ avatar: z.ZodOptional<z.ZodString>;
136
+ locale: z.ZodOptional<z.ZodString>;
137
+ createTime: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>>;
139
+ permissions: z.ZodArray<z.ZodString>;
140
+ }, z.core.$strip>;
141
+ declare const LoginRequestSchema: z.ZodObject<{
142
+ username: z.ZodString;
143
+ password: z.ZodString;
144
+ verifyCode: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>;
146
+ declare const LoginResponseSchema: z.ZodObject<{
147
+ token: z.ZodString;
148
+ refreshToken: z.ZodOptional<z.ZodString>;
149
+ user: z.ZodObject<{
150
+ id: z.ZodString;
151
+ username: z.ZodString;
152
+ name: z.ZodOptional<z.ZodString>;
153
+ email: z.ZodOptional<z.ZodString>;
154
+ status: z.ZodOptional<z.ZodBoolean>;
155
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ avatar: z.ZodOptional<z.ZodString>;
158
+ locale: z.ZodOptional<z.ZodString>;
159
+ createTime: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>;
161
+ }, z.core.$strip>;
162
+
163
+ /** Represents an authenticated user in the system. */
164
+ interface User {
165
+ /** Unique user identifier. */
166
+ id: string;
167
+ /** Login username. */
168
+ username: string;
169
+ /** Display name. */
170
+ name?: string;
171
+ /** Email address. */
172
+ email?: string;
173
+ /** Whether the user account is active. */
174
+ status?: boolean;
175
+ /** Role codes assigned to the user. */
176
+ roles?: string[];
177
+ /** Permission codes granted to the user. */
178
+ permissions?: string[];
179
+ /** URL to the user's avatar image. */
180
+ avatar?: string;
181
+ /** Preferred locale/language code (e.g. "zh-CN"). */
182
+ locale?: string;
183
+ /** ISO timestamp of account creation. */
184
+ createTime?: string;
185
+ }
186
+ /** Paginated list response envelope. */
187
+ interface PaginatedResponse<T> {
188
+ /** Items for the current page. */
189
+ data: T[];
190
+ /** Total number of items across all pages. */
191
+ total: number;
192
+ /** Current page number (1-indexed). */
193
+ page: number;
194
+ /** Number of items per page. */
195
+ pageSize: number;
196
+ /** Total number of pages. */
197
+ totalPages: number;
198
+ }
199
+ /** Standard API response envelope wrapping a typed result. */
200
+ interface ApiResponse<T> {
201
+ /** Business status code (e.g. 200 for success). */
202
+ status: number;
203
+ /** Human-readable response message. */
204
+ message: string;
205
+ /** The response payload. */
206
+ result: T;
207
+ /** ISO timestamp of when the response was generated. */
208
+ timestamp: string;
209
+ }
210
+ /** Generic tree node used for hierarchical data structures. */
211
+ interface TreeNode {
212
+ /** Unique node identifier. */
213
+ id: string;
214
+ /** Parent node identifier, null for root nodes. */
215
+ parentId?: string | null;
216
+ /** Display name of the node. */
217
+ name: string;
218
+ /** Child nodes in the hierarchy. */
219
+ children?: TreeNode[];
220
+ /** Allow additional domain-specific properties. */
221
+ [key: string]: unknown;
222
+ }
223
+ /** Option item for select/dropdown components. */
224
+ interface SelectOption {
225
+ /** Display text shown to the user. */
226
+ label: string;
227
+ /** Underlying option value. */
228
+ value: string | number;
229
+ /** Whether this option is selectable. */
230
+ disabled?: boolean;
231
+ /** Nested child options for cascading selects. */
232
+ children?: SelectOption[];
233
+ }
234
+ /** Navigation menu item with optional permission gating. */
235
+ interface MenuItem {
236
+ /** Unique menu item identifier. */
237
+ id: string;
238
+ /** Display name of the menu entry. */
239
+ name: string;
240
+ /** Route path this menu item links to. */
241
+ path?: string;
242
+ /** Icon identifier or component name. */
243
+ icon?: string;
244
+ /** Parent menu item identifier, null for top-level items. */
245
+ parentId?: string | null;
246
+ /** Numeric sort order for display ordering. */
247
+ sortOrder?: number;
248
+ /** Permission codes required to view this menu item. */
249
+ permissions?: string[];
250
+ /** Nested child menu items. */
251
+ children?: MenuItem[];
252
+ }
253
+ /** Metadata for a dictionary/enum entry used in forms and displays. */
254
+ interface DictionaryItem {
255
+ /** Unique dictionary item identifier. */
256
+ id: string;
257
+ /** Human-readable display label. */
258
+ label: string;
259
+ /** Machine-readable value. */
260
+ value: string;
261
+ /** Numeric sort order for display ordering. */
262
+ sortOrder?: number;
263
+ }
264
+ /** Metadata for an uploaded file resource. */
265
+ interface UploadFile {
266
+ /** Unique file identifier. */
267
+ id: string;
268
+ /** Original file name. */
269
+ name: string;
270
+ /** Accessible URL for the file. */
271
+ url: string;
272
+ /** File size in bytes. */
273
+ size: number;
274
+ /** MIME type (e.g. "image/png"). */
275
+ mimeType: string;
276
+ /** ISO timestamp of when the file was uploaded. */
277
+ createdAt: string;
278
+ }
279
+
280
+ /** Shape of the authentication state managed by the auth store. */
281
+ interface AuthState {
282
+ /** Whether the user is currently authenticated. */
283
+ isAuthenticated: boolean;
284
+ /** Current access token, null when not authenticated. */
285
+ token: string | null;
286
+ /** Current refresh token, null when not available. */
287
+ refreshToken: string | null;
288
+ /** Authenticated user profile, null when not authenticated. */
289
+ user: User | null;
290
+ /** Flat list of permission codes granted to the user. */
291
+ permissions: string[];
292
+ }
293
+
294
+ export { ApiErrorResponseSchema, type ApiResponse, ApiResponseSchema, type AuthState, AuthStateSchema, CreateUserSchema, type DictionaryItem, DictionaryItemSchema, LoginRequestSchema, LoginResponseSchema, type MenuItem, MenuItemSchema, type PaginatedResponse, PaginatedResponseSchema, type SelectOption, SelectOptionSchema, type TreeNode, TreeNodeSchema, UpdateUserSchema, type UploadFile, UploadFileSchema, type User, UserSchema };
@@ -0,0 +1,294 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ /**
4
+ * Zod Schemas — 前后端共享的 Single Source of Truth
5
+ *
6
+ * 对标 Claude Code 的 Tool inputSchema/outputSchema 模式:
7
+ * 一个定义同时提供运行时验证和 TypeScript 类型推断。
8
+ *
9
+ * 用法:
10
+ * ```ts
11
+ * // 后端 — DTO 验证
12
+ * const data = UserSchema.parse(req.body);
13
+ *
14
+ * // 前端 — 表单验证
15
+ * const result = UserSchema.safeParse(formValues);
16
+ *
17
+ * // 类型推断(无需手动维护 interface)
18
+ * type User = z.infer<typeof UserSchema>;
19
+ * ```
20
+ */
21
+
22
+ declare const UserSchema: z.ZodObject<{
23
+ id: z.ZodString;
24
+ username: z.ZodString;
25
+ name: z.ZodOptional<z.ZodString>;
26
+ email: z.ZodOptional<z.ZodString>;
27
+ status: z.ZodOptional<z.ZodBoolean>;
28
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
+ avatar: z.ZodOptional<z.ZodString>;
31
+ locale: z.ZodOptional<z.ZodString>;
32
+ createTime: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ declare const CreateUserSchema: z.ZodObject<{
35
+ name: z.ZodOptional<z.ZodString>;
36
+ username: z.ZodString;
37
+ email: z.ZodOptional<z.ZodString>;
38
+ status: z.ZodOptional<z.ZodBoolean>;
39
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ avatar: z.ZodOptional<z.ZodString>;
42
+ locale: z.ZodOptional<z.ZodString>;
43
+ password: z.ZodString;
44
+ }, z.core.$strip>;
45
+ declare const UpdateUserSchema: z.ZodObject<{
46
+ id: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
47
+ username: z.ZodOptional<z.ZodString>;
48
+ name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
49
+ email: z.ZodOptional<z.ZodOptional<z.ZodString>>;
50
+ status: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
51
+ roles: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
52
+ permissions: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
53
+ avatar: z.ZodOptional<z.ZodOptional<z.ZodString>>;
54
+ locale: z.ZodOptional<z.ZodOptional<z.ZodString>>;
55
+ createTime: z.ZodOptional<z.ZodOptional<z.ZodString>>;
56
+ }, z.core.$strip>;
57
+ declare const PaginatedResponseSchema: <T extends z.ZodType>(itemSchema: T) => z.ZodObject<{
58
+ data: z.ZodArray<T>;
59
+ total: z.ZodNumber;
60
+ page: z.ZodNumber;
61
+ pageSize: z.ZodNumber;
62
+ totalPages: z.ZodNumber;
63
+ }, z.core.$strip>;
64
+ declare const ApiResponseSchema: <T extends z.ZodType>(resultSchema: T) => z.ZodObject<{
65
+ status: z.ZodNumber;
66
+ message: z.ZodString;
67
+ result: T;
68
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
69
+ }, z.core.$strip>;
70
+ declare const ApiErrorResponseSchema: z.ZodObject<{
71
+ status: z.ZodNumber;
72
+ code: z.ZodString;
73
+ message: z.ZodString;
74
+ result: z.ZodNullable<z.ZodUnknown>;
75
+ timestamp: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
76
+ }, z.core.$strip>;
77
+ declare const TreeNodeSchema: z.ZodType<{
78
+ id: string;
79
+ name: string;
80
+ parentId?: string | null;
81
+ children?: Array<{
82
+ id: string;
83
+ name: string;
84
+ parentId?: string | null;
85
+ children?: unknown[];
86
+ }>;
87
+ }>;
88
+ declare const SelectOptionSchema: z.ZodType<{
89
+ label: string;
90
+ value: string | number;
91
+ disabled?: boolean;
92
+ children?: Array<{
93
+ label: string;
94
+ value: string | number;
95
+ disabled?: boolean;
96
+ children?: unknown[];
97
+ }>;
98
+ }>;
99
+ declare const MenuItemSchema: z.ZodObject<{
100
+ id: z.ZodString;
101
+ name: z.ZodString;
102
+ path: z.ZodOptional<z.ZodString>;
103
+ icon: z.ZodOptional<z.ZodString>;
104
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
+ sortOrder: z.ZodOptional<z.ZodNumber>;
106
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ children: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
108
+ }, z.core.$strip>;
109
+ declare const DictionaryItemSchema: z.ZodObject<{
110
+ id: z.ZodString;
111
+ label: z.ZodString;
112
+ value: z.ZodString;
113
+ sortOrder: z.ZodOptional<z.ZodNumber>;
114
+ }, z.core.$strip>;
115
+ declare const UploadFileSchema: z.ZodObject<{
116
+ id: z.ZodString;
117
+ name: z.ZodString;
118
+ url: z.ZodString;
119
+ size: z.ZodNumber;
120
+ mimeType: z.ZodString;
121
+ createdAt: z.ZodString;
122
+ }, z.core.$strip>;
123
+ declare const AuthStateSchema: z.ZodObject<{
124
+ isAuthenticated: z.ZodBoolean;
125
+ token: z.ZodNullable<z.ZodString>;
126
+ refreshToken: z.ZodNullable<z.ZodString>;
127
+ user: z.ZodNullable<z.ZodObject<{
128
+ id: z.ZodString;
129
+ username: z.ZodString;
130
+ name: z.ZodOptional<z.ZodString>;
131
+ email: z.ZodOptional<z.ZodString>;
132
+ status: z.ZodOptional<z.ZodBoolean>;
133
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ avatar: z.ZodOptional<z.ZodString>;
136
+ locale: z.ZodOptional<z.ZodString>;
137
+ createTime: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strip>>;
139
+ permissions: z.ZodArray<z.ZodString>;
140
+ }, z.core.$strip>;
141
+ declare const LoginRequestSchema: z.ZodObject<{
142
+ username: z.ZodString;
143
+ password: z.ZodString;
144
+ verifyCode: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strip>;
146
+ declare const LoginResponseSchema: z.ZodObject<{
147
+ token: z.ZodString;
148
+ refreshToken: z.ZodOptional<z.ZodString>;
149
+ user: z.ZodObject<{
150
+ id: z.ZodString;
151
+ username: z.ZodString;
152
+ name: z.ZodOptional<z.ZodString>;
153
+ email: z.ZodOptional<z.ZodString>;
154
+ status: z.ZodOptional<z.ZodBoolean>;
155
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ avatar: z.ZodOptional<z.ZodString>;
158
+ locale: z.ZodOptional<z.ZodString>;
159
+ createTime: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>;
161
+ }, z.core.$strip>;
162
+
163
+ /** Represents an authenticated user in the system. */
164
+ interface User {
165
+ /** Unique user identifier. */
166
+ id: string;
167
+ /** Login username. */
168
+ username: string;
169
+ /** Display name. */
170
+ name?: string;
171
+ /** Email address. */
172
+ email?: string;
173
+ /** Whether the user account is active. */
174
+ status?: boolean;
175
+ /** Role codes assigned to the user. */
176
+ roles?: string[];
177
+ /** Permission codes granted to the user. */
178
+ permissions?: string[];
179
+ /** URL to the user's avatar image. */
180
+ avatar?: string;
181
+ /** Preferred locale/language code (e.g. "zh-CN"). */
182
+ locale?: string;
183
+ /** ISO timestamp of account creation. */
184
+ createTime?: string;
185
+ }
186
+ /** Paginated list response envelope. */
187
+ interface PaginatedResponse<T> {
188
+ /** Items for the current page. */
189
+ data: T[];
190
+ /** Total number of items across all pages. */
191
+ total: number;
192
+ /** Current page number (1-indexed). */
193
+ page: number;
194
+ /** Number of items per page. */
195
+ pageSize: number;
196
+ /** Total number of pages. */
197
+ totalPages: number;
198
+ }
199
+ /** Standard API response envelope wrapping a typed result. */
200
+ interface ApiResponse<T> {
201
+ /** Business status code (e.g. 200 for success). */
202
+ status: number;
203
+ /** Human-readable response message. */
204
+ message: string;
205
+ /** The response payload. */
206
+ result: T;
207
+ /** ISO timestamp of when the response was generated. */
208
+ timestamp: string;
209
+ }
210
+ /** Generic tree node used for hierarchical data structures. */
211
+ interface TreeNode {
212
+ /** Unique node identifier. */
213
+ id: string;
214
+ /** Parent node identifier, null for root nodes. */
215
+ parentId?: string | null;
216
+ /** Display name of the node. */
217
+ name: string;
218
+ /** Child nodes in the hierarchy. */
219
+ children?: TreeNode[];
220
+ /** Allow additional domain-specific properties. */
221
+ [key: string]: unknown;
222
+ }
223
+ /** Option item for select/dropdown components. */
224
+ interface SelectOption {
225
+ /** Display text shown to the user. */
226
+ label: string;
227
+ /** Underlying option value. */
228
+ value: string | number;
229
+ /** Whether this option is selectable. */
230
+ disabled?: boolean;
231
+ /** Nested child options for cascading selects. */
232
+ children?: SelectOption[];
233
+ }
234
+ /** Navigation menu item with optional permission gating. */
235
+ interface MenuItem {
236
+ /** Unique menu item identifier. */
237
+ id: string;
238
+ /** Display name of the menu entry. */
239
+ name: string;
240
+ /** Route path this menu item links to. */
241
+ path?: string;
242
+ /** Icon identifier or component name. */
243
+ icon?: string;
244
+ /** Parent menu item identifier, null for top-level items. */
245
+ parentId?: string | null;
246
+ /** Numeric sort order for display ordering. */
247
+ sortOrder?: number;
248
+ /** Permission codes required to view this menu item. */
249
+ permissions?: string[];
250
+ /** Nested child menu items. */
251
+ children?: MenuItem[];
252
+ }
253
+ /** Metadata for a dictionary/enum entry used in forms and displays. */
254
+ interface DictionaryItem {
255
+ /** Unique dictionary item identifier. */
256
+ id: string;
257
+ /** Human-readable display label. */
258
+ label: string;
259
+ /** Machine-readable value. */
260
+ value: string;
261
+ /** Numeric sort order for display ordering. */
262
+ sortOrder?: number;
263
+ }
264
+ /** Metadata for an uploaded file resource. */
265
+ interface UploadFile {
266
+ /** Unique file identifier. */
267
+ id: string;
268
+ /** Original file name. */
269
+ name: string;
270
+ /** Accessible URL for the file. */
271
+ url: string;
272
+ /** File size in bytes. */
273
+ size: number;
274
+ /** MIME type (e.g. "image/png"). */
275
+ mimeType: string;
276
+ /** ISO timestamp of when the file was uploaded. */
277
+ createdAt: string;
278
+ }
279
+
280
+ /** Shape of the authentication state managed by the auth store. */
281
+ interface AuthState {
282
+ /** Whether the user is currently authenticated. */
283
+ isAuthenticated: boolean;
284
+ /** Current access token, null when not authenticated. */
285
+ token: string | null;
286
+ /** Current refresh token, null when not available. */
287
+ refreshToken: string | null;
288
+ /** Authenticated user profile, null when not authenticated. */
289
+ user: User | null;
290
+ /** Flat list of permission codes granted to the user. */
291
+ permissions: string[];
292
+ }
293
+
294
+ export { ApiErrorResponseSchema, type ApiResponse, ApiResponseSchema, type AuthState, AuthStateSchema, CreateUserSchema, type DictionaryItem, DictionaryItemSchema, LoginRequestSchema, LoginResponseSchema, type MenuItem, MenuItemSchema, type PaginatedResponse, PaginatedResponseSchema, type SelectOption, SelectOptionSchema, type TreeNode, TreeNodeSchema, UpdateUserSchema, type UploadFile, UploadFileSchema, type User, UserSchema };
package/dist/index.js ADDED
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ApiErrorResponseSchema: () => ApiErrorResponseSchema,
24
+ ApiResponseSchema: () => ApiResponseSchema,
25
+ AuthStateSchema: () => AuthStateSchema,
26
+ CreateUserSchema: () => CreateUserSchema,
27
+ DictionaryItemSchema: () => DictionaryItemSchema,
28
+ LoginRequestSchema: () => LoginRequestSchema,
29
+ LoginResponseSchema: () => LoginResponseSchema,
30
+ MenuItemSchema: () => MenuItemSchema,
31
+ PaginatedResponseSchema: () => PaginatedResponseSchema,
32
+ SelectOptionSchema: () => SelectOptionSchema,
33
+ TreeNodeSchema: () => TreeNodeSchema,
34
+ UpdateUserSchema: () => UpdateUserSchema,
35
+ UploadFileSchema: () => UploadFileSchema,
36
+ UserSchema: () => UserSchema
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/schemas.ts
41
+ var import_v4 = require("zod/v4");
42
+ var UserSchema = import_v4.z.object({
43
+ id: import_v4.z.string(),
44
+ username: import_v4.z.string().min(2).max(32),
45
+ name: import_v4.z.string().optional(),
46
+ email: import_v4.z.string().email().optional(),
47
+ status: import_v4.z.boolean().optional(),
48
+ roles: import_v4.z.array(import_v4.z.string()).optional(),
49
+ permissions: import_v4.z.array(import_v4.z.string()).optional(),
50
+ avatar: import_v4.z.string().url().optional(),
51
+ locale: import_v4.z.string().optional(),
52
+ createTime: import_v4.z.string().optional()
53
+ });
54
+ var CreateUserSchema = UserSchema.omit({ id: true, createTime: true }).extend({
55
+ password: import_v4.z.string().min(6).max(128)
56
+ });
57
+ var UpdateUserSchema = UserSchema.partial().required({ id: true });
58
+ var PaginatedResponseSchema = (itemSchema) => import_v4.z.object({
59
+ data: import_v4.z.array(itemSchema),
60
+ total: import_v4.z.number().int().min(0),
61
+ page: import_v4.z.number().int().min(1),
62
+ pageSize: import_v4.z.number().int().min(1),
63
+ totalPages: import_v4.z.number().int().min(0)
64
+ });
65
+ var ApiResponseSchema = (resultSchema) => import_v4.z.object({
66
+ status: import_v4.z.number().int(),
67
+ message: import_v4.z.string(),
68
+ result: resultSchema,
69
+ timestamp: import_v4.z.union([import_v4.z.string(), import_v4.z.number()])
70
+ });
71
+ var ApiErrorResponseSchema = import_v4.z.object({
72
+ status: import_v4.z.number().int(),
73
+ code: import_v4.z.string(),
74
+ message: import_v4.z.string(),
75
+ result: import_v4.z.unknown().nullable(),
76
+ timestamp: import_v4.z.union([import_v4.z.string(), import_v4.z.number()])
77
+ });
78
+ var TreeNodeSchema = import_v4.z.object({
79
+ id: import_v4.z.string(),
80
+ name: import_v4.z.string(),
81
+ parentId: import_v4.z.string().nullable().optional(),
82
+ children: import_v4.z.lazy(() => import_v4.z.array(TreeNodeSchema)).optional()
83
+ });
84
+ var SelectOptionSchema = import_v4.z.object({
85
+ label: import_v4.z.string(),
86
+ value: import_v4.z.union([import_v4.z.string(), import_v4.z.number()]),
87
+ disabled: import_v4.z.boolean().optional(),
88
+ children: import_v4.z.lazy(() => import_v4.z.array(SelectOptionSchema)).optional()
89
+ });
90
+ var MenuItemSchema = import_v4.z.object({
91
+ id: import_v4.z.string(),
92
+ name: import_v4.z.string(),
93
+ path: import_v4.z.string().optional(),
94
+ icon: import_v4.z.string().optional(),
95
+ parentId: import_v4.z.string().nullable().optional(),
96
+ sortOrder: import_v4.z.number().int().optional(),
97
+ permissions: import_v4.z.array(import_v4.z.string()).optional(),
98
+ children: import_v4.z.lazy(() => import_v4.z.array(MenuItemSchema)).optional()
99
+ });
100
+ var DictionaryItemSchema = import_v4.z.object({
101
+ id: import_v4.z.string(),
102
+ label: import_v4.z.string(),
103
+ value: import_v4.z.string(),
104
+ sortOrder: import_v4.z.number().int().optional()
105
+ });
106
+ var UploadFileSchema = import_v4.z.object({
107
+ id: import_v4.z.string(),
108
+ name: import_v4.z.string(),
109
+ url: import_v4.z.string().url(),
110
+ size: import_v4.z.number().int().min(0),
111
+ mimeType: import_v4.z.string(),
112
+ createdAt: import_v4.z.string()
113
+ });
114
+ var AuthStateSchema = import_v4.z.object({
115
+ isAuthenticated: import_v4.z.boolean(),
116
+ token: import_v4.z.string().nullable(),
117
+ refreshToken: import_v4.z.string().nullable(),
118
+ user: UserSchema.nullable(),
119
+ permissions: import_v4.z.array(import_v4.z.string())
120
+ });
121
+ var LoginRequestSchema = import_v4.z.object({
122
+ username: import_v4.z.string().min(1),
123
+ password: import_v4.z.string().min(1),
124
+ verifyCode: import_v4.z.string().optional()
125
+ });
126
+ var LoginResponseSchema = import_v4.z.object({
127
+ token: import_v4.z.string(),
128
+ refreshToken: import_v4.z.string().optional(),
129
+ user: UserSchema
130
+ });
131
+ // Annotate the CommonJS export names for ESM import in node:
132
+ 0 && (module.exports = {
133
+ ApiErrorResponseSchema,
134
+ ApiResponseSchema,
135
+ AuthStateSchema,
136
+ CreateUserSchema,
137
+ DictionaryItemSchema,
138
+ LoginRequestSchema,
139
+ LoginResponseSchema,
140
+ MenuItemSchema,
141
+ PaginatedResponseSchema,
142
+ SelectOptionSchema,
143
+ TreeNodeSchema,
144
+ UpdateUserSchema,
145
+ UploadFileSchema,
146
+ UserSchema
147
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,107 @@
1
+ // src/schemas.ts
2
+ import { z } from "zod/v4";
3
+ var UserSchema = z.object({
4
+ id: z.string(),
5
+ username: z.string().min(2).max(32),
6
+ name: z.string().optional(),
7
+ email: z.string().email().optional(),
8
+ status: z.boolean().optional(),
9
+ roles: z.array(z.string()).optional(),
10
+ permissions: z.array(z.string()).optional(),
11
+ avatar: z.string().url().optional(),
12
+ locale: z.string().optional(),
13
+ createTime: z.string().optional()
14
+ });
15
+ var CreateUserSchema = UserSchema.omit({ id: true, createTime: true }).extend({
16
+ password: z.string().min(6).max(128)
17
+ });
18
+ var UpdateUserSchema = UserSchema.partial().required({ id: true });
19
+ var PaginatedResponseSchema = (itemSchema) => z.object({
20
+ data: z.array(itemSchema),
21
+ total: z.number().int().min(0),
22
+ page: z.number().int().min(1),
23
+ pageSize: z.number().int().min(1),
24
+ totalPages: z.number().int().min(0)
25
+ });
26
+ var ApiResponseSchema = (resultSchema) => z.object({
27
+ status: z.number().int(),
28
+ message: z.string(),
29
+ result: resultSchema,
30
+ timestamp: z.union([z.string(), z.number()])
31
+ });
32
+ var ApiErrorResponseSchema = z.object({
33
+ status: z.number().int(),
34
+ code: z.string(),
35
+ message: z.string(),
36
+ result: z.unknown().nullable(),
37
+ timestamp: z.union([z.string(), z.number()])
38
+ });
39
+ var TreeNodeSchema = z.object({
40
+ id: z.string(),
41
+ name: z.string(),
42
+ parentId: z.string().nullable().optional(),
43
+ children: z.lazy(() => z.array(TreeNodeSchema)).optional()
44
+ });
45
+ var SelectOptionSchema = z.object({
46
+ label: z.string(),
47
+ value: z.union([z.string(), z.number()]),
48
+ disabled: z.boolean().optional(),
49
+ children: z.lazy(() => z.array(SelectOptionSchema)).optional()
50
+ });
51
+ var MenuItemSchema = z.object({
52
+ id: z.string(),
53
+ name: z.string(),
54
+ path: z.string().optional(),
55
+ icon: z.string().optional(),
56
+ parentId: z.string().nullable().optional(),
57
+ sortOrder: z.number().int().optional(),
58
+ permissions: z.array(z.string()).optional(),
59
+ children: z.lazy(() => z.array(MenuItemSchema)).optional()
60
+ });
61
+ var DictionaryItemSchema = z.object({
62
+ id: z.string(),
63
+ label: z.string(),
64
+ value: z.string(),
65
+ sortOrder: z.number().int().optional()
66
+ });
67
+ var UploadFileSchema = z.object({
68
+ id: z.string(),
69
+ name: z.string(),
70
+ url: z.string().url(),
71
+ size: z.number().int().min(0),
72
+ mimeType: z.string(),
73
+ createdAt: z.string()
74
+ });
75
+ var AuthStateSchema = z.object({
76
+ isAuthenticated: z.boolean(),
77
+ token: z.string().nullable(),
78
+ refreshToken: z.string().nullable(),
79
+ user: UserSchema.nullable(),
80
+ permissions: z.array(z.string())
81
+ });
82
+ var LoginRequestSchema = z.object({
83
+ username: z.string().min(1),
84
+ password: z.string().min(1),
85
+ verifyCode: z.string().optional()
86
+ });
87
+ var LoginResponseSchema = z.object({
88
+ token: z.string(),
89
+ refreshToken: z.string().optional(),
90
+ user: UserSchema
91
+ });
92
+ export {
93
+ ApiErrorResponseSchema,
94
+ ApiResponseSchema,
95
+ AuthStateSchema,
96
+ CreateUserSchema,
97
+ DictionaryItemSchema,
98
+ LoginRequestSchema,
99
+ LoginResponseSchema,
100
+ MenuItemSchema,
101
+ PaginatedResponseSchema,
102
+ SelectOptionSchema,
103
+ TreeNodeSchema,
104
+ UpdateUserSchema,
105
+ UploadFileSchema,
106
+ UserSchema
107
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@zucker-framework/fe-types",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "module": "dist/index.mjs",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ }
18
+ },
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist",
22
+ "LICENSE",
23
+ "NOTICE",
24
+ "THIRD_PARTY_NOTICES"
25
+ ],
26
+ "dependencies": {
27
+ "zod": "^4.5.4"
28
+ },
29
+ "license": "Apache-2.0",
30
+ "author": "Lind",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/Lind-pro/zucker-framework.git",
34
+ "directory": "packages/fe-types"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "registry": "https://registry.npmjs.org/"
39
+ },
40
+ "scripts": {
41
+ "build": "tsup src/index.ts --format cjs,esm --dts",
42
+ "clean": "rm -rf dist"
43
+ }
44
+ }