@scalar/types 0.7.3 → 0.7.4

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 (46) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api-reference/api-client-configuration.js +3 -7
  3. package/dist/api-reference/api-client-plugin.js +32 -30
  4. package/dist/api-reference/api-reference-configuration.js +404 -361
  5. package/dist/api-reference/api-reference-plugin.js +43 -47
  6. package/dist/api-reference/authentication-configuration.js +1 -1
  7. package/dist/api-reference/authentication-configuration.test-d.js +41 -42
  8. package/dist/api-reference/base-configuration.js +150 -146
  9. package/dist/api-reference/html-api.js +1 -1
  10. package/dist/api-reference/html-rendering-configuration.js +19 -20
  11. package/dist/api-reference/index.js +5 -26
  12. package/dist/api-reference/source-configuration.js +105 -96
  13. package/dist/entities/index.js +1 -21
  14. package/dist/entities/security-scheme.js +179 -140
  15. package/dist/index.js +6 -6
  16. package/dist/legacy/index.js +1 -5
  17. package/dist/legacy/reference-config.js +6 -10
  18. package/dist/snippetz/index.js +1 -6
  19. package/dist/snippetz/snippetz.js +35 -31
  20. package/dist/snippetz/snippetz.test-d.js +30 -27
  21. package/dist/utils/index.js +1 -5
  22. package/dist/utils/nanoid.js +7 -7
  23. package/dist/utils/utility-types.js +1 -1
  24. package/package.json +5 -9
  25. package/dist/api-reference/api-client-configuration.js.map +0 -7
  26. package/dist/api-reference/api-client-plugin.js.map +0 -7
  27. package/dist/api-reference/api-reference-configuration.js.map +0 -7
  28. package/dist/api-reference/api-reference-plugin.js.map +0 -7
  29. package/dist/api-reference/authentication-configuration.js.map +0 -7
  30. package/dist/api-reference/authentication-configuration.test-d.js.map +0 -7
  31. package/dist/api-reference/base-configuration.js.map +0 -7
  32. package/dist/api-reference/html-api.js.map +0 -7
  33. package/dist/api-reference/html-rendering-configuration.js.map +0 -7
  34. package/dist/api-reference/index.js.map +0 -7
  35. package/dist/api-reference/source-configuration.js.map +0 -7
  36. package/dist/entities/index.js.map +0 -7
  37. package/dist/entities/security-scheme.js.map +0 -7
  38. package/dist/index.js.map +0 -7
  39. package/dist/legacy/index.js.map +0 -7
  40. package/dist/legacy/reference-config.js.map +0 -7
  41. package/dist/snippetz/index.js.map +0 -7
  42. package/dist/snippetz/snippetz.js.map +0 -7
  43. package/dist/snippetz/snippetz.test-d.js.map +0 -7
  44. package/dist/utils/index.js.map +0 -7
  45. package/dist/utils/nanoid.js.map +0 -7
  46. package/dist/utils/utility-types.js.map +0 -7
@@ -1,32 +1,36 @@
1
- import { objectEntries } from "@scalar/helpers/object/object-entries";
2
- const GROUPED_CLIENTS = {
3
- c: ["libcurl"],
4
- clojure: ["clj_http"],
5
- csharp: ["httpclient", "restsharp"],
6
- dart: ["http"],
7
- fsharp: ["httpclient"],
8
- go: ["native"],
9
- http: ["http1.1"],
10
- java: ["asynchttp", "nethttp", "okhttp", "unirest"],
11
- js: ["axios", "fetch", "jquery", "ofetch", "xhr"],
12
- kotlin: ["okhttp"],
13
- node: ["axios", "fetch", "ofetch", "undici"],
14
- objc: ["nsurlsession"],
15
- ocaml: ["cohttp"],
16
- php: ["curl", "guzzle"],
17
- powershell: ["restmethod", "webrequest"],
18
- python: ["python3", "requests", "httpx_sync", "httpx_async"],
19
- r: ["httr"],
20
- ruby: ["native"],
21
- rust: ["reqwest"],
22
- shell: ["curl", "httpie", "wget"],
23
- swift: ["nsurlsession"]
1
+ import { objectEntries } from '@scalar/helpers/object/object-entries';
2
+ /**
3
+ * Maps programming languages and environments to their available HTTP clients.
4
+ * Each key is a target (language/environment), and each value is an array of
5
+ * client identifiers in the format `target/client`.
6
+ *
7
+ * This is the source of truth for all supported code generation targets.
8
+ */
9
+ export const GROUPED_CLIENTS = {
10
+ c: ['libcurl'],
11
+ clojure: ['clj_http'],
12
+ csharp: ['httpclient', 'restsharp'],
13
+ dart: ['http'],
14
+ fsharp: ['httpclient'],
15
+ go: ['native'],
16
+ http: ['http1.1'],
17
+ java: ['asynchttp', 'nethttp', 'okhttp', 'unirest'],
18
+ js: ['axios', 'fetch', 'jquery', 'ofetch', 'xhr'],
19
+ kotlin: ['okhttp'],
20
+ node: ['axios', 'fetch', 'ofetch', 'undici'],
21
+ objc: ['nsurlsession'],
22
+ ocaml: ['cohttp'],
23
+ php: ['curl', 'guzzle'],
24
+ powershell: ['restmethod', 'webrequest'],
25
+ python: ['python3', 'requests', 'httpx_sync', 'httpx_async'],
26
+ r: ['httr'],
27
+ ruby: ['native'],
28
+ rust: ['reqwest'],
29
+ shell: ['curl', 'httpie', 'wget'],
30
+ swift: ['nsurlsession'],
24
31
  };
25
- const AVAILABLE_CLIENTS = objectEntries(GROUPED_CLIENTS).flatMap(
26
- ([group, clients]) => clients.map((client) => `${group}/${client}`)
27
- );
28
- export {
29
- AVAILABLE_CLIENTS,
30
- GROUPED_CLIENTS
31
- };
32
- //# sourceMappingURL=snippetz.js.map
32
+ /**
33
+ * Flat array of all available client identifiers.
34
+ * Each identifier follows the format `target/client` (e.g., `js/fetch`, `python/requests`).
35
+ */
36
+ export const AVAILABLE_CLIENTS = objectEntries(GROUPED_CLIENTS).flatMap(([group, clients]) => clients.map((client) => `${group}/${client}`));
@@ -1,28 +1,31 @@
1
- import { assertType, describe, it } from "vitest";
2
- describe("TargetId", () => {
3
- it("has node as a target", () => {
4
- const target = "node";
5
- assertType(target);
6
- });
7
- it(`target doesn't exist`, () => {
8
- const target = "foo";
9
- assertType(target);
10
- });
11
- it("has undici as a client", () => {
12
- const client = "undici";
13
- assertType(client);
14
- });
15
- it(`client doesn't exist`, () => {
16
- const client = "does-not-exist";
17
- assertType(client);
18
- });
19
- it(`client exists, but target doesn't`, () => {
20
- const client = "undici";
21
- assertType(client);
22
- });
23
- it("client does exist, but not for the given target", () => {
24
- const client = "undici";
25
- assertType(client);
26
- });
1
+ import { assertType, describe, it } from 'vitest';
2
+ describe('TargetId', () => {
3
+ it('has node as a target', () => {
4
+ const target = 'node';
5
+ assertType(target);
6
+ });
7
+ it(`target doesn't exist`, () => {
8
+ const target = 'foo';
9
+ // @ts-expect-error target doesn't exist
10
+ assertType(target);
11
+ });
12
+ it('has undici as a client', () => {
13
+ const client = 'undici';
14
+ assertType(client);
15
+ });
16
+ it(`client doesn't exist`, () => {
17
+ const client = 'does-not-exist';
18
+ // @ts-expect-error client doesn't exist
19
+ assertType(client);
20
+ });
21
+ it(`client exists, but target doesn't`, () => {
22
+ const client = 'undici';
23
+ // @ts-expect-error client exists, but target doesn't
24
+ assertType(client);
25
+ });
26
+ it('client does exist, but not for the given target', () => {
27
+ const client = 'undici';
28
+ // @ts-expect-error client does exist, but not for the given target
29
+ assertType(client);
30
+ });
27
31
  });
28
- //# sourceMappingURL=snippetz.test-d.js.map
@@ -1,5 +1 @@
1
- import { nanoidSchema } from "./nanoid.js";
2
- export {
3
- nanoidSchema
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ export { nanoidSchema } from './nanoid.js';
@@ -1,7 +1,7 @@
1
- import { nanoid } from "nanoid";
2
- import { z } from "zod";
3
- const nanoidSchema = z.string().min(7).default(() => nanoid());
4
- export {
5
- nanoidSchema
6
- };
7
- //# sourceMappingURL=nanoid.js.map
1
+ import { nanoid } from 'nanoid';
2
+ import { z } from 'zod';
3
+ /** Generates a default value */
4
+ export const nanoidSchema = z
5
+ .string()
6
+ .min(7)
7
+ .default(() => nanoid());
@@ -1 +1 @@
1
- //# sourceMappingURL=utility-types.js.map
1
+ export {};
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "scalar",
17
17
  "references"
18
18
  ],
19
- "version": "0.7.3",
19
+ "version": "0.7.4",
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
@@ -62,19 +62,15 @@
62
62
  "nanoid": "^5.1.6",
63
63
  "type-fest": "^5.3.1",
64
64
  "zod": "^4.3.5",
65
- "@scalar/helpers": "0.4.1"
65
+ "@scalar/helpers": "0.4.2"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/har-format": "^1.2.16",
69
- "vite": "^7.3.1",
70
- "@scalar/build-tooling": "0.5.0"
69
+ "vite": "8.0.0"
71
70
  },
72
71
  "scripts": {
73
- "build": "scalar-build-esbuild",
74
- "lint:check": "scalar-lint-check",
75
- "lint:fix": "scalar-lint-fix",
72
+ "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
76
73
  "test": "vitest",
77
- "types:build": "scalar-types-build",
78
- "types:check": "scalar-types-check"
74
+ "types:check": "tsc --noEmit"
79
75
  }
80
76
  }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/api-client-configuration.ts"],
4
- "sourcesContent": ["import type z from 'zod'\n\nimport { baseConfigurationSchema } from './base-configuration'\nimport { sourceConfigurationSchema } from './source-configuration'\n\nexport const apiClientConfigurationSchema = baseConfigurationSchema.extend(sourceConfigurationSchema.shape)\n\nexport type ApiClientConfiguration = z.infer<typeof apiClientConfigurationSchema>\n"],
5
- "mappings": "AAEA,SAAS,+BAA+B;AACxC,SAAS,iCAAiC;AAEnC,MAAM,+BAA+B,wBAAwB,OAAO,0BAA0B,KAAK;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/api-client-plugin.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\n\nconst sectionViewSchema = z.object({\n title: z.string().optional(),\n // Since this is meant to be a Vue component, we'll use unknown\n component: z.unknown(),\n props: z.record(z.string(), z.any()).optional(),\n})\n\nconst viewsSchema = z.object({\n 'request.section': z.array(sectionViewSchema).optional(),\n 'response.section': z.array(sectionViewSchema).optional(),\n})\n\nexport const hooksSchema = z.object({\n onBeforeRequest: z\n .function({\n input: [z.object({ request: z.instanceof(Request) })],\n // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(z.void())]),\n })\n .optional(),\n onResponseReceived: z\n .function({\n input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })],\n // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(z.void())]),\n })\n .optional(),\n})\n\n/**\n * An API client plugin that can connect into request and response hooks\n */\nexport const apiClientPluginSchema = z.function({\n input: [],\n output: z.object({\n name: z.string(),\n views: viewsSchema.optional(),\n hooks: hooksSchema.optional(),\n }),\n})\n\nexport type ApiClientPlugin = z.infer<typeof apiClientPluginSchema>\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAElB,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE3B,WAAW,EAAE,QAAQ;AAAA,EACrB,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS;AAChD,CAAC;AAED,MAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,mBAAmB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAAA,EACvD,oBAAoB,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAC1D,CAAC;AAEM,MAAM,cAAc,EAAE,OAAO;AAAA,EAClC,iBAAiB,EACd,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,OAAO,EAAE,CAAC,CAAC;AAAA;AAAA;AAAA,EAGtD,CAAC,EACA,SAAS;AAAA,EACZ,oBAAoB,EACjB,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,QAAQ,GAAG,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AAAA;AAAA;AAAA,EAGlG,CAAC,EACA,SAAS;AACd,CAAC;AAKM,MAAM,wBAAwB,EAAE,SAAS;AAAA,EAC9C,OAAO,CAAC;AAAA,EACR,QAAQ,EAAE,OAAO;AAAA,IACf,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,YAAY,SAAS;AAAA,IAC5B,OAAO,YAAY,SAAS;AAAA,EAC9B,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/api-reference-configuration.ts"],
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\n .function({\n input: [],\n // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(z.void())]),\n })\n .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<((slug: string) => Promise<void> | void) | undefined>,\n /** onBeforeRequest is fired before the request is sent. You can modify the request here. */\n onBeforeRequest: z\n .function({\n input: [z.object({ request: z.instanceof(Request) })],\n // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(z.void())]),\n })\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 // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(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 // Why no output? https://github.com/scalar/scalar/pull/7047\n // output: z.union([z.void(), z.promise(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 * MCP (Model Context Protocol) configuration\n * Optional. When provided, enables MCP integration with the given name and url.\n */\n mcp: z\n .object({\n /** Display name for the MCP server */\n name: z.string().optional(),\n /** URL of the MCP server */\n url: z.string().optional(),\n /** When true, disables the MCP integration */\n disabled: z.boolean().optional(),\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 receive:\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 the first tag in the sidebar when no specific URL target is present\n * @default true\n */\n defaultOpenFirstTag: 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 * Pure configuration without the sources\n *\n * @deprecated Remove this once the types have been fully migrated\n */\nexport type ApiReferenceConfigurationRaw = Omit<\n z.infer<typeof apiReferenceConfigurationSchema>, // Remove deprecated attributes\n 'proxy' | 'spec' | 'authentication' | 'showToolbar'\n> & {\n authentication?: AuthenticationConfiguration\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 = ApiReferenceConfigurationRaw & {\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 // Migrate showToolbar to showDeveloperTools\n if (configuration.showToolbar && configuration.showToolbar !== 'localhost') {\n console.warn(`[DEPRECATED] You're using the deprecated 'showToolbar' attribute. Use 'showDeveloperTools' instead.`)\n\n configuration.showDeveloperTools = configuration.showToolbar\n\n // @ts-expect-error - We're deleting the deprecated attribute\n delete configuration.showToolbar\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' | 'showToolbar'\n> & {\n authentication?: AuthenticationConfiguration\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[]\n}\n\n/** Configuration for multiple Api References */\nexport type AnyApiReferenceConfiguration =\n | Partial<ApiReferenceConfigurationWithSource>\n | Partial<ApiReferenceConfigurationWithMultipleSources>\n | Partial<ApiReferenceConfigurationWithSource>[]\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,OAA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M,KAAK;AAC3B,YAAQ;AAAA,MACN;AAAA,IACF;AAEA,kBAAc,MAAM,cAAc,KAAK;AACvC,WAAO,cAAc;AAAA,EACvB;AAEA,MAAI,cAAc,MAAM,SAAS;AAC/B,YAAQ;AAAA,MACN;AAAA,IACF;AAEA,kBAAc,UAAU,cAAc,KAAK;AAC3C,WAAO,cAAc;AAAA,EACvB;AAGA,MAAI,cAAc,OAAO;AACvB,YAAQ;AAAA,MACN;AAAA,IACF;AAEA,QAAI,CAAC,cAAc,UAAU;AAC3B,oBAAc,WAAW,cAAc;AAAA,IACzC;AAEA,WAAO,cAAc;AAAA,EACvB;AAEA,MAAI,cAAc,aAAa,eAAe;AAC5C,YAAQ,KAAK,yEAAyE,aAAa,IAAI;AACvG,YAAQ,KAAK,wEAAwE,aAAa,YAAY;AAC9G,YAAQ;AAAA,MACN,mGAAmG,aAAa;AAAA,IAClH;AAEA,kBAAc,WAAW;AAAA,EAC3B;AAGA,MAAI,cAAc,eAAe,cAAc,gBAAgB,aAAa;AAC1E,YAAQ,KAAK,qGAAqG;AAElH,kBAAc,qBAAqB,cAAc;AAGjD,WAAO,cAAc;AAAA,EACvB;AAEA,SAAO;AACT,CAAC;AA6BM,MAAM,6BAA6B,CACxC,WAEA,QAAQ,CAAC,MAAM,QAAQ,MAAM,KAAK,UAAU,aAAa,UAAU,MAAM,QAAQ,OAAO,OAAO,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/api-reference-plugin.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\n\nconst 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\nconst viewComponentSchema = z.object({\n /**\n * Vue component to render in the view\n */\n component: z.unknown(),\n /**\n * Custom renderer to render the view component (e.g., ReactRenderer)\n */\n renderer: z.unknown().optional(),\n /**\n * Additional props to pass to the component\n */\n props: z.record(z.string(), z.any()).optional(),\n})\n\nconst viewsSchema = z.object({\n /**\n * Renders after the Models section\n */\n 'content.end': z.array(viewComponentSchema).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 * Components to render at specific views in the API Reference\n */\n views: viewsSchema.optional(),\n }),\n})\n\n// Infer the types from the schemas\nexport type SpecificationExtension = z.infer<typeof openApiExtensionSchema>\nexport type ViewComponent = z.infer<typeof viewComponentSchema>\nexport type ApiReferencePlugin = z.infer<typeof apiReferencePluginSchema>\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAElB,MAAM,yBAAyB,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAStC,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;AAED,MAAM,sBAAsB,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAInC,WAAW,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIrB,UAAU,EAAE,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA,EAI/B,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS;AAChD,CAAC;AAED,MAAM,cAAc,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAI3B,eAAe,EAAE,MAAM,mBAAmB,EAAE,SAAS;AACvD,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;AAAA;AAAA;AAAA,IAI1C,OAAO,YAAY,SAAS;AAAA,EAC9B,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/authentication-configuration.test-d.ts"],
4
- "sourcesContent": ["import { assertType, describe, it } from 'vitest'\n\nimport type { AuthenticationConfiguration } from './authentication-configuration'\n\ndescribe('ApiReferenceConfiguration', () => {\n it('ensure we are generating correct types for preferredSecurityScheme', () => {\n assertType<AuthenticationConfiguration>({ preferredSecurityScheme: 'apiKey' })\n assertType<AuthenticationConfiguration>({ preferredSecurityScheme: ['apiKey', 'bearerAuth'] })\n assertType<AuthenticationConfiguration>({\n preferredSecurityScheme: ['apiKey', ['basic', 'oauth2'], ['apiKey', 'bearerAuth', 'oauth2']],\n })\n assertType<AuthenticationConfiguration>({\n // @ts-expect-error incorrect type\n preferredSecurityScheme: 47,\n })\n assertType<AuthenticationConfiguration>({\n // @ts-expect-error incorrect type\n preferredSecurityScheme: [22, null],\n })\n })\n\n it('ensure we are generating correct types for securitySchemes', () => {\n assertType<AuthenticationConfiguration>({\n securitySchemes: {\n apiKey: { type: 'apiKey', name: 'api_key', in: 'header' },\n },\n })\n assertType<AuthenticationConfiguration>({\n securitySchemes: {\n bearerAuth: { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' },\n },\n })\n assertType<AuthenticationConfiguration>({\n securitySchemes: {\n oauth2: {\n type: 'oauth2',\n flows: {\n implicit: { scopes: { 'read:items': 'Read access to items' } },\n password: {\n username: 'username',\n password: 'password',\n },\n },\n },\n },\n })\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY,UAAU,UAAU;AAIzC,SAAS,6BAA6B,MAAM;AAC1C,KAAG,sEAAsE,MAAM;AAC7E,eAAwC,EAAE,yBAAyB,SAAS,CAAC;AAC7E,eAAwC,EAAE,yBAAyB,CAAC,UAAU,YAAY,EAAE,CAAC;AAC7F,eAAwC;AAAA,MACtC,yBAAyB,CAAC,UAAU,CAAC,SAAS,QAAQ,GAAG,CAAC,UAAU,cAAc,QAAQ,CAAC;AAAA,IAC7F,CAAC;AACD,eAAwC;AAAA;AAAA,MAEtC,yBAAyB;AAAA,IAC3B,CAAC;AACD,eAAwC;AAAA;AAAA,MAEtC,yBAAyB,CAAC,IAAI,IAAI;AAAA,IACpC,CAAC;AAAA,EACH,CAAC;AAED,KAAG,8DAA8D,MAAM;AACrE,eAAwC;AAAA,MACtC,iBAAiB;AAAA,QACf,QAAQ,EAAE,MAAM,UAAU,MAAM,WAAW,IAAI,SAAS;AAAA,MAC1D;AAAA,IACF,CAAC;AACD,eAAwC;AAAA,MACtC,iBAAiB;AAAA,QACf,YAAY,EAAE,MAAM,QAAQ,QAAQ,UAAU,cAAc,MAAM;AAAA,MACpE;AAAA,IACF,CAAC;AACD,eAAwC;AAAA,MACtC,iBAAiB;AAAA,QACf,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,OAAO;AAAA,YACL,UAAU,EAAE,QAAQ,EAAE,cAAc,uBAAuB,EAAE;AAAA,YAC7D,UAAU;AAAA,cACR,UAAU;AAAA,cACV,UAAU;AAAA,YACZ;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
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 * Whether and when to show the developer tools.\n *\n * @default 'localhost' to only show the toolbar on localhost or similar hosts\n */\n showDeveloperTools: z.enum(['always', 'localhost', 'never']).optional().default('localhost').catch('localhost'),\n /**\n * Sets the visibility of the developer tools\n * @default 'localhost' to only show the toolbar on localhost or similar hosts\n * @deprecated Use showDeveloperTools instead\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 'astro',\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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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;AAAA,IACA;AAAA,EACF,CAAC,EACA,SAAS,EACT,SAAS;AAAA;AAAA,EAEZ,eAAe,EACZ,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,CAAC;AAAA,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,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/html-rendering-configuration.ts"],
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
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/index.ts"],
4
- "sourcesContent": ["export {\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 ApiReferenceConfigurationRaw,\n type ApiReferenceConfigurationWithMultipleSources,\n type ApiReferenceConfigurationWithSource,\n apiReferenceConfigurationSchema,\n apiReferenceConfigurationWithSourceSchema,\n isConfigurationWithSources,\n} from './api-reference-configuration'\nexport type {\n ApiReferencePlugin,\n SpecificationExtension,\n ViewComponent,\n} from './api-reference-plugin'\nexport type { AuthenticationConfiguration } from './authentication-configuration'\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": "AAAA;AAAA,EAEE;AAAA,OACK;AACP,SAA+B,uBAAuB,mBAAmB;AACzE;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EAEE;AAAA,OACK;AACP;AAAA,EAEE;AAAA,OACK;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api-reference/source-configuration.ts"],
4
- "sourcesContent": ["import z from 'zod'\n\n/**\n * A source is any potential document input used for API Reference\n * and API Client integrations. Sources may be specified in the configuration\n * or used independently. Some configurations may have multiple sources.\n */\nexport const sourceConfigurationSchema = z.object({\n default: z.boolean().default(false).optional().catch(false),\n /**\n * URL to an OpenAPI/Swagger document\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 * @example\n * ```ts\n * const oldConfiguration = {\n * spec: {\n * content: '\u2026',\n * },\n * }\n *\n * const newConfiguration = {\n * content: '\u2026',\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 /**\n * The OpenAPI/Swagger document to render\n *\n * @deprecated Use `url` and `content` on the top level instead.\n **/\n spec: z\n .object({\n url: z.string().optional(),\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 .optional(),\n /**\n * Agent Scalar configuration\n **/\n agent: z\n .object({\n key: z.string().optional(),\n disabled: z.boolean().optional(),\n /**\n * When true, hide the control to add more APIs in the agent chat.\n * Only preloaded/registry documents are shown; the public API list is not offered.\n */\n hideAddApi: z.boolean().optional(),\n })\n .optional(),\n})\n\nexport type SourceConfiguration = z.infer<typeof sourceConfigurationSchema>\n"],
5
- "mappings": "AAAA,OAAO,OAAO;AAOP,MAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB1D,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzB,SAAS,EACN,MAAM;AAAA,IACL,EAAE,OAAO;AAAA,IACT,EAAE,KAAK;AAAA,IACP,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,IAC5B,EAAE,SAAS;AAAA,MACT,OAAO,CAAC;AAAA,MACR,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,IACtC,CAAC;AAAA,EACH,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY3B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,MAAM,EACH,OAAO;AAAA,IACN,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,IACzB,SAAS,EACN,MAAM;AAAA,MACL,EAAE,OAAO;AAAA,MACT,EAAE,KAAK;AAAA,MACP,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,MAC5B,EAAE,SAAS;AAAA,QACT,OAAO,CAAC;AAAA,QACR,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAAA,MACtC,CAAC;AAAA,IACH,CAAC,EACA,SAAS;AAAA,EACd,CAAC,EACA,SAAS;AAAA;AAAA;AAAA;AAAA,EAIZ,OAAO,EACJ,OAAO;AAAA,IACN,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,IACzB,UAAU,EAAE,QAAQ,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,IAK/B,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,EACnC,CAAC,EACA,SAAS;AACd,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/entities/index.ts"],
4
- "sourcesContent": ["export {\n type Oauth2Flow,\n type Oauth2FlowPayload,\n type SecuritySchemaHttp,\n type SecuritySchemaOpenId,\n type SecurityScheme,\n type SecuritySchemeApiKey,\n type SecuritySchemeOauth2,\n type SecuritySchemeOauth2Payload,\n type SecuritySchemePayload,\n oasSecurityRequirementSchema,\n oasSecuritySchemeSchema,\n pkceOptions,\n securityApiKeySchema,\n securityHttpSchema,\n securityOauthSchema,\n securityOpenIdSchema,\n securitySchemeSchema,\n} from './security-scheme'\n"],
5
- "mappings": "AAAA;AAAA,EAUE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/entities/security-scheme.ts"],
4
- "sourcesContent": ["import { z } from 'zod'\n\nimport { type ENTITY_BRANDS, nanoidSchema } from '../utils/nanoid'\n\n// ---------------------------------------------------------------------------\n// COMMON PROPS FOR ALL SECURITY SCHEMES\n\n/** Some common properties used in all security schemes */\nconst commonProps = z.object({\n /* A description for security scheme. CommonMark syntax MAY be used for rich text representation. */\n description: z.string().optional(),\n})\n\nconst extendedSecuritySchema = z.object({\n uid: nanoidSchema.brand<ENTITY_BRANDS['SECURITY_SCHEME']>(),\n /** The name key that links a security requirement to a security object */\n nameKey: z.string().optional().default(''),\n})\n\n// ---------------------------------------------------------------------------\n// API KEY\n\nconst securitySchemeApiKeyIn = ['query', 'header', 'cookie'] as const\n\nconst oasSecuritySchemeApiKey = commonProps.extend({\n type: z.literal('apiKey'),\n /** REQUIRED. The name of the header, query or cookie parameter to be used. */\n name: z.string().optional().default(''),\n /** REQUIRED. The location of the API key. Valid values are \"query\", \"header\" or \"cookie\". */\n in: z.enum(securitySchemeApiKeyIn).optional().default('header').catch('header'),\n})\n\nconst apiKeyValueSchema = z.object({\n value: z.string().default(''),\n})\n\nexport const securityApiKeySchema = oasSecuritySchemeApiKey.merge(extendedSecuritySchema).merge(apiKeyValueSchema)\nexport type SecuritySchemeApiKey = z.infer<typeof securityApiKeySchema>\n\n// ---------------------------------------------------------------------------\n// HTTP\n\nconst oasSecuritySchemeHttp = commonProps.extend({\n type: z.literal('http'),\n /**\n * REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in\n * [RFC7235]. The values used SHOULD be registered in the IANA Authentication Scheme registry.\n */\n scheme: z\n .string()\n .toLowerCase()\n .pipe(z.enum(['basic', 'bearer']))\n .optional()\n .default('basic'),\n /**\n * A hint to the client to identify how the bearer token is formatted.\n * Bearer tokens are usually generated by an authorization server, so\n * this information is primarily for documentation purposes.\n */\n bearerFormat: z\n .union([z.literal('JWT'), z.string()])\n .optional()\n .default('JWT'),\n})\n\nconst httpValueSchema = z.object({\n username: z.string().default(''),\n password: z.string().default(''),\n token: z.string().default(''),\n})\n\nexport const securityHttpSchema = oasSecuritySchemeHttp.merge(extendedSecuritySchema).merge(httpValueSchema)\nexport type SecuritySchemaHttp = z.infer<typeof securityHttpSchema>\n\n// ---------------------------------------------------------------------------\n// OPENID CONNECT\nconst oasSecuritySchemeOpenId = commonProps.extend({\n type: z.literal('openIdConnect'),\n /**\n * REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the\n * form of a URL. The OpenID Connect standard requires the use of TLS.\n */\n openIdConnectUrl: z.string().optional().default(''),\n})\n\nexport const securityOpenIdSchema = oasSecuritySchemeOpenId.merge(extendedSecuritySchema)\nexport type SecuritySchemaOpenId = z.infer<typeof securityOpenIdSchema>\n\n// ---------------------------------------------------------------------------\n\n/**\n * REQUIRED. The authorization URL to be used for this flow. This MUST be in\n * the form of a URL. The OAuth2 standard requires the use of TLS.\n */\nconst authorizationUrl = z.string().default('')\n\n/**\n * REQUIRED. The token URL to be used for this flow. This MUST be in the\n * form of a URL. The OAuth2 standard requires the use of TLS.\n */\nconst tokenUrl = z.string().default('')\n\n/** Common properties used across all oauth2 flows */\nconst flowsCommon = z.object({\n /**\n * The URL to be used for obtaining refresh tokens. This MUST be in the form of a\n * URL. The OAuth2 standard requires the use of TLS.\n */\n 'refreshUrl': z.string().optional().default(''),\n /**\n * REQUIRED. The available scopes for the OAuth2 security scheme. A map\n * between the scope name and a short description for it. The map MAY be empty.\n */\n 'scopes': z.record(z.string(), z.string().optional().default('')).optional().default({}).catch({}),\n 'selectedScopes': z.array(z.string()).optional().default([]),\n /** Extension to save the client Id associated with an oauth flow */\n 'x-scalar-client-id': z.string().optional().default(''),\n /** The auth token */\n 'token': z.string().default(''),\n /** Additional query parameters for the OAuth authorization request. Example: { prompt: 'consent', audience: 'scalar' }. */\n 'x-scalar-security-query': z.record(z.string(), z.string()).optional(),\n /** Additional body parameters for the OAuth token request. Example: { audience: 'foo' }. */\n 'x-scalar-security-body': z.record(z.string(), z.string()).optional(),\n /** Extension to specify custom token name in the response (defaults to 'access_token') */\n 'x-tokenName': z.string().optional(),\n})\n\n/** Setup a default redirect uri if we can */\nconst defaultRedirectUri = typeof window !== 'undefined' ? window.location.origin + window.location.pathname : ''\n\n/** Options for the x-usePkce extension */\nexport const pkceOptions = ['SHA-256', 'plain', 'no'] as const\n\nconst credentialsLocationExtension = z.enum(['header', 'body']).optional()\n\n/** Oauth2 security scheme */\nconst oasSecuritySchemeOauth2 = commonProps.extend({\n type: z.literal('oauth2'),\n /** The default scopes for the oauth flow */\n 'x-default-scopes': z.array(z.string()).optional(),\n /** REQUIRED. An object containing configuration information for the flow types supported. */\n flows: z\n .object({\n /** Configuration for the OAuth Implicit flow */\n implicit: flowsCommon.extend({\n 'type': z.literal('implicit').default('implicit'),\n authorizationUrl,\n 'x-scalar-redirect-uri': z.string().optional().default(defaultRedirectUri),\n }),\n /** Configuration for the OAuth Resource Owner Password flow */\n password: flowsCommon.extend({\n type: z.literal('password').default('password'),\n tokenUrl,\n clientSecret: z.string().default(''),\n username: z.string().default(''),\n password: z.string().default(''),\n 'x-scalar-credentials-location': credentialsLocationExtension,\n }),\n /** Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. */\n clientCredentials: flowsCommon.extend({\n type: z.literal('clientCredentials').default('clientCredentials'),\n tokenUrl,\n clientSecret: z.string().default(''),\n 'x-scalar-credentials-location': credentialsLocationExtension,\n }),\n /** Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.*/\n authorizationCode: flowsCommon.extend({\n 'type': z.literal('authorizationCode').default('authorizationCode'),\n authorizationUrl,\n 'x-usePkce': z.enum(pkceOptions).optional().default('no'),\n 'x-scalar-redirect-uri': z.string().optional().default(defaultRedirectUri),\n tokenUrl,\n clientSecret: z.string().default(''),\n 'x-scalar-credentials-location': credentialsLocationExtension,\n }),\n })\n .partial()\n .default({\n implicit: {\n selectedScopes: [],\n scopes: {},\n 'x-scalar-client-id': '',\n refreshUrl: '',\n token: '',\n type: 'implicit',\n authorizationUrl: 'http://localhost:8080',\n 'x-scalar-redirect-uri': defaultRedirectUri,\n },\n }),\n})\n\nexport const securityOauthSchema = oasSecuritySchemeOauth2.merge(extendedSecuritySchema)\n\nexport type SecuritySchemeOauth2 = z.infer<typeof securityOauthSchema>\nexport type SecuritySchemeOauth2Payload = z.input<typeof securityOauthSchema>\nexport type Oauth2Flow = NonNullable<\n SecuritySchemeOauth2['flows']['authorizationCode' | 'clientCredentials' | 'implicit' | 'password']\n>\n/** Payload for the oauth 2 flows + extensions */\nexport type Oauth2FlowPayload = NonNullable<SecuritySchemeOauth2Payload['flows']>[\n | 'authorizationCode'\n | 'clientCredentials'\n | 'implicit'\n | 'password'] &\n Record<`x-${string}`, string>\n\n// ---------------------------------------------------------------------------\n// Final Types\n\n/**\n * Security Requirement\n * Lists the required security schemes to execute this operation OR the whole collection/spec.\n * The name used for each property MUST correspond to a security scheme declared in the Security\n * Schemes under the Components Object.\n *\n * The key (name) here will be matched to the key of the securityScheme for linking\n *\n * @see https://spec.openapis.org/oas/latest.html#security-requirement-object\n */\nexport const oasSecurityRequirementSchema = z.record(z.string(), z.array(z.string()).optional().default([]))\n\n/** OAS Compliant security schemes */\nexport const oasSecuritySchemeSchema = z.union([\n oasSecuritySchemeApiKey,\n oasSecuritySchemeHttp,\n oasSecuritySchemeOauth2,\n oasSecuritySchemeOpenId,\n])\n\n/** Extended security schemes for workspace usage */\nexport const securitySchemeSchema = z\n .discriminatedUnion('type', [securityApiKeySchema, securityHttpSchema, securityOpenIdSchema, securityOauthSchema])\n .transform((data) => {\n // Set selected scopes from x-default-scopes\n if (data.type === 'oauth2' && data['x-default-scopes']?.length) {\n const keys = Object.keys(data.flows) as Array<keyof typeof data.flows>\n keys.forEach((key) => {\n if (data.flows[key]?.selectedScopes && data['x-default-scopes']) {\n data.flows[key].selectedScopes = [data['x-default-scopes']].flat()\n }\n })\n }\n return data\n })\n\n/**\n * Security Scheme Object\n *\n * @see https://spec.openapis.org/oas/latest.html#security-scheme-object\n */\nexport type SecurityScheme = z.infer<typeof securitySchemeSchema>\nexport type SecuritySchemePayload = z.input<typeof securitySchemeSchema>\n"],
5
- "mappings": "AAAA,SAAS,SAAS;AAElB,SAA6B,oB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;AAAA,MACzE;AAAA,MACA,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA,MACnC,iCAAiC;AAAA,IACnC,CAAC;AAAA,EACH,CAAC,EACA,QAAQ,EACR,QAAQ;AAAA,IACP,UAAU;AAAA,MACR,gBAAgB,CAAC;AAAA,MACjB,QAAQ,CAAC;AAAA,MACT,sBAAsB;AAAA,MACtB,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,MAAM;AAAA,MACN,kBAAkB;AAAA,MAClB,yBAAyB;AAAA,IAC3B;AAAA,EACF,CAAC;AACL,CAAC;AAEM,MAAM,sBAAsB,wBAAwB,MAAM,sBAAsB;AA4BhF,MAAM,+BAA+B,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGpG,MAAM,0BAA0B,EAAE,MAAM;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,MAAM,uBAAuB,EACjC,mBAAmB,QAAQ,CAAC,sBAAsB,oBAAoB,sBAAsB,mBAAmB,CAAC,EAChH,UAAU,CAAC,SAAS;AAEnB,MAAI,KAAK,SAAS,YAAY,KAAK,kBAAkB,GAAG,QAAQ;AAC9D,UAAM,OAAO,OAAO,KAAK,KAAK,KAAK;AACnC,SAAK,QAAQ,CAAC,QAAQ;AACpB,UAAI,KAAK,MAAM,GAAG,GAAG,kBAAkB,KAAK,kBAAkB,GAAG;AAC/D,aAAK,MAAM,GAAG,EAAE,iBAAiB,CAAC,KAAK,kBAAkB,CAAC,EAAE,KAAK;AAAA,MACnE;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO;AACT,CAAC;",
6
- "names": []
7
- }
package/dist/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * We should not use these exports anymore, but we need them for commonjs compatibility.\n */\n\n// biome-ignore lint/performance/noReExportAll: leave this to avoid copy exports\nexport * from './api-reference/index'\nexport { XScalarStability } from './legacy/index'\n"],
5
- "mappings": "AAKA,cAAc;AACd,SAAS,wBAAwB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/legacy/index.ts"],
4
- "sourcesContent": ["export type {\n ContentType,\n Heading,\n} from './reference-config'\nexport { XScalarStability } from './reference-config'\n"],
5
- "mappings": "AAIA,SAAS,wBAAwB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/legacy/reference-config.ts"],
4
- "sourcesContent": ["type OptionalCharset = string | null\n\nexport type ContentType =\n | `application/json${OptionalCharset}`\n | `application/xml${OptionalCharset}`\n | `text/plain${OptionalCharset}`\n | `text/html${OptionalCharset}`\n | `application/octet-stream${OptionalCharset}`\n | `application/x-www-form-urlencoded${OptionalCharset}`\n | `multipart/form-data${OptionalCharset}`\n | `*/*${OptionalCharset}`\n | `application/vnd.${string}+json${OptionalCharset}`\n\nexport enum XScalarStability {\n Deprecated = 'deprecated',\n Experimental = 'experimental',\n Stable = 'stable',\n}\n\nexport type Heading = {\n depth: number\n value: string\n slug?: string\n}\n"],
5
- "mappings": "AAaO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,gBAAa;AACb,EAAAA,kBAAA,kBAAe;AACf,EAAAA,kBAAA,YAAS;AAHC,SAAAA;AAAA,GAAA;",
6
- "names": ["XScalarStability"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/snippetz/index.ts"],
4
- "sourcesContent": ["export type {\n AvailableClient,\n AvailableClients,\n ClientId,\n FormDataParam,\n HarRequest,\n HarResponse,\n Plugin,\n PluginConfiguration,\n PostDataCommon,\n Target,\n TargetId,\n} from './snippetz'\nexport { AVAILABLE_CLIENTS, GROUPED_CLIENTS } from './snippetz'\n"],
5
- "mappings": "AAaA,SAAS,mBAAmB,uBAAuB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/snippetz/snippetz.ts"],
4
- "sourcesContent": ["import { objectEntries } from '@scalar/helpers/object/object-entries'\nimport type { Request as HarRequest } from 'har-format'\n\nexport type {\n Param as FormDataParam,\n PostDataCommon,\n Request as HarRequest,\n Response as HarResponse,\n} from 'har-format'\n\n/**\n * Maps programming languages and environments to their available HTTP clients.\n * Each key is a target (language/environment), and each value is an array of\n * client identifiers in the format `target/client`.\n *\n * This is the source of truth for all supported code generation targets.\n */\nexport const GROUPED_CLIENTS = {\n c: ['libcurl'],\n clojure: ['clj_http'],\n csharp: ['httpclient', 'restsharp'],\n dart: ['http'],\n fsharp: ['httpclient'],\n go: ['native'],\n http: ['http1.1'],\n java: ['asynchttp', 'nethttp', 'okhttp', 'unirest'],\n js: ['axios', 'fetch', 'jquery', 'ofetch', 'xhr'],\n kotlin: ['okhttp'],\n node: ['axios', 'fetch', 'ofetch', 'undici'],\n objc: ['nsurlsession'],\n ocaml: ['cohttp'],\n php: ['curl', 'guzzle'],\n powershell: ['restmethod', 'webrequest'],\n python: ['python3', 'requests', 'httpx_sync', 'httpx_async'],\n r: ['httr'],\n ruby: ['native'],\n rust: ['reqwest'],\n shell: ['curl', 'httpie', 'wget'],\n swift: ['nsurlsession'],\n} as const\n\n/**\n * Flat array of all available client identifiers.\n * Each identifier follows the format `target/client` (e.g., `js/fetch`, `python/requests`).\n */\nexport const AVAILABLE_CLIENTS = objectEntries(GROUPED_CLIENTS).flatMap(([group, clients]) =>\n clients.map((client) => `${group}/${client}` as const),\n)\n\n/**\n * All available client identifiers in array format\n * @example\n * ```typescript\n * const clients: AvailableClients = ['js/fetch', 'python/requests', 'shell/curl']\n * ```\n */\nexport type AvailableClients = typeof AVAILABLE_CLIENTS\n\n/**\n * A single available client identifier.\n * @example\n * ```typescript\n * const client: AvailableClient = 'js/fetch'\n * ```\n */\nexport type AvailableClient = AvailableClients[number]\n\n/**\n * A programming language or environment identifier.\n * @example\n * ```typescript\n * const targetId: TargetId = 'js'\n * ```\n */\nexport type TargetId = keyof typeof GROUPED_CLIENTS\n\n/**\n * Extracts the client name from a full client identifier for a given target.\n * For example, for target `js`, this extracts `fetch` from `js/fetch`.\n *\n * @template T - The target identifier (e.g., `js`, `python`)\n */\nexport type ClientId<T extends TargetId> = (typeof GROUPED_CLIENTS)[T][number]\n\n/**\n * Configuration for a specific target (language/environment).\n * Contains metadata about the target and its available clients.\n */\nexport type Target = {\n [K in TargetId]: {\n /** The unique identifier for this target. */\n key: K\n /** Human-readable name for the target. */\n title: string\n /** The default client to use for this target. */\n default: ClientId<K>\n /** All available client plugins for this target. */\n clients: Plugin[]\n }\n}[TargetId]\n\n/**\n * A code generation plugin for a specific HTTP client.\n * Each plugin knows how to convert an HTTP request into source code\n * for its target language and client library.\n */\nexport type Plugin = {\n /** The language or environment this plugin targets. */\n target: TargetId\n /** The identifier of the HTTP client within the target. */\n client: ClientId<TargetId>\n /** Human-readable name for the client. */\n title: string\n /** Generates source code for the given HTTP request. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration that can be passed to any code generation plugin.\n * Plugins may use this to customize the generated code.\n */\nexport type PluginConfiguration = {\n /** Credentials for HTTP Basic Authentication. */\n auth?: {\n username: string\n password: string\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,qBAAqB;AAiBvB,MAAM,kBAAkB;AAAA,EAC7B,GAAG,CAAC,SAAS;AAAA,EACb,SAAS,CAAC,UAAU;AAAA,EACpB,QAAQ,CAAC,cAAc,WAAW;AAAA,EAClC,MAAM,CAAC,MAAM;AAAA,EACb,QAAQ,CAAC,YAAY;AAAA,EACrB,IAAI,CAAC,QAAQ;AAAA,EACb,MAAM,CAAC,SAAS;AAAA,EAChB,MAAM,CAAC,aAAa,WAAW,UAAU,SAAS;AAAA,EAClD,IAAI,CAAC,SAAS,SAAS,UAAU,UAAU,KAAK;AAAA,EAChD,QAAQ,CAAC,QAAQ;AAAA,EACjB,MAAM,CAAC,SAAS,SAAS,UAAU,QAAQ;AAAA,EAC3C,MAAM,CAAC,cAAc;AAAA,EACrB,OAAO,CAAC,QAAQ;AAAA,EAChB,KAAK,CAAC,QAAQ,QAAQ;AAAA,EACtB,YAAY,CAAC,cAAc,YAAY;AAAA,EACvC,QAAQ,CAAC,WAAW,YAAY,cAAc,aAAa;AAAA,EAC3D,GAAG,CAAC,MAAM;AAAA,EACV,MAAM,CAAC,QAAQ;AAAA,EACf,MAAM,CAAC,SAAS;AAAA,EAChB,OAAO,CAAC,QAAQ,UAAU,MAAM;AAAA,EAChC,OAAO,CAAC,cAAc;AACxB;AAMO,MAAM,oBAAoB,cAAc,eAAe,EAAE;AAAA,EAAQ,CAAC,CAAC,OAAO,OAAO,MACtF,QAAQ,IAAI,CAAC,WAAW,GAAG,KAAK,IAAI,MAAM,EAAW;AACvD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/snippetz/snippetz.test-d.ts"],
4
- "sourcesContent": ["import { assertType, describe, it } from 'vitest'\n\nimport type { ClientId, TargetId } from './index'\n\ndescribe('TargetId', () => {\n it('has node as a target', () => {\n const target = 'node'\n\n assertType<TargetId>(target)\n })\n\n it(`target doesn't exist`, () => {\n const target = 'foo'\n\n // @ts-expect-error target doesn't exist\n assertType<TargetId>(target)\n })\n\n it('has undici as a client', () => {\n const client = 'undici'\n\n assertType<ClientId<'node'>>(client)\n })\n\n it(`client doesn't exist`, () => {\n const client = 'does-not-exist'\n\n // @ts-expect-error client doesn't exist\n assertType<ClientId<'node'>>(client)\n })\n\n it(`client exists, but target doesn't`, () => {\n const client = 'undici'\n\n // @ts-expect-error client exists, but target doesn't\n assertType<ClientId<'foobar'>>(client)\n })\n\n it('client does exist, but not for the given target', () => {\n const client = 'undici'\n\n // @ts-expect-error client does exist, but not for the given target\n assertType<ClientId<'shell'>>(client)\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,YAAY,UAAU,UAAU;AAIzC,SAAS,YAAY,MAAM;AACzB,KAAG,wBAAwB,MAAM;AAC/B,UAAM,SAAS;AAEf,eAAqB,MAAM;AAAA,EAC7B,CAAC;AAED,KAAG,wBAAwB,MAAM;AAC/B,UAAM,SAAS;AAGf,eAAqB,MAAM;AAAA,EAC7B,CAAC;AAED,KAAG,0BAA0B,MAAM;AACjC,UAAM,SAAS;AAEf,eAA6B,MAAM;AAAA,EACrC,CAAC;AAED,KAAG,wBAAwB,MAAM;AAC/B,UAAM,SAAS;AAGf,eAA6B,MAAM;AAAA,EACrC,CAAC;AAED,KAAG,qCAAqC,MAAM;AAC5C,UAAM,SAAS;AAGf,eAA+B,MAAM;AAAA,EACvC,CAAC;AAED,KAAG,mDAAmD,MAAM;AAC1D,UAAM,SAAS;AAGf,eAA8B,MAAM;AAAA,EACtC,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/index.ts"],
4
- "sourcesContent": ["export type { ENTITY_BRANDS } from './nanoid'\nexport { nanoidSchema } from './nanoid'\nexport type { UnknownObject } from './utility-types'\n"],
5
- "mappings": "AACA,SAAS,oBAAoB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/nanoid.ts"],
4
- "sourcesContent": ["import { nanoid } from 'nanoid'\nimport { z } from 'zod'\n\n/** Generates a default value */\nexport const nanoidSchema = z\n .string()\n .min(7)\n .default(() => nanoid())\n\n/** UID format for objects */\nexport type Nanoid = z.infer<typeof nanoidSchema>\n\n/** All of our Zod brands for entities, used to brand nanoidSchemas. */\nexport type ENTITY_BRANDS = {\n COLLECTION: 'collection'\n COOKIE: 'cookie'\n ENVIRONMENT: 'environment'\n EXAMPLE: 'example'\n OPERATION: 'operation'\n SECURITY_SCHEME: 'securityScheme'\n SERVER: 'server'\n TAG: 'tag'\n WORKSPACE: 'workspace'\n}\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,SAAS;AAGX,MAAM,eAAe,EACzB,OAAO,EACP,IAAI,CAAC,EACL,QAAQ,MAAM,OAAO,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }