@scalar/types 0.2.16 → 0.3.1

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 (53) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api-reference/api-client-configuration.d.ts +122 -0
  3. package/dist/api-reference/api-client-configuration.d.ts.map +1 -0
  4. package/dist/api-reference/api-client-configuration.js +7 -0
  5. package/dist/api-reference/api-client-configuration.js.map +7 -0
  6. package/dist/api-reference/api-client-plugin.d.ts +39 -0
  7. package/dist/api-reference/api-client-plugin.d.ts.map +1 -0
  8. package/dist/api-reference/api-client-plugin.js +34 -0
  9. package/dist/api-reference/api-client-plugin.js.map +7 -0
  10. package/dist/api-reference/api-reference-configuration.d.ts +177 -2144
  11. package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
  12. package/dist/api-reference/api-reference-configuration.js +263 -440
  13. package/dist/api-reference/api-reference-configuration.js.map +2 -2
  14. package/dist/api-reference/api-reference-plugin.d.ts +7 -65
  15. package/dist/api-reference/api-reference-plugin.d.ts.map +1 -1
  16. package/dist/api-reference/api-reference-plugin.js +8 -7
  17. package/dist/api-reference/api-reference-plugin.js.map +2 -2
  18. package/dist/api-reference/base-configuration.d.ts +118 -0
  19. package/dist/api-reference/base-configuration.d.ts.map +1 -0
  20. package/dist/api-reference/base-configuration.js +139 -0
  21. package/dist/api-reference/base-configuration.js.map +7 -0
  22. package/dist/api-reference/html-rendering-configuration.d.ts +3 -21
  23. package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
  24. package/dist/api-reference/html-rendering-configuration.js.map +2 -2
  25. package/dist/api-reference/index.d.ts +6 -3
  26. package/dist/api-reference/index.d.ts.map +1 -1
  27. package/dist/api-reference/index.js +12 -3
  28. package/dist/api-reference/index.js.map +2 -2
  29. package/dist/api-reference/source-configuration.d.ts +18 -0
  30. package/dist/api-reference/source-configuration.d.ts.map +1 -0
  31. package/dist/api-reference/source-configuration.js +87 -0
  32. package/dist/api-reference/source-configuration.js.map +7 -0
  33. package/dist/entities/security-scheme.d.ts +220 -1641
  34. package/dist/entities/security-scheme.d.ts.map +1 -1
  35. package/dist/entities/security-scheme.js +11 -2
  36. package/dist/entities/security-scheme.js.map +2 -2
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +2 -2
  41. package/dist/snippetz/snippetz.d.ts +9 -3
  42. package/dist/snippetz/snippetz.d.ts.map +1 -1
  43. package/dist/snippetz/snippetz.js +1 -0
  44. package/dist/snippetz/snippetz.js.map +2 -2
  45. package/package.json +4 -4
  46. package/dist/api-client/api-client-plugin.d.ts +0 -172
  47. package/dist/api-client/api-client-plugin.d.ts.map +0 -1
  48. package/dist/api-client/api-client-plugin.js +0 -33
  49. package/dist/api-client/api-client-plugin.js.map +0 -7
  50. package/dist/api-client/index.d.ts +0 -2
  51. package/dist/api-client/index.d.ts.map +0 -1
  52. package/dist/api-client/index.js +0 -6
  53. package/dist/api-client/index.js.map +0 -7
@@ -1,466 +1,292 @@
1
1
  import { z } from "zod";
2
- import { ApiClientPluginSchema } from "../api-client/index.js";
3
- import { ApiReferencePluginSchema } from "./api-reference-plugin.js";
4
- const themeIdEnum = z.enum([
5
- "alternate",
6
- "default",
7
- "moon",
8
- "purple",
9
- "solarized",
10
- "bluePlanet",
11
- "deepSpace",
12
- "saturn",
13
- "kepler",
14
- "elysiajs",
15
- "fastify",
16
- "mars",
17
- "laserwave",
18
- "none"
19
- ]);
20
- const operationTitleEnum = z.enum(["summary", "path"]);
21
- const searchHotKeyEnum = z.enum([
22
- "a",
23
- "b",
24
- "c",
25
- "d",
26
- "e",
27
- "f",
28
- "g",
29
- "h",
30
- "i",
31
- "j",
32
- "k",
33
- "l",
34
- "m",
35
- "n",
36
- "o",
37
- "p",
38
- "q",
39
- "r",
40
- "s",
41
- "t",
42
- "u",
43
- "v",
44
- "w",
45
- "x",
46
- "y",
47
- "z"
48
- ]);
49
- const integrationEnum = z.enum([
50
- "adonisjs",
51
- "docusaurus",
52
- "dotnet",
53
- "elysiajs",
54
- "express",
55
- "fastapi",
56
- "fastify",
57
- "go",
58
- "hono",
59
- "html",
60
- "laravel",
61
- "litestar",
62
- "nestjs",
63
- "nextjs",
64
- "nitro",
65
- "nuxt",
66
- "platformatic",
67
- "react",
68
- "rust",
69
- "svelte",
70
- "vue"
71
- ]).nullable();
72
- const specConfigurationSchema = z.object({
73
- /**
74
- * URL to an OpenAPI/Swagger document
75
- *
76
- * @deprecated Please move `url` to the top level and remove the `spec` prefix.
77
- *
78
- * @example
79
- * ```ts
80
- * const oldConfiguration = {
81
- * spec: {
82
- * url: 'https://example.com/openapi.json',
83
- * },
84
- * }
85
- *
86
- * const newConfiguration = {
87
- * url: 'https://example.com/openapi.json',
88
- * }
89
- * ```
90
- **/
91
- url: z.string().optional(),
2
+ import { apiReferencePluginSchema } from "./api-reference-plugin.js";
3
+ import { NEW_PROXY_URL, OLD_PROXY_URL, baseConfigurationSchema } from "./base-configuration.js";
4
+ import { sourceConfigurationSchema } from "./source-configuration.js";
5
+ const fetchLikeSchema = z.custom();
6
+ const apiReferenceConfigurationSchema = baseConfigurationSchema.extend({
92
7
  /**
93
- * Directly embed the OpenAPI document.
94
- * Can be a string, object, function returning an object, or null.
95
- *
96
- * @remarks It's recommended to pass a URL instead of content.
97
- *
98
- * @deprecated Please move `content` to the top level and remove the `spec` prefix.
99
- *
100
- * @example
101
- * ```ts
102
- * const oldConfiguration = {
103
- * spec: {
104
- * content: '…',
105
- * },
106
- * }
107
- *
108
- * const newConfiguration = {
109
- * content: '…',
110
- * }
111
- * ```
112
- **/
113
- content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
8
+ * The layout to use for the references
9
+ * @default 'modern'
10
+ */
11
+ layout: z.enum(["modern", "classic"]).optional().default("modern").catch("modern"),
114
12
  /**
115
- * The title of the OpenAPI document.
116
- *
117
- * @example 'Scalar Galaxy'
118
- *
119
- * @deprecated Please move `title` to the top level and remove the `spec` prefix.
13
+ * URL to a request proxy for the API client
14
+ * @deprecated Use proxyUrl instead
120
15
  */
121
- title: z.string().optional(),
16
+ proxy: z.string().optional(),
122
17
  /**
123
- * The slug of the OpenAPI document used in the URL.
124
- *
125
- * If none is passed, the title will be used.
126
- *
127
- * If no title is used, it'll just use the index.
128
- *
129
- * @example 'scalar-galaxy'
18
+ * Custom fetch function for custom logic
130
19
  *
131
- * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
20
+ * Can be used to add custom headers, handle auth, etc.
132
21
  */
133
- slug: z.string().optional()
134
- });
135
- const pathRoutingSchema = z.object({
136
- /** Base path for the API reference */
137
- basePath: z.string()
138
- });
139
- const apiClientConfigurationSchema = z.object({
22
+ fetch: fetchLikeSchema.optional(),
140
23
  /**
141
- * URL to an OpenAPI/Swagger document
142
- **/
143
- url: z.string().optional(),
24
+ * Plugins for the API reference
25
+ */
26
+ plugins: z.array(apiReferencePluginSchema).optional(),
144
27
  /**
145
- * Directly embed the OpenAPI document.
146
- * Can be a string, object, function returning an object, or null.
147
- *
148
- * @remarks It's recommended to pass a URL instead of content.
149
- **/
150
- content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
28
+ * Allows the user to inject an editor for the spec
29
+ * @default false
30
+ */
31
+ isEditable: z.boolean().optional().default(false).catch(false),
151
32
  /**
152
- * The title of the OpenAPI document.
153
- *
154
- * @example 'Scalar Galaxy'
33
+ * Controls whether the references show a loading state in the intro
34
+ * @default false
155
35
  */
156
- title: z.string().optional(),
36
+ isLoading: z.boolean().optional().default(false).catch(false),
157
37
  /**
158
- * The slug of the OpenAPI document used in the URL.
159
- *
160
- * If none is passed, the title will be used.
161
- *
162
- * If no title is used, it'll just use the index.
163
- *
164
- * @example 'scalar-galaxy'
38
+ * Whether to show models in the sidebar, search, and content.
39
+ * @default false
40
+ */
41
+ hideModels: z.boolean().optional().default(false).catch(false),
42
+ /**
43
+ * Sets the file type of the document to download, set to `none` to hide the download button
44
+ * @default 'both'
165
45
  */
166
- slug: z.string().optional(),
46
+ documentDownloadType: z.enum(["yaml", "json", "both", "direct", "none"]).optional().default("both").catch("both"),
167
47
  /**
168
- * The OpenAPI/Swagger document to render
48
+ * Whether to show the "Download OpenAPI Document" button
49
+ * @default false
50
+ * @deprecated Use `documentDownloadType: 'none'` instead
51
+ */
52
+ hideDownloadButton: z.boolean().optional(),
53
+ /**
54
+ * Whether to show the "Test Request" button
55
+ * @default false
56
+ */
57
+ hideTestRequestButton: z.boolean().optional().default(false).catch(false),
58
+ /**
59
+ * Whether to show the sidebar search bar
60
+ * @default false
61
+ */
62
+ hideSearch: z.boolean().optional().default(false).catch(false),
63
+ /**
64
+ * Whether to show the operationId
169
65
  *
170
- * @deprecated Use `url` and `content` on the top level instead.
171
- **/
172
- spec: specConfigurationSchema.optional(),
173
- /** Prefill authentication */
174
- authentication: z.any().optional(),
175
- // Temp until we bring in the new auth
176
- /** Base URL for the API server */
177
- baseServerURL: z.string().optional(),
178
- /**
179
- * Whether to hide the client button
180
66
  * @default false
181
67
  */
182
- hideClientButton: z.boolean().optional().default(false).catch(false),
183
- /** URL to a request proxy for the API client */
184
- proxyUrl: z.string().optional(),
185
- /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
186
- searchHotKey: searchHotKeyEnum.optional(),
187
- /** List of OpenAPI server objects */
188
- servers: z.array(z.any()).optional(),
189
- // Using any for OpenAPIV3_1.ServerObject
68
+ showOperationId: z.boolean().optional().default(false).catch(false),
69
+ /** Whether dark mode is on or off initially (light mode) */
70
+ darkMode: z.boolean().optional(),
71
+ /** forceDarkModeState makes it always this state no matter what */
72
+ forceDarkModeState: z.enum(["dark", "light"]).optional(),
190
73
  /**
191
- * Whether to show the sidebar
192
- * @default true
74
+ * Whether to show the dark mode toggle
75
+ * @default false
193
76
  */
194
- showSidebar: z.boolean().optional().default(true).catch(true),
195
- /**
196
- * Whether to use the operation summary or the operation path for the sidebar and search
197
- * @default 'summary'
198
- */
199
- operationTitleSource: operationTitleEnum.optional().default("summary").catch("summary"),
200
- /** A string to use one of the color presets */
201
- theme: themeIdEnum.optional().default("default").catch("default"),
202
- /** Integration type identifier */
203
- _integration: integrationEnum.optional(),
204
- /** onRequestSent is fired when a request is sent */
205
- onRequestSent: z.function().args(z.string()).returns(z.void()).optional(),
206
- /** Whether to persist auth to local storage */
207
- persistAuth: z.boolean().optional().default(false).catch(false),
208
- /** Plugins for the API client */
209
- plugins: z.array(ApiClientPluginSchema).optional(),
210
- /** Enables / disables telemetry*/
211
- telemetry: z.boolean().optional().default(true)
212
- });
213
- const FetchLike = z.function().args(z.union([z.string(), z.instanceof(URL), z.instanceof(Request)]), z.any().optional()).returns(z.promise(z.instanceof(Response))).optional();
214
- const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(
215
- z.object({
216
- /**
217
- * The layout to use for the references
218
- * @default 'modern'
219
- */
220
- layout: z.enum(["modern", "classic"]).optional().default("modern").catch("modern"),
221
- /**
222
- * URL to a request proxy for the API client
223
- * @deprecated Use proxyUrl instead
224
- */
225
- proxy: z.string().optional(),
226
- /**
227
- * Custom fetch function for custom logic
228
- *
229
- * Can be used to add custom headers, handle auth, etc.
230
- */
231
- fetch: FetchLike,
232
- /**
233
- * Plugins for the API reference
234
- */
235
- plugins: z.array(ApiReferencePluginSchema).optional(),
236
- /**
237
- * Allows the user to inject an editor for the spec
238
- * @default false
239
- */
240
- isEditable: z.boolean().optional().default(false).catch(false),
241
- /**
242
- * Controls whether the references show a loading state in the intro
243
- * @default false
244
- */
245
- isLoading: z.boolean().optional().default(false).catch(false),
246
- /**
247
- * Whether to show models in the sidebar, search, and content.
248
- * @default false
249
- */
250
- hideModels: z.boolean().optional().default(false).catch(false),
251
- /**
252
- * Sets the file type of the document to download, set to `none` to hide the download button
253
- * @default 'both'
254
- */
255
- documentDownloadType: z.enum(["yaml", "json", "both", "direct", "none"]).optional().default("both").catch("both"),
256
- /**
257
- * Whether to show the "Download OpenAPI Document" button
258
- * @default false
259
- * @deprecated Use `documentDownloadType: 'none'` instead
260
- */
261
- hideDownloadButton: z.boolean().optional(),
262
- /**
263
- * Whether to show the "Test Request" button
264
- * @default false
265
- */
266
- hideTestRequestButton: z.boolean().optional().default(false).catch(false),
267
- /**
268
- * Whether to show the sidebar search bar
269
- * @default false
270
- */
271
- hideSearch: z.boolean().optional().default(false).catch(false),
272
- /** Whether dark mode is on or off initially (light mode) */
273
- darkMode: z.boolean().optional(),
274
- /** forceDarkModeState makes it always this state no matter what */
275
- forceDarkModeState: z.enum(["dark", "light"]).optional(),
276
- /**
277
- * Whether to show the dark mode toggle
278
- * @default false
279
- */
280
- hideDarkModeToggle: z.boolean().optional().default(false).catch(false),
281
- /**
282
- * If used, passed data will be added to the HTML header
283
- * @see https://unhead.unjs.io/usage/composables/use-seo-meta
284
- */
285
- metaData: z.any().optional(),
286
- // Using any for UseSeoMetaInput since it's an external type
287
- /**
288
- * Path to a favicon image
289
- * @default undefined
290
- * @example '/favicon.svg'
291
- */
292
- favicon: z.string().optional(),
293
- /**
294
- * List of httpsnippet clients to hide from the clients menu
295
- * By default hides Unirest, pass `[]` to show all clients
296
- */
297
- hiddenClients: z.union([z.record(z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)]).optional(),
298
- /** Determine the HTTP client that's selected by default */
299
- defaultHttpClient: z.object({
300
- targetKey: z.custom(),
301
- clientKey: z.string()
302
- }).optional(),
303
- /** Custom CSS to be added to the page */
304
- customCss: z.string().optional(),
305
- /** onSpecUpdate is fired on spec/swagger content change */
306
- onSpecUpdate: z.function().args(z.string()).returns(z.void()).optional(),
307
- /** onServerChange is fired on selected server change */
308
- onServerChange: z.function().args(z.string()).returns(z.void()).optional(),
309
- /** onDocumentSelect is fired when the config is selected */
310
- onDocumentSelect: z.function().returns(z.void().or(z.void().promise())).optional(),
311
- /** Callback fired when the reference is fully loaded */
312
- onLoaded: z.function().returns(z.void().or(z.void().promise())).optional(),
313
- /** onBeforeRequest is fired before the request is sent. You can modify the request here. */
314
- onBeforeRequest: z.function().args(z.object({ request: z.instanceof(Request) })).returns(z.void().or(z.void().promise())).optional(),
315
- /**
316
- * onShowMore is fired when the user clicks the "Show more" button on the references
317
- * @param tagId - The ID of the tag that was clicked
318
- */
319
- onShowMore: z.function().args(z.string()).returns(z.void().or(z.void().promise())).optional(),
320
- /**
321
- * onSidebarClick is fired when the user clicks on a sidebar item
322
- * @param href - The href of the sidebar item that was clicked
323
- */
324
- onSidebarClick: z.function().args(z.string()).returns(z.void().or(z.void().promise())).optional(),
325
- /**
326
- * Route using paths instead of hashes, your server MUST support this
327
- * @example '/standalone-api-reference/:custom(.*)?'
328
- * @experimental
329
- * @default undefined
330
- */
331
- pathRouting: pathRoutingSchema.optional(),
332
- /**
333
- * Customize the heading portion of the hash
334
- * @param heading - The heading object
335
- * @returns A string ID used to generate the URL hash
336
- * @default (heading) => `#description/${heading.slug}`
337
- */
338
- generateHeadingSlug: z.function().args(
339
- z.object({
340
- slug: z.string().default("headingSlug")
341
- })
342
- ).returns(z.string()).optional(),
343
- /**
344
- * Customize the model portion of the hash
345
- * @param model - The model object with a name property
346
- * @returns A string ID used to generate the URL hash
347
- * @default (model) => slug(model.name)
348
- */
349
- generateModelSlug: z.function().args(
350
- z.object({
351
- name: z.string().default("modelName")
352
- })
353
- ).returns(z.string()).optional(),
354
- /**
355
- * Customize the tag portion of the hash
356
- * @param tag - The tag object
357
- * @returns A string ID used to generate the URL hash
358
- * @default (tag) => slug(tag.name)
359
- */
360
- generateTagSlug: z.function().args(
361
- z.object({
362
- name: z.string().default("tagName")
363
- })
364
- ).returns(z.string()).optional(),
365
- /**
366
- * Customize the operation portion of the hash
367
- * @param operation - The operation object
368
- * @returns A string ID used to generate the URL hash
369
- * @default (operation) => `${operation.method}${operation.path}`
370
- */
371
- generateOperationSlug: z.function().args(
77
+ hideDarkModeToggle: z.boolean().optional().default(false).catch(false),
78
+ /**
79
+ * If used, passed data will be added to the HTML header
80
+ * @see https://unhead.unjs.io/usage/composables/use-seo-meta
81
+ */
82
+ metaData: z.any().optional(),
83
+ // Using any for UseSeoMetaInput since it's an external type
84
+ /**
85
+ * Path to a favicon image
86
+ * @default undefined
87
+ * @example '/favicon.svg'
88
+ */
89
+ favicon: z.string().optional(),
90
+ /**
91
+ * List of httpsnippet clients to hide from the clients menu
92
+ * By default hides Unirest, pass `[]` to show all clients
93
+ */
94
+ hiddenClients: z.union([z.record(z.string(), z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)]).optional(),
95
+ /** Determine the HTTP client that's selected by default */
96
+ defaultHttpClient: z.object({
97
+ targetKey: z.custom(),
98
+ clientKey: z.string()
99
+ }).optional(),
100
+ /** Custom CSS to be added to the page */
101
+ customCss: z.string().optional(),
102
+ /** onSpecUpdate is fired on spec/swagger content change */
103
+ onSpecUpdate: z.function({
104
+ input: [z.string()],
105
+ output: z.void()
106
+ }).optional(),
107
+ /** onServerChange is fired on selected server change */
108
+ onServerChange: z.function({
109
+ input: [z.string()],
110
+ output: z.void()
111
+ }).optional(),
112
+ /** onDocumentSelect is fired when the config is selected */
113
+ onDocumentSelect: z.function().optional(),
114
+ /** Callback fired when the reference is fully loaded */
115
+ onLoaded: z.function().optional(),
116
+ /** onBeforeRequest is fired before the request is sent. You can modify the request here. */
117
+ onBeforeRequest: z.function({ input: [z.object({ request: z.instanceof(Request) })], output: z.void() }).optional(),
118
+ /**
119
+ * onShowMore is fired when the user clicks the "Show more" button on the references
120
+ * @param tagId - The ID of the tag that was clicked
121
+ */
122
+ onShowMore: z.function({
123
+ input: [z.string()],
124
+ output: z.void()
125
+ }).optional(),
126
+ /**
127
+ * onSidebarClick is fired when the user clicks on a sidebar item
128
+ * @param href - The href of the sidebar item that was clicked
129
+ */
130
+ onSidebarClick: z.function({
131
+ input: [z.string()],
132
+ output: z.void()
133
+ }).optional(),
134
+ /**
135
+ * Route using paths instead of hashes, your server MUST support this
136
+ * @example '/standalone-api-reference/:custom(.*)?'
137
+ * @experimental
138
+ * @default undefined
139
+ */
140
+ pathRouting: z.object({
141
+ basePath: z.string()
142
+ }).optional(),
143
+ /**
144
+ * Customize the heading portion of the hash
145
+ * @param heading - The heading object
146
+ * @returns A string ID used to generate the URL hash
147
+ * @default (heading) => `#description/${heading.slug}`
148
+ */
149
+ generateHeadingSlug: z.function({
150
+ input: [z.object({ slug: z.string().default("headingSlug") })],
151
+ output: z.string()
152
+ }).optional(),
153
+ /**
154
+ * Customize the model portion of the hash
155
+ * @param model - The model object with a name property
156
+ * @returns A string ID used to generate the URL hash
157
+ * @default (model) => slug(model.name)
158
+ */
159
+ generateModelSlug: z.function({
160
+ input: [z.object({ name: z.string().default("modelName") })],
161
+ output: z.string()
162
+ }).optional(),
163
+ /**
164
+ * Customize the tag portion of the hash
165
+ * @param tag - The tag object
166
+ * @returns A string ID used to generate the URL hash
167
+ * @default (tag) => slug(tag.name)
168
+ */
169
+ generateTagSlug: z.function({
170
+ input: [z.object({ name: z.string().default("tagName") })],
171
+ output: z.string()
172
+ }).optional(),
173
+ /**
174
+ * Customize the operation portion of the hash
175
+ * @param operation - The operation object
176
+ * @returns A string ID used to generate the URL hash
177
+ * @default (operation) => `${operation.method}${operation.path}`
178
+ */
179
+ generateOperationSlug: z.function({
180
+ input: [
372
181
  z.object({
373
182
  path: z.string(),
374
183
  operationId: z.string().optional(),
375
184
  method: z.string(),
376
185
  summary: z.string().optional()
377
186
  })
378
- ).returns(z.string()).optional(),
379
- /**
380
- * Customize the webhook portion of the hash
381
- * @param webhook - The webhook object
382
- * @returns A string ID used to generate the URL hash
383
- * @default (webhook) => slug(webhook.name)
384
- */
385
- generateWebhookSlug: z.function().args(
187
+ ],
188
+ output: z.string()
189
+ }).optional(),
190
+ /**
191
+ * Customize the webhook portion of the hash
192
+ * @param webhook - The webhook object
193
+ * @returns A string ID used to generate the URL hash
194
+ * @default (webhook) => slug(webhook.name)
195
+ */
196
+ generateWebhookSlug: z.function({
197
+ input: [
386
198
  z.object({
387
199
  name: z.string(),
388
200
  method: z.string().optional()
389
201
  })
390
- ).returns(z.string()).optional(),
391
- /**
392
- * To handle redirects, pass a function that will recieve:
393
- * - The current path with hash if pathRouting is enabled
394
- * - The current hash if hashRouting (default)
395
- * And then passes that to history.replaceState
396
- *
397
- * @example hashRouting (default)
398
- * ```ts
399
- * redirect: (hash: string) => hash.replace('#v1/old-path', '#v2/new-path')
400
- * ```
401
- * @example pathRouting
402
- * ```ts
403
- * redirect: (pathWithHash: string) => {
404
- * if (pathWithHash.includes('#')) {
405
- * return pathWithHash.replace('/v1/tags/user#operation/get-user', '/v1/tags/user/operation/get-user')
406
- * }
407
- * return null
408
- * }
409
- * ```
410
- */
411
- redirect: z.function().args(z.string()).returns(z.string().nullable().optional()).optional(),
412
- /**
413
- * Whether to include default fonts
414
- * @default true
415
- */
416
- withDefaultFonts: z.boolean().optional().default(true).catch(true),
417
- /**
418
- * Whether to expand all tags by default
419
- *
420
- * Warning this can cause performance issues on big documents
421
- * @default false
422
- */
423
- defaultOpenAllTags: z.boolean().optional().default(false).catch(false),
424
- /**
425
- * Whether to expand all models by default
426
- *
427
- * Warning this can cause performance issues on big documents
428
- * @default false
429
- */
430
- expandAllModelSections: z.boolean().optional().default(false).catch(false),
431
- /**
432
- * Whether to expand all responses by default
433
- *
434
- * Warning this can cause performance issues on big documents
435
- * @default false
436
- */
437
- expandAllResponses: z.boolean().optional().default(false).catch(false),
438
- /**
439
- * Function to sort tags
440
- * @default 'alpha' for alphabetical sorting
441
- */
442
- tagsSorter: z.union([z.literal("alpha"), z.function().args(z.any(), z.any()).returns(z.number())]).optional(),
443
- /**
444
- * Function to sort operations
445
- * @default 'alpha' for alphabetical sorting
446
- */
447
- operationsSorter: z.union([z.literal("alpha"), z.literal("method"), z.function().args(z.any(), z.any()).returns(z.number())]).optional(),
448
- /**
449
- * Order the schema properties by
450
- * @default 'alpha' for alphabetical sorting
451
- */
452
- orderSchemaPropertiesBy: z.union([z.literal("alpha"), z.literal("preserve")]).optional().default("alpha").catch("alpha"),
453
- /**
454
- * Sort the schema properties by required ones first
455
- * @default true
456
- */
457
- orderRequiredPropertiesFirst: z.boolean().optional().default(true).catch(true)
458
- })
459
- );
460
- const OLD_PROXY_URL = "https://api.scalar.com/request-proxy";
461
- const NEW_PROXY_URL = "https://proxy.scalar.com";
462
- const migrateConfiguration = (_configuration) => {
463
- const configuration = { ..._configuration };
202
+ ],
203
+ output: z.string()
204
+ }).optional(),
205
+ /**
206
+ * To handle redirects, pass a function that will recieve:
207
+ * - The current path with hash if pathRouting is enabled
208
+ * - The current hash if hashRouting (default)
209
+ * And then passes that to history.replaceState
210
+ *
211
+ * @example hashRouting (default)
212
+ * ```ts
213
+ * redirect: (hash: string) => hash.replace('#v1/old-path', '#v2/new-path')
214
+ * ```
215
+ * @example pathRouting
216
+ * ```ts
217
+ * redirect: (pathWithHash: string) => {
218
+ * if (pathWithHash.includes('#')) {
219
+ * return pathWithHash.replace('/v1/tags/user#operation/get-user', '/v1/tags/user/operation/get-user')
220
+ * }
221
+ * return null
222
+ * }
223
+ * ```
224
+ */
225
+ redirect: z.function({
226
+ input: [z.string()],
227
+ output: z.string().nullable().optional()
228
+ }).optional(),
229
+ /**
230
+ * Whether to include default fonts
231
+ * @default true
232
+ */
233
+ withDefaultFonts: z.boolean().optional().default(true).catch(true),
234
+ /**
235
+ * Whether to expand all tags by default
236
+ *
237
+ * Warning this can cause performance issues on big documents
238
+ * @default false
239
+ */
240
+ defaultOpenAllTags: z.boolean().optional().default(false).catch(false),
241
+ /**
242
+ * Whether to expand all models by default
243
+ *
244
+ * Warning this can cause performance issues on big documents
245
+ * @default false
246
+ */
247
+ expandAllModelSections: z.boolean().optional().default(false).catch(false),
248
+ /**
249
+ * Whether to expand all responses by default
250
+ *
251
+ * Warning this can cause performance issues on big documents
252
+ * @default false
253
+ */
254
+ expandAllResponses: z.boolean().optional().default(false).catch(false),
255
+ /**
256
+ * Function to sort tags
257
+ * @default 'alpha' for alphabetical sorting
258
+ */
259
+ tagsSorter: z.union([
260
+ z.literal("alpha"),
261
+ z.function({
262
+ input: [z.any(), z.any()],
263
+ output: z.number()
264
+ })
265
+ ]).optional(),
266
+ /**
267
+ * Function to sort operations
268
+ * @default 'alpha' for alphabetical sorting
269
+ */
270
+ operationsSorter: z.union([
271
+ z.literal("alpha"),
272
+ z.literal("method"),
273
+ z.function({
274
+ input: [z.any(), z.any()],
275
+ output: z.number()
276
+ })
277
+ ]).optional(),
278
+ /**
279
+ * Order the schema properties by
280
+ * @default 'alpha' for alphabetical sorting
281
+ */
282
+ orderSchemaPropertiesBy: z.union([z.literal("alpha"), z.literal("preserve")]).optional().default("alpha").catch("alpha"),
283
+ /**
284
+ * Sort the schema properties by required ones first
285
+ * @default true
286
+ */
287
+ orderRequiredPropertiesFirst: z.boolean().optional().default(true).catch(true)
288
+ });
289
+ const apiReferenceConfigurationWithSourceSchema = apiReferenceConfigurationSchema.extend(sourceConfigurationSchema.shape).transform((configuration) => {
464
290
  if (configuration.hideDownloadButton) {
465
291
  console.warn(
466
292
  `[DEPRECATED] You're using the deprecated 'hideDownloadButton' attribute. Use 'documentDownloadType: 'none'' instead.`
@@ -499,14 +325,11 @@ const migrateConfiguration = (_configuration) => {
499
325
  configuration.proxyUrl = NEW_PROXY_URL;
500
326
  }
501
327
  return configuration;
502
- };
503
- const apiReferenceConfigurationSchema = _apiReferenceConfigurationSchema.transform(migrateConfiguration);
328
+ });
504
329
  const isConfigurationWithSources = (config) => Boolean(!Array.isArray(config) && config && "sources" in config && Array.isArray(config.sources));
505
330
  export {
506
- FetchLike,
507
- apiClientConfigurationSchema,
508
331
  apiReferenceConfigurationSchema,
509
- isConfigurationWithSources,
510
- specConfigurationSchema
332
+ apiReferenceConfigurationWithSourceSchema,
333
+ isConfigurationWithSources
511
334
  };
512
335
  //# sourceMappingURL=api-reference-configuration.js.map