-
Notifications
You must be signed in to change notification settings - Fork 23
/
types.sanity.ts
188 lines (175 loc) · 3.89 KB
/
types.sanity.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import { pick } from "./helpers/utils/object";
export const SANITY_API_VERSION = "2023-10-24";
export const SCHEMAS = {
"block.block0": "",
"block.block1": "",
"block.block10": "",
"block.block12": "",
"block.block13": "",
"block.block14": "",
"block.block15": "",
"block.block16": "",
"block.block17": "",
"block.block18": "",
"block.block2": "",
"block.block3": "",
"block.block4": "",
"block.block5": "",
"block.block7": "",
"config.cms": "",
"config.deployment": "",
"config.general": "",
"config.icons": "",
"config.integrations": "",
"config.seo": "",
"config.social": "",
"config.theme": "",
"config.translations": "",
"faq.item": "",
"page.blog": "",
"page.blogs": "",
"page.casestudies": "",
"page.casestudy": "",
"page.content": "",
"page.event": "",
"page.events": "",
"page.guide": "",
"page.guides": "",
"page.home": "",
"page.landing": "",
"page.mediacoverage": "",
"page.mediacoveragearticle": "",
"page.news": "",
"page.newsarticle": "",
"page.newsroom": "",
"page.notfound": "",
"page.podcast": "",
"page.podcasts": "",
"page.pressrelease": "",
"page.pressreleases": "",
"page.pricing": "",
"page.resources": "",
"page.search": "",
"page.sitemap": "",
"page.tag": "",
"page.tags": "",
"page.tool": "",
"page.tools": "",
"page.video": "",
"page.videos": "",
"preset.blocks": "",
"preset.button": "",
"preset.decoration": "",
"preset.theme.block": "",
"preset.theme.text": "",
"preset.theme.title": "",
"pricing.category": "",
"pricing.feature": "",
"pricing.plan": "",
"testimonials.item": "",
footer: "",
navigation: "",
password: "",
person: "",
redirect: "",
script: "",
};
export type SchemaName = keyof typeof SCHEMAS;
export const LINKABLE_SCHEMAS = pick(
SCHEMAS,
"page.blog",
"page.blogs",
"page.casestudies",
"page.casestudy",
"page.content",
"page.event",
"page.events",
"page.guide",
"page.guides",
"page.home",
"page.landing",
"page.mediacoverage",
"page.mediacoveragearticle",
"page.news",
"page.newsarticle",
"page.newsroom",
"page.podcast",
"page.podcasts",
"page.pressrelease",
"page.pressreleases",
"page.pricing",
"page.resources",
"page.search",
"page.sitemap",
"page.tag",
"page.tags",
"page.tool",
"page.tools",
"page.video",
"page.videos",
);
export type LinkableSchemaName = keyof typeof LINKABLE_SCHEMAS;
// pages we want to link to in the CMS, but are Next.js static routes
export const STATIC_LINKABLE_SCHEMAS: SchemaName[] = [
"page.sitemap",
"page.search",
];
export const TRANSLATABLE_SCHEMAS = pick(
SCHEMAS,
"config.general",
"config.seo",
"config.translations",
"faq.item",
"person",
"testimonials.item",
);
export type TranslatableSchemaName = keyof typeof TRANSLATABLE_SCHEMAS;
export const RESOURCE_SCHEMAS = pick(
LINKABLE_SCHEMAS,
"page.blog",
"page.event",
"page.casestudy",
"page.podcast",
"page.tool",
"page.video",
"page.guide",
"page.newsarticle",
"page.mediacoveragearticle",
"page.pressrelease",
);
export type ResourceType = keyof typeof RESOURCE_SCHEMAS;
export const RESOURCE_SCHEMAS_LIST = Object.keys(
RESOURCE_SCHEMAS,
) as ResourceType[];
export const BLOCK_SCHEMAS = pick(
SCHEMAS,
"block.block0",
"block.block1",
"block.block10",
"block.block12",
"block.block13",
"block.block14",
"block.block15",
"block.block16",
"block.block17",
"block.block18",
"block.block2",
"block.block3",
"block.block4",
"block.block5",
"block.block7",
);
export type BlockSchemaName = keyof typeof BLOCK_SCHEMAS;
declare module "sanity" {
// redeclare StringOptions; it will be merged with StringOptions in the sanity module
export interface StringOptions {
localize?: boolean;
max?: string | number;
}
export interface SlugOptions {
localize?: boolean;
}
export interface ObjectOptions {
localize?: boolean;
}
}