@vedhae/cms-schema 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/README.md +11 -0
- package/dist/hero.schema.d.ts +21 -0
- package/dist/hero.schema.js +17 -0
- package/dist/image.schema.d.ts +11 -0
- package/dist/image.schema.js +10 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/dist/shopByCategory.schema.d.ts +28 -0
- package/dist/shopByCategory.schema.js +15 -0
- package/dist/shopByPerson.schema.d.ts +28 -0
- package/dist/shopByPerson.schema.js +15 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical Hero CMS shape
|
|
4
|
+
* This is what admin, worker, frontend agree on
|
|
5
|
+
*/
|
|
6
|
+
export declare const HeroSchema: z.ZodObject<{
|
|
7
|
+
page: z.ZodLiteral<"home">;
|
|
8
|
+
section: z.ZodLiteral<"hero">;
|
|
9
|
+
active: z.ZodBoolean;
|
|
10
|
+
tagline: z.ZodString;
|
|
11
|
+
title: z.ZodString;
|
|
12
|
+
description: z.ZodOptional<z.ZodString>;
|
|
13
|
+
ctaText: z.ZodString;
|
|
14
|
+
ctaLink: z.ZodString;
|
|
15
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
url: z.ZodString;
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
alt: z.ZodString;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type HeroSection = z.infer<typeof HeroSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ImageAssetSchema } from "./image.schema";
|
|
3
|
+
/**
|
|
4
|
+
* Canonical Hero CMS shape
|
|
5
|
+
* This is what admin, worker, frontend agree on
|
|
6
|
+
*/
|
|
7
|
+
export const HeroSchema = z.object({
|
|
8
|
+
page: z.literal("home"),
|
|
9
|
+
section: z.literal("hero"),
|
|
10
|
+
active: z.boolean(),
|
|
11
|
+
tagline: z.string().min(1),
|
|
12
|
+
title: z.string().min(1),
|
|
13
|
+
description: z.string().optional(),
|
|
14
|
+
ctaText: z.string().min(1),
|
|
15
|
+
ctaLink: z.string().min(1),
|
|
16
|
+
image: ImageAssetSchema.optional(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Shared image asset definition
|
|
4
|
+
* Used across all CMS sections
|
|
5
|
+
*/
|
|
6
|
+
export declare const ImageAssetSchema: z.ZodObject<{
|
|
7
|
+
url: z.ZodString;
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
alt: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ImageAsset = z.infer<typeof ImageAssetSchema>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ImageAssetSchema } from "./image.schema";
|
|
2
|
+
export { HeroSchema } from "./hero.schema";
|
|
3
|
+
export { ShopByCategorySchema } from "./shopByCategory.schema";
|
|
4
|
+
export { ShopByPersonSchema } from "./shopByPerson.schema";
|
|
5
|
+
export type { ImageAsset } from "./image.schema";
|
|
6
|
+
export type { HeroSection } from "./hero.schema";
|
|
7
|
+
export type { ShopByCategorySection } from "./shopByCategory.schema";
|
|
8
|
+
export type { ShopByPersonSection } from "./shopByPerson.schema";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ShopByCategoryItemSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
link: z.ZodString;
|
|
5
|
+
order: z.ZodNumber;
|
|
6
|
+
image: z.ZodObject<{
|
|
7
|
+
url: z.ZodString;
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
alt: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const ShopByCategorySchema: z.ZodObject<{
|
|
13
|
+
page: z.ZodLiteral<"home">;
|
|
14
|
+
section: z.ZodLiteral<"shopByCategory">;
|
|
15
|
+
active: z.ZodBoolean;
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
categories: z.ZodArray<z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
link: z.ZodString;
|
|
20
|
+
order: z.ZodNumber;
|
|
21
|
+
image: z.ZodObject<{
|
|
22
|
+
url: z.ZodString;
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
alt: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type ShopByCategorySection = z.infer<typeof ShopByCategorySchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ImageAssetSchema } from "./image.schema";
|
|
3
|
+
export const ShopByCategoryItemSchema = z.object({
|
|
4
|
+
name: z.string().min(1),
|
|
5
|
+
link: z.string().min(1),
|
|
6
|
+
order: z.number().int(),
|
|
7
|
+
image: ImageAssetSchema,
|
|
8
|
+
});
|
|
9
|
+
export const ShopByCategorySchema = z.object({
|
|
10
|
+
page: z.literal("home"),
|
|
11
|
+
section: z.literal("shopByCategory"),
|
|
12
|
+
active: z.boolean(),
|
|
13
|
+
title: z.string().min(1),
|
|
14
|
+
categories: z.array(ShopByCategoryItemSchema),
|
|
15
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ShopByPersonItemSchema: z.ZodObject<{
|
|
3
|
+
label: z.ZodString;
|
|
4
|
+
link: z.ZodString;
|
|
5
|
+
order: z.ZodNumber;
|
|
6
|
+
image: z.ZodObject<{
|
|
7
|
+
url: z.ZodString;
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
alt: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const ShopByPersonSchema: z.ZodObject<{
|
|
13
|
+
page: z.ZodLiteral<"home">;
|
|
14
|
+
section: z.ZodLiteral<"shopByPerson">;
|
|
15
|
+
active: z.ZodBoolean;
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
cards: z.ZodArray<z.ZodObject<{
|
|
18
|
+
label: z.ZodString;
|
|
19
|
+
link: z.ZodString;
|
|
20
|
+
order: z.ZodNumber;
|
|
21
|
+
image: z.ZodObject<{
|
|
22
|
+
url: z.ZodString;
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
alt: z.ZodString;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type ShopByPersonSection = z.infer<typeof ShopByPersonSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ImageAssetSchema } from "./image.schema";
|
|
3
|
+
export const ShopByPersonItemSchema = z.object({
|
|
4
|
+
label: z.string().min(1),
|
|
5
|
+
link: z.string().min(1),
|
|
6
|
+
order: z.number().int(),
|
|
7
|
+
image: ImageAssetSchema,
|
|
8
|
+
});
|
|
9
|
+
export const ShopByPersonSchema = z.object({
|
|
10
|
+
page: z.literal("home"),
|
|
11
|
+
section: z.literal("shopByPerson"),
|
|
12
|
+
active: z.boolean(),
|
|
13
|
+
title: z.string().min(1),
|
|
14
|
+
cards: z.array(ShopByPersonItemSchema),
|
|
15
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vedhae/cms-schema",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"zod": "^3.23.8"
|
|
21
|
+
}
|
|
22
|
+
}
|