@mintlify/validation 0.1.125 → 0.1.126

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,328 @@
1
+ import { z } from 'zod';
2
+ export declare function validateMintConfig(value: unknown): z.SafeParseError<{
3
+ name: string;
4
+ favicon: string;
5
+ colors: {
6
+ primary: string;
7
+ light?: string | undefined;
8
+ dark?: string | undefined;
9
+ background?: {
10
+ light?: string | undefined;
11
+ dark?: string | undefined;
12
+ } | undefined;
13
+ anchors?: string | {
14
+ from: string;
15
+ to: string;
16
+ via?: string | undefined;
17
+ } | undefined;
18
+ ultraLight?: any;
19
+ ultraDark?: any;
20
+ };
21
+ navigation: import("@mintlify/models").NavigationGroup[];
22
+ $schema?: string | undefined;
23
+ mintlify?: string | undefined;
24
+ logo?: string | {
25
+ light: string;
26
+ dark: string;
27
+ href?: string | undefined;
28
+ } | undefined;
29
+ openapi?: string | string[] | undefined;
30
+ api?: {
31
+ baseUrl?: string | string[] | undefined;
32
+ auth?: {
33
+ method?: "bearer" | "basic" | "key" | "cobo" | undefined;
34
+ name?: string | undefined;
35
+ inputPrefix?: string | undefined;
36
+ } | undefined;
37
+ playground?: {
38
+ mode?: "show" | "simple" | "hide" | undefined;
39
+ } | undefined;
40
+ request?: {
41
+ example?: {
42
+ showOptionalParams?: boolean | undefined;
43
+ } | undefined;
44
+ } | undefined;
45
+ maintainOrder?: boolean | undefined;
46
+ } | undefined;
47
+ modeToggle?: {
48
+ default?: "light" | "dark" | undefined;
49
+ isHidden?: boolean | undefined;
50
+ } | undefined;
51
+ versions?: (string | {
52
+ name: string;
53
+ url: string;
54
+ })[] | undefined;
55
+ metadata?: Record<string, string> | undefined;
56
+ topbarCtaButton?: {
57
+ name: string;
58
+ url: string;
59
+ type?: "link" | undefined;
60
+ } | {
61
+ type: "github";
62
+ url: string;
63
+ } | undefined;
64
+ topbarLinks?: ({
65
+ name: string;
66
+ url: string;
67
+ type?: "link" | undefined;
68
+ } | {
69
+ type: "github";
70
+ url: string;
71
+ })[] | undefined;
72
+ primaryTab?: {
73
+ name: string;
74
+ } | undefined;
75
+ topAnchor?: {
76
+ name: string;
77
+ icon?: string | undefined;
78
+ iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
79
+ } | undefined;
80
+ anchors?: {
81
+ name: string;
82
+ url: string;
83
+ icon?: string | undefined;
84
+ iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
85
+ color?: string | {
86
+ from: string;
87
+ to: string;
88
+ via?: string | undefined;
89
+ } | undefined;
90
+ isDefaultHidden?: boolean | undefined;
91
+ version?: string | undefined;
92
+ }[] | undefined;
93
+ tabs?: {
94
+ name: string;
95
+ url: string;
96
+ version?: string | undefined;
97
+ }[] | undefined;
98
+ footerSocials?: {
99
+ type: string;
100
+ url: string;
101
+ }[] | Record<string, string> | undefined;
102
+ backgroundImage?: string | undefined;
103
+ feedback?: {
104
+ thumbsRating?: boolean | undefined;
105
+ suggestEdit?: boolean | undefined;
106
+ raiseIssue?: boolean | undefined;
107
+ } | undefined;
108
+ analytics?: {
109
+ amplitude?: {
110
+ apiKey: string;
111
+ } | undefined;
112
+ clearbit?: {
113
+ publicApiKey: string;
114
+ } | undefined;
115
+ fathom?: {
116
+ siteId: string;
117
+ } | undefined;
118
+ ga4?: {
119
+ measurementId: string;
120
+ } | undefined;
121
+ gtm?: {
122
+ tagId: string;
123
+ } | undefined;
124
+ hotjar?: {
125
+ hjid: string;
126
+ hjsv: string;
127
+ } | undefined;
128
+ koala?: {
129
+ publicApiKey: string;
130
+ } | undefined;
131
+ logrocket?: {
132
+ appId: string;
133
+ } | undefined;
134
+ mixpanel?: {
135
+ projectToken: string;
136
+ } | undefined;
137
+ pirsch?: {
138
+ id: string;
139
+ } | undefined;
140
+ posthog?: {
141
+ apiKey: string;
142
+ apiHost?: string | undefined;
143
+ } | undefined;
144
+ plausible?: {
145
+ domain: string;
146
+ } | undefined;
147
+ } | undefined;
148
+ integrations?: {
149
+ intercom?: string | undefined;
150
+ frontchat?: string | undefined;
151
+ } | undefined;
152
+ isWhiteLabeled?: boolean | undefined;
153
+ search?: {
154
+ prompt?: string | undefined;
155
+ } | undefined;
156
+ redirects?: {
157
+ source: string;
158
+ destination: string;
159
+ }[] | undefined;
160
+ seo?: {
161
+ indexHiddenPages?: boolean | undefined;
162
+ } | undefined;
163
+ }> | {
164
+ warnings: z.ZodIssue[];
165
+ success: true;
166
+ data: {
167
+ name: string;
168
+ $schema: string;
169
+ favicon: string;
170
+ colors: {
171
+ primary: string;
172
+ light?: string | undefined;
173
+ dark?: string | undefined;
174
+ background?: {
175
+ light?: string | undefined;
176
+ dark?: string | undefined;
177
+ } | undefined;
178
+ anchors?: string | {
179
+ from: string;
180
+ to: string;
181
+ via?: string | undefined;
182
+ } | undefined;
183
+ ultraLight?: any;
184
+ ultraDark?: any;
185
+ };
186
+ navigation: import("@mintlify/models").NavigationGroup[];
187
+ mintlify?: string | undefined;
188
+ logo?: string | {
189
+ light: string;
190
+ dark: string;
191
+ href?: string | undefined;
192
+ } | undefined;
193
+ openapi?: string | string[] | undefined;
194
+ api?: {
195
+ baseUrl?: string | string[] | undefined;
196
+ auth?: {
197
+ method?: "bearer" | "basic" | "key" | "cobo" | undefined;
198
+ name?: string | undefined;
199
+ inputPrefix?: string | undefined;
200
+ } | undefined;
201
+ playground?: {
202
+ mode: "show" | "simple" | "hide";
203
+ } | undefined;
204
+ request?: {
205
+ example?: {
206
+ showOptionalParams: boolean;
207
+ } | undefined;
208
+ } | undefined;
209
+ maintainOrder?: boolean | undefined;
210
+ } | undefined;
211
+ modeToggle?: {
212
+ default?: "light" | "dark" | undefined;
213
+ isHidden?: boolean | undefined;
214
+ } | undefined;
215
+ versions?: (string | {
216
+ name: string;
217
+ url: string;
218
+ })[] | undefined;
219
+ metadata?: Record<string, string> | undefined;
220
+ topbarCtaButton?: {
221
+ name: string;
222
+ url: string;
223
+ type?: "link" | undefined;
224
+ } | {
225
+ type: "github";
226
+ url: string;
227
+ } | undefined;
228
+ topbarLinks?: ({
229
+ name: string;
230
+ url: string;
231
+ type?: "link" | undefined;
232
+ } | {
233
+ type: "github";
234
+ url: string;
235
+ })[] | undefined;
236
+ primaryTab?: {
237
+ name: string;
238
+ } | undefined;
239
+ topAnchor?: {
240
+ name: string;
241
+ icon?: string | undefined;
242
+ iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
243
+ } | undefined;
244
+ anchors?: {
245
+ name: string;
246
+ url: string;
247
+ icon?: string | undefined;
248
+ iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-light" | "sharp-regular" | "sharp-solid" | "sharp-thin" | "solid" | "thin" | undefined;
249
+ color?: string | {
250
+ from: string;
251
+ to: string;
252
+ via?: string | undefined;
253
+ } | undefined;
254
+ isDefaultHidden?: boolean | undefined;
255
+ version?: string | undefined;
256
+ }[] | undefined;
257
+ tabs?: {
258
+ name: string;
259
+ url: string;
260
+ version?: string | undefined;
261
+ }[] | undefined;
262
+ footerSocials?: {
263
+ type: string;
264
+ url: string;
265
+ }[] | Record<string, string> | undefined;
266
+ backgroundImage?: string | undefined;
267
+ feedback?: {
268
+ thumbsRating?: boolean | undefined;
269
+ suggestEdit?: boolean | undefined;
270
+ raiseIssue?: boolean | undefined;
271
+ } | undefined;
272
+ analytics?: {
273
+ amplitude?: {
274
+ apiKey: string;
275
+ } | undefined;
276
+ clearbit?: {
277
+ publicApiKey: string;
278
+ } | undefined;
279
+ fathom?: {
280
+ siteId: string;
281
+ } | undefined;
282
+ ga4?: {
283
+ measurementId: string;
284
+ } | undefined;
285
+ gtm?: {
286
+ tagId: string;
287
+ } | undefined;
288
+ hotjar?: {
289
+ hjid: string;
290
+ hjsv: string;
291
+ } | undefined;
292
+ koala?: {
293
+ publicApiKey: string;
294
+ } | undefined;
295
+ logrocket?: {
296
+ appId: string;
297
+ } | undefined;
298
+ mixpanel?: {
299
+ projectToken: string;
300
+ } | undefined;
301
+ pirsch?: {
302
+ id: string;
303
+ } | undefined;
304
+ posthog?: {
305
+ apiKey: string;
306
+ apiHost?: string | undefined;
307
+ } | undefined;
308
+ plausible?: {
309
+ domain: string;
310
+ } | undefined;
311
+ } | undefined;
312
+ integrations?: {
313
+ intercom?: string | undefined;
314
+ frontchat?: string | undefined;
315
+ } | undefined;
316
+ isWhiteLabeled?: boolean | undefined;
317
+ search?: {
318
+ prompt?: string | undefined;
319
+ } | undefined;
320
+ redirects?: {
321
+ source: string;
322
+ destination: string;
323
+ }[] | undefined;
324
+ seo?: {
325
+ indexHiddenPages?: boolean | undefined;
326
+ } | undefined;
327
+ };
328
+ };
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { customErrorMap } from './customErrorMap.js';
3
+ import { refineMissingVersions } from './refinements/refineMissingVersions.js';
4
+ import { mintConfigSchema } from './schemas/config.js';
5
+ import { aggregateWarnings } from './warnings/aggregateWarnings.js';
6
+ export function validateMintConfig(value) {
7
+ // save old error map, as this error map is configured globally, and we don't want to overwrite global behavior
8
+ const oldErrorMap = z.getErrorMap();
9
+ z.setErrorMap(customErrorMap);
10
+ const refinedSchema = mintConfigSchema.superRefine(refineMissingVersions);
11
+ const validationResults = refinedSchema.safeParse(value);
12
+ // reset error map
13
+ z.setErrorMap(oldErrorMap);
14
+ if (!validationResults.success)
15
+ return validationResults;
16
+ return Object.assign(Object.assign({}, validationResults), { warnings: aggregateWarnings(validationResults.data) });
17
+ }