@scalar/types 0.3.0 → 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.
- package/CHANGELOG.md +8 -0
- package/dist/api-reference/api-client-configuration.d.ts +122 -0
- package/dist/api-reference/api-client-configuration.d.ts.map +1 -0
- package/dist/api-reference/api-client-configuration.js +7 -0
- package/dist/api-reference/api-client-configuration.js.map +7 -0
- package/dist/{api-client → api-reference}/api-client-plugin.d.ts +6 -3
- package/dist/api-reference/api-client-plugin.d.ts.map +1 -0
- package/dist/{api-client → api-reference}/api-client-plugin.js +10 -10
- package/dist/{api-client → api-reference}/api-client-plugin.js.map +3 -3
- package/dist/api-reference/api-reference-configuration.d.ts +58 -525
- package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
- package/dist/api-reference/api-reference-configuration.js +264 -501
- package/dist/api-reference/api-reference-configuration.js.map +2 -2
- package/dist/api-reference/api-reference-plugin.d.ts +4 -4
- package/dist/api-reference/api-reference-plugin.d.ts.map +1 -1
- package/dist/api-reference/api-reference-plugin.js +5 -5
- package/dist/api-reference/api-reference-plugin.js.map +2 -2
- package/dist/api-reference/base-configuration.d.ts +118 -0
- package/dist/api-reference/base-configuration.d.ts.map +1 -0
- package/dist/api-reference/base-configuration.js +139 -0
- package/dist/api-reference/base-configuration.js.map +7 -0
- package/dist/api-reference/html-rendering-configuration.d.ts +2 -2
- package/dist/api-reference/html-rendering-configuration.d.ts.map +1 -1
- package/dist/api-reference/html-rendering-configuration.js.map +2 -2
- package/dist/api-reference/index.d.ts +6 -3
- package/dist/api-reference/index.d.ts.map +1 -1
- package/dist/api-reference/index.js +12 -3
- package/dist/api-reference/index.js.map +2 -2
- package/dist/api-reference/source-configuration.d.ts +18 -0
- package/dist/api-reference/source-configuration.d.ts.map +1 -0
- package/dist/api-reference/source-configuration.js +87 -0
- package/dist/api-reference/source-configuration.js.map +7 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/snippetz/snippetz.d.ts +1 -1
- package/dist/snippetz/snippetz.d.ts.map +1 -1
- package/dist/snippetz/snippetz.js +1 -0
- package/dist/snippetz/snippetz.js.map +2 -2
- package/package.json +2 -2
- package/dist/api-client/api-client-plugin.d.ts.map +0 -1
- package/dist/api-client/index.d.ts +0 -2
- package/dist/api-client/index.d.ts.map +0 -1
- package/dist/api-client/index.js +0 -6
- package/dist/api-client/index.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api-reference/api-reference-configuration.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from 'zod'\n\nimport { ApiClientPluginSchema } from '../api-client'\nimport type { TargetId } from '../snippetz'\nimport { ApiReferencePluginSchema } from './api-reference-plugin'\nimport type { AuthenticationConfiguration } from './authentication-configuration'\n\n/** Available theme presets for the API reference */\nconst themeIdEnum = z.enum([\n 'alternate',\n 'default',\n 'moon',\n 'purple',\n 'solarized',\n 'bluePlanet',\n 'deepSpace',\n 'saturn',\n 'kepler',\n 'elysiajs',\n 'fastify',\n 'mars',\n 'laserwave',\n 'none',\n])\n\n/** Whether to use the operation summary or the operation path for the sidebar and search */\nconst operationTitleEnum = z.enum(['summary', 'path'])\n\n/** Valid keys that can be used with CTRL/CMD to open the search modal */\nconst searchHotKeyEnum = z.enum([\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n])\n\n/** Supported integration types */\nconst integrationEnum = z\n .enum([\n 'adonisjs',\n 'docusaurus',\n 'dotnet',\n 'elysiajs',\n 'express',\n 'fastapi',\n 'fastify',\n 'go',\n 'hono',\n 'html',\n 'laravel',\n 'litestar',\n 'nestjs',\n 'nextjs',\n 'nitro',\n 'nuxt',\n 'platformatic',\n 'react',\n 'rust',\n 'svelte',\n 'vue',\n ])\n .nullable()\n\n/** Configuration for the OpenAPI/Swagger specification */\nexport const specConfigurationSchema = z.object({\n /**\n * URL to an OpenAPI/Swagger document\n *\n * @deprecated Please move `url` to the top level and remove the `spec` prefix.\n *\n * @example\n * ```ts\n * const oldConfiguration = {\n * spec: {\n * url: 'https://example.com/openapi.json',\n * },\n * }\n *\n * const newConfiguration = {\n * url: 'https://example.com/openapi.json',\n * }\n * ```\n **/\n url: z.string().optional(),\n /**\n * Directly embed the OpenAPI document.\n * Can be a string, object, function returning an object, or null.\n *\n * @remarks It's recommended to pass a URL instead of content.\n *\n * @deprecated Please move `content` to the top level and remove the `spec` prefix.\n *\n * @example\n * ```ts\n * const oldConfiguration = {\n * spec: {\n * content: '\u2026',\n * },\n * }\n *\n * const newConfiguration = {\n * content: '\u2026',\n * }\n * ```\n **/\n\n content: z\n .union([\n z.string(),\n z.null(),\n z.record(z.string(), z.any()),\n z.function({\n input: [],\n output: z.record(z.string(), z.any()),\n }),\n ])\n .optional(),\n /**\n * The title of the OpenAPI document.\n *\n * @example 'Scalar Galaxy'\n *\n * @deprecated Please move `title` to the top level and remove the `spec` prefix.\n */\n title: z.string().optional(),\n /**\n * The slug of the OpenAPI document used in the URL.\n *\n * If none is passed, the title will be used.\n *\n * If no title is used, it'll just use the index.\n *\n * @example 'scalar-galaxy'\n *\n * @deprecated Please move `slug` to the top level and remove the `spec` prefix.\n */\n slug: z.string().optional(),\n})\nexport type SpecConfiguration = z.infer<typeof specConfigurationSchema>\n\n/** Configuration for path-based routing */\nconst pathRoutingSchema = z.object({\n /** Base path for the API reference */\n basePath: z.string(),\n})\n\n/** Configuration for the Api Client */\nexport const apiClientConfigurationSchema = z.object({\n /**\n * URL to an OpenAPI/Swagger document\n **/\n url: z.string().optional(),\n /**\n * Directly embed the OpenAPI document.\n * Can be a string, object, function returning an object, or null.\n *\n * @remarks It's recommended to pass a URL instead of content.\n **/\n content: z\n .union([\n z.string(),\n z.null(),\n z.record(z.string(), z.any()),\n z.function({\n input: [],\n output: z.record(z.string(), z.any()),\n }),\n ])\n .optional(),\n /**\n * The title of the OpenAPI document.\n *\n * @example 'Scalar Galaxy'\n */\n title: z.string().optional(),\n /**\n * The slug of the OpenAPI document used in the URL.\n *\n * If none is passed, the title will be used.\n *\n * If no title is used, it'll just use the index.\n *\n * @example 'scalar-galaxy'\n */\n slug: z.string().optional(),\n /**\n * The OpenAPI/Swagger document to render\n *\n * @deprecated Use `url` and `content` on the top level instead.\n **/\n spec: specConfigurationSchema.optional(),\n /** Prefill authentication */\n authentication: z.any().optional(), // Temp until we bring in the new auth\n /** Base URL for the API server */\n baseServerURL: z.string().optional(),\n /**\n * Whether to hide the client button\n * @default false\n */\n hideClientButton: z.boolean().optional().default(false).catch(false),\n /** URL to a request proxy for the API client */\n proxyUrl: z.string().optional(),\n /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */\n searchHotKey: searchHotKeyEnum.optional(),\n /** List of OpenAPI server objects */\n servers: z.array(z.any()).optional(), // Using any for OpenAPIV3_1.ServerObject\n /**\n * Whether to show the sidebar\n * @default true\n */\n showSidebar: z.boolean().optional().default(true).catch(true),\n /**\n * Sets the visibility of the developer tools\n * @default 'localhost' to only show the toolbar on localhost or similar hosts\n */\n showToolbar: z.enum(['always', 'localhost', 'never']).optional().default('localhost').catch('localhost'),\n /**\n * Whether to use the operation summary or the operation path for the sidebar and search\n * @default 'summary'\n */\n operationTitleSource: operationTitleEnum.optional().default('summary').catch('summary'),\n /** A string to use one of the color presets */\n theme: themeIdEnum.optional().default('default').catch('default'),\n /** Integration type identifier */\n _integration: integrationEnum.optional(),\n /** onRequestSent is fired when a request is sent */\n onRequestSent: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** Whether to persist auth to local storage */\n persistAuth: z.boolean().optional().default(false).catch(false),\n /** Plugins for the API client */\n plugins: z.array(ApiClientPluginSchema).optional(),\n /** Enables / disables telemetry*/\n telemetry: z.boolean().optional().default(true),\n})\n\nexport type ApiClientConfiguration = z.infer<typeof apiClientConfigurationSchema>\n\n// Zod Schemas don't work well with async functions, so we use a custom type instead.\nconst FetchLikeSchema = z.custom<(input: string | URL | Request, init?: RequestInit) => Promise<Response>>()\n\n/** Configuration for the Api Client without the transform since it cannot be merged */\nconst _apiReferenceConfigurationSchema = apiClientConfigurationSchema.merge(\n z.object({\n /**\n * The layout to use for the references\n * @default 'modern'\n */\n layout: z.enum(['modern', 'classic']).optional().default('modern').catch('modern'),\n /**\n * URL to a request proxy for the API client\n * @deprecated Use proxyUrl instead\n */\n proxy: z.string().optional(),\n /**\n * Custom fetch function for custom logic\n *\n * Can be used to add custom headers, handle auth, etc.\n */\n fetch: FetchLikeSchema.optional(),\n /**\n * Plugins for the API reference\n */\n plugins: z.array(ApiReferencePluginSchema).optional(),\n /**\n * Allows the user to inject an editor for the spec\n * @default false\n */\n isEditable: z.boolean().optional().default(false).catch(false),\n /**\n * Controls whether the references show a loading state in the intro\n * @default false\n */\n isLoading: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show models in the sidebar, search, and content.\n * @default false\n */\n hideModels: z.boolean().optional().default(false).catch(false),\n /**\n * Sets the file type of the document to download, set to `none` to hide the download button\n * @default 'both'\n */\n documentDownloadType: z.enum(['yaml', 'json', 'both', 'direct', 'none']).optional().default('both').catch('both'),\n /**\n * Whether to show the \"Download OpenAPI Document\" button\n * @default false\n * @deprecated Use `documentDownloadType: 'none'` instead\n */\n hideDownloadButton: z.boolean().optional(),\n /**\n * Whether to show the \"Test Request\" button\n * @default false\n */\n hideTestRequestButton: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show the sidebar search bar\n * @default false\n */\n hideSearch: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show the operationId\n *\n * @default false\n */\n showOperationId: z.boolean().optional().default(false).catch(false),\n /** Whether dark mode is on or off initially (light mode) */\n darkMode: z.boolean().optional(),\n /** forceDarkModeState makes it always this state no matter what */\n forceDarkModeState: z.enum(['dark', 'light']).optional(),\n /**\n * Whether to show the dark mode toggle\n * @default false\n */\n hideDarkModeToggle: z.boolean().optional().default(false).catch(false),\n /**\n * If used, passed data will be added to the HTML header\n * @see https://unhead.unjs.io/usage/composables/use-seo-meta\n */\n metaData: z.any().optional(), // Using any for UseSeoMetaInput since it's an external type\n /**\n * Path to a favicon image\n * @default undefined\n * @example '/favicon.svg'\n */\n favicon: z.string().optional(),\n /**\n * List of httpsnippet clients to hide from the clients menu\n * By default hides Unirest, pass `[]` to show all clients\n */\n hiddenClients: z\n .union([z.record(z.string(), z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)])\n .optional(),\n /** Determine the HTTP client that's selected by default */\n defaultHttpClient: z\n .object({\n targetKey: z.custom<TargetId>(),\n clientKey: z.string(),\n })\n .optional(),\n /** Custom CSS to be added to the page */\n customCss: z.string().optional(),\n /** onSpecUpdate is fired on spec/swagger content change */\n onSpecUpdate: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** onServerChange is fired on selected server change */\n onServerChange: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** onDocumentSelect is fired when the config is selected */\n onDocumentSelect: z.function().optional() as z.ZodType<(() => Promise<void> | void) | undefined>,\n /** Callback fired when the reference is fully loaded */\n onLoaded: z.function().optional() as z.ZodType<(() => Promise<void> | void) | undefined>,\n /** onBeforeRequest is fired before the request is sent. You can modify the request here. */\n onBeforeRequest: z\n .function({ input: [z.object({ request: z.instanceof(Request) })], output: z.void() })\n .optional() as z.ZodType<((a: { request: Request }) => Promise<void> | void) | undefined>,\n /**\n * onShowMore is fired when the user clicks the \"Show more\" button on the references\n * @param tagId - The ID of the tag that was clicked\n */\n onShowMore: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional() as z.ZodType<((a: string) => Promise<void> | void) | undefined>,\n /**\n * onSidebarClick is fired when the user clicks on a sidebar item\n * @param href - The href of the sidebar item that was clicked\n */\n onSidebarClick: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional() as z.ZodType<((a: string) => Promise<void> | void) | undefined>,\n /**\n * Route using paths instead of hashes, your server MUST support this\n * @example '/standalone-api-reference/:custom(.*)?'\n * @experimental\n * @default undefined\n */\n pathRouting: pathRoutingSchema.optional(),\n /**\n * Customize the heading portion of the hash\n * @param heading - The heading object\n * @returns A string ID used to generate the URL hash\n * @default (heading) => `#description/${heading.slug}`\n */\n generateHeadingSlug: z\n .function({\n input: [z.object({ slug: z.string().default('headingSlug') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the model portion of the hash\n * @param model - The model object with a name property\n * @returns A string ID used to generate the URL hash\n * @default (model) => slug(model.name)\n */\n generateModelSlug: z\n .function({\n input: [z.object({ name: z.string().default('modelName') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the tag portion of the hash\n * @param tag - The tag object\n * @returns A string ID used to generate the URL hash\n * @default (tag) => slug(tag.name)\n */\n generateTagSlug: z\n .function({\n input: [z.object({ name: z.string().default('tagName') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the operation portion of the hash\n * @param operation - The operation object\n * @returns A string ID used to generate the URL hash\n * @default (operation) => `${operation.method}${operation.path}`\n */\n generateOperationSlug: z\n .function({\n input: [\n z.object({\n path: z.string(),\n operationId: z.string().optional(),\n method: z.string(),\n summary: z.string().optional(),\n }),\n ],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the webhook portion of the hash\n * @param webhook - The webhook object\n * @returns A string ID used to generate the URL hash\n * @default (webhook) => slug(webhook.name)\n */\n generateWebhookSlug: z\n .function({\n input: [\n z.object({\n name: z.string(),\n method: z.string().optional(),\n }),\n ],\n output: z.string(),\n })\n .optional(),\n /**\n * To handle redirects, pass a function that will recieve:\n * - The current path with hash if pathRouting is enabled\n * - The current hash if hashRouting (default)\n * And then passes that to history.replaceState\n *\n * @example hashRouting (default)\n * ```ts\n * redirect: (hash: string) => hash.replace('#v1/old-path', '#v2/new-path')\n * ```\n * @example pathRouting\n * ```ts\n * redirect: (pathWithHash: string) => {\n * if (pathWithHash.includes('#')) {\n * return pathWithHash.replace('/v1/tags/user#operation/get-user', '/v1/tags/user/operation/get-user')\n * }\n * return null\n * }\n * ```\n */\n redirect: z\n .function({\n input: [z.string()],\n output: z.string().nullable().optional(),\n })\n .optional(),\n /**\n * Whether to include default fonts\n * @default true\n */\n withDefaultFonts: z.boolean().optional().default(true).catch(true),\n /**\n * Whether to expand all tags by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n defaultOpenAllTags: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to expand all models by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n expandAllModelSections: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to expand all responses by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n expandAllResponses: z.boolean().optional().default(false).catch(false),\n /**\n * Function to sort tags\n * @default 'alpha' for alphabetical sorting\n */\n tagsSorter: z\n .union([\n z.literal('alpha'),\n z.function({\n input: [z.any(), z.any()],\n output: z.number(),\n }),\n ])\n .optional(),\n /**\n * Function to sort operations\n * @default 'alpha' for alphabetical sorting\n */\n operationsSorter: z\n .union([\n z.literal('alpha'),\n z.literal('method'),\n z.function({\n input: [z.any(), z.any()],\n output: z.number(),\n }),\n ])\n .optional(),\n /**\n * Order the schema properties by\n * @default 'alpha' for alphabetical sorting\n */\n orderSchemaPropertiesBy: z\n .union([z.literal('alpha'), z.literal('preserve')])\n .optional()\n .default('alpha')\n .catch('alpha'),\n /**\n * Sort the schema properties by required ones first\n * @default true\n */\n orderRequiredPropertiesFirst: z.boolean().optional().default(true).catch(true),\n }),\n)\n\nconst OLD_PROXY_URL = 'https://api.scalar.com/request-proxy'\nconst NEW_PROXY_URL = 'https://proxy.scalar.com'\n\n/** Migrate the configuration through a transform */\nconst migrateConfiguration = <T extends z.infer<typeof _apiReferenceConfigurationSchema>>(_configuration: T): T => {\n const configuration = { ..._configuration }\n\n // Migrate hideDownloadButton to documentDownloadType\n if (configuration.hideDownloadButton) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'hideDownloadButton' attribute. Use 'documentDownloadType: 'none'' instead.`,\n )\n\n configuration.documentDownloadType = 'none'\n }\n\n // Remove the spec prefix\n if (configuration.spec?.url) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'spec.url' attribute. Remove the spec prefix and move the 'url' attribute to the top level.`,\n )\n\n configuration.url = configuration.spec.url\n delete configuration.spec\n }\n\n if (configuration.spec?.content) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'spec.content' attribute. Remove the spec prefix and move the 'content' attribute to the top level.`,\n )\n\n configuration.content = configuration.spec.content\n delete configuration.spec\n }\n\n // Migrate proxy URL\n if (configuration.proxy) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'proxy' attribute, rename it to 'proxyUrl' or update the package.`,\n )\n\n if (!configuration.proxyUrl) {\n configuration.proxyUrl = configuration.proxy\n }\n\n delete configuration.proxy\n }\n\n if (configuration.proxyUrl === OLD_PROXY_URL) {\n console.warn(`[DEPRECATED] Warning: configuration.proxyUrl points to our old proxy (${OLD_PROXY_URL}).`)\n console.warn(`[DEPRECATED] We are overwriting the value and use the new proxy URL (${NEW_PROXY_URL}) instead.`)\n console.warn(\n `[DEPRECATED] Action Required: You should manually update your configuration to use the new URL (${NEW_PROXY_URL}). Read more: https://github.com/scalar/scalar`,\n )\n\n configuration.proxyUrl = NEW_PROXY_URL\n }\n\n return configuration\n}\n\n/** Configuration for the Api Reference */\nexport const apiReferenceConfigurationSchema = _apiReferenceConfigurationSchema.transform(migrateConfiguration)\n\n/** Configuration after parsing, this is the main type */\nexport type ApiReferenceConfiguration = Omit<\n z.infer<typeof _apiReferenceConfigurationSchema>,\n // Remove deprecated attributes\n 'proxy' | 'spec' | 'authentication'\n> & {\n authentication?: AuthenticationConfiguration\n}\n\n/** Api Config which includes the default config */\ntype ApiReferenceConfigurationWithDefault = ApiReferenceConfiguration & {\n /** Whether to use this config as the default one */\n default?: boolean\n}\n\n/** Configuration for a single config with sources */\nexport type ApiReferenceConfigurationWithSources = Omit<ApiReferenceConfigurationWithDefault, 'default'> & {\n sources: (SpecConfiguration & { default?: boolean })[]\n}\n\n/** Configuration for multiple Api References */\nexport type AnyApiReferenceConfiguration =\n | Partial<ApiReferenceConfiguration>\n | Partial<ApiReferenceConfigurationWithSources>\n | Partial<ApiReferenceConfigurationWithDefault>[]\n | Partial<ApiReferenceConfigurationWithSources>[]\n\n/** Typeguard to check to narrow the configs to the one with sources */\nexport const isConfigurationWithSources = (\n config: AnyApiReferenceConfiguration,\n): config is Partial<ApiReferenceConfigurationWithSources> =>\n Boolean(!Array.isArray(config) && config && 'sources' in config && Array.isArray(config.sources))\n"],
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import { type ZodType, z } from 'zod'\n\nimport type { TargetId } from '../snippetz'\nimport { apiReferencePluginSchema } from './api-reference-plugin'\nimport type { AuthenticationConfiguration } from './authentication-configuration'\nimport { NEW_PROXY_URL, OLD_PROXY_URL, baseConfigurationSchema } from './base-configuration'\nimport { type SourceConfiguration, sourceConfigurationSchema } from './source-configuration'\n\n// Zod Schemas don't work well with async functions, so we use a custom type instead.\nconst fetchLikeSchema = z.custom<(input: string | URL | Request, init?: RequestInit) => Promise<Response>>()\n\n/**\n * Standard configuration for the Api Reference.\n *\n * This is used internally to the configure the applications and does not include the sources.\n *\n * Sources should only be specified in the user facing configurations.\n *\n * In the the future it is likely sources will be removed completely from the configuration and instead\n * specified through a separate addDocument interface.\n */\nexport const apiReferenceConfigurationSchema = baseConfigurationSchema.extend({\n /**\n * The layout to use for the references\n * @default 'modern'\n */\n layout: z.enum(['modern', 'classic']).optional().default('modern').catch('modern'),\n /**\n * URL to a request proxy for the API client\n * @deprecated Use proxyUrl instead\n */\n proxy: z.string().optional(),\n /**\n * Custom fetch function for custom logic\n *\n * Can be used to add custom headers, handle auth, etc.\n */\n fetch: fetchLikeSchema.optional(),\n /**\n * Plugins for the API reference\n */\n plugins: z.array(apiReferencePluginSchema).optional(),\n /**\n * Allows the user to inject an editor for the spec\n * @default false\n */\n isEditable: z.boolean().optional().default(false).catch(false),\n /**\n * Controls whether the references show a loading state in the intro\n * @default false\n */\n isLoading: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show models in the sidebar, search, and content.\n * @default false\n */\n hideModels: z.boolean().optional().default(false).catch(false),\n /**\n * Sets the file type of the document to download, set to `none` to hide the download button\n * @default 'both'\n */\n documentDownloadType: z.enum(['yaml', 'json', 'both', 'direct', 'none']).optional().default('both').catch('both'),\n /**\n * Whether to show the \"Download OpenAPI Document\" button\n * @default false\n * @deprecated Use `documentDownloadType: 'none'` instead\n */\n hideDownloadButton: z.boolean().optional(),\n /**\n * Whether to show the \"Test Request\" button\n * @default false\n */\n hideTestRequestButton: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show the sidebar search bar\n * @default false\n */\n hideSearch: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to show the operationId\n *\n * @default false\n */\n showOperationId: z.boolean().optional().default(false).catch(false),\n /** Whether dark mode is on or off initially (light mode) */\n darkMode: z.boolean().optional(),\n /** forceDarkModeState makes it always this state no matter what */\n forceDarkModeState: z.enum(['dark', 'light']).optional(),\n /**\n * Whether to show the dark mode toggle\n * @default false\n */\n hideDarkModeToggle: z.boolean().optional().default(false).catch(false),\n /**\n * If used, passed data will be added to the HTML header\n * @see https://unhead.unjs.io/usage/composables/use-seo-meta\n */\n metaData: z.any().optional(), // Using any for UseSeoMetaInput since it's an external type\n /**\n * Path to a favicon image\n * @default undefined\n * @example '/favicon.svg'\n */\n favicon: z.string().optional(),\n /**\n * List of httpsnippet clients to hide from the clients menu\n * By default hides Unirest, pass `[]` to show all clients\n */\n hiddenClients: z\n .union([z.record(z.string(), z.union([z.boolean(), z.array(z.string())])), z.array(z.string()), z.literal(true)])\n .optional(),\n /** Determine the HTTP client that's selected by default */\n defaultHttpClient: z\n .object({\n targetKey: z.custom<TargetId>(),\n clientKey: z.string(),\n })\n .optional(),\n /** Custom CSS to be added to the page */\n customCss: z.string().optional(),\n /** onSpecUpdate is fired on spec/swagger content change */\n onSpecUpdate: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** onServerChange is fired on selected server change */\n onServerChange: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** onDocumentSelect is fired when the config is selected */\n onDocumentSelect: z.function().optional() as z.ZodType<(() => Promise<void> | void) | undefined>,\n /** Callback fired when the reference is fully loaded */\n onLoaded: z.function().optional() as z.ZodType<(() => Promise<void> | void) | undefined>,\n /** onBeforeRequest is fired before the request is sent. You can modify the request here. */\n onBeforeRequest: z\n .function({ input: [z.object({ request: z.instanceof(Request) })], output: z.void() })\n .optional() as z.ZodType<((a: { request: Request }) => Promise<void> | void) | undefined>,\n /**\n * onShowMore is fired when the user clicks the \"Show more\" button on the references\n * @param tagId - The ID of the tag that was clicked\n */\n onShowMore: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional() as z.ZodType<((a: string) => Promise<void> | void) | undefined>,\n /**\n * onSidebarClick is fired when the user clicks on a sidebar item\n * @param href - The href of the sidebar item that was clicked\n */\n onSidebarClick: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional() as z.ZodType<((a: string) => Promise<void> | void) | undefined>,\n /**\n * Route using paths instead of hashes, your server MUST support this\n * @example '/standalone-api-reference/:custom(.*)?'\n * @experimental\n * @default undefined\n */\n pathRouting: z\n .object({\n basePath: z.string(),\n })\n .optional(),\n /**\n * Customize the heading portion of the hash\n * @param heading - The heading object\n * @returns A string ID used to generate the URL hash\n * @default (heading) => `#description/${heading.slug}`\n */\n generateHeadingSlug: z\n .function({\n input: [z.object({ slug: z.string().default('headingSlug') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the model portion of the hash\n * @param model - The model object with a name property\n * @returns A string ID used to generate the URL hash\n * @default (model) => slug(model.name)\n */\n generateModelSlug: z\n .function({\n input: [z.object({ name: z.string().default('modelName') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the tag portion of the hash\n * @param tag - The tag object\n * @returns A string ID used to generate the URL hash\n * @default (tag) => slug(tag.name)\n */\n generateTagSlug: z\n .function({\n input: [z.object({ name: z.string().default('tagName') })],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the operation portion of the hash\n * @param operation - The operation object\n * @returns A string ID used to generate the URL hash\n * @default (operation) => `${operation.method}${operation.path}`\n */\n generateOperationSlug: z\n .function({\n input: [\n z.object({\n path: z.string(),\n operationId: z.string().optional(),\n method: z.string(),\n summary: z.string().optional(),\n }),\n ],\n output: z.string(),\n })\n .optional(),\n /**\n * Customize the webhook portion of the hash\n * @param webhook - The webhook object\n * @returns A string ID used to generate the URL hash\n * @default (webhook) => slug(webhook.name)\n */\n generateWebhookSlug: z\n .function({\n input: [\n z.object({\n name: z.string(),\n method: z.string().optional(),\n }),\n ],\n output: z.string(),\n })\n .optional(),\n /**\n * To handle redirects, pass a function that will recieve:\n * - The current path with hash if pathRouting is enabled\n * - The current hash if hashRouting (default)\n * And then passes that to history.replaceState\n *\n * @example hashRouting (default)\n * ```ts\n * redirect: (hash: string) => hash.replace('#v1/old-path', '#v2/new-path')\n * ```\n * @example pathRouting\n * ```ts\n * redirect: (pathWithHash: string) => {\n * if (pathWithHash.includes('#')) {\n * return pathWithHash.replace('/v1/tags/user#operation/get-user', '/v1/tags/user/operation/get-user')\n * }\n * return null\n * }\n * ```\n */\n redirect: z\n .function({\n input: [z.string()],\n output: z.string().nullable().optional(),\n })\n .optional(),\n /**\n * Whether to include default fonts\n * @default true\n */\n withDefaultFonts: z.boolean().optional().default(true).catch(true),\n /**\n * Whether to expand all tags by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n defaultOpenAllTags: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to expand all models by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n expandAllModelSections: z.boolean().optional().default(false).catch(false),\n /**\n * Whether to expand all responses by default\n *\n * Warning this can cause performance issues on big documents\n * @default false\n */\n expandAllResponses: z.boolean().optional().default(false).catch(false),\n /**\n * Function to sort tags\n * @default 'alpha' for alphabetical sorting\n */\n tagsSorter: z\n .union([\n z.literal('alpha'),\n z.function({\n input: [z.any(), z.any()],\n output: z.number(),\n }),\n ])\n .optional(),\n /**\n * Function to sort operations\n * @default 'alpha' for alphabetical sorting\n */\n operationsSorter: z\n .union([\n z.literal('alpha'),\n z.literal('method'),\n z.function({\n input: [z.any(), z.any()],\n output: z.number(),\n }),\n ])\n .optional(),\n /**\n * Order the schema properties by\n * @default 'alpha' for alphabetical sorting\n */\n orderSchemaPropertiesBy: z\n .union([z.literal('alpha'), z.literal('preserve')])\n .optional()\n .default('alpha')\n .catch('alpha'),\n /**\n * Sort the schema properties by required ones first\n * @default true\n */\n orderRequiredPropertiesFirst: z.boolean().optional().default(true).catch(true),\n})\n\n/**\n * Configuration for the Scalar Api Reference integrations\n *\n * See the type `ApiReferenceConfigurationWithSource` or `AnyApiReferenceConfiguration`\\\n * for the configuration that includes the sources for you OpenAPI documents\n */\nexport type ApiReferenceConfiguration = Omit<\n z.infer<typeof apiReferenceConfigurationSchema>, // Remove deprecated attributes\n 'proxy' | 'spec' | 'authentication'\n> & {\n authentication?: AuthenticationConfiguration\n} & {\n /** @deprecated\n * This type now refers to the base configuration that does not include the sources.\n * Use the type `ApiReferenceConfigurationWithSource` instead.\n */\n url?: SourceConfiguration['url']\n /** @deprecated\n * This type now refers to the base configuration that does not include the sources.\n * Use the type `ApiReferenceConfigurationWithSource` instead.\n */\n content?: SourceConfiguration['content']\n}\n\n/** Migrate the configuration through a transform */\n// const migrateConfiguration = <T extends z.infer<typeof _apiReferenceConfigurationSchema>>\n\n/** Configuration for the Api Reference */\nexport const apiReferenceConfigurationWithSourceSchema: ZodType<\n Omit<ApiReferenceConfiguration, 'url' | 'content'> & SourceConfiguration\n> = apiReferenceConfigurationSchema.extend(sourceConfigurationSchema.shape).transform((configuration) => {\n // Migrate hideDownloadButton to documentDownloadType\n if (configuration.hideDownloadButton) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'hideDownloadButton' attribute. Use 'documentDownloadType: 'none'' instead.`,\n )\n\n configuration.documentDownloadType = 'none'\n }\n\n // Remove the spec prefix\n if (configuration.spec?.url) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'spec.url' attribute. Remove the spec prefix and move the 'url' attribute to the top level.`,\n )\n\n configuration.url = configuration.spec.url\n delete configuration.spec\n }\n\n if (configuration.spec?.content) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'spec.content' attribute. Remove the spec prefix and move the 'content' attribute to the top level.`,\n )\n\n configuration.content = configuration.spec.content\n delete configuration.spec\n }\n\n // Migrate proxy URL\n if (configuration.proxy) {\n console.warn(\n `[DEPRECATED] You're using the deprecated 'proxy' attribute, rename it to 'proxyUrl' or update the package.`,\n )\n\n if (!configuration.proxyUrl) {\n configuration.proxyUrl = configuration.proxy\n }\n\n delete configuration.proxy\n }\n\n if (configuration.proxyUrl === OLD_PROXY_URL) {\n console.warn(`[DEPRECATED] Warning: configuration.proxyUrl points to our old proxy (${OLD_PROXY_URL}).`)\n console.warn(`[DEPRECATED] We are overwriting the value and use the new proxy URL (${NEW_PROXY_URL}) instead.`)\n console.warn(\n `[DEPRECATED] Action Required: You should manually update your configuration to use the new URL (${NEW_PROXY_URL}). Read more: https://github.com/scalar/scalar`,\n )\n\n configuration.proxyUrl = NEW_PROXY_URL\n }\n\n return configuration\n})\n\n/**\n * User facing configuration that includes the document source configuration\n */\nexport type ApiReferenceConfigurationWithSource = Omit<\n z.infer<typeof apiReferenceConfigurationWithSourceSchema>,\n // Remove deprecated attributes\n 'proxy' | 'spec' | 'authentication'\n> & {\n authentication?: AuthenticationConfiguration\n}\n\n/**\n * When providing an array of configurations we extend with the default attribute\n * which indicates which configuration should be used as the default one\n */\nexport type ApiReferenceConfigurationWithDefault = ApiReferenceConfigurationWithSource & {\n /** Whether to use this config as the default one */\n default?: boolean\n}\n\n/**\n * Configuration for a single config with multiple sources\n * The configuration will be shared between the documents\n */\nexport type ApiReferenceConfigurationWithMultipleSources = ApiReferenceConfigurationWithSource & {\n sources: (SourceConfiguration & { default?: boolean })[]\n}\n\n/** Configuration for multiple Api References */\nexport type AnyApiReferenceConfiguration =\n | Partial<ApiReferenceConfigurationWithSource>\n | Partial<ApiReferenceConfigurationWithMultipleSources>\n | Partial<ApiReferenceConfigurationWithDefault>[]\n | Partial<ApiReferenceConfigurationWithMultipleSources>[]\n\n/** Typeguard to check to narrow the configs to the one with sources */\nexport const isConfigurationWithSources = (\n config: AnyApiReferenceConfiguration,\n): config is Partial<ApiReferenceConfigurationWithMultipleSources> =>\n Boolean(!Array.isArray(config) && config && 'sources' in config && Array.isArray(config.sources))\n"],
|
|
5
|
+
"mappings": "AAAA,SAAuB,SAAS;AAGhC,SAAS,gCAAgC;AAEzC,SAAS,eAAe,eAAe,+BAA+B;AACtE,SAAmC,iCAAiC;AAGpE,MAAM,kBAAkB,EAAE,OAAiF;AAYpG,MAAM,kCAAkC,wBAAwB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5E,QAAQ,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,QAAQ,EAAE,MAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjF,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3B,OAAO,gBAAgB,SAAS;AAAA;AAAA;AAAA;AAAA,EAIhC,SAAS,EAAE,MAAM,wBAAwB,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpD,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK,EAAE,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EA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A,EAC3B;AAEA,SAAO;AACT,CAAC;AAsCM,MAAM,6BAA6B,CACxC,WAEA,QAAQ,CAAC,MAAM,QAAQ,MAAM,KAAK,UAAU,aAAa,UAAU,MAAM,QAAQ,OAAO,OAAO,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const openApiExtensionSchema: z.ZodObject<{
|
|
3
3
|
name: z.ZodString;
|
|
4
4
|
component: z.ZodUnknown;
|
|
5
5
|
renderer: z.ZodOptional<z.ZodUnknown>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const apiReferencePluginSchema: z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
|
|
8
8
|
name: z.ZodString;
|
|
9
9
|
extensions: z.ZodArray<z.ZodObject<{
|
|
10
10
|
name: z.ZodString;
|
|
@@ -12,6 +12,6 @@ export declare const ApiReferencePluginSchema: z.ZodFunction<z.ZodTuple<readonly
|
|
|
12
12
|
renderer: z.ZodOptional<z.ZodUnknown>;
|
|
13
13
|
}, z.core.$strip>>;
|
|
14
14
|
}, z.core.$strip>>;
|
|
15
|
-
export type SpecificationExtension = z.infer<typeof
|
|
16
|
-
export type ApiReferencePlugin = z.infer<typeof
|
|
15
|
+
export type SpecificationExtension = z.infer<typeof openApiExtensionSchema>;
|
|
16
|
+
export type ApiReferencePlugin = z.infer<typeof apiReferencePluginSchema>;
|
|
17
17
|
//# sourceMappingURL=api-reference-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-reference-plugin.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-reference-plugin.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,sBAAsB;;;;iBAkBjC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;kBAMnC,CAAA;AAGF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAC3E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const openApiExtensionSchema = z.object({
|
|
3
3
|
/**
|
|
4
4
|
* Name of specification extension property. Has to start with `x-`.
|
|
5
5
|
*
|
|
@@ -18,15 +18,15 @@ const OpenApiExtensionSchema = z.object({
|
|
|
18
18
|
*/
|
|
19
19
|
renderer: z.unknown().optional()
|
|
20
20
|
});
|
|
21
|
-
const
|
|
21
|
+
const apiReferencePluginSchema = z.function({
|
|
22
22
|
input: [],
|
|
23
23
|
output: z.object({
|
|
24
24
|
name: z.string(),
|
|
25
|
-
extensions: z.array(
|
|
25
|
+
extensions: z.array(openApiExtensionSchema)
|
|
26
26
|
})
|
|
27
27
|
});
|
|
28
28
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
apiReferencePluginSchema,
|
|
30
|
+
openApiExtensionSchema
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=api-reference-plugin.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api-reference/api-reference-plugin.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\n\nexport const openApiExtensionSchema = z.object({\n /**\n * Name of specification extension property. Has to start with `x-`.\n *\n * @example\n * ```yaml\n * x-custom-extension: foobar\n * ```\n */\n name: z.string().regex(/^x-/),\n /**\n * Vue component to render the specification extension\n */\n component: z.unknown(),\n /**\n * Custom renderer to render the specification extension\n */\n renderer: z.unknown().optional(),\n})\n\nexport const apiReferencePluginSchema = z.function({\n input: [],\n output: z.object({\n name: z.string(),\n extensions: z.array(openApiExtensionSchema),\n }),\n})\n\n// Infer the types from the schemas\nexport type SpecificationExtension = z.infer<typeof openApiExtensionSchema>\nexport type ApiReferencePlugin = z.infer<typeof apiReferencePluginSchema>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAEX,MAAM,yBAAyB,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7C,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA,EAI5B,WAAW,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIrB,UAAU,EAAE,QAAQ,EAAE,SAAS;AACjC,CAAC;AAEM,MAAM,2BAA2B,EAAE,SAAS;AAAA,EACjD,OAAO,CAAC;AAAA,EACR,QAAQ,EAAE,OAAO;AAAA,IACf,MAAM,EAAE,OAAO;AAAA,IACf,YAAY,EAAE,MAAM,sBAAsB;AAAA,EAC5C,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const OLD_PROXY_URL = "https://api.scalar.com/request-proxy";
|
|
3
|
+
export declare const NEW_PROXY_URL = "https://proxy.scalar.com";
|
|
4
|
+
/** Shared configuration for the Api Reference and Api Client */
|
|
5
|
+
export declare const baseConfigurationSchema: z.ZodObject<{
|
|
6
|
+
title: z.ZodOptional<z.ZodString>;
|
|
7
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
8
|
+
authentication: z.ZodOptional<z.ZodAny>;
|
|
9
|
+
baseServerURL: z.ZodOptional<z.ZodString>;
|
|
10
|
+
hideClientButton: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
|
|
11
|
+
proxyUrl: z.ZodOptional<z.ZodString>;
|
|
12
|
+
searchHotKey: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
a: "a";
|
|
14
|
+
b: "b";
|
|
15
|
+
c: "c";
|
|
16
|
+
d: "d";
|
|
17
|
+
e: "e";
|
|
18
|
+
f: "f";
|
|
19
|
+
g: "g";
|
|
20
|
+
h: "h";
|
|
21
|
+
i: "i";
|
|
22
|
+
j: "j";
|
|
23
|
+
k: "k";
|
|
24
|
+
l: "l";
|
|
25
|
+
m: "m";
|
|
26
|
+
n: "n";
|
|
27
|
+
o: "o";
|
|
28
|
+
p: "p";
|
|
29
|
+
q: "q";
|
|
30
|
+
r: "r";
|
|
31
|
+
s: "s";
|
|
32
|
+
t: "t";
|
|
33
|
+
u: "u";
|
|
34
|
+
v: "v";
|
|
35
|
+
w: "w";
|
|
36
|
+
x: "x";
|
|
37
|
+
y: "y";
|
|
38
|
+
z: "z";
|
|
39
|
+
}>>;
|
|
40
|
+
servers: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
41
|
+
showSidebar: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
|
|
42
|
+
showToolbar: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
43
|
+
never: "never";
|
|
44
|
+
always: "always";
|
|
45
|
+
localhost: "localhost";
|
|
46
|
+
}>>>>;
|
|
47
|
+
operationTitleSource: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
summary: "summary";
|
|
49
|
+
path: "path";
|
|
50
|
+
}>>>>;
|
|
51
|
+
theme: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
default: "default";
|
|
53
|
+
alternate: "alternate";
|
|
54
|
+
moon: "moon";
|
|
55
|
+
purple: "purple";
|
|
56
|
+
solarized: "solarized";
|
|
57
|
+
bluePlanet: "bluePlanet";
|
|
58
|
+
deepSpace: "deepSpace";
|
|
59
|
+
saturn: "saturn";
|
|
60
|
+
kepler: "kepler";
|
|
61
|
+
elysiajs: "elysiajs";
|
|
62
|
+
fastify: "fastify";
|
|
63
|
+
mars: "mars";
|
|
64
|
+
laserwave: "laserwave";
|
|
65
|
+
none: "none";
|
|
66
|
+
}>>>>;
|
|
67
|
+
_integration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
68
|
+
elysiajs: "elysiajs";
|
|
69
|
+
fastify: "fastify";
|
|
70
|
+
adonisjs: "adonisjs";
|
|
71
|
+
docusaurus: "docusaurus";
|
|
72
|
+
dotnet: "dotnet";
|
|
73
|
+
express: "express";
|
|
74
|
+
fastapi: "fastapi";
|
|
75
|
+
go: "go";
|
|
76
|
+
hono: "hono";
|
|
77
|
+
html: "html";
|
|
78
|
+
laravel: "laravel";
|
|
79
|
+
litestar: "litestar";
|
|
80
|
+
nestjs: "nestjs";
|
|
81
|
+
nextjs: "nextjs";
|
|
82
|
+
nitro: "nitro";
|
|
83
|
+
nuxt: "nuxt";
|
|
84
|
+
platformatic: "platformatic";
|
|
85
|
+
react: "react";
|
|
86
|
+
rust: "rust";
|
|
87
|
+
svelte: "svelte";
|
|
88
|
+
vue: "vue";
|
|
89
|
+
}>>>;
|
|
90
|
+
onRequestSent: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodString], null>, z.ZodVoid>>;
|
|
91
|
+
persistAuth: z.ZodCatch<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
|
|
92
|
+
plugins: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodObject<{
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
views: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
'request.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
title: z.ZodOptional<z.ZodString>;
|
|
97
|
+
component: z.ZodUnknown;
|
|
98
|
+
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
99
|
+
}, z.core.$strip>>>;
|
|
100
|
+
'response.section': z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
101
|
+
title: z.ZodOptional<z.ZodString>;
|
|
102
|
+
component: z.ZodUnknown;
|
|
103
|
+
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
hooks: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
108
|
+
request: z.ZodCustom<Request, Request>;
|
|
109
|
+
}, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
110
|
+
onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
111
|
+
response: z.ZodCustom<Response, Response>;
|
|
112
|
+
operation: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
113
|
+
}, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>>>>;
|
|
116
|
+
telemetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
//# sourceMappingURL=base-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/base-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAInB,eAAO,MAAM,aAAa,yCAAyC,CAAA;AACnE,eAAO,MAAM,aAAa,6BAA6B,CAAA;AAEvD,gEAAgE;AAChE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyIlC,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { apiClientPluginSchema } from "./api-client-plugin.js";
|
|
3
|
+
const OLD_PROXY_URL = "https://api.scalar.com/request-proxy";
|
|
4
|
+
const NEW_PROXY_URL = "https://proxy.scalar.com";
|
|
5
|
+
const baseConfigurationSchema = z.object({
|
|
6
|
+
/**
|
|
7
|
+
* The title of the OpenAPI document.
|
|
8
|
+
*
|
|
9
|
+
* @example 'Scalar Galaxy'
|
|
10
|
+
*/
|
|
11
|
+
title: z.string().optional(),
|
|
12
|
+
/**
|
|
13
|
+
* The slug of the OpenAPI document used in the URL.
|
|
14
|
+
*
|
|
15
|
+
* If none is passed, the title will be used.
|
|
16
|
+
*
|
|
17
|
+
* If no title is used, it'll just use the index.
|
|
18
|
+
*
|
|
19
|
+
* @example 'scalar-galaxy'
|
|
20
|
+
*/
|
|
21
|
+
slug: z.string().optional(),
|
|
22
|
+
/** Prefill authentication */
|
|
23
|
+
authentication: z.any().optional(),
|
|
24
|
+
// Temp until we bring in the new auth
|
|
25
|
+
/** Base URL for the API server */
|
|
26
|
+
baseServerURL: z.string().optional(),
|
|
27
|
+
/**
|
|
28
|
+
* Whether to hide the client button
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
hideClientButton: z.boolean().optional().default(false).catch(false),
|
|
32
|
+
/** URL to a request proxy for the API client */
|
|
33
|
+
proxyUrl: z.string().optional(),
|
|
34
|
+
/** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */
|
|
35
|
+
searchHotKey: z.enum([
|
|
36
|
+
"a",
|
|
37
|
+
"b",
|
|
38
|
+
"c",
|
|
39
|
+
"d",
|
|
40
|
+
"e",
|
|
41
|
+
"f",
|
|
42
|
+
"g",
|
|
43
|
+
"h",
|
|
44
|
+
"i",
|
|
45
|
+
"j",
|
|
46
|
+
"k",
|
|
47
|
+
"l",
|
|
48
|
+
"m",
|
|
49
|
+
"n",
|
|
50
|
+
"o",
|
|
51
|
+
"p",
|
|
52
|
+
"q",
|
|
53
|
+
"r",
|
|
54
|
+
"s",
|
|
55
|
+
"t",
|
|
56
|
+
"u",
|
|
57
|
+
"v",
|
|
58
|
+
"w",
|
|
59
|
+
"x",
|
|
60
|
+
"y",
|
|
61
|
+
"z"
|
|
62
|
+
]).optional(),
|
|
63
|
+
/** List of OpenAPI server objects */
|
|
64
|
+
servers: z.array(z.any()).optional(),
|
|
65
|
+
// Using any for OpenAPIV3_1.ServerObject
|
|
66
|
+
/**
|
|
67
|
+
* Whether to show the sidebar
|
|
68
|
+
* @default true
|
|
69
|
+
*/
|
|
70
|
+
showSidebar: z.boolean().optional().default(true).catch(true),
|
|
71
|
+
/**
|
|
72
|
+
* Sets the visibility of the developer tools
|
|
73
|
+
* @default 'localhost' to only show the toolbar on localhost or similar hosts
|
|
74
|
+
*/
|
|
75
|
+
showToolbar: z.enum(["always", "localhost", "never"]).optional().default("localhost").catch("localhost"),
|
|
76
|
+
/**
|
|
77
|
+
* Whether to use the operation summary or the operation path for the sidebar and search
|
|
78
|
+
* @default 'summary'
|
|
79
|
+
*/
|
|
80
|
+
operationTitleSource: z.enum(["summary", "path"]).optional().default("summary").catch("summary"),
|
|
81
|
+
/** A string to use one of the color presets */
|
|
82
|
+
theme: z.enum([
|
|
83
|
+
"alternate",
|
|
84
|
+
"default",
|
|
85
|
+
"moon",
|
|
86
|
+
"purple",
|
|
87
|
+
"solarized",
|
|
88
|
+
"bluePlanet",
|
|
89
|
+
"deepSpace",
|
|
90
|
+
"saturn",
|
|
91
|
+
"kepler",
|
|
92
|
+
"elysiajs",
|
|
93
|
+
"fastify",
|
|
94
|
+
"mars",
|
|
95
|
+
"laserwave",
|
|
96
|
+
"none"
|
|
97
|
+
]).optional().default("default").catch("default"),
|
|
98
|
+
/** Integration type identifier */
|
|
99
|
+
_integration: z.enum([
|
|
100
|
+
"adonisjs",
|
|
101
|
+
"docusaurus",
|
|
102
|
+
"dotnet",
|
|
103
|
+
"elysiajs",
|
|
104
|
+
"express",
|
|
105
|
+
"fastapi",
|
|
106
|
+
"fastify",
|
|
107
|
+
"go",
|
|
108
|
+
"hono",
|
|
109
|
+
"html",
|
|
110
|
+
"laravel",
|
|
111
|
+
"litestar",
|
|
112
|
+
"nestjs",
|
|
113
|
+
"nextjs",
|
|
114
|
+
"nitro",
|
|
115
|
+
"nuxt",
|
|
116
|
+
"platformatic",
|
|
117
|
+
"react",
|
|
118
|
+
"rust",
|
|
119
|
+
"svelte",
|
|
120
|
+
"vue"
|
|
121
|
+
]).nullable().optional(),
|
|
122
|
+
/** onRequestSent is fired when a request is sent */
|
|
123
|
+
onRequestSent: z.function({
|
|
124
|
+
input: [z.string()],
|
|
125
|
+
output: z.void()
|
|
126
|
+
}).optional(),
|
|
127
|
+
/** Whether to persist auth to local storage */
|
|
128
|
+
persistAuth: z.boolean().optional().default(false).catch(false),
|
|
129
|
+
/** Plugins for the API client */
|
|
130
|
+
plugins: z.array(apiClientPluginSchema).optional(),
|
|
131
|
+
/** Enables / disables telemetry*/
|
|
132
|
+
telemetry: z.boolean().optional().default(true)
|
|
133
|
+
});
|
|
134
|
+
export {
|
|
135
|
+
NEW_PROXY_URL,
|
|
136
|
+
OLD_PROXY_URL,
|
|
137
|
+
baseConfigurationSchema
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=base-configuration.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/api-reference/base-configuration.ts"],
|
|
4
|
+
"sourcesContent": ["import z from 'zod'\n\nimport { apiClientPluginSchema } from './api-client-plugin'\n\nexport const OLD_PROXY_URL = 'https://api.scalar.com/request-proxy'\nexport const NEW_PROXY_URL = 'https://proxy.scalar.com'\n\n/** Shared configuration for the Api Reference and Api Client */\nexport const baseConfigurationSchema = z.object({\n /**\n * The title of the OpenAPI document.\n *\n * @example 'Scalar Galaxy'\n */\n title: z.string().optional(),\n /**\n * The slug of the OpenAPI document used in the URL.\n *\n * If none is passed, the title will be used.\n *\n * If no title is used, it'll just use the index.\n *\n * @example 'scalar-galaxy'\n */\n slug: z.string().optional(),\n /** Prefill authentication */\n authentication: z.any().optional(), // Temp until we bring in the new auth\n /** Base URL for the API server */\n baseServerURL: z.string().optional(),\n /**\n * Whether to hide the client button\n * @default false\n */\n hideClientButton: z.boolean().optional().default(false).catch(false),\n /** URL to a request proxy for the API client */\n proxyUrl: z.string().optional(),\n /** Key used with CTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k) */\n searchHotKey: z\n .enum([\n 'a',\n 'b',\n 'c',\n 'd',\n 'e',\n 'f',\n 'g',\n 'h',\n 'i',\n 'j',\n 'k',\n 'l',\n 'm',\n 'n',\n 'o',\n 'p',\n 'q',\n 'r',\n 's',\n 't',\n 'u',\n 'v',\n 'w',\n 'x',\n 'y',\n 'z',\n ])\n .optional(),\n /** List of OpenAPI server objects */\n servers: z.array(z.any()).optional(), // Using any for OpenAPIV3_1.ServerObject\n /**\n * Whether to show the sidebar\n * @default true\n */\n showSidebar: z.boolean().optional().default(true).catch(true),\n /**\n * Sets the visibility of the developer tools\n * @default 'localhost' to only show the toolbar on localhost or similar hosts\n */\n showToolbar: z.enum(['always', 'localhost', 'never']).optional().default('localhost').catch('localhost'),\n /**\n * Whether to use the operation summary or the operation path for the sidebar and search\n * @default 'summary'\n */\n operationTitleSource: z.enum(['summary', 'path']).optional().default('summary').catch('summary'),\n /** A string to use one of the color presets */\n theme: z\n .enum([\n 'alternate',\n 'default',\n 'moon',\n 'purple',\n 'solarized',\n 'bluePlanet',\n 'deepSpace',\n 'saturn',\n 'kepler',\n 'elysiajs',\n 'fastify',\n 'mars',\n 'laserwave',\n 'none',\n ])\n .optional()\n .default('default')\n .catch('default'),\n /** Integration type identifier */\n _integration: z\n .enum([\n 'adonisjs',\n 'docusaurus',\n 'dotnet',\n 'elysiajs',\n 'express',\n 'fastapi',\n 'fastify',\n 'go',\n 'hono',\n 'html',\n 'laravel',\n 'litestar',\n 'nestjs',\n 'nextjs',\n 'nitro',\n 'nuxt',\n 'platformatic',\n 'react',\n 'rust',\n 'svelte',\n 'vue',\n ])\n .nullable()\n .optional(),\n /** onRequestSent is fired when a request is sent */\n onRequestSent: z\n .function({\n input: [z.string()],\n output: z.void(),\n })\n .optional(),\n /** Whether to persist auth to local storage */\n persistAuth: z.boolean().optional().default(false).catch(false),\n /** Plugins for the API client */\n plugins: z.array(apiClientPluginSchema).optional(),\n /** Enables / disables telemetry*/\n telemetry: z.boolean().optional().default(true),\n})\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,OAAO;AAEd,SAAS,6BAA6B;AAE/B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AAGtB,MAAM,0BAA0B,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM9C,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU3B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE1B,gBAAgB,EAAE,IAAI,EAAE,SAAS;AAAA;AAAA;AAAA,EAEjC,eAAe,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnC,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK,EAAE,MAAM,KAAK;AAAA;AAAA,EAEnE,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE9B,cAAc,EACX,KAAK;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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IAClB,QAAQ,EAAE,KAAK;AAAA,EACjB,CAAC,EACA,SAAS;AAAA;AAAA,EAEZ,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAK,EAAE,MAAM,KAAK;AAAA;AAAA,EAE9D,SAAS,EAAE,MAAM,qBAAqB,EAAE,SAAS;AAAA;AAAA,EAEjD,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,IAAI;AAChD,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApiReferenceConfigurationWithMultipleSources } from './api-reference-configuration.js';
|
|
3
3
|
/**
|
|
4
4
|
* Zod schema for HTML rendering configuration
|
|
5
5
|
*/
|
|
@@ -12,5 +12,5 @@ export declare const htmlRenderingConfigurationSchema: z.ZodObject<{
|
|
|
12
12
|
*
|
|
13
13
|
* It's the ApiReferenceConfiguration, but extended with the `pageTitle` and `cdn` options.
|
|
14
14
|
*/
|
|
15
|
-
export type HtmlRenderingConfiguration = Partial<
|
|
15
|
+
export type HtmlRenderingConfiguration = Partial<ApiReferenceConfigurationWithMultipleSources> & z.infer<typeof htmlRenderingConfigurationSchema>;
|
|
16
16
|
//# sourceMappingURL=html-rendering-configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"html-rendering-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/html-rendering-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAA;AAEjG;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;iBAe3C,CAAA;AAEF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,4CAA4C,CAAC,GAC5F,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api-reference/html-rendering-configuration.ts"],
|
|
4
|
-
"sourcesContent": ["import { z } from 'zod'\nimport type {
|
|
5
|
-
"mappings": "AAAA,SAAS,SAAS;
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\n\nimport type { ApiReferenceConfigurationWithMultipleSources } from './api-reference-configuration'\n\n/**\n * Zod schema for HTML rendering configuration\n */\nexport const htmlRenderingConfigurationSchema = z.object({\n /**\n * The URL to the Scalar API Reference JS CDN.\n *\n * Use this to pin a specific version of the Scalar API Reference.\n *\n * @default https://cdn.jsdelivr.net/npm/@scalar/api-reference\n *\n * @example https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.122\n */\n cdn: z.string().optional().default('https://cdn.jsdelivr.net/npm/@scalar/api-reference'),\n /**\n * The title of the page.\n */\n pageTitle: z.string().optional().default('Scalar API Reference'),\n})\n\n/**\n * The configuration for the static HTML rendering using the CDN.\n *\n * It's the ApiReferenceConfiguration, but extended with the `pageTitle` and `cdn` options.\n */\nexport type HtmlRenderingConfiguration = Partial<ApiReferenceConfigurationWithMultipleSources> &\n z.infer<typeof htmlRenderingConfigurationSchema>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAOX,MAAM,mCAAmC,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUvD,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,oDAAoD;AAAA;AAAA;AAAA;AAAA,EAIvF,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,sBAAsB;AACjE,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { type ApiClientConfiguration,
|
|
2
|
-
export { type
|
|
3
|
-
export type
|
|
1
|
+
export { type ApiClientConfiguration, apiClientConfigurationSchema, } from './api-client-configuration.js';
|
|
2
|
+
export { type ApiClientPlugin, apiClientPluginSchema, hooksSchema } from './api-client-plugin.js';
|
|
3
|
+
export { type AnyApiReferenceConfiguration, type ApiReferenceConfiguration, type ApiReferenceConfigurationWithDefault, type ApiReferenceConfigurationWithMultipleSources, type ApiReferenceConfigurationWithSource, apiReferenceConfigurationSchema, apiReferenceConfigurationWithSourceSchema, isConfigurationWithSources, } from './api-reference-configuration.js';
|
|
4
|
+
export type { ApiReferencePlugin, SpecificationExtension, } from './api-reference-plugin.js';
|
|
4
5
|
export type { ApiReferenceInstance, CreateApiReference } from './html-api.js';
|
|
6
|
+
export { type HtmlRenderingConfiguration, htmlRenderingConfigurationSchema, } from './html-rendering-configuration.js';
|
|
7
|
+
export { type SourceConfiguration, sourceConfigurationSchema, } from './source-configuration.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-reference/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-reference/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,eAAe,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC9F,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,4CAA4C,EACjD,KAAK,mCAAmC,EACxC,+BAA+B,EAC/B,yCAAyC,EACzC,0BAA0B,GAC3B,MAAM,+BAA+B,CAAA;AACtC,YAAY,EACV,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,EACL,KAAK,0BAA0B,EAC/B,gCAAgC,GACjC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAA"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
apiClientConfigurationSchema
|
|
2
|
+
apiClientConfigurationSchema
|
|
3
|
+
} from "./api-client-configuration.js";
|
|
4
|
+
import { apiClientPluginSchema, hooksSchema } from "./api-client-plugin.js";
|
|
5
|
+
import {
|
|
3
6
|
apiReferenceConfigurationSchema,
|
|
4
|
-
|
|
7
|
+
apiReferenceConfigurationWithSourceSchema,
|
|
5
8
|
isConfigurationWithSources
|
|
6
9
|
} from "./api-reference-configuration.js";
|
|
7
10
|
import {
|
|
8
11
|
htmlRenderingConfigurationSchema
|
|
9
12
|
} from "./html-rendering-configuration.js";
|
|
13
|
+
import {
|
|
14
|
+
sourceConfigurationSchema
|
|
15
|
+
} from "./source-configuration.js";
|
|
10
16
|
export {
|
|
11
17
|
apiClientConfigurationSchema,
|
|
18
|
+
apiClientPluginSchema,
|
|
12
19
|
apiReferenceConfigurationSchema,
|
|
20
|
+
apiReferenceConfigurationWithSourceSchema,
|
|
21
|
+
hooksSchema,
|
|
13
22
|
htmlRenderingConfigurationSchema,
|
|
14
23
|
isConfigurationWithSources,
|
|
15
|
-
|
|
24
|
+
sourceConfigurationSchema
|
|
16
25
|
};
|
|
17
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api-reference/index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "AAAA;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["// biome-ignore lint/performance/noBarrelFile: exporting from a block\nexport {\n type ApiClientConfiguration,\n apiClientConfigurationSchema,\n} from './api-client-configuration'\nexport { type ApiClientPlugin, apiClientPluginSchema, hooksSchema } from './api-client-plugin'\nexport {\n type AnyApiReferenceConfiguration,\n type ApiReferenceConfiguration,\n type ApiReferenceConfigurationWithDefault,\n type ApiReferenceConfigurationWithMultipleSources,\n type ApiReferenceConfigurationWithSource,\n apiReferenceConfigurationSchema,\n apiReferenceConfigurationWithSourceSchema,\n isConfigurationWithSources,\n} from './api-reference-configuration'\nexport type {\n ApiReferencePlugin,\n SpecificationExtension,\n} from './api-reference-plugin'\nexport type { ApiReferenceInstance, CreateApiReference } from './html-api'\nexport {\n type HtmlRenderingConfiguration,\n htmlRenderingConfigurationSchema,\n} from './html-rendering-configuration'\nexport {\n type SourceConfiguration,\n sourceConfigurationSchema,\n} from './source-configuration'\n"],
|
|
5
|
+
"mappings": "AACA;AAAA,EAEE;AAAA,OACK;AACP,SAA+B,uBAAuB,mBAAmB;AACzE;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A source is any potential document input used for API Reference
|
|
4
|
+
* and API Client integrations. Sources may be specified in the configuration
|
|
5
|
+
* or used independently. Some configurations may have multiple sources.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sourceConfigurationSchema: z.ZodObject<{
|
|
8
|
+
url: z.ZodOptional<z.ZodString>;
|
|
9
|
+
content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodRecord<z.ZodString, z.ZodAny>>]>>;
|
|
10
|
+
title: z.ZodOptional<z.ZodString>;
|
|
11
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
12
|
+
spec: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
url: z.ZodOptional<z.ZodString>;
|
|
14
|
+
content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodRecord<z.ZodString, z.ZodAny>>]>>;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type SourceConfiguration = z.infer<typeof sourceConfigurationSchema>;
|
|
18
|
+
//# sourceMappingURL=source-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/source-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;iBAuFpC,CAAA;AAEF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|