@scalar/types 0.3.1 → 0.3.2
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 +2 -2
- package/dist/api-reference/api-client-plugin.d.ts +4 -4
- package/dist/api-reference/api-client-plugin.d.ts.map +1 -1
- package/dist/api-reference/api-client-plugin.js +6 -4
- package/dist/api-reference/api-client-plugin.js.map +2 -2
- package/dist/api-reference/api-reference-configuration.d.ts.map +1 -1
- package/dist/api-reference/api-reference-configuration.js +21 -7
- package/dist/api-reference/api-reference-configuration.js.map +2 -2
- package/dist/api-reference/authentication-configuration.d.ts +1 -1
- package/dist/api-reference/authentication-configuration.d.ts.map +1 -1
- package/dist/api-reference/base-configuration.d.ts +2 -2
- package/dist/snippetz/snippetz.d.ts +1 -1
- package/dist/snippetz/snippetz.d.ts.map +1 -1
- package/dist/snippetz/snippetz.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -101,11 +101,11 @@ export declare const apiClientConfigurationSchema: z.ZodObject<{
|
|
|
101
101
|
hooks: z.ZodOptional<z.ZodObject<{
|
|
102
102
|
onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
103
103
|
request: z.ZodCustom<Request, Request>;
|
|
104
|
-
}, z.core.$strip>], null>, z.
|
|
104
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
105
105
|
onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
106
106
|
response: z.ZodCustom<Response, Response>;
|
|
107
107
|
operation: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
108
|
-
}, z.core.$strip>], null>, z.
|
|
108
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
109
109
|
}, z.core.$strip>>;
|
|
110
110
|
}, z.core.$strip>>>>;
|
|
111
111
|
telemetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -2,11 +2,11 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const hooksSchema: z.ZodObject<{
|
|
3
3
|
onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
4
4
|
request: z.ZodCustom<Request, Request>;
|
|
5
|
-
}, z.core.$strip>], null>, z.
|
|
5
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
6
6
|
onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
7
7
|
response: z.ZodCustom<Response, Response>;
|
|
8
8
|
operation: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
9
|
-
}, z.core.$strip>], null>, z.
|
|
9
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
11
|
/**
|
|
12
12
|
* An API client plugin that can connect into request and response hooks
|
|
@@ -28,11 +28,11 @@ export declare const apiClientPluginSchema: z.ZodFunction<z.ZodTuple<readonly []
|
|
|
28
28
|
hooks: z.ZodOptional<z.ZodObject<{
|
|
29
29
|
onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
30
30
|
request: z.ZodCustom<Request, Request>;
|
|
31
|
-
}, z.core.$strip>], null>, z.
|
|
31
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
32
32
|
onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
33
33
|
response: z.ZodCustom<Response, Response>;
|
|
34
34
|
operation: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
35
|
-
}, z.core.$strip>], null>, z.
|
|
35
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
}, z.core.$strip>>;
|
|
38
38
|
export type ApiClientPlugin = z.infer<typeof apiClientPluginSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;
|
|
1
|
+
{"version":3,"file":"api-client-plugin.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-client-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAcvB,eAAO,MAAM,WAAW;;;;;;;;iBAetB,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;kBAOhC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
|
@@ -11,12 +11,14 @@ const viewsSchema = z.object({
|
|
|
11
11
|
});
|
|
12
12
|
const hooksSchema = z.object({
|
|
13
13
|
onBeforeRequest: z.function({
|
|
14
|
-
input: [z.object({ request: z.instanceof(Request) })]
|
|
15
|
-
output
|
|
14
|
+
input: [z.object({ request: z.instanceof(Request) })]
|
|
15
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
16
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
16
17
|
}).optional(),
|
|
17
18
|
onResponseReceived: z.function({
|
|
18
|
-
input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })]
|
|
19
|
-
output
|
|
19
|
+
input: [z.object({ response: z.instanceof(Response), operation: z.record(z.string(), z.any()) })]
|
|
20
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
21
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
20
22
|
}).optional()
|
|
21
23
|
});
|
|
22
24
|
const apiClientPluginSchema = z.function({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 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 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
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-reference-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/api-reference-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIrC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAEjF,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,wBAAwB,CAAA;AAK5F;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAZH,MAAM,GAAG,GAAG,GAAG,OAAO,SAAS,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,UAAhE,MAAM,GAAG,GAAG,GAAG,OAAO,SAAS,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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CAAC,GACrD,OAAO,CAAC,oCAAoC,CAAC,EAAE,GAC/C,OAAO,CAAC,4CAA4C,CAAC,EAAE,CAAA;AAE3D,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,GACrC,QAAQ,4BAA4B,KACnC,MAAM,IAAI,OAAO,CAAC,4CAA4C,CACkC,CAAA"}
|
|
@@ -110,26 +110,40 @@ const apiReferenceConfigurationSchema = baseConfigurationSchema.extend({
|
|
|
110
110
|
output: z.void()
|
|
111
111
|
}).optional(),
|
|
112
112
|
/** onDocumentSelect is fired when the config is selected */
|
|
113
|
-
onDocumentSelect: z.function(
|
|
113
|
+
onDocumentSelect: z.function({
|
|
114
|
+
input: []
|
|
115
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
116
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
117
|
+
}).optional(),
|
|
114
118
|
/** Callback fired when the reference is fully loaded */
|
|
115
|
-
onLoaded: z.function(
|
|
119
|
+
onLoaded: z.function({
|
|
120
|
+
input: []
|
|
121
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
122
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
123
|
+
}).optional(),
|
|
116
124
|
/** onBeforeRequest is fired before the request is sent. You can modify the request here. */
|
|
117
|
-
onBeforeRequest: z.function({
|
|
125
|
+
onBeforeRequest: z.function({
|
|
126
|
+
input: [z.object({ request: z.instanceof(Request) })]
|
|
127
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
128
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
129
|
+
}).optional(),
|
|
118
130
|
/**
|
|
119
131
|
* onShowMore is fired when the user clicks the "Show more" button on the references
|
|
120
132
|
* @param tagId - The ID of the tag that was clicked
|
|
121
133
|
*/
|
|
122
134
|
onShowMore: z.function({
|
|
123
|
-
input: [z.string()]
|
|
124
|
-
output
|
|
135
|
+
input: [z.string()]
|
|
136
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
137
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
125
138
|
}).optional(),
|
|
126
139
|
/**
|
|
127
140
|
* onSidebarClick is fired when the user clicks on a sidebar item
|
|
128
141
|
* @param href - The href of the sidebar item that was clicked
|
|
129
142
|
*/
|
|
130
143
|
onSidebarClick: z.function({
|
|
131
|
-
input: [z.string()]
|
|
132
|
-
output
|
|
144
|
+
input: [z.string()]
|
|
145
|
+
// Why no output? https://github.com/scalar/scalar/pull/7047
|
|
146
|
+
// output: z.union([z.void(), z.promise(z.void())]),
|
|
133
147
|
}).optional(),
|
|
134
148
|
/**
|
|
135
149
|
* Route using paths instead of hashes, your server MUST support this
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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.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,EAK7D,WAAW,EAAE,QAAQ,EAAE,SAAS,E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O,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,IAAI,CAAC,CAAC,EAC/G,SAAS;AAAA;AAAA,EAEZ,mBAAmB,EAChB,OAAO;AAAA,IACN,WAAW,EAAE,OAAiB;AAAA,IAC9B,WAAW,EAAE,OAAO;AAAA,EACtB,CAAC,EACA,SAAS;AAAA;AAAA,EAEZ,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAE/B,cAAc,EACX,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,CAAC;AAAA,IAClB,QAAQ,EAAE,KAAK;AAAA,EACjB,CAAC,EACA,SAAS;AAAA;AAAA,EAEZ,gBAAgB,EACb,SAAS;AAAA,IACR,OAAO,CAAC,EAAE,OAAO,CAAC;AAAA,IAClB,QAAQ,EAAE,KAAK;AAAA,EACjB,CAAC,EACA,SAAS;AAAA;AAAA,EAEZ,kBAAkB,
|
|
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\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 /** 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 * 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,Q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;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;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,5 +1,5 @@
|
|
|
1
|
+
import type { PartialDeep } from 'type-fest';
|
|
1
2
|
import type { SecurityScheme } from '../entities/security-scheme.js';
|
|
2
|
-
import type { PartialDeep } from 'type-fest/source/partial-deep';
|
|
3
3
|
/**
|
|
4
4
|
* Authentication configuration for the API reference.
|
|
5
5
|
* This config is not validated so does not need a zod schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/authentication-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"authentication-configuration.d.ts","sourceRoot":"","sources":["../../src/api-reference/authentication-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEjE;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,CAAA;IAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,CAAA;CAC9D,CAAA"}
|
|
@@ -106,11 +106,11 @@ export declare const baseConfigurationSchema: z.ZodObject<{
|
|
|
106
106
|
hooks: z.ZodOptional<z.ZodObject<{
|
|
107
107
|
onBeforeRequest: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
108
108
|
request: z.ZodCustom<Request, Request>;
|
|
109
|
-
}, z.core.$strip>], null>, z.
|
|
109
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
110
110
|
onResponseReceived: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
111
111
|
response: z.ZodCustom<Response, Response>;
|
|
112
112
|
operation: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
113
|
-
}, z.core.$strip>], null>, z.
|
|
113
|
+
}, z.core.$strip>], null>, z.core.$ZodFunctionOut>>;
|
|
114
114
|
}, z.core.$strip>>;
|
|
115
115
|
}, z.core.$strip>>>>;
|
|
116
116
|
telemetry: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Request as HarRequest } from 'har-format';
|
|
2
|
-
import type { Writable } from 'type-fest
|
|
2
|
+
import type { Writable } from 'type-fest';
|
|
3
3
|
export type { Param as FormDataParam, Request as HarRequest } from 'har-format';
|
|
4
4
|
/**
|
|
5
5
|
* List of available clients
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../../src/snippetz/snippetz.ts"],"names":[],"mappings":"AAAA,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M,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAAC,SAAS,GAAG,CAAC,IAAI,MAAM,CAAC,EAAE,GAC3E,CAAC,GACD,KAAK,GACP,KAAK,CAAA;AAET,uCAAuC;AACvC,MAAM,MAAM,MAAM,GAAG;IACnB,mCAAmC;IACnC,MAAM,EAAE,QAAQ,CAAA;IAChB,oCAAoC;IACpC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC1B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,8BAA8B;IAC9B,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,EAAE,mBAAmB,KAAK,MAAM,CAAA;CACzF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,mDAAmD;IACnD,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9C,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/snippetz/snippetz.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Request as HarRequest } from 'har-format'\nimport type { Writable } from 'type-fest
|
|
4
|
+
"sourcesContent": ["import type { Request as HarRequest } from 'har-format'\nimport type { Writable } from 'type-fest'\n\nexport type { Param as FormDataParam, Request as HarRequest } from 'har-format'\n\n/**\n * List of available clients\n */\nexport const AVAILABLE_CLIENTS = [\n 'c/libcurl',\n 'clojure/clj_http',\n 'csharp/httpclient',\n 'csharp/restsharp',\n 'dart/http',\n 'fsharp/httpclient',\n 'go/native',\n 'http/http1.1',\n 'java/asynchttp',\n 'java/nethttp',\n 'java/okhttp',\n 'java/unirest',\n 'js/axios',\n 'js/fetch',\n 'js/jquery',\n 'js/ofetch',\n 'js/xhr',\n 'kotlin/okhttp',\n 'node/axios',\n 'node/fetch',\n 'node/ofetch',\n 'node/undici',\n 'objc/nsurlsession',\n 'ocaml/cohttp',\n 'php/curl',\n 'php/guzzle',\n 'powershell/restmethod',\n 'powershell/webrequest',\n 'python/python3',\n 'python/requests',\n 'python/httpx_sync',\n 'python/httpx_async',\n 'r/httr',\n 'ruby/native',\n 'rust/reqwest',\n 'shell/curl',\n 'shell/httpie',\n 'shell/wget',\n 'swift/nsurlsession',\n] as const\n\n/** Non read only tuple of available clients */\nexport type AvailableClients = Writable<typeof AVAILABLE_CLIENTS>\n/** A union for a single available client */\nexport type AvailableClient = AvailableClients[number]\n/** A non read only array of available clients */\nexport type AvailableClientsArray = AvailableClients[number][]\n\n/** Programming language */\nexport type TargetId = AvailableClients[number] extends `${infer T}/${string}` ? T : never\n\n/** Configuration for a target */\nexport type Target = {\n [K in TargetId]: {\n key: K\n title: string\n default: ClientId<K>\n clients: Plugin[]\n }\n}[TargetId]\n\n/** HTTP client */\nexport type ClientId<T extends string> = T extends TargetId\n ? Extract<AvailableClients[number], `${T}/${string}`> extends `${T}/${infer C}`\n ? C\n : never\n : never\n\n/** What any plugins needs to return */\nexport type Plugin = {\n /** The language or environment. */\n target: TargetId\n /** The identifier of the client. */\n client: ClientId<TargetId>\n /** The title of the client. */\n title: string\n /** The actual source code. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration for any plugin\n */\nexport type PluginConfiguration = {\n /** Credentials to add HTTP Basic Authentication */\n auth?: { username: string; password: string }\n}\n"],
|
|
5
5
|
"mappings": "AAQO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scalar",
|
|
17
17
|
"references"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.3.
|
|
19
|
+
"version": "0.3.2",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=20"
|
|
22
22
|
},
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"nanoid": "5.1.5",
|
|
68
|
-
"type-fest": "
|
|
68
|
+
"type-fest": "5.0.0",
|
|
69
69
|
"zod": "4.1.11",
|
|
70
|
-
"@scalar/openapi-types": "0.
|
|
70
|
+
"@scalar/openapi-types": "0.5.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/har-format": "^1.2.15",
|