@aveliya/contracts 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.
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ // Browser-safe API contract, shared directly with the admin adapter. Keep server
3
+ // services/configuration out of this module so both builds use the same schema.
4
+ const text = z.string();
5
+ const nonempty = text.min(1);
6
+ const quantity = z.number().int().nonnegative();
7
+ export const adminVariantSchema = z.object({
8
+ id: nonempty, sku: nonempty, colorId: nonempty, sizeId: nonempty,
9
+ quantity,
10
+ imageUrl: text.optional(), mediaId: text.optional(), active: z.boolean().optional(),
11
+ }).strict();
12
+ export const adminProductSchema = z.object({
13
+ primaryCategoryId: nonempty.optional(),
14
+ id: nonempty, slug: nonempty, name: nonempty, sku: nonempty,
15
+ description: text, shortDescription: text,
16
+ category: nonempty, subcategory: nonempty, collection: nonempty,
17
+ audience: nonempty,
18
+ collections: z.array(nonempty).optional(), seoTitle: text.optional(), seoDescription: text.optional(),
19
+ createdAt: text.optional(), updatedAt: text.optional(),
20
+ basePrice: z.number().int().positive(), salePrice: quantity.optional(),
21
+ images: z.array(z.object({
22
+ id: text.optional(), primary: z.boolean().optional(), order: quantity.optional(),
23
+ colorId: text.optional(), variantId: text.optional(), type: z.literal('image').optional(),
24
+ url: nonempty, alt: text,
25
+ width: z.number().int().positive(), height: z.number().int().positive(),
26
+ }).strict()).min(1),
27
+ videos: z.array(text),
28
+ colors: z.array(z.object({ id: nonempty, name: nonempty, hex: nonempty }).strict()).min(1),
29
+ sizes: z.array(z.object({ id: nonempty, label: nonempty }).strict()).min(1),
30
+ variants: z.array(adminVariantSchema).min(1),
31
+ material: nonempty,
32
+ careInstructions: z.array(text), sizeAndFit: z.array(text),
33
+ tags: z.array(text), badges: z.array(z.enum(['new', 'bestseller', 'limited', 'sale'])),
34
+ isFeatured: z.boolean(), isNew: z.boolean(), isBestseller: z.boolean(),
35
+ active: z.boolean(),
36
+ }).strict();
37
+ export const adminProductsResponseSchema = z.object({
38
+ items: z.array(adminProductSchema),
39
+ total: quantity,
40
+ page: z.number().int().positive(),
41
+ pageSize: z.number().int().positive(),
42
+ }).strict();
43
+ // Public reads can expose a product whose variants are all currently inactive.
44
+ export const publicProductSchema = adminProductSchema.omit({ active: true, createdAt: true, updatedAt: true })
45
+ .extend({ variants: z.array(adminVariantSchema) });
46
+ export const catalogProductsResponseSchema = adminProductsResponseSchema.extend({ items: z.array(publicProductSchema) });
@@ -0,0 +1,118 @@
1
+ import { z } from 'zod';
2
+ export declare const facetNames: readonly ["categories", "collections", "sizes", "colors", "materials"];
3
+ export declare const catalogFacetsSchema: z.ZodObject<{
4
+ categories: z.ZodArray<z.ZodObject<{
5
+ id: z.ZodString;
6
+ label: z.ZodString;
7
+ }, "strict", z.ZodTypeAny, {
8
+ id: string;
9
+ label: string;
10
+ }, {
11
+ id: string;
12
+ label: string;
13
+ }>, "many">;
14
+ collections: z.ZodArray<z.ZodObject<{
15
+ id: z.ZodString;
16
+ label: z.ZodString;
17
+ }, "strict", z.ZodTypeAny, {
18
+ id: string;
19
+ label: string;
20
+ }, {
21
+ id: string;
22
+ label: string;
23
+ }>, "many">;
24
+ sizes: z.ZodArray<z.ZodObject<{
25
+ id: z.ZodString;
26
+ label: z.ZodString;
27
+ }, "strict", z.ZodTypeAny, {
28
+ id: string;
29
+ label: string;
30
+ }, {
31
+ id: string;
32
+ label: string;
33
+ }>, "many">;
34
+ colors: z.ZodArray<z.ZodObject<{
35
+ id: z.ZodString;
36
+ label: z.ZodString;
37
+ }, "strict", z.ZodTypeAny, {
38
+ id: string;
39
+ label: string;
40
+ }, {
41
+ id: string;
42
+ label: string;
43
+ }>, "many">;
44
+ materials: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ label: z.ZodString;
47
+ }, "strict", z.ZodTypeAny, {
48
+ id: string;
49
+ label: string;
50
+ }, {
51
+ id: string;
52
+ label: string;
53
+ }>, "many">;
54
+ price: z.ZodObject<{
55
+ min: z.ZodNullable<z.ZodNumber>;
56
+ max: z.ZodNullable<z.ZodNumber>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ min: number | null;
59
+ max: number | null;
60
+ }, {
61
+ min: number | null;
62
+ max: number | null;
63
+ }>;
64
+ truncated: z.ZodArray<z.ZodEnum<["categories", "collections", "sizes", "colors", "materials"]>, "many">;
65
+ }, "strict", z.ZodTypeAny, {
66
+ collections: {
67
+ id: string;
68
+ label: string;
69
+ }[];
70
+ colors: {
71
+ id: string;
72
+ label: string;
73
+ }[];
74
+ sizes: {
75
+ id: string;
76
+ label: string;
77
+ }[];
78
+ categories: {
79
+ id: string;
80
+ label: string;
81
+ }[];
82
+ materials: {
83
+ id: string;
84
+ label: string;
85
+ }[];
86
+ price: {
87
+ min: number | null;
88
+ max: number | null;
89
+ };
90
+ truncated: ("collections" | "colors" | "sizes" | "categories" | "materials")[];
91
+ }, {
92
+ collections: {
93
+ id: string;
94
+ label: string;
95
+ }[];
96
+ colors: {
97
+ id: string;
98
+ label: string;
99
+ }[];
100
+ sizes: {
101
+ id: string;
102
+ label: string;
103
+ }[];
104
+ categories: {
105
+ id: string;
106
+ label: string;
107
+ }[];
108
+ materials: {
109
+ id: string;
110
+ label: string;
111
+ }[];
112
+ price: {
113
+ min: number | null;
114
+ max: number | null;
115
+ };
116
+ truncated: ("collections" | "colors" | "sizes" | "categories" | "materials")[];
117
+ }>;
118
+ export type CatalogFacets = z.infer<typeof catalogFacetsSchema>;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ const option = z.object({ id: z.string(), label: z.string() }).strict();
3
+ export const facetNames = ['categories', 'collections', 'sizes', 'colors', 'materials'];
4
+ export const catalogFacetsSchema = z
5
+ .object({
6
+ categories: z.array(option).max(200),
7
+ collections: z.array(option).max(200),
8
+ sizes: z.array(option).max(200),
9
+ colors: z.array(option).max(200),
10
+ materials: z.array(option).max(200),
11
+ price: z.object({
12
+ min: z.number().nonnegative().nullable(),
13
+ max: z.number().nonnegative().nullable(),
14
+ }),
15
+ truncated: z.array(z.enum(facetNames)),
16
+ })
17
+ .strict();
@@ -0,0 +1,406 @@
1
+ import { z } from 'zod';
2
+ export declare const categoryInputSchema: z.ZodObject<{
3
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
4
+ name: z.ZodString;
5
+ slug: z.ZodString;
6
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
7
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
8
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
9
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
10
+ displayOrder: z.ZodDefault<z.ZodNumber>;
11
+ isActive: z.ZodDefault<z.ZodBoolean>;
12
+ }, "strict", z.ZodTypeAny, {
13
+ imageUrl: string | null;
14
+ slug: string;
15
+ name: string;
16
+ description: string | null;
17
+ seoTitle: string | null;
18
+ seoDescription: string | null;
19
+ parentCategoryId: string | null;
20
+ displayOrder: number;
21
+ isActive: boolean;
22
+ }, {
23
+ slug: string;
24
+ name: string;
25
+ imageUrl?: string | null | undefined;
26
+ description?: string | null | undefined;
27
+ seoTitle?: string | null | undefined;
28
+ seoDescription?: string | null | undefined;
29
+ parentCategoryId?: string | null | undefined;
30
+ displayOrder?: number | undefined;
31
+ isActive?: boolean | undefined;
32
+ }>;
33
+ export declare const categoryPatchSchema: z.ZodObject<{
34
+ parentCategoryId: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
35
+ name: z.ZodOptional<z.ZodString>;
36
+ slug: z.ZodOptional<z.ZodString>;
37
+ description: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
38
+ imageUrl: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
39
+ seoTitle: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
40
+ seoDescription: z.ZodOptional<z.ZodDefault<z.ZodNullable<z.ZodString>>>;
41
+ displayOrder: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
42
+ isActive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
43
+ }, "strict", z.ZodTypeAny, {
44
+ imageUrl?: string | null | undefined;
45
+ slug?: string | undefined;
46
+ name?: string | undefined;
47
+ description?: string | null | undefined;
48
+ seoTitle?: string | null | undefined;
49
+ seoDescription?: string | null | undefined;
50
+ parentCategoryId?: string | null | undefined;
51
+ displayOrder?: number | undefined;
52
+ isActive?: boolean | undefined;
53
+ }, {
54
+ imageUrl?: string | null | undefined;
55
+ slug?: string | undefined;
56
+ name?: string | undefined;
57
+ description?: string | null | undefined;
58
+ seoTitle?: string | null | undefined;
59
+ seoDescription?: string | null | undefined;
60
+ parentCategoryId?: string | null | undefined;
61
+ displayOrder?: number | undefined;
62
+ isActive?: boolean | undefined;
63
+ }>;
64
+ export declare const categorySchema: z.ZodObject<{
65
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
66
+ name: z.ZodString;
67
+ slug: z.ZodString;
68
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
69
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
70
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
71
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
72
+ displayOrder: z.ZodDefault<z.ZodNumber>;
73
+ isActive: z.ZodDefault<z.ZodBoolean>;
74
+ } & {
75
+ id: z.ZodString;
76
+ createdAt: z.ZodString;
77
+ updatedAt: z.ZodString;
78
+ }, "strict", z.ZodTypeAny, {
79
+ id: string;
80
+ imageUrl: string | null;
81
+ slug: string;
82
+ name: string;
83
+ description: string | null;
84
+ seoTitle: string | null;
85
+ seoDescription: string | null;
86
+ createdAt: string;
87
+ updatedAt: string;
88
+ parentCategoryId: string | null;
89
+ displayOrder: number;
90
+ isActive: boolean;
91
+ }, {
92
+ id: string;
93
+ slug: string;
94
+ name: string;
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ imageUrl?: string | null | undefined;
98
+ description?: string | null | undefined;
99
+ seoTitle?: string | null | undefined;
100
+ seoDescription?: string | null | undefined;
101
+ parentCategoryId?: string | null | undefined;
102
+ displayOrder?: number | undefined;
103
+ isActive?: boolean | undefined;
104
+ }>;
105
+ export declare const categoryTreeSchema: z.ZodObject<{
106
+ items: z.ZodArray<z.ZodObject<{
107
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
108
+ name: z.ZodString;
109
+ slug: z.ZodString;
110
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
111
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
112
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
113
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
114
+ displayOrder: z.ZodDefault<z.ZodNumber>;
115
+ isActive: z.ZodDefault<z.ZodBoolean>;
116
+ } & {
117
+ id: z.ZodString;
118
+ createdAt: z.ZodString;
119
+ updatedAt: z.ZodString;
120
+ }, "strict", z.ZodTypeAny, {
121
+ id: string;
122
+ imageUrl: string | null;
123
+ slug: string;
124
+ name: string;
125
+ description: string | null;
126
+ seoTitle: string | null;
127
+ seoDescription: string | null;
128
+ createdAt: string;
129
+ updatedAt: string;
130
+ parentCategoryId: string | null;
131
+ displayOrder: number;
132
+ isActive: boolean;
133
+ }, {
134
+ id: string;
135
+ slug: string;
136
+ name: string;
137
+ createdAt: string;
138
+ updatedAt: string;
139
+ imageUrl?: string | null | undefined;
140
+ description?: string | null | undefined;
141
+ seoTitle?: string | null | undefined;
142
+ seoDescription?: string | null | undefined;
143
+ parentCategoryId?: string | null | undefined;
144
+ displayOrder?: number | undefined;
145
+ isActive?: boolean | undefined;
146
+ }>, "many">;
147
+ }, "strict", z.ZodTypeAny, {
148
+ items: {
149
+ id: string;
150
+ imageUrl: string | null;
151
+ slug: string;
152
+ name: string;
153
+ description: string | null;
154
+ seoTitle: string | null;
155
+ seoDescription: string | null;
156
+ createdAt: string;
157
+ updatedAt: string;
158
+ parentCategoryId: string | null;
159
+ displayOrder: number;
160
+ isActive: boolean;
161
+ }[];
162
+ }, {
163
+ items: {
164
+ id: string;
165
+ slug: string;
166
+ name: string;
167
+ createdAt: string;
168
+ updatedAt: string;
169
+ imageUrl?: string | null | undefined;
170
+ description?: string | null | undefined;
171
+ seoTitle?: string | null | undefined;
172
+ seoDescription?: string | null | undefined;
173
+ parentCategoryId?: string | null | undefined;
174
+ displayOrder?: number | undefined;
175
+ isActive?: boolean | undefined;
176
+ }[];
177
+ }>;
178
+ export declare const categoryDetailSchema: z.ZodObject<{
179
+ category: z.ZodObject<{
180
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
181
+ name: z.ZodString;
182
+ slug: z.ZodString;
183
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
184
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
185
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
186
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
187
+ displayOrder: z.ZodDefault<z.ZodNumber>;
188
+ isActive: z.ZodDefault<z.ZodBoolean>;
189
+ } & {
190
+ id: z.ZodString;
191
+ createdAt: z.ZodString;
192
+ updatedAt: z.ZodString;
193
+ }, "strict", z.ZodTypeAny, {
194
+ id: string;
195
+ imageUrl: string | null;
196
+ slug: string;
197
+ name: string;
198
+ description: string | null;
199
+ seoTitle: string | null;
200
+ seoDescription: string | null;
201
+ createdAt: string;
202
+ updatedAt: string;
203
+ parentCategoryId: string | null;
204
+ displayOrder: number;
205
+ isActive: boolean;
206
+ }, {
207
+ id: string;
208
+ slug: string;
209
+ name: string;
210
+ createdAt: string;
211
+ updatedAt: string;
212
+ imageUrl?: string | null | undefined;
213
+ description?: string | null | undefined;
214
+ seoTitle?: string | null | undefined;
215
+ seoDescription?: string | null | undefined;
216
+ parentCategoryId?: string | null | undefined;
217
+ displayOrder?: number | undefined;
218
+ isActive?: boolean | undefined;
219
+ }>;
220
+ breadcrumbs: z.ZodArray<z.ZodObject<{
221
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
222
+ name: z.ZodString;
223
+ slug: z.ZodString;
224
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
225
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
226
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
227
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
228
+ displayOrder: z.ZodDefault<z.ZodNumber>;
229
+ isActive: z.ZodDefault<z.ZodBoolean>;
230
+ } & {
231
+ id: z.ZodString;
232
+ createdAt: z.ZodString;
233
+ updatedAt: z.ZodString;
234
+ }, "strict", z.ZodTypeAny, {
235
+ id: string;
236
+ imageUrl: string | null;
237
+ slug: string;
238
+ name: string;
239
+ description: string | null;
240
+ seoTitle: string | null;
241
+ seoDescription: string | null;
242
+ createdAt: string;
243
+ updatedAt: string;
244
+ parentCategoryId: string | null;
245
+ displayOrder: number;
246
+ isActive: boolean;
247
+ }, {
248
+ id: string;
249
+ slug: string;
250
+ name: string;
251
+ createdAt: string;
252
+ updatedAt: string;
253
+ imageUrl?: string | null | undefined;
254
+ description?: string | null | undefined;
255
+ seoTitle?: string | null | undefined;
256
+ seoDescription?: string | null | undefined;
257
+ parentCategoryId?: string | null | undefined;
258
+ displayOrder?: number | undefined;
259
+ isActive?: boolean | undefined;
260
+ }>, "many">;
261
+ }, "strict", z.ZodTypeAny, {
262
+ category: {
263
+ id: string;
264
+ imageUrl: string | null;
265
+ slug: string;
266
+ name: string;
267
+ description: string | null;
268
+ seoTitle: string | null;
269
+ seoDescription: string | null;
270
+ createdAt: string;
271
+ updatedAt: string;
272
+ parentCategoryId: string | null;
273
+ displayOrder: number;
274
+ isActive: boolean;
275
+ };
276
+ breadcrumbs: {
277
+ id: string;
278
+ imageUrl: string | null;
279
+ slug: string;
280
+ name: string;
281
+ description: string | null;
282
+ seoTitle: string | null;
283
+ seoDescription: string | null;
284
+ createdAt: string;
285
+ updatedAt: string;
286
+ parentCategoryId: string | null;
287
+ displayOrder: number;
288
+ isActive: boolean;
289
+ }[];
290
+ }, {
291
+ category: {
292
+ id: string;
293
+ slug: string;
294
+ name: string;
295
+ createdAt: string;
296
+ updatedAt: string;
297
+ imageUrl?: string | null | undefined;
298
+ description?: string | null | undefined;
299
+ seoTitle?: string | null | undefined;
300
+ seoDescription?: string | null | undefined;
301
+ parentCategoryId?: string | null | undefined;
302
+ displayOrder?: number | undefined;
303
+ isActive?: boolean | undefined;
304
+ };
305
+ breadcrumbs: {
306
+ id: string;
307
+ slug: string;
308
+ name: string;
309
+ createdAt: string;
310
+ updatedAt: string;
311
+ imageUrl?: string | null | undefined;
312
+ description?: string | null | undefined;
313
+ seoTitle?: string | null | undefined;
314
+ seoDescription?: string | null | undefined;
315
+ parentCategoryId?: string | null | undefined;
316
+ displayOrder?: number | undefined;
317
+ isActive?: boolean | undefined;
318
+ }[];
319
+ }>;
320
+ export declare const categoryListSchema: z.ZodObject<{
321
+ items: z.ZodArray<z.ZodObject<{
322
+ parentCategoryId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
323
+ name: z.ZodString;
324
+ slug: z.ZodString;
325
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
326
+ imageUrl: z.ZodDefault<z.ZodNullable<z.ZodString>>;
327
+ seoTitle: z.ZodDefault<z.ZodNullable<z.ZodString>>;
328
+ seoDescription: z.ZodDefault<z.ZodNullable<z.ZodString>>;
329
+ displayOrder: z.ZodDefault<z.ZodNumber>;
330
+ isActive: z.ZodDefault<z.ZodBoolean>;
331
+ } & {
332
+ id: z.ZodString;
333
+ createdAt: z.ZodString;
334
+ updatedAt: z.ZodString;
335
+ }, "strict", z.ZodTypeAny, {
336
+ id: string;
337
+ imageUrl: string | null;
338
+ slug: string;
339
+ name: string;
340
+ description: string | null;
341
+ seoTitle: string | null;
342
+ seoDescription: string | null;
343
+ createdAt: string;
344
+ updatedAt: string;
345
+ parentCategoryId: string | null;
346
+ displayOrder: number;
347
+ isActive: boolean;
348
+ }, {
349
+ id: string;
350
+ slug: string;
351
+ name: string;
352
+ createdAt: string;
353
+ updatedAt: string;
354
+ imageUrl?: string | null | undefined;
355
+ description?: string | null | undefined;
356
+ seoTitle?: string | null | undefined;
357
+ seoDescription?: string | null | undefined;
358
+ parentCategoryId?: string | null | undefined;
359
+ displayOrder?: number | undefined;
360
+ isActive?: boolean | undefined;
361
+ }>, "many">;
362
+ } & {
363
+ total: z.ZodNumber;
364
+ page: z.ZodNumber;
365
+ pageSize: z.ZodNumber;
366
+ }, "strict", z.ZodTypeAny, {
367
+ items: {
368
+ id: string;
369
+ imageUrl: string | null;
370
+ slug: string;
371
+ name: string;
372
+ description: string | null;
373
+ seoTitle: string | null;
374
+ seoDescription: string | null;
375
+ createdAt: string;
376
+ updatedAt: string;
377
+ parentCategoryId: string | null;
378
+ displayOrder: number;
379
+ isActive: boolean;
380
+ }[];
381
+ total: number;
382
+ page: number;
383
+ pageSize: number;
384
+ }, {
385
+ items: {
386
+ id: string;
387
+ slug: string;
388
+ name: string;
389
+ createdAt: string;
390
+ updatedAt: string;
391
+ imageUrl?: string | null | undefined;
392
+ description?: string | null | undefined;
393
+ seoTitle?: string | null | undefined;
394
+ seoDescription?: string | null | undefined;
395
+ parentCategoryId?: string | null | undefined;
396
+ displayOrder?: number | undefined;
397
+ isActive?: boolean | undefined;
398
+ }[];
399
+ total: number;
400
+ page: number;
401
+ pageSize: number;
402
+ }>;
403
+ export type Category = z.infer<typeof categorySchema>;
404
+ export type CategoryInput = z.infer<typeof categoryInputSchema>;
405
+ export type CategoryPatch = z.infer<typeof categoryPatchSchema>;
406
+ export type CategoryDetail = z.infer<typeof categoryDetailSchema>;
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ const nullableText = (max) => z.string().trim().max(max).nullable();
3
+ export const categoryInputSchema = z
4
+ .object({
5
+ parentCategoryId: z.string().min(1).max(120).nullable().default(null),
6
+ name: z.string().trim().min(1).max(200),
7
+ slug: z
8
+ .string()
9
+ .trim()
10
+ .min(1)
11
+ .max(180)
12
+ .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/),
13
+ description: nullableText(5000).default(null),
14
+ imageUrl: z
15
+ .string()
16
+ .url()
17
+ .max(2048)
18
+ .regex(/^https?:\/\//)
19
+ .nullable()
20
+ .default(null),
21
+ seoTitle: nullableText(200).default(null),
22
+ seoDescription: nullableText(500).default(null),
23
+ displayOrder: z.number().int().min(0).max(2147483647).default(0),
24
+ isActive: z.boolean().default(true),
25
+ })
26
+ .strict();
27
+ export const categoryPatchSchema = categoryInputSchema.partial().strict();
28
+ export const categorySchema = categoryInputSchema
29
+ .extend({
30
+ id: z.string().min(1).max(120),
31
+ createdAt: z.string().datetime(),
32
+ updatedAt: z.string().datetime(),
33
+ })
34
+ .strict();
35
+ export const categoryTreeSchema = z
36
+ .object({ items: z.array(categorySchema).max(10000) })
37
+ .strict();
38
+ export const categoryDetailSchema = z
39
+ .object({
40
+ category: categorySchema,
41
+ breadcrumbs: z.array(categorySchema),
42
+ })
43
+ .strict();
44
+ export const categoryListSchema = categoryTreeSchema.extend({
45
+ total: z.number().int().nonnegative(),
46
+ page: z.number().int().positive(),
47
+ pageSize: z.number().int().positive().max(100),
48
+ });
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ export declare const bankInstructionsSchema: z.ZodObject<{
3
+ bankName: z.ZodString;
4
+ accountTitle: z.ZodString;
5
+ accountNumber: z.ZodString;
6
+ instructions: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ bankName: string;
9
+ accountTitle: string;
10
+ accountNumber: string;
11
+ instructions: string;
12
+ }, {
13
+ bankName: string;
14
+ accountTitle: string;
15
+ accountNumber: string;
16
+ instructions: string;
17
+ }>;
18
+ export declare const checkoutConfigSchema: z.ZodEffects<z.ZodObject<{
19
+ paymentMethods: z.ZodArray<z.ZodEnum<["cod", "bank-transfer"]>, "many">;
20
+ bankTransfer: z.ZodNullable<z.ZodObject<{
21
+ bankName: z.ZodString;
22
+ accountTitle: z.ZodString;
23
+ accountNumber: z.ZodString;
24
+ instructions: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ bankName: string;
27
+ accountTitle: string;
28
+ accountNumber: string;
29
+ instructions: string;
30
+ }, {
31
+ bankName: string;
32
+ accountTitle: string;
33
+ accountNumber: string;
34
+ instructions: string;
35
+ }>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ paymentMethods: ("cod" | "bank-transfer")[];
38
+ bankTransfer: {
39
+ bankName: string;
40
+ accountTitle: string;
41
+ accountNumber: string;
42
+ instructions: string;
43
+ } | null;
44
+ }, {
45
+ paymentMethods: ("cod" | "bank-transfer")[];
46
+ bankTransfer: {
47
+ bankName: string;
48
+ accountTitle: string;
49
+ accountNumber: string;
50
+ instructions: string;
51
+ } | null;
52
+ }>, {
53
+ paymentMethods: ("cod" | "bank-transfer")[];
54
+ bankTransfer: {
55
+ bankName: string;
56
+ accountTitle: string;
57
+ accountNumber: string;
58
+ instructions: string;
59
+ } | null;
60
+ }, {
61
+ paymentMethods: ("cod" | "bank-transfer")[];
62
+ bankTransfer: {
63
+ bankName: string;
64
+ accountTitle: string;
65
+ accountNumber: string;
66
+ instructions: string;
67
+ } | null;
68
+ }>;
69
+ export type CheckoutConfig = z.infer<typeof checkoutConfigSchema>;