@vedhae/cms-schema 4.2.1 → 4.2.3
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/about.schema.d.ts +40 -0
- package/dist/about.schema.js +16 -0
- package/dist/cardSection.schema.d.ts +12 -12
- package/dist/hero.schema.d.ts +6 -6
- package/dist/image.schema.d.ts +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -1
- package/dist/product.meta.d.ts +43 -0
- package/dist/product.meta.js +58 -0
- package/dist/product.schema.d.ts +20 -24
- package/dist/product.schema.js +3 -10
- package/dist/productHero.schema.d.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AboutHeroSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
title: string;
|
|
6
|
+
}, {
|
|
7
|
+
title: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type AboutHero = z.infer<typeof AboutHeroSchema>;
|
|
10
|
+
export declare const AboutContentSchema: z.ZodObject<{
|
|
11
|
+
paragraphs: z.ZodArray<z.ZodString, "many">;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
paragraphs: string[];
|
|
14
|
+
}, {
|
|
15
|
+
paragraphs: string[];
|
|
16
|
+
}>;
|
|
17
|
+
export type AboutContent = z.infer<typeof AboutContentSchema>;
|
|
18
|
+
export declare const AboutImagesSchema: z.ZodObject<{
|
|
19
|
+
images: z.ZodArray<z.ZodObject<{
|
|
20
|
+
url: z.ZodString;
|
|
21
|
+
alt: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
url: string;
|
|
24
|
+
alt: string;
|
|
25
|
+
}, {
|
|
26
|
+
url: string;
|
|
27
|
+
alt: string;
|
|
28
|
+
}>, "many">;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
images: {
|
|
31
|
+
url: string;
|
|
32
|
+
alt: string;
|
|
33
|
+
}[];
|
|
34
|
+
}, {
|
|
35
|
+
images: {
|
|
36
|
+
url: string;
|
|
37
|
+
alt: string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
export type AboutImages = z.infer<typeof AboutImagesSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/* =========================
|
|
3
|
+
ABOUT PAGE
|
|
4
|
+
========================= */
|
|
5
|
+
export const AboutHeroSchema = z.object({
|
|
6
|
+
title: z.string(),
|
|
7
|
+
});
|
|
8
|
+
export const AboutContentSchema = z.object({
|
|
9
|
+
paragraphs: z.array(z.string()),
|
|
10
|
+
});
|
|
11
|
+
export const AboutImagesSchema = z.object({
|
|
12
|
+
images: z.array(z.object({
|
|
13
|
+
url: z.string().url(),
|
|
14
|
+
alt: z.string(),
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
@@ -8,12 +8,12 @@ export declare const CardItemSchema: z.ZodObject<{
|
|
|
8
8
|
path: z.ZodString;
|
|
9
9
|
alt: z.ZodString;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
url: string;
|
|
12
11
|
path: string;
|
|
12
|
+
url: string;
|
|
13
13
|
alt: string;
|
|
14
14
|
}, {
|
|
15
|
-
url: string;
|
|
16
15
|
path: string;
|
|
16
|
+
url: string;
|
|
17
17
|
alt: string;
|
|
18
18
|
}>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -21,8 +21,8 @@ export declare const CardItemSchema: z.ZodObject<{
|
|
|
21
21
|
link: string;
|
|
22
22
|
order: number;
|
|
23
23
|
image: {
|
|
24
|
-
url: string;
|
|
25
24
|
path: string;
|
|
25
|
+
url: string;
|
|
26
26
|
alt: string;
|
|
27
27
|
};
|
|
28
28
|
}, {
|
|
@@ -30,8 +30,8 @@ export declare const CardItemSchema: z.ZodObject<{
|
|
|
30
30
|
link: string;
|
|
31
31
|
order: number;
|
|
32
32
|
image: {
|
|
33
|
-
url: string;
|
|
34
33
|
path: string;
|
|
34
|
+
url: string;
|
|
35
35
|
alt: string;
|
|
36
36
|
};
|
|
37
37
|
}>;
|
|
@@ -50,12 +50,12 @@ export declare const CardSectionSchema: z.ZodObject<{
|
|
|
50
50
|
path: z.ZodString;
|
|
51
51
|
alt: z.ZodString;
|
|
52
52
|
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
url: string;
|
|
54
53
|
path: string;
|
|
54
|
+
url: string;
|
|
55
55
|
alt: string;
|
|
56
56
|
}, {
|
|
57
|
-
url: string;
|
|
58
57
|
path: string;
|
|
58
|
+
url: string;
|
|
59
59
|
alt: string;
|
|
60
60
|
}>;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -63,8 +63,8 @@ export declare const CardSectionSchema: z.ZodObject<{
|
|
|
63
63
|
link: string;
|
|
64
64
|
order: number;
|
|
65
65
|
image: {
|
|
66
|
-
url: string;
|
|
67
66
|
path: string;
|
|
67
|
+
url: string;
|
|
68
68
|
alt: string;
|
|
69
69
|
};
|
|
70
70
|
}, {
|
|
@@ -72,40 +72,40 @@ export declare const CardSectionSchema: z.ZodObject<{
|
|
|
72
72
|
link: string;
|
|
73
73
|
order: number;
|
|
74
74
|
image: {
|
|
75
|
-
url: string;
|
|
76
75
|
path: string;
|
|
76
|
+
url: string;
|
|
77
77
|
alt: string;
|
|
78
78
|
};
|
|
79
79
|
}>, "many">;
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
title: string;
|
|
81
82
|
order: number;
|
|
82
83
|
page: "home";
|
|
83
84
|
section: "one" | "two";
|
|
84
|
-
title: string;
|
|
85
85
|
active: boolean;
|
|
86
86
|
items: {
|
|
87
87
|
name: string;
|
|
88
88
|
link: string;
|
|
89
89
|
order: number;
|
|
90
90
|
image: {
|
|
91
|
-
url: string;
|
|
92
91
|
path: string;
|
|
92
|
+
url: string;
|
|
93
93
|
alt: string;
|
|
94
94
|
};
|
|
95
95
|
}[];
|
|
96
96
|
}, {
|
|
97
|
+
title: string;
|
|
97
98
|
order: number;
|
|
98
99
|
page: "home";
|
|
99
100
|
section: "one" | "two";
|
|
100
|
-
title: string;
|
|
101
101
|
active: boolean;
|
|
102
102
|
items: {
|
|
103
103
|
name: string;
|
|
104
104
|
link: string;
|
|
105
105
|
order: number;
|
|
106
106
|
image: {
|
|
107
|
-
url: string;
|
|
108
107
|
path: string;
|
|
108
|
+
url: string;
|
|
109
109
|
alt: string;
|
|
110
110
|
};
|
|
111
111
|
}[];
|
package/dist/hero.schema.d.ts
CHANGED
|
@@ -13,39 +13,39 @@ export declare const HeroSectionSchema: z.ZodObject<{
|
|
|
13
13
|
path: z.ZodString;
|
|
14
14
|
alt: z.ZodString;
|
|
15
15
|
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
url: string;
|
|
17
16
|
path: string;
|
|
17
|
+
url: string;
|
|
18
18
|
alt: string;
|
|
19
19
|
}, {
|
|
20
|
-
url: string;
|
|
21
20
|
path: string;
|
|
21
|
+
url: string;
|
|
22
22
|
alt: string;
|
|
23
23
|
}>>;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
title: string;
|
|
25
26
|
page: "home";
|
|
26
27
|
section: "hero";
|
|
27
|
-
title: string;
|
|
28
28
|
active: boolean;
|
|
29
29
|
tagline: string;
|
|
30
30
|
ctaText: string;
|
|
31
31
|
ctaLink: string;
|
|
32
32
|
image?: {
|
|
33
|
-
url: string;
|
|
34
33
|
path: string;
|
|
34
|
+
url: string;
|
|
35
35
|
alt: string;
|
|
36
36
|
} | undefined;
|
|
37
37
|
description?: string | undefined;
|
|
38
38
|
}, {
|
|
39
|
+
title: string;
|
|
39
40
|
page: "home";
|
|
40
41
|
section: "hero";
|
|
41
|
-
title: string;
|
|
42
42
|
active: boolean;
|
|
43
43
|
tagline: string;
|
|
44
44
|
ctaText: string;
|
|
45
45
|
ctaLink: string;
|
|
46
46
|
image?: {
|
|
47
|
-
url: string;
|
|
48
47
|
path: string;
|
|
48
|
+
url: string;
|
|
49
49
|
alt: string;
|
|
50
50
|
} | undefined;
|
|
51
51
|
description?: string | undefined;
|
package/dist/image.schema.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ export declare const ImageAssetSchema: z.ZodObject<{
|
|
|
4
4
|
path: z.ZodString;
|
|
5
5
|
alt: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
url: string;
|
|
8
7
|
path: string;
|
|
8
|
+
url: string;
|
|
9
9
|
alt: string;
|
|
10
10
|
}, {
|
|
11
|
-
url: string;
|
|
12
11
|
path: string;
|
|
12
|
+
url: string;
|
|
13
13
|
alt: string;
|
|
14
14
|
}>;
|
|
15
15
|
export type ImageAsset = z.infer<typeof ImageAssetSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,12 @@ export { HeroSectionSchema } from "./hero.schema.js";
|
|
|
3
3
|
export { CardSectionSchema } from "./cardSection.schema.js";
|
|
4
4
|
export { ProductSchema } from "./product.schema.js";
|
|
5
5
|
export { ProductHeroSchema } from "./productHero.schema.js";
|
|
6
|
+
export { ProductCategorySchema, ProductUserSchema, ProductRouteSchema, } from "./product.meta.js";
|
|
7
|
+
export { AboutHeroSchema, AboutContentSchema, AboutImagesSchema, } from "./about.schema.js";
|
|
6
8
|
export type { ImageAsset } from "./image.schema.js";
|
|
7
9
|
export type { HeroSection } from "./hero.schema.js";
|
|
8
10
|
export type { CardSection } from "./cardSection.schema.js";
|
|
9
11
|
export type { Product } from "./product.schema.js";
|
|
10
12
|
export type { ProductHero } from "./productHero.schema.js";
|
|
13
|
+
export type { ProductCategory, ProductUser, ProductRoute, RouteConfig, } from "./product.meta.js";
|
|
14
|
+
export type { AboutHero, AboutContent, AboutImages, } from "./about.schema.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/* ======================================================
|
|
2
|
+
SCHEMAS
|
|
3
|
+
====================================================== */
|
|
4
|
+
// Core
|
|
2
5
|
export { ImageAssetSchema } from "./image.schema.js";
|
|
3
6
|
export { HeroSectionSchema } from "./hero.schema.js";
|
|
4
7
|
export { CardSectionSchema } from "./cardSection.schema.js";
|
|
8
|
+
// Products
|
|
5
9
|
export { ProductSchema } from "./product.schema.js";
|
|
6
10
|
export { ProductHeroSchema } from "./productHero.schema.js";
|
|
11
|
+
// Product meta (ROUTES / CATEGORIES / USERS)
|
|
12
|
+
export { ProductCategorySchema, ProductUserSchema, ProductRouteSchema, } from "./product.meta.js";
|
|
13
|
+
// About
|
|
14
|
+
export { AboutHeroSchema, AboutContentSchema, AboutImagesSchema, } from "./about.schema.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Categories represent *where* a product belongs
|
|
4
|
+
* Example routes:
|
|
5
|
+
* /products/body
|
|
6
|
+
* /products/face-lips
|
|
7
|
+
*/
|
|
8
|
+
export declare const PRODUCT_CATEGORIES: readonly ["face", "lip", "face-lips", "body", "hair"];
|
|
9
|
+
export declare const ProductCategorySchema: z.ZodEnum<["face", "lip", "face-lips", "body", "hair"]>;
|
|
10
|
+
export type ProductCategory = z.infer<typeof ProductCategorySchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Users represent *who* the product is for
|
|
13
|
+
* Example routes:
|
|
14
|
+
* /products/men
|
|
15
|
+
* /products/women
|
|
16
|
+
* /products/kids
|
|
17
|
+
*/
|
|
18
|
+
export declare const PRODUCT_USERS: readonly ["men", "women", "kids", "adults", "teens"];
|
|
19
|
+
export declare const ProductUserSchema: z.ZodEnum<["men", "women", "kids", "adults", "teens"]>;
|
|
20
|
+
export type ProductUser = z.infer<typeof ProductUserSchema>;
|
|
21
|
+
/**
|
|
22
|
+
* These are the ONLY allowed product listing routes
|
|
23
|
+
* Used by:
|
|
24
|
+
* - Astro getStaticPaths
|
|
25
|
+
* - Admin routing
|
|
26
|
+
* - Worker validation
|
|
27
|
+
*/
|
|
28
|
+
export declare const PRODUCT_ROUTES: readonly ["face-lips", "body", "hair", "men", "women", "kids"];
|
|
29
|
+
export declare const ProductRouteSchema: z.ZodEnum<["face-lips", "body", "hair", "men", "women", "kids"]>;
|
|
30
|
+
export type ProductRoute = z.infer<typeof ProductRouteSchema>;
|
|
31
|
+
/**
|
|
32
|
+
* Shared route config shape
|
|
33
|
+
* Used by website to map routes → filters
|
|
34
|
+
*/
|
|
35
|
+
export type RouteConfig = {
|
|
36
|
+
type: "category";
|
|
37
|
+
values: ProductCategory[];
|
|
38
|
+
title: string;
|
|
39
|
+
} | {
|
|
40
|
+
type: "user";
|
|
41
|
+
values: ProductUser[];
|
|
42
|
+
title: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/* =========================================================
|
|
3
|
+
PRODUCT CATEGORIES
|
|
4
|
+
(used for category pages, filtering, hero selection)
|
|
5
|
+
========================================================= */
|
|
6
|
+
/**
|
|
7
|
+
* Categories represent *where* a product belongs
|
|
8
|
+
* Example routes:
|
|
9
|
+
* /products/body
|
|
10
|
+
* /products/face-lips
|
|
11
|
+
*/
|
|
12
|
+
export const PRODUCT_CATEGORIES = [
|
|
13
|
+
"face",
|
|
14
|
+
"lip",
|
|
15
|
+
"face-lips",
|
|
16
|
+
"body",
|
|
17
|
+
"hair",
|
|
18
|
+
];
|
|
19
|
+
export const ProductCategorySchema = z.enum(PRODUCT_CATEGORIES);
|
|
20
|
+
/* =========================================================
|
|
21
|
+
PRODUCT USERS / AUDIENCE
|
|
22
|
+
(used for "Shop by Person" pages)
|
|
23
|
+
========================================================= */
|
|
24
|
+
/**
|
|
25
|
+
* Users represent *who* the product is for
|
|
26
|
+
* Example routes:
|
|
27
|
+
* /products/men
|
|
28
|
+
* /products/women
|
|
29
|
+
* /products/kids
|
|
30
|
+
*/
|
|
31
|
+
export const PRODUCT_USERS = [
|
|
32
|
+
"men",
|
|
33
|
+
"women",
|
|
34
|
+
"kids",
|
|
35
|
+
"adults",
|
|
36
|
+
"teens",
|
|
37
|
+
];
|
|
38
|
+
export const ProductUserSchema = z.enum(PRODUCT_USERS);
|
|
39
|
+
/* =========================================================
|
|
40
|
+
PRODUCT ROUTES
|
|
41
|
+
(all valid /products/:route pages)
|
|
42
|
+
========================================================= */
|
|
43
|
+
/**
|
|
44
|
+
* These are the ONLY allowed product listing routes
|
|
45
|
+
* Used by:
|
|
46
|
+
* - Astro getStaticPaths
|
|
47
|
+
* - Admin routing
|
|
48
|
+
* - Worker validation
|
|
49
|
+
*/
|
|
50
|
+
export const PRODUCT_ROUTES = [
|
|
51
|
+
"face-lips",
|
|
52
|
+
"body",
|
|
53
|
+
"hair",
|
|
54
|
+
"men",
|
|
55
|
+
"women",
|
|
56
|
+
"kids",
|
|
57
|
+
];
|
|
58
|
+
export const ProductRouteSchema = z.enum(PRODUCT_ROUTES);
|
package/dist/product.schema.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
7
7
|
title: z.ZodString;
|
|
8
8
|
titleDescription: z.ZodString;
|
|
9
9
|
size: z.ZodString;
|
|
10
|
-
users: z.ZodArray<z.
|
|
11
|
-
categories: z.ZodArray<z.
|
|
10
|
+
users: z.ZodArray<z.ZodEnum<["men", "women", "kids", "adults", "teens"]>, "many">;
|
|
11
|
+
categories: z.ZodArray<z.ZodEnum<["face", "lip", "face-lips", "body", "hair"]>, "many">;
|
|
12
12
|
internalLink: z.ZodString;
|
|
13
13
|
externalLink: z.ZodOptional<z.ZodString>;
|
|
14
14
|
price: z.ZodNumber;
|
|
@@ -20,12 +20,12 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
20
20
|
path: z.ZodString;
|
|
21
21
|
alt: z.ZodString;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
url: string;
|
|
24
23
|
path: string;
|
|
24
|
+
url: string;
|
|
25
25
|
alt: string;
|
|
26
26
|
}, {
|
|
27
|
-
url: string;
|
|
28
27
|
path: string;
|
|
28
|
+
url: string;
|
|
29
29
|
alt: string;
|
|
30
30
|
}>, "many">;
|
|
31
31
|
aboutTitle: z.ZodString;
|
|
@@ -33,31 +33,27 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
33
33
|
howToUseTitle: z.ZodString;
|
|
34
34
|
howToUseDescription: z.ZodString;
|
|
35
35
|
ingredientsTitle: z.ZodString;
|
|
36
|
-
/**
|
|
37
|
-
* Each ingredient item:
|
|
38
|
-
* [ingredientName, ingredientDescription]
|
|
39
|
-
*/
|
|
40
36
|
ingredients: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
|
|
41
37
|
active: z.ZodBoolean;
|
|
42
38
|
order: z.ZodNumber;
|
|
43
39
|
createdAt: z.ZodNumber;
|
|
44
40
|
updatedAt: z.ZodNumber;
|
|
45
41
|
}, "strip", z.ZodTypeAny, {
|
|
46
|
-
order: number;
|
|
47
42
|
title: string;
|
|
43
|
+
order: number;
|
|
48
44
|
active: boolean;
|
|
49
45
|
id: string;
|
|
50
46
|
titleDescription: string;
|
|
51
47
|
size: string;
|
|
52
|
-
users:
|
|
53
|
-
categories:
|
|
48
|
+
users: ("men" | "women" | "kids" | "adults" | "teens")[];
|
|
49
|
+
categories: ("face" | "lip" | "face-lips" | "body" | "hair")[];
|
|
54
50
|
internalLink: string;
|
|
55
51
|
price: number;
|
|
56
52
|
stockStatus: boolean;
|
|
57
53
|
stockVolume: number;
|
|
58
54
|
imageLinks: {
|
|
59
|
-
url: string;
|
|
60
55
|
path: string;
|
|
56
|
+
url: string;
|
|
61
57
|
alt: string;
|
|
62
58
|
}[];
|
|
63
59
|
aboutTitle: string;
|
|
@@ -71,21 +67,21 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
71
67
|
externalLink?: string | undefined;
|
|
72
68
|
priceSubText?: string | undefined;
|
|
73
69
|
}, {
|
|
74
|
-
order: number;
|
|
75
70
|
title: string;
|
|
71
|
+
order: number;
|
|
76
72
|
active: boolean;
|
|
77
73
|
id: string;
|
|
78
74
|
titleDescription: string;
|
|
79
75
|
size: string;
|
|
80
|
-
users:
|
|
81
|
-
categories:
|
|
76
|
+
users: ("men" | "women" | "kids" | "adults" | "teens")[];
|
|
77
|
+
categories: ("face" | "lip" | "face-lips" | "body" | "hair")[];
|
|
82
78
|
internalLink: string;
|
|
83
79
|
price: number;
|
|
84
80
|
stockStatus: boolean;
|
|
85
81
|
stockVolume: number;
|
|
86
82
|
imageLinks: {
|
|
87
|
-
url: string;
|
|
88
83
|
path: string;
|
|
84
|
+
url: string;
|
|
89
85
|
alt: string;
|
|
90
86
|
}[];
|
|
91
87
|
aboutTitle: string;
|
|
@@ -99,21 +95,21 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
99
95
|
externalLink?: string | undefined;
|
|
100
96
|
priceSubText?: string | undefined;
|
|
101
97
|
}>, {
|
|
102
|
-
order: number;
|
|
103
98
|
title: string;
|
|
99
|
+
order: number;
|
|
104
100
|
active: boolean;
|
|
105
101
|
id: string;
|
|
106
102
|
titleDescription: string;
|
|
107
103
|
size: string;
|
|
108
|
-
users:
|
|
109
|
-
categories:
|
|
104
|
+
users: ("men" | "women" | "kids" | "adults" | "teens")[];
|
|
105
|
+
categories: ("face" | "lip" | "face-lips" | "body" | "hair")[];
|
|
110
106
|
internalLink: string;
|
|
111
107
|
price: number;
|
|
112
108
|
stockStatus: boolean;
|
|
113
109
|
stockVolume: number;
|
|
114
110
|
imageLinks: {
|
|
115
|
-
url: string;
|
|
116
111
|
path: string;
|
|
112
|
+
url: string;
|
|
117
113
|
alt: string;
|
|
118
114
|
}[];
|
|
119
115
|
aboutTitle: string;
|
|
@@ -127,21 +123,21 @@ export declare const ProductSchema: z.ZodEffects<z.ZodObject<{
|
|
|
127
123
|
externalLink?: string | undefined;
|
|
128
124
|
priceSubText?: string | undefined;
|
|
129
125
|
}, {
|
|
130
|
-
order: number;
|
|
131
126
|
title: string;
|
|
127
|
+
order: number;
|
|
132
128
|
active: boolean;
|
|
133
129
|
id: string;
|
|
134
130
|
titleDescription: string;
|
|
135
131
|
size: string;
|
|
136
|
-
users:
|
|
137
|
-
categories:
|
|
132
|
+
users: ("men" | "women" | "kids" | "adults" | "teens")[];
|
|
133
|
+
categories: ("face" | "lip" | "face-lips" | "body" | "hair")[];
|
|
138
134
|
internalLink: string;
|
|
139
135
|
price: number;
|
|
140
136
|
stockStatus: boolean;
|
|
141
137
|
stockVolume: number;
|
|
142
138
|
imageLinks: {
|
|
143
|
-
url: string;
|
|
144
139
|
path: string;
|
|
140
|
+
url: string;
|
|
145
141
|
alt: string;
|
|
146
142
|
}[];
|
|
147
143
|
aboutTitle: string;
|
package/dist/product.schema.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ImageAssetSchema } from "./image.schema.js";
|
|
3
|
+
import { ProductCategorySchema, ProductUserSchema, } from "./product.meta.js";
|
|
3
4
|
/**
|
|
4
5
|
* Product schema
|
|
5
6
|
*/
|
|
@@ -15,8 +16,8 @@ export const ProductSchema = z
|
|
|
15
16
|
/* =========================
|
|
16
17
|
Audience & classification
|
|
17
18
|
========================= */
|
|
18
|
-
users: z.array(
|
|
19
|
-
categories: z.array(
|
|
19
|
+
users: z.array(ProductUserSchema).min(1),
|
|
20
|
+
categories: z.array(ProductCategorySchema).min(1),
|
|
20
21
|
/* =========================
|
|
21
22
|
Navigation
|
|
22
23
|
========================= */
|
|
@@ -41,10 +42,6 @@ export const ProductSchema = z
|
|
|
41
42
|
howToUseTitle: z.string().min(1),
|
|
42
43
|
howToUseDescription: z.string().min(1),
|
|
43
44
|
ingredientsTitle: z.string().min(1),
|
|
44
|
-
/**
|
|
45
|
-
* Each ingredient item:
|
|
46
|
-
* [ingredientName, ingredientDescription]
|
|
47
|
-
*/
|
|
48
45
|
ingredients: z.array(z.tuple([z.string(), z.string()])).min(1),
|
|
49
46
|
/* =========================
|
|
50
47
|
System fields
|
|
@@ -55,10 +52,6 @@ export const ProductSchema = z
|
|
|
55
52
|
updatedAt: z.number(),
|
|
56
53
|
})
|
|
57
54
|
.superRefine((data, ctx) => {
|
|
58
|
-
/**
|
|
59
|
-
* Enforce stock logic:
|
|
60
|
-
* If stockStatus is false, stockVolume must be 0
|
|
61
|
-
*/
|
|
62
55
|
if (data.stockStatus === false && data.stockVolume !== 0) {
|
|
63
56
|
ctx.addIssue({
|
|
64
57
|
path: ["stockVolume"],
|
|
@@ -17,18 +17,18 @@ export declare const ProductHeroSchema: z.ZodObject<{
|
|
|
17
17
|
path: z.ZodString;
|
|
18
18
|
alt: z.ZodString;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
url: string;
|
|
21
20
|
path: string;
|
|
21
|
+
url: string;
|
|
22
22
|
alt: string;
|
|
23
23
|
}, {
|
|
24
|
-
url: string;
|
|
25
24
|
path: string;
|
|
25
|
+
url: string;
|
|
26
26
|
alt: string;
|
|
27
27
|
}>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
29
|
image: {
|
|
30
|
-
url: string;
|
|
31
30
|
path: string;
|
|
31
|
+
url: string;
|
|
32
32
|
alt: string;
|
|
33
33
|
};
|
|
34
34
|
page: "products";
|
|
@@ -39,8 +39,8 @@ export declare const ProductHeroSchema: z.ZodObject<{
|
|
|
39
39
|
};
|
|
40
40
|
}, {
|
|
41
41
|
image: {
|
|
42
|
-
url: string;
|
|
43
42
|
path: string;
|
|
43
|
+
url: string;
|
|
44
44
|
alt: string;
|
|
45
45
|
};
|
|
46
46
|
page: "products";
|