@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
|
@@ -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,17 +0,0 @@
|
|
|
1
|
-
import { MenuStore, AppStore } from '@redocly/graphql-docs';
|
|
2
|
-
import type { LoaderFn } from '../../types';
|
|
3
|
-
import type { GraphQLConfig } from '@redocly/config';
|
|
4
|
-
export type GraphqlLoadResult = {
|
|
5
|
-
content: string;
|
|
6
|
-
menu: MenuStore;
|
|
7
|
-
store: AppStore;
|
|
8
|
-
metadata?: Record<string, unknown>;
|
|
9
|
-
settings: GraphQLConfig;
|
|
10
|
-
} | undefined;
|
|
11
|
-
export declare const graphqlDocLoader: LoaderFn;
|
|
12
|
-
export type BundledDefinition = {
|
|
13
|
-
relativePath: string;
|
|
14
|
-
settings: GraphQLConfig;
|
|
15
|
-
};
|
|
16
|
-
export declare const graphqlDocsLoader: LoaderFn<BundledDefinition[]>;
|
|
17
|
-
//# sourceMappingURL=graphql-doc-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{buildSchema as d}from"graphql";import{MenuStore as f,AppStore as g}from"@redocly/graphql-docs";import h from"node:path";import{combineUrls as u}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as w}from"../../../constants/common.js";import{deepMerge as q}from"../../../utils/object/deep-merge.js";import{reporter as S}from"../../tools/notifiers/reporter.js";import{getApiConfigByPath as b}from"../get-api-config.js";import{replaceFileExtension as x}from"../openapi-docs/store-definition-bundles.js";const E=async(r,{getConfig:i,fs:c})=>{const e=await i(),o=e?.graphql??{},t=await c.read(r),{graphql:n={},metadata:m}=b(e.apis,r),s=q(o||{},n,{feedback:o.feedback||e.feedback,downloadUrls:o.downloadUrls||[{url:u(w,`${x(r,h.posix.extname(r))}?download`)}]});let p,l;try{const a=d(t);l=new g(a),p=new f(a,s)}catch(a){await S.panicOnBuild(a);return}return{menu:p,store:l,settings:s,metadata:m,content:t}},F=async(r,{fs:i,cache:c,isPathIgnored:e})=>{const o=[];for(const{relativePath:t}of i.scan(/(\.gql|\.graphql)$/)){if(await e(t))continue;const n=await c.load(t,"graphql-doc").catch(()=>null);n?.data&&o.push({relativePath:t,settings:n.data.settings})}return o};export{E as graphqlDocLoader,F as graphqlDocsLoader};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LifecyclePluginInstance } from '../../types';
|
|
2
|
-
export declare function graphqlDocsPlugin(): Promise<LifecyclePluginInstance>;
|
|
3
|
-
export declare function storeGqlSchema(content: string, outDir: string, relativePath: string): void;
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{writeFileSync as v}from"node:fs";import C from"node:path";import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{combineUrls as q}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_TEMPLATE_ID as O,GRAPHQL_SPEC_SLUG as Q,PUBLIC_RBAC_SCOPE_ITEM as H}from"../../../constants/common.js";import{removeTrailingSlash as I}from"../../../utils/url/remove-trailing-slash.js";import{getTemplatePath as N}from"./get-template-path.js";import{searchResolver as F}from"./search/search-resolver.js";import{graphqlDocLoader as M,graphqlDocsLoader as U}from"./graphql-doc-loader.js";import{getAiDocumentsStore as A}from"./search/ai/get-ai-search-document.js";import{fromCurrentDir as k}from"../../utils/paths.js";import{ensureDir as x}from"../../utils/fs.js";import{telemetryTraceStep as B}from"../../../cli/telemetry/helpers/trace-step.js";const j="graphql-docs-",R="graphql-spec-download";async function nt(){return{id:"graphql",requiredEntitlements:["graphql"],loaders:{"graphql-doc":M,"load-graphql-docs":U},processContent:async(t,{fs:l,cache:n,isPathIgnored:i,withPathPrefix:p})=>{await B("com.redocly.build.plugin.graphqlDocs",async()=>{t.createRequestHandler(R,k(import.meta.url,"./spec-download.api.js")),t.addApiRoute({slug:Q+"/*",requestHandlerId:R,httpMethod:"all",[$]:H,getStaticData:async()=>({props:{}})});const m=t.createTemplate(O,N("./template/GraphQLDocs.js"));for(const{relativePath:o}of l.scan(/(\.gql|\.graphql)$/)){if(await i(o))continue;const h=await n.load(o,"graphql-doc");if(!h.data)continue;K(h.data.content,t.outdir,o);const{menu:_,content:y,settings:u,metadata:G,store:c}=h.data,L=`${j}${o}`;await t.createSharedData(L,y);const d=[{key:"graphQlSettings",id:L}],b=_.getGroups(),T=_.getSidebarItems(),g={type:"graphql",title:b[0].name,...G},s=[{slugSuffix:"",fsPath:o,templateId:m,getStaticData:S(void 0,u,p),sharedData:d,getAiDocumentsStore:A({label:u.info?.title??"GraphQL Overview",groupName:"overview",metadata:g,actions:t,store:c,includeInLLMsTxt:!0})}];for(const r of b){const f=`${r.id}`;s.push({slugSuffix:f,fsPath:o,templateId:m,getStaticData:S(r,u,p),sharedData:d});for(const e of r.typeGroups){const a=`${e.id}`;s.push({slugSuffix:a,fsPath:o,templateId:m,getStaticData:S(e,u,p),sharedData:d,getAiDocumentsStore:A({label:e.name,groupName:e.name,metadata:g,actions:t,store:c,isTypeGroup:!0,items:new Set(e.items)})});for(const E of e.items){const P=`${e.id}/${E}`;s.push({slugSuffix:P,fsPath:o,templateId:m,getStaticData:S(e,u,p),sharedData:d,getAiDocumentsStore:A({label:E,groupName:e.name,metadata:g,actions:t,store:c})})}}}if(!s.length)return;const D=s[s.length-1];D.metadata=g,D.getSidebar=r=>{function f(e){return e.map(a=>({...a,slug:a.slug&&I(q(r.baseSlug,a.slug)),routeSlug:a.routeSlug&&I(q(r.baseSlug,a.routeSlug)),link:a.link&&I(q(r.baseSlug,a.link)),items:a.items&&f(a.items)}))}return f(T)},D.getSearchDocuments=F(t,c);for(const r of s)t.addRoute(r)}})}}}function S(t,l,n){return async function(i){return{props:{seo:{title:t?.name??l.info?.title??"GraphQL Overview"},settings:{...l,location:{section:t?.id},sidebar:{hide:!0},baseUrlPath:n(i.baseSlug)},disableAutoScroll:!0}}}}function K(t,l,n){const i=w.slice(1);v(x(C.resolve(l,`${i}/${n}`)),t,"utf8")}export{nt as graphqlDocsPlugin,K as storeGqlSchema};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t=r=>!!r.match(/(\.gql|\.graphql)$/);export{t as isGraphqlDoc};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AppStore } from '@redocly/graphql-docs';
|
|
2
|
-
import type { PageRouteDetails, ProcessContentActions } from '../../../../types';
|
|
3
|
-
import type { AiDocumentsStore } from '../../../../plugins/search/types.js';
|
|
4
|
-
type GetAiDocumentsStoreParams = {
|
|
5
|
-
label: string;
|
|
6
|
-
groupName: string;
|
|
7
|
-
metadata: Record<string, unknown>;
|
|
8
|
-
actions: ProcessContentActions;
|
|
9
|
-
store: AppStore;
|
|
10
|
-
includeInLLMsTxt?: boolean;
|
|
11
|
-
llmstxtTitle?: string;
|
|
12
|
-
isTypeGroup?: boolean;
|
|
13
|
-
items?: Set<string>;
|
|
14
|
-
};
|
|
15
|
-
export declare const getAiDocumentsStore: ({ label, groupName, metadata, actions, store, includeInLLMsTxt, llmstxtTitle, isTypeGroup, items, }: GetAiDocumentsStoreParams) => (route: PageRouteDetails) => Promise<AiDocumentsStore | undefined>;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=get-ai-search-document.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{TYPE_GROUPS as S}from"../../constants.js";import{getLocaleFromRelativePath as D}from"../../../../fs/utils/get-locale-from-relative-path.js";import{convertDocumentToMarkdown as y,getSearchDocument as P}from"./utils.js";import{extractDocumentSearchFacets as L}from"../search-facets.js";const F=({label:o,groupName:r,metadata:a,actions:i,store:m,includeInLLMsTxt:e,llmstxtTitle:c,isTypeGroup:f,items:u})=>async t=>{const s=D(t.fsPath),n=L(i,a),h=t.slug===t.baseSlug,g=e!==void 0?e:h,l=A(o,r,t,m,s,n,f,u,h);if(l)return{async getLLMsTxts(){return[{slug:l.url,fsPath:t.fsPath,title:c||l.title,content:l.content,includeInLLMsTxt:g}]},async getSearchDocuments(){return[l]}}};function d(o,r,a,i,m){const e=[];for(const c of S){const f=c.charAt(0).toUpperCase()+c.slice(1),u=P({label:f,groupName:c,store:a,isTypeGroup:!0}),t=(Array.isArray(u)?u:[u]).filter(n=>!!(n&&n.name));if(t.length===0)continue;e.push(`## ${f}`);const s=t.map(n=>`- ${n.name}: ${n.description}`);e.push(...s)}return{url:r.slug,fsPath:r.fsPath,content:e.join(`
|
|
2
|
-
`),title:o,locale:i,facets:m}}function A(o,r,a,i,m,e,c,f,u){if(u)return d(o,a,i,m,e);const t=c?P({label:o,groupName:r,store:i,isTypeGroup:c,items:f??new Set}):P({label:o,groupName:r,store:i}),s=(Array.isArray(t)?t:[t]).filter(p=>!!p);if(s.length===0)return;const n=s.length===1,h=n?1:2,g=s.map(p=>y(p,h)).join(`---
|
|
3
|
-
|
|
4
|
-
`),l=n?s[0].name:o;return{url:a.slug,fsPath:a.fsPath,content:g,title:l??"",locale:m,facets:e}}export{F as getAiDocumentsStore};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AppStore } from '@redocly/graphql-docs';
|
|
2
|
-
import type { GraphQLSearchDocument } from '../../types.js';
|
|
3
|
-
type GetSearchDocumentParams = {
|
|
4
|
-
label: string;
|
|
5
|
-
groupName: string;
|
|
6
|
-
store: AppStore;
|
|
7
|
-
isTypeGroup?: boolean;
|
|
8
|
-
items?: Set<string>;
|
|
9
|
-
};
|
|
10
|
-
type GetSearchDocumentReturnType = GraphQLSearchDocument | (GraphQLSearchDocument | undefined)[] | undefined;
|
|
11
|
-
export declare function getSearchDocument({ label, groupName, store, isTypeGroup, items, }: GetSearchDocumentParams): GetSearchDocumentReturnType;
|
|
12
|
-
export declare function convertDocumentToMarkdown(document: GraphQLSearchDocument, baseLevel?: number): string;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{GraphQLEnumType as _,GraphQLInputObjectType as Q,GraphQLInterfaceType as S,GraphQLList as j,GraphQLNonNull as R,GraphQLObjectType as D,GraphQLScalarType as M,GraphQLUnionType as P,Kind as a}from"graphql";const V={queries:(n,e)=>n.getQueryTypes(e),mutations:(n,e)=>n.getMutationTypes(e),subscriptions:(n,e)=>n.getSubscriptionTypes(e),directives:(n,e)=>n.getDirectiveTypes(e),interfaces:(n,e)=>n.getTypes(a.INTERFACE_TYPE_DEFINITION,e),objects:(n,e)=>n.getTypes(a.OBJECT_TYPE_DEFINITION,e),unions:(n,e)=>n.getTypes(a.UNION_TYPE_DEFINITION,e),scalars:(n,e)=>n.getTypes(a.SCALAR_TYPE_DEFINITION,e),enums:(n,e)=>n.getTypes(a.ENUM_TYPE_DEFINITION,e),inputs:(n,e)=>n.getTypes(a.INPUT_OBJECT_TYPE_DEFINITION,e)};function w(n,e,i){const t=V[n];return t?t(e,i).map(s=>E(s?.name??"",n,e)):[]}function E(n,e,i){switch(e){case"queries":return g(i.getQueryField(n),e);case"mutations":return g(i.getMutationField(n),e);case"subscriptions":return g(i.getSubscriptionField(n),e);case"directives":const t=i.getDirective(n);return{name:t?.name,group:e,description:t?.description||void 0,locations:t?.locations.map(f=>f.toString()),isRepeatable:!!t?.isRepeatable,args:F(t?.args)};case"interfaces":return m(i.getType(n),e);case"objects":return m(i.getType(n),e);case"unions":const r=i.getType(n),s=r?Y(r):[];return{name:r?.name,group:e,description:r?.description||void 0,types:s};case"scalars":const o=i.getType(n);return{name:o?.name,group:e,description:o?.description||void 0};case"enums":const u=i.getType(n),d=u?A(u):[];return{name:u?.name,group:e,description:u?.description||void 0,values:d};case"inputs":return m(i.getType(n),e);default:return}}function g(n,e){return{name:n?.name,group:e,description:n?.description??void 0,response:n?$(n.type):void 0,args:F(n?.args)}}function m(n,e){return{name:n?.name,group:e,description:n?.description||void 0,fields:n?y(n.getFields(),1,[]):void 0}}function Y(n){return n.getTypes().map(({name:e,description:i})=>({name:e,description:i||void 0}))}function A(n){return n.getValues().map(({name:e,description:i,value:t})=>({name:e,description:i||void 0,value:t}))}function U({label:n,groupName:e,store:i,isTypeGroup:t,items:r}){const s=e.toLowerCase();return t?w(s,i,r):E(n,s,i)}function $(n,e=1,i=[]){const{type:t,list:r,notNull:s}=l(n),o=t.toString();if(i.includes(o)||i.length>=e)return o;if(t instanceof D)return{name:t.name,description:t.description||void 0,list:r,notNull:s,fields:y(t.getFields(),e,[...i,o])};if(t instanceof S)return{name:t.name,description:t.description||void 0,list:r,notNull:s,fields:y(t.getFields(),e,[...i,o])};if(t instanceof P)return{name:t.name,description:t.description||void 0,list:r,notNull:s,types:t.getTypes().map(u=>u.name)};if(t instanceof _){const u=t.getValues().map(d=>({name:d.name,description:d.description||void 0,value:d.value}));return{name:t.name,description:t.description||void 0,list:r,notNull:s,values:u}}else{if(t instanceof M)return o;if(t instanceof Q)return{name:t.name,description:t.description||void 0,list:r,notNull:s,fields:y(t.getFields(),e,[...i,o])}}}function F(n,e=3){if(!n)return;const i={};return n.forEach(t=>{i[t.name]={type:$(t.type,e),description:t.description??void 0}}),i}function y(n,e,i){if(!n)return;const t={};return Object.entries(n).forEach(([r,s])=>{t[r]={type:$(s.type,e,i),description:s.description,defaultValue:s.defaultValue}}),t}function l(n){return n instanceof R?{type:l(n.ofType).type,notNull:!0}:n instanceof j?{type:l(n.ofType).type,list:!0}:{type:n}}function p(n,e=2){return"#".repeat(Math.min(6,e+n-1))}function B(n,e=1){const{name:i,group:t,description:r,args:s,response:o,locations:u,isRepeatable:d,types:f,values:I,fields:N}=n;let c=`${p(1,e)} ${i}
|
|
2
|
-
|
|
3
|
-
**Type:** GraphQL ${t}
|
|
4
|
-
|
|
5
|
-
`;return r&&(c+=`**Description:**
|
|
6
|
-
${r}
|
|
7
|
-
|
|
8
|
-
`),f&&(c+=`${p(2,e)} Types
|
|
9
|
-
${h(f)}
|
|
10
|
-
|
|
11
|
-
`),I&&(c+=`${p(2,e)} Values
|
|
12
|
-
${h(I)}
|
|
13
|
-
|
|
14
|
-
`),N&&(c+=`${p(2,e)} Fields
|
|
15
|
-
${T(N)}
|
|
16
|
-
|
|
17
|
-
`),s&&Object.keys(s).length>0&&(c+=`${p(2,e)} Arguments
|
|
18
|
-
${T(s)}
|
|
19
|
-
|
|
20
|
-
`),o&&(typeof o=="string"?c+=`${p(2,e)} Response
|
|
21
|
-
**Type:** ${o}
|
|
22
|
-
`:(c+=`${p(2,e)} Response
|
|
23
|
-
**Type:** ${o.name}
|
|
24
|
-
**Description:**
|
|
25
|
-
${o.description}
|
|
26
|
-
|
|
27
|
-
`,c+=o.fields?`${p(3,e)} Fields
|
|
28
|
-
${T(o.fields)}
|
|
29
|
-
`:"")),c+=d?`${p(2,e)} Repeatable
|
|
30
|
-
`:"",c+=u?`${p(2,e)} Locations
|
|
31
|
-
${u.map(O=>`- ${O}`).join(`
|
|
32
|
-
`)}
|
|
33
|
-
`:"",c}function h(n){return n.map(e=>`- ${e.name}${e.description?`: ${e.description}`:""}`).join(`
|
|
34
|
-
`)}function T(n,e=0){const i=" ".repeat(e);return n?Object.entries(n).map(([t,r])=>typeof r.type=="string"?`${i}- ${t} (${r.type})${r.description?`: ${r.description}`:""}`:`${i}- ${t} (${r.type?.name}${r.type?.notNull?", Not Null":""}): ${r.description}
|
|
35
|
-
${T(r.type?.fields??{},e+1)}`).join(`
|
|
36
|
-
`):""}export{B as convertDocumentToMarkdown,U as getSearchDocument};
|
|
@@ -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 { AppStore } from '@redocly/graphql-docs';
|
|
2
|
-
import type { PageStaticData } from '@redocly/config';
|
|
3
|
-
import type { PageRouteDetails, ProcessContentActions, SearchDocument } from '../../../types';
|
|
4
|
-
export declare function searchResolver(actions: ProcessContentActions, store: AppStore): (route: PageRouteDetails, staticData: PageStaticData) => Promise<SearchDocument[]>;
|
|
5
|
-
//# sourceMappingURL=search-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as m,REDOCLY_TEAMS_RBAC as l}from"@redocly/config";import{removeMarkdownLinks as h}from"../../openapi-docs/utils.js";import{extractDocumentSearchFacets as b,setDocumentSearchFacets as R}from"./search-facets.js";function k(c,e){return async(t,r)=>{const s=t.getSidebar?.(t)||[];return f(c,r,t,s,e)}}function f(c,e,t,r,s,p){const a=[];for(const n of r)if(n.type==="group")a.push(...f(c,e,t,n.items??[],s,n.label));else{const i=S(n,s,p||"");if(i){const o=n.link||n.slug,d={slug:t.slug,fsPath:t.fsPath},g=t.metadata||{},u=b(c,g);R(c,u),a.push({id:o,url:o,text:h(i.description||""),title:i.name,facets:u,[l]:e[l],[m]:e[m]||d})}}return a}function S(c,e,t){const r=t.toLowerCase(),{label:s}=c;switch(r){case"queries":return e.getQueryField(s);case"mutations":return e.getMutationField(s);case"subscriptions":return e.getSubscriptionField(s);case"directives":return e.getDirective(s);case"objects":case"interfaces":case"unions":case"enums":case"inputs":case"scalars":return e.getType(s)}}export{k as searchResolver};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import l from"node:path";import{readFile as d,existsSync as h}from"node:fs";import{promisify as A}from"node:util";import{PUBLIC_API_DEFINITIONS_FOLDER as L}from"../../constants/common.js";import{GRAPHQL_SPEC_SLUG as R}from"../../../constants/common";import{canDownloadApiDefinition as w}from"../../utils/rbac.js";const F=A(d);async function q(r,e,i){const{isAuthenticated:n,teams:a,claims:{email:c}}=e.user,o=new URL(r.url),p=decodeURIComponent(o.pathname.replace(R,"")),s=e.config.access??{},m=s.rbac??{},f=s.requiresLogin??!1;if(!w(o.pathname,m,f,{isAuthenticated:n,email:c,teams:a}))return new Response("Unauthorized",{status:n?403:401});const t=l.join(i.props?.outdir??"",L,p);if(!h(t))return new Response("Not found",{status:404});const u=await F(t,"utf-8");return new Response(u,{headers:{"Content-Type":"application/graphql"}})}export{q as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import t from"react";import c from"styled-components";import{RedoclyGraphQLDocs as h}from"@redocly/graphql-docs";import{buildSchema as l}from"graphql";import{LayoutVariant as f}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useThemeConfig as p}from"@redocly/theme/core/hooks";import{withPathPrefix as g}from"@redocly/theme/core/utils";import{ServerRoutes as E}from"../../../../constants/api.js";import{CLIENT_TELEMETRY_ENABLED as u}from"../../../../client/constants/common.js";import{PACKAGE_NAME as d}from"../../../../config/product-gates.js";import{envConfig as S}from"../../../config/env-config.js";import{usePageSharedData as L}from"../../../../client/providers/page-data/hooks.js";import{useCodeHighlight as R}from"../../../../client/app/hooks/codeHighlight/useCodeHighlight.js";function v({pageProps:o}){const e=L("graphQlSettings"),{settings:r}=o,{graphql:i}=p(),{highlight:n}=R(),m=t.useMemo(()=>({graphql:l(e)}),[e]),s=t.useMemo(()=>{const a={...i,...r};return{layout:o.apiOptions?.layout??f.THREE_PANEL,...a,markdown:{...a.markdown,highlight:n},navigation:{contentPrefix:""}}},[i,r,n,o.apiOptions?.layout]);return t.createElement(C,null,t.createElement(h,{schema:m,settings:s,telemetryConfig:{collectorUrl:new URL(g(E.OTEL_TRACES),location.origin).toString(),disabled:!u,serviceVersion:`${d}@${S.REDOCLY_PORTAL_VERSION}`}}))}const C=c.div`
|
|
2
|
-
--navigation-anchor-offset: var(--navbar-height);
|
|
3
|
-
--sidebar-width: 0px;
|
|
4
|
-
`;export{v as default};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { GraphQLType } from 'graphql';
|
|
2
|
-
import type { TYPE_GROUPS } from './constants.js';
|
|
3
|
-
export type TypeGroup = (typeof TYPE_GROUPS)[number];
|
|
4
|
-
export type GraphQLSearchDocument = {
|
|
5
|
-
name?: string;
|
|
6
|
-
group: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
args?: Record<string, GraphQLFieldDetails>;
|
|
9
|
-
locations?: string[];
|
|
10
|
-
isRepeatable?: boolean;
|
|
11
|
-
response?: GraphQLTypeDetails | string;
|
|
12
|
-
types?: GraphQLTypeDetails[];
|
|
13
|
-
values?: GraphQLFieldValue[];
|
|
14
|
-
fields?: Record<string, GraphQLFieldDetails>;
|
|
15
|
-
};
|
|
16
|
-
export type GraphQLTypeDetails = {
|
|
17
|
-
name: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
list?: boolean;
|
|
20
|
-
notNull?: boolean;
|
|
21
|
-
fields?: Record<string, GraphQLFieldDetails>;
|
|
22
|
-
values?: GraphQLFieldValue[];
|
|
23
|
-
types?: string[];
|
|
24
|
-
};
|
|
25
|
-
export type GraphQLFieldDetails = {
|
|
26
|
-
type?: string | GraphQLTypeDetails;
|
|
27
|
-
description?: string;
|
|
28
|
-
defaultValue?: unknown;
|
|
29
|
-
};
|
|
30
|
-
export type GraphQLFieldValue = {
|
|
31
|
-
name: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
value?: unknown;
|
|
34
|
-
};
|
|
35
|
-
export type UnwrappedGraphQLType = {
|
|
36
|
-
type: GraphQLType;
|
|
37
|
-
notNull?: boolean;
|
|
38
|
-
list?: boolean;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=types.d.ts.map
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ContentItemModel, OpenAPIParser, OperationModel, Options, SchemaModel } from '@redocly/openapi-docs';
|
|
2
|
-
import type { OperationParameter } from '@redocly/theme/core/types';
|
|
3
|
-
import type { SearchDocument } from '../../types';
|
|
4
|
-
import { OpenApiSearchBuilder } from './openapi-search-builder.js';
|
|
5
|
-
type Parameters = Record<string, OperationParameter>;
|
|
6
|
-
export declare class AiSearchIndexer extends OpenApiSearchBuilder {
|
|
7
|
-
#private;
|
|
8
|
-
constructor(parser: OpenAPIParser, options: Options, basePath: string);
|
|
9
|
-
addItem(item: ContentItemModel): SearchDocument | undefined;
|
|
10
|
-
protected buildOperationDocument(operation: OperationModel): SearchDocument | undefined;
|
|
11
|
-
protected addSchema(parameters: Parameters, schema: SchemaModel | undefined, mediaType: string | undefined, place: string, isResponse: boolean, path?: string[], visited?: Set<string>, level?: number, skipFields?: Set<string>): void;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=ai-search-indexer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{OpenApiSearchBuilder as h}from"./openapi-search-builder.js";import{getOneOfSchema as O}from"./utils.js";class y extends h{constructor(t,e,n){super(t,e,n)}addItem(t){try{return this.buildSearchDocument(t)}catch(e){console.error("Cannot add item to AI search indexer",e.message);return}}buildOperationDocument(t){const e=this.createOperationDocumentBase(t),n=e?.parameters?.find(i=>i.place==="request fields"&&i.name==="body"&&"oneOf"in i&&i.oneOf!==void 0);return n&&(n.required=t.requestBody?.required??!1),e}addSchema(t,e,n,i,s,u=[],o=new Set,d=0,c){if(!(!e||e.isCircular||d>this.options.generatedSamplesMaxDepth)){if(e.pointer){if(o.has(e.pointer))return;o.add(e.pointer)}for(const r of e.fields??[]){if(c?.has(r.name)||this.#t(e,r,s))continue;const a=this.createSchemaFieldParameter(r,e,i,n,u),f=this.getParameterId(a);if(t[f]!=null)continue;t[f]=a,this.addSchema(t,r.schema,n,i,s,[...u,r.name],o,d+1);const l=O(r.schema);l&&(a.oneOf=this.#e(l,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1}))}if(e.items&&this.addSchema(t,e.items,n,i,s,u,o,d+1),d===0&&u.length===0&&e.oneOf){const r=this.#e(e,{mediaType:n,place:i,isResponse:s,visited:o,level:d+1});if(r){const a={name:"body",description:"",place:i,mediaType:n,path:[],type:e.displayType||"object",required:!1,example:void 0,enum:void 0,oneOf:r};t[this.getParameterId(a)]=a}}}}#t(t,e,n){return!!t[m]||e.kind==="additionalProperties"||!!e.schema?.readOnly&&!n||!!e.schema?.writeOnly&&n}#e(t,e){const{mediaType:n,place:i,isResponse:s,visited:u,level:o}=e,d=new Set((t.fields??[]).map(r=>r.name)),c=(t.oneOf??[]).map((r,a)=>{const f={};return this.addSchema(f,r,n,i,s,[],new Set(u),o,d),{title:r.title||`variant ${a+1}`,parameters:Object.values(f)}}).filter(r=>r.parameters.length>0);if(c.length!==0)return{discriminator:t.discriminatorProp,variants:c}}}export{y as AiSearchIndexer};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { RawUniversalConfig } from '@redocly/openapi-core';
|
|
2
|
-
export declare const MarkdownParserDecorator: ({ outputRelativePath, cwd, }: {
|
|
3
|
-
outputRelativePath: string;
|
|
4
|
-
cwd: string;
|
|
5
|
-
}) => {
|
|
6
|
-
any: {
|
|
7
|
-
leave(node: Record<string, unknown>, ctx: any): void;
|
|
8
|
-
};
|
|
9
|
-
ref: {
|
|
10
|
-
leave(node: Record<string, unknown>, ctx: any): void;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare const RbacDecorator: () => {
|
|
14
|
-
Tag: {
|
|
15
|
-
enter(node: Record<string, unknown>): void;
|
|
16
|
-
};
|
|
17
|
-
any: {
|
|
18
|
-
leave(node: Record<string, unknown>, ctx: any): void;
|
|
19
|
-
};
|
|
20
|
-
ref: {
|
|
21
|
-
leave(node: Record<string, unknown>): void;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare function injectDecoratorIntoConfig(config: RawUniversalConfig, outputRelativePath: string, cwd: string): RawUniversalConfig;
|
|
25
|
-
//# sourceMappingURL=decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import b from"node:path";import{REDOCLY_TEAMS_RBAC as u}from"@redocly/config";import{slash as k}from"../../../utils/path/slash.js";function f(a,r,t){if(!r)throw new Error("Visitor required");if(a){a.description&&r(a,"description",t.location.absolutePointer+"/description",t);for(const o in a["x-enumDescriptions"])r(a["x-enumDescriptions"],o,t.location.absolutePointer+"/x-enumDescriptions/"+o,t)}}const g=/^[a-zA-Z0-9\s\-,.!\?:;'"()/]+$/,s=({outputRelativePath:a,cwd:r})=>{const t=function(e,m,l,p){const{node:n}=p.resolve(e[m]);if(!n||typeof n!="string"||n.match(g))return;const i=p.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:a,key:m})};return{any:{leave(o,e){f(o,t,e)}},ref:{leave(o,e){f(o,t,e)}}}},c=()=>{const a={};return{Tag:{enter(r){r?.["x-rbac"]&&(a[String(r.name)]=r["x-rbac"])}},any:{leave(r,t){if((t.type.name==="Operation"||t.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)a[o]&&(r["x-rbac"]=r["x-rbac"]||a[o]);r?.["x-rbac"]&&(r[u]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[u]=r["x-rbac"],delete r["x-rbac"])}}}};function h(a,r,t){const o={id:"markdown",decorators:{oas2:{markdown:s,rbac:c},oas3:{markdown:s,rbac:c},async3:{markdown:s,rbac:c}}};return{...a,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:t},...a.decorators||{}},plugins:[...a.plugins||[],o]}}export{s as MarkdownParserDecorator,c as RbacDecorator,h as injectDecoratorIntoConfig};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type NormalizedProblem } from '@redocly/openapi-core';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a bundle error with file path, line/column, and codeframe for better debugging.
|
|
4
|
-
*/
|
|
5
|
-
export declare function formatBundleError(problem: NormalizedProblem, cwd: string): Promise<string>;
|
|
6
|
-
//# sourceMappingURL=format-bundle-error.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{getLineColLocation as f,isAbsoluteUrl as m}from"@redocly/openapi-core";import g from"node:path";import{gray as s}from"../../tools/notifiers/helpers/colors.js";import{getCodeframe as h}from"../../utils/codeframes/codeframes.js";async function P(o,c){const e=o.location?.[0];if(!e)return`${o.message} at `;if(!e.source){const t=e.pointer??"";return`${o.message} at ${t}`}const n=m(e.source.absoluteRef)?e.source.absoluteRef:g.relative(c,e.source.absoluteRef);try{const t=f(e),i=e.pointer?s(`at ${e.pointer}`):"",l=`${n}:${t.start.line}:${t.start.col}`;let r="";try{const a=e.source?.getLines()??[],u={start:{line:t.start.line,character:t.start.col},end:{line:t.end?.line??t.start.line,character:t.end?.col??Math.max(t.start.col+1,a[t.start.line-1]?.length??t.start.col)},lines:a},{frame:$}=h(u,!0);r=$}catch{r=""}return`${l} ${i}
|
|
2
|
-
${o.message}
|
|
3
|
-
${r?`${r}
|
|
4
|
-
`:""}`}catch{const t=e.pointer?s(`at ${e.pointer}`):"";return`${n} ${t}
|
|
5
|
-
${o.message}`}}export{P as formatBundleError};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getPublicEnvVariables as n}from"../../utils/envs/get-public-env-variables.js";const l=async({fsPath:r,slug:e},t,{variables:a,partials:i},o)=>{const s=o.getPartialsForRoute?.(e)||i;return{definitionId:r,...t.props,markdown:{partials:s,variables:{...a,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{simplifyAstStructure as Z}from"@redocly/openapi-docs";import{REDOCLY_ROUTE_RBAC as y,REDOCLY_TEAMS_RBAC as D}from"@redocly/config";import{OPENAPI_DOCS_TEMPLATE_ID as j,PUBLIC_RBAC_SCOPE_ITEM as U}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ee,PUBLIC_API_DEFINITIONS_FOLDER as te}from"../../constants/common.js";import{OPENAPI_SHARED_DATA_PREFIX as L}from"../../constants/plugins/openapi-docs.js";import{envConfig as V}from"../../config/env-config.js";import{isRbacScopeItems as oe}from"../../utils/rbac/is-rbac-scope-items.js";import{getRouteSlugsForPath as ae}from"../utils.js";import{searchResolver as re}from"./search/search-resolver.js";import{convertOpenAPIDocs2Sidebar as se,shouldAddRoute as ie}from"./utils.js";import{getTemplatePath as q}from"./get-template-path.js";import{storeDefinitionBundles as ne}from"./store-definition-bundles.js";import{definitionLoader as ce,definitionsLoader as pe}from"./load-definition.js";import{getAiDocumentsStore as de}from"./search/get-ai-search-documents.js";import{fromCurrentDir as le}from"../../utils/paths.js";import{telemetryTraceStep as fe}from"../../../cli/telemetry/helpers/trace-step.js";import{getApiConfigByPath as ue}from"../get-api-config.js";import{shouldAdvertiseGatewayXMcp as me,buildGatewayXMcp as ge}from"../mcp/gateway-mcp/eligibility.js";const x="openapi-spec-download";async function Be(){let k=[],C={},N=new Set,d={};return{id:"openapi",requiredEntitlements:["openapi"],loaders:{"load-oas-docs":pe,"load-oas":ce},processContent:async(e,n)=>{await fe("com.redocly.build.plugin.openapiDocs",async l=>{e.createRequestHandler(x,le(import.meta.url,"./spec-download.api.js")),e.addApiRoute({slug:te+"/*",requestHandlerId:x,httpMethod:"all",[D]:U,getStaticData:async()=>({props:{}})}),e.addApiRoute({slug:ee+"/*",requestHandlerId:x,httpMethod:"all",[D]:U,getStaticData:async()=>({props:{}})});const E=e.createTemplate(j,q("../../../client/templates/openapi-docs/template.js")),f=e.registerServerPropsGetter(j,q("./get-server-props.js")),u=await n.getConfig();l?.setAttribute("config",JSON.stringify(u.openapi||{})),C={},d={};const c=(await n.cache.load(".","load-oas-docs")).data;k=c.map(({markdocChunks:a,relativePath:o,customOutputRelativeFile:r,isVirtual:s,realRelativePath:m})=>({chunks:a,relativePath:o,realRelativePath:m,isVirtual:r!=null||s})),ne(c,e.outdir);for(const a of c||[]){const{definition:o,config:r,relativePath:s,customOutputRelativeFile:m,contentItems:_,flatItems:g,parser:h,options:I,rawOptions:v,hash:R}=a,S=m||s,i=[],G={},{definition:X}=h||{},{info:p}=X||{},O=p?.["x-metadata"],w=!!r.openapi?.excludeFromSearch||!!r.theme?.openapi?.excludeFromSearch||!!u.openapi?.excludeFromSearch||!!u.theme?.openapi?.excludeFromSearch,H={title:p?.title,description:p?.description,summary:p?.summary,...r.metadata,...O},P={untagged:[],tagged:new Map};for(const t of g){const{id:F,href:A,operationDefinition:T}=t;if(T){const{tags:b}=T;if(b)for(const B of b)P.tagged.has(B)||P.tagged.set(B,[]),P.tagged.get(B)?.push(t);else P.untagged.push(t);V.isDevelopMode&&(G[`#${T.pointer}`]=t.href)}if(!ie({item:t}))continue;const M=t,Q=M.type==="section"&&!!M.infoDefinition,W=A.split("#")[0]+"/",z=t?.operationDefinition?.[D],K=oe(r.access?.rbac)?r.access.rbac:void 0;i.push({excludeFromSearch:w,slugSuffix:W,fsPath:S,metadata:{subType:"openapi-operation"},httpVerb:t?.httpVerb||"",path:s,templateId:E,[D]:z||K,getAiDocumentsStore:de({parser:h,options:I,info:p,tagOperations:P,openapiContentItem:M,metadata:H,relativePath:s,getSearchFacets:e.getSearchFacets,includeInLLMsTxt:Q,excludeFromSearch:w}),getStaticData:async b=>({props:{dynamicMarkdocComponents:["openapi"],baseSlug:b.baseSlug,seo:t["x-metadata"]?.seo||{title:t.name,description:t.description},itemId:F,disableAutoScroll:!0}})})}if(i[0]={...i[0],metadata:{type:"openapi",...H},hasClientRoutes:!0,getSidebar:(t,F)=>{const A=[];return se({contentItems:_,sidebarItems:A,routeSlug:t.slug,navItem:F}),A},getNavText:()=>p?.title,getSearchDocuments:re(h,I,g,e.getSearchFacets,e.setSearchFacets,w)},O?.apiId&&!a.isVirtual){const t=ue(a.config.apis,a.realRelativePath);d[O.apiId]={[D]:t.rbac,[y]:{fsPath:S}}}const Y=i[0];i[0]=i[i.length-1],i[i.length-1]=Y;for(const t of i)e.addRoute({...t,serverPropsGetterIds:[f]});const J=V.isDevelopMode?s:void 0,$=`${L}${s}`;C[$]={fsPath:S,definition:o,options:v,sourcePath:J,routesMapping:G,hash:R};for(const t of i)e.addRoute({...t,sharedData:[{id:$,key:"openAPIDocsStore"}],serverPropsGetterIds:[f]})}})},afterRoutesCreated:async(e,n)=>{const l=new Set;for(const{chunks:a,relativePath:o,isVirtual:r,realRelativePath:s}of k){const m=ae(e.getAllRoutes(),o),_=(await n.cache.load(s,"load-oas")).compoundHash;await n.cache.load(o,{loader:async function(){for(const{node:h,markdown:I,key:v,relativePath:R}of a){const{ast:S}=await e.parseMarkdoc({input:{content:I,relativePath:R,isVirtual:r},context:n,deps:{sharedDataIds:[`${L}${R}`],routeSlugs:m}});h[`x-parsed-md-${v}`]={result:Z(S)}}},name:"openapi-markdoc-inline-parser"},[_]);for(const{pointer:g}of a)l.add(g)}const E=N.difference(l);for(const a of E)n.cache.delete(a);N=l;const f=e.getConfig(),u=f.access?.rbac??{},c=n.withPathPrefix("/mcp");for(const[a,o]of Object.entries(C)){const r=e.getRouteByFsPath(o.fsPath)?.baseSlug,s=r&&me(o.definition,a.slice(L.length),u,f.mcp)?{...o.definition,"x-mcp":{...ge(c),...o.definition["x-mcp"],servers:[{url:c}]}}:o.definition;await e.createSharedData(a,{...o,definition:s,baseSlug:r},o.hash)}Object.entries(d).forEach(([a,o])=>{const r=o[y]?.fsPath;if(!r)return;const s=e.getRouteByFsPath(r)?.baseSlug;d[a]={...o,[y]:{...o[y],slug:s},slug:s}}),e.setGlobalData({apiProducts:d})}}}export{Be as openAPIDocsPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import f from"node:path";import{CONFIG_FILE_NAME as h}from"../../../constants/common.js";import{normalizeRouteSlug as c}from"../../../utils/path/normalize-route-slug.js";import{removeLeadingSlash as L}from"../../../utils/url/remove-leading-slash.js";import{parseBaseName as x}from"../utils.js";const y=async(e,s)=>{if(!e.match(/(\.ya?ml|\.json)$/)||f.posix.basename(e)===h||await s.isPathIgnored(e))return!1;const i=s.fs.getFileInfo(e);if(!i)return!1;try{const{data:n}=await s.cache.load(i.realRelativePath,"yaml");return!(!n?.openapi&&!n?.swagger)}catch{return!1}},F=async(e,s,i,n)=>{const{getRouteBySlug:u,getRouteByFsPath:l}=i,o={isOpenapiDetected:!1,isOpenapiValid:!1},g={isOpenapiDetected:!0,isOpenapiValid:!1},d={isOpenapiDetected:!0,isOpenapiValid:!0};let r=e.toLowerCase();if(e.startsWith("/"))r=c(e);else if(e.startsWith("./")||e.startsWith("../")){const t=l(s)?.slug;if(!t)return o;const{isIndexFile:a}=x(s);r=a?c(f.posix.join(t,e)):c(f.posix.join(t,"../",e))}else return o;const p=r.toLowerCase().split("/");for(let t=p.length;t>=0;t--){const a=p.slice(0,t).join("/"),O=p.slice(t).join("/"),m=u(a)||l(L(a));if(m)return await y(m.fsPath,n)?O?g:d:o}return o};export{F as isOpenApiURL,y as isOpenapiDoc};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { OpenAPIParser } from '@redocly/openapi-docs';
|
|
2
|
-
import type { RbacScopeItems, RedocConfig, REDOCLY_TEAMS_RBAC, RedoclyConfig } from '@redocly/config';
|
|
3
|
-
import type { ContentItemModel, IMenuItem, OpenAPIDefinition, Options } from '@redocly/openapi-docs';
|
|
4
|
-
import type { LifecycleContext } from '../../types';
|
|
5
|
-
export type BundledDefinition = {
|
|
6
|
-
definition: OpenAPIDefinition;
|
|
7
|
-
config: Partial<RedoclyConfig & NonNullable<RedoclyConfig['apis']>[string]>;
|
|
8
|
-
relativePath: string;
|
|
9
|
-
realRelativePath: string;
|
|
10
|
-
customOutputRelativeFile?: string;
|
|
11
|
-
markdocChunks: MarkdocChunk[];
|
|
12
|
-
hash: string;
|
|
13
|
-
isVirtual: boolean;
|
|
14
|
-
contentItems: ContentItemModel[];
|
|
15
|
-
flatItems: (IMenuItem & {
|
|
16
|
-
[REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
|
|
17
|
-
})[];
|
|
18
|
-
options: Options;
|
|
19
|
-
rawOptions: RedocConfig;
|
|
20
|
-
parser: OpenAPIParser;
|
|
21
|
-
};
|
|
22
|
-
export type MarkdocChunk = {
|
|
23
|
-
node: Record<string, unknown>;
|
|
24
|
-
pointer: string;
|
|
25
|
-
markdown: string;
|
|
26
|
-
relativePath: string;
|
|
27
|
-
key: string;
|
|
28
|
-
};
|
|
29
|
-
export declare function definitionLoader(relativePath: string, context: LifecycleContext): Promise<Omit<BundledDefinition, 'hash'>[]>;
|
|
30
|
-
export declare function definitionsLoader(_: string, context: LifecycleContext): Promise<BundledDefinition[]>;
|
|
31
|
-
//# sourceMappingURL=load-definition.d.ts.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import*as l from"path";import{convertSwagger2OpenAPI as no}from"@redocly/openapi-docs/lib/utils/convertSwagger2OpenAPI.js";import{Source as ro,bundle as to,createConfig as io,getTotals as eo,resolvePlugins as ao}from"@redocly/openapi-core";import{normalizeOptions as so,OpenAPIParser as co,buildContentItems as fo}from"@redocly/openapi-docs";import{combineUrls as E}from"@redocly/theme/core/utils";import{CONFIG_FILE_NAME as j}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as P}from"../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as lo}from"../../constants/plugins/openapi-docs.js";import{unique as po}from"../../../utils/array/unique.js";import{deepMerge as F}from"../../../utils/object/deep-merge.js";import{pluralize as R}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as uo}from"../../utils/envs/replace-env-variables-deep.js";import{logger as N}from"../../tools/notifiers/logger.js";import{reporter as b}from"../../tools/notifiers/reporter.js";import{injectDecoratorIntoConfig as mo}from"./decorators.js";import{getAllApiConfigsByPath as go}from"../get-api-config.js";import{normalizeFeedbackOptions as wo}from"./utils.js";import{replaceFileExtension as L}from"./store-definition-bundles.js";import{ExternalResolver as ho}from"../../fs/utils/external-ref-resolver.js";import{formatBundleError as bo}from"./format-bundle-error.js";import{ensureAccessBackwardsCompatibility as Oo}from"../config-parser/loaders/utils/read-and-validate-config.js";async function Uo(o,u){const{fs:r,cache:O,getConfig:g,isPathIgnored:m}=u;if(l.posix.basename(o)===j)return[];let s;try{s=(await O.load(o,"yaml")).data}catch{return[]}if(!s?.openapi&&!s?.swagger)return N.verbose(`${o} file is not definition. Skipping`),[];const p=await g("."),e=r.getFileInfo(o),n=await g(l.posix.dirname(o)),M=go(n?.apis,o,n.configPath),S=[],V=await m(o);for(const c of M){if(!c.output&&V)continue;const T=F({decorators:p.decorators},n,{rbac:void 0,access:{rbac:void 0}},c),{resolvedObj:U}=uo(T),a=Oo(U);if(a.decorators&&typeof a.decorators!="object"){await b.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof a.decorators}'`);continue}if(a.plugins&&!Array.isArray(a.plugins)){await b.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof a.plugins}'`);continue}const z=n.configPath?l.posix.dirname(n.configPath):".",t=c.output?l.posix.join(z,c.output):o;if(await m(t))continue;e&&c.output&&!r.exists(t)&&r.addVirtualFile(t,e);const G=l.resolve(r.cwd,n.realConfigPath||j),v=new ho(r),C=await io(mo(a,t,r.cwd),{configPath:G,externalRefResolver:v});p.plugins&&p.configPath!==n.configPath&&(C.plugins=po([...C.plugins||[],...await ao(p.plugins,r.cwd)],f=>f.id));const B=l.resolve(r.cwd,o),J=await r.read(o),q={config:C,base:l.dirname(B),doc:{source:new ro(B,J),parsed:JSON.parse(JSON.stringify(s))},externalRefResolver:v},{bundle:{parsed:y},problems:D,visitorsData:H}=await to(q),X=H["markdown/markdown"]?.markdocChunks??[],i=eo(D);let A=[i.errors&&`${i.errors} ${R(i.errors,"error","errors")}`,i.warnings&&`${i.warnings} ${R(i.warnings,"warning","warnings")}`,i.ignored&&`${i.ignored} ignored`].filter(Boolean).join(", ");if(i.errors){const f=D.filter(d=>d.severity==="error");let $=`${A} while bundling ${t} definition:
|
|
2
|
-
`;const x=Math.min(f.length,lo);for(let d=0;d<x;d++){const Z=f[d],oo=await bo(Z,r.cwd);$+=`${oo}
|
|
3
|
-
`}if(f.length>x){const d=f.length-x;$+=`... and ${d} more ${R(d,"error","errors")}`}await b.panicOnBuild($)}i.warnings&&N.warn(`${A} while bundling %rp definition`,t);const w=Co(y.swagger!==void 0?await no(y):y,n.metadata),h=F(p.openapi||{},n.openapi||{},c.openapi||c?.theme?.openapi||{});h.showSchemaCatalogLinks&&(w["x-schema-catalog-link"]=E(P,t));const K=w["x-feedback"]||h.feedback||n.feedback,_={...h,feedback:wo(K),hideSidebar:!0,disableRouter:!0,mockServer:a?.mockServer||p?.mockServer,downloadUrls:h.downloadUrls||[{url:E(P,`${L(t,".json")}?download`)},{url:E(P,`${L(t,".yaml")}?download`)}]},I=so(_);let k;try{k=new co(w,void 0,I)}catch(f){await b.panicOnBuild(f);continue}const{contentItems:Q,flatItems:W}=fo(k,I),Y={definition:w,config:a,relativePath:t,realRelativePath:e?.realRelativePath||t,customOutputRelativeFile:c.output&&t,markdocChunks:X,contentItems:Q,flatItems:W,options:I,rawOptions:_,parser:k,isVirtual:e?.isVirtual??!1};S.push(Y)}return S}async function zo(o,u){const{fs:r,cache:O,getConfig:g}=u,m=[];for(const s of r.scan(/(\.ya?ml|\.json)$/)){if(!await g(l.posix.dirname(s.relativePath)))continue;const e=await O.load(s.relativePath,"load-oas");e.data&&e.data.length&&m.push(...e.data.map(n=>({...n,isVirtual:s.isVirtual||n.isVirtual,hash:e.compoundHash})))}return m}function Co(o,u){return u?{...o,info:{...o.info,"x-metadata":{...o.info["x-metadata"],...u}}}:o}export{Uo as definitionLoader,zo as definitionsLoader};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { OperationMenuItem } from '@redocly/openapi-docs/lib/models/types.js';
|
|
2
|
-
import type { ContentItemModel, OpenAPIParser, OperationModel, Options, SchemaModel } from '@redocly/openapi-docs';
|
|
3
|
-
import type { OperationParameter } from '@redocly/theme/core/types';
|
|
4
|
-
import type { SearchDocument } from '../../types';
|
|
5
|
-
type OperationParameterModel = OperationModel['parameters'][number];
|
|
6
|
-
type SchemaFieldModel = NonNullable<SchemaModel['fields']>[number];
|
|
7
|
-
export declare abstract class OpenApiSearchBuilder {
|
|
8
|
-
#private;
|
|
9
|
-
protected readonly parser: OpenAPIParser;
|
|
10
|
-
protected readonly options: Options;
|
|
11
|
-
protected readonly basePath: string;
|
|
12
|
-
constructor(parser: OpenAPIParser, options: Options, basePath: string);
|
|
13
|
-
getOperation(item: OperationMenuItem): OperationModel;
|
|
14
|
-
protected buildSearchDocument(item: ContentItemModel): SearchDocument | undefined;
|
|
15
|
-
protected abstract buildOperationDocument(operation: OperationModel, rbac: Record<string, string> | undefined): SearchDocument | undefined;
|
|
16
|
-
protected collectOperationSearchParameters(operation: OperationModel): OperationParameter[];
|
|
17
|
-
protected abstract addSchema(parameters: Record<string, OperationParameter>, schema: SchemaModel | undefined, mediaType: string | undefined, place: string, isResponse: boolean, path?: string[], visitedPointers?: Set<string>, level?: number): void;
|
|
18
|
-
protected createOperationDocumentBase(operation: OperationModel, rbac?: Record<string, string> | undefined): SearchDocument | undefined;
|
|
19
|
-
protected createOperationParameter(parameter: OperationParameterModel): OperationParameter;
|
|
20
|
-
protected createSchemaFieldParameter(field: SchemaFieldModel, schema: SchemaModel, place: string, mediaType: string | undefined, path: string[]): OperationParameter;
|
|
21
|
-
protected getParameterId(param: OperationParameter): string;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=openapi-search-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as u from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{combineUrls as d}from"@redocly/theme/core/utils";import{removeMarkdownLinks as c,stripFormatting as a}from"./utils.js";const o=u.default||u;class g{parser;options;basePath;constructor(e,t,n){this.parser=e,this.options=t,this.basePath=n}getOperation(e){return o.getOperation(this.parser,e.operationDefinition,e.parent,{...this.options,internal_skipSamples:!0},e.href)}buildSearchDocument(e){switch(e.type){case"tag":case"section":return this.#e(e,!0);case"operation":return this.buildOperationDocument(this.getOperation(e),e[i]);case"rsrc":case"prompt":case"tool":return this.#e(e,!1);default:return}}collectOperationSearchParameters(e){const t={};for(const r of e.parameters){if(r[i])continue;const s=this.createOperationParameter(r);t[this.getParameterId(s)]=s}const n=new Set;this.addSchema(t,e.requestBody?.content?.mediaTypes[0]?.schema,e.requestBody?.content?.mediaTypes[0]?.name,"request fields",!1,[],n);for(const r of e.responses)this.addSchema(t,r.content?.mediaTypes[0]?.schema,r.content?.mediaTypes[0]?.name,`response ${r.code} fields`,!0,[],n);return Object.values(t)}createOperationDocumentBase(e,t){if(e.type!=="operation")return;const n=d(this.basePath,e.href);return{id:n,url:n,title:a(e.name),text:a(c(e.description||"")),httpMethod:e.httpVerb,httpPath:e.path,deprecated:e.deprecated,security:e.security.map(r=>r.schemes.map(s=>s.id)).flat().filter(Boolean),parameters:this.collectOperationSearchParameters(e),...t?{[i]:t}:{}}}createOperationParameter(e){const t=e.schema?.example||e.example;return{name:e.name,description:a(c(e.description)),place:`${e.in} parameters`,mediaType:void 0,type:e.schema?.type.toString()||"unknown",deepLink:o.generateDeepLink(e),required:e.required,example:t?JSON.stringify(t):void 0,enum:e.schema?.enum?.length?e.schema.enum:void 0}}createSchemaFieldParameter(e,t,n,r,s){const p=e.schema?.example||e.example,m=e.schema?.enum;return{name:e.name,description:a(e.description),place:n,mediaType:r,path:s,deepLink:o.generateDeepLink(e),type:e.schema?.type.toString()||"unknown",required:e.required||t.schema.required?.includes(e.name)||!1,example:p?JSON.stringify(p):void 0,enum:m?.length?m:void 0}}getParameterId(e){return[...e.path||[],e.name.toString()].join(".")+e.description+e.place}#e(e,t){const n=d(this.basePath,e.href);return{id:n,url:n,text:a(c(e.description||"")),title:t?a(e.name):e.name}}}export{g as OpenApiSearchBuilder};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ContentItemModel, OpenAPIParser, Options, OpenAPIInfo } from '@redocly/openapi-docs';
|
|
2
|
-
import type { AfterRoutesCreatedActions, AfterRoutesCreatedLifecycleContext, MdPageStaticData, PageRouteDetails } from '../../../types';
|
|
3
|
-
import type { AiDocumentsStore } from '../../../plugins/search/types.js';
|
|
4
|
-
import type { TagOperations } from '../types.js';
|
|
5
|
-
import type { SearchFacet } from '@redocly/theme/core/types';
|
|
6
|
-
export declare const getAiDocumentsStore: ({ parser, options, info, tagOperations, relativePath, openapiContentItem, metadata, getSearchFacets, includeInLLMsTxt, excludeFromSearch, }: {
|
|
7
|
-
parser: OpenAPIParser;
|
|
8
|
-
options: Options;
|
|
9
|
-
info: OpenAPIInfo;
|
|
10
|
-
tagOperations: TagOperations;
|
|
11
|
-
relativePath: string;
|
|
12
|
-
openapiContentItem: ContentItemModel;
|
|
13
|
-
metadata: Record<string, unknown>;
|
|
14
|
-
getSearchFacets: () => Map<string, SearchFacet>;
|
|
15
|
-
includeInLLMsTxt: boolean;
|
|
16
|
-
excludeFromSearch?: boolean;
|
|
17
|
-
}) => (route: PageRouteDetails, staticData: MdPageStaticData, context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
|
|
18
|
-
//# sourceMappingURL=get-ai-search-documents.d.ts.map
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as x}from"@redocly/config";import{basename as C,join as q}from"node:path";import _ from"@markdoc/markdoc";import{joinSectionContent as G}from"../../../plugins/markdown/search/join-section-content.js";import{toMarkdown as J}from"../../../plugins/markdown/search/to-markdown.js";import{AstToSearchNodeTransformer as B}from"../../../plugins/markdown/search/walk-sections.js";import{createRenderTagFn as z}from"../../../plugins/markdown/search/create-render-tag-fn.js";import{getBuildTranslateContext as v}from"../../../utils/l10n/get-build-translate-context.js";import{canDownloadApiDefinition as Y,isResourcePubliclyAccessible as H}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as V}from"../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as K}from"../../../constants/rbac.js";import{getLlmsTxtMdPathBySlug as Q}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{AiSearchIndexer as W}from"../ai-search-indexer.js";import{getLocaleFromRelativePath as X}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as Z}from"./search-facets.js";import{formatDocumentMetadata as I}from"../../search/utils.js";import{llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as ee}from"../store-definition-bundles.js";const j=new Map,Ee=({parser:s,options:c,info:n,tagOperations:r,relativePath:t,openapiContentItem:e,metadata:i,getSearchFacets:u,includeInLLMsTxt:a,excludeFromSearch:f})=>async(o,p,l,O)=>{if(f)return;const U=await o.getNavText?.()||C(o.fsPath),w=new W(s,c,o.baseSlug||o.slug),m=w.addItem(e);if(!m)return;const T=await l.getConfig(),D=Array.isArray(m.title)?m.title.join(" "):m.title;let $,d,y=j.get(t);if((e.type==="tag"||e.type==="section"&&e.infoDefinition)&&!y){const{all:A,publiclyAccessible:g}=ue(r.tagged,w,T),{all:S,publiclyAccessible:b}=le(r.untagged,w,T);j.set(t,{taggedSearchDocuments:new Map(A),untaggedSearchDocuments:S,publiclyAccessibleTaggedSearchDocuments:new Map(g),publiclyAccessibleUntaggedSearchDocuments:b})}y=j.get(t);const h="#";switch(e.type){case"operation":const A=w.getOperation(e);$=d=ce({title:D,security:s.definition.security,document:m,version:m.version||n.version,headingLevel:h,operation:A});break;case"section":if(e.infoDefinition){y=j.get(t),d=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:U,config:T}),d+=`
|
|
2
|
-
`;for(const[S,b]of y?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!b.length)continue;const k=s.definition.tags?.find(L=>L.name===S);d+=E({title:k?.["x-displayName"]||S,description:k?.description,operationSearchDocuments:b,headingLevel:`${h}#`})}const g=y?.publiclyAccessibleUntaggedSearchDocuments||[];g.length&&(d+=E({title:"Other",description:void 0,operationSearchDocuments:g,headingLevel:`${h}#`})),$=await N({parser:s,info:n,staticData:p,relativePath:t,headingLevel:h,pageName:U,config:T})}else if(e.ast){const g=new _.Ast.Node("document",{},e.ast),{locale:S,translate:b}=await v(o.slug,O.getGlobalData?.().l10n),k=Array.from(new B({ast:g,partials:{},renderTag:z(O.markdocOptions.tags,S,b),getInnerContent:J,skipConditionals:!0}).transform());d=$=G(k)}break;case"tag":d=E({title:D,description:e.description,operationSearchDocuments:y?.publiclyAccessibleTaggedSearchDocuments.get(e.name)||[],headingLevel:h}),$=E({title:D,description:e.description,operationSearchDocuments:[],headingLevel:h});break;case"rsrc":case"prompt":case"tool":d=re({title:D,description:e.description,name:e.name,xMcpConfig:s.definition["x-mcp"],headingLevel:h}),$=d;break}return{async getLLMsTxts(){return[{title:e.name,description:e.type==="tag"?e.description:void 0,content:d||"",slug:o.slug,fsPath:o.fsPath,includeInLLMsTxt:a}]},async getSearchDocuments(){if(e.type==="operation"||e.type==="section"&&(e.infoDefinition||e.ast)||e.type==="tag"){const A=X(o.fsPath),g=Z({...m,...i},n,u);return[{title:D,description:Array.isArray(m.text)?m.text.join(" "):m.text,content:$||"",url:m.url??o.slug,fsPath:o.fsPath,locale:A,product:o.product?.name,rbacTeams:m.rbacTeams,facets:g}]}return[]}}};async function N({parser:s,info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}){const u=I(c["x-metadata"]);let a=c.title?`${e} ${c.title}
|
|
3
|
-
|
|
4
|
-
`:`${e} ${t}
|
|
5
|
-
|
|
6
|
-
`;return a+=c.description?`${c.description}
|
|
7
|
-
|
|
8
|
-
`:"",a+=c.summary?`${c.summary}
|
|
9
|
-
|
|
10
|
-
`:"",a+=c.version?`Version: ${c.version}
|
|
11
|
-
`:"",a+=c.license?`License: ${c.license.name}
|
|
12
|
-
`:"",e=`${e}#`,a+=u.length?`Metadata:
|
|
13
|
-
${u}
|
|
14
|
-
`:"",a+=`
|
|
15
|
-
`,a+=ne({parser:s,headingLevel:e}),a+=se({parser:s,headingLevel:e}),a+=await te({info:c,staticData:n,relativePath:r,pageName:t,headingLevel:e,config:i}),a}function E({title:s="",description:c,operationSearchDocuments:n,headingLevel:r}){let t=`${r} ${s}
|
|
16
|
-
|
|
17
|
-
`;return c&&(t+=`${c}
|
|
18
|
-
|
|
19
|
-
`),n.length&&n.forEach(e=>{const i=Array.isArray(e.title)?e.title.join(" "):e.title;t+=`${r}# ${i}${e.deprecated?" (deprecated)":""}
|
|
20
|
-
|
|
21
|
-
`,t+=` - ${M({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:Q(e.url)})}`,t+=`
|
|
22
|
-
`}),t}function ne({parser:s,headingLevel:c}){const{servers:n}=s.definition;if(n&&n.length){let r=`${c} Servers
|
|
23
|
-
|
|
24
|
-
`;return n.forEach(t=>{r+=t.description?`${t.description}
|
|
25
|
-
`:"",r+=`\`\`\`
|
|
26
|
-
${t.url}
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
`,t.variables&&(r+=`Variables:
|
|
30
|
-
`,Object.entries(t.variables).forEach(([e,i])=>{r+=`- \`${e}\`${i.description?`: ${i.description}`:""}
|
|
31
|
-
`,r+=i.default?`Default: ${JSON.stringify(i.default)}
|
|
32
|
-
`:"",r+=i.enum?`Enum: ${i.enum.map(u=>JSON.stringify(u)).join(", ")}
|
|
33
|
-
`:""}),r+=`
|
|
34
|
-
`)}),r}return""}async function te({info:s,staticData:c,relativePath:n,pageName:r,headingLevel:t,config:e}){const i=q(c.props?.outdir||"",V,ee(n,".yaml")),u=e.access?.rbac,a=e.access?.requiresLogin;if(Y(i,u??{},a??!1,K)){let f=`${t} Download OpenAPI description
|
|
35
|
-
|
|
36
|
-
`;return f+=M({title:s.title||r||"OpenAPI definition",description:void 0,slug:i}),f}return""}function se({parser:s,headingLevel:c}){if(!s.definition.components?.securitySchemes)return"";let n=`${c} Security
|
|
37
|
-
|
|
38
|
-
`;const{securitySchemes:r}=s.definition.components;return Object.keys(r).forEach(t=>{const e=r[t];e&&(n+=`${c}# ${t}
|
|
39
|
-
|
|
40
|
-
`,n+=e.description?`${e.description}
|
|
41
|
-
|
|
42
|
-
`:"",e.type&&(n+=`Type: ${e.type}
|
|
43
|
-
`),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
|
|
44
|
-
`),e.in&&(n+=`In: ${e.in}
|
|
45
|
-
`),e.name&&(n+=`Name: ${e.name}
|
|
46
|
-
`),e.scheme&&(n+=`Scheme: ${e.scheme}
|
|
47
|
-
`),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
|
|
48
|
-
`),e.flows?.implicit?.authorizationUrl&&(n+=`Authorization URL: ${e.flows.implicit?.authorizationUrl}
|
|
49
|
-
`),e.flows?.implicit?.scopes&&(n+=`Scopes:
|
|
50
|
-
`,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
|
|
51
|
-
`})),e.flows?.password?.tokenUrl&&(n+=`Token URL: ${e.flows.password?.tokenUrl}
|
|
52
|
-
`),e.flows?.password?.scopes&&(n+=`Scopes:
|
|
53
|
-
`,Object.entries(e.flows?.password?.scopes||{}).forEach(([i,u])=>{n+=`- \`${i}\`: ${u}
|
|
54
|
-
`})),n+=`
|
|
55
|
-
`)}),n}function ce({title:s,security:c,document:n,version:r,headingLevel:t,operation:e}){const{text:i,httpMethod:u,httpPath:a,deprecated:f}=n,o=ae(n.parameters||[],`${t}#`),p=ie(`${t}#`,n.parameters,e);let l=s?`${t} ${s}${f?" (deprecated)":""}
|
|
56
|
-
|
|
57
|
-
`:"";return l+=i?`${i}
|
|
58
|
-
|
|
59
|
-
`:"",l+=`Endpoint: ${u?.toUpperCase()} ${a}
|
|
60
|
-
`,l+=r?`Version: ${r}
|
|
61
|
-
`:"",l+=n.security?.length?`Security: ${n.security.join(", ")}
|
|
62
|
-
`:c?.length?`Security: ${c.map(O=>O.id).join(", ")}
|
|
63
|
-
`:"",l+=`
|
|
64
|
-
`,l+=o?`${o}
|
|
65
|
-
`:"",l+=`
|
|
66
|
-
`,l+=`${p.join(`
|
|
67
|
-
`)}`,l}function re({title:s,name:c,xMcpConfig:n,headingLevel:r}){const t=n?.tools.find(i=>i.name===c);if(!t)return"";let e=`${r} ${s}
|
|
68
|
-
|
|
69
|
-
`;return e+=t.description?`${t.description}
|
|
70
|
-
|
|
71
|
-
`:"",e+=`${r}# Input schema:
|
|
72
|
-
|
|
73
|
-
`,e+=`\`\`\`json
|
|
74
|
-
${JSON.stringify(t.inputSchema,null,2)}
|
|
75
|
-
\`\`\`
|
|
76
|
-
|
|
77
|
-
`,t.outputSchema&&(e+=`${r}# Output schema:
|
|
78
|
-
|
|
79
|
-
`,e+=`\`\`\`json
|
|
80
|
-
${JSON.stringify(t.outputSchema,null,2)}
|
|
81
|
-
\`\`\`
|
|
82
|
-
|
|
83
|
-
`),e}function ie(s,c,n){return!c&&!n||!n?.responses?[]:n?.responses.filter(t=>!t.content?.mediaTypes[0]?.schema).map(t=>`${s} ${R(`response ${t.code} fields`)}
|
|
84
|
-
`)}function oe(s,c,n,r){const t=JSON.stringify(s),e=r.get(t);return e?`${n}Enum: same as ${e} (${s.length} values)
|
|
85
|
-
`:(r.set(t,c),`${n}Enum: ${s.map(i=>JSON.stringify(i)).join(", ")}
|
|
86
|
-
`)}function P(s,c,n,r){const t=`${c} `,e=s.oneOf,u=[...s.path||[],s.name].join("."),a=Array.isArray(s.description)?s.description.join(" "):s.description,f=!!e&&e.variants.length>1;let o=`${c}- \`${u}\` (${s.type}${s.required?", required":""})`;if(f&&(o+=e.discriminator?` \u2014 one of (discriminator: ${e.discriminator}):`:" \u2014 one of:"),o+=`
|
|
87
|
-
`,o+=a?`${t}${a.trim()}
|
|
88
|
-
`:"",s.enum){const p=r?`\`${u}\` in "${r}"`:`\`${u}\``;o+=oe(s.enum,p,t,n)}else s.example&&(o+=`${t}Example: ${s.example}
|
|
89
|
-
`);if(f)for(const p of e.variants){o+=`${c} - ${p.title}:
|
|
90
|
-
`;for(const l of p.parameters)o+=P(l,`${c} `,n,p.title)}else if(e)for(const p of e.variants[0].parameters)o+=P(p,`${c} `,n);return o}function ae(s,c){const n={};for(const e of s){const i=`${e.place}${e.mediaType?` (${e.mediaType})`:""}`;n[i]=[...n[i]||[],e]}const r=new Map;return Object.entries(n).map(([e,i])=>{const u=i.map(a=>P(a," ",r));return`${c} ${R(e)}:
|
|
91
|
-
|
|
92
|
-
${u.join(`
|
|
93
|
-
`)}`}).join(`
|
|
94
|
-
`)}function ue(s,c,n){const r=[],t=[];return s.forEach((e,i)=>{const u=[],a=[];e.forEach(f=>{const o=c.addItem(f);o&&(u.push(o),F({[x]:f[x],slug:o.url},n)&&a.push(o))}),r.push([i,u]),t.push([i,a])}),{all:r,publiclyAccessible:t}}function le(s,c,n){const r=[],t=[];return s.forEach(e=>{const i=c.addItem(e);i&&(r.push(i),F({[x]:e[x],slug:i.url},n)&&t.push(i))}),{all:r,publiclyAccessible:t}}function R(s){return s.charAt(0).toUpperCase()+s.slice(1)}function F(s,c){return c.access?.requiresLogin?!0:H(s,c)}export{Ee as getAiDocumentsStore};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SearchFacet } from '@redocly/theme/core/types';
|
|
2
|
-
import type { OpenAPIInfo } from '@redocly/openapi-docs/lib/types';
|
|
3
|
-
export declare function setDocumentSearchFacets(documentSearchFacets: {
|
|
4
|
-
[key: string]: string | Set<string>;
|
|
5
|
-
}, getSearchFacets: () => Map<string, SearchFacet>, setSearchFacets: (searchFacets: Map<string, SearchFacet>) => void): void;
|
|
6
|
-
export declare function extractDocumentSearchFacets(metadata: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}, info: OpenAPIInfo, getSearchFacets: () => Map<string, SearchFacet>): {
|
|
9
|
-
[key: string]: string;
|
|
10
|
-
};
|
|
11
|
-
//# 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(t,o,s){const e=o();for(const[n,r]of Object.entries(t)){const c=e.get(n);if(c){const i=new Set(c.values??[]);r instanceof Set?[...r].forEach(a=>c.values=Array.from(i.add(a))):c.values=Array.from(i.add(r))}}s(e)}function p(t,o,s){const e={[f]:u,apiTitle:o.title,apiVersion:o.version?.toString()};if(!t)return e;const n=s();for(const[r,c]of Object.entries(t))n.has(r)&&(e[r]=String(c));return t.title&&(e.apiTitle=t.title),e}export{p as extractDocumentSearchFacets,h as setDocumentSearchFacets};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SearchFacet } from '@redocly/theme/core/types';
|
|
2
|
-
import type { ContentItemModel, OpenAPIParser, Options } from '@redocly/openapi-docs';
|
|
3
|
-
import type { PageRouteDetails, SearchDocument } from '../../../types';
|
|
4
|
-
export declare function searchResolver(parser: OpenAPIParser, options: Options, flatItems: ContentItemModel[], getSearchFacets: () => Map<string, SearchFacet>, setSearchFacets: (searchFacets: Map<string, SearchFacet>) => void, excludeFromSearch?: boolean): (route: PageRouteDetails) => Promise<SearchDocument[]>;
|
|
5
|
-
//# sourceMappingURL=search-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as f,REDOCLY_TEAMS_RBAC as s}from"@redocly/config";import{SearchIndexer as R}from"../search-indexer.js";import{extractDocumentSearchFacets as g,setDocumentSearchFacets as S}from"./search-facets.js";function E(n,i,m,c,d,l){return async t=>{if(l)return[];const o=t.metadata||{},a=new R(n,i,t.baseSlug||t.slug);a.addInfo(n.definition.info,o);for(const e of m)a.addItem(e);const h={},r=g(o,n.definition.info,c),u=a.getResult().map(e=>({...e,[s]:e[s]||t[s],[f]:t[f]||{slug:t.slug,fsPath:t.fsPath},facets:r}));return S({...r,...h},c,d),u}}export{E as searchResolver};
|