fumadocs-openapi 12.5.5 → 12.5.6
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 +6 -3
- package/dist/.translations/keys.js +6 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/generate-file.d.ts +1 -3
- package/dist/generate-file.js +3 -3
- package/dist/i18n.d.ts +1 -3
- package/dist/i18n.js +1 -2
- package/dist/index.browser.d.ts +0 -2
- package/dist/index.browser.js +1 -2
- package/dist/node_modules/.pnpm/fast-content-type-parse@4.0.1/node_modules/fast-content-type-parse/index.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/array-helper.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/options-helper.js +1 -2
- package/dist/operation.d.ts +1 -3
- package/dist/operation.js +1 -2
- package/dist/packages/shared-api/dist/.translations/index.d.ts +2 -5
- package/dist/packages/shared-api/dist/.translations/keys.js +2 -2
- package/dist/packages/shared-api/dist/auto-anchor/index.js +1 -2
- package/dist/packages/shared-api/dist/codegen.d.ts +0 -3
- package/dist/packages/shared-api/dist/codegen.js +1 -2
- package/dist/packages/shared-api/dist/components/badge.js +1 -2
- package/dist/packages/shared-api/dist/components/collapsible.js +1 -2
- package/dist/packages/shared-api/dist/components/copy-typescript.js +1 -2
- package/dist/packages/shared-api/dist/components/defaults.d.ts +1 -4
- package/dist/packages/shared-api/dist/components/defaults.js +1 -2
- package/dist/packages/shared-api/dist/components/dialog.js +1 -2
- package/dist/packages/shared-api/dist/components/example.js +3 -3
- package/dist/packages/shared-api/dist/components/playground/fields.js +27 -9
- package/dist/packages/shared-api/dist/components/playground/json-editor.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/panels.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/param-input.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/result.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/schema.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/server-select.js +1 -2
- package/dist/packages/shared-api/dist/components/schema/client.d.ts +1 -4
- package/dist/packages/shared-api/dist/components/schema/client.js +3 -2
- package/dist/packages/shared-api/dist/components/schema/index.d.ts +0 -3
- package/dist/packages/shared-api/dist/components/schema/index.js +1 -2
- package/dist/packages/shared-api/dist/components/segmented.js +1 -2
- package/dist/packages/shared-api/dist/components/select-tab.js +1 -2
- package/dist/packages/shared-api/dist/components/select.js +1 -2
- package/dist/packages/shared-api/dist/components/spinner.js +1 -2
- package/dist/packages/shared-api/dist/i18n.js +1 -2
- package/dist/packages/shared-api/dist/source.d.ts +1 -4
- package/dist/packages/shared-api/dist/source.js +1 -2
- package/dist/packages/shared-api/dist/utils/document-cache.js +1 -2
- package/dist/packages/shared-api/dist/utils/id-to-title.js +1 -2
- package/dist/packages/shared-api/dist/utils/is-plain-object.js +1 -2
- package/dist/packages/shared-api/dist/utils/url.js +1 -2
- package/dist/packages/shared-api/dist/utils/use-query.js +1 -2
- package/dist/packages/shared-api/dist/utils/use-server-store.js +1 -2
- package/dist/playground/auth.d.ts +0 -2
- package/dist/playground/auth.js +1 -2
- package/dist/playground/fetcher.d.ts +1 -3
- package/dist/playground/fetcher.js +1 -2
- package/dist/playground/use-playground.d.ts +1 -3
- package/dist/playground/use-playground.js +1 -2
- package/dist/requests/generators/all.d.ts +1 -3
- package/dist/requests/generators/all.js +1 -2
- package/dist/requests/generators/csharp.d.ts +1 -3
- package/dist/requests/generators/csharp.js +1 -2
- package/dist/requests/generators/curl.d.ts +1 -3
- package/dist/requests/generators/curl.js +1 -2
- package/dist/requests/generators/go.d.ts +1 -3
- package/dist/requests/generators/go.js +1 -2
- package/dist/requests/generators/index.d.ts +1 -3
- package/dist/requests/generators/index.js +1 -2
- package/dist/requests/generators/java.d.ts +1 -3
- package/dist/requests/generators/java.js +1 -2
- package/dist/requests/generators/javascript.d.ts +1 -3
- package/dist/requests/generators/javascript.js +1 -2
- package/dist/requests/generators/python.d.ts +1 -3
- package/dist/requests/generators/python.js +1 -2
- package/dist/requests/generators/rust.d.ts +1 -3
- package/dist/requests/generators/rust.js +1 -2
- package/dist/requests/media/adapter.d.ts +0 -2
- package/dist/requests/media/adapter.js +1 -2
- package/dist/requests/media/encode.d.ts +1 -3
- package/dist/requests/media/encode.js +1 -2
- package/dist/requests/media/resolve-adapter.d.ts +1 -3
- package/dist/requests/media/resolve-adapter.js +1 -2
- package/dist/requests/string-utils.js +1 -2
- package/dist/requests/types.d.ts +1 -3
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +1 -2
- package/dist/server/oauth.d.ts +1 -3
- package/dist/server/oauth.js +1 -2
- package/dist/server/proxy.d.ts +0 -2
- package/dist/server/proxy.js +8 -4
- package/dist/types/openapi.d.ts +1 -3
- package/dist/types.d.ts +1 -3
- package/dist/ui/base.d.ts +1 -3
- package/dist/ui/base.js +1 -2
- package/dist/ui/components/codeblock.js +1 -2
- package/dist/ui/components/endpoint.js +1 -2
- package/dist/ui/components/heading.js +1 -2
- package/dist/ui/components/markdown.js +1 -2
- package/dist/ui/components/method-label.js +1 -2
- package/dist/ui/components/schema.js +1 -2
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/index.js +1 -2
- package/dist/ui/operation/index.js +14 -5
- package/dist/ui/operation/usage-tabs.js +12 -5
- package/dist/ui/playground/client.d.ts +5 -4
- package/dist/ui/playground/client.js +1 -2
- package/dist/ui/playground/components/auth.js +1 -2
- package/dist/ui/playground/components/request-panel.d.ts +8 -0
- package/dist/ui/playground/components/request-panel.js +16 -10
- package/dist/ui/playground/components/response-panel.js +1 -2
- package/dist/ui/playground/components/result-display.d.ts +1 -3
- package/dist/ui/playground/components/result-display.js +1 -2
- package/dist/ui/playground/components/server-select.js +1 -2
- package/dist/ui/playground/components/url-bar.js +1 -2
- package/dist/ui/scalar/client.js +1 -2
- package/dist/ui/scalar/index.d.ts +1 -3
- package/dist/ui/scalar/index.js +1 -2
- package/dist/utils/create-page.d.ts +1 -3
- package/dist/utils/create-page.js +1 -2
- package/dist/utils/document/dereference.d.ts +1 -3
- package/dist/utils/document/dereference.js +1 -2
- package/dist/utils/document/load.js +1 -2
- package/dist/utils/get-example-requests.js +1 -2
- package/dist/utils/pages/builder.d.ts +0 -2
- package/dist/utils/pages/builder.js +1 -2
- package/dist/utils/pages/preset-auto.d.ts +0 -2
- package/dist/utils/pages/preset-auto.js +1 -2
- package/dist/utils/pages/to-static-data.d.ts +1 -3
- package/dist/utils/pages/to-static-data.js +1 -2
- package/dist/utils/pages/to-text.d.ts +1 -3
- package/dist/utils/pages/to-text.js +1 -2
- package/dist/utils/schema.js +1 -2
- package/dist/utils/use-server.d.ts +0 -2
- package/dist/utils/use-server.js +1 -2
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCodeUsageGeneratorRegistry as createCodeUsageGeneratorRegistry$1 } from "../../packages/shared-api/dist/codegen.js";
|
|
2
|
-
|
|
2
|
+
// src/requests/generators/index.ts
|
|
3
3
|
function pathnameFromRequest(pathname, { path, query }) {
|
|
4
4
|
for (const key in path) {
|
|
5
5
|
const param = path[key];
|
|
@@ -18,5 +18,4 @@ function pathnameFromRequest(pathname, { path, query }) {
|
|
|
18
18
|
function createCodeUsageGeneratorRegistry(inherit) {
|
|
19
19
|
return createCodeUsageGeneratorRegistry$1(inherit);
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { createCodeUsageGeneratorRegistry, pathnameFromRequest };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cookieString, doubleQuote, indent, inputToString } from "../string-utils.js";
|
|
2
2
|
import { generateBodyExample } from "../media/adapter.js";
|
|
3
|
-
|
|
3
|
+
// src/requests/generators/java.ts
|
|
4
4
|
const boundary = "form-data-boundary";
|
|
5
5
|
const java = {
|
|
6
6
|
label: "Java",
|
|
@@ -48,5 +48,4 @@ function multipartBody(body) {
|
|
|
48
48
|
}
|
|
49
49
|
return `var body = HttpRequest.BodyPublishers.ofString(${JSON.stringify(`${text}--${boundary}--\r\n`)});`;
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
export { java };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cookieString, doubleQuote, indent } from "../string-utils.js";
|
|
2
2
|
import { generateBodyExample } from "../media/adapter.js";
|
|
3
|
-
|
|
3
|
+
// src/requests/generators/javascript.ts
|
|
4
4
|
const javascript = {
|
|
5
5
|
label: "JavaScript",
|
|
6
6
|
lang: "js",
|
|
@@ -27,5 +27,4 @@ const javascript = {
|
|
|
27
27
|
return s.join("\n\n");
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
//#endregion
|
|
31
30
|
export { javascript };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { doubleQuote } from "../string-utils.js";
|
|
2
2
|
import { generateBodyExample } from "../media/adapter.js";
|
|
3
|
-
|
|
3
|
+
// src/requests/generators/python.ts
|
|
4
4
|
const python = {
|
|
5
5
|
label: "Python",
|
|
6
6
|
lang: "python",
|
|
@@ -40,5 +40,4 @@ function generatePythonObject(v, imports) {
|
|
|
40
40
|
} else if (typeof v === "object") return `{\n${Object.entries(v).map(([key, value]) => ` ${doubleQuote(key)}: ${generatePythonObject(value, imports)}`).join(", \n")}\n}`;
|
|
41
41
|
else throw new Error(`Unsupported type: ${typeof v}`);
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { python };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cookieString, doubleQuote, indent } from "../string-utils.js";
|
|
2
2
|
import { generateBodyExample } from "../media/adapter.js";
|
|
3
|
-
|
|
3
|
+
// src/requests/generators/rust.ts
|
|
4
4
|
const rust = {
|
|
5
5
|
label: "Rust",
|
|
6
6
|
lang: "rust",
|
|
@@ -30,5 +30,4 @@ ${indent(request.join("\n"), 2)}
|
|
|
30
30
|
}`;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
//#endregion
|
|
34
33
|
export { rust };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/requests/media/adapter.d.ts
|
|
2
1
|
interface BaseContext {
|
|
3
2
|
/**
|
|
4
3
|
* Passed by your custom example generator, for your custom media adapter to receive.
|
|
@@ -46,5 +45,4 @@ export interface MediaAdapter {
|
|
|
46
45
|
body: unknown;
|
|
47
46
|
}, ctx: MediaContext) => string | undefined;
|
|
48
47
|
}
|
|
49
|
-
//#endregion
|
|
50
48
|
export {};
|
|
@@ -3,7 +3,7 @@ import { csharpRawString, goString, javaTextBlock, jsTemplateLiteral, pythonStri
|
|
|
3
3
|
import { require_js2xml } from "../../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
|
|
4
4
|
import { inputToString } from "../string-utils.js";
|
|
5
5
|
import { resolveMediaAdapter } from "./resolve-adapter.js";
|
|
6
|
-
|
|
6
|
+
// src/requests/media/adapter.ts
|
|
7
7
|
var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
|
|
8
8
|
const defaultAdapters = {
|
|
9
9
|
"application/json": {
|
|
@@ -141,5 +141,4 @@ function str(init, mediaType, ctx) {
|
|
|
141
141
|
case "rust": return `let body = ${rustString(text)};`;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
//#endregion
|
|
145
144
|
export { defaultAdapters, generateBodyExample };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RawRequestData, RequestData } from "../types.js";
|
|
2
2
|
import { MediaAdapter } from "./adapter.js";
|
|
3
3
|
import { ParameterObject } from "../../types.js";
|
|
4
|
-
//#region src/requests/media/encode.d.ts
|
|
5
4
|
export interface EncodedParameter {
|
|
6
5
|
readonly value: string;
|
|
7
6
|
}
|
|
@@ -11,5 +10,4 @@ export interface EncodedParameterMultiple {
|
|
|
11
10
|
/**
|
|
12
11
|
* serialize parameters, see https://swagger.io/docs/specification/v3_0/serialization.
|
|
13
12
|
*/
|
|
14
|
-
export declare function encodeRequestData(from: RawRequestData, adapters: Record<string, MediaAdapter>, parameters?: ParameterObject[]): RequestData;
|
|
15
|
-
//#endregion
|
|
13
|
+
export declare function encodeRequestData(from: RawRequestData, adapters: Record<string, MediaAdapter>, parameters?: ParameterObject[]): RequestData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveMediaAdapter } from "./resolve-adapter.js";
|
|
2
|
-
|
|
2
|
+
// src/requests/media/encode.ts
|
|
3
3
|
/**
|
|
4
4
|
* serialize parameters, see https://swagger.io/docs/specification/v3_0/serialization.
|
|
5
5
|
*/
|
|
@@ -123,5 +123,4 @@ function serializeCookieParameter(field, value, output) {
|
|
|
123
123
|
else if (typeof value === "object") output[field.name] = { value: Object.entries(value).flat().join(",") };
|
|
124
124
|
else output[field.name] = { value: String(value) };
|
|
125
125
|
}
|
|
126
|
-
//#endregion
|
|
127
126
|
export { encodeRequestData };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MediaAdapter } from "./adapter.js";
|
|
2
|
-
//#region src/requests/media/resolve-adapter.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Resolve a media adapter for a given media type.
|
|
5
4
|
* Supports exact matches and pattern matching (e.g., +json suffix).
|
|
@@ -8,5 +7,4 @@ import { MediaAdapter } from "./adapter.js";
|
|
|
8
7
|
* @param adapters - Record of media adapters
|
|
9
8
|
* @returns The resolved adapter or undefined if not found
|
|
10
9
|
*/
|
|
11
|
-
export declare function resolveMediaAdapter(mediaType: string, adapters: Record<string, MediaAdapter>): MediaAdapter | undefined;
|
|
12
|
-
//#endregion
|
|
10
|
+
export declare function resolveMediaAdapter(mediaType: string, adapters: Record<string, MediaAdapter>): MediaAdapter | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/requests/media/resolve-adapter.ts
|
|
2
2
|
const VariantMediaTypeRegex = /^(?<dir>[a-zA-Z0-9._-]+)\/(?<content>[a-zA-Z0-9._-]+)\+(?<variant>[a-zA-Z0-9._-]+)$/;
|
|
3
3
|
/**
|
|
4
4
|
* Resolve the media type of the adapter for a given media type, like `application/json` for `+json` variants.
|
|
@@ -24,5 +24,4 @@ function resolveMediaAdapter(mediaType, adapters) {
|
|
|
24
24
|
const type = resolveMediaType(mediaType, adapters);
|
|
25
25
|
if (type) return adapters[type];
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { resolveMediaAdapter, resolveMediaType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __toESM } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { require_js2xml } from "../node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js";
|
|
3
|
-
|
|
3
|
+
// src/requests/string-utils.ts
|
|
4
4
|
var import_js2xml = /* @__PURE__ */ __toESM(require_js2xml(), 1);
|
|
5
5
|
/**
|
|
6
6
|
* The text of a body value in the format of a media type, strings are already serialized.
|
|
@@ -44,5 +44,4 @@ function indent(code, tab = 1) {
|
|
|
44
44
|
const p = " ".repeat(tab);
|
|
45
45
|
return code.split("\n").map((v) => v.length === 0 ? v : p + v).join("\n");
|
|
46
46
|
}
|
|
47
|
-
//#endregion
|
|
48
47
|
export { cookieString, doubleQuote, indent, inputToString, jsxString };
|
package/dist/requests/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EncodedParameter, EncodedParameterMultiple } from "./media/encode.js";
|
|
2
2
|
import { HttpMethods } from "../types.js";
|
|
3
|
-
//#region src/requests/types.d.ts
|
|
4
3
|
export interface RawRequestData {
|
|
5
4
|
method: HttpMethods;
|
|
6
5
|
path: Record<string, unknown>;
|
|
@@ -18,5 +17,4 @@ export interface RequestData {
|
|
|
18
17
|
cookie: Record<string, EncodedParameter>;
|
|
19
18
|
body?: unknown;
|
|
20
19
|
bodyMediaType?: string;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
20
|
+
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import "../ui/index.js";
|
|
|
9
9
|
import { DynamicSource, LoaderPlugin, MetaData, Page, PageData, Source } from "fumadocs-core/source";
|
|
10
10
|
import { TOCItemType } from "fumadocs-core/toc";
|
|
11
11
|
import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
|
|
12
|
-
//#region src/server/index.d.ts
|
|
13
12
|
/**
|
|
14
13
|
* schema ID -> file path, URL, downloaded schema object, or a function returning them
|
|
15
14
|
*/
|
|
@@ -84,5 +83,4 @@ export declare function openapiSource(server: OpenAPIServer, options?: OpenAPISo
|
|
|
84
83
|
metaData: MetaData;
|
|
85
84
|
pageData: OpenAPIPageData;
|
|
86
85
|
}>>;
|
|
87
|
-
//#endregion
|
|
88
86
|
export type { CreateProxyOptions, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec, Proxy };
|
package/dist/server/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createOAuthHandler } from "./oauth.js";
|
|
|
7
7
|
import { loadDocument } from "../utils/document/load.js";
|
|
8
8
|
import { MethodLabel } from "../ui/components/method-label.js";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
|
|
10
|
+
// src/server/index.tsx
|
|
11
11
|
function createOpenAPI(options = {}) {
|
|
12
12
|
const { disableCache = false, includeDocument = true } = options;
|
|
13
13
|
const docCache = /* @__PURE__ */ new Map();
|
|
@@ -145,5 +145,4 @@ function openapiPlugin() {
|
|
|
145
145
|
async function openapiSource(server, options = {}) {
|
|
146
146
|
return server.staticSource(options);
|
|
147
147
|
}
|
|
148
|
-
//#endregion
|
|
149
148
|
export { createOpenAPI, openapiPlugin, openapiSource };
|
package/dist/server/oauth.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
//#region src/server/oauth.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A route handler for the redirect URI of OAuth flows, it sends users back to the page that started the flow.
|
|
4
3
|
*/
|
|
5
|
-
export declare function createOAuthHandler(): (req: Request) => Response;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function createOAuthHandler(): (req: Request) => Response;
|
package/dist/server/oauth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/server/oauth.ts
|
|
2
2
|
/**
|
|
3
3
|
* A route handler for the redirect URI of OAuth flows, it sends users back to the page that started the flow.
|
|
4
4
|
*/
|
|
@@ -13,5 +13,4 @@ function createOAuthHandler() {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { createOAuthHandler };
|
package/dist/server/proxy.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/server/proxy.d.ts
|
|
2
1
|
declare const methods: readonly ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
3
2
|
type Handler = (req: Request) => Promise<Response>;
|
|
4
3
|
type OriginMatcher = string | RegExp;
|
|
@@ -30,5 +29,4 @@ export interface CreateProxyOptions {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
export declare function createProxy(options?: CreateProxyOptions): Proxy;
|
|
33
|
-
//#endregion
|
|
34
32
|
export {};
|
package/dist/server/proxy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/server/proxy.ts
|
|
2
2
|
const methods = [
|
|
3
3
|
"GET",
|
|
4
4
|
"POST",
|
|
@@ -61,6 +61,7 @@ function createProxy(options = {}) {
|
|
|
61
61
|
let method = initial.method;
|
|
62
62
|
let url = new URL(initial.url);
|
|
63
63
|
const headers = new Headers(initial.headers);
|
|
64
|
+
headers.delete("content-length");
|
|
64
65
|
let body = initial.body && methodsWithBody.has(method.toUpperCase()) ? await initial.arrayBuffer() : void 0;
|
|
65
66
|
for (let redirects = 0; redirects <= maxRedirects; redirects++) {
|
|
66
67
|
const response = await send(url, {
|
|
@@ -87,7 +88,6 @@ function createProxy(options = {}) {
|
|
|
87
88
|
case 303:
|
|
88
89
|
method = "GET";
|
|
89
90
|
body = void 0;
|
|
90
|
-
headers.delete("content-length");
|
|
91
91
|
headers.delete("content-type");
|
|
92
92
|
}
|
|
93
93
|
url = next;
|
|
@@ -171,8 +171,13 @@ let publicFetch;
|
|
|
171
171
|
*/
|
|
172
172
|
async function createPublicFetch() {
|
|
173
173
|
if ("Bun" in globalThis) throw new ProxyError("Private networks cannot be blocked on Bun, specify `allowedOrigins`.", 500);
|
|
174
|
+
const key = Symbol.for("undici.globalDispatcher.1");
|
|
175
|
+
const builtin = Reflect.get(globalThis, key);
|
|
174
176
|
const [{ Agent, fetch }, dns, { BlockList, isIP }] = await Promise.all([
|
|
175
|
-
import("undici")
|
|
177
|
+
import("undici").then((undici) => {
|
|
178
|
+
Reflect.set(globalThis, key, builtin);
|
|
179
|
+
return undici;
|
|
180
|
+
}),
|
|
176
181
|
import("node:dns"),
|
|
177
182
|
import("node:net")
|
|
178
183
|
]);
|
|
@@ -196,5 +201,4 @@ async function createPublicFetch() {
|
|
|
196
201
|
});
|
|
197
202
|
};
|
|
198
203
|
}
|
|
199
|
-
//#endregion
|
|
200
204
|
export { createProxy };
|
package/dist/types/openapi.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types/openapi.d.ts
|
|
2
1
|
/** Original copy: https://github.com/scalar/scalar/blob/main/packages/openapi-types/src/openapi-types.ts
|
|
3
2
|
* - Removed Record<string, unknown> fallbacks
|
|
4
3
|
*/
|
|
@@ -897,5 +896,4 @@ export type IJsonSchema = {
|
|
|
897
896
|
oneOf?: IJsonSchema[];
|
|
898
897
|
not?: IJsonSchema;
|
|
899
898
|
$ref?: string;
|
|
900
|
-
};
|
|
901
|
-
//#endregion
|
|
899
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3, OpenAPIV3_2 } from "./types/openapi.js";
|
|
2
2
|
import { InlineCodeUsageGenerator } from "./requests/generators/index.js";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
export type Document = OpenAPIV3_2.Document;
|
|
5
4
|
export type OperationObject = OpenAPIV3_2.OperationObject & {
|
|
6
5
|
'x-codeSamples'?: InlineCodeUsageGenerator[];
|
|
@@ -23,5 +22,4 @@ export type ExampleObject = OpenAPIV3_2.ExampleObject;
|
|
|
23
22
|
export type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
|
|
24
23
|
export type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
|
|
25
24
|
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
26
|
-
export type Awaitable<T> = T | Promise<T>;
|
|
27
|
-
//#endregion
|
|
25
|
+
export type Awaitable<T> = T | Promise<T>;
|
package/dist/ui/base.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { OpenAPIPageProps } from "../utils/pages/builder.js";
|
|
2
2
|
import { CreateOpenAPIPageOptions } from "./index.js";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
//#region src/ui/base.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
|
|
7
6
|
*/
|
|
8
|
-
export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
package/dist/ui/base.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRenderer } from "../utils/create-page.js";
|
|
|
3
3
|
import { Schema } from "../packages/shared-api/dist/components/schema/index.js";
|
|
4
4
|
import { Operation } from "./operation/index.js";
|
|
5
5
|
import { jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/ui/base.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
|
|
9
9
|
*/
|
|
@@ -24,5 +24,4 @@ function Layout({ operations, webhooks }) {
|
|
|
24
24
|
children: [operations?.map((item) => item.children), webhooks?.map((item) => item.children)]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createOpenAPIPageBase };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/codeblock.tsx
|
|
5
5
|
function ClientCodeBlock(props) {
|
|
6
6
|
const { CodeBlock } = useComponents();
|
|
7
7
|
return /* @__PURE__ */ jsx(CodeBlock, { ...props });
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { ClientCodeBlock };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MethodLabel } from "./method-label.js";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/endpoint.tsx
|
|
5
5
|
function EndpointBar({ method, route, deprecated = false, children, ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
7
|
...props,
|
|
@@ -36,5 +36,4 @@ function Route({ route, ...props }) {
|
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { EndpointBar };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/ui/components/heading.tsx
|
|
6
6
|
/**
|
|
7
7
|
* A heading of the page, `id` is resolved against the anchor sections it is under.
|
|
8
8
|
*/
|
|
@@ -13,5 +13,4 @@ function Heading({ id, ...props }) {
|
|
|
13
13
|
...props
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { Heading };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/markdown.tsx
|
|
5
5
|
function Markdown({ md }) {
|
|
6
6
|
const { Markdown: Comp } = useComponents();
|
|
7
7
|
return /* @__PURE__ */ jsx(Comp, { md });
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { Markdown };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Badge } from "../../packages/shared-api/dist/components/badge.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/ui/components/method-label.tsx
|
|
4
4
|
function getMethodColor(method) {
|
|
5
5
|
switch (method.toUpperCase()) {
|
|
6
6
|
case "PUT": return "yellow";
|
|
@@ -17,5 +17,4 @@ function MethodLabel({ children, ...props }) {
|
|
|
17
17
|
children: children.toUpperCase()
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { MethodLabel };
|
|
@@ -3,7 +3,7 @@ import { useComponents, useRenderContext } from "../../utils/create-page.js";
|
|
|
3
3
|
import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/ui/components/schema.tsx
|
|
7
7
|
/**
|
|
8
8
|
* The Schema UI of the page, with the anchor ID of the root schema resolved.
|
|
9
9
|
*/
|
|
@@ -24,5 +24,4 @@ function SchemaUI({ client, ...props }) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { SchemaUI };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec } from "../utils/pages/builder.js";
|
|
2
2
|
import { CreateOpenAPIRendererOptions } from "../utils/create-page.js";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
//#region src/ui/index.d.ts
|
|
5
4
|
export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOptions, 'components'> {
|
|
6
5
|
/**
|
|
7
6
|
* Replace parts of the UI, e.g. the ones installed with Fumadocs CLI.
|
|
@@ -12,5 +11,4 @@ export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOpti
|
|
|
12
11
|
* Create `<OpenAPIPage />` (a client component).
|
|
13
12
|
*/
|
|
14
13
|
export declare function createOpenAPIPage(options?: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
15
|
-
//#endregion
|
|
16
14
|
export type { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec };
|
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createOpenAPIPageBase } from "./base.js";
|
|
3
3
|
import { defaultShikiFactory } from "fumadocs-core/highlight/shiki/full";
|
|
4
|
-
|
|
4
|
+
// src/ui/index.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Create `<OpenAPIPage />` (a client component).
|
|
7
7
|
*/
|
|
@@ -11,5 +11,4 @@ function createOpenAPIPage(options = {}) {
|
|
|
11
11
|
shiki: options.shiki ?? defaultShikiFactory
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { createOpenAPIPage };
|
|
@@ -22,7 +22,7 @@ import { ChevronRight, Plus, X } from "lucide-react";
|
|
|
22
22
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
23
23
|
import { Dialog } from "@base-ui/react/dialog";
|
|
24
24
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
25
|
-
|
|
25
|
+
// src/ui/operation/index.tsx
|
|
26
26
|
function Operation({ type, path, method, operation, pathItem, ...props }) {
|
|
27
27
|
return /* @__PURE__ */ jsx(OperationProvider, {
|
|
28
28
|
type,
|
|
@@ -88,7 +88,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
88
88
|
children: /* @__PURE__ */ jsx(MediaContent, {
|
|
89
89
|
schema: content.schema,
|
|
90
90
|
required: requestBody.required,
|
|
91
|
-
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
91
|
+
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
92
|
+
"aria-label": t("Media type"),
|
|
93
|
+
items
|
|
94
|
+
}),
|
|
92
95
|
request: true
|
|
93
96
|
})
|
|
94
97
|
}, mediaType))
|
|
@@ -153,7 +156,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
153
156
|
className: "overflow-hidden rounded-xl border bg-fd-card",
|
|
154
157
|
children: [/* @__PURE__ */ jsx("div", {
|
|
155
158
|
className: "flex h-9 items-center border-b ps-1.5 pe-1 text-[0.8125rem] not-prose",
|
|
156
|
-
children: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
159
|
+
children: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
160
|
+
"aria-label": t("Security scheme"),
|
|
161
|
+
items
|
|
162
|
+
})
|
|
157
163
|
}), security.map((requirement, i) => /* @__PURE__ */ jsx(SelectTab, {
|
|
158
164
|
value: items[i].value,
|
|
159
165
|
className: "px-3",
|
|
@@ -326,6 +332,7 @@ function ResponseSection({ responses, headingLevel }) {
|
|
|
326
332
|
});
|
|
327
333
|
}
|
|
328
334
|
function ResponseContent({ item: { status, response, content }, onLink }) {
|
|
335
|
+
const t = useTranslations({ note: "operation page" });
|
|
329
336
|
const segments = ["response", status];
|
|
330
337
|
const ref = useAnchorLink(segments, onLink);
|
|
331
338
|
const contentTypes = Object.entries(content);
|
|
@@ -348,7 +355,10 @@ function ResponseContent({ item: { status, response, content }, onLink }) {
|
|
|
348
355
|
anchorSegments: [mediaType],
|
|
349
356
|
children: /* @__PURE__ */ jsx(MediaContent, {
|
|
350
357
|
schema: media.schema,
|
|
351
|
-
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
358
|
+
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
359
|
+
"aria-label": t("Media type"),
|
|
360
|
+
items
|
|
361
|
+
})
|
|
352
362
|
})
|
|
353
363
|
}, mediaType))]
|
|
354
364
|
})
|
|
@@ -496,5 +506,4 @@ function Callback({ item, path, headingLevel }) {
|
|
|
496
506
|
})]
|
|
497
507
|
});
|
|
498
508
|
}
|
|
499
|
-
//#endregion
|
|
500
509
|
export { Operation };
|
|
@@ -12,7 +12,7 @@ import { getRaw } from "@scalar/json-magic/magic-proxy";
|
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useTranslations } from "@fuma-translate/react";
|
|
14
14
|
import { Switch } from "@base-ui/react/switch";
|
|
15
|
-
|
|
15
|
+
// src/ui/operation/usage-tabs.tsx
|
|
16
16
|
function UsageTabs() {
|
|
17
17
|
const ctx = useRenderContext();
|
|
18
18
|
const t = useTranslations({ note: "operation page" });
|
|
@@ -38,6 +38,7 @@ function UsageTabs() {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
function UsageTabsSelector() {
|
|
41
|
+
const t = useTranslations({ note: "operation page" });
|
|
41
42
|
const { items, selected, select } = useExampleRequests();
|
|
42
43
|
function renderItem(item) {
|
|
43
44
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
@@ -58,6 +59,7 @@ function UsageTabsSelector() {
|
|
|
58
59
|
value: selected,
|
|
59
60
|
onValueChange: (v) => v !== null && select(v),
|
|
60
61
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
62
|
+
"aria-label": t("Example request"),
|
|
61
63
|
className: "not-prose mb-4 rounded-xl bg-fd-card px-3",
|
|
62
64
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
63
65
|
}), /* @__PURE__ */ jsx(SelectContent, { children: options.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
@@ -69,6 +71,7 @@ function UsageTabsSelector() {
|
|
|
69
71
|
const storageKey = "fumadocs_openapi_requests";
|
|
70
72
|
/** the code usages of the selected example request, with a select of their languages */
|
|
71
73
|
function CodeUsages({ title, selectExample = false, className, viewportClassName }) {
|
|
74
|
+
const t = useTranslations({ note: "operation page" });
|
|
72
75
|
const generators = useOperation().codeUsages.map();
|
|
73
76
|
const examples = useExampleRequests();
|
|
74
77
|
const selected = useCodeUsageId(storageKey);
|
|
@@ -92,13 +95,15 @@ function CodeUsages({ title, selectExample = false, className, viewportClassName
|
|
|
92
95
|
})),
|
|
93
96
|
value: example.id,
|
|
94
97
|
onValueChange: examples.select,
|
|
98
|
+
"aria-label": t("Example request"),
|
|
95
99
|
align: "start",
|
|
96
100
|
className: "-ms-2 max-w-full text-fd-foreground"
|
|
97
101
|
}) : title,
|
|
98
102
|
Actions: exampleActions(/* @__PURE__ */ jsx(ExampleSelect, {
|
|
99
103
|
items,
|
|
100
104
|
value: id,
|
|
101
|
-
onValueChange: (value) => selectCodeUsage(storageKey, value)
|
|
105
|
+
onValueChange: (value) => selectCodeUsage(storageKey, value),
|
|
106
|
+
"aria-label": t("Code language")
|
|
102
107
|
})),
|
|
103
108
|
className: cn(exampleCodeBlock.className, className),
|
|
104
109
|
viewportProps: { className: viewportClassName }
|
|
@@ -143,6 +148,7 @@ function ResponseTabsDefaultContent({ tabs }) {
|
|
|
143
148
|
})),
|
|
144
149
|
value: String(index),
|
|
145
150
|
onValueChange: (v) => setIndex(Number(v)),
|
|
151
|
+
"aria-label": t("Example"),
|
|
146
152
|
align: "start",
|
|
147
153
|
className: "-ms-2"
|
|
148
154
|
}), example.description && /* @__PURE__ */ jsx("div", {
|
|
@@ -183,7 +189,8 @@ function ResponseTabsDefaultContent({ tabs }) {
|
|
|
183
189
|
onValueChange: (v) => {
|
|
184
190
|
setCode(v);
|
|
185
191
|
setIndex(0);
|
|
186
|
-
}
|
|
192
|
+
},
|
|
193
|
+
"aria-label": t("Response status")
|
|
187
194
|
})]
|
|
188
195
|
}), body]
|
|
189
196
|
});
|
|
@@ -226,7 +233,8 @@ function RequestTabsDefaultContent() {
|
|
|
226
233
|
label: item.id === "_default" ? t("Default") : item.name
|
|
227
234
|
})),
|
|
228
235
|
value: item.id,
|
|
229
|
-
onValueChange: select
|
|
236
|
+
onValueChange: select,
|
|
237
|
+
"aria-label": t("Example request")
|
|
230
238
|
})
|
|
231
239
|
}),
|
|
232
240
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -266,5 +274,4 @@ function RequestTabsDefaultContent() {
|
|
|
266
274
|
]
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
|
-
//#endregion
|
|
270
277
|
export { CodeUsages, RequestTabs, UsageTabs };
|