@redocly/framework 1.0.0-next.1 → 1.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/commands/translate.js +1 -1
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/content-layer/config-schema.d.ts +7 -2
- package/dist/content-layer/config-schema.js +1 -1
- package/dist/content-layer/config.d.ts +22 -9
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/context.d.ts +2 -0
- package/dist/content-layer/context.js +1 -1
- package/dist/content-layer/database/assets.js +1 -1
- package/dist/content-layer/database/blobs.js +1 -1
- package/dist/content-layer/database/entity-store.d.ts +5 -0
- package/dist/content-layer/database/entity-store.js +1 -1
- package/dist/content-layer/database/files.js +1 -1
- package/dist/content-layer/database/finalize.js +1 -1
- package/dist/content-layer/database/invalidation.d.ts +6 -0
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/database/link-refs.js +1 -1
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/route-query-deps.js +1 -1
- package/dist/content-layer/database/schema.d.ts +33 -0
- package/dist/content-layer/database/schema.js +1 -1
- package/dist/content-layer/database/search-vocab.js +2 -2
- package/dist/content-layer/database/site-config.d.ts +23 -0
- package/dist/content-layer/database/site-config.js +1 -1
- package/dist/content-layer/database/static-files.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/hook-inputs.js +1 -1
- package/dist/content-layer/ingest/run.js +1 -1
- package/dist/content-layer/ingest/search-sync.js +1 -1
- package/dist/content-layer/ingest/sync.js +1 -1
- package/dist/content-layer/link-checker/delta.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/markdown/constants/tag-sets.d.ts +2 -0
- package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
- package/dist/content-layer/markdown/nodes/table.js +1 -1
- package/dist/content-layer/markdown/resolve/ast.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-snippet.js +5 -4
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-walkthrough/filesets.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/diagram-file.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.d.ts +2 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
- package/dist/content-layer/markdown/resolve/render-diagrams.d.ts +8 -1
- package/dist/content-layer/markdown/resolve/render-diagrams.js +1 -1
- package/dist/content-layer/markdown/tags/markdoc-error.d.ts +8 -0
- package/dist/content-layer/markdown/tags/markdoc-error.js +1 -1
- package/dist/content-layer/markdown/utils/node-source-range.d.ts +3 -3
- package/dist/content-layer/markdown/utils/node-source-range.js +1 -1
- package/dist/content-layer/materialization/asset-reconcile.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plan-gates.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +4 -4
- package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.d.ts +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.d.ts +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/sidebars.d.ts +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.d.ts +4 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +2 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.d.ts +2 -1
- package/dist/content-layer/plugins/internal/sidebar/index.js +1 -1
- package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
- package/dist/content-layer/plugins/types/search.d.ts +13 -2
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/problems/codes.d.ts +10 -0
- package/dist/content-layer/problems/codes.js +1 -1
- package/dist/content-layer/revisions/delete.js +1 -1
- package/dist/content-layer/search/engine/core/search-engine.js +1 -1
- package/dist/content-layer/search/facet-rows.js +1 -1
- package/dist/content-layer/search/keywords.d.ts +18 -0
- package/dist/content-layer/search/keywords.js +1 -0
- package/dist/content-layer/search/postings/postings-store.d.ts +14 -0
- package/dist/content-layer/search/postings/postings-store.js +1 -1
- package/dist/content-layer/search/store.d.ts +3 -1
- package/dist/content-layer/server/database.js +1 -1
- package/dist/content-layer/static/registry.js +1 -1
- package/dist/content-layer/versions/group-info.d.ts +21 -0
- package/dist/content-layer/versions/group-info.js +1 -0
- package/dist/content-layer/versions/redirect.d.ts +13 -11
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.d.ts +1 -21
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/content-layer/versions/version-groups.d.ts +1 -1
- package/dist/content-layer/versions/version-groups.js +1 -1
- package/dist/server/__tests__/rbac-fixture.js +1 -1
- package/dist/server/app.js +3 -3
- package/dist/server/content.js +9 -9
- package/dist/server/lambda-entry.js +1 -1
- package/dist/server/node-entry.js +1 -1
- package/dist/server/page-handlers.js +2 -2
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/project-env.d.ts +12 -0
- package/dist/server/project-env.js +1 -0
- package/dist/server/redirects.js +1 -1
- package/dist/server/runtime-config.js +1 -1
- package/dist/server/search/route.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/child-entry.js +1 -1
- package/dist/server/subprocess/host.js +1 -1
- package/dist/server/subprocess/runner.js +1 -1
- package/dist/shared/constants/dependency-pack.js +1 -1
- package/dist/shared/constants/l10n/langs/ar.js +1 -1
- package/dist/shared/constants/l10n/langs/de.js +1 -1
- package/dist/shared/constants/l10n/langs/en.js +1 -1
- package/dist/shared/constants/l10n/langs/es.js +1 -1
- package/dist/shared/constants/l10n/langs/fr.js +1 -1
- package/dist/shared/constants/l10n/langs/hi.js +1 -1
- package/dist/shared/constants/l10n/langs/it.js +1 -1
- package/dist/shared/constants/l10n/langs/ja.js +1 -1
- package/dist/shared/constants/l10n/langs/ko.js +1 -1
- package/dist/shared/constants/l10n/langs/pl.js +1 -1
- package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
- package/dist/shared/constants/l10n/langs/pt.js +1 -1
- package/dist/shared/constants/l10n/langs/ru.js +1 -1
- package/dist/shared/constants/l10n/langs/uk.js +1 -1
- package/dist/shared/constants/l10n/langs/zh.js +1 -1
- package/dist/shared/plan-gates.d.ts +3 -2
- package/dist/shared/search/facets.d.ts +5 -0
- package/dist/shared/search/facets.js +1 -1
- package/dist/shared/types/search.d.ts +1 -0
- package/dist/shared/types/sidebar.d.ts +1 -0
- package/drizzle/20261103061150_site_config_effective_hash/migration.sql +1 -0
- package/drizzle/20261105151816_search_http_path_tokens/migration.sql +1 -0
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{matchGlob as n}from"../plugins/utils/glob.js";import{createTrackedRedoclyConfig as r}from"../config-deps.js";import{buildDataRefMarker as i,hashBlobContent as a}from"../materialization/data-ref.js";import{resolveDataRef as o,upsertBlob as s}from"../database/blobs.js";import{createEntityStore as c}from"../database/entity-store.js";import{createRouteQueryEvaluator as l}from"../plugins/utils/route-index.js";import{
|
|
1
|
+
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{matchGlob as n}from"../plugins/utils/glob.js";import{createTrackedRedoclyConfig as r}from"../config-deps.js";import{buildDataRefMarker as i,hashBlobContent as a}from"../materialization/data-ref.js";import{resolveDataRef as o,upsertBlob as s}from"../database/blobs.js";import{createEntityStore as c}from"../database/entity-store.js";import{createRouteQueryEvaluator as l}from"../plugins/utils/route-index.js";import{createAudienceTagResolver as u}from"../markdown/resolve/audience-tag.js";import{materializeEntityByKey as d}from"../materialization/entity.js";import{createMarkdownService as f}from"../markdown/service.js";import{createSearchHandle as p}from"../search/store.js";import{resolve as m}from"node:path";function h(h,g,_={}){let v,y,b,x,S;return function C(w,T,E){let D=h.pluginRegistry.getById(w.pluginId);if(!D)throw Error(`Entity loader "${w.definition.id}" references missing plugin "${w.pluginId}".`);let{state:O}=h;if(!O)throw Error(`Entity loader "${w.definition.id}" ran before content state was loaded.`);let k=r(h.config),A=k.config.access?.rbac,j=h.config.access?.rbac;(j!==v||y===void 0)&&(v=j,y=u(A,e=>h.logger.warn(e)));let M=y,N=k.config.l10n?.defaultLocale;(S===void 0||S.defaultLocale!==N)&&(x??=e(O.filesByPath.keys()),S={defaultLocale:N,locales:t({defaultLocale:N},x).locales});let P=S.locales,F=[],I=[],L=[];return(b?.state!==O||b.config!==h.config)&&(b={state:O,config:h.config,evaluator:l(O,h.config)}),{args:T??{},config:k.config,contentDir:h.contentDir,file:{absolutePath:m(h.contentDir,E),path:E,lastModifiedAt:O.filesByPath.get(E)?.lastModifiedAt??null},io:{...h.pluginIO,async glob(e){return L.push(e),n(O.filesByPath.keys(),e)}},entities:c({database:g,state:O,materialize:e=>d({database:g,key:e,loaderRegistry:h.pluginRegistry,loaderContextFactory:C,contentDir:h.contentDir,revisions:_.revisions,logger:h.logger}),onEntityRead:e=>F.push(e),record:e=>I.push(e)}),search:p(g),logger:h.logger.child(`content-layer:entity:${w.definition.id}`),plugin:{id:D.id,version:D.version},pluginRegistry:h.pluginRegistry,resolveAudienceTag:M,routes:b.evaluator.index(e=>I.push(e)),markdown:f({state:O,resolveAudienceTag:M,contentLocales:P}),createBlobRef:async(e,t)=>{let n=t?.format??`json`,r=typeof e==`string`?e:Buffer.from(e).toString(`base64`),o=a(r);return await s(g,{key:o,content:r,size:r.length}),i(o,n)},resolveDataRef:e=>o(g,e),_trackedConfig:k,_loadedEntityKeys:F,_globPatterns:L,_routeQueries:I}}}export{h as createBuildTimeEntityLoaderContextFactory};
|
|
@@ -31,6 +31,8 @@ export declare function registerUserMarkdocSchema(schema: UserMarkdocSchema | un
|
|
|
31
31
|
export declare function registerUserMarkdocSchemaFailure(files: readonly string[]): void;
|
|
32
32
|
/** The files the CLI loaded the project schema from; `undefined` when it did not load one. */
|
|
33
33
|
export declare function userMarkdocSchemaFiles(): readonly string[] | undefined;
|
|
34
|
+
/** The tags the registered project schema defines, built-in names included; empty without one. */
|
|
35
|
+
export declare function userMarkdocTagNames(): string[];
|
|
34
36
|
/** Whether the CLI validates pages: it registered the project schema, or found none. */
|
|
35
37
|
export declare function isMarkdocValidationEnabled(): boolean;
|
|
36
38
|
/** The digest of the registered project schema; `undefined` without one. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{builtInMarkdocFunctions as n}from"./builtin-functions.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return a!==void 0&&!o}function
|
|
1
|
+
import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{builtInMarkdocFunctions as n}from"./builtin-functions.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/lib/components/markdoc/defaultMarkdocConfig.js`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(e,t){let r={tags:{...e.tags},nodes:{...e.nodes},functions:{...n,...e.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[n,i]of Object.entries(t[e]??{}))if(y(i)){if(e===`functions`&&n in r.functions){v.has(n)||(v.add(n),console.warn(`[markdoc] The user schema defines the "${n}" function, but the engine already defines it. The engine function is used.`));continue}r[e][n]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:t,nodes:e,functions:n};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MARKDOWN_CLASS_NAME as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n={transform(n,r){let
|
|
1
|
+
import{MARKDOWN_CLASS_NAME as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new t.Tag(`div`,{className:`md-table-wrapper`},[new t.Tag(`table`,{...a,className:[e,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...t.nodes.td,attributes:{...t.nodes.td.attributes,valign:r}},a={...t.nodes.th,attributes:{...t.nodes.th.attributes,valign:r}};function o([e]){if(t.Tag.isTag(e)&&e.name===`thead`){for(let n of e.children)if(t.Tag.isTag(n))for(let e of n.children)t.Tag.isTag(e)&&e.name===`th`&&(e.attributes[`data-label`]=s(e.children))}}function s(e){return e.map(e=>typeof e==`string`||typeof e==`number`?String(e):t.Tag.isTag(e)?s(e.children):``).join(``).trim()}export{n as table,i as td,a as th};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocNodeRange as e}from"../utils/node-source-range.js";import{builtInMarkdocTags as t}from"../constants/builtin-tags.js";import{getExampleContent as n,walkWithExampleContent as r}from"../utils/reparse-example-fences.js";import{parseMarkdownDocument as i}from"../utils/parse-cache.js";import{substituteStaticVariables as a}from"../utils/substitute-variables.js";import{collectMarkdocTagNames as o,isPromptTag as s,resolveMarkdocBuildTimeAttributes as c}from"./markdoc.js";import{inlineRawPartials as l}from"./raw-partials.js";import{renderMarkdocDiagrams as u}from"./render-diagrams.js";import d from"@redocly/markdoc";const f=/* @__PURE__ */ new Set([`parse-error`,`missing-opening`,`missing-closing`,`fence-tag-error`,`no-inline-annotations`]);async function p(e,n,r){let s=await l(e,n,r.resolverContext),f=i(s.source),p=r.validation?v(f,n,h(r.validation)):[],{entityDeps:m,assetUsages:g,linkRefs:_,problems:y}=await c(f,{tags:r.tags??t,sourceFilePath:n,resolverContext:r.resolverContext,source:s.source});r.variables&&a(f,r.variables);let x=await u(f,n,r.resolverContext.logger),S=b(f,n),C=r.transform?.(f)??[];return{ast:d.compact(f),entityDeps:[...s.entityDeps,...m],assetUsages:g,linkRefs:_,tagList:o(f),problems:[...s.problems,...y,...S,...p,...C,...x]}}const m=/* @__PURE__ */ new WeakMap;function h(e){let t=m.get(e);return t===void 0&&(t=d.prepareConfig({...e,tags:g(e.tags),nodes:g(e.nodes)}),m.set(e,t)),t}function g(e){if(e!==void 0)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let{validate:n}=t;return n===void 0?[e,t]:[e,{...t,validate(e,t){try{return n.call(this,e,t)}catch(t){return[{id:`validate-failed`,level:`error`,message:`The validate() of '${e.tag??e.type}' failed: ${_(t)}`}]}}}]}))}const _=e=>e instanceof Error?e.message:String(e);function v(e,t,i){let a=[e],o=/* @__PURE__ */ new Set,c=[];for(let t of r(e,s)){for(let e of t.errors??[])o.add(e);let e=n(t);e&&a.push(e),s(t)&&c.push({node:t,children:t.children})}for(let e of c)e.node.children=[];try{return a.flatMap(e=>d.validate(e,i)).filter(e=>!o.has(e.error)).map(e=>y(e,t))}catch(e){return[{code:`markdoc/validation-error`,message:`Markdoc validation failed: ${_(e)}`,location:{filePath:t,range:{start:{line:1},end:{line:1}}}}]}finally{for(let e of c)e.node.children=e.children}}function y(t,n){let{level:r,message:i}=t.error,a={code:`markdoc/validation-error`,message:i,location:{filePath:n,range:e(t)??{start:{line:1},end:{line:1}}}};return r!==`error`&&r!==`critical`&&(a.severity=`warning`),a}function b(t,n){let i=[];for(let a of r(t))for(let t of a.errors){let r=f.has(t.id)?`markdoc/parse-error`:`markdoc/validation-error`;i.push({code:r,message:t.message,location:{filePath:n,range:e(a)??{start:{line:1},end:{line:1}}}})}return i}export{p as resolveMarkdownAst};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"./context-paths.js";async function n(n){let{node:i,attributeName:a}=n,o=i.attributes[a];if(typeof o!=`string`||o===``||n.io===void 0)return null;let s=t(n,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}];if(!await n.io.exists(s.absolutePath)){let t=`Code snippet file ${s.contentPath} does not exist`;return e(i,t,n.sourceFilePath,c)}let l=await n.io.readFile(s.absolutePath);try{i.attributes.rawContent=r(l,{from:i.attributes.from,to:i.attributes.to,after:i.attributes.after,before:i.attributes.before,prefix:typeof i.attributes.prefix==`string`?i.attributes.prefix:``,contentPath:s.contentPath})}catch(t){let r=t instanceof Error?t.message:String(t);return e(i,r,n.sourceFilePath,c)}return i.children=[],{entityDeps:c}}function r(e,t){let n=t.from??t.after,r=t.to??t.before,i=t.after!=null,a=t.before!=null,o=(typeof n==`number`?Math.max(n||0,1):1)+ +!!i,s=(typeof r==`number`?r:1/0)-+!!a,c=e;if(typeof n==`string`){let e=c.indexOf(n);if(e===-1)throw Error(`Cannot find start text "${n}" in snippet file ${t.contentPath}`);for(;c[e]!==`
|
|
2
2
|
`&&e>0;)e--;Number.isFinite(s)&&e>0&&(s-=c.slice(0,e).split(`
|
|
3
|
-
`).length),c=e===0?c:c.slice(e+1)}if(typeof r==`string`){let e=c.indexOf(r);if(e===-1)throw Error(`Cannot find end text "${r}" in snippet file ${t.contentPath}`);c[e-1]===`
|
|
4
|
-
`&&e
|
|
3
|
+
`).length),c=e===0?c:c.slice(e+1)}if(typeof r==`string`){let e=c.indexOf(r);if(e===-1)throw Error(`Cannot find end text "${r}" in snippet file ${t.contentPath}`);if(a)c[e-1]===`
|
|
4
|
+
`&&e--;else{let t=c.indexOf(`
|
|
5
|
+
`,e);e=t===-1?c.length:t}c=c.slice(0,e)}let l=c.split(`
|
|
5
6
|
`);if(a)for(;l[l.length-1]===``;)l.pop();return t.prefix+l.slice(o-1,s).join(`
|
|
6
|
-
`)}export{
|
|
7
|
+
`)}export{r as extractSnippetRegion,n as resolveCodeSnippetFileAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocErrorResult as e}from"../../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"../context-paths.js";import{mapFileExtensionToLanguage as n}from"./map-file-extension-to-language.js";import{parseFileChunks as r}from"./file-chunk-parser.js";import{join as i,posix as a}from"node:path";import o from"picomatch";async function s(s){let{node:c,attributeName:l}=s,u=s.io,d=c.attributes[l];if(!Array.isArray(d)||u===void 0)return c.attributes.resolvedFilesets=[],null;let f=u,p=[];async function m(e){let c=t(s,e);if(c===null)return s.logger?.warn(`code-walkthrough: cannot resolve "${e}" from ${s.sourceFilePath}`),[];let l=o.scan(c.contentPath).isGlob?await f.glob?.(c.contentPath)??[]:[c.contentPath];return(await Promise.all(l.map(async e=>{p.push({kind:`file`,path:e});let t=i(s.contentDir,e);if(!await f.exists(t))return s.logger?.warn(`code-walkthrough: file ${e} does not exist`),null;let o=await f.readFile(t),{root:c,metadata:l}=r(o,e);return{path:e,content:c,metadata:l,basename:a.basename(e),language:n(a.extname(e))}}))).filter(e=>e!==null)}let h;try{h=await Promise.all(d.map(async e=>{let t=Array.isArray(e.files)?e.files:[],n=Array.isArray(e.downloadAssociatedFiles)?e.downloadAssociatedFiles:[],[r,i]=await Promise.all([Promise.all(t.map(m)),Promise.all(n.map(m))]);return{when:e.when,unless:e.unless,files:r.flat(),downloadAssociatedFiles:i.flat()}}))}catch(t){let n=t instanceof Error?t.message:String(t);return e(c,n,s.sourceFilePath,p)}return c.attributes.resolvedFilesets=h,{entityDeps:p}}export{s as resolveCodeWalkthroughFilesetsAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocErrorResult as e}from"../../tags/markdoc-error.js";import{resolveResolverTarget as t}from"./context-paths.js";async function n(n){let{node:r,attributeName:i}=n,a=r.attributes[i];if(typeof a!=`string`||a===``||n.io===void 0)return null;let o=t(n,a);if(o===null)return null;if(!await n.io.exists(o.absolutePath)){let t=`Diagram file ${o.contentPath} does not exist`;return e(r,t,n.sourceFilePath,[{kind:`file`,path:o.contentPath}])}return r.attributes.rawContent=await n.io.readFile(o.absolutePath),r.children=[],{entityDeps:[{kind:`file`,path:o.contentPath}]}}export{n as resolveDiagramFileAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{
|
|
1
|
+
import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r}from"../../tags/markdoc-error.js";import{resolveResolverTarget as i}from"./context-paths.js";import a from"js-yaml";function o(e){return l(e,`RawContent`,e=>e)}function s(e){return l(e,`Resolved`,e=>a.load(e))}function c(t){let{node:r,attributeName:a,sourceFilePath:o}=t,s=r.attributes[a];if(typeof s!=`string`||s===``)return null;let c=n(o),l=c!==void 0&&s.startsWith(`/`)&&n(s.slice(1))===void 0?`/${e}/${c}${s}`:s,u=i(t,l)?.contentPath;return u!==void 0&&(r.attributes[a]=u),null}async function l(e,n,a){let o=e.node.attributes[e.attributeName];if(typeof o!=`string`||o===``||e.io===void 0)return null;let s=i(e,o);if(s===null)return null;let c=[{kind:`file`,path:s.contentPath}],l=s;if(!await e.io.exists(s.absolutePath)){let n=t(e.sourceFilePath);if(l=n===void 0?null:i({...e,sourceFilePath:n},o),l!==null&&c.push({kind:`file`,path:l.contentPath}),l===null||!await e.io.exists(l.absolutePath)){let t=`File ${s.contentPath} does not exist`;return r(e.node,t,e.sourceFilePath,c)}}let u=await e.io.readFile(l.absolutePath),d;try{d=a(u)}catch(t){let n=t instanceof Error?t.message:String(t),i=`File ${l.contentPath} is not valid: ${n}`;return r(e.node,i,e.sourceFilePath,c)}return e.node.attributes[`${e.attributeName}${n}`]=d,{entityDeps:c}}export{s as resolveParsedYamlAttribute,o as resolveRawContentAttribute,c as resolveRelativePathAttribute};
|
|
@@ -4,5 +4,6 @@ export declare function resolveJsonSchemaRefAttribute(ctx: MarkdocAttributeResol
|
|
|
4
4
|
/** `{% json-example schema={...} %}`: generate a sample value from the resolved schema. */
|
|
5
5
|
export declare function resolveSampleFromJsonSchemaAttribute(ctx: MarkdocAttributeResolverContext): Promise<MarkdocAttributeResolverResult | null>;
|
|
6
6
|
/** `{% json-example value={...} %}`: a literal value passes through; a `{ $ref: "file#/pointer" }`
|
|
7
|
-
* loads the pointed value (a tracked file dep). Failures land in `valueResolvedErrors
|
|
7
|
+
* loads the pointed value (a tracked file dep). Failures land in `valueResolvedErrors` and
|
|
8
|
+
* a problem on the tag's line. */
|
|
8
9
|
export declare function resolveJsonExampleRefAttribute(ctx: MarkdocAttributeResolverContext): Promise<MarkdocAttributeResolverResult | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../ingest/scan.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../ingest/scan.js";import{markdocNodeProblem as n}from"../../utils/node-source-range.js";import{resolveResolverTarget as r}from"./context-paths.js";import{join as i}from"node:path";async function a(e,t){let{bundle:n,createConfig:r,Source:a}=await import(`@redocly/openapi-core`),s=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),c=i(e.contentDir,e.sourceFilePath),l=await n({config:await r({}),doc:{source:new a(c,``),parsed:s}}),u=l.bundle.parsed,d=u.components?.schemas,f=d?.__root?.$ref,p=typeof f==`string`?f.split(`/`).at(-1):void 0;return{oas:u,schema:p?d?.[p]:d?.__root,errors:(l.problems??[]).slice(0,1).map(e=>e.message),fileDeps:o(l.fileDependencies,e.contentDir,c)}}function o(e,n,r){if(e===void 0)return[];let i=/* @__PURE__ */ new Set;for(let a of e){let e=t(n,a);a!==r&&e!==null&&i.add(e)}return[...i].sort()}function s(e,t=[]){return e.length>0||t.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e})),problems:t}:null}function c(e,t){let{node:r,attributeName:i}=e;return r.attributes[`${i}ResolvedErrors`]=t,e.logger?.warn(`${r.tag} in ${e.sourceFilePath}: ${t[0]}`),n(r,t[0],e.sourceFilePath)}async function l(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i))return null;let{oas:o,errors:l,fileDeps:u}=await a(t,i);return n.attributes[`${r}Resolved`]=o,l.length>0?s(u,[c(t,l)]):s(u)}async function u(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i)||n.attributes.value!==void 0)return null;let{oas:o,schema:l,errors:u,fileDeps:d}=await a(t,i);if(u.length>0)return s(d,[c(t,u)]);let f=n.attributes.mode,p=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=p.sample(l,{...f===`read`?{skipWriteOnly:!0}:void 0,...f===`write`?{skipReadOnly:!0}:void 0},o)}catch(e){return s(d,[c(t,[`Failed to generate a sample from the schema: ${e?.message??e}`])])}return s(d)}async function d(t){let{node:n,attributeName:i}=t,a=n.attributes[i],o=e=>({problems:[c(t,[e])]});if(a!==void 0&&n.attributes.schema!==void 0)return o(`The "schema" and "value" attributes are mutually exclusive, use only one.`);if(a===void 0)return n.attributes.schema===void 0?o(`The tag requires a "schema" or "value" attribute.`):null;let s=e(a)?a.$ref:void 0;if(typeof s!=`string`)return n.attributes[`${i}Resolved`]=a,null;let[l,u]=s.split(`#`),d=l?r(t,l):null;if(d===null||t.io===void 0)return o(`Invalid $ref "${s}": the path must stay inside the content directory.`);if(!await t.io.exists(d.absolutePath))return o(`Invalid $ref: no such file ${d.contentPath}`);let p=await t.io.readFile(d.absolutePath),m=[{kind:`file`,path:d.contentPath}],h;try{h=(await import(`js-yaml`)).load(p)}catch(e){return{entityDeps:m,...o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`)}}let g=u?f(h,u):h;return u&&g===void 0?{entityDeps:m,...o(`Invalid $ref: ${d.contentPath} has no value at #${u}`)}:(n.attributes[`${i}Resolved`]=g,{entityDeps:m})}function f(t,n){let r=t;for(let t of n.split(`/`).slice(+!!n.startsWith(`/`))){let n=t.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r))r=r[Number(n)];else if(e(r))r=r[n];else return}return r}export{d as resolveJsonExampleRefAttribute,l as resolveJsonSchemaRefAttribute,u as resolveSampleFromJsonSchemaAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compileRouteAccessMatcher as e,matchContentScope as t}from"../../../../server/rbac/engine.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{SPEC_KIND_OPENAPI as r}from"../../../plugins/types/api-entity.js";import{
|
|
1
|
+
import{compileRouteAccessMatcher as e,matchContentScope as t}from"../../../../server/rbac/engine.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{SPEC_KIND_OPENAPI as r}from"../../../plugins/types/api-entity.js";import{markdocNodeProblem as i}from"../../utils/node-source-range.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../server/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,t){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${t}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[i(e.node,t,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(e){let t=n(e.options)?e.options:{};return n(t.mockServer)?{...t,mockServer:{...t.mockServer,position:`off`}}:t}function b(e,t){let r=v(e,`language`),i=v(e,`options`);return{...t,...i,codeSamples:{...n(t.codeSamples)?t.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let i=async()=>{let{buildItems:i}=await import(`@redocly/api-docs`),a=u(t.document,r,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await i({type:r,document:a,options:{...n,specType:r,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return i();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=i(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(n,r,i){let a=e(n.config);if(a===null)return{};let o=t(a,{filePath:r,slug:i??null});return{[f]:o??{}}}async function I(e){let{definition:t,problems:i}=await h(e);if(t===null)return{problems:i};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs`),f=t.metadata,p=n(f.options)?f.options:{},m=await P(e,t.contentPath),g=l(p,e.config,m),_=v(e,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(t.document,r,{warn:t=>e.logger?.warn(t)}),S=d(x,b,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!S)return null;let C=N(S.source,v(e,`mimeType`),v(e,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(e,t.contentPath,m)};return e.node.attributes[e.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../../tags/markdoc-error.js";import{shiftRange as n}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as r}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as i}from"./context-paths.js";import{getPartialsFolders as a,isPartialPath as o}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as s,computeFrontmatterLineOffset as c}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as l}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as u}from"../markdoc.js";async function d(n){let{node:d,attributeName:p}=n,m=d.attributes[p];if(typeof m!=`string`||m===``||n.io===void 0)return null;let h=i(n,m);if(h===null)return null;if(!o(h.contentPath,n.config)){let t=`Partial ${h.contentPath} must live in a partials folder (markdown.partialsFolders: ${a(n.config).join(`, `)})`;return e(d,t,n.sourceFilePath)}let g=n.partialChain??[n.sourceFilePath];if(g.includes(h.contentPath))return t(d,`Circular partial inclusion: ${[...g,h.contentPath].join(` -> `)}`),{entityDeps:[{kind:`file`,path:h.contentPath}]};if(!await n.io.exists(h.absolutePath)){let t=`Partial file ${h.contentPath} does not exist`;return e(d,t,n.sourceFilePath,[{kind:`file`,path:h.contentPath}])}let _=await n.io.readFile(h.absolutePath),v=_.replace(s,``),y=structuredClone(n.markdown.parseCached(v)),b=await u(y,{tags:n.tags,sourceFilePath:h.contentPath,resolverContext:{config:n.config,contentDir:n.contentDir,entities:n.entities,file:n.file,io:n.io,logger:n.logger,markdown:n.markdown,plugin:n.plugin},partialChain:[...g,h.contentPath],source:v}),x=d.attributes.variables;typeof x==`object`&&x&&!Array.isArray(x)&&l(y,x),d.children=y.children;let S=c(_);return{entityDeps:[{kind:`file`,path:h.contentPath},...b.entityDeps],assetUsages:b.assetUsages,linkRefs:r(b.linkRefs,h.contentPath,S),problems:b.problems.map(e=>f(e,S))}}function f(e,t){if(t===0||e.location?.range===void 0)return e;let r={...e.location,range:n(e.location.range,t)};return{...e,location:r}}export{d as resolvePartialFileAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{delocalizeL10nPath as e}from"../../../../shared/utils/l10n.js";import{
|
|
1
|
+
import{delocalizeL10nPath as e}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as t}from"../../tags/markdoc-error.js";import{resolveResolverTarget as n}from"./context-paths.js";import{prefixSvgIds as r}from"../../utils/prefix-svg-ids.js";async function i(i,a={}){let{node:o,attributeName:s}=i,c=o.attributes[s];if(typeof c!=`string`||c===``||i.io===void 0)return null;let l=n(i,c);if(l===null)return null;let u=[{kind:`file`,path:l.contentPath}],d=l;if(!await i.io.exists(l.absolutePath)){let r=e(i.sourceFilePath);if(d=r===void 0?null:n({...i,sourceFilePath:r},c),d===null||!await i.io.exists(d.absolutePath)){if(a.optional)return null;let e=`SVG file ${l.contentPath} does not exist`;return t(o,e,i.sourceFilePath,u)}u.push({kind:`file`,path:d.contentPath})}let f=await i.io.readFile(d.absolutePath),p=d.contentPath.replace(/[^a-zA-Z0-9_-]/g,`-`);return o.attributes[`${s}RawContent`]=r(f,p),{entityDeps:u}}export{i as resolveSvgContentAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{replaceWithMarkdocError as
|
|
1
|
+
import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{walkMarkdocAst as n}from"../utils/walk-markdoc-ast.js";import{getExampleContent as r,walkWithExampleContent as i}from"../utils/reparse-example-fences.js";import{isLocalReference as a}from"./references.js";import{resolveLinkAttribute as o}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as s,resolveImageAttribute as c,resolveImageSrcSetAttribute as l}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as u}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as d}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as f}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as p}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as m}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as h}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as g}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as _}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as v,resolveRawContentAttribute as y,resolveRelativePathAttribute as b}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as x,resolveJsonSchemaRefAttribute as S,resolveSampleFromJsonSchemaAttribute as C}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as w,resolveOpenapiCodeSamplesAttribute as T,resolveOpenapiExampleAttribute as E,resolveOpenapiReplayAttribute as D,resolveOpenapiResponsePanelAttribute as O,resolveOpenapiResponseSamplesAttribute as k}from"./markdoc-resolvers/operation-samples.js";import{getAttributeBuildTimeResolver as A}from"./attribute-resolver-key.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,a){let o=a.tags??{},s=F,c={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},l=a.resolverContext?.markdown?.disabledTags,u=R(a.source),d=[...n(e,{skipChildren:z})],f=d.flatMap(e=>{let t=r(e);return t?[...i(t,z)]:[]});for(let e of[...d,...f])M(e);let p=f.filter(e=>e.type===`tag`);for(let e of[...d,...p])if(e.type===`link`)await L(s.nativeMdLink,e,`href`,a,c,u);else if(e.type===`image`)await L(s.imageSrc,e,`src`,a,c,u);else if(e.type===`tag`){if(typeof e.tag==`string`&&l?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let n=typeof e.tag==`string`?o[e.tag]:void 0;for(let[t,r]of Object.entries(n?.attributes??{})){let n=A(r);if(!n)continue;let i=s[n];i&&await L(i,e,t,a,c,u)}}return c}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>o(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return c(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await d(e,{optional:!0}),s(r,t,i,n)},codeSnippetFile:u,diagramFile:_,svgContent:d,tagRawContent:f,htmlAttrs:p,imageGallery:m,codeWalkthroughFilesets:h,partialFile:g,jsonSchemaRef:S,sampleFromJsonSchema:C,jsonExampleRef:x,openapiCodeSamples:T,openapiCodeSamplePanel:w,openapiReplay:D,openapiResponseSamples:k,openapiResponsePanel:O,openapiExample:E,rawContent:y,parsedYaml:v,relativePath:b};function I(e){let t=/* @__PURE__ */ new Set;for(let n of i(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&a(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Node as MarkdocNode } from '@redocly/markdoc';
|
|
2
|
+
import type { ProblemDraft } from '../../problems/types.js';
|
|
2
3
|
import type { Logger } from '../../../shared/logger.js';
|
|
3
4
|
export type DiagramType = 'mermaid' | 'excalidraw' | 'plantuml';
|
|
4
5
|
export type DiagramInput = {
|
|
@@ -9,9 +10,15 @@ export type DiagramHtmlVariants = {
|
|
|
9
10
|
light: string;
|
|
10
11
|
dark: string;
|
|
11
12
|
error?: string;
|
|
13
|
+
/** True when the service gave no render, so a later render of the same source can succeed. */
|
|
14
|
+
retryable?: boolean;
|
|
12
15
|
};
|
|
13
16
|
/** Include the date in gantt hashes that show the current-day marker. */
|
|
14
17
|
export declare function generateDiagramHash(source: string, type?: DiagramType): string;
|
|
15
18
|
/** Return an error result when the diagram service fails. */
|
|
16
19
|
export declare function renderDiagramsWithVariants(diagrams: DiagramInput[], logger?: Logger): Promise<DiagramHtmlVariants[]>;
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Stamps the rendered SVG variants onto the diagram nodes of `ast`. Returns a
|
|
22
|
+
* `markdoc/diagram-service-failed` problem for each diagram the service did not render.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderMarkdocDiagrams(ast: MarkdocNode, sourceFilePath: string, logger?: Logger): Promise<ProblemDraft[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocNodeProblem as e}from"../utils/node-source-range.js";import{DIAGRAM_LANGUAGES as t}from"../nodes/fence.js";import{walkWithExampleContent as n}from"../utils/reparse-example-fences.js";import{createHash as r}from"node:crypto";import{nanoid as i}from"nanoid";const a=/* @__PURE__ */ new Map;function o(e){return r(`sha256`).update(e).digest(`hex`)}function s(e,t=`mermaid`){let n=`${t}:${e}`;if(t===`mermaid`&&e.toLowerCase().includes(`gantt`)&&!e.toLowerCase().includes(`todaymarker off`)){let e=(/* @__PURE__ */ new Date()).toISOString().split(`T`)[0];return o(n+e)}return o(n)}function c(){return globalThis.process?.env?.REDOCLY_DIAGRAM_MICROSERVICE_URL||`https://tools.redocly.com/diagram-renders`}async function l(e,t,n){let r=await fetch(c(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:e,definitions:t,rayId:n,theme:`both`})});if(r.status!==200)throw Error(`Diagram rendering service returned ${r.status}`);return await r.json()}async function u(e,t){if(e.length===0)return[];let n=/* @__PURE__ */ new Map;for(let{type:t,source:r}of e)if(!a.has(s(r,t))){let e=n.get(t)??[];e.push(r),n.set(t,e)}let r=/* @__PURE__ */ new Map;return await Promise.all([...n].map(async([e,n])=>{let o=i();try{let i=await l(e,n,o);for(let[o,c]of n.entries()){let n=i[o],l=s(c,e);if(!n||n.error){let i=n?.error??`empty service response`;t?.error(`Failed to render ${e} diagram: ${i}`),r.set(l,{light:``,dark:``,error:`Failed to render ${e} diagram: ${i}`,retryable:n===void 0})}else{let e={light:n.light??``,dark:n.dark??``};a.set(l,e),r.set(l,e)}}}catch(i){let a=i instanceof Error?i.message:String(i);t?.error(`Failed to render ${e} diagrams: ${a} (rayId: ${o})`);for(let t of n)r.set(s(t,e),{light:``,dark:``,error:`Failed to render ${e} diagram: ${a}`,retryable:!0})}})),e.map(({type:e,source:t})=>{let n=s(t,e);return r.get(n)??a.get(n)??{light:``,dark:``,error:`Diagram was not rendered`}})}function d(e){return typeof e==`string`&&t.has(e)}function f(e){let t=[];for(let r of n(e))if(r.type===`fence`){let{language:e,content:n}=r.attributes;d(e)&&typeof n==`string`&&t.push({node:r,input:{type:e,source:n}})}else if(r.type===`tag`&&r.tag===`diagram`){let{rawContent:e,type:n}=r.attributes;typeof e==`string`&&d(n)&&t.push({node:r,input:{type:n,source:e}})}return t}async function p(t,n,r){if(!globalThis.process?.versions?.node)return[];let i=f(t);if(i.length===0)return[];let a=await u(i.map(e=>e.input),r),o=[];for(let[t,{node:r}]of i.entries()){let i=a[t];r.attributes.diagramHtml=i.light,r.attributes.diagramHtmlDark=i.dark,i.error&&(r.attributes.diagramError=i.error,i.retryable&&o.push(e(r,i.error,n,`markdoc/diagram-service-failed`)))}return o}export{s as generateDiagramHash,u as renderDiagramsWithVariants,p as renderMarkdocDiagrams};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type Node as MarkdocNode, type Schema } from '@redocly/markdoc';
|
|
2
|
+
import type { MarkdocAttributeResolverResult } from '../../plugins/types/markdoc.js';
|
|
3
|
+
import type { EntityInvalidationDep } from '../../plugins/types/plugin.js';
|
|
2
4
|
export declare const MARKDOC_ERROR_TAG = "markdoc-error";
|
|
3
5
|
/**
|
|
4
6
|
* Engine-emitted diagnostic (partial cycle, disabled tag, failed resolver). A block
|
|
@@ -7,3 +9,9 @@ export declare const MARKDOC_ERROR_TAG = "markdoc-error";
|
|
|
7
9
|
export declare const markdocError: Schema;
|
|
8
10
|
/** Rewrite `node` in place into a `markdoc-error` tag carrying `message`. */
|
|
9
11
|
export declare function replaceWithMarkdocError(node: MarkdocNode, message: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* A resolver's failure: the node becomes a `markdoc-error` and the result reports `message`
|
|
14
|
+
* at the node's line in `sourceFilePath`. `entityDeps` are kept so the page resolves again
|
|
15
|
+
* once the file appears or changes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function markdocErrorResult(node: MarkdocNode, message: string, sourceFilePath: string, entityDeps?: readonly EntityInvalidationDep[]): MarkdocAttributeResolverResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@redocly/markdoc";const
|
|
1
|
+
import{markdocNodeProblem as e}from"../utils/node-source-range.js";import t from"@redocly/markdoc";const n=`markdoc-error`,r={selfClosing:!0,attributes:{message:{type:String,render:!1}},transform(e){let n=String(e.attributes.message??`Markdoc error`);return e.inline?new t.Tag(`MarkdocInlineError`,{},[n]):new t.Tag(`Admonition`,{type:`danger`},[n])}};function i(e,t){e.type=`tag`,e.tag=n,e.attributes={message:t},e.annotations=[],e.children=[]}function a(t,n,r,a=[]){return i(t,n),{entityDeps:a,problems:[e(t,n,r)]}}export{n as MARKDOC_ERROR_TAG,r as markdocError,a as markdocErrorResult,i as replaceWithMarkdocError};
|
|
@@ -13,8 +13,8 @@ type Located = Pick<MarkdocNode, 'type' | 'inline' | 'location'> | {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function markdocNodeRange(node: Located): SourceRange | undefined;
|
|
15
15
|
/**
|
|
16
|
-
* A `markdoc/validation-error`
|
|
17
|
-
* the file the node was parsed from (a partial for an inlined node).
|
|
16
|
+
* A `code` problem (default `markdoc/validation-error`) for `message` at the node's line in
|
|
17
|
+
* `filePath`, the file the node was parsed from (a partial for an inlined node).
|
|
18
18
|
*/
|
|
19
|
-
export declare function markdocNodeProblem(node: Located, message: string, filePath: string): ProblemDraft;
|
|
19
|
+
export declare function markdocNodeProblem(node: Located, message: string, filePath: string, code?: string): ProblemDraft;
|
|
20
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){let t=e.location?.start.line;if(t===void 0)return;let n=t+1,r=e.type===`tag`&&!(`inline`in e&&e.inline)?n:e.location?.end.line??n;return{start:{line:n},end:{line:r}}}function t(t,n,r){return{code
|
|
1
|
+
function e(e){let t=e.location?.start.line;if(t===void 0)return;let n=t+1,r=e.type===`tag`&&!(`inline`in e&&e.inline)?n:e.location?.end.line??n;return{start:{line:n},end:{line:r}}}function t(t,n,r,i=`markdoc/validation-error`){return{code:i,message:n,location:{filePath:r,range:e(t)??{start:{line:1},end:{line:1}}}}}export{t as markdocNodeProblem,e as markdocNodeRange};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildContentAssetUrl as e,deriveContentAssetFilename as t}from"../plugins/internal/assets/url.js";import{getContentAssetsOutputDir as n}from"../../shared/constants/runtime-layout.js";import{garbageCollectOrphanAssets as r}from"../database/assets.js";import{dirname as i,join as a}from"node:path";async function o(e,t,n){await e.mkdir(i(t),{recursive:!0});let r=`${t}.tmp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await n(r),await e.rename(r,t)}async function s(e,r){let{usage:i}=r,s=r.filename??t(i.path,i.hash,i.tag),c=a(r.contentDir,i.path),l=a(n(r.contentDir),s);if(!await e.exists(c))return null;let u={path:i.path,hash:i.hash,kind:i.kind,filename:s};try{if(await e.exists(l))return u;await o(e,l,t=>e.copyFile(c,t))}catch(e){if(e instanceof Error&&/EACCES|EPERM/.test(e.message))return u;throw e}return u}async function c(e,t){let{removed:
|
|
1
|
+
import{buildContentAssetUrl as e,deriveContentAssetFilename as t}from"../plugins/internal/assets/url.js";import{getContentAssetsOutputDir as n}from"../../shared/constants/runtime-layout.js";import{garbageCollectOrphanAssets as r}from"../database/assets.js";import{dirname as i,join as a}from"node:path";async function o(e,t,n){await e.mkdir(i(t),{recursive:!0});let r=`${t}.tmp-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;await n(r),await e.rename(r,t)}async function s(e,r){let{usage:i}=r,s=r.filename??t(i.path,i.hash,i.tag),c=a(r.contentDir,i.path),l=a(n(r.contentDir),s);if(!await e.exists(c))return null;let u={path:i.path,hash:i.hash,kind:i.kind,filename:s};try{if(await e.exists(l))return u;await o(e,l,t=>e.copyFile(c,t))}catch(e){if(e instanceof Error&&/EACCES|EPERM/.test(e.message))return u;throw e}return u}async function c(e,t){let{removed:n,orphanedFilenames:i}=await r(t.database,{logger:t.logger});return await u(e,{...t,filenames:i}),{removedRows:n.length,sweptFilenames:i}}async function l(e,t){await u(e,t)}async function u(e,t){let r=n(t.contentDir);await Promise.all(t.filenames.map(n=>e.unlink(a(r,n)).catch(e=>{d(e)||t.logger?.warn(`Could not remove a published content asset`,{filename:n,error:e instanceof Error?e.message:String(e)})})))}function d(e){return e instanceof Error&&/ENOENT|NotFoundError/.test(`${e.name} ${e.message}`)}async function f(e,t){let r=[],i=[],a=[];if(t.registered.length===0)return{restored:r,missingSources:i,failed:a};let o=/* @__PURE__ */ new Set;try{for(let r of await e.readdir(n(t.contentDir)))o.add(r.name)}catch{}let c=/* @__PURE__ */ new Map;for(let e of t.registered)o.has(e.filename)||c.set(e.filename,e);let l=[...c];for(let n=0;n<l.length;n+=16)await Promise.all(l.slice(n,n+16).map(async([n,o])=>{try{let a=await s(e,{contentDir:t.contentDir,filename:n,usage:{path:o.path,hash:o.hash,kind:o.kind===`image`?`image`:`file`}});a?r.push(a.filename):i.push(o.path)}catch{a.push(o.path)}}));return{restored:r,missingSources:i,failed:a}}function p(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(`${n.path}|${n.hash}`,n);return[...t.values()]}function m(t){let n;for(let r of t)r.l10n&&(n??={},(n[r.l10n.locale]??={})[r.l10n.canonicalUrl]=e(r.path,r.hash,r.tag));return n}export{m as buildL10nAssetMap,p as dedupeAssetUsages,c as garbageCollectOrphanAssetFiles,s as reconcileAsset,l as removeReplacedAssetFiles,f as restoreMissingAssetFiles,o as writeFileAtomically};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hashJsonValue as e}from"../database/utils/json.js";import{
|
|
1
|
+
import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{collectDataRefMarkers as a}from"./data-ref.js";import{replaceBlobRefsForEntityTx as o}from"../database/blobs.js";import{dedupeRouteQueryDependencies as s}from"../plugins/utils/route-index.js";import{MaterializationError as c,ProblemError as l}from"../problems/problem-error.js";import{problemRow as u,replaceEntityProblemsExceptCodesTx as d}from"../database/problems.js";import{replaceAssetRefsForEntityTx as f,upsertAssetsTx as p}from"../database/assets.js";import{createProblem as m}from"../problems/codes.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{buildL10nAssetMap as _,dedupeAssetUsages as v,reconcileAsset as y,removeReplacedAssetFiles as b}from"./asset-reconcile.js";import{cutEntityRevisionTx as x}from"../revisions/cut.js";import{detectMarkdocPayloadFlag as S}from"../markdown/server/render.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??S(P),L=I?_(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=v(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>y(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.capture&&i.revisions.isTracked(k?.path??``)&&await x(n,{current:l,max:i.revisions.max});let v=A._trackedConfig;await N(n,l.id,v?.collectDependencies()??[]);let y=A._loadedEntityKeys,b=A._globPatterns;if((j.entityDeps!==void 0||y.length>0||b.length>0)&&await w(n,{entityId:l.id,originPluginId:O.pluginId,isSystem:!!l.isSystem,deps:[...j.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await C(n,{originPluginId:O.pluginId,hook:`loader`,entityId:l.id,dependencies:s(A._routeQueries)}),await d(n,l.id,T,(j.problems??[]).map(e=>u(m(e),{scope:`entity`,entityId:l.id}))),await o(n,{entityId:l.id,blobKeys:B}),W=await p(n,U),await f(n,{entityId:l.id,refs:V.map(({path:e,hash:t})=>({path:e,hash:t}))}),(j.linkRefs!==void 0||j.targetInventories!==void 0)&&k?.path&&(await h(n,{entityId:l.id,originFileId:k.fileId,originPluginId:O.pluginId,filePath:k.path,drafts:j.linkRefs??[]}),k.fileId!==null))for(let e of j.targetInventories??[])await g(n,{fileId:k.fileId,originPluginId:O.pluginId,draft:e})}),H&&W.length>0&&await b(A.io,{contentDir:H,filenames:W,logger:i.logger}),F}async function M(e,t,n){let r=n instanceof l?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=u(m(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await d(e,t,T,[n])})}catch{}}async function N(e,t,n){await e.delete(i).where(D(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{k as materializeEntityByKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{isObject as t}from"../../shared/utils/is-object.js";import{getStaticFilesOutputDir as n,getStaticManifestPath as r}from"../../shared/constants/runtime-layout.js";import{isDataRefMarker as i}from"./data-ref.js";import{resolveDataRef as a}from"../database/blobs.js";import{MaterializationError as o}from"../problems/problem-error.js";import{loadEntityRecordByKey as s}from"../database/entities.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{
|
|
1
|
+
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{isObject as t}from"../../shared/utils/is-object.js";import{getStaticFilesOutputDir as n,getStaticManifestPath as r}from"../../shared/constants/runtime-layout.js";import{isDataRefMarker as i}from"./data-ref.js";import{resolveDataRef as a}from"../database/blobs.js";import{MaterializationError as o}from"../problems/problem-error.js";import{loadEntityRecordByKey as s}from"../database/entities.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{writeFileAtomically as l}from"./asset-reconcile.js";import{producerContentType as u,toStaticBodyBytes as d}from"../static/producer-value.js";import{join as f}from"node:path";function p(e){return new Set(e.flatMap(e=>e.kind===`producer`&&e.entityKey?[e.entityKey]:[]))}async function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.staleProducers)try{await e.materializeEntity(n)}catch(r){if(!(r instanceof o))throw r;t.add(n.key),e.logger.debug(`Could not materialize the static producer ${n.key}; recorded the problem and moved on`)}let n=[];for(let r of e.rows){let i=e.resolveAudience(r);if(r.kind===`copy`){n.push(h(e.io,e.contentDir,r,i));continue}let a=await g(e.io,e.database,r,i,r.entityKey!==null&&t.has(r.entityKey));a&&n.push(a)}let r=await _(e.io,{contentDir:e.contentDir,entries:n}),i=new Map(e.rows.map(e=>[e.path,e]));return await c(e.database,r.manifest.files.filter(e=>{let t=i.get(e.path);return t?.hash!==e.hash||t.size!==e.size}).map(e=>({path:e.path,hash:e.hash,size:e.size}))),e.logger.info(`Static files: ${r.manifest.files.length} registered, ${r.written.length} written, ${r.removed.length} removed`),r.manifest}function h(e,t,n,r){if(!n.sourcePath||!n.hash)throw Error(`Static file "${n.path}" has no copy source.`);let i=f(t,n.sourcePath);return{path:n.path,hash:n.hash,contentType:n.contentType,audience:r,write:t=>e.copyFile(i,t)}}async function g(e,n,r,o,c){let l=r.entityKey?await s(n,r.entityKey):null;if(!l||l.status!==`ready`&&!c)throw Error(`Static file "${r.path}": producer entity "${r.entityKey}" is not ready.`);let f=l.data;if(!t(f)||!i(f.body)){if(c)return null;throw Error(`Static file "${r.path}": producer "${r.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:r.path,hash:p.blobKey,contentType:u(f,r),audience:o,write:async t=>e.writeFile(t,d(await a(n,p)))}}async function _(t,i){let a=n(i.contentDir),o=r(i.contentDir),s=new Map((await v(t,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(t,a)),u=[],d=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let n=f(a,...e.path.split(`/`)),r=s.get(e.path),i=r?.hash===e.hash&&c.has(e.path)?r.size:null;i===null&&(await l(t,n,e.write),i=(await t.stat(n))?.size??0,u.push(e.path)),d.push({path:e.path,hash:e.hash,contentType:e.contentType,size:i,audience:e.audience})}));let p=new Set(i.entries.map(e=>e.path)),m=[...c].filter(e=>!p.has(e));await Promise.all(m.map(e=>t.unlink(f(a,...e.split(`/`))))),d.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:d};return await t.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:u,removed:m}}async function v(e,t){try{let n=JSON.parse(await e.readFile(t));return Array.isArray(n.files)?n:null}catch{return null}}async function y(e,t,n=``){let r=[],i;try{i=await e.readdir(t)}catch{return r}for(let a of i){let i=`${n}${a.name}`;a.type===`directory`?r.push(...await y(e,f(t,a.name),`${i}/`)):a.type===`file`&&r.push(i)}return r}export{p as collectStaticProducerKeys,m as materializeStaticProducers,_ as reconcileStaticFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),customPackages:p(`customPackages`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
1
|
+
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{MarkdocRenderer as s,markdocComponents as c}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as l}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as u}from"../../../../../client/telemetry/config.js";import{withReplayOptions as d}from"../../../../../client/replay-options.js";import{JsonSchemaTag as f}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as p}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as m}from"./event-handlers.js";import{useContext as h,useEffect as g,useMemo as _
|
|
1
|
+
import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{MarkdocRenderer as s,markdocComponents as c}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as l}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as u}from"../../../../../client/telemetry/config.js";import{withReplayOptions as d}from"../../../../../client/replay-options.js";import{JsonSchemaTag as f}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as p}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as m}from"./event-handlers.js";import{useContext as h,useEffect as g,useMemo as _}from"react";import{useLocation as v}from"react-router";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{useThemeConfig as C}from"@redocly/theme/core/hooks";import{LayoutVariant as w}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as T}from"virtual:realm-runtime";import{userMarkdocComponents as E}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as D,apiDocsMarkdocComponents as O}from"@redocly/api-docs";import{Breadcrumbs as k}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as A}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as j}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as M}from"@redocly/theme/layouts/ThreePanelLayout";const N={...c,JsonSchema:f,JsonExample:p,...E,...O},P={parse:e=>e,render:e=>/* @__PURE__ */ b(s,{ast:e,components:N})},F={MiddlePanelHeader:I};function I(){return/* @__PURE__ */ x(y,{children:[/* @__PURE__ */ b(k,{}),/* @__PURE__ */ b(V,{})]})}function L(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function R({page:e}){let t=T(r),i=T(n),{layout:o}=h(a),s=z(),c=_(()=>t&&{...m(d(t.options)),oAuth2RedirectURI:B(),userClaims:s,unstable_hooks:F},[t,s]),f=e.slug.toLowerCase(),p=_(()=>t&&t.basePath!==f?l(t.items,t.basePath,f):t?.items,[t,f]);if(U(e.metadata,p,t?.title),!t)return null;let g=u();return/* @__PURE__ */ x(y,{children:[i&&/* @__PURE__ */ b(H,{layout:o,children:/* @__PURE__ */ b(A,{metadata:i})}),/* @__PURE__ */ b(D,{items:p,store:t.store,options:c,basePath:f,layout:o,markdownAdapter:P,telemetryConfig:g})]})}function z(){let e=h(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return _(()=>({email:t,name:n}),[t,n])}function B(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const V=S(j)`
|
|
2
2
|
width: 100%;
|
|
3
|
-
`,
|
|
3
|
+
`,H=S(M)`
|
|
4
4
|
&& {
|
|
5
|
-
padding-right: ${({layout:e})=>e===
|
|
5
|
+
padding-right: ${({layout:e})=>e===w.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
|
|
6
6
|
}
|
|
7
|
-
`;function
|
|
7
|
+
`;function U(e,t,n){let{pathname:r}=v(),{seo:a}=C(),o=a?.projectTitle,s=t?i(e,t,L(r),n):void 0;g(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as i}from"../../../../shared/search/facets.js";import{configuredFacetFields as a,extractFacetsFromFrontmatter as o,invalidFacetValueProblems as s,searchCategoryOf as c}from"../../../search/facet-values.js";import{toPosixPath as l}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as u}from"../../../../shared/constants/l10n/defaults.js";import{isObject as d}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as f}from"../../../plan-gates.js";import{filePathToRouteSlug as p}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as m,SPEC_KIND_ASYNCAPI as h,SPEC_KIND_GRAPHQL as g,SPEC_KIND_OPENAPI as _}from"../../types/api-entity.js";import{isPlanFeatureGranted as v}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as y,unpackMarkdocAstsDeep as b}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as x}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as S}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ee,API_DOCS_PLUGIN_ID as te,API_DOCS_RENDER_DEP_KEY as ne,API_DOCS_RENDER_LOADER_ID as C,API_DOCS_SIDEBAR_LOADER_ID as w,API_DOCS_TEMPLATE_ID as T,SPEC_DOWNLOAD_ROUTE_PATHS as E,SPEC_PATH_PARAM as re}from"./server/shared.js";import{resolveApiBundleConfig as ie,resolveApiOptions as ae,resolveNestedFeedback as oe,schemaCatalogLink as se,withDownloadUrls as ce,withFeedbackOption as le,withMockServerOption as ue}from"./server/options.js";import{annotateApiDocsRbac as de}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as D}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as fe}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as O}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as k,resolveMarkdocTagSet as A}from"../../../markdown/constants/tag-sets.js";import{pageLocale as j}from"../../utils/page-locale.js";import{buildBundledApiDefinition as M,resolveLlmsDescriptions as N}from"./server/build-definition.js";import{collectSidebarSubpathTargets as P,toSidebarSubtree as F,toSubpathTarget as I}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as L}from"./server/markdown-docs.js";import{join as R,relative as z}from"node:path";import B from"@redocly/markdoc";const V=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],pe={[_]:`OpenAPI`,[h]:`AsyncAPI`,[g]:`GraphQL`,[m]:`Arazzo`},H=t(C,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=ce(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?ue(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await M({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),f={...d(u.document)&&d(u.document.info)?{infoDescription:u.document.info.description}:{},...await N(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&d(u.document)&&(u.document[`x-schema-catalog-link`]=se(e.file.path)),u.options=le(u.options,u.document,e.args.feedback??e.config.feedback);let p=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:p,markdownParser:e=>B.compact(x(e))}),_=JSON.stringify({items:y(m),store:y(h),options:u.options,specType:g,basePath:p,title:ye(u.document,e.args.kind,m),metadata:ve(u.document),[D]:{llms:f}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:k},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=b(e),r=await we(t.entities,t.route.originFilePath),l={...t.route.metadata,...d(n.metadata)?n.metadata:{}},{category:u,isInvalid:f}=c(l),{facets:p,invalidFields:m}=o(l,a(t.config)),{buildApiDocsSearchDocuments:h}=await import(`./server/search-documents.js`);return{...h(n,r,{groupKey:u,facets:p,warn:e=>t.logger?.warn(e)}),problems:s([...m,...f?[i]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=b(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(S(r)).catch(()=>void 0):void 0,{tags:a}=await A(k);return L(n,_e(i,n[D]?.llms),r,{tags:a,locale:j(t)})},usesProjectMarkdocSchema:!0}),U=t(ee,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await M({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===g,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...he(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=fe(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>l(z(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:R(e.contentDir,t)}}function me(e){let t=e[O];return d(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function he(e,t){let n=d(e)&&d(e.info)?e.info:{},r=d(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(w,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(S(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=de(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:x}),s=F(o),c=n(o).map(({from:e})=>I(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...P(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ge={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function _e(e,t){if(t===void 0||!d(e))return e;let n=d(e.info)?e.info:{},r=d(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ve(e){let t=d(e)&&d(e.info)?e.info:{};return d(t[`x-metadata`])?t[`x-metadata`]:{}}function ye(e,t,n){let r=d(e)&&d(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=d(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ge[t]}const be=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Y(e,t){let n=d(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),d(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),d(t.metadata)&&Object.assign(r,t.metadata);for(let e of be)delete r[e];return r}function X(e){return d(e.metadata)?e.metadata:void 0}function xe(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=xe(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...d(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function Se(e){if(e.ext===`.gql`||e.ext===`.graphql`)return g;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?_:Q(r)?h:Q(i)?m:null}const Ce=e({id:te,version:`0.41.0`,content:{filter:{extensions:V},async extractFile(e,t){if(u.test(e.path))return null;let n=Se(e);if(n===null)return null;if(n!==`arazzo`&&!v(t.config,n))return{routes:[],problems:[f(`${pe[n]} documents`)]};let r=e.path,i=me(e.manifest),a=i??r,{rbac:o,...s}=await ae(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!v(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await oe(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ie(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let d=U.withArgs(c,{stableKey:S(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[d]};let m=Y(e,s);s.excludeFromSearch===!0&&(m.excludeFromSearch=!0),m.type=n,c.rbac!==void 0&&(m.rbac=c.rbac);let h=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=p(r);return{routes:[{deps:{[ne]:h},metadata:m,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:T,wildcardPrefix:!0}],entities:[d,h,g]}}},loaders:[U,H,q],templates:{[T]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(E.bundle,`bundle`),$(E.deprecatedBundle,`bundle`),$(E.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+re,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function we(e,t){if(t)try{return await e.load(S(t))}catch{return}}export{Ce as apiDocsContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{toPosixPath as d}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as m}from"../../../plan-gates.js";import{filePathToRouteSlug as h}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as g,SPEC_KIND_ASYNCAPI as _,SPEC_KIND_GRAPHQL as v,SPEC_KIND_OPENAPI as y}from"../../types/api-entity.js";import{isPlanFeatureGranted as b}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as T,API_DOCS_PLUGIN_ID as ee,API_DOCS_RENDER_DEP_KEY as E,API_DOCS_RENDER_LOADER_ID as D,API_DOCS_SIDEBAR_LOADER_ID as te,API_DOCS_TEMPLATE_ID as O,SPEC_DOWNLOAD_ROUTE_PATHS as k,SPEC_PATH_PARAM as ne}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[y]:`OpenAPI`,[_]:`AsyncAPI`,[v]:`GraphQL`,[g]:`Arazzo`},U=t(D,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(m),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,m),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(T,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===v,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>d(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return p(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(te,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return p(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return v;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?y:Q(r)?_:Q(i)?g:null}const Te=e({id:ee,version:`0.42.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!b(t.config,n))return{routes:[],problems:[m(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!b(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let d=Se(e,s);s.excludeFromSearch===!0&&(d.excludeFromSearch=!0),d.type=n,c.rbac!==void 0&&(d.rbac=c.rbac);let p=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=h(r);return{routes:[{deps:{[E]:p},metadata:d,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:O,wildcardPrefix:!0}],entities:[u,p,g]}}},loaders:[W,U,J],templates:{[O]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(k.bundle,`bundle`),$(k.deprecatedBundle,`bundle`),$(k.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+ne,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRbacScope as e}from"../../../../../server/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),n.type===`separator
|
|
1
|
+
import{isRbacScope as e}from"../../../../../server/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),r.type===`separator`&&(r.separatorLine=!0),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
|
|
@@ -4,7 +4,7 @@ export declare const API_DOCS_SEARCH_GROUP = "API Reference";
|
|
|
4
4
|
export type ApiDocsSearchDocumentOptions = {
|
|
5
5
|
/** The category of every document; `API Reference` by default. */
|
|
6
6
|
groupKey?: string;
|
|
7
|
-
/** Facet values every document carries. */
|
|
7
|
+
/** Facet values every document carries; an HTTP operation also carries its method and path. */
|
|
8
8
|
facets?: SearchDocumentFacets;
|
|
9
9
|
/** Receives the warnings of the `x-rbac` annotation; the render loader reported the same ones. */
|
|
10
10
|
warn?: (message: string) => void;
|