fumadocs-openapi 12.1.0 → 12.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/generated/shared.css +1 -1
- package/dist/.translations/index.d.ts +1 -0
- package/dist/.translations/keys.js +1 -0
- package/dist/playground/auth.d.ts +8 -2
- package/dist/playground/auth.js +51 -44
- package/dist/ui/playground/client.js +1 -1
- package/dist/ui/playground/components/oauth-dialog.js +8 -8
- package/dist/ui/playground/components/result-display.js +39 -16
- package/package.json +3 -3
package/css/generated/shared.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@source inline("!isDefined *:data-[collapsible=true]:order-last *:min-w-0 --- --accordion-panel-height --anchor-width --available-height --available-width --collapsible-panel-height --fd-docs-row-1 --min-height --spacing --transform-origin -mode -ms-2 -mx-3 -translate-x-1/2 -translate-y-1/2 @4xl:flex-row @4xl:items-start @4xl:sticky @4xl:top-[calc(var(--fd-docs-row-1,2rem)+1rem)] @4xl:w-[400px] @container @default @fuma-translate/react @fumadocs/json-schema @fumari/stf @md:grid-cols-2 @param @private @returns @scalar/api-client-react @see @typescript-eslint/no-explicit-any [&[hidden]:not([hidden='until-found'])]:hidden [&_svg]:size-3.5 a absolute accept access access_token accordion actual adapter adapters additionalProperties again against alias align allFlows allOf allow already alt always an anchor anchorIdStartsWith anchorSegments and animate-spin anyFields anyOf apiExample apiKey apiPlayground applicable application/javascript application/json application/x-javascript application/x-www-form-urlencoded application/xml apply are aria-label aria-live arkdown array as asSchema async at audience auth auth-specific authCodeQuery authNode authSchemes authorization authorizationCode authorizationUrl authorization_code authorize authorizes autoComplete avoid await back backdrop-blur-lg backdrop-blur-sm badgeVariants base baseDir basic be because before behavior belong bg-black/30 bg-fd-background/50 bg-fd-card bg-fd-muted bg-fd-popover bg-fd-popover/60 bg-fd-primary bg-fd-primary/10 bg-fd-secondary bg-transparent binary blob block blocks blue body bodyMediaType bodyNode boolean border border-0 border-b border-current border-fd-primary/20 border-s border-t border-y bottom break-all buffer built-in bundled button buttonVariants by byteLength bytes cache cached cachedDocFiles callbacks callbacksNode can cannot case catch center change charset children class-variance-authority className cleanup client clientAuth clientAuthMethods clientCredentials clientHeight clientId clientSecret client_auth client_credentials client_error client_id client_secret cloned closed cn code codeProps codeUsages codeblock col-span-full collapsible color compiler components configuration const content contentType contentTypes cookie cookies copying core createContext createOAuthHandler createOpenAPIPageBase createProxy credentials css csv ctx current currentValue custom customise customization cva dark dark:text-blue-400 dark:text-green-400 dark:text-orange-400 dark:text-red-400 dark:text-yellow-400 data data-[closed]:animate-fd-popover-out data-[disabled]:opacity-50 data-[disabled]:pointer-events-none data-[highlighted]:bg-fd-accent data-[highlighted]:text-fd-accent-foreground data-[open]:animate-fd-popover-in data-[open]:border-b-0 data-[popup-open]:text-fd-accent-foreground data-closed:animate-fd-dialog-out data-closed:animate-fd-fade-out data-collapsible data-ending-style:h-0 data-ending-style:opacity-0 data-object-search-input data-open:animate-fd-dialog-in data-open:animate-fd-fade-in data-placeholder:text-fd-muted-foreground data-starting-style:h-0 data-starting-style:opacity-0 data-type dataEngine decoded default defaultMdxComponents defaultOpen defaultShikiFactory defaultShikiOptions defaultValue defaultValues defaults deferredValue define definitions delete deprecated depth dereference dereferenced description descriptionNode development deviceAuthorization dialog didn disable disableCache disabled disabled:cursor-not-allowed disabled:opacity-50 display displayNames div do doc docCache docFilesCache docRoot docs document documents domain downloaded drives duplicated duration-200 during dynamic dynamicSource e eading ease-out element else empty empty:hidden enabled encode encodeRequestData encoded end end-2 endpoint enforce engine ensure entries entry enum error eslint-disable eslint-disable-next-line example exampleId examples export exported extends fallback false fast-content-type-parse fd-page-tree-item-name fd-scroll-container fetch fetcher field fieldData fieldLabelVariants fieldName fields file filePath files filtered fine first first:border-t-0 firstItemRef fixed flex flex-1 flex-col flex-col-reverse flex-row flex-wrap flow flows focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring focus-within:[&_svg]:text-fd-primary focus-within:ring focus-within:ring-2 focus-within:ring-fd-ring focus:outline-none focus:ring focus:ring-0 focus:ring-fd-ring folder folderStyle font-medium font-mono font-normal font-semibold for form form-encoded formData format fragment from fs full fumadocs-core/source fumadocs-core/toc fumadocs-openapi-oauth fumadocs-ui/mdx fumadocs:openapi fumadocs_openapi_requests fumadocs_openapi_responses function gap-0.5 gap-1 gap-1.5 gap-2 gap-2.5 gap-24 gap-3 gap-4 gap-6 gap-x-4 gap-x-6 gap-y-1 gap-y-4 generate generateDefault generateSchemaUI generated get getOpenAPIPageProps getSchema getSchemas getWatchPaths ghost github-dark github-light given go grant_type gray green grid grid-cols-1 grid-cols-[auto_1fr] group group-data-[panel-open]/accordion:rotate-90 group-data-[panel-open]:rotate-180 group/accordion groupId h-(--accordion-panel-height) h-(--collapsible-panel-height) h-10 h-9 h-[240px] h-px h1 hash hast-util-to-jsx-runtime have headNode header headers heading headingLevel headless hidden hiddenProperties highlighted highlighter holding hook hover:bg-fd-accent hover:text-fd-accent-foreground hover:underline how href html htmlFor http hydration i icon icon-sm icon-xs id idx if ignore img implicit import imports in in-popover index indexItemMatch info infoTags init initial inline-flex input inputs inset-0 inside installed instanceof instead integer interface internal into invalid is isDefined isDuplicated isDynamic isLazy isLoading isMounted isNumber isRequired issues it item items items-center items-start its j js json json-schema-typed justify-between justify-center keep key keyed keyof kind label labelClassName lang last last:border-b-0 last:mb-0 lazy leading-none leave left left-1/2 length let light like line-through link links list list-disc list-inside listed load loadDocument loaderPlugin localStorage location lucide-react map mapValues marker:text-fd-muted-foreground matching max-age max-h-(--available-height) max-h-[460px] max-w-(--available-width) max-w-[98vw] max-w-full max-w-lg may mb-1 mb-2 mb-auto md mdxComponents me-auto media mediaAdapters mediaType member merge mergeRefs message meta metaData method methods mime min-h-(--min-height,200px) min-w-0 min-w-[240px] min-w-[calc(var(--anchor-width)+--spacing(2))] modify mounted ms-auto mt-0! mt-10 mt-2 mt-3 multipart/form-data multiple must mx-1 my-0! my-1 my-1.5 my-2 my-2! my-4 name name! named namespace navigating navigation needs nested never new no no-cache node node:fs node:path noop normalizes not not-last:pb-0 not-prose note null number oauth2 oauthRedirectUrl object objectSearchOverrides objectSet objects of off omit on onChange onClick onCopy onKeyDown onOpenChange onScrollEnd onSubmit onValueChange one oneOf ones only opacity-80 open openApiData openIdConnect openapi openapiMeta opened opens operation options or orange order-last origin origin-(--transform-origin) other out outline outline-none output over overflow-auto overflow-hidden overflow-x-auto overflow-y-auto overflow-y-hidden p-1 p-1.5 p-2 p-3 p-4 packages page pageData pages panelVariants param parameter parameterLabel parameterNode parameters params parent parentPathIndex parents parsed part parts party pass password path pathIndex pathItem pathName pathnameFromRequest pattern patternProperties payload pb-0 pb-2 pe-2 pe-3 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 pending pendingFlowKey persist persisted picked place placeholder placeholder:text-fd-muted-foreground playground playgrounds please plugins polite popover popoverRef positions pre preloadOpenAPIPage preloaded preventScroll previous primitive processor properties property props prose prose-no-margin prose-sm proxy proxyForwardCookie proxyUrl ps-1 ps-2 ps-3 ps-4.5 ps-6 pt-0 pt-1 pt-2 pt-2.5 px px-1 px-2 px-3 px-4 py-0 py-0.5 py-1 py-1.5 py-2 py-4 query querySelector quiet random raw rawSearch re-triggering react react-hooks/exhaustive-deps react/jsx-runtime read readOnly readonly record red redirect redirectUrl redirect_uri ref reference refs regenerated rehype-react relative relativePath remark remark-rehype remarkGfm remarkRehype remove removeItem removing render renderBodyField renderCodeblock renderMarkdown renderParameterField renderPopoverTrigger renderTrigger rendered renderers renders replace represents request request-body requestBody requestData requestInit requestTimeout requestUrl requests required requirement requirements res reset resize-none resolve resolveMediaAdapter resolveUrl resolved resolvedInput resolvedTheme response response-body responseNode responseTabs response_type responses rest restored result return returning returns role root rootId roots rotate-90 rounded-2xl rounded-b-none rounded-lg rounded-md rounded-sm rounded-t-md rounded-xl route s-highlight safeParse same satisfies scalar scan schema schemaId schemaPropKeys schemaUI scheme schemeId schemes scope scopes scroll scroll-m-20 scrollTop scrollTops search secondary seconds secret section sections security see segments segs select select-none selected selectedType selections selector send sends sep separator server server-to-server serverSchema serverUrl services sessionStorage set setClientAuth setError setInfo setIsJson setNextName setObjectUrl setOpen setPath setSearch setSelected setServerVariables setShow setStore setToken setType setValue shadow-lg shadow-md shadow-sm shared shiki shikiOptions show showDescription showExample showResponseSchema showSelect showTitle showing shrink-0 side sideOffset signal single size size-3.5 size-4 skipNonRequired skipReadOnly slot slotType slots sm sm:flex-row sm:gap-2 sm:justify-end sm:text-start smooth so some sr-only src stable start started state staticSource status statusInfo step stf stfSync sticky still storageKey store stored string stringify stringifyFieldKey structuredData styles submit such supported svg switch t tab tabDepth tabValues tabs tag target testQuery text text-[0.8125rem] text-blue-600 text-center text-end text-fd-card-foreground text-fd-foreground text-fd-muted-foreground text-fd-muted-foreground/70 text-fd-popover-foreground text-fd-primary text-fd-primary-foreground text-fd-secondary-foreground text-green-500 text-green-600 text-lg text-nowrap text-orange-400 text-orange-600 text-red-400 text-red-400/80 text-red-500 text-red-600 text-sm text-start text-xs text-yellow-600 text/css text/csv text/html text/plain that the their them themes they this through throw timeout timerRef tips title to toJsxRuntime toStaticData toc token tokenInfo tokenUrl token_type token_url toolbar top top-0 top-1/2 top-10 top-2 tracking-tight transform transformPageTree transition-[height,opacity] transition-[height] transition-colors transition-transform translations tree trigger true truncate try ts type typeVariants typeof types unchanged undefined under underline unexpected union unionField unions unknown unlisted unselected up update updateInfo updated updatedSchemeId updating url usageTabs use useAnchorId useApiClient useComponents useCopyButton useFieldValue useListener useMemo useNamespace useObject useOnChange useOpenAPI useOperation usePlaygroundAuth useQuery useRef useRenderContext useResponseExamples useServer useState useStatusInfo useStf useSyncExternalStore useTheme useTranslations useTypeScriptDefinitions used username users using utf-8 v value valueSchema values variable variables variant variants via view virtual void w-0 w-14 w-[600px] w-fit w-full warn was we webhook webhooks when where will with without won wrap-break-word wrapping write writeOnly x-exclusiveCodeSample x-playground-lazy xml yellow you your z-20 z-50");
|
|
1
|
+
@source inline("!isDefined *:data-[collapsible=true]:order-last *:min-w-0 --- --accordion-panel-height --anchor-width --available-height --available-width --collapsible-panel-height --fd-docs-row-1 --min-height --spacing --transform-origin -mode -ms-2 -mx-3 -translate-x-1/2 -translate-y-1/2 @4xl:flex-row @4xl:items-start @4xl:sticky @4xl:top-[calc(var(--fd-docs-row-1,2rem)+1rem)] @4xl:w-[400px] @container @default @fuma-translate/react @fumadocs/json-schema @fumari/stf @md:grid-cols-2 @param @private @returns @scalar/api-client-react @see @typescript-eslint/no-explicit-any [&[hidden]:not([hidden='until-found'])]:hidden [&_svg]:size-3.5 a absolute accept access access_token accordion actual adapter adapters additionalProperties again against alias align allFlows allOf allow already alt always an anchor anchorIdStartsWith anchorSegments and animate-spin anyFields anyOf apiExample apiKey apiPlayground applicable application/javascript application/json application/x-javascript application/x-www-form-urlencoded application/xml applies apply are aria-label aria-live arkdown array as asSchema async at audience auth auth-specific authCodeQuery authNode authSchemes authorization authorizationCode authorizationUrl authorization_code authorize authorizes autoComplete avoid await back backdrop-blur-lg backdrop-blur-sm badgeVariants base baseDir basic be because before behavior belong bg-black/30 bg-fd-background/50 bg-fd-card bg-fd-muted bg-fd-popover bg-fd-popover/60 bg-fd-primary bg-fd-primary/10 bg-fd-secondary bg-transparent binary block blocks blue body bodyMediaType bodyNode boolean border border-0 border-b border-current border-fd-primary/20 border-s border-t border-y bottom break-all built-in bundled button buttonVariants by byteLength bytes cache cached cachedDocFiles callbacks callbacksNode can cannot case catch center change charset children class-variance-authority className cleanup client clientAuth clientAuthMethods clientCredentials clientHeight clientId clientSecret client_auth client_credentials client_error client_id client_secret cloned closed cn code codeProps codeUsages codeblock col-span-full collapsible color compiler components configuration const content contentType contentTypes cookie cookies copying core createContext createOAuthHandler createOpenAPIPageBase createProxy credentials css csv ctx current currentValue custom customise customization cva dark dark:text-blue-400 dark:text-green-400 dark:text-orange-400 dark:text-red-400 dark:text-yellow-400 data data-[closed]:animate-fd-popover-out data-[disabled]:opacity-50 data-[disabled]:pointer-events-none data-[highlighted]:bg-fd-accent data-[highlighted]:text-fd-accent-foreground data-[open]:animate-fd-popover-in data-[open]:border-b-0 data-[popup-open]:text-fd-accent-foreground data-closed:animate-fd-dialog-out data-closed:animate-fd-fade-out data-collapsible data-ending-style:h-0 data-ending-style:opacity-0 data-object-search-input data-open:animate-fd-dialog-in data-open:animate-fd-fade-in data-placeholder:text-fd-muted-foreground data-starting-style:h-0 data-starting-style:opacity-0 data-type dataEngine decoded default defaultMdxComponents defaultOpen defaultShikiFactory defaultShikiOptions defaultValue defaultValues defaults deferredValue define definitions delete deprecated depth dereference dereferenced description descriptionNode development deviceAuthorization dialog didn disable disableCache disabled disabled:cursor-not-allowed disabled:opacity-50 display displayNames disposition div do doc docCache docFilesCache docRoot docs document documents domain download downloaded drives duplicated duration-200 during dynamic dynamicSource e eading ease-out element else empty empty:hidden enabled encode encodeRequestData encoded end end-2 endpoint enforce engine ensure entries entry enum error eslint-disable eslint-disable-next-line example exampleId examples export exported extended extends fallback false fast-content-type-parse fd-page-tree-item-name fd-scroll-container fetch fetcher field fieldData fieldLabelVariants fieldName fields file filePath files filtered fine first first:border-t-0 firstItemRef fixed flex flex-1 flex-col flex-col-reverse flex-row flex-wrap flow flows focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring focus-within:[&_svg]:text-fd-primary focus-within:ring focus-within:ring-2 focus-within:ring-fd-ring focus:outline-none focus:ring focus:ring-0 focus:ring-fd-ring folder folderStyle font-medium font-mono font-normal font-semibold for form form-encoded formData format fragment from fs full fumadocs-core/source fumadocs-core/toc fumadocs-openapi-oauth fumadocs-ui/mdx fumadocs:openapi fumadocs_openapi_requests fumadocs_openapi_responses function gap-0.5 gap-1 gap-1.5 gap-2 gap-2.5 gap-24 gap-3 gap-4 gap-6 gap-x-4 gap-x-6 gap-y-1 gap-y-4 generate generateDefault generateSchemaUI generated get getOpenAPIPageProps getSchema getSchemas getWatchPaths ghost github-dark github-light given go goes grant_type gray green grid grid-cols-1 grid-cols-[auto_1fr] group group-data-[panel-open]/accordion:rotate-90 group-data-[panel-open]:rotate-180 group/accordion groupId h-(--accordion-panel-height) h-(--collapsible-panel-height) h-10 h-9 h-[240px] h-px h1 hash hast-util-to-jsx-runtime have headNode header headers heading headingLevel headless hidden hiddenProperties highlighted highlighter holding hook hover:bg-fd-accent hover:text-fd-accent-foreground hover:underline how href html htmlFor http hydration i icon icon-sm icon-xs id idx if ignore img implicit import imports in in-popover index indexItemMatch info infoTags init initial inline-flex input inputs inset-0 inside installed instanceof instead integer interface internal into invalid is isDefined isDuplicated isDynamic isLazy isLoading isMounted isNumber isRequired issues it item items items-center items-start its j js json json-schema-typed justify-between justify-center keep key keyed keyof kind label labelClassName lang last last:border-b-0 last:mb-0 lazy leading-none leave left left-1/2 length let light like line-through link links list list-disc list-inside listed listen listener listeners load loadDocument loaderPlugin localStorage location lucide-react map mapValues marker:text-fd-muted-foreground match matching max-age max-h-(--available-height) max-h-[460px] max-w-(--available-width) max-w-[98vw] max-w-full max-w-lg may mb-1 mb-2 mb-auto md mdxComponents me-auto media mediaAdapters mediaType member merge mergeRefs message meta metaData method methods mime min-h-(--min-height,200px) min-w-0 min-w-[240px] min-w-[calc(var(--anchor-width)+--spacing(2))] modify mounted ms-auto mt-0! mt-10 mt-2 mt-3 multipart/form-data multiple must mx-1 my-0! my-1 my-1.5 my-2 my-2! my-4 name name! named namespace navigating navigation needs nested never new no no-cache node node:fs node:path noop normalizes not not-last:pb-0 not-prose note null number oauth2 oauthRedirectUrl object objectSearchOverrides objectSet objectUrl objects of off omit on onChange onClick onCopy onKeyDown onOpenChange onScrollEnd onSubmit onToken onValueChange one oneOf ones only opacity-80 open openApiData openIdConnect openapi openapiMeta opened opens operation options or orange order-last origin origin-(--transform-origin) other otherwise out outline outline-none output over overflow-auto overflow-hidden overflow-x-auto overflow-y-auto overflow-y-hidden p-1 p-1.5 p-2 p-3 p-4 packages page pageData pages panelVariants param parameter parameterLabel parameterNode parameters params parent parentPathIndex parents parsed part parts party pass password path pathIndex pathItem pathName pathnameFromRequest pattern patternProperties payload pb-0 pb-2 pe-2 pe-3 peer-disabled:cursor-not-allowed peer-disabled:opacity-70 pending pendingFlowKey persist persisted picked place placeholder placeholder:text-fd-muted-foreground playground playgrounds please plugins polite popover popoverRef positions pre preferring preloadOpenAPIPage preloaded preventScroll previous primitive processor properties property props prose prose-no-margin prose-sm proxy proxyForwardCookie proxyUrl ps-1 ps-2 ps-3 ps-4.5 ps-6 pt-0 pt-1 pt-2 pt-2.5 px px-1 px-2 px-3 px-4 py-0 py-0.5 py-1 py-1.5 py-2 py-4 query querySelector quiet random raw rawSearch re-triggering react react-hooks/exhaustive-deps react/jsx-runtime read readOnly readonly record red redirect redirectUrl redirect_uri ref reference refs regenerated rehype-react relative relativePath remark remark-rehype remarkGfm remarkRehype remove removeItem removing render renderBodyField renderCodeblock renderMarkdown renderParameterField renderPopoverTrigger renderTrigger rendered renderers renders replace represents request request-body requestBody requestData requestInit requestTimeout requestUrl requests required requirement requirements res reset resize-none resolve resolveMediaAdapter resolveUrl resolved resolvedInput resolvedTheme response response-body responseNode responseTabs response_type responses rest restored result return returning returns role root rootId roots rotate-90 rounded-2xl rounded-b-none rounded-lg rounded-md rounded-sm rounded-t-md rounded-xl route s-highlight safeParse same satisfies scalar scan schema schemaId schemaPropKeys schemaUI scheme schemeId schemes scope scopes scroll scroll-m-20 scrollTop scrollTops search secondary seconds secret section sections security see segments segs select select-none selected selectedType selections selector send sends sep separator server server-to-server serverSchema serverUrl services sessionStorage set setClientAuth setError setInfo setIsJson setNextName setObjectUrl setOpen setPath setSearch setSelected setServerVariables setShow setStore setToken setType setValue shadow-lg shadow-md shadow-sm shared shiki shikiOptions show showDescription showExample showResponseSchema showSelect showTitle showing shrink-0 side sideOffset signal single size size-3.5 size-4 skipNonRequired skipReadOnly slot slotType slots sm sm:flex-row sm:gap-2 sm:justify-end sm:text-start smooth so some sr-only src stable start started state staticSource status statusInfo step stf stfSync sticky still storageKey store stored string stringify stringifyFieldKey structuredData styles submit subscribe such supported svg switch t tab tabDepth tabValues tabs tag target testQuery text text-[0.8125rem] text-blue-600 text-center text-end text-fd-card-foreground text-fd-foreground text-fd-muted-foreground text-fd-muted-foreground/70 text-fd-popover-foreground text-fd-primary text-fd-primary-foreground text-fd-secondary-foreground text-green-500 text-green-600 text-lg text-nowrap text-orange-400 text-orange-600 text-red-400 text-red-400/80 text-red-500 text-red-600 text-sm text-start text-xs text-yellow-600 text/css text/csv text/html text/plain that the their them themes they this through throw timeout timerRef tips title to toJsxRuntime toStaticData toc token tokenInfo tokenUrl token_type token_url tokens toolbar top top-0 top-1/2 top-10 top-2 tracking-tight transform transformPageTree transition-[height,opacity] transition-[height] transition-colors transition-transform translations tree trigger true truncate try ts type typeVariants typeof types unchanged undefined under underline unexpected union unionField unions unknown unlisted unselected up update updateInfo updated updating url usageTabs use useAnchorId useApiClient useComponents useCopyButton useFieldValue useListener useMemo useNamespace useObject useOnChange useOpenAPI useOperation usePlaygroundAuth useQuery useRef useRenderContext useResponseExamples useServer useState useStatusInfo useStf useSyncExternalStore useTheme useTranslations useTypeScriptDefinitions used username users using utf-8 v value valueSchema values variable variables variant variants via view virtual void w-0 w-14 w-[600px] w-fit w-full warn was we webhook webhooks when where will with without won wrap-break-word wrapping write writeOnly x-exclusiveCodeSample x-playground-lazy xml yellow you your z-20 z-50");
|
|
@@ -30,6 +30,7 @@ export type Translations = {
|
|
|
30
30
|
"Deprecated(operation page)": string;
|
|
31
31
|
"Deprecated(security scheme)": string;
|
|
32
32
|
"Device Authorization(OAuth dialog)": string;
|
|
33
|
+
"Download(playground result display)": string;
|
|
33
34
|
"Empty(operation page)": string;
|
|
34
35
|
"Enter Value(playground server select)": string;
|
|
35
36
|
"Enter value(OAuth dialog)": string;
|
|
@@ -30,6 +30,7 @@ var keys_default = [
|
|
|
30
30
|
"Deprecated(operation page)",
|
|
31
31
|
"Deprecated(security scheme)",
|
|
32
32
|
"Device Authorization(OAuth dialog)",
|
|
33
|
+
"Download(playground result display)",
|
|
33
34
|
"Empty(operation page)",
|
|
34
35
|
"Enter Value(playground server select)",
|
|
35
36
|
"Enter value(OAuth dialog)",
|
|
@@ -11,7 +11,10 @@ export interface OAuthFlowInput {
|
|
|
11
11
|
clientSecret: string;
|
|
12
12
|
username: string;
|
|
13
13
|
password: string;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* where token requests send the client credentials,
|
|
16
|
+
* `header` (HTTP Basic) applies only with a client secret, otherwise the `client_id` goes in the body
|
|
17
|
+
*/
|
|
15
18
|
clientAuth: 'body' | 'header';
|
|
16
19
|
/** URL of the selected server, relative URLs of the flow resolve against it */
|
|
17
20
|
serverUrl: string;
|
|
@@ -31,17 +34,20 @@ type TokenInfo = {
|
|
|
31
34
|
type: 'authorization_code';
|
|
32
35
|
client_id: string;
|
|
33
36
|
client_secret: string;
|
|
37
|
+
client_auth: OAuthFlowInput['clientAuth'];
|
|
34
38
|
token: string;
|
|
35
39
|
} | {
|
|
36
40
|
type: 'implicit';
|
|
37
41
|
client_id: string;
|
|
38
42
|
token: string;
|
|
39
43
|
};
|
|
44
|
+
type TokenListener = (schemeId: string, token: string) => void;
|
|
40
45
|
interface AuthContextType {
|
|
41
46
|
store: TokenStore;
|
|
42
|
-
updatedSchemeId: string | null;
|
|
43
47
|
isLoading: boolean;
|
|
44
48
|
error?: unknown;
|
|
49
|
+
/** listen to the tokens of flows returning to the page, returns a cleanup */
|
|
50
|
+
subscribe: (listener: TokenListener) => () => void;
|
|
45
51
|
}
|
|
46
52
|
export declare function usePlaygroundAuth(): AuthContextType;
|
|
47
53
|
export interface AuthRequirement {
|
package/dist/playground/auth.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useQuery } from "../packages/shared-api/dist/utils/use-query.js";
|
|
3
3
|
import { useOpenAPI } from "../utils/create-page.js";
|
|
4
|
-
import { createContext, use, useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { createContext, use, useCallback, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useListener } from "@fumari/stf";
|
|
7
7
|
import { arrayStartsWith, objectGet, objectSet } from "@fumari/stf/lib/utils";
|
|
8
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
9
8
|
//#region src/playground/auth.tsx
|
|
10
9
|
const pendingFlowKey = "fumadocs-openapi-oauth";
|
|
11
10
|
/**
|
|
@@ -25,6 +24,7 @@ async function requestOAuthToken(scheme, type, { schemeId, scopes, clientId, cli
|
|
|
25
24
|
scheme: schemeId,
|
|
26
25
|
client_id: clientId,
|
|
27
26
|
client_secret: clientSecret,
|
|
27
|
+
client_auth: clientAuth,
|
|
28
28
|
redirect_uri: new URL(redirectUrl ?? window.location.pathname, window.location.origin).href,
|
|
29
29
|
token_url: "tokenUrl" in flow ? new URL(flow.tokenUrl, serverUrl).href : void 0
|
|
30
30
|
};
|
|
@@ -42,27 +42,28 @@ async function requestOAuthToken(scheme, type, { schemeId, scopes, clientId, cli
|
|
|
42
42
|
if (type !== "password" && type !== "clientCredentials") return;
|
|
43
43
|
const flow = flows[type];
|
|
44
44
|
if (!flow) return;
|
|
45
|
-
const headers = {};
|
|
46
45
|
const body = new URLSearchParams({ scope });
|
|
47
46
|
if (type === "password") {
|
|
48
47
|
body.set("grant_type", "password");
|
|
49
48
|
body.set("username", username);
|
|
50
49
|
body.set("password", password);
|
|
51
50
|
} else body.set("grant_type", "client_credentials");
|
|
52
|
-
|
|
51
|
+
return fetchToken(new URL(flow.tokenUrl, serverUrl).href, body, {
|
|
52
|
+
client_id: clientId,
|
|
53
|
+
client_secret: clientSecret,
|
|
54
|
+
client_auth: clientAuth
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function fetchToken(tokenUrl, body, { client_id, client_secret, client_auth }) {
|
|
58
|
+
const headers = { "Content-Type": "application/x-www-form-urlencoded" };
|
|
59
|
+
if (client_auth === "header" && client_secret) headers.Authorization = `Basic ${btoa(`${encodeURIComponent(client_id)}:${encodeURIComponent(client_secret)}`)}`;
|
|
53
60
|
else {
|
|
54
|
-
if (
|
|
55
|
-
if (
|
|
61
|
+
if (client_id) body.set("client_id", client_id);
|
|
62
|
+
if (client_secret) body.set("client_secret", client_secret);
|
|
56
63
|
}
|
|
57
|
-
return fetchToken(new URL(flow.tokenUrl, serverUrl).href, body, headers);
|
|
58
|
-
}
|
|
59
|
-
async function fetchToken(tokenUrl, body, headers = {}) {
|
|
60
64
|
const res = await fetch(tokenUrl, {
|
|
61
65
|
method: "POST",
|
|
62
|
-
headers
|
|
63
|
-
...headers,
|
|
64
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
65
|
-
},
|
|
66
|
+
headers,
|
|
66
67
|
body
|
|
67
68
|
});
|
|
68
69
|
if (!res.ok) throw new Error(await res.text());
|
|
@@ -77,23 +78,33 @@ function usePlaygroundAuth() {
|
|
|
77
78
|
}
|
|
78
79
|
function AuthProvider({ children }) {
|
|
79
80
|
const [store, setStore] = useState({});
|
|
81
|
+
const listeners = useMemo(() => /* @__PURE__ */ new Set(), []);
|
|
82
|
+
const subscribe = useCallback((listener) => {
|
|
83
|
+
listeners.add(listener);
|
|
84
|
+
return () => {
|
|
85
|
+
listeners.delete(listener);
|
|
86
|
+
};
|
|
87
|
+
}, [listeners]);
|
|
88
|
+
function save(schemeId, info) {
|
|
89
|
+
setStore((s) => ({
|
|
90
|
+
...s,
|
|
91
|
+
[schemeId]: info
|
|
92
|
+
}));
|
|
93
|
+
for (const listener of listeners) listener(schemeId, info.token);
|
|
94
|
+
}
|
|
80
95
|
const authCodeQuery = useQuery(async (code, flow) => {
|
|
81
96
|
const token = await fetchToken(flow.token_url, new URLSearchParams({
|
|
82
97
|
grant_type: "authorization_code",
|
|
83
98
|
code,
|
|
84
|
-
redirect_uri: flow.redirect_uri
|
|
99
|
+
redirect_uri: flow.redirect_uri
|
|
100
|
+
}), flow);
|
|
101
|
+
save(flow.scheme, {
|
|
102
|
+
type: "authorization_code",
|
|
85
103
|
client_id: flow.client_id,
|
|
86
|
-
client_secret: flow.client_secret
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
[flow.scheme]: {
|
|
91
|
-
type: "authorization_code",
|
|
92
|
-
client_id: flow.client_id,
|
|
93
|
-
client_secret: flow.client_secret,
|
|
94
|
-
token
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
104
|
+
client_secret: flow.client_secret,
|
|
105
|
+
client_auth: flow.client_auth,
|
|
106
|
+
token
|
|
107
|
+
});
|
|
97
108
|
});
|
|
98
109
|
useEffect(() => {
|
|
99
110
|
const stored = sessionStorage.getItem(pendingFlowKey);
|
|
@@ -104,14 +115,11 @@ function AuthProvider({ children }) {
|
|
|
104
115
|
const code = query.get("code");
|
|
105
116
|
const token = hash.get("access_token");
|
|
106
117
|
if (code && query.get("state") === flow.state) authCodeQuery.start(code, flow);
|
|
107
|
-
else if (token && hash.get("state") === flow.state)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
token: `${hash.get("token_type") ?? "Bearer"} ${token}`
|
|
113
|
-
}
|
|
114
|
-
}));
|
|
118
|
+
else if (token && hash.get("state") === flow.state) save(flow.scheme, {
|
|
119
|
+
type: "implicit",
|
|
120
|
+
client_id: flow.client_id,
|
|
121
|
+
token: `${hash.get("token_type") ?? "Bearer"} ${token}`
|
|
122
|
+
});
|
|
115
123
|
else return;
|
|
116
124
|
sessionStorage.removeItem(pendingFlowKey);
|
|
117
125
|
window.history.replaceState(null, "", window.location.pathname);
|
|
@@ -119,13 +127,14 @@ function AuthProvider({ children }) {
|
|
|
119
127
|
return /* @__PURE__ */ jsx(AuthContext, {
|
|
120
128
|
value: useMemo(() => ({
|
|
121
129
|
store,
|
|
122
|
-
updatedSchemeId: Object.keys(store)[0] ?? null,
|
|
123
130
|
isLoading: authCodeQuery.isLoading,
|
|
124
|
-
error: authCodeQuery.error
|
|
131
|
+
error: authCodeQuery.error,
|
|
132
|
+
subscribe
|
|
125
133
|
}), [
|
|
126
134
|
store,
|
|
127
135
|
authCodeQuery.isLoading,
|
|
128
|
-
authCodeQuery.error
|
|
136
|
+
authCodeQuery.error,
|
|
137
|
+
subscribe
|
|
129
138
|
]),
|
|
130
139
|
children
|
|
131
140
|
});
|
|
@@ -134,7 +143,7 @@ function AuthProvider({ children }) {
|
|
|
134
143
|
* The auth fields of an API playground: the values it persists, and the request data they encode into.
|
|
135
144
|
*/
|
|
136
145
|
function useAuthFields(engine, { operation, transform } = {}) {
|
|
137
|
-
const
|
|
146
|
+
const { subscribe } = usePlaygroundAuth();
|
|
138
147
|
const { storageKeyPrefix, doc } = useOpenAPI();
|
|
139
148
|
const { dereferenced, resolve } = doc;
|
|
140
149
|
const schemes = dereferenced.components?.securitySchemes;
|
|
@@ -215,21 +224,19 @@ function useAuthFields(engine, { operation, transform } = {}) {
|
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
});
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
if (!updatedSchemeId) return;
|
|
221
|
-
const { token } = auth.store[updatedSchemeId];
|
|
222
|
-
const field = fields.find((field) => field.schemeId === updatedSchemeId);
|
|
227
|
+
const onToken = useEffectEvent((schemeId, token) => {
|
|
228
|
+
const field = fields.find((field) => field.schemeId === schemeId);
|
|
223
229
|
if (field) {
|
|
224
230
|
engine.update(field.fieldName, token);
|
|
225
231
|
return;
|
|
226
232
|
}
|
|
227
|
-
const idx = requirements.findIndex((req) => req.some((item) => item.id ===
|
|
233
|
+
const idx = requirements.findIndex((req) => req.some((item) => item.id === schemeId));
|
|
228
234
|
if (idx !== -1) {
|
|
229
|
-
localStorage.setItem(`${storageKeyPrefix}auth-${
|
|
235
|
+
localStorage.setItem(`${storageKeyPrefix}auth-${schemeId}`, JSON.stringify(token));
|
|
230
236
|
select(idx);
|
|
231
237
|
}
|
|
232
238
|
});
|
|
239
|
+
useEffect(() => subscribe(onToken), [subscribe]);
|
|
233
240
|
return {
|
|
234
241
|
requirements,
|
|
235
242
|
selected,
|
|
@@ -22,10 +22,10 @@ import { Fragment, createContext, use, useEffect, useMemo, useRef, useState } fr
|
|
|
22
22
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
23
23
|
import { StfProvider, useDataEngine, useFieldValue, useListener, useStf } from "@fumari/stf";
|
|
24
24
|
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
25
|
-
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
26
25
|
import { useTranslations } from "@fuma-translate/react";
|
|
27
26
|
import { ChevronDown, LoaderCircle, PlusIcon } from "lucide-react";
|
|
28
27
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
28
|
+
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
29
29
|
//#region src/ui/playground/client.tsx
|
|
30
30
|
const OptionsContext = createContext({});
|
|
31
31
|
function usePlaygroundOptions() {
|
|
@@ -28,16 +28,16 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
|
|
|
28
28
|
const [type, setType] = useState(() => {
|
|
29
29
|
return Object.keys(scheme.flows)[0];
|
|
30
30
|
});
|
|
31
|
-
const [clientAuth, setClientAuth] = useState("
|
|
31
|
+
const [clientAuth, setClientAuth] = useState(() => tokenInfo?.type === "authorization_code" ? tokenInfo.client_auth : "header");
|
|
32
32
|
const t = useTranslations({ note: "OAuth dialog" });
|
|
33
33
|
const clientAuthMethods = {
|
|
34
|
-
body: {
|
|
35
|
-
name: t("Send client credentials in body"),
|
|
36
|
-
description: t("Include the client ID and secret in the token request body.")
|
|
37
|
-
},
|
|
38
34
|
header: {
|
|
39
35
|
name: t("Send as Basic Auth header"),
|
|
40
36
|
description: t("Send the client ID and secret in the Authorization header.")
|
|
37
|
+
},
|
|
38
|
+
body: {
|
|
39
|
+
name: t("Send client credentials in body"),
|
|
40
|
+
description: t("Include the client ID and secret in the token request body.")
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const allFlows = useMemo(() => ({
|
|
@@ -148,7 +148,7 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
|
|
|
148
148
|
autoComplete: "off",
|
|
149
149
|
disabled: isLoading,
|
|
150
150
|
defaultValue: defaultValues.clientId,
|
|
151
|
-
required: type !== "password"
|
|
151
|
+
required: type !== "password"
|
|
152
152
|
})
|
|
153
153
|
]
|
|
154
154
|
}),
|
|
@@ -171,11 +171,11 @@ function Content({ schemeId, scopes, setToken, setOpen }) {
|
|
|
171
171
|
autoComplete: "off",
|
|
172
172
|
disabled: isLoading,
|
|
173
173
|
defaultValue: defaultValues.clientSecret,
|
|
174
|
-
required: type !== "password"
|
|
174
|
+
required: type !== "password"
|
|
175
175
|
})
|
|
176
176
|
]
|
|
177
177
|
}),
|
|
178
|
-
(type === "clientCredentials" || type === "password") && /* @__PURE__ */ jsxs("fieldset", {
|
|
178
|
+
(type === "authorizationCode" || type === "clientCredentials" || type === "password") && /* @__PURE__ */ jsxs("fieldset", {
|
|
179
179
|
className: "flex flex-col gap-1.5",
|
|
180
180
|
children: [/* @__PURE__ */ jsx(Label, {
|
|
181
181
|
htmlFor: "client_auth",
|
|
@@ -8,7 +8,7 @@ import { Fragment, useEffect, useMemo, useState } from "react";
|
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useTranslations } from "@fuma-translate/react";
|
|
10
10
|
import { cva } from "class-variance-authority";
|
|
11
|
-
import { ChevronDown, CircleX, SignpostIcon } from "lucide-react";
|
|
11
|
+
import { ChevronDown, CircleX, DownloadIcon, SignpostIcon } from "lucide-react";
|
|
12
12
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
13
13
|
//#region src/ui/playground/components/result-display.tsx
|
|
14
14
|
var import_fast_content_type_parse = require_fast_content_type_parse();
|
|
@@ -69,11 +69,17 @@ function getTextFormat(mime) {
|
|
|
69
69
|
function ResponseResult({ data, reset, ...rest }) {
|
|
70
70
|
const t = useTranslations({ note: "playground result display" });
|
|
71
71
|
const statusInfo = useStatusInfo(data.status);
|
|
72
|
+
const [objectUrl, setObjectUrl] = useState();
|
|
72
73
|
const { parameters, type } = useMemo(() => (0, import_fast_content_type_parse.safeParse)(data.headers.get("Content-Type") ?? "text/plain"), [data.headers]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const objectUrl = URL.createObjectURL(new Blob([data.body], { type }));
|
|
76
|
+
setObjectUrl(objectUrl);
|
|
77
|
+
return () => URL.revokeObjectURL(objectUrl);
|
|
78
|
+
}, [data.body, type]);
|
|
73
79
|
let body;
|
|
74
|
-
if (type.startsWith("image/")) body = /* @__PURE__ */ jsx(ImageResult, {
|
|
80
|
+
if (type.startsWith("image/")) body = objectUrl && /* @__PURE__ */ jsx(ImageResult, {
|
|
75
81
|
mime: type,
|
|
76
|
-
|
|
82
|
+
src: objectUrl
|
|
77
83
|
});
|
|
78
84
|
else if (data.body.byteLength > 0) {
|
|
79
85
|
const lang = getTextFormat(type);
|
|
@@ -103,19 +109,28 @@ function ResponseResult({ data, reset, ...rest }) {
|
|
|
103
109
|
children: [
|
|
104
110
|
/* @__PURE__ */ jsx(statusInfo.icon, { className: cn("size-4 shrink-0", statusInfo.color) }),
|
|
105
111
|
/* @__PURE__ */ jsxs("p", {
|
|
106
|
-
className: "text-sm font-medium
|
|
112
|
+
className: "min-w-0 me-auto text-sm font-medium truncate",
|
|
107
113
|
children: [
|
|
108
114
|
data.status,
|
|
109
115
|
" ",
|
|
110
116
|
statusInfo.description
|
|
111
117
|
]
|
|
112
118
|
}),
|
|
119
|
+
data.body.byteLength > 0 && /* @__PURE__ */ jsxs("a", {
|
|
120
|
+
href: objectUrl,
|
|
121
|
+
download: getFileName(data.headers),
|
|
122
|
+
className: cn(buttonVariants({
|
|
123
|
+
size: "sm",
|
|
124
|
+
variant: "outline"
|
|
125
|
+
}), "gap-2"),
|
|
126
|
+
children: [/* @__PURE__ */ jsx(DownloadIcon, { className: "size-3.5 text-fd-muted-foreground" }), t("Download")]
|
|
127
|
+
}),
|
|
113
128
|
/* @__PURE__ */ jsx("button", {
|
|
114
129
|
type: "button",
|
|
115
|
-
className:
|
|
130
|
+
className: buttonVariants({
|
|
116
131
|
size: "sm",
|
|
117
132
|
variant: "outline"
|
|
118
|
-
}),
|
|
133
|
+
}),
|
|
119
134
|
onClick: () => reset(),
|
|
120
135
|
children: t("Close")
|
|
121
136
|
})
|
|
@@ -184,26 +199,34 @@ function TextResult({ lang, charset, data, contentType }) {
|
|
|
184
199
|
}) }
|
|
185
200
|
});
|
|
186
201
|
}
|
|
187
|
-
function ImageResult({ mime,
|
|
188
|
-
const [objectUrl, setObjectUrl] = useState(null);
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
const blob = new Blob([buffer], { type: mime });
|
|
191
|
-
const url = URL.createObjectURL(blob);
|
|
192
|
-
setObjectUrl(url);
|
|
193
|
-
return () => URL.revokeObjectURL(url);
|
|
194
|
-
}, [mime, buffer]);
|
|
195
|
-
if (!objectUrl) return;
|
|
202
|
+
function ImageResult({ mime, src }) {
|
|
196
203
|
return /* @__PURE__ */ jsxs("figure", {
|
|
197
204
|
className: "w-full p-1 bg-fd-card border rounded-lg shadow-sm",
|
|
198
205
|
children: [/* @__PURE__ */ jsx("figcaption", {
|
|
199
206
|
className: "text-xs text-fd-muted-foreground font-mono p-1 pb-2",
|
|
200
207
|
children: mime
|
|
201
208
|
}), /* @__PURE__ */ jsx("img", {
|
|
202
|
-
src
|
|
209
|
+
src,
|
|
203
210
|
alt: "",
|
|
204
211
|
className: "w-full rounded-md"
|
|
205
212
|
})]
|
|
206
213
|
});
|
|
207
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* The file name from `Content-Disposition`, preferring `filename*` (RFC 6266), without directories.
|
|
217
|
+
*/
|
|
218
|
+
function getFileName(headers) {
|
|
219
|
+
const disposition = headers.get("Content-Disposition") ?? "";
|
|
220
|
+
const extended = /(?:^|;)\s*filename\*\s*=\s*[^']*'[^']*'([^\s;"]+)/i.exec(disposition);
|
|
221
|
+
let name;
|
|
222
|
+
if (extended) try {
|
|
223
|
+
name = decodeURIComponent(extended[1]);
|
|
224
|
+
} catch {}
|
|
225
|
+
if (!name) {
|
|
226
|
+
const match = /(?:^|;)\s*filename\s*=\s*(?:"((?:\\.|[^"\\])*)"|([^\s;]+))/i.exec(disposition);
|
|
227
|
+
name = match?.[1]?.replace(/\\(.)/g, "$1") ?? match?.[2];
|
|
228
|
+
}
|
|
229
|
+
return name?.replace(/^.*[/\\]/, "") || "response";
|
|
230
|
+
}
|
|
208
231
|
//#endregion
|
|
209
232
|
export { DefaultResultDisplay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.1",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"@types/react-dom": "^19.3.0",
|
|
79
79
|
"fast-content-type-parse": "^4.0.0",
|
|
80
80
|
"fuma-cli": "^0.3.1",
|
|
81
|
-
"fumadocs-core": "16.15.
|
|
82
|
-
"fumadocs-ui": "npm:@fumadocs/base-ui@16.15.
|
|
81
|
+
"fumadocs-core": "16.15.18",
|
|
82
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@16.15.18",
|
|
83
83
|
"json-schema-typed": "^8.0.2",
|
|
84
84
|
"shared-api": "0.2.10",
|
|
85
85
|
"tsconfig": "0.0.0",
|