@scalar/types 0.1.13 → 0.1.14

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 (69) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/api-reference/api-reference-configuration.d.ts +9 -9
  3. package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
  4. package/dist/api-reference/api-reference-configuration.js +271 -289
  5. package/dist/api-reference/api-reference-configuration.js.map +7 -0
  6. package/dist/api-reference/api-reference-configuration.test.js +224 -0
  7. package/dist/api-reference/api-reference-configuration.test.js.map +7 -0
  8. package/dist/api-reference/api-reference-plugin.js +24 -22
  9. package/dist/api-reference/api-reference-plugin.js.map +7 -0
  10. package/dist/api-reference/authentication-configuration.d.ts +2 -2
  11. package/dist/api-reference/authentication-configuration.d.ts.map +1 -1
  12. package/dist/api-reference/authentication-configuration.js +1 -0
  13. package/dist/api-reference/authentication-configuration.js.map +7 -0
  14. package/dist/api-reference/authentication-configuration.test-d.js +45 -0
  15. package/dist/api-reference/authentication-configuration.test-d.js.map +7 -0
  16. package/dist/api-reference/html-api.d.ts +1 -1
  17. package/dist/api-reference/html-api.d.ts.map +1 -1
  18. package/dist/api-reference/html-api.js +1 -0
  19. package/dist/api-reference/html-api.js.map +7 -0
  20. package/dist/api-reference/html-rendering-configuration.d.ts +1 -1
  21. package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
  22. package/dist/api-reference/html-rendering-configuration.js +19 -21
  23. package/dist/api-reference/html-rendering-configuration.js.map +7 -0
  24. package/dist/api-reference/index.d.ts +4 -5
  25. package/dist/api-reference/index.d.ts.map +1 -1
  26. package/dist/api-reference/index.js +17 -3
  27. package/dist/api-reference/index.js.map +7 -0
  28. package/dist/entities/index.d.ts +1 -1
  29. package/dist/entities/index.d.ts.map +1 -1
  30. package/dist/entities/index.js +21 -1
  31. package/dist/entities/index.js.map +7 -0
  32. package/dist/entities/security-scheme.js +116 -157
  33. package/dist/entities/security-scheme.js.map +7 -0
  34. package/dist/entities/security-scheme.test.js +311 -0
  35. package/dist/entities/security-scheme.test.js.map +7 -0
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +3 -4
  39. package/dist/index.js.map +7 -0
  40. package/dist/legacy/index.d.ts +1 -1
  41. package/dist/legacy/index.d.ts.map +1 -1
  42. package/dist/legacy/index.js +2 -1
  43. package/dist/legacy/index.js.map +7 -0
  44. package/dist/legacy/reference-config.d.ts +2 -2
  45. package/dist/legacy/reference-config.d.ts.map +1 -1
  46. package/dist/legacy/reference-config.js +10 -8
  47. package/dist/legacy/reference-config.js.map +7 -0
  48. package/dist/snippetz/index.d.ts +1 -1
  49. package/dist/snippetz/index.d.ts.map +1 -1
  50. package/dist/snippetz/index.js +2 -1
  51. package/dist/snippetz/index.js.map +7 -0
  52. package/dist/snippetz/snippetz.js +39 -40
  53. package/dist/snippetz/snippetz.js.map +7 -0
  54. package/dist/snippetz/snippetz.test-d.js +28 -0
  55. package/dist/snippetz/snippetz.test-d.js.map +7 -0
  56. package/dist/utils/index.d.ts +2 -2
  57. package/dist/utils/index.d.ts.map +1 -1
  58. package/dist/utils/index.js +5 -1
  59. package/dist/utils/index.js.map +7 -0
  60. package/dist/utils/nanoid.js +7 -11
  61. package/dist/utils/nanoid.js.map +7 -0
  62. package/dist/utils/nanoid.test.js +29 -0
  63. package/dist/utils/nanoid.test.js.map +7 -0
  64. package/dist/utils/utility-types.js +1 -0
  65. package/dist/utils/utility-types.js.map +7 -0
  66. package/package.json +5 -9
  67. package/dist/api-reference/helpers/migrate-theme-variables.d.ts +0 -10
  68. package/dist/api-reference/helpers/migrate-theme-variables.d.ts.map +0 -1
  69. package/dist/api-reference/helpers/migrate-theme-variables.js +0 -22
@@ -1,217 +1,209 @@
1
- import { z } from 'zod';
2
- import { ApiReferencePluginSchema } from './api-reference-plugin.js';
3
- import { migrateThemeVariables } from './helpers/migrate-theme-variables.js';
4
-
5
- /** Available theme presets for the API reference */
1
+ import { z } from "zod";
2
+ import { ApiReferencePluginSchema } from "./api-reference-plugin.js";
6
3
  const themeIdEnum = z.enum([
7
- 'alternate',
8
- 'default',
9
- 'moon',
10
- 'purple',
11
- 'solarized',
12
- 'bluePlanet',
13
- 'deepSpace',
14
- 'saturn',
15
- 'kepler',
16
- 'elysiajs',
17
- 'fastify',
18
- 'mars',
19
- 'laserwave',
20
- 'none',
4
+ "alternate",
5
+ "default",
6
+ "moon",
7
+ "purple",
8
+ "solarized",
9
+ "bluePlanet",
10
+ "deepSpace",
11
+ "saturn",
12
+ "kepler",
13
+ "elysiajs",
14
+ "fastify",
15
+ "mars",
16
+ "laserwave",
17
+ "none"
21
18
  ]);
22
- /** Valid keys that can be used with CTRL/CMD to open the search modal */
23
19
  const searchHotKeyEnum = z.enum([
24
- 'a',
25
- 'b',
26
- 'c',
27
- 'd',
28
- 'e',
29
- 'f',
30
- 'g',
31
- 'h',
32
- 'i',
33
- 'j',
34
- 'k',
35
- 'l',
36
- 'm',
37
- 'n',
38
- 'o',
39
- 'p',
40
- 'q',
41
- 'r',
42
- 's',
43
- 't',
44
- 'u',
45
- 'v',
46
- 'w',
47
- 'x',
48
- 'y',
49
- 'z',
20
+ "a",
21
+ "b",
22
+ "c",
23
+ "d",
24
+ "e",
25
+ "f",
26
+ "g",
27
+ "h",
28
+ "i",
29
+ "j",
30
+ "k",
31
+ "l",
32
+ "m",
33
+ "n",
34
+ "o",
35
+ "p",
36
+ "q",
37
+ "r",
38
+ "s",
39
+ "t",
40
+ "u",
41
+ "v",
42
+ "w",
43
+ "x",
44
+ "y",
45
+ "z"
50
46
  ]);
51
- /** Supported integration types */
52
- const integrationEnum = z
53
- .enum([
54
- 'adonisjs',
55
- 'docusaurus',
56
- 'dotnet',
57
- 'elysiajs',
58
- 'express',
59
- 'fastapi',
60
- 'fastify',
61
- 'go',
62
- 'hono',
63
- 'html',
64
- 'laravel',
65
- 'litestar',
66
- 'nestjs',
67
- 'nextjs',
68
- 'nitro',
69
- 'nuxt',
70
- 'platformatic',
71
- 'react',
72
- 'rust',
73
- 'svelte',
74
- 'vue',
75
- ])
76
- .nullable();
77
- /** Configuration for the OpenAPI/Swagger specification */
47
+ const integrationEnum = z.enum([
48
+ "adonisjs",
49
+ "docusaurus",
50
+ "dotnet",
51
+ "elysiajs",
52
+ "express",
53
+ "fastapi",
54
+ "fastify",
55
+ "go",
56
+ "hono",
57
+ "html",
58
+ "laravel",
59
+ "litestar",
60
+ "nestjs",
61
+ "nextjs",
62
+ "nitro",
63
+ "nuxt",
64
+ "platformatic",
65
+ "react",
66
+ "rust",
67
+ "svelte",
68
+ "vue"
69
+ ]).nullable();
78
70
  const specConfigurationSchema = z.object({
79
- /**
80
- * URL to an OpenAPI/Swagger document
81
- *
82
- * @deprecated Please move `url` to the top level and remove the `spec` prefix.
83
- *
84
- * @example
85
- * ```ts
86
- * const oldConfiguration = {
87
- * spec: {
88
- * url: 'https://example.com/openapi.json',
89
- * },
90
- * }
91
- *
92
- * const newConfiguration = {
93
- * url: 'https://example.com/openapi.json',
94
- * }
95
- * ```
96
- **/
97
- url: z.string().optional(),
98
- /**
99
- * Directly embed the OpenAPI document.
100
- * Can be a string, object, function returning an object, or null.
101
- *
102
- * @remarks It's recommended to pass a URL instead of content.
103
- *
104
- * @deprecated Please move `content` to the top level and remove the `spec` prefix.
105
- *
106
- * @example
107
- * ```ts
108
- * const oldConfiguration = {
109
- * spec: {
110
- * content: '…',
111
- * },
112
- * }
113
- *
114
- * const newConfiguration = {
115
- * content: '…',
116
- * }
117
- * ```
118
- **/
119
- content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
120
- /**
121
- * The title of the OpenAPI document.
122
- *
123
- * @example 'Scalar Galaxy'
124
- *
125
- * @deprecated Please move `title` to the top level and remove the `spec` prefix.
126
- */
127
- title: z.string().optional(),
128
- /**
129
- * The slug of the OpenAPI document used in the URL.
130
- *
131
- * If none is passed, the title will be used.
132
- *
133
- * If no title is used, it'll just use the index.
134
- *
135
- * @example 'scalar-galaxy'
136
- *
137
- * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
138
- */
139
- slug: z.string().optional(),
71
+ /**
72
+ * URL to an OpenAPI/Swagger document
73
+ *
74
+ * @deprecated Please move `url` to the top level and remove the `spec` prefix.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const oldConfiguration = {
79
+ * spec: {
80
+ * url: 'https://example.com/openapi.json',
81
+ * },
82
+ * }
83
+ *
84
+ * const newConfiguration = {
85
+ * url: 'https://example.com/openapi.json',
86
+ * }
87
+ * ```
88
+ **/
89
+ url: z.string().optional(),
90
+ /**
91
+ * Directly embed the OpenAPI document.
92
+ * Can be a string, object, function returning an object, or null.
93
+ *
94
+ * @remarks It's recommended to pass a URL instead of content.
95
+ *
96
+ * @deprecated Please move `content` to the top level and remove the `spec` prefix.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const oldConfiguration = {
101
+ * spec: {
102
+ * content: '…',
103
+ * },
104
+ * }
105
+ *
106
+ * const newConfiguration = {
107
+ * content: '…',
108
+ * }
109
+ * ```
110
+ **/
111
+ content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
112
+ /**
113
+ * The title of the OpenAPI document.
114
+ *
115
+ * @example 'Scalar Galaxy'
116
+ *
117
+ * @deprecated Please move `title` to the top level and remove the `spec` prefix.
118
+ */
119
+ title: z.string().optional(),
120
+ /**
121
+ * The slug of the OpenAPI document used in the URL.
122
+ *
123
+ * If none is passed, the title will be used.
124
+ *
125
+ * If no title is used, it'll just use the index.
126
+ *
127
+ * @example 'scalar-galaxy'
128
+ *
129
+ * @deprecated Please move `slug` to the top level and remove the `spec` prefix.
130
+ */
131
+ slug: z.string().optional()
140
132
  });
141
- /** Configuration for path-based routing */
142
133
  const pathRoutingSchema = z.object({
143
- /** Base path for the API reference */
144
- basePath: z.string(),
134
+ /** Base path for the API reference */
135
+ basePath: z.string()
145
136
  });
146
- /** Configuration for the Api Client */
147
137
  const apiClientConfigurationSchema = z.object({
148
- /**
149
- * URL to an OpenAPI/Swagger document
150
- **/
151
- url: z.string().optional(),
152
- /**
153
- * Directly embed the OpenAPI document.
154
- * Can be a string, object, function returning an object, or null.
155
- *
156
- * @remarks It's recommended to pass a URL instead of content.
157
- **/
158
- content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
159
- /**
160
- * The title of the OpenAPI document.
161
- *
162
- * @example 'Scalar Galaxy'
163
- */
164
- title: z.string().optional(),
165
- /**
166
- * The slug of the OpenAPI document used in the URL.
167
- *
168
- * If none is passed, the title will be used.
169
- *
170
- * If no title is used, it'll just use the index.
171
- *
172
- * @example 'scalar-galaxy'
173
- */
174
- slug: z.string().optional(),
175
- /**
176
- * The OpenAPI/Swagger document to render
177
- *
178
- * @deprecated Use `url` and `content` on the top level instead.
179
- **/
180
- spec: specConfigurationSchema.optional(),
181
- /** Prefill authentication */
182
- authentication: z.any().optional(), // Temp until we bring in the new auth
183
- /** Base URL for the API server */
184
- baseServerURL: z.string().optional(),
185
- /**
186
- * Whether to hide the client button
187
- * @default false
188
- */
189
- hideClientButton: z.boolean().optional().default(false).catch(false),
190
- /** URL to a request proxy for the API client */
191
- proxyUrl: z.string().optional(),
192
- /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
193
- searchHotKey: searchHotKeyEnum.optional(),
194
- /** List of OpenAPI server objects */
195
- servers: z.array(z.any()).optional(), // Using any for OpenAPIV3_1.ServerObject
196
- /**
197
- * Whether to show the sidebar
198
- * @default true
199
- */
200
- showSidebar: z.boolean().optional().default(true).catch(true),
201
- /** A string to use one of the color presets */
202
- theme: themeIdEnum.optional().default('default').catch('default'),
203
- /** Integration type identifier */
204
- _integration: integrationEnum.optional(),
205
- /** onRequestSent is fired when a request is sent */
206
- onRequestSent: z.function().args(z.string()).returns(z.void()).optional(),
138
+ /**
139
+ * URL to an OpenAPI/Swagger document
140
+ **/
141
+ url: z.string().optional(),
142
+ /**
143
+ * Directly embed the OpenAPI document.
144
+ * Can be a string, object, function returning an object, or null.
145
+ *
146
+ * @remarks It's recommended to pass a URL instead of content.
147
+ **/
148
+ content: z.union([z.string(), z.record(z.any()), z.function().returns(z.record(z.any())), z.null()]).optional(),
149
+ /**
150
+ * The title of the OpenAPI document.
151
+ *
152
+ * @example 'Scalar Galaxy'
153
+ */
154
+ title: z.string().optional(),
155
+ /**
156
+ * The slug of the OpenAPI document used in the URL.
157
+ *
158
+ * If none is passed, the title will be used.
159
+ *
160
+ * If no title is used, it'll just use the index.
161
+ *
162
+ * @example 'scalar-galaxy'
163
+ */
164
+ slug: z.string().optional(),
165
+ /**
166
+ * The OpenAPI/Swagger document to render
167
+ *
168
+ * @deprecated Use `url` and `content` on the top level instead.
169
+ **/
170
+ spec: specConfigurationSchema.optional(),
171
+ /** Prefill authentication */
172
+ authentication: z.any().optional(),
173
+ // Temp until we bring in the new auth
174
+ /** Base URL for the API server */
175
+ baseServerURL: z.string().optional(),
176
+ /**
177
+ * Whether to hide the client button
178
+ * @default false
179
+ */
180
+ hideClientButton: z.boolean().optional().default(false).catch(false),
181
+ /** URL to a request proxy for the API client */
182
+ proxyUrl: z.string().optional(),
183
+ /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
184
+ searchHotKey: searchHotKeyEnum.optional(),
185
+ /** List of OpenAPI server objects */
186
+ servers: z.array(z.any()).optional(),
187
+ // Using any for OpenAPIV3_1.ServerObject
188
+ /**
189
+ * Whether to show the sidebar
190
+ * @default true
191
+ */
192
+ showSidebar: z.boolean().optional().default(true).catch(true),
193
+ /** A string to use one of the color presets */
194
+ theme: themeIdEnum.optional().default("default").catch("default"),
195
+ /** Integration type identifier */
196
+ _integration: integrationEnum.optional(),
197
+ /** onRequestSent is fired when a request is sent */
198
+ onRequestSent: z.function().args(z.string()).returns(z.void()).optional()
207
199
  });
208
- /** Configuration for the Api Client without the transform since it cannot be merged */
209
- const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.object({
200
+ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(
201
+ z.object({
210
202
  /**
211
203
  * The layout to use for the references
212
204
  * @default 'modern'
213
205
  */
214
- layout: z.enum(['modern', 'classic']).optional().default('modern').catch('modern'),
206
+ layout: z.enum(["modern", "classic"]).optional().default("modern").catch("modern"),
215
207
  /**
216
208
  * URL to a request proxy for the API client
217
209
  * @deprecated Use proxyUrl instead
@@ -254,7 +246,7 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
254
246
  /** Whether dark mode is on or off initially (light mode) */
255
247
  darkMode: z.boolean().optional(),
256
248
  /** forceDarkModeState makes it always this state no matter what */
257
- forceDarkModeState: z.enum(['dark', 'light']).optional(),
249
+ forceDarkModeState: z.enum(["dark", "light"]).optional(),
258
250
  /**
259
251
  * Whether to show the dark mode toggle
260
252
  * @default false
@@ -264,7 +256,8 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
264
256
  * If used, passed data will be added to the HTML header
265
257
  * @see https://unhead.unjs.io/usage/composables/use-seo-meta
266
258
  */
267
- metaData: z.any().optional(), // Using any for UseSeoMetaInput since it's an external type
259
+ metaData: z.any().optional(),
260
+ // Using any for UseSeoMetaInput since it's an external type
268
261
  /**
269
262
  * Path to a favicon image
270
263
  * @default undefined
@@ -275,16 +268,12 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
275
268
  * List of httpsnippet clients to hide from the clients menu
276
269
  * By default hides Unirest, pass `[]` to show all clients
277
270
  */
278
- hiddenClients: z
279
- .union([z.record(z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)])
280
- .optional(),
271
+ hiddenClients: z.union([z.record(z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)]).optional(),
281
272
  /** Determine the HTTP client that's selected by default */
282
- defaultHttpClient: z
283
- .object({
284
- targetKey: z.custom(),
285
- clientKey: z.string(),
286
- })
287
- .optional(),
273
+ defaultHttpClient: z.object({
274
+ targetKey: z.custom(),
275
+ clientKey: z.string()
276
+ }).optional(),
288
277
  /** Custom CSS to be added to the page */
289
278
  customCss: z.string().optional(),
290
279
  /** onSpecUpdate is fired on spec/swagger content change */
@@ -318,69 +307,59 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
318
307
  * @returns A string ID used to generate the URL hash
319
308
  * @default (heading) => `#description/${heading.slug}`
320
309
  */
321
- generateHeadingSlug: z
322
- .function()
323
- .args(z.object({
324
- slug: z.string().default('headingSlug'),
325
- }))
326
- .returns(z.string())
327
- .optional(),
310
+ generateHeadingSlug: z.function().args(
311
+ z.object({
312
+ slug: z.string().default("headingSlug")
313
+ })
314
+ ).returns(z.string()).optional(),
328
315
  /**
329
316
  * Customize the model portion of the hash
330
317
  * @param model - The model object with a name property
331
318
  * @returns A string ID used to generate the URL hash
332
319
  * @default (model) => slug(model.name)
333
320
  */
334
- generateModelSlug: z
335
- .function()
336
- .args(z.object({
337
- name: z.string().default('modelName'),
338
- }))
339
- .returns(z.string())
340
- .optional(),
321
+ generateModelSlug: z.function().args(
322
+ z.object({
323
+ name: z.string().default("modelName")
324
+ })
325
+ ).returns(z.string()).optional(),
341
326
  /**
342
327
  * Customize the tag portion of the hash
343
328
  * @param tag - The tag object
344
329
  * @returns A string ID used to generate the URL hash
345
330
  * @default (tag) => slug(tag.name)
346
331
  */
347
- generateTagSlug: z
348
- .function()
349
- .args(z.object({
350
- name: z.string().default('tagName'),
351
- }))
352
- .returns(z.string())
353
- .optional(),
332
+ generateTagSlug: z.function().args(
333
+ z.object({
334
+ name: z.string().default("tagName")
335
+ })
336
+ ).returns(z.string()).optional(),
354
337
  /**
355
338
  * Customize the operation portion of the hash
356
339
  * @param operation - The operation object
357
340
  * @returns A string ID used to generate the URL hash
358
341
  * @default (operation) => `${operation.method}${operation.path}`
359
342
  */
360
- generateOperationSlug: z
361
- .function()
362
- .args(z.object({
343
+ generateOperationSlug: z.function().args(
344
+ z.object({
363
345
  path: z.string(),
364
346
  operationId: z.string().optional(),
365
347
  method: z.string(),
366
- summary: z.string().optional(),
367
- }))
368
- .returns(z.string())
369
- .optional(),
348
+ summary: z.string().optional()
349
+ })
350
+ ).returns(z.string()).optional(),
370
351
  /**
371
352
  * Customize the webhook portion of the hash
372
353
  * @param webhook - The webhook object
373
354
  * @returns A string ID used to generate the URL hash
374
355
  * @default (webhook) => slug(webhook.name)
375
356
  */
376
- generateWebhookSlug: z
377
- .function()
378
- .args(z.object({
357
+ generateWebhookSlug: z.function().args(
358
+ z.object({
379
359
  name: z.string(),
380
- method: z.string().optional(),
381
- }))
382
- .returns(z.string())
383
- .optional(),
360
+ method: z.string().optional()
361
+ })
362
+ ).returns(z.string()).optional(),
384
363
  /**
385
364
  * To handle redirects, pass a function that will recieve:
386
365
  * - The current path with hash if pathRouting is enabled
@@ -413,54 +392,57 @@ const _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(z.ob
413
392
  * Function to sort tags
414
393
  * @default 'alpha' for alphabetical sorting
415
394
  */
416
- tagsSorter: z.union([z.literal('alpha'), z.function().args(z.any(), z.any()).returns(z.number())]).optional(),
395
+ tagsSorter: z.union([z.literal("alpha"), z.function().args(z.any(), z.any()).returns(z.number())]).optional(),
417
396
  /**
418
397
  * Function to sort operations
419
398
  * @default 'alpha' for alphabetical sorting
420
399
  */
421
- operationsSorter: z
422
- .union([z.literal('alpha'), z.literal('method'), z.function().args(z.any(), z.any()).returns(z.number())])
423
- .optional(),
424
- }));
425
- const OLD_PROXY_URL = 'https://api.scalar.com/request-proxy';
426
- const NEW_PROXY_URL = 'https://proxy.scalar.com';
427
- /** Migrate the configuration through a transform */
400
+ operationsSorter: z.union([z.literal("alpha"), z.literal("method"), z.function().args(z.any(), z.any()).returns(z.number())]).optional()
401
+ })
402
+ );
403
+ const OLD_PROXY_URL = "https://api.scalar.com/request-proxy";
404
+ const NEW_PROXY_URL = "https://proxy.scalar.com";
428
405
  const migrateConfiguration = (_configuration) => {
429
- const configuration = { ..._configuration };
430
- // Remove the spec prefix
431
- if (configuration.spec?.url) {
432
- console.warn(`[DEPRECATED] You're using the deprecated 'spec.url' attribute. Remove the spec prefix and move the 'url' attribute to the top level.`);
433
- configuration.url = configuration.spec.url;
434
- delete configuration.spec;
435
- }
436
- if (configuration.spec?.content) {
437
- console.warn(`[DEPRECATED] You're using the deprecated 'spec.content' attribute. Remove the spec prefix and move the 'content' attribute to the top level.`);
438
- configuration.content = configuration.spec.content;
439
- delete configuration.spec;
440
- }
441
- // Migrate legacy theme variables
442
- if (configuration.customCss) {
443
- configuration.customCss = migrateThemeVariables(configuration.customCss);
406
+ const configuration = { ..._configuration };
407
+ if (configuration.spec?.url) {
408
+ console.warn(
409
+ `[DEPRECATED] You're using the deprecated 'spec.url' attribute. Remove the spec prefix and move the 'url' attribute to the top level.`
410
+ );
411
+ configuration.url = configuration.spec.url;
412
+ delete configuration.spec;
413
+ }
414
+ if (configuration.spec?.content) {
415
+ console.warn(
416
+ `[DEPRECATED] You're using the deprecated 'spec.content' attribute. Remove the spec prefix and move the 'content' attribute to the top level.`
417
+ );
418
+ configuration.content = configuration.spec.content;
419
+ delete configuration.spec;
420
+ }
421
+ if (configuration.proxy) {
422
+ console.warn(
423
+ `[DEPRECATED] You're using the deprecated 'proxy' attribute, rename it to 'proxyUrl' or update the package.`
424
+ );
425
+ if (!configuration.proxyUrl) {
426
+ configuration.proxyUrl = configuration.proxy;
444
427
  }
445
- // Migrate proxy URL
446
- if (configuration.proxy) {
447
- console.warn(`[DEPRECATED] You're using the deprecated 'proxy' attribute, rename it to 'proxyUrl' or update the package.`);
448
- if (!configuration.proxyUrl) {
449
- configuration.proxyUrl = configuration.proxy;
450
- }
451
- delete configuration.proxy;
452
- }
453
- if (configuration.proxyUrl === OLD_PROXY_URL) {
454
- console.warn(`[DEPRECATED] Warning: configuration.proxyUrl points to our old proxy (${OLD_PROXY_URL}).`);
455
- console.warn(`[DEPRECATED] We are overwriting the value and use the new proxy URL (${NEW_PROXY_URL}) instead.`);
456
- console.warn(`[DEPRECATED] Action Required: You should manually update your configuration to use the new URL (${NEW_PROXY_URL}). Read more: https://github.com/scalar/scalar`);
457
- configuration.proxyUrl = NEW_PROXY_URL;
458
- }
459
- return configuration;
428
+ delete configuration.proxy;
429
+ }
430
+ if (configuration.proxyUrl === OLD_PROXY_URL) {
431
+ console.warn(`[DEPRECATED] Warning: configuration.proxyUrl points to our old proxy (${OLD_PROXY_URL}).`);
432
+ console.warn(`[DEPRECATED] We are overwriting the value and use the new proxy URL (${NEW_PROXY_URL}) instead.`);
433
+ console.warn(
434
+ `[DEPRECATED] Action Required: You should manually update your configuration to use the new URL (${NEW_PROXY_URL}). Read more: https://github.com/scalar/scalar`
435
+ );
436
+ configuration.proxyUrl = NEW_PROXY_URL;
437
+ }
438
+ return configuration;
460
439
  };
461
- /** Configuration for the Api Reference */
462
440
  const apiReferenceConfigurationSchema = _apiReferenceConfigurationSchema.transform(migrateConfiguration);
463
- /** Typeguard to check to narrow the configs to the one with sources */
464
- const isConfigurationWithSources = (config) => Boolean(!Array.isArray(config) && config && 'sources' in config && Array.isArray(config.sources));
465
-
466
- export { apiClientConfigurationSchema, apiReferenceConfigurationSchema, isConfigurationWithSources, specConfigurationSchema };
441
+ const isConfigurationWithSources = (config) => Boolean(!Array.isArray(config) && config && "sources" in config && Array.isArray(config.sources));
442
+ export {
443
+ apiClientConfigurationSchema,
444
+ apiReferenceConfigurationSchema,
445
+ isConfigurationWithSources,
446
+ specConfigurationSchema
447
+ };
448
+ //# sourceMappingURL=api-reference-configuration.js.map