@mintlify/validation 0.1.58 → 0.1.59

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.
Files changed (32) hide show
  1. package/dist/index.js +86 -2
  2. package/dist/mint-config/common.js +12 -0
  3. package/dist/mint-config/flattenUnionErrorMessages.js +23 -0
  4. package/dist/mint-config/hexadecimalPattern.js +4 -0
  5. package/dist/mint-config/schemas/analytics.js +132 -0
  6. package/dist/mint-config/schemas/anchorColors.js +31 -0
  7. package/dist/mint-config/schemas/anchors.d.ts +6 -6
  8. package/dist/mint-config/schemas/anchors.js +72 -0
  9. package/dist/mint-config/schemas/apiReference.js +68 -0
  10. package/dist/mint-config/schemas/basics.js +135 -0
  11. package/dist/mint-config/schemas/colors.js +45 -0
  12. package/dist/mint-config/schemas/config.d.ts +13 -13
  13. package/dist/mint-config/schemas/config.js +42 -0
  14. package/dist/mint-config/schemas/favicon.js +12 -0
  15. package/dist/mint-config/schemas/integrations.js +14 -0
  16. package/dist/mint-config/schemas/navigation.js +27 -0
  17. package/dist/mint-config/schemas/tabs.js +31 -0
  18. package/dist/mint-config/schemas/versions.js +16 -0
  19. package/dist/mint-config/types/enums.js +4 -0
  20. package/dist/mint-config/types/index.js +2 -0
  21. package/dist/mint-config/types/navigation.js +2 -0
  22. package/dist/mint-config/validateAnchorsWarnings.js +39 -0
  23. package/dist/mint-config/validateVersionsInNavigation.js +60 -0
  24. package/dist/openapi/convertOpenApi.js +174 -0
  25. package/dist/openapi/convertParameters.js +64 -0
  26. package/dist/openapi/convertSchema.js +486 -0
  27. package/dist/openapi/convertSecurity.js +87 -0
  28. package/dist/openapi/convertServers.js +47 -0
  29. package/dist/openapi/types/endpoint.js +16 -0
  30. package/dist/tsconfig.build.tsbuildinfo +1 -0
  31. package/package.json +3 -3
  32. package/dist/index.js.LICENSE.txt +0 -8
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MintValidationResults = void 0;
4
+ var MintValidationResults = /** @class */ (function () {
5
+ function MintValidationResults() {
6
+ this.status = 'success';
7
+ this.errors = [];
8
+ this.warnings = [];
9
+ }
10
+ return MintValidationResults;
11
+ }());
12
+ exports.MintValidationResults = MintValidationResults;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.flattenUnionErrorMessages = void 0;
13
+ // TO DO: Write unit tests for this function.
14
+ // TO DO: Prettify the output instead of just returning JSON objects.
15
+ function flattenUnionErrorMessages(unionErrors) {
16
+ return unionErrors.reduce(function (acc, unionError) {
17
+ if (Array.isArray(unionError.unionErrors) && unionError.unionErrors.length > 0) {
18
+ return __spreadArray(__spreadArray([], acc, true), flattenUnionErrorMessages(unionError.unionErrors), true);
19
+ }
20
+ return __spreadArray(__spreadArray([], acc, true), [unionError.message], false);
21
+ }, []);
22
+ }
23
+ exports.flattenUnionErrorMessages = flattenUnionErrorMessages;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hexadecimalPattern = void 0;
4
+ exports.hexadecimalPattern = /^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyticsSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var amplitudeConfigInterfaceSchema = zod_1.z.object({
6
+ apiKey: zod_1.z.string({
7
+ required_error: 'Amplitude apiKey is missing.',
8
+ invalid_type_error: 'Amplitude apiKey must be a string.',
9
+ }),
10
+ }, {
11
+ invalid_type_error: 'Amplitude analytics config must be an object with an apiKey property.',
12
+ });
13
+ var clearbitConfigInterfaceSchema = zod_1.z.object({
14
+ publicApiKey: zod_1.z.string({
15
+ required_error: 'Clearbit publicApiKey is missing.',
16
+ invalid_type_error: 'Clearbit publicApiKey must be a string.',
17
+ }),
18
+ }, {
19
+ invalid_type_error: 'Clearbit config must be an object with a publicApiKey property.',
20
+ });
21
+ var fathomConfigInterfaceSchema = zod_1.z.object({
22
+ siteId: zod_1.z.string({
23
+ required_error: 'Fathom siteId is missing.',
24
+ invalid_type_error: 'Fathom siteId must be a string.',
25
+ }),
26
+ }, {
27
+ invalid_type_error: 'Fathom analytics config must be an object with a siteId property.',
28
+ });
29
+ var googleAnalyticsConfigInterfaceSchema = zod_1.z.object({
30
+ measurementId: zod_1.z
31
+ .string({
32
+ required_error: 'Google Analytics measurementId is missing.',
33
+ invalid_type_error: 'Google Analytics measurementId must be a string.',
34
+ })
35
+ .startsWith('G', 'Google Analytics measurementId must start with G.'),
36
+ }, {
37
+ invalid_type_error: 'Google Analytics config must be an object with a measurementId property.',
38
+ });
39
+ var googleTagManagerConfigInterfaceSchema = zod_1.z.object({
40
+ tagId: zod_1.z
41
+ .string({
42
+ required_error: 'Google Tag Manager tagId is missing.',
43
+ invalid_type_error: 'Google Tag Manager tagId must be a string.',
44
+ })
45
+ .startsWith('G', 'Google Tag Manager tagId must start with G.'),
46
+ }, {
47
+ invalid_type_error: 'Google Tag Manager config must be an object with a tagId property.',
48
+ });
49
+ var hotjarConfigInterfaceSchema = zod_1.z.object({
50
+ hjid: zod_1.z.string({
51
+ required_error: 'Hotjar hjid is missing.',
52
+ invalid_type_error: 'Hotjar hjid must be a string.',
53
+ }),
54
+ hjsv: zod_1.z.string({
55
+ required_error: 'Hotjar hjsv is missing.',
56
+ invalid_type_error: 'Hotjar hjsv must be a string.',
57
+ }),
58
+ }, {
59
+ invalid_type_error: 'Hotjar config must be an object with a hjid and hjsv property.',
60
+ });
61
+ var koalaConfigInterfaceSchema = zod_1.z.object({
62
+ publicApiKey: zod_1.z
63
+ .string({
64
+ required_error: 'Public Api Key is required for the Koala snippet to run.',
65
+ invalid_type_error: 'Koala Public Api Key must be a string.',
66
+ })
67
+ .refine(function (publicApiKey) { return publicApiKey.length >= 2; }, 'Koala Public Api Key must have at least two characters'),
68
+ }, {
69
+ invalid_type_error: 'Koala config must be an object with a publicApiKey property.',
70
+ });
71
+ var logrocketConfigInterfaceSchema = zod_1.z.object({
72
+ appId: zod_1.z.string({
73
+ required_error: 'Logrocket appId is missing.',
74
+ invalid_type_error: 'Logrocket appId must be a string.',
75
+ }),
76
+ }, {
77
+ invalid_type_error: 'Logrocket config must be an object with an appId property.',
78
+ });
79
+ var mixpanelConfigInterfaceSchema = zod_1.z.object({
80
+ projectToken: zod_1.z.string({
81
+ required_error: 'Mixpanel projectToken is missing.',
82
+ invalid_type_error: 'Mixpanel projectToken must be a string.',
83
+ }),
84
+ }, {
85
+ invalid_type_error: 'Mixpanel config must be an object with a projectToken property.',
86
+ });
87
+ var pirschConfigInterfaceSchema = zod_1.z.object({
88
+ id: zod_1.z.string({
89
+ required_error: 'Pirsch id is missing.',
90
+ invalid_type_error: 'Pirsch id must be a string.',
91
+ }),
92
+ }, { invalid_type_error: 'Pirsch config must be an object with an id property.' });
93
+ var postHogConfigInterfaceSchema = zod_1.z.object({
94
+ apiKey: zod_1.z
95
+ .string({
96
+ required_error: 'Posthog apiKey is missing.',
97
+ invalid_type_error: 'Posthog apiKey must be a string.',
98
+ })
99
+ .startsWith('phc_', 'Posthog apiKey must start with phc_'),
100
+ apiHost: zod_1.z
101
+ .string({ invalid_type_error: 'Posthog apiHost must be a string.' })
102
+ .url('Posthog apiHost must be a valid URL.')
103
+ .optional(),
104
+ }, {
105
+ invalid_type_error: 'Posthog config must be an object with an apiKey property.',
106
+ });
107
+ var plausibleConfigInterfaceSchema = zod_1.z.object({
108
+ domain: zod_1.z
109
+ .string({
110
+ required_error: 'Plausible domain is missing.',
111
+ invalid_type_error: 'Plausible domain must be a string.',
112
+ })
113
+ .refine(function (domain) { return !domain.startsWith('http://') && !domain.startsWith('https://'); }, 'Plausible domain must not start with http:// or https://'),
114
+ }, {
115
+ invalid_type_error: 'Plausible config must be an object with a domain property. The domain must not start with http:// or https://.',
116
+ });
117
+ exports.analyticsSchema = zod_1.z
118
+ .object({
119
+ amplitude: amplitudeConfigInterfaceSchema.optional(),
120
+ clearbit: clearbitConfigInterfaceSchema.optional(),
121
+ fathom: fathomConfigInterfaceSchema.optional(),
122
+ ga4: googleAnalyticsConfigInterfaceSchema.optional(),
123
+ gtm: googleTagManagerConfigInterfaceSchema.optional(),
124
+ hotjar: hotjarConfigInterfaceSchema.optional(),
125
+ koala: koalaConfigInterfaceSchema.optional(),
126
+ logrocket: logrocketConfigInterfaceSchema.optional(),
127
+ mixpanel: mixpanelConfigInterfaceSchema.optional(),
128
+ pirsch: pirschConfigInterfaceSchema.optional(),
129
+ posthog: postHogConfigInterfaceSchema.optional(),
130
+ plausible: plausibleConfigInterfaceSchema.optional(),
131
+ })
132
+ .strict('Mintlify only supports analytics integrations from: amplitude, clearbit, fathom, ga4, gtm, hotjar, koala, logrocket, mixpanel, pirsch, posthog and plausible.');
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.anchorColorSchema = exports.gradientSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var hexadecimalPattern_1 = require("../hexadecimalPattern");
6
+ exports.gradientSchema = zod_1.z.object({
7
+ from: zod_1.z
8
+ .string({
9
+ invalid_type_error: 'Anchor color.from must be a string.',
10
+ })
11
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Anchor color.from must be a hexadecimal color.'),
12
+ via: zod_1.z
13
+ .string({
14
+ invalid_type_error: 'Anchor color.via must be a string.',
15
+ })
16
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Anchor color.via must be undefined or a hexadecimal color.')
17
+ .optional(),
18
+ to: zod_1.z
19
+ .string({
20
+ invalid_type_error: 'Anchor color.to must be a string.',
21
+ })
22
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Anchor color.to must be a hexadecimal color.'),
23
+ });
24
+ exports.anchorColorSchema = zod_1.z.union([
25
+ zod_1.z
26
+ .string({ invalid_type_error: 'Anchor color must be a string.' })
27
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Anchor color must be a hexadecimal color.'),
28
+ exports.gradientSchema.strict('Anchors with gradient colors can only have properties from, via, and to with valid hexadecimal colors.'),
29
+ ], {
30
+ invalid_type_error: 'Anchor color must be a string or an object with from and to properties.',
31
+ });
@@ -23,7 +23,7 @@ declare const anchorSchema: z.ZodObject<{
23
23
  name: string;
24
24
  url: string;
25
25
  icon?: string | undefined;
26
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
26
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
27
27
  color?: string | {
28
28
  from: string;
29
29
  to: string;
@@ -35,7 +35,7 @@ declare const anchorSchema: z.ZodObject<{
35
35
  name: string;
36
36
  url: string;
37
37
  icon?: string | undefined;
38
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
38
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
39
39
  color?: string | {
40
40
  from: string;
41
41
  to: string;
@@ -68,7 +68,7 @@ export declare const anchorsSchema: z.ZodArray<z.ZodObject<{
68
68
  name: string;
69
69
  url: string;
70
70
  icon?: string | undefined;
71
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
71
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
72
72
  color?: string | {
73
73
  from: string;
74
74
  to: string;
@@ -80,7 +80,7 @@ export declare const anchorsSchema: z.ZodArray<z.ZodObject<{
80
80
  name: string;
81
81
  url: string;
82
82
  icon?: string | undefined;
83
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
83
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
84
84
  color?: string | {
85
85
  from: string;
86
86
  to: string;
@@ -96,11 +96,11 @@ export declare const topAnchorSchema: z.ZodObject<{
96
96
  }, "strict", z.ZodTypeAny, {
97
97
  name: string;
98
98
  icon?: string | undefined;
99
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
99
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
100
100
  }, {
101
101
  name: string;
102
102
  icon?: string | undefined;
103
- iconType?: "light" | "brands" | "duotone" | "sharp-solid" | "solid" | "thin" | undefined;
103
+ iconType?: "brands" | "duotone" | "light" | "sharp-solid" | "solid" | "thin" | undefined;
104
104
  }>;
105
105
  export type AnchorType = z.infer<typeof anchorSchema>;
106
106
  export type AnchorsType = z.infer<typeof anchorsSchema>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topAnchorSchema = exports.anchorsSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var anchorColors_1 = require("./anchorColors");
6
+ var anchorSchema = zod_1.z.object({
7
+ name: zod_1.z
8
+ .string({
9
+ required_error: 'Every anchor must have a name.',
10
+ invalid_type_error: 'Anchor name must be a string.',
11
+ })
12
+ .trim()
13
+ .min(1, 'Anchor name is empty.'),
14
+ url: zod_1.z
15
+ .string({
16
+ required_error: 'Every anchor must have a url',
17
+ invalid_type_error: 'Anchor url must be a string.',
18
+ })
19
+ .trim()
20
+ .min(1, 'Anchor URL is missing.'),
21
+ icon: zod_1.z
22
+ .string({
23
+ invalid_type_error: 'Anchor icon must be the name of a Font Awesome icon. Visit this link to see all the available icons: https://fontawesome.com/icons',
24
+ })
25
+ .refine(function (iconStr) { return !iconStr.startsWith('fa-'); }, 'icon does not need to start with "fa-". Please delete "fa-" and keep the rest of the icon name.')
26
+ .optional(),
27
+ iconType: zod_1.z
28
+ .enum(['brands', 'duotone', 'light', 'sharp-solid', 'solid', 'thin'], {
29
+ errorMap: function () {
30
+ return {
31
+ message: 'anchor iconType must be one of the following strings: brands, duotone, light, sharp-solid, solid, thin',
32
+ };
33
+ },
34
+ })
35
+ .optional(),
36
+ color: anchorColors_1.anchorColorSchema.optional(),
37
+ isDefaultHidden: zod_1.z
38
+ .boolean({
39
+ invalid_type_error: 'Anchor isDefaultHidden must be a boolean. Try writing true or false without quotes around them.',
40
+ })
41
+ .optional(),
42
+ version: zod_1.z
43
+ .string({
44
+ invalid_type_error: 'Version must be a string in the versions array.',
45
+ })
46
+ .optional(),
47
+ });
48
+ exports.anchorsSchema = anchorSchema.array();
49
+ exports.topAnchorSchema = zod_1.z
50
+ .object({
51
+ name: zod_1.z.string({
52
+ required_error: 'topAnchor.name is missing, set it or delete the entire topAnchor property.',
53
+ invalid_type_error: 'topAnchor.name must be a string',
54
+ }),
55
+ icon: zod_1.z
56
+ .string({
57
+ invalid_type_error: 'topAnchor.icon must be a string',
58
+ })
59
+ .optional(),
60
+ iconType: zod_1.z
61
+ .enum(['brands', 'duotone', 'light', 'sharp-solid', 'solid', 'thin'], {
62
+ errorMap: function () {
63
+ return {
64
+ message: 'topAnchor.iconType must be one of the following strings: brands, duotone, light, sharp-solid, solid, thin',
65
+ };
66
+ },
67
+ })
68
+ .optional(),
69
+ }, {
70
+ invalid_type_error: "topAnchor must be an object with a name property. Delete the topAnchor if you don't want to customize the values.",
71
+ })
72
+ .strict('topAnchor can only have name, icon, and iconType properties.');
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apiSchema = exports.openApiSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ exports.openApiSchema = zod_1.z.union([
6
+ zod_1.z.string({
7
+ invalid_type_error: 'openapi must be a string or an array of strings of absolute or relative URLs pointing to your OpenAPI file.',
8
+ }),
9
+ zod_1.z.array(zod_1.z.string({
10
+ invalid_type_error: 'openapi must be a string or an array of strings of absolute or relative URLs pointing to your OpenAPI file.',
11
+ })),
12
+ ]);
13
+ exports.apiSchema = zod_1.z
14
+ .object({
15
+ baseUrl: zod_1.z
16
+ .union([
17
+ zod_1.z.string().url('api.baseUrl must be a valid URL.'),
18
+ zod_1.z.array(zod_1.z.string().url('api.baseUrl array entries must be valid URLs.')),
19
+ ])
20
+ .optional(),
21
+ auth: zod_1.z
22
+ .object({
23
+ method: zod_1.z
24
+ .enum(['bearer', 'basic', 'key', 'cobo'], {
25
+ errorMap: function () {
26
+ return {
27
+ message: 'api.auth.method has to be one of: bearer, basic, or key',
28
+ };
29
+ },
30
+ })
31
+ .optional(),
32
+ name: zod_1.z.string().optional(),
33
+ inputPrefix: zod_1.z.string().optional(),
34
+ })
35
+ .strict('api.auth can only contain method, name, and inputPrefix.')
36
+ .optional(),
37
+ playground: zod_1.z
38
+ .object({
39
+ mode: zod_1.z
40
+ .enum(['show', 'simple', 'hide'], {
41
+ errorMap: function () {
42
+ return {
43
+ message: 'api.playground.mode must be one of the following strings: show, simple, or hide',
44
+ };
45
+ },
46
+ })
47
+ .optional()
48
+ .default('show'),
49
+ })
50
+ .optional(),
51
+ request: zod_1.z
52
+ .object({
53
+ example: zod_1.z
54
+ .object({
55
+ showOptionalParams: zod_1.z.boolean().optional().default(false),
56
+ })
57
+ .optional(),
58
+ })
59
+ .optional(),
60
+ maintainOrder: zod_1.z
61
+ .boolean({
62
+ invalid_type_error: 'maintainOrder must be a boolean. Try writing true or false without the quotes.',
63
+ })
64
+ .optional(),
65
+ }, {
66
+ invalid_type_error: 'api must be an object. The object can have baseUrl, auth, and playground as properties.',
67
+ })
68
+ .strict('api can only contain baseUrl, auth, and playground as properties.');
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.iconTypes = exports.createCtaButtonSchema = exports.redirectsSchema = exports.searchSchema = exports.feedbackSchema = exports.footerSocialsSchema = exports.metadataSchema = exports.isWhiteLabeledSchema = exports.modeToggleSchema = exports.logoSchema = exports.nameSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ exports.nameSchema = zod_1.z
6
+ .string({ required_error: 'Name is missing.' })
7
+ .min(1, 'Name cannot be empty.')
8
+ .trim();
9
+ exports.logoSchema = zod_1.z.union([
10
+ zod_1.z.string().min(3, 'Logo needs to be a path to your logo file including the file extension.'),
11
+ zod_1.z.object({
12
+ light: zod_1.z.string(),
13
+ dark: zod_1.z.string(),
14
+ href: zod_1.z.string().optional(),
15
+ }),
16
+ ], {
17
+ invalid_type_error: 'Logo must be a string or an object with light and dark properties.',
18
+ });
19
+ exports.modeToggleSchema = zod_1.z.object({
20
+ default: zod_1.z
21
+ .enum(['light', 'dark'], {
22
+ errorMap: function () {
23
+ return {
24
+ message: 'modeToggleSchema.default must be one of the following: light or dark',
25
+ };
26
+ },
27
+ })
28
+ .optional(),
29
+ isHidden: zod_1.z
30
+ .boolean({
31
+ invalid_type_error: 'isHidden must be a boolean. Try writing true or false without the quotes.',
32
+ })
33
+ .optional(),
34
+ });
35
+ exports.isWhiteLabeledSchema = zod_1.z.boolean({
36
+ invalid_type_error: 'isWhiteLabeled must be a boolean. Try writing true or false without the quotes.',
37
+ });
38
+ exports.metadataSchema = zod_1.z.record(zod_1.z.string({ invalid_type_error: 'metadata keys must be strings' }), zod_1.z
39
+ .string({ invalid_type_error: 'metadata values must be strings' })
40
+ .min(1, 'metadata values must not be empty'));
41
+ exports.footerSocialsSchema = zod_1.z.union([
42
+ // TO DO: deprecate array types
43
+ zod_1.z.array(zod_1.z.object({
44
+ type: zod_1.z.string(),
45
+ url: zod_1.z.string().url('footerSocials url must be a valid url'),
46
+ })),
47
+ zod_1.z.record(zod_1.z.string().trim().min(1, 'footerSocials name (the key in the object) must not be empty'), zod_1.z.string().url('footerSocials url (the value in the object) must be a valid url')),
48
+ ], {
49
+ invalid_type_error: 'footerSocials must be an object where the key is the name of the social media and the value is the url to your profile. For example: { "twitter": "https://twitter.com/mintlify" }',
50
+ });
51
+ exports.feedbackSchema = zod_1.z.object({
52
+ thumbsRating: zod_1.z
53
+ .boolean({
54
+ invalid_type_error: 'thumbsRating must be a boolean. Try writing true or false without the quotes.',
55
+ })
56
+ .optional(),
57
+ suggestEdit: zod_1.z
58
+ .boolean({
59
+ invalid_type_error: 'suggestEdit must be a boolean. Try writing true or false without the quotes.',
60
+ })
61
+ .optional(),
62
+ raiseIssue: zod_1.z
63
+ .boolean({
64
+ invalid_type_error: 'raiseIssue must be a boolean. Try writing true or false without the quotes.',
65
+ })
66
+ .optional(),
67
+ });
68
+ exports.searchSchema = zod_1.z.object({
69
+ prompt: zod_1.z
70
+ .string({
71
+ invalid_type_error: 'search.prompt must be a string. If this field is undefined, the default prompt is `Search...`',
72
+ })
73
+ .optional(),
74
+ });
75
+ var redirectSchema = zod_1.z.object({
76
+ source: zod_1.z.string(),
77
+ destination: zod_1.z.string(),
78
+ });
79
+ exports.redirectsSchema = zod_1.z
80
+ .array(redirectSchema, {
81
+ invalid_type_error: 'redirects must be an array of objects with source and destination properties',
82
+ })
83
+ .refine(function (value) {
84
+ var keys = value.map(function (obj) { return obj.source; });
85
+ return new Set(keys).size === keys.length;
86
+ }, {
87
+ message: 'Sources in the array must be unique.',
88
+ });
89
+ var createCtaButtonSchema = function (ctaButtonName) {
90
+ return zod_1.z.union([
91
+ zod_1.z
92
+ .object({
93
+ type: zod_1.z.literal('link').optional(),
94
+ name: zod_1.z.string({
95
+ required_error: 'Name must be defined when using a CTA button',
96
+ invalid_type_error: 'Name must be a string',
97
+ }),
98
+ url: zod_1.z
99
+ .string({
100
+ required_error: ctaButtonName + '.url is missing',
101
+ invalid_type_error: ctaButtonName + '.url must be a string',
102
+ })
103
+ .min(1, ctaButtonName + '.url cannot be empty'),
104
+ })
105
+ .strict(ctaButtonName +
106
+ ' can only contain name, url, and type properties. Set a different type if you need to set other fields.'),
107
+ zod_1.z
108
+ .object({
109
+ type: zod_1.z.literal('github'),
110
+ url: zod_1.z
111
+ .string({
112
+ required_error: ctaButtonName +
113
+ '.url is missing. Please set the url to a link to your GitHub repository.',
114
+ invalid_type_error: ctaButtonName +
115
+ '.url must be a string. Specifically, set the url to a link to your GitHub repository.',
116
+ })
117
+ .url(ctaButtonName + '.url must be a valid url pointing to your GitHub repository.'),
118
+ })
119
+ .strict(ctaButtonName +
120
+ ' can only contain url and type properties when type="github". Please delete any other properties you have set.'),
121
+ ], {
122
+ invalid_type_error: ctaButtonName +
123
+ ' must be an object. The object can have type="link" (the default) if you define a url and a name. You can also have type="github" if you define a url pointing to your GitHub repo and set the type in the object.',
124
+ });
125
+ };
126
+ exports.createCtaButtonSchema = createCtaButtonSchema;
127
+ exports.iconTypes = [
128
+ 'brands',
129
+ 'duotone',
130
+ 'light',
131
+ 'regular',
132
+ 'sharp-solid',
133
+ 'solid',
134
+ 'thin',
135
+ ];
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.colorsSchema = void 0;
4
+ var zod_1 = require("zod");
5
+ var hexadecimalPattern_1 = require("../hexadecimalPattern");
6
+ var anchorColors_1 = require("./anchorColors");
7
+ exports.colorsSchema = zod_1.z
8
+ .object({
9
+ primary: zod_1.z
10
+ .string({ invalid_type_error: 'Primary color must be a string.' })
11
+ .min(1, 'Color primary is missing.')
12
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Primary color must be a hexadecimal color including the # at the start.'),
13
+ light: zod_1.z
14
+ .string({ invalid_type_error: 'Light color must be a string.' })
15
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Light color must be a hexadecimal color including the # at the start.')
16
+ .optional(),
17
+ dark: zod_1.z
18
+ .string({ invalid_type_error: 'Dark color must be a string.' })
19
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Dark color must be a hexadecimal color including the # at the start.')
20
+ .optional(),
21
+ background: zod_1.z
22
+ .object({
23
+ light: zod_1.z
24
+ .string({
25
+ invalid_type_error: 'Background light color must be a string.',
26
+ })
27
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Background light color must be a hexadecimal color including the # at the start.')
28
+ .optional(),
29
+ dark: zod_1.z
30
+ .string({
31
+ invalid_type_error: 'Background dark color must be a string.',
32
+ })
33
+ .regex(hexadecimalPattern_1.hexadecimalPattern, 'Background dark color must be a hexadecimal color including the # at the start.')
34
+ .optional(),
35
+ })
36
+ .optional(),
37
+ anchors: anchorColors_1.anchorColorSchema.optional(),
38
+ // Prevent strict() from throwing an error when the user defines a deprecated ultraLight / ultraDark color.
39
+ ultraLight: zod_1.z.any().optional(),
40
+ ultraDark: zod_1.z.any().optional(),
41
+ }, {
42
+ required_error: 'Colors are missing. You need to define at least the primary color. For example: { "colors": { "primary": "#ff0000" } }',
43
+ invalid_type_error: 'Colors must be an object.',
44
+ })
45
+ .strict('Some of the colors in mint.json are invalid, did you make a typo? We only accept primary, light, dark, background, and anchors.');