@redocly/redoc 0.137.0-next.6 → 0.137.0-next.7
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 +9 -0
- package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
- package/dist/client/templates/api-docs/helpers.d.ts +4 -1
- package/dist/client/templates/api-docs/helpers.js +5 -1
- package/dist/client/templates/api-docs/template.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/config/env-config.d.ts +2 -0
- package/dist/server/config/env-schema.d.ts +5 -0
- package/dist/server/config/env-schemas/feature-flags.d.ts +4 -0
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/esbuild/esbuild.js +3 -3
- package/dist/server/esbuild/plugins/mcp-tool-handlers-resolver.js +1 -1
- package/dist/server/plugins/api-docs/options.js +1 -1
- package/dist/server/plugins/{openapi-docs/is-openapi-doc.d.ts → api-docs/utils/is-api-doc.d.ts} +4 -2
- package/dist/server/plugins/api-docs/utils/is-api-doc.js +1 -0
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +4 -4
- package/dist/server/plugins/mcp/codemode/code-execution-telemetry.d.ts +3 -1
- package/dist/server/plugins/mcp/codemode/code-execution-telemetry.js +1 -1
- package/dist/server/plugins/mcp/codemode/invoke-tool.js +1 -1
- package/dist/server/plugins/mcp/codemode/prompts.js +1 -1
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/fetch-shim.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills/fetch-shim.js +9 -3
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
- package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +1 -1
- package/dist/server/plugins/mcp/codemode/types.d.ts +1 -0
- package/dist/server/plugins/mcp/constants.d.ts +1 -0
- package/dist/server/plugins/mcp/constants.js +1 -1
- package/dist/server/plugins/mcp/custom-tools/extract-tool-definition.d.ts +13 -0
- package/dist/server/plugins/mcp/custom-tools/extract-tool-definition.js +1 -0
- package/dist/server/plugins/mcp/custom-tools/scan-custom-tools.d.ts +6 -0
- package/dist/server/plugins/mcp/custom-tools/scan-custom-tools.js +1 -0
- package/dist/server/plugins/mcp/custom-tools/validate-tool-definition.d.ts +3 -0
- package/dist/server/plugins/mcp/custom-tools/validate-tool-definition.js +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +2 -0
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +2 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/callable-apis.d.ts +10 -0
- package/dist/server/plugins/mcp/gateway-mcp/callable-apis.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.d.ts +1 -9
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +6 -1
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/servers/mcp-server.js +3 -3
- package/dist/server/plugins/mcp/types.d.ts +29 -3
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.d.ts +4 -0
- package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +1 -0
- package/dist/server/plugins/mcp/utils/find-gated-tool-names.d.ts +2 -3
- package/dist/server/plugins/mcp/utils/find-gated-tool-names.js +1 -1
- package/dist/server/plugins/mcp/utils/mcp-client.d.ts +13 -0
- package/dist/server/plugins/mcp/utils/mcp-client.js +1 -0
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.d.ts +6 -1
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/mcp/workers/import-mcp-tool-handlers.d.ts +5 -0
- package/dist/server/plugins/mcp/workers/import-mcp-tool-handlers.js +1 -0
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +6 -11
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
- package/dist/server/plugins/mcp/workers/tool-file-system.d.ts +6 -0
- package/dist/server/plugins/mcp/workers/tool-file-system.js +1 -0
- package/dist/server/sandbox/sandbox.js +2 -2
- package/dist/server/sandbox/utils/returns-from-top-level.d.ts +4 -0
- package/dist/server/sandbox/utils/returns-from-top-level.js +1 -0
- package/dist/server/store.d.ts +1 -0
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +2 -1
- package/dist/server/web-server/routes/resolve-route.js +1 -1
- package/dist/server/web-server/utils/get-request-origin.d.ts +2 -0
- package/dist/server/web-server/utils/get-request-origin.js +1 -1
- package/dist/server/workers/mcp-tool-worker-pool.d.ts +1 -0
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker.js +1 -1
- package/dist/server/workers/types.d.ts +9 -2
- package/dist/server/workers/worker-pool.d.ts +1 -0
- package/dist/server/workers/worker-pool.js +1 -1
- package/dist/utils/guards/is-plain-object.d.ts +19 -0
- package/dist/utils/guards/is-plain-object.js +1 -0
- package/package.json +3 -6
- package/dist/client/templates/asyncapi-docs/helpers.d.ts +0 -12
- package/dist/client/templates/asyncapi-docs/helpers.js +0 -1
- package/dist/client/templates/asyncapi-docs/template.d.ts +0 -15
- package/dist/client/templates/asyncapi-docs/template.js +0 -9
- package/dist/client/templates/openapi-docs/helpers.d.ts +0 -18
- package/dist/client/templates/openapi-docs/helpers.js +0 -5
- package/dist/client/templates/openapi-docs/template.d.ts +0 -6
- package/dist/client/templates/openapi-docs/template.js +0 -14
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +0 -9
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +0 -1
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +0 -2
- package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +0 -1
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +0 -6
- package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-check.d.ts +0 -8
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-check.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-overlay.d.ts +0 -2
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-overlay.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-use-license-key.d.ts +0 -5
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/empty-use-license-key.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/index.d.ts +0 -6
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/index.js +0 -1
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/loadAndBundleSpec.mock.d.ts +0 -3
- package/dist/server/esbuild/plugins/openapi-docs-module-replacer/loadAndBundleSpec.mock.js +0 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.d.ts +0 -18
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.js +0 -5
- package/dist/server/plugins/asyncapi-docs/get-server-props.d.ts +0 -4
- package/dist/server/plugins/asyncapi-docs/get-server-props.js +0 -1
- package/dist/server/plugins/asyncapi-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/asyncapi-docs/get-template-path.js +0 -1
- package/dist/server/plugins/asyncapi-docs/index.d.ts +0 -3
- package/dist/server/plugins/asyncapi-docs/index.js +0 -1
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.d.ts +0 -3
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.d.ts +0 -9
- package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +0 -56
- package/dist/server/plugins/asyncapi-docs/search/schema-processor.d.ts +0 -8
- package/dist/server/plugins/asyncapi-docs/search/schema-processor.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/search-facets.d.ts +0 -8
- package/dist/server/plugins/asyncapi-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/asyncapi-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/asyncapi-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/asyncapi-docs/store-definition-bundles.d.ts +0 -4
- package/dist/server/plugins/asyncapi-docs/store-definition-bundles.js +0 -1
- package/dist/server/plugins/graphql-docs/constants.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/constants.js +0 -1
- package/dist/server/plugins/graphql-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/get-template-path.js +0 -1
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.d.ts +0 -17
- package/dist/server/plugins/graphql-docs/graphql-doc-loader.js +0 -1
- package/dist/server/plugins/graphql-docs/index.d.ts +0 -4
- package/dist/server/plugins/graphql-docs/index.js +0 -1
- package/dist/server/plugins/graphql-docs/is-graphql-doc.d.ts +0 -2
- package/dist/server/plugins/graphql-docs/is-graphql-doc.js +0 -1
- package/dist/server/plugins/graphql-docs/search/ai/get-ai-search-document.d.ts +0 -17
- package/dist/server/plugins/graphql-docs/search/ai/get-ai-search-document.js +0 -4
- package/dist/server/plugins/graphql-docs/search/ai/utils.d.ts +0 -14
- package/dist/server/plugins/graphql-docs/search/ai/utils.js +0 -36
- package/dist/server/plugins/graphql-docs/search/search-facets.d.ts +0 -8
- package/dist/server/plugins/graphql-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/graphql-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/graphql-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/graphql-docs/spec-download.api.d.ts +0 -3
- package/dist/server/plugins/graphql-docs/spec-download.api.js +0 -1
- package/dist/server/plugins/graphql-docs/template/GraphQLDocs.d.ts +0 -5
- package/dist/server/plugins/graphql-docs/template/GraphQLDocs.js +0 -4
- package/dist/server/plugins/graphql-docs/types.d.ts +0 -40
- package/dist/server/plugins/graphql-docs/types.js +0 -0
- package/dist/server/plugins/openapi-docs/ai-search-indexer.d.ts +0 -14
- package/dist/server/plugins/openapi-docs/ai-search-indexer.js +0 -1
- package/dist/server/plugins/openapi-docs/decorators.d.ts +0 -25
- package/dist/server/plugins/openapi-docs/decorators.js +0 -1
- package/dist/server/plugins/openapi-docs/format-bundle-error.d.ts +0 -6
- package/dist/server/plugins/openapi-docs/format-bundle-error.js +0 -5
- package/dist/server/plugins/openapi-docs/get-server-props.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/get-server-props.js +0 -1
- package/dist/server/plugins/openapi-docs/get-template-path.d.ts +0 -2
- package/dist/server/plugins/openapi-docs/get-template-path.js +0 -1
- package/dist/server/plugins/openapi-docs/index.d.ts +0 -3
- package/dist/server/plugins/openapi-docs/index.js +0 -1
- package/dist/server/plugins/openapi-docs/is-openapi-doc.js +0 -1
- package/dist/server/plugins/openapi-docs/load-definition.d.ts +0 -31
- package/dist/server/plugins/openapi-docs/load-definition.js +0 -3
- package/dist/server/plugins/openapi-docs/openapi-search-builder.d.ts +0 -24
- package/dist/server/plugins/openapi-docs/openapi-search-builder.js +0 -1
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.d.ts +0 -18
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +0 -94
- package/dist/server/plugins/openapi-docs/search/search-facets.d.ts +0 -11
- package/dist/server/plugins/openapi-docs/search/search-facets.js +0 -1
- package/dist/server/plugins/openapi-docs/search/search-resolver.d.ts +0 -5
- package/dist/server/plugins/openapi-docs/search/search-resolver.js +0 -1
- package/dist/server/plugins/openapi-docs/search-indexer.d.ts +0 -17
- package/dist/server/plugins/openapi-docs/search-indexer.js +0 -1
- package/dist/server/plugins/openapi-docs/spec-download.api.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/spec-download.api.js +0 -1
- package/dist/server/plugins/openapi-docs/store-definition-bundles.d.ts +0 -4
- package/dist/server/plugins/openapi-docs/store-definition-bundles.js +0 -1
- package/dist/server/plugins/openapi-docs/types.d.ts +0 -17
- package/dist/server/plugins/openapi-docs/types.js +0 -0
- package/dist/server/plugins/openapi-docs/utils.d.ts +0 -25
- package/dist/server/plugins/openapi-docs/utils.js +0 -1
- /package/dist/client/templates/{openapi-docs → api-docs}/mock-server-config.d.ts +0 -0
- /package/dist/client/templates/{openapi-docs → api-docs}/mock-server-config.js +0 -0
- /package/dist/{server/plugins → markdoc}/helpers/parse-partials.d.ts +0 -0
- /package/dist/{server/plugins → markdoc}/helpers/parse-partials.js +0 -0
- /package/dist/server/plugins/{openapi-docs → api-docs/utils}/ast-utils.d.ts +0 -0
- /package/dist/server/plugins/{openapi-docs → api-docs/utils}/ast-utils.js +0 -0
|
@@ -128,10 +128,10 @@ export type McpToolSchema = {
|
|
|
128
128
|
schema: Record<string, unknown>;
|
|
129
129
|
outputSchema?: Record<string, unknown>;
|
|
130
130
|
annotations?: ToolAnnotations;
|
|
131
|
+
hasAvailabilityGate?: boolean;
|
|
131
132
|
};
|
|
132
133
|
export type McpToolRegistration = McpToolSchema & {
|
|
133
134
|
importPath: string;
|
|
134
|
-
hasAvailabilityGate?: boolean;
|
|
135
135
|
};
|
|
136
136
|
export type MiddlewareDetails = {
|
|
137
137
|
id: string;
|
|
@@ -164,6 +164,7 @@ export type ProcessContentActions = {
|
|
|
164
164
|
addApiRoute: (route: ApiRoute) => void;
|
|
165
165
|
addMcpTools: (importPath: string, tools: McpToolSchema[]) => void;
|
|
166
166
|
getMcpTools: () => McpToolRegistration[];
|
|
167
|
+
removeMcpTools: (names: string[]) => void;
|
|
167
168
|
createRequestHandler: (id: string, importPath: string) => void;
|
|
168
169
|
clearRequestHandlersByPrefix: (prefix: string) => void;
|
|
169
170
|
addRedirect: (from: string, to: RedirectConfig, options?: RedirectOptions) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Source as P}from"@redocly/openapi-core";import y from"node:fs/promises";import S from"node:path";import{withPathPrefix as j,getPathPrefix as h,combineUrls as w}from"@redocly/theme/core/utils";import{API_DOCS_SHARED_DATA_PREFIX as d}from"../../constants/plugins/api-docs.js";import{CATALOG_BASE_SLUG as b,CATALOG_SLUGS as $}from"../../../constants/catalog-entities.js";import{CATALOG_ENTITIES_FILES_REGEX as I}from"../../constants/plugins/catalog-entities.js";import{removeTrailingSlash as E}from"../../../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as N}from"../../../utils/path/normalize-route-slug.js";import{promiseMapLimit as T}from"../../utils/async/promise-map-limit.js";import{getRoutesByLines as L,getPointerPosition as U}from"../../plugins/
|
|
1
|
+
import{Source as P}from"@redocly/openapi-core";import y from"node:fs/promises";import S from"node:path";import{withPathPrefix as j,getPathPrefix as h,combineUrls as w}from"@redocly/theme/core/utils";import{API_DOCS_SHARED_DATA_PREFIX as d}from"../../constants/plugins/api-docs.js";import{CATALOG_BASE_SLUG as b,CATALOG_SLUGS as $}from"../../../constants/catalog-entities.js";import{CATALOG_ENTITIES_FILES_REGEX as I}from"../../constants/plugins/catalog-entities.js";import{removeTrailingSlash as E}from"../../../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as N}from"../../../utils/path/normalize-route-slug.js";import{promiseMapLimit as T}from"../../utils/async/promise-map-limit.js";import{getRoutesByLines as L,getPointerPosition as U}from"../../plugins/api-docs/utils/ast-utils.js";import{readSharedData as m}from"../../utils/index.js";const q=new Set(["openapi","asyncapi"]);function K(n){return async t=>{const i=await t.req.json(),r=decodeURI(E(i.split("?")[0])),[o]=r.split("#"),g=h(),f=N(o.slice(g.length)),u=f.startsWith(b)?b:f,e=n.getRouteBySlug(u);if(e){const p=n.getRouteByFsPath(e.fsPath);if(p?.metadata?.type&&q.has(p.metadata.type)){const a=await m(`${d}${e.fsPath}`,n.outdir);if(!a?.routesMapping)return t.json({route:e},200);const s=Object.keys(a.routesMapping).find(c=>w(e.baseSlug,a.routesMapping[c])===r);if(!a.sourcePath)return t.json({route:e},200);let l;if(s){const c=S.join(n.contentDir,e.fsPath),R=await y.readFile(c,"utf-8"),_=new P(c,R);l=U(s,_)}return t.json({route:{fsPath:e.fsPath,pointer:s,position:l}},200)}if(p?.metadata?.type==="graphql"){const a=await m(`${d}${e.fsPath}`,n.outdir);if(!a?.graphqlPositions)return t.json({route:e},200);const s=Object.keys(a.graphqlPositions).find(c=>w(e.baseSlug,c)===r),l=s?a.graphqlPositions[s].position:void 0;return t.json({route:{fsPath:e.fsPath,position:l}},200)}}return t.json({route:e},200)}}function X(n){return async t=>{const i=await t.req.json(),r=await T(i,5,async o=>A(o,n));return t.json({routes:r},200)}}function Y(n){return async t=>{const i=await t.req.json(),r=await A(i,n);return t.json(r,200)}}function J(n){return async t=>{const i=(t.req.query("lines")||"").split(",").map(f=>parseInt(f)),r=t.req.query("file");if(!r)return t.json("No data",400);const o=await m(`${d}${r}`,n.outdir),g=S.join(n.contentDir,r);try{const f=await y.readFile(g,"utf-8");if(!o)return t.json("No data",400);const u=new P(g,f),e=L(i,u,o.routesMapping,o.baseSlug);return t.json(e,200)}catch{return t.json("No data",400)}}}async function A(n,t){const[i,r]=n.split(":");if(I.test(i))return{route:{slug:`${b}/${$.ALL}`}};let o=t.getRouteByFsPath(i);if(o?.metadata?.type&&q.has(o.metadata.type)){const u=await m(`${d}${i}`,t.outdir);if(u?.sourcePath){const e=S.join(t.contentDir,o.fsPath),p=await y.readFile(e,"utf-8"),a=new P(e,p),s=L([parseInt(r,10)],a,u.routesMapping,o.baseSlug);if(s.length)return{route:{slug:h()?j(s[0]):s[0],filePath:n}}}}if(o?.metadata?.type==="graphql"){const u=await m(`${d}${i}`,t.outdir),e=parseInt(r,10);if(u?.sourcePath&&u.graphqlPositions&&!Number.isNaN(e)){let p,a=1/0;for(const[s,{startLine:l,endLine:c}]of Object.entries(u.graphqlPositions))l<=e&&e<=c&&c-l<a&&(a=c-l,p=s);if(p){const s=w(o.baseSlug,p);return{route:{slug:h()?j(s):s,filePath:n}}}}}const g=o?.slug?h()?j(o?.slug):o?.slug:"";return{route:{...o,pageName:o?await o?.getNavText?.():"",slug:g,filePath:n}}}export{J as getRoutesByLineHandler,Y as resolvePathHandler,X as resolvePathsHandler,K as resolveSlugHandler};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Context } from 'hono';
|
|
2
2
|
export declare function getRequestOrigin(ctx: Context): string;
|
|
3
|
+
/** Request-based counterpart of `getRequestOrigin`; the same trust caveat applies. */
|
|
3
4
|
export declare function getForwardedOrigin(request: Request): string;
|
|
5
|
+
export declare function getInternalOrigin(request: Request): string | undefined;
|
|
4
6
|
//# sourceMappingURL=get-request-origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{envConfig as i}from"../../config/env-config.js";const c=["localhost","127.0.0.1","::1","[::1]"];function n(o){return o?.split(",")[0].trim()||void 0}const a=/^(?:[A-Za-z0-9._-]+|\[[0-9A-Fa-f:.]+\])(?::\d{1,5})?$/;function s(o){const t=n(o);return t&&a.test(t)?t:void 0}function d(o){const t=n(o)?.toLowerCase();return t==="http"||t==="https"?t:void 0}function p(o){const t=o.replace(/:\d+$/,"");return c.includes(t)||t.endsWith(".localhost")}function h(o){const t=new URL(o.req.url),r=d(o.req.header("x-forwarded-proto"))||t.protocol.slice(0,-1)||"https",e=s(o.req.header("x-forwarded-host"))||t.host;return`${r}://${e}`}function u(o){const t=new URL(o.url),r=s(o.headers.get("x-forwarded-host"))||t.host;return`${d(o.headers.get("x-forwarded-proto"))||(p(r)?"http":"https")}://${r}`}function l(o){const t=o.context?.remoteAddr?.port??i.PORT;return t?`http://127.0.0.1:${t}`:void 0}export{u as getForwardedOrigin,l as getInternalOrigin,h as getRequestOrigin};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WorkerPool } from './worker-pool.js';
|
|
2
2
|
export declare const MCP_TOOL_WORKER_KEY = "executeMcpTool";
|
|
3
3
|
export declare const MCP_TOOL_IS_AVAILABLE_KEY = "isMcpToolAvailable";
|
|
4
|
+
export declare const MCP_TOOL_AVAILABILITY_KEY = "mcpToolAvailability";
|
|
4
5
|
export declare const mcpToolWorkers: WorkerPool;
|
|
5
6
|
//# sourceMappingURL=mcp-tool-worker-pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAllowedEnvs as o}from"../utils/envs/get-api-route-allowed-env-variables.js";import{WorkerPool as r}from"./worker-pool.js";const p="executeMcpTool",
|
|
1
|
+
import{getAllowedEnvs as o}from"../utils/envs/get-api-route-allowed-env-variables.js";import{WorkerPool as r}from"./worker-pool.js";const p="executeMcpTool",l="isMcpToolAvailable",c="mcpToolAvailability",e=5,i=new r({workerScript:"./mcp-tool-worker",minWorkers:1,maxWorkers:e,workerType:"process",forkOpts:{stdio:"inherit"},resolveForkEnv:o,lazy:!0,sandbox:!0});export{c as MCP_TOOL_AVAILABILITY_KEY,l as MCP_TOOL_IS_AVAILABLE_KEY,p as MCP_TOOL_WORKER_KEY,i as mcpToolWorkers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"workerpool";import{executeMcpTool as r,isMcpToolAvailable as _}from"../plugins/mcp/workers/execute-mcp-tool.js";import{MCP_TOOL_IS_AVAILABLE_KEY as
|
|
1
|
+
import o from"workerpool";import{executeMcpTool as r,isMcpToolAvailable as _,mcpToolAvailability as i}from"../plugins/mcp/workers/execute-mcp-tool.js";import{MCP_TOOL_AVAILABILITY_KEY as l,MCP_TOOL_IS_AVAILABLE_KEY as A,MCP_TOOL_WORKER_KEY as m}from"./mcp-tool-worker-pool.js";o.worker({[m]:r,[A]:_,[l]:i});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ApiRoutesWorkerParams, ApiRoutesWorkerResponse } from '../types/plugins/api-routes.js';
|
|
2
2
|
import type { RenderPayload } from '../../types/ssr.js';
|
|
3
3
|
import type { ScorecardsWorkerParams, ScorecardsWorkerResponse } from '../types/plugins/scorecards.js';
|
|
4
|
-
import type { McpToolExecutionParams, McpToolWorkerResponse } from '../plugins/mcp/types.js';
|
|
4
|
+
import type { McpToolContext, McpToolExecutionParams, McpToolWorkerResponse } from '../plugins/mcp/types.js';
|
|
5
5
|
import type { SCORECARDS_WORKER_KEY } from './scorecards-worker-pool.js';
|
|
6
6
|
import type { API_ROUTES_WORKER_KEY } from './api-routes-worker-pool.js';
|
|
7
7
|
import type { SSR_WORKER_KEY } from './ssr-worker-pool.js';
|
|
8
|
-
import type { MCP_TOOL_IS_AVAILABLE_KEY, MCP_TOOL_WORKER_KEY } from './mcp-tool-worker-pool.js';
|
|
8
|
+
import type { MCP_TOOL_AVAILABILITY_KEY, MCP_TOOL_IS_AVAILABLE_KEY, MCP_TOOL_WORKER_KEY } from './mcp-tool-worker-pool.js';
|
|
9
9
|
export type SsrWorkerResponse = {
|
|
10
10
|
html: string;
|
|
11
11
|
statusCode: 200 | 500;
|
|
@@ -32,6 +32,13 @@ export type WorkerTypeMapping = {
|
|
|
32
32
|
params: [Omit<McpToolExecutionParams, 'args' | 'extra'>];
|
|
33
33
|
response: boolean;
|
|
34
34
|
};
|
|
35
|
+
[MCP_TOOL_AVAILABILITY_KEY]: {
|
|
36
|
+
params: [{
|
|
37
|
+
toolNames: string[];
|
|
38
|
+
context: McpToolContext;
|
|
39
|
+
}];
|
|
40
|
+
response: Record<string, boolean>;
|
|
41
|
+
};
|
|
35
42
|
};
|
|
36
43
|
export type WorkerParams<T extends keyof WorkerTypeMapping> = WorkerTypeMapping[T]['params'];
|
|
37
44
|
export type WorkerResponse<T extends keyof WorkerTypeMapping> = WorkerTypeMapping[T]['response'];
|
|
@@ -7,6 +7,7 @@ export type WorkerPoolConfig = {
|
|
|
7
7
|
resolveForkEnv?: () => Record<string, string | undefined>;
|
|
8
8
|
} & WorkerPoolOptions;
|
|
9
9
|
type RegisteredWorkers = keyof WorkerTypeMapping;
|
|
10
|
+
export declare const workerBaseDir: string;
|
|
10
11
|
export declare class WorkerPool {
|
|
11
12
|
#private;
|
|
12
13
|
constructor(config: WorkerPoolConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import l from"workerpool";import{mkdirSync as m}from"node:fs";import{basename as u,dirname as c,resolve as
|
|
1
|
+
import l from"workerpool";import{mkdirSync as m}from"node:fs";import{basename as u,dirname as c,resolve as p}from"node:path";import{fileURLToPath as f}from"node:url";import{envConfig as n}from"../config/env-config.js";import{SandboxContext as v}from"../utils/sandbox-context.js";const h=(()=>{const o=c(f(import.meta.url));return u(o)==="chunks"?c(o):o})();class P{#t=null;#r;constructor(r){this.#r=r,this.#r.lazy||(this.#t=this.#e())}#e(){const{workerScript:r,lazy:t,sandbox:i,resolveForkEnv:s,...e}=this.#r,a=this.#s(r);return s&&e.forkOpts&&(e.forkOpts={...e.forkOpts,env:s()}),this.#o(i)?l.pool(a,{...e,forkOpts:this.#i(e.forkOpts)}):l.pool(a,{...e})}#o(r){return!!r&&n.isReunite&&n.REDOCLY_DISABLE_API_FUNCTION_SANDBOX!==!0}#i(r){const t=v.resolve(h);try{m(t.tmpDir,{recursive:!0})}catch{}return{...r,cwd:t.serverOutDir,execArgv:[...t.execArgv,...r?.execArgv??[]],env:{...r?.env,...t.env}}}#s(r){let t=r;return!t.endsWith(".js")&&!t.endsWith(".mjs")&&(t=`${t}.${n.isDevelopMode?"js":"mjs"}`),t.startsWith(".")?p(h,t):t}#n(){return this.#t||(this.#t=this.#e()),this.#t}async exec(r,t,i){let e=this.#n().exec(r,t);return i?.timeout&&(e=e.timeout(i.timeout)),await e}async terminate(){this.#t&&(await this.#t.terminate(),this.#t=null)}}export{P as WorkerPool,h as workerBaseDir};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether a value is a non-null, non-array object.
|
|
3
|
+
*
|
|
4
|
+
* Unlike `isObject`, class instances pass: the check guards shape
|
|
5
|
+
* (keyed properties), not prototype purity.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The value to check.
|
|
8
|
+
* @returns True if the value is a non-null, non-array object.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* isPlainObject({}); // true
|
|
13
|
+
* isPlainObject(new Date()); // true
|
|
14
|
+
* isPlainObject([]); // false
|
|
15
|
+
* isPlainObject(null); // false
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
19
|
+
//# sourceMappingURL=is-plain-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}export{t as isPlainObject};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/redoc",
|
|
3
|
-
"version": "0.137.0-next.
|
|
3
|
+
"version": "0.137.0-next.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -93,11 +93,8 @@
|
|
|
93
93
|
"xpath": "0.0.34",
|
|
94
94
|
"yaml-ast-parser": "0.0.43",
|
|
95
95
|
"zod": "^3.25.76",
|
|
96
|
-
"@redocly/api-docs": "0.2.0-next.
|
|
97
|
-
"@redocly/
|
|
98
|
-
"@redocly/config": "0.54.0",
|
|
99
|
-
"@redocly/graphql-docs": "1.14.0-next.6",
|
|
100
|
-
"@redocly/openapi-docs": "3.25.0-next.6",
|
|
96
|
+
"@redocly/api-docs": "0.2.0-next.7",
|
|
97
|
+
"@redocly/config": "0.55.0",
|
|
101
98
|
"@redocly/portal-legacy-ui": "0.19.0",
|
|
102
99
|
"@redocly/portal-plugin-mock-server": "0.22.0-next.6",
|
|
103
100
|
"@redocly/realm-asyncapi-sdk": "0.15.0-next.3",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PageProps } from '@redocly/config';
|
|
2
|
-
export declare function useCollectMarkdocOptions({ markdown }: PageProps): {
|
|
3
|
-
variables?: Record<string, any>;
|
|
4
|
-
tags: {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
};
|
|
7
|
-
nodes: any;
|
|
8
|
-
functions: any;
|
|
9
|
-
components: any;
|
|
10
|
-
partials: Record<string, import("@markdoc/markdoc").Node[] | import("@markdoc/markdoc").Node> | undefined;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useMemo as t}from"react";import{components as m}from"@redocly-markdoc/components";import{schema as s}from"@redocly-markdoc/schema";import{tags as r,components as n}from"@redocly/theme/markdoc/default";import*as a from"../../app/markdoc/custom-components/index.js";import*as e from"../../../markdoc/nodes/index.js";import p from"../../../markdoc/tags/index.js";import{normalizeCustomTags as i}from"../../../markdoc/helpers/normalize-custom-tags.js";import{parsePartials as c}from"../../templates/openapi-docs/helpers.js";function O({markdown:o}){return t(()=>({tags:{...p,...r,...i(s?.tags??{})},nodes:{...e,...s?.nodes??{}},functions:{...s?.functions??{}},components:{...a,...n,...m,...globalThis.__LOADER.markdocComponents},...o,partials:c(o?.partials)}),[o])}export{O as useCollectMarkdocOptions};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { LayoutVariant } from '@redocly/theme/components/SidebarActions/SidebarActions';
|
|
3
|
-
type TemplateProps = {
|
|
4
|
-
pageProps: {
|
|
5
|
-
apiOptions: {
|
|
6
|
-
layout: LayoutVariant;
|
|
7
|
-
};
|
|
8
|
-
settings: {
|
|
9
|
-
baseUrlPath: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export default function AsyncApiDocs({ pageProps }: TemplateProps): React.JSX.Element;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import m from"styled-components";import*as t from"react";import{RedoclyAsyncAPIDocs as d}from"@redocly/asyncapi-docs";import{withPathPrefix as r}from"@redocly/theme/core/utils";import{ServerRoutes as p}from"../../../constants/api.js";import{CLIENT_TELEMETRY_ENABLED as f}from"../../constants/common.js";import{PACKAGE_NAME as E}from"../../../config/product-gates";import{usePageSharedData as A}from"../../providers/page-data/hooks";import{useCollectMarkdocOptions as h}from"./helpers.js";function u({pageProps:o}){const e=A("AsyncApiDefinition"),{document:i,apiItems:a,protocol:n,downloadUrls:s}=e,c=r(o?.settings?.baseUrlPath),l=h(o);return t.createElement(g,null,t.createElement(d,{pageProps:o,document:i,apiItems:a,routingBasePath:c,protocol:n,downloadUrls:s,markdocOptions:l,telemetryConfig:{collectorUrl:new URL(r(p.OTEL_TRACES),location.origin).toString(),disabled:!f,serviceVersion:`${E}@${process.env.REDOCLY_PORTAL_VERSION}`}}))}const g=m.div`
|
|
2
|
-
a[id],
|
|
3
|
-
a[data-section-id],
|
|
4
|
-
div[data-section-id] {
|
|
5
|
-
scroll-margin-top: calc(var(--navbar-height) + var(--banner-height) + var(--panel-gap-vertical));
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
--sidebar-width: 0px;
|
|
9
|
-
`;export{u as default};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type Node } from '@markdoc/markdoc';
|
|
2
|
-
import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
3
|
-
import type { OpenAPIDefinition } from '@redocly/openapi-docs';
|
|
4
|
-
import type { EventType } from '@redocly/openapi-docs/src/events/types';
|
|
5
|
-
import type { RedocConfig, PageProps } from '@redocly/config';
|
|
6
|
-
type EventFunctionInput = string | ((event: EventType) => void) | undefined;
|
|
7
|
-
type OpenAPIDocsStore = {
|
|
8
|
-
definition: OpenAPIDefinition;
|
|
9
|
-
options: RedocConfig;
|
|
10
|
-
basePath?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function joinWithSeparator(base?: string, path?: string, sep?: string): string;
|
|
13
|
-
export declare function parsePartials(partials?: Record<string, any>): Record<string, Node[] | Node> | undefined;
|
|
14
|
-
export declare function usePatchedStore(storeJs: OpenAPIDocsStore, { markdown, baseSlug }: PageProps): OpenAPIDocsStore;
|
|
15
|
-
export declare function safeParseFunction(fnInput: EventFunctionInput): ((event: EventType) => void) | null;
|
|
16
|
-
export declare function mergeEvents(userFunction: ((event: EventType) => void) | null, telemetryEvent?: AsyncApiRealmUI.GetEventData<'com.redocly.openapiDocs.interacted'>[0]['eventType']): (event: EventType) => void;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{useMemo as f}from"react";import{components as g}from"@redocly-markdoc/components";import{schema as c}from"@redocly-markdoc/schema";import{Ast as d}from"@markdoc/markdoc";import{PageNavigation as h}from"@redocly/theme/components/PageNavigation/PageNavigation";import{tags as _,components as y}from"@redocly/theme/markdoc/default";import{Breadcrumbs as P}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as m,getBaseDataAttributes as w}from"@redocly/theme/core/utils";import{ServerRoutes as u}from"../../../constants/api.js";import{OPENAPI_DOCS_TEMPLATE_ID as S}from"../../../constants/common.js";import{isBrowser as O}from"../../../utils/env/is-browser.js";import*as v from"../../../markdoc/nodes/index.js";import C from"../../../markdoc/tags/index.js";import{normalizeCustomTags as T}from"../../../markdoc/helpers/normalize-custom-tags.js";import*as A from"../../app/markdoc/custom-components/index.js";import{usePageData as x,useSidebarSiblingsData as D}from"../../providers/page-data/hooks";import{telemetry as E}from"../../app/telemetry/index.js";import{getMockServerDocsConfig as R}from"./mock-server-config.js";function Z(o="",r="",t="/"){return o.endsWith(t)&&(o=o.slice(0,-t.length)),r.startsWith(t)&&(r=r.slice(t.length)),!o||!r?o+r:o+t+r}function b(o){if(o)return Object.entries(o).reduce((r,[t,n])=>(r[t]=d.fromJSON(JSON.stringify(n)),r),{})}function G(o,{markdown:r,baseSlug:t}){return f(()=>{const i=O();if(o.options.oAuth2RedirectURI=i?`${window.location.origin}${m(u.REPLAY_OAUTH2_CALLBACK)}`:void 0,o.options.routingBasePath=m(t),o.options.mockServer=R(o.options.mockServer,t),o.options.corsProxyUrl===void 0){const e=m(`${u.CORS_PROXY}/`);o.options.corsProxyUrl=i?new URL(e,window.location.origin).toString():e}o.options.scrollYOffset=i?parseInt(getComputedStyle(document.documentElement).getPropertyValue("--navbar-height"),10):0,o.options.markdocOptions={tags:{...C,..._,...T(c?.tags??{})},nodes:{...v,...c?.nodes??{}},functions:{...c?.functions??{}},components:{...A,...y,...g,...globalThis.__LOADER.markdocComponents},...r,partials:b(r?.partials)},o.options.unstable_hooks={...o.options.unstable_hooks,MiddlePanelFooter:()=>{const{templateId:e}=x()||{},{nextPage:s,prevPage:a}=D()||{};return e===S?null:h({nextPage:s,prevPage:a})},MiddlePanelHeader:()=>P({})};const l={codeSamplesLanguageSwitch:"samples_language_switch",codeSamplesCopy:"code_samples_copy",panelToggle:"panel_toggle",targetServerSwitch:"target_server_switch",tryItOpen:"try_it_toggle",tryItSent:"try_it_sent"},p={};for(const[e,s]of Object.entries(l)){const a=I(o.options.events?.[e]);p[e]=U(a,s)}return o.options.events=p,o},[o,r,t])}function I(o){if(typeof window>"u")return null;if(typeof o=="function")return o;if(typeof o!="string")return null;try{const r=o.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(i=>r.includes(i)))throw new Error("Function contains prohibited keywords");return new Function("event",`
|
|
2
|
-
'use strict';
|
|
3
|
-
const userFn = ${r};
|
|
4
|
-
return userFn(event);
|
|
5
|
-
`)}catch(r){return console.error("Function parsing error:",r),null}}function U(o,r){return t=>{if(o)try{o(t)}catch(n){console.error("User event handler error:",n)}if(r)try{E.sendOpenapiDocsMessage([{...w("openapiDocsInteraction","openapiDocs"),eventType:r,operationHttpVerb:t.operationHttpVerb,operationPath:t.operationPath,lang:"lang"in t?t.lang:void 0,action:t.action,state:"state"in t?t.state:void 0,serverUrl:"serverUrl"in t?t.serverUrl:void 0}])}catch{}}}export{Z as joinWithSeparator,U as mergeEvents,b as parsePartials,I as safeParseFunction,G as usePatchedStore};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import*as o from"react";import i from"styled-components";import{RedoclyOpenAPIDocs as m}from"@redocly/openapi-docs";import{LayoutVariant as c}from"@redocly/config";import{CLIENT_TELEMETRY_ENABLED as s}from"../../constants/common.js";import{ThreePanelLayout as p}from"@redocly/theme/layouts/ThreePanelLayout";import{CatalogClassicInfoBlock as f}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{withPathPrefix as h}from"@redocly/theme/core/utils";import{useUserClaims as d}from"../../app/hooks";import{ServerRoutes as u}from"../../../constants/api.js";import{PACKAGE_NAME as E}from"../../../config/product-gates";import{usePageSharedData as v}from"../../providers/page-data/hooks";import{usePatchedStore as g}from"./helpers.js";function y({pageProps:t}){const r=d(),e=v("openAPIDocsStore"),n=o.useMemo(()=>({layout:t.apiOptions?.layout,userClaims:r}),[t.apiOptions?.layout,r]),a=g(e,t);if(!e)return"Something went wrong";const l=t.apiOptions?.layout;return o.createElement(A,null,o.createElement(S,{layout:l},o.createElement(f,{metadata:t.metadata})),o.createElement(m,{store:{options:a.options,definition:a.definition,withState:n},telemetryConfig:{collectorUrl:new URL(h(u.OTEL_TRACES),location.origin).toString(),disabled:!s,serviceVersion:`${E}@${process.env.REDOCLY_PORTAL_VERSION}`}}))}const S=i(p)`
|
|
2
|
-
&& {
|
|
3
|
-
padding-right: ${({layout:t})=>t===c.THREE_PANEL?"calc(var(--panel-gap-horizontal) * 2)":"var(--panel-gap-horizontal)"};
|
|
4
|
-
}
|
|
5
|
-
`,A=i.div`
|
|
6
|
-
div[id] {
|
|
7
|
-
scroll-margin-top: calc(var(--navbar-height) + var(--banner-height) - var(--panel-gap-vertical));
|
|
8
|
-
}
|
|
9
|
-
a[id] {
|
|
10
|
-
scroll-margin-top: calc(var(--navbar-height) + var(--banner-height) + var(--panel-gap-vertical));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
--sidebar-width: 0px;
|
|
14
|
-
`;export{y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return{licenseInfo:{allowed:!0,valid:!0},isValid:!0,isPending:!1}}export{e as useLicense};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return null}export{e as LicenseOverlay};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as o}from"module";const s=o(import.meta.url),t=()=>({name:"esbuild-redocly-api-docs-module-replacer",setup:r=>{r.onResolve({filter:/\/hooks\/useLicense\.js$/},async e=>{if(e.resolveDir.endsWith("/api-docs/lib"))return{path:s.resolve("./empty-check.js")}}),r.onResolve({filter:/\/components\/LicenseOverlay\.js$/},async e=>{if(e.resolveDir.endsWith("/api-docs/lib"))return{path:s.resolve("./empty-overlay.js")}})}});export{t as ApiDocsModuleReplacer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return{licenseInfo:{allowed:!0,valid:!0},isValid:!0}}export{e as useLicense};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const n=function(){return null};export{n as Overlay};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return{isValid:!0,loading:!1}}export{e as useLicenseKey};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as r}from"module";const o=r(import.meta.url),c=()=>({name:"esbuild-redocly-openapi-docs-module-replacer",setup:e=>{e.onResolve({filter:/\.[\/\\]Overlay.js$/},async s=>{if(s.resolveDir.endsWith("openapi-docs/lib/components/RedoclyOpenAPIDocs"))return{path:o.resolve("./empty-overlay.js")}}),e.onResolve({filter:/(.*)\/hooks\/useLicense.js$/},async s=>{if(s.resolveDir.endsWith("openapi-docs/lib/components/RedoclyOpenAPIDocs"))return{path:o.resolve("./empty-check.js")}}),e.onResolve({filter:/shared\/license\/use-license-key/},async()=>({path:o.resolve("./empty-use-license-key.js")}))}});export{c as OpenapiDocsModuleReplacer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(){}function e(){}export{e as convertSwagger2OpenAPI,n as loadAndBundleDefinition};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AsyncApiDefinition, AsyncApiDefinitionReferenced } from '@redocly/asyncapi-docs';
|
|
2
|
-
import type { MarkdocChunk } from '../openapi-docs/load-definition.js';
|
|
3
|
-
import type { RedoclyConfig } from '@redocly/config';
|
|
4
|
-
import type { LifecycleContext } from '../../types';
|
|
5
|
-
export type BundledDefinition = {
|
|
6
|
-
document: AsyncApiDefinition;
|
|
7
|
-
documentWithReferences: AsyncApiDefinitionReferenced;
|
|
8
|
-
config: Partial<RedoclyConfig & NonNullable<RedoclyConfig['apis']>[string]>;
|
|
9
|
-
customOutputRelativeFile: string | undefined;
|
|
10
|
-
markdocChunks: MarkdocChunk[];
|
|
11
|
-
realRelativePath: string;
|
|
12
|
-
relativePath: string;
|
|
13
|
-
isVirtual: boolean;
|
|
14
|
-
hash: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function asyncapiDocLoader(relativePath: string, { fs, logger, cache, getConfig, isPathIgnored }: LifecycleContext): Promise<Omit<BundledDefinition, 'hash'>[]>;
|
|
17
|
-
export declare function asyncapiDocsLoader(_: string, context: LifecycleContext): Promise<BundledDefinition[]>;
|
|
18
|
-
//# sourceMappingURL=asyncapi-doc-loader.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import s from"node:path";import{bundle as R,createConfig as B,getTotals as J}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as L}from"../../../constants/common.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as W}from"../get-api-config.js";import{injectDecoratorIntoConfig as _}from"../openapi-docs/decorators.js";import{ExternalResolver as T}from"../../fs/utils/external-ref-resolver.js";async function Z(n,{fs:o,logger:f,cache:u,getConfig:p,isPathIgnored:d}){let a;try{a=(await u.load(n,"yaml")).data}catch{return[]}if(!a?.asyncapi)return f.verbose(`${n} file is not AsyncAPI document. Skipping`),[];const l=[],e=o.getFileInfo(n),t=await p(s.posix.dirname(n)),A=W(t?.apis,n,t.configPath),D=await d(n);for(const c of A){if(!c.output&&D)continue;const O=t.configPath?s.posix.dirname(t.configPath):".",r=c.output?s.posix.join(O,c.output):n;if(await d(r))continue;e&&c.output&&!await o.exists(r)&&o.addVirtualFile(r,e);const m=M(t,{rbac:void 0},c),k=s.resolve(o.cwd,t.realConfigPath||L),w=new T(o),v=await B(_(m,r,o.cwd),{configPath:k,externalRefResolver:w}),h=s.resolve(o.cwd,n),g={config:v,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(a))}},{bundle:{parsed:I},problems:y,visitorsData:N}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:P}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(a))}}),S=N["markdown/markdown"]?.markdocChunks??[],i=J(y);let b=[i.errors&&`${i.errors} ${$(i.errors,"error","errors")}`,i.warnings&&`${i.warnings} ${$(i.warnings,"warning","warnings")}`,i.ignored&&`${i.ignored} ignored`].filter(Boolean).join(", ");if(i.errors){const C=y.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${r} definition.
|
|
2
|
-
|
|
3
|
-
${C?.message} at ${C?.location?.[0].pointer}
|
|
4
|
-
|
|
5
|
-
`)}i.warnings&&f.warn(`${b} while bundling %rp definition`,r);const V=x(I,t.metadata),j=x(P,t.metadata),E={document:V,documentWithReferences:j,config:m,relativePath:r,realRelativePath:e?.realRelativePath||r,customOutputRelativeFile:c.output&&r,markdocChunks:S,isVirtual:e?.isVirtual??!1};l.push(E)}return l}async function nn(n,o){const{fs:f,cache:u,getConfig:p}=o,d=[];for(const a of await f.scan(/(\.ya?ml|\.json)$/)){if(!await p(s.posix.dirname(a.relativePath)))continue;let e;try{e=await u.load(a.relativePath,"asyncapi-doc")}catch{continue}e.data?.length&&d.push(...e.data.map(t=>({...t,isVirtual:a.isVirtual||t.isVirtual,hash:e.compoundHash})))}return d}function x(n,o){return o?{...n,info:{...n.info,"x-metadata":{...n.info["x-metadata"],...o}}}:n}export{Z as asyncapiDocLoader,nn as asyncapiDocsLoader};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getPublicEnvVariables as n}from"../../utils/envs/get-public-env-variables.js";const l=async({fsPath:r,slug:e},t,{partials:a,variables:i},o)=>{const s=o.getPartialsForRoute?.(e)||a;return{definitionId:r,...t.props,markdown:{partials:s,variables:{...i,env:n()}}}};var d=l;export{d as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fromCurrentDir as t}from"../../utils/paths.js";function m(r){return t(import.meta.url,r)}export{m as getTemplatePath};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import A from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as R}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getRouteSlugsForPath as F}from"../utils.js";import{getTemplatePath as b}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as N,asyncapiDocsLoader as j}from"./asyncapi-doc-loader.js";import{searchResolver as L}from"./search/search-resolver.js";import{getAiDocumentsStore as G}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as M}from"../../../cli/telemetry/helpers/trace-step.js";const _="asyncapi-docs-";async function ot(d){let p=[],u=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":N,"asyncapi-docs":j},processContent:async(e,o)=>{await M("com.redocly.build.plugin.asyncapiDocs",async()=>{if((await o.getConfig()).plugins?.some(l=>l.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const c=e.createTemplate(v,b("../../../client/templates/asyncapi-docs/template.js")),g=e.registerServerPropsGetter(v,b("./get-server-props.js"));for(const l of await o.fs.scan(/(\.ya?ml|\.json)$/))if(!await o.isPathIgnored(l.relativePath))try{const{data:r,compoundHash:w}=await o.cache.load(l.realRelativePath,"asyncapi-doc");if(!r?.length)continue;p=r.map(({markdocChunks:t,relativePath:s,isVirtual:m,customOutputRelativeFile:f,realRelativePath:y})=>({chunks:t,relativePath:s,realRelativePath:y,isVirtual:f!=null||l.isVirtual||m})),O(r,e.outdir,w);for(const t of r){const s=`${_}${t.relativePath}`,m=T(t.document),{navItems:f,apiItems:y}=$({asyncApiDoc:t.document,protocol:m||""}),I=[{url:D(R,`${C(t.relativePath,".json")}?download`)},{url:D(R,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(s,{document:t.document,apiItems:y,protocol:m,downloadUrls:I}),f.forEach(i=>{const n={fsPath:t.relativePath,slugSuffix:`/${i.link}`,templateId:c,sharedData:[{key:"AsyncApiDefinition",id:s}],getStaticData:S(o.withPathPrefix,i.label),serverPropsGetterIds:[g]};e.addRoute(n),i.items&&i.items.forEach(a=>{e.addRoute({...n,slugSuffix:`/${a.link}`,getStaticData:S(o.withPathPrefix,a.label)}),a.items&&a.items.forEach(h=>{e.addRoute({...n,slugSuffix:`/${h.link}`,getStaticData:S(o.withPathPrefix,a.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:c,hasClientRoutes:!0,getSidebar:i=>{const n=a=>{const h={...a};return a.link&&(h.routeSlug=D(i.slug,a.link),h.link=D(i.slug,a.link)),a.items&&(h.items=a.items.map(n)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:i.slug,link:i.slug},...f.map(n)]},getSearchDocuments:L(e,t.document),getStaticData:S(o.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:G({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:s}]})}}catch(r){console.error(r)}})},afterRoutesCreated:async(e,o)=>{const P=new Set;for(const{chunks:c,relativePath:g,isVirtual:l,realRelativePath:r}of p){const w=F(e.getAllRoutes(),g),t=(await o.cache.load(r,"asyncapi-doc")).compoundHash;await o.cache.load(g,{loader:async function(){for(const{node:m,markdown:f,pointer:y,key:I,relativePath:i}of c){const{ast:n}=await e.parseMarkdoc({input:{content:f,relativePath:y,isVirtual:l},context:o,deps:{sharedDataIds:[`${_}${i}`],routeSlugs:w}});m[`x-parsed-md-${I}`]={result:E(n)}}},name:"asyncapi-markdoc-inline-parser"},[t]);for(const{pointer:s}of c)P.add(s)}const k=u.difference(P);for(const c of k)o.cache.delete(c);u=P}}}function S(d,p){return async function(u,e){return{props:{settings:{baseUrlPath:d(u.baseSlug)},disableAutoScroll:!0,seo:{title:p}}}}}function C(d,p){const u=A.posix.dirname(d),e=A.posix.basename(d,A.posix.extname(d))+p;return A.posix.join(u,e)}export{ot as asyncAPIDocsPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import f from"node:path";import{CONFIG_FILE_NAME as n}from"../../../constants/common.js";const o=async(a,r)=>{if(!a.match(/(\.ya?ml|\.json)$/)||f.posix.basename(a)===n||await r.isPathIgnored(a))return!1;const s=r.fs.getFileInfo(a);if(!s)return!1;try{const{data:e}=await r.cache.load(s.realRelativePath,"yaml");return!!e?.asyncapi}catch{return!1}};export{o as isAsyncapiDoc};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AsyncApiDefinition } from '@redocly/asyncapi-docs';
|
|
2
|
-
import type { PageRouteDetails, ProcessContentActions, AfterRoutesCreatedLifecycleContext } from '../../../types';
|
|
3
|
-
import type { AiDocumentsStore } from '../../../plugins/search/types.js';
|
|
4
|
-
export declare const getAiDocumentsStore: ({ actions, document, metadata, }: {
|
|
5
|
-
actions: ProcessContentActions;
|
|
6
|
-
document: AsyncApiDefinition;
|
|
7
|
-
metadata: Record<string, unknown>;
|
|
8
|
-
}) => (route: PageRouteDetails, _staticData: unknown, context: AfterRoutesCreatedLifecycleContext) => Promise<AiDocumentsStore | undefined>;
|
|
9
|
-
//# sourceMappingURL=get-ai-search-documents.d.ts.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import{basename as S}from"node:path";import{REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{isResourcePubliclyAccessible as C}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as A}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{getLocaleFromRelativePath as L}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as j}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as d}from"./schema-processor.js";import{llmsTxtLink as k}from"../../search/llmstxt/index.js";const Z=({actions:n,document:e,metadata:i})=>async(t,s,r)=>{const a=t.getSidebar?.(t)||[],c=await r.getConfig(),{allSearchDocuments:o,publiclyAccessibleSearchDocuments:l}=b(t,a,e,n,i,c);if(o.length)return{async getLLMsTxts(){return l.map(f=>({slug:f.url,fsPath:t.fsPath,title:f.title,content:f.content,includeInLLMsTxt:f.includeInLLMsTxt}))},async getSearchDocuments(){return o}}};function b(n,e,i,t,s,r,a){const c=[],o=[];for(const l of e){if(l.type==="group"){const h=l.apiItemData?.type==="channel"?l:a,{allSearchDocuments:D,publiclyAccessibleSearchDocuments:P}=b(n,l.items||[],i,t,s,r,h);c.push(...D),o.push(...P)}const f=I(n,l,i,t,s,r);f&&(c.push(f),B(l,r,a)&&o.push(f))}return{allSearchDocuments:c,publiclyAccessibleSearchDocuments:o}}function I(n,e,i,t,s,r){const a=F(e,i);if(!a)return null;const c=e.link||"",o=e.httpVerb||"",l=L(n.fsPath),f=j(t,s),h=M(n,e,i,a,o,c,r);return{url:c||n.slug,fsPath:n.fsPath,content:h.trim(),title:m(a.title||"")||S(n.fsPath),locale:l,product:n.product?.name,facets:f,includeInLLMsTxt:!e.apiItemData}}function M(n,e,i,t,s,r,a){let c="";const o=m(t.title||""),l=m(t.description||"")+m(t.summary||"");return o&&(c+=`# ${o}
|
|
2
|
-
|
|
3
|
-
`),l&&(c+=`${l}
|
|
4
|
-
|
|
5
|
-
`),s&&(c+=`Method: ${s.toUpperCase()}
|
|
6
|
-
`),c+=O(i),c+=v(i),e.type==="link"&&!e.apiItemData&&(c+=T(n,a)),e.apiItemData?.type==="channel"&&(c+=x(e,i,r,n)),e.apiItemData?.type==="operation"&&(c+=N(e,i)),c}function O(n){let e="";return n.info?.version&&(e+=`Version: ${n.info.version}
|
|
7
|
-
`),n.info?.license?.name&&(e+=`License: ${n.info.license.name}
|
|
8
|
-
`),e}function v(n){if(!n.servers||Object.keys(n.servers).length===0)return"";let e=`
|
|
9
|
-
## Servers
|
|
10
|
-
|
|
11
|
-
`;for(const[i,t]of Object.entries(n.servers))e+=`### ${i}
|
|
12
|
-
`,t.description&&(e+=`${t.description}
|
|
13
|
-
`),e+=`Host: ${t.host}
|
|
14
|
-
`,e+=`Protocol: ${t.protocol}
|
|
15
|
-
`,t.protocolVersion&&(e+=`Protocol Version: ${t.protocolVersion}
|
|
16
|
-
`),t.pathname&&(e+=`Path: ${t.pathname}
|
|
17
|
-
`),e+=`
|
|
18
|
-
`;return e}function T(n,e){const i=n.getSidebar?.(n)||[],t=$(i,e);if(Object.keys(t).length===0)return"";let s="";for(const[,r]of Object.entries(t))if(r.length>0)for(const a of r){const c=a.label||"Untitled",o=a.link||a.routeSlug||"";s+=`#### ${c}
|
|
19
|
-
|
|
20
|
-
`,o&&(s+=` - ${k({title:c,description:void 0,slug:A(o)})}
|
|
21
|
-
|
|
22
|
-
`)}return s}function x(n,e,i,t){const s=n.apiItemData?.id;if(!s)return"";const r=e.channels?.[s];if(!r)return"";let a="";if(r.parameters&&Object.keys(r.parameters).length>0){a+=`## Parameters
|
|
23
|
-
|
|
24
|
-
`;for(const[c,o]of Object.entries(r.parameters))a+=`### ${c}
|
|
25
|
-
`,typeof o=="object"&&o!==null&&"description"in o&&o.description&&(a+=`${o.description}
|
|
26
|
-
`),typeof o=="object"&&o!==null&&"enum"in o&&Array.isArray(o.enum)&&o.enum.length>0&&(a+=`Enum: ${o.enum.join(", ")}
|
|
27
|
-
`),typeof o=="object"&&o!==null&&"default"in o&&o.default&&(a+=`Default: ${o.default}
|
|
28
|
-
`),a+=`
|
|
29
|
-
`}if(r.messages&&Object.keys(r.messages).length>0){a+=`## Messages
|
|
30
|
-
|
|
31
|
-
`;for(const[c,o]of Object.entries(r.messages))a+=R(o,c,i,t)}return a}function R(n,e,i,t){let r=`### ${n.title||n.name||e}
|
|
32
|
-
`;if(n.description&&(r+=`${n.description}
|
|
33
|
-
`),n.summary&&(r+=`${n.summary}
|
|
34
|
-
`),n.payload){const a=d(n.payload,"message payload",i.replace(t.slug+"/","").replace(/^\//,""),e);a.length>0&&(r+=`
|
|
35
|
-
#### Payload Schema
|
|
36
|
-
|
|
37
|
-
`,r+=g(a))}if(n.headers){const a=d(n.headers,"message headers",i.replace(t.slug+"/","").replace(/^\//,""),e);a.length>0&&(r+=`
|
|
38
|
-
#### Headers Schema
|
|
39
|
-
|
|
40
|
-
`,r+=g(a))}return r}function g(n){let e="";for(const i of n)if(typeof i=="object"&&i!==null&&"name"in i&&"type"in i){const t=i;e+=`- **${t.name}** (${t.type}${t.required?", required":""})
|
|
41
|
-
`,t.description&&(e+=` ${t.description}
|
|
42
|
-
`),t.enum&&Array.isArray(t.enum)&&t.enum.length>0&&(e+=` Enum: ${t.enum.join(", ")}
|
|
43
|
-
`),e+=`
|
|
44
|
-
`}return e}function N(n,e){const i=n.apiItemData?.id;if(!i)return"";const t=e.operations?.[i];if(!t)return"";let s=`## Operation Details
|
|
45
|
-
|
|
46
|
-
`;if(t.action&&(s+=`Action: ${t.action}
|
|
47
|
-
`),t.description&&(s+=`${t.description}
|
|
48
|
-
`),t.summary&&(s+=`${t.summary}
|
|
49
|
-
`),t.messages&&t.messages.length>0){s+=`
|
|
50
|
-
### Messages
|
|
51
|
-
|
|
52
|
-
`;for(const r of t.messages){const a=r.title||r.name||"Message";s+=`#### ${a}
|
|
53
|
-
`,r.description&&(s+=`${r.description}
|
|
54
|
-
`),r.summary&&(s+=`${r.summary}
|
|
55
|
-
`),s+=`
|
|
56
|
-
`}}return s}function $(n,e){const i={};for(const t of n)t.type==="group"?t.apiItemData?.type==="channel"?q(t,i,e):V(t,i,e):t.apiItemData?.type==="channel"&&E(t,i,e);return i}function q(n,e,i){const t=n.label||"Channel";if(p(u(n),i)&&(e[t]||(e[t]=[]),e[t].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&p(u(s),i)&&e[t].push(s)}function V(n,e,i){if(n.items){const t=$(n.items,i);for(const[s,r]of Object.entries(t))e[s]||(e[s]=[]),e[s].push(...r)}}function E(n,e,i){const t=n.label||"Channel";if(p(u(n),i)&&(e[t]||(e[t]=[]),e[t].push(n),n.items))for(const s of n.items)s.apiItemData?.type==="operation"&&p(u(s),i)&&e[t].push(s)}function F(n,e){const{apiItemData:i,type:t}=n;return i?.type?w(i,e):t==="link"?_(e):null}function w(n,e){switch(n.type){case"channel":return e.channels?.[n.id]||null;case"operation":return e.operations?.[n.id]||null;default:return null}}function _(n){return{description:n.info?.description||"",title:n.info?.title||"",summary:""}}function B(n,e,i){const t=p(u(n),e);if(n.apiItemData?.type==="operation"&&i){const s=p(u(i),e);return t&&s}return t}function u(n){return{slug:n.link||"",[y]:n[y]}}function p(n,e){return e.access?.requiresLogin?!0:C(n,e)}export{Z as getAiDocumentsStore};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { OperationParameter } from '@redocly/theme/core/types';
|
|
2
|
-
export type SchemaProcessorOptions = {
|
|
3
|
-
basePath?: string;
|
|
4
|
-
mediaType?: string;
|
|
5
|
-
messageKey?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function processSchema(schema: any | undefined, place: string, basePath: string, messageKey?: string): OperationParameter[];
|
|
8
|
-
//# sourceMappingURL=schema-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{removeMarkdownLinks as j}from"../../openapi-docs/utils.js";function w(t,n,o,i){if(!t)return[];const e={};return l(e,t,n,o,i),Object.values(e)}function l(t,n,o,i,e,f=[]){if(!(!n||n.type==="null")){if(n.type==="object"&&n.properties){for(const[r,u]of Object.entries(n.properties))if(typeof u=="object"&&u!==null){const d=f.concat([r]),p=n.required?.includes(r)||!1,y=c(r,u,o,d,p,i,e),O=A(y);if(t[O]!==void 0)continue;t[O]=y,l(t,u,o,i,e,d)}}if(n.type==="array"&&n.items&&typeof n.items=="object"&&n.items!==null&&l(t,n.items,o,i,e,f),n.oneOf&&Array.isArray(n.oneOf))for(const r of n.oneOf)typeof r=="object"&&r!==null&&l(t,r,o,i,e,f);if(n.anyOf&&Array.isArray(n.anyOf))for(const r of n.anyOf)typeof r=="object"&&r!==null&&l(t,r,o,i,e,f);if(n.allOf&&Array.isArray(n.allOf))for(const r of n.allOf)typeof r=="object"&&r!==null&&l(t,r,o,i,e,f)}}function c(t,n,o,i,e,f,r){const u=S(n),d=j(n.description||""),p=n.example,y=n.enum;return{name:t,description:d,place:o,mediaType:void 0,path:i.slice(0,-1),type:u||"unknown",required:e,example:p?JSON.stringify(p):void 0,enum:y?.length?y:void 0,deepLink:k(i,o,f,r)}}function S(t){return t.type?Array.isArray(t.type)?t.type.filter(n=>n!=="null").join(" | "):t.type:t.properties?"object":t.items?"array":t.enum?"enum":t.format?t.format:"unknown"}function A(t){return`${t.name}${t.description}${t.place}`}function k(t,n,o,i){let e="",f="";n==="message headers"?f="headers":n==="message payload"&&(f="payload"),t.length>0&&(e=t.join("/"));let r=`#${o}/messages`;return i&&(r+=`&m=${i.toLowerCase()}`),f&&(r+=`&t=${f}`),e&&(r+=`&path=${e.toLowerCase()}`),r}export{w as processSchema};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ProcessContentActions } from '../../../types';
|
|
2
|
-
export declare function setDocumentSearchFacets(actions: ProcessContentActions, documentSearchFacets: {
|
|
3
|
-
[key: string]: string | Set<string>;
|
|
4
|
-
}): void;
|
|
5
|
-
export declare function extractDocumentSearchFacets(actions: ProcessContentActions, metadata?: Record<string, unknown>): {
|
|
6
|
-
[key: string]: string;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=search-facets.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SEARCH_GROUP_FACET_FIELD as f}from"../../../../constants/common.js";import{SEARCH_GROUP_NAME_API as u}from"../../../constants/plugins/search.js";function h(r,a){const e=r.getSearchFacets();for(const[s,t]of Object.entries(a)){const c=e.get(s);if(c){const o=new Set(c.values??[]);t instanceof Set?[...t].forEach(n=>c.values=Array.from(o.add(n))):c.values=Array.from(o.add(t))}}r.setSearchFacets(e)}function F(r,a){const e={[f]:u};if(!a)return e;const s=r.getSearchFacets();for(const[t,c]of Object.entries(a))s.has(t)&&(e[t]=String(c));return e}export{F as extractDocumentSearchFacets,h as setDocumentSearchFacets};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PageStaticData } from '@redocly/config';
|
|
2
|
-
import type { AsyncApiDefinition } from '@redocly/asyncapi-docs';
|
|
3
|
-
import type { PageRouteDetails, ProcessContentActions, SearchDocument } from '../../../types';
|
|
4
|
-
export declare function searchResolver(actions: ProcessContentActions, document: AsyncApiDefinition): (route: PageRouteDetails, staticData: PageStaticData) => Promise<SearchDocument[]>;
|
|
5
|
-
//# sourceMappingURL=search-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as D,REDOCLY_TEAMS_RBAC as d}from"@redocly/config";import{extractDocumentSearchFacets as O,setDocumentSearchFacets as T}from"./search-facets.js";import{removeMarkdownLinks as m}from"../../openapi-docs/utils.js";import{processSchema as S}from"./schema-processor.js";function q(e,t){return async(n,r)=>{const o=n.getSidebar?.(n)||[];return k({actions:e,document:t,staticData:r,route:n},o)}}function k(e,t){const n=[];for(const r of t){r.type==="group"&&n.push(...k(e,r.items||[]));const o=w(e,r);o&&n.push(o)}return n}function w(e,t){const{actions:n,document:r,staticData:o,route:s}=e,f=A(t,r);if(!f)return null;const g=t.link||"",L=t.httpVerb||"",P={slug:s.slug,fsPath:s.fsPath},R=s.metadata||{},y=O(n,R);T(n,y);const i={id:g,url:g,text:m(f.description||"")+m(f.summary||""),title:m(f.title||""),httpMethod:L,facets:y,[d]:t[d]||o[d],[D]:s[D]||P};if(t.apiItemData?.type==="channel"){const x=t.apiItemData.id,u=r.channels?.[x];if(u){const p=[];if(u.parameters)for(const[l,c]of Object.entries(u.parameters)){const a={name:l,description:m(c.description||""),place:"channel parameters",mediaType:void 0,type:"string",required:!1,example:void 0,enum:c.enum,deepLink:`#${i.url.replace(s.slug+"/","").replace(/^\//,"")}/parameters&path=${l}`};p.push(a)}if(u.messages){const l=u.messages;if(l)for(const[c,a]of Object.entries(l)){const C={name:a.title||a.name||c,description:m(a.description||"")+m(a.summary||""),place:"message",mediaType:void 0,type:"unknown",deepLink:`#${i.url.replace(s.slug+"/","").replace(/^\//,"")}/messages&m=${c.toLocaleLowerCase()}`,required:!1,example:void 0,enum:void 0};if(p.push(C),a.payload){const h=S(a.payload,"message payload",i.url.replace(s.slug+"/","").replace(/^\//,""),c);p.push(...h)}if(a.headers){const h=S(a.headers,"message headers",i.url.replace(s.slug+"/","").replace(/^\//,""),c);p.push(...h)}}}p.length>0&&(i.parameters=p)}}return i}function A(e,t){const{apiItemData:n}=e;return n?.type?E(n,t):e.type==="group"&&e.label?F(e.label,t):I(t)}function E(e,t){switch(e.type){case"channel":return t.channels?.[e.id]||null;case"operation":return t.operations?.[e.id]||null}}function F(e,t){const n=t.components?.tags?.[e];return{description:n?.description||"",title:n?.name||e,summary:""}}function I(e){return{description:e.info?.description||"",title:e.info?.title||"",summary:""}}export{q as searchResolver};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { BundledDefinition } from './asyncapi-doc-loader.js';
|
|
2
|
-
export declare function storeDefinitionBundles(definitions: BundledDefinition[], outDir: string, hash: string): void;
|
|
3
|
-
export declare function replaceFileExtension(filePath: string, fileExt: string): string;
|
|
4
|
-
//# sourceMappingURL=store-definition-bundles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{writeFileSync as l}from"fs";import o from"path";import{dump as d}from"js-yaml";import{PUBLIC_API_DEFINITIONS_FOLDER as u,PUBLIC_STATIC_FOLDER as m}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{ensureDir as g}from"../../utils/fs.js";const c=new Map;function _(e,t,i){const r=u.slice(1);try{for(const s of e){const{documentWithReferences:f,relativePath:n}=s;if(c.get(n)!==i){if(n.startsWith(m+"/")){const a=o.posix.extname(n);p({outDir:t,definitionFolder:".",relativePath:n.replace(m+"/",""),definitionString:a===".json"?JSON.stringify(f,null,2):d(f)}),c.set(n,i);continue}p({outDir:t,definitionFolder:r,relativePath:F(n,".json"),definitionString:JSON.stringify(f,null,2)}),c.set(n,i)}}}catch(s){x.error("failed to store definition bundles",s)}}function F(e,t){const i=o.posix.dirname(e),r=o.posix.basename(e,o.posix.extname(e))+t;return o.posix.join(i,r)}function p({outDir:e,definitionString:t,relativePath:i,definitionFolder:r}){l(g(o.resolve(e,`${r}/${i}`)),t,"utf8")}export{F as replaceFileExtension,_ as storeDefinitionBundles};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const s=["queries","mutations","subscriptions","directives","unions","scalars","interfaces","enums","objects","inputs"];export{s as TYPE_GROUPS};
|