@redocly/redoc-reef 0.139.0-next.8 → 0.139.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +226 -0
- package/dist/cli/develop.js +1 -1
- package/dist/cli/eject/resolveEjectParams.js +1 -1
- package/dist/client/app/Sidebar/PoweredByRedocly.d.ts +14 -0
- package/dist/client/app/Sidebar/PoweredByRedocly.js +40 -0
- package/dist/client/app/Sidebar/Sidebar.js +3 -3
- package/dist/client/app/hooks/useL10nConfig.d.ts +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
- package/dist/client/app/utils/programmatic-scroll.js +1 -1
- package/dist/client/app/webmcp/tools/api-tools.js +1 -1
- package/dist/client/app/webmcp/tools/site-tools.js +2 -2
- package/dist/client/app/webmcp/useWebMcpTools.js +1 -1
- package/dist/client/browser-entry.js +2 -2
- package/dist/client/templates/api-docs/template.js +5 -3
- package/dist/constants/common.d.ts +2 -0
- package/dist/constants/common.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/constants/entitlements.d.ts +2 -2
- package/dist/server/constants/entitlements.js +1 -1
- package/dist/server/entitlements/entitlements-provider.d.ts +8 -2
- package/dist/server/entitlements/entitlements-provider.js +1 -1
- package/dist/server/entitlements/is-valid-plan.d.ts +2 -2
- package/dist/server/entitlements/is-valid-plan.js +1 -1
- package/dist/server/fs/content-fs.js +1 -1
- package/dist/server/fs/utils/external-ref-resolver.js +2 -2
- package/dist/server/fs/utils/is-translation-fallback.d.ts +9 -0
- package/dist/server/fs/utils/is-translation-fallback.js +1 -0
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/api-docs/get-server-props.js +1 -1
- package/dist/server/plugins/api-docs/index.js +1 -1
- package/dist/server/plugins/api-docs/loader.js +3 -3
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +6 -3
- package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +52 -52
- package/dist/server/plugins/api-docs/utils/inject-metadata.d.ts +19 -0
- package/dist/server/plugins/api-docs/utils/inject-metadata.js +1 -0
- package/dist/server/plugins/catalog-entities/template/index.js +1 -1
- package/dist/server/plugins/config-parser/index.js +1 -1
- package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
- package/dist/server/plugins/default-theme/resolve-logo.js +1 -1
- package/dist/server/plugins/dev-onboarding/api/routes/products.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
- package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
- package/dist/server/plugins/markdown/read-file-content.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.d.ts +0 -5
- package/dist/server/plugins/mcp/gateway-mcp/allowed-http-methods.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.d.ts +3 -4
- package/dist/server/plugins/mcp/gateway-mcp/caller-api-calls.js +1 -1
- package/dist/server/plugins/nav-utils.js +1 -1
- package/dist/server/providers/database/has-project-database.js +1 -1
- package/dist/server/store.d.ts +3 -1
- package/dist/server/store.js +1 -1
- package/dist/server/types/index.d.ts +1 -0
- package/dist/server/types/plugins/markdown.d.ts +1 -0
- package/dist/server/types/static-files.d.ts +6 -0
- package/dist/server/types/static-files.js +0 -0
- package/dist/server/utils/content/build-static-file-paths.d.ts +15 -0
- package/dist/server/utils/content/build-static-file-paths.js +1 -0
- package/dist/server/utils/find-disallowed-packages.d.ts +16 -0
- package/dist/server/utils/find-disallowed-packages.js +1 -0
- package/dist/server/utils/is-realm-or-reef.js +1 -1
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/rbac-expand.d.ts +4 -0
- package/dist/server/utils/rbac-expand.js +1 -1
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/redirects/find-redirect.d.ts +4 -3
- package/dist/server/utils/redirects/find-redirect.js +1 -1
- package/dist/server/utils/resolve-asset-path.js +1 -1
- package/dist/server/utils/validate-allowed-packages.d.ts +7 -0
- package/dist/server/utils/validate-allowed-packages.js +2 -0
- package/dist/server/web-server/auth.d.ts +2 -0
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/jwt/jwt.js +1 -1
- package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-client-metadata.d.ts +3 -3
- package/dist/server/web-server/routes/mcp-routes/mcp-client-metadata.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
- package/dist/types/entitlements.d.ts +10 -1
- package/dist/types/global-data.d.ts +4 -0
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PlanGates,
|
|
1
|
+
import type { Entitlements, PlanGates, PricingTier, Feature } from '../../types/index.js';
|
|
2
2
|
export declare const PLAN_GATES_DEFAULTS: {
|
|
3
|
-
[key in
|
|
3
|
+
[key in PricingTier]: PlanGates & Pick<Entitlements, 'allowedPackages'>;
|
|
4
4
|
};
|
|
5
5
|
export declare const GATED_PLUGINS: string[];
|
|
6
6
|
export declare const GATED_MARKDOC_TAGS: Record<string, Feature>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GATEWAY_FETCH_LIMIT_DEFAULTS as e,MCP_REQUEST_LIMIT_DEFAULTS as t}from"../../constants/common.js";const
|
|
1
|
+
import{GATEWAY_FETCH_LIMIT_DEFAULTS as e,MCP_REQUEST_LIMIT_DEFAULTS as t}from"../../constants/common.js";const a=["@redocly/*","react","react-dom","react-is","react-router","react-router-dom","styled-components","@markdoc/markdoc","js-yaml","graphql","zod","hono","buffer","i18next","nanoid","picomatch","prismjs","react-countup","styled-system","polished","clsx","react-icons","lucide-react","framer-motion","react-helmet","react-select","react-markdown","remark-gfm","unist-util-visit","marked","highlight-words-core","axios","lodash","lodash-es","lodash.throttle"],o={pro:{pricingTier:"pro",rbac:!1,sso:!1,cookieConsent:!1,analytics:!0,removeAttribution:!1,advancedSearch:!1,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:.5,mcp:!0,mcpGateway:!1,sdkGeneration:!1,mcpMode:"tools",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec,mcpRequestRatePerMin:t.ratePerMin,mcpRequestQuotaPerDay:t.quotaPerDay,customPackages:!1,allowedPackages:a},scale:{pricingTier:"scale",rbac:!1,sso:!0,cookieConsent:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!0,aiSearchLimit:750,kvStorageLimit:5,mcp:!0,mcpGateway:!1,sdkGeneration:!0,mcpMode:"tools",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec,mcpRequestRatePerMin:t.ratePerMin,mcpRequestQuotaPerDay:t.quotaPerDay,customPackages:!0},enterprise:{pricingTier:"enterprise",rbac:!0,sso:!0,cookieConsent:!0,analytics:!0,removeAttribution:!0,advancedSearch:!0,ssoDirect:!1,aiSearchLimit:750,kvStorageLimit:5,mcp:!0,mcpGateway:!0,sdkGeneration:!0,mcpMode:"code",gatewayFetchRatePerMin:e.ratePerMin,gatewayFetchQuotaPerDay:e.quotaPerDay,gatewayFetchBudgetPerExec:e.budgetPerExec,mcpRequestRatePerMin:t.ratePerMin,mcpRequestQuotaPerDay:t.quotaPerDay,customPackages:!0}},c=["@redocly/portal-plugin-async-api/plugin.js","@redocly/portal-plugin-mock-server/plugin.js","@redocly/portal-plugin-soap-api/plugin.js"],s={"code-walkthrough":"codeWalkthrough",step:"codeWalkthrough",toggle:"codeWalkthrough",input:"codeWalkthrough"};export{s as GATED_MARKDOC_TAGS,c as GATED_PLUGINS,o as PLAN_GATES_DEFAULTS};
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import type { Entitlements, Feature,
|
|
1
|
+
import type { Entitlements, Feature, PricingTier } from '../../types/index.js';
|
|
2
2
|
type InitOptions = {
|
|
3
3
|
ignoreTokenExpiration?: boolean;
|
|
4
|
-
developModePlan?:
|
|
4
|
+
developModePlan?: PricingTier;
|
|
5
5
|
};
|
|
6
6
|
export declare class EntitlementsProvider {
|
|
7
7
|
#private;
|
|
8
8
|
private constructor();
|
|
9
9
|
static instance(): EntitlementsProvider;
|
|
10
10
|
get entitlements(): Entitlements | null;
|
|
11
|
+
/** The new-pricing tier of the plan; `null` for legacy orders and without entitlements. */
|
|
12
|
+
get pricingTier(): PricingTier | null;
|
|
11
13
|
init(initOptions?: InitOptions): Promise<void>;
|
|
12
14
|
canAccessFeature: (key: Feature) => boolean | null;
|
|
15
|
+
/** Whether the project may declare any npm package; true unless the plan sets `customPackages` to false. */
|
|
16
|
+
canUseAnyPackage: () => boolean;
|
|
17
|
+
/** The npm packages the plan allows when `canUseAnyPackage()` is false; `[]` when the token has no valid list. */
|
|
18
|
+
getAllowedPackages: () => string[];
|
|
13
19
|
getPackageEjectIgnore(): Promise<string[]>;
|
|
14
20
|
}
|
|
15
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENTITLEMENTS_JWKS_URL as
|
|
1
|
+
import{ENTITLEMENTS_JWKS_URL as c}from"../constants/common.js";import{PLAN_GATES_DEFAULTS as l}from"../constants/entitlements.js";import{envConfig as s}from"../config/env-config.js";import{logger as r}from"../tools/notifiers/logger.js";import{reporter as i}from"../tools/notifiers/reporter.js";import{PACKAGE_NAME as p,PRODUCT_GATES as g}from"../../config/product-gates.js";import{EJECT_IGNORE_CONFIG as m}from"../../config/eject-ignore.js";import*as o from"../web-server/jwt/jwt.js";import{AlgorithmTypes as f}from"../web-server/jwt/types.js";const h="default",u="@redocly/framework";class a{static#t;#n=null;#e={};constructor(){}static instance(){return a.#t||(a.#t=new a),a.#t}get entitlements(){return this.#n}get pricingTier(){return this.#n?.pricingTier??null}async init(e={}){this.#e=e;try{await this.#o()}catch(t){r.warn("Failed to process entitlements information: "+t.message),r.verbose(t.message)}}canAccessFeature=e=>e?this.entitlements&&!!this.entitlements[e]:!0;canUseAnyPackage=()=>this.entitlements?.customPackages!==!1;getAllowedPackages=()=>{const e=this.entitlements?.allowedPackages;return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:[]};async getPackageEjectIgnore(){const e=[];for(const[t,n]of Object.entries(m))this.canAccessFeature(t)&&e.push(...n);return e}#r(){return s.PLAN_GATES||""}async#a(){let e;try{e=await fetch(c).then(t=>t.json())}catch(t){return r.warn("Failed to get JWKS information: "+t.message),!1}try{const t=e.keys&&e.keys.length>0?e.keys[0]:null,n=this.#r();return t&&n?await o.verify(n,t,f.RS256,this.#e.ignoreTokenExpiration):!1}catch(t){return r.warn("Failed to verify plan gates token: "+t.message),!1}}async#s(){if(await this.#a()){const{payload:e}=o.decode(this.#r());if(e){if(!s.REDOCLY_ENV&&e.exp){const t=e.exp*1e3,n=new Date(t);r.info(`Entitlements token expires on ${n.toISOString()} (in ${Math.ceil((t-new Date().getTime())/(1440*60*1e3))} days)`)}return await this.#i(e),e}}await i.panicOnContentError("Plan gates token is not valid or empty.")}async#i(e){p===u&&(e.pricingTier||e.subscriptionId===h||await i.panicOnContentError("@redocly/framework requires the Pro, Scale, or Enterprise plan. This organization is on an earlier plan: keep building with its product package, such as @redocly/realm."))}async#o(){const e=this.#e.developModePlan&&!this.#r()?l[this.#e.developModePlan]:await this.#s();this.#n={...g,...e}}}export{a as EntitlementsProvider};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function isValidPlan(plan: string): plan is
|
|
1
|
+
import type { PricingTier } from '../../types/index.js';
|
|
2
|
+
export declare function isValidPlan(plan: string): plan is PricingTier;
|
|
3
3
|
//# sourceMappingURL=is-valid-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(e){return["pro","enterprise"].includes(e)}export{n as isValidPlan};
|
|
1
|
+
function n(e){return["pro","scale","enterprise"].includes(e)}export{n as isValidPlan};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import m from"node:path";import{I18N_DIR_NAME as f,L10N_DIR_NAME as h}from"../constants/common.js";import{logger as c}from"../tools/notifiers/logger.js";import{Fs as F}from"./fs.js";import{isL10nPath as n}from"./utils/is-l10n-path.js";import{getLocaleFromRelativePath as d}from"./utils/get-locale-from-relative-path.js";import{isL10nRootFile as u}from"./utils/is-l10n-root-file.js";import{removeL10nPrefix as l}from"./utils/remove-l10n-prefix.js";import{LastModifiedTracker as g}from"./last-modified-tracker.js";class b extends F{cwd;ignored;#e=new Map;#t=new Set;#i;#s;constructor(e,t=[]){super(e,t),this.cwd=e,this.ignored=t,this.#i=new g(this),this.#r()}get localeFolders(){return Array.from(this.#e.keys())}get localizationFolder(){if(this.#s)return this.#s;let e=!1,t=!1;const s=this.localeFolders;if(!s.length)return;for(const i of s)for(const r of this.#e.get(i)?.values()||[]){const a=r.startsWith(h),p=r.startsWith(f);a&&!e&&(e=!0),p&&!t&&(t=!0)}e&&t?c.warn("Detected both `@l10n` and `@i18n` folders. Using `@l10n` folder for localization because `@i18n` folder is deprecated."):t&&c.warn("`@i18n` folder is deprecated. Please use `@l10n` folder instead.");const o=e?h:f;return this.#s=o,o}getFileInfo(e){if(e=e.replace(/^\.\//g,""),n(e)){if(super.exists(e))return super.getFileInfo(e);const t=l(e),s=super.getFileInfo(t);return s&&{...s,relativePath:e,realRelativePath:t,dirname:m.posix.dirname(e),isVirtual:!0}}return super.getFileInfo(e)}exists(e){return e=e.replace(/^\.\//g,""),n(e)?super.exists(e)||super.exists(l(e)):super.exists(e)}async read(e,t="utf-8"){return n(e)?
|
|
1
|
+
import m from"node:path";import{I18N_DIR_NAME as f,L10N_DIR_NAME as h}from"../constants/common.js";import{logger as c}from"../tools/notifiers/logger.js";import{Fs as F}from"./fs.js";import{isL10nPath as n}from"./utils/is-l10n-path.js";import{getLocaleFromRelativePath as d}from"./utils/get-locale-from-relative-path.js";import{isL10nRootFile as u}from"./utils/is-l10n-root-file.js";import{removeL10nPrefix as l}from"./utils/remove-l10n-prefix.js";import{LastModifiedTracker as g}from"./last-modified-tracker.js";class b extends F{cwd;ignored;#e=new Map;#t=new Set;#i;#s;constructor(e,t=[]){super(e,t),this.cwd=e,this.ignored=t,this.#i=new g(this),this.#r()}get localeFolders(){return Array.from(this.#e.keys())}get localizationFolder(){if(this.#s)return this.#s;let e=!1,t=!1;const s=this.localeFolders;if(!s.length)return;for(const i of s)for(const r of this.#e.get(i)?.values()||[]){const a=r.startsWith(h),p=r.startsWith(f);a&&!e&&(e=!0),p&&!t&&(t=!0)}e&&t?c.warn("Detected both `@l10n` and `@i18n` folders. Using `@l10n` folder for localization because `@i18n` folder is deprecated."):t&&c.warn("`@i18n` folder is deprecated. Please use `@l10n` folder instead.");const o=e?h:f;return this.#s=o,o}getFileInfo(e){if(e=e.replace(/^\.\//g,""),n(e)){if(super.exists(e))return super.getFileInfo(e);const t=l(e),s=super.getFileInfo(t);return s&&{...s,relativePath:e,realRelativePath:t,dirname:m.posix.dirname(e),isVirtual:!0}}return super.getFileInfo(e)}exists(e){return e=e.replace(/^\.\//g,""),n(e)?super.exists(e)||super.exists(l(e)):super.exists(e)}async read(e,t="utf-8"){return n(e)?super.exists(e)?super.read(e,t):super.read(l(e),t):super.read(e,t)}scan(e){let t=super.scan(e);this.#t.size>0&&(t=t.filter(i=>!this.#t.has(i.relativePath)));const s={},o=new Set;for(const i of t)if(n(i.relativePath)){const r=d(i.relativePath),a=s[r]||new Set;a.add(l(i.relativePath)),s[r]=a}else o.add(i.relativePath);for(const i of o.values())for(const r of this.#e.keys())if(!s[r]?.has(i)){const a=`${this.localizationFolder}/${r}/${i}`;t.push({realRelativePath:i,relativePath:a,isVirtual:!0,hash:void 0})}return t}getLastModified(e){const t=this.getFileInfo(e);return this.#i.getLastModified(t?.realRelativePath||e)}#o(e){this.#t.add(e);const t=e.split("/")[0];c.warn(`The file %rp is placed directly in the ${t} folder root and does not belong to any locale, so it is ignored. Move it into a locale folder, for example ${t}/<locale>/.`,e)}async#r(){await this.watcher,this.#e=new Map,this.#t=new Set;for(const e of this.filesList.values()){if(!n(e.relativePath))continue;if(u(e.relativePath)){this.#o(e.relativePath);continue}const t=d(e.relativePath),s=this.#e.get(t)||new Set;s.add(e.relativePath),this.#e.set(t,s)}super.watch(async e=>{for(const t of e){if(t.event==="code-updated"||!n(t.path))continue;if(u(t.path)){t.event==="add"&&this.#o(t.path),t.event==="unlink"&&this.#t.delete(t.path);continue}const s=d(t.path),o=this.#e.get(s)||new Set;switch(t.event){case"add":o.add(t.path),this.#e.set(s,o);break;case"unlink":o&&(o.delete(t.path),o.size===0&&this.#e.delete(s));break}}})}}export{b as ContentFs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{BaseResolver as i,ResolveError as h,Source as n,isAbsoluteUrl as l,readFileFromUrl as m}from"@redocly/openapi-core";import f from"path";import{slash as p}from"../../../utils/path/slash.js";const d=/^https?:\/\/.*\/_bundle\/(.*\.(?:yaml|json)$)/;class v extends i{fs;constructor(
|
|
2
|
-
`))}}if(l(
|
|
1
|
+
import{BaseResolver as i,ResolveError as h,Source as n,isAbsoluteUrl as l,readFileFromUrl as m}from"@redocly/openapi-core";import f from"path";import{slash as p}from"../../../utils/path/slash.js";const d=/^https?:\/\/.*\/_bundle\/(.*\.(?:yaml|json)$)/;class v extends i{fs;constructor(e){super(),this.fs=e}async resolveDocument(e,s,t=!1){const r=this.resolveExternalRef(e,s),c=this.cache.get(r);if(c)return c;const a=this.loadExternalRef(r).then(o=>this.parseDocument(o,t));return this.cache.set(r,a),a}async loadExternalRef(e){try{const s=e.match(d);if(s){const[,t]=s;if(this.fs.exists(t)){const r=await this.fs.read(t);return new n(t,r.replace(/\r\n/g,`
|
|
2
|
+
`))}}if(l(e)){const{body:t,mimeType:r}=await m(e,this.config.http);return new n(e,t,r)}else{const t=p(f.relative(this.fs.cwd,e)),r=await this.fs.read(t);return new n(e,r.replace(/\r\n/g,`
|
|
3
3
|
`))}}catch(s){throw s.message=s.message.replace(", lstat",""),new h(s)}}}export{v as ExternalResolver};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells if a file record is the default-locale file that a missing translation falls back to.
|
|
3
|
+
* A virtual record outside the locale folders is a generated file, not a fallback.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isTranslationFallback(record?: {
|
|
6
|
+
relativePath?: string;
|
|
7
|
+
isVirtual?: boolean;
|
|
8
|
+
}): boolean;
|
|
9
|
+
//# sourceMappingURL=is-translation-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isL10nPath as t}from"./is-l10n-path.js";function l(a){return!!(a?.isVirtual&&a.relativePath&&t(a.relativePath))}export{l as isTranslationFallback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as n,dirname as f}from"node:path";import{fileURLToPath as l}from"node:url";import{readFile as u}from"fs/promises";import{createReadStream as d}from"fs";import{envConfig as v}from"./config/env-config.js";import{telemetry as g}from"./telemetry/index.js";import{createRouter as S}from"./web-server/router.js";import{installProdRoutes as R}from"./web-server/routes/index.js";import{Store as
|
|
1
|
+
import{resolve as n,dirname as f}from"node:path";import{fileURLToPath as l}from"node:url";import{readFile as u}from"fs/promises";import{createReadStream as d}from"fs";import{envConfig as v}from"./config/env-config.js";import{telemetry as g}from"./telemetry/index.js";import{createRouter as S}from"./web-server/router.js";import{installProdRoutes as R}from"./web-server/routes/index.js";import{Store as x}from"./store.js";import{loadEnvVariables as D}from"./utils/envs/load-env-variables.js";import{startHttpServer as P}from"./web-server/http.js";import{readStaticData as w}from"./utils/static-data.js";import{startIdleTimeout as E}from"./web-server/middleware/idleTimeoutMiddleware.js";import{reporter as y}from"./tools/notifiers/reporter.js";import{logger as b}from"./tools/notifiers/logger.js";import{EntitlementsProvider as h}from"./entitlements/entitlements-provider.js";import{DatabasePreconnectService as I}from"./providers/database/database-preconnect-service.js";import{KvService as O}from"./persistence/kv/services/kv-service.js";import{runScorecardsWorker as N}from"./plugins/scorecards/workers/run-scorecards-worker.js";import{isScorecardsEnabled as T}from"./utils/is-scorecards-enabled.js";import{isRealmOrReef as k}from"./utils/is-realm-or-reef.js";import{renderPage as or}from"./ssr/index.js";const A=new URL(import.meta.url),F=A.searchParams.get("only-exports")==="true";if(!F){let p=function(){const r=process.argv.findIndex(i=>i==="--port"||i==="-p");if(r===-1)return null;const t=process.argv[r+1];if(t.startsWith("-"))return null;const o=parseInt(t,10);return isNaN(o)?null:o};const e=f(l(import.meta.url));await D(e);const s=JSON.parse(await u(n(e,"./store.json"),"utf-8")),m=x.fromJson(s,{outdir:n(e,"../client"),serverOutDir:e,serverMode:!0,contentDir:""});if(await h.instance().init({ignoreTokenExpiration:!0}),k()){await I.init(e);const r=await O.getInstance({baseDbDir:e});setInterval(()=>{r.clearExpired().catch(t=>{b.error("Failed to clear expired KV entries",t)})},300*1e3)}c(m).catch(r=>{console.error(r)});async function c(r){g.initialize();const t=S();R(t,r,{readStaticAsset:async a=>d(a),resolveRouteData:async a=>w(a.slug,r.outdir)}),y.printErrors();const o=p(),i=v.PORT;return await P(t,o??i??4e3),E(),T(r.config)&&N(r.serverOutDir,r.config.scorecards),t}}export{or as renderPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPublicEnvVariables as n}from"../../utils/envs/get-public-env-variables.js";const
|
|
1
|
+
import{getPublicEnvVariables as n}from"../../utils/envs/get-public-env-variables.js";const o=async({fsPath:a,slug:t},r,{partials:e,variables:i},l)=>{const s=l.getPartialsForRoute?.(t)||e;return{definitionId:a,...r.props,markdown:{partials:s,variables:{...i,env:n()}},...r.isTranslationFallback?{isTranslationFallback:!0}:{}}};var p=o;export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as C,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{mcpTagSchemas as ot,schemaDefinitionTag as rt,markdocParser as U}from"@redocly/api-docs";import{withPathPrefix as $}from"@redocly/theme/core/utils";import{API_DOCS_TEMPLATE_ID as j,GRAPHQL_SPEC_SLUG as at,PUBLIC_RBAC_SCOPE_ITEM as N}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as st,PUBLIC_API_DEFINITIONS_FOLDER as it}from"../../constants/common.js";import{API_DOCS_SHARED_DATA_PREFIX as E}from"../../constants/plugins/api-docs.js";import{fromCurrentDir as nt}from"../../utils/paths.js";import{normalizeRouteSlug as ct}from"../../../utils/path/normalize-route-slug.js";import{removeTrailingSlash as pt}from"../../../utils/url/remove-trailing-slash.js";import{isTranslationFallback as ut}from"../../fs/utils/is-translation-fallback.js";import{createSlugify as lt}from"../create-slugify.js";import{apiDocLoader as dt,apiDocsLoader as mt}from"./loader.js";import{getTemplatePath as V}from"./get-template-path.js";import{storeDefinitionBundles as ft}from"./store-definition-bundles.js";import{telemetryTraceStep as gt}from"../../../cli/telemetry/helpers/trace-step.js";import{searchResolver as ht}from"./search/search-resolver.js";import{getAiDocumentsStore as Dt}from"./search/get-ai-search-documents.js";import{getApiConfigByPath as St}from"../get-api-config.js";import{getRouteSlugsForPath as Pt}from"../utils.js";import{collectItemRoutes as yt}from"./utils/collect-item-routes.js";import{isChunkCurrent as It}from"./utils/decorators.js";import{applyNavItemToRoot as At}from"./utils/apply-nav-item-to-root.js";import{buildRoutesMapping as vt}from"./utils/build-routes-mapping.js";import{buildItemPositions as bt}from"./utils/build-item-positions.js";import{resolveApiDocTitle as Rt}from"./utils/resolve-api-doc-title.js";import{resolveConfigRbac as W}from"./utils/resolve-config-rbac.js";import{relativePathToBaseSlug as _t}from"./utils/relative-path-to-base-slug.js";import{normalizeApiVersion as Ct}from"./utils/normalize-api-version.js";import{importApiDocsBuilder as Q}from"./import-api-docs-builder.js";import{envConfig as G}from"../../config/env-config.js";import{logger as Tt}from"../../tools/notifiers/logger.js";const k="openapi-spec-download",wt={asyncapi:"AsyncAPI Docs",graphql:"GraphQL Docs",openapi:"OpenAPI Docs"};async function de(){let e=[],r=new Map;const s=new WeakMap;let n=new Set,m={};function O(o,D,v){const y=s.get(o)??new Map;s.set(o,y);const S=D??"";return y.get(S)===v?!1:(y.set(S,v),!0)}return{id:"api-docs",requiredEntitlements:["openapi","asyncapi","graphql"],loaders:{"api-doc":dt,"api-docs":mt},processContent:async(o,D)=>{await gt("com.redocly.build.plugin.apiDocs",async()=>{o.createRequestHandler(k,nt(import.meta.url,"./spec-download.api.js")),o.addApiRoute({slug:it+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:st+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})}),o.addApiRoute({slug:at+"/*",requestHandlerId:k,httpMethod:"all",[A]:N,getStaticData:async()=>({props:{}})});const v=o.createTemplate(j,V("../../../client/templates/api-docs/template.js")),y=o.registerServerPropsGetter(j,V("./get-server-props.js")),S=await D.getConfig();r=new Map,m={};const I=await o.loadApiDocuments(D);ft(I,o.outdir);const T=!!S.plugins?.some(t=>typeof t=="string"&&t.startsWith("@redocly/portal-plugin-async-api/"));T&&I.some(t=>t.type==="asyncapi")&&Tt.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");const c=T?I.filter(t=>t.type!=="asyncapi"):I;e=c.map(({markdocChunks:t,relativePath:P,isVirtual:p,customOutputRelativeFile:a,realRelativePath:h})=>({chunks:t??[],relativePath:P,realRelativePath:h,isVirtual:a!=null||p}));const{buildItems:i}=await Q(o.serverOutDir),f=(await D.cache.load("content-slugs","content-slugs")).data,g=lt(f),F=t=>ct(g(t));for(const t of c){const P=t.customOutputRelativeFile||t.relativePath,p=F(P);Ot(t,p);const{items:a,store:h}=await i({type:t.type,document:t.document,options:t.options,basePath:p,markdownParser:U}),b=`${E}${t.relativePath}`,M=G.isDevelopMode?t.relativePath:void 0,u=Mt(t.document),R=u?.["x-metadata"],_=t.isVirtual?void 0:R?.apiId,L={document:t,basePath:p,sourcePath:M,apiId:_,build:{items:a,store:h}};await o.createSharedData(b,z(L,a,h));const Y=W(t.config),B=!!t.options.excludeFromSearch,X=t.type==="openapi",J=yt(a,Y),Z=ut(t),d=J.map(l=>{const x=l.metadata?.seo,w={fsPath:P,templateId:v,sharedData:[{key:"apiDocsStore",id:b}],serverPropsGetterIds:[y],excludeFromSearch:B,getStaticData:kt(l.label,x,Z),[A]:l[A]};return Object.assign(w,Ft(l.link,p)),X&&l.httpVerb&&(w.httpVerb=l.httpVerb,w.metadata={subType:"openapi-operation"}),w});if(!d.length)continue;const H=Rt(u,t.type,a),tt=Ct(u?.version),q={type:t.type,title:H,version:tt,description:typeof u?.description=="string"?u.description:void 0,summary:typeof u?.summary=="string"?u.summary:void 0,...u?.["x-metadata"]&&typeof u["x-metadata"]=="object"?u["x-metadata"]:{}};d[0]={...d[0],metadata:q,hasClientRoutes:!0,getSidebar:(l,x)=>At(K(a),p,x),getNavText:()=>H??wt[t.type]??"API Docs",getSearchDocuments:ht(a,q,o.getSearchFacets,o.setSearchFacets,B,h,t.document),getAiDocumentsStore:Dt({getBuild:()=>L.build,metadata:q,document:t.document,specType:t.type,excludeFromSearch:B,basePath:p,getSearchFacets:o.getSearchFacets,markdocTags:{...ot,schemaDefinition:rt}})};const et=d[0];d[0]=d[d.length-1],d[d.length-1]=et;for(const l of d)o.addRoute(l);if(_){const l=St(t.config?.apis,t.realRelativePath);m[_]={[A]:l.rbac,[C]:{fsPath:P}}}r.set(b,L)}})},afterRoutesCreated:async(o,D)=>{const{buildItems:v,simplifyAstStructure:y}=await Q(o.serverOutDir),S=new Set,I=new Set;for(const{chunks:c,relativePath:i,isVirtual:f}of e){const g=`${E}${i}`,F=Pt(o.getAllRoutes(),i);for(const{node:t,markdown:P,pointer:p,key:a,relativePath:h}of c){const{ast:b,compoundHash:M}=await o.parseMarkdoc({input:{content:P,relativePath:h,isVirtual:f},resource:p,context:D,deps:{sharedDataIds:[`${E}${h}`],routeSlugs:F}});if(S.add(p),!(a==="graphql-docs"?t?.description?.value!==void 0:!!a&&It(t,a,P))||!O(t,a,M))continue;I.add(g);const R=y(b);if(a==="graphql-docs"){t.description&&(t.description.value=R);const _=`${E}${h}`;Et(r.get(_),R)}else a&&(t[a]=R)}}const T=n.difference(S);for(const c of T)D.cache.delete(c);n=S,Object.entries(m).forEach(([c,i])=>{const f=i[C]?.fsPath;if(!f)return;const g=o.getRouteByFsPath(f)?.baseSlug;m[c]={...i,[C]:{...i[C],slug:g},slug:g}}),o.setGlobalData({apiProducts:m});for(const[c,i]of r){if(!I.has(c))continue;const{items:f,store:g}=await v({type:i.document.type,document:i.document.document,options:i.document.options,basePath:i.basePath,markdownParser:U});i.build={items:f,store:g},await o.createSharedData(c,z(i,f,g))}}}}function z({document:e,basePath:r,sourcePath:s,apiId:n},m,O){return{[A]:W(e.config),[C]:{slug:pt(r),fsPath:e.customOutputRelativeFile||e.relativePath},items:m,store:O,options:e.options,baseSlug:r,routesMapping:G.isDevelopMode?vt(m,r):{},graphqlPositions:G.isDevelopMode&&e.type==="graphql"?bt(m,r):void 0,sourcePath:s,apiId:n}}function Et(e,r){e?.document.type!=="graphql"||!e.document.options||(e.document.options.info={...e.document.options.info||{},description:r})}function kt(e,r,s){return async function(n){return{...s?{isTranslationFallback:!0}:{},props:{settings:{baseUrlPath:$(n.baseSlug)},disableAutoScroll:!0,seo:{title:e,...r}}}}}function Ot(e,r){const s=e.options?.mockServer,n=$(`/_mock${_t(e.relativePath)}`);s?.url===n&&(e.options={...e.options,mockServer:{...s,url:$(`/_mock${r}`)}})}function Ft(e,r){if(e===r)return{};const s=r==="/"?"/":`${r}/`;if(e.startsWith(s)){const n=e.slice(s.length);return n?{slugSuffix:n}:{}}return{slug:e}}function Mt(e){if(e&&typeof e=="object"&&"info"in e)return e.info}function K(e){return e.map(({content:r,items:s,...n})=>({...n,...s&&{items:K(s)}}))}export{de as apiDocsPlugin,Ft as toRouteSlugFields};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as l from"node:path";import{parse as
|
|
2
|
-
`;const e=Math.min(a.length,G);for(let i=0;i<e;i++){const
|
|
3
|
-
`}if(a.length>e){const i=a.length-e;c+=`... and ${i} more ${
|
|
1
|
+
import*as l from"node:path";import{parse as D,visit as N}from"graphql";import{Source as S,bundle as _,createConfig as x,getTotals as M,resolvePlugins as V}from"@redocly/openapi-core";import{convertSwaggerToOpenApi as j}from"@redocly/api-docs/lib/services/spec-convert/swagger.js";import{normalizeAsyncApiDefinition as F}from"@redocly/api-docs/lib/services/spec-convert/asyncapi.js";import{CONFIG_FILE_NAME as E}from"../../../constants/common.js";import{MAX_BUNDLING_ERRORS_TO_PRINT as G}from"../../constants/plugins/api-docs.js";import{unique as L}from"../../../utils/array/unique.js";import{deepMerge as z}from"../../../utils/object/deep-merge.js";import{pluralize as k}from"../../../utils/string/pluralize.js";import{replaceEnvVariablesDeep as H}from"../../utils/envs/replace-env-variables-deep.js";import{logger as q}from"../../tools/notifiers/logger.js";import{reporter as h}from"../../tools/notifiers/reporter.js";import{ExternalResolver as O}from"../../fs/utils/external-ref-resolver.js";import{collectCopiedDescriptionChunks as J,injectDecoratorIntoConfig as Q,isPlainNonMarkdownText as U}from"./utils/decorators.js";import{getAllApiConfigsByPath as X,getApiConfigByPath as K}from"../get-api-config.js";import{formatBundleError as W}from"./utils/format-bundle-error.js";import{injectMetadata as P}from"./utils/inject-metadata.js";import{createOptions as $}from"./options.js";const Y=/(\.ya?ml|\.json|\.gql|\.graphql)$/,v=/(\.gql|\.graphql)$/;async function $n(n,o){if(l.posix.basename(n)===E)return[];if(v.test(n)){if(await o.isPathIgnored(n))return[];const f=await sn(n,o);return f?[f]:[]}let r;try{r=(await o.cache.load(n,"yaml")).data}catch{return[]}const t=on(n,r);if(!t||!r||t==="graphql")return t===null&&q.verbose(`${n} file is not a recognized API spec. Skipping`),[];const{fs:s,getConfig:a,isPathIgnored:c}=o,e=t==="openapi"?await a("."):null,i=s.getFileInfo(n),u=await a(l.posix.dirname(n)),p=X(u?.apis,n,u.configPath),w=await c(n),d=[];for(const f of p){if(!f.output&&w)continue;const y=u.configPath?l.posix.dirname(u.configPath):".",g=f.output?l.posix.join(y,f.output):n;if(!await c(g)){i&&f.output&&!s.exists(g)&&s.addVirtualFile(g,i);try{const m=await an({relativePath:n,outputRelativePath:g,loaded:r,specType:t,rootConfig:e,config:u,apiConfig:f,fileRecord:i,fs:s});m&&d.push(m)}catch(m){await h.panicOnBuildContentError(m)}}}return d}async function vn(n,o){const{fs:r,cache:t}=o,s=[];for(const a of r.scan(Y)){let c;try{c=await t.load(a.relativePath,"api-doc")}catch{continue}if(c.data?.length)for(const e of c.data)s.push({...e,isVirtual:a.isVirtual||e.isVirtual,hash:c.compoundHash})}return s}function Z(n){const o=[];return N(n,{leave:r=>{!("description"in r)||!r.description?.value||!("name"in r)||U(r.description.value)||o.push({node:r,pointer:`#/types/${r?.name?.value}`,markdown:r.description.value,relativePath:"",key:"graphql-docs"})}}),o}async function nn(n){try{const o=D(n);return{document:o,markdocChunks:Z(o)}}catch(o){await h.panicOnBuildContentError(o);return}}function on(n,o){return v.test(n)?"graphql":o?.openapi||o?.swagger?"openapi":o?.asyncapi?"asyncapi":null}async function rn(n,o,r){if(n==="openapi"){const t=o.swagger!==void 0?j(o):o;return P(t,r)}return P(F(o),r)}async function tn(n){const{outputRelativePath:o,rootConfig:r,config:t,apiConfig:s,fs:a}=n,c=z({decorators:r?.decorators},t,{rbac:void 0},s),{resolvedObj:e}=H(c);if(e.decorators&&typeof e.decorators!="object"){await h.panicOnBuildContentError(`'decorators' must be an object at redocly.yaml, got '${typeof e.decorators}'`);return}if(e.plugins&&!Array.isArray(e.plugins)){await h.panicOnBuildContentError(`'plugins' must be an array at redocly.yaml, got '${typeof e.plugins}'`);return}const i=l.resolve(a.cwd,t.realConfigPath||E),u=new O(a),p=await x(Q(e,o,a.cwd),{configPath:i,externalRefResolver:u});return r?.plugins&&r.configPath!==t.configPath&&(p.plugins=L([...p.plugins||[],...await V(r.plugins,a.cwd)],w=>w.id)),{coreConfig:p,mergedConfig:e}}async function en(n,o,r){const t=M(n),s=[t.errors&&`${t.errors} ${k(t.errors,"error","errors")}`,t.warnings&&`${t.warnings} ${k(t.warnings,"warning","warnings")}`,t.ignored&&`${t.ignored} ignored`].filter(Boolean).join(", ");if(t.errors){const a=n.filter(i=>i.severity==="error");let c=`${s} while bundling ${o} definition:
|
|
2
|
+
`;const e=Math.min(a.length,G);for(let i=0;i<e;i++){const u=await W(a[i],r);c+=`${u}
|
|
3
|
+
`}if(a.length>e){const i=a.length-e;c+=`... and ${i} more ${k(i,"error","errors")}`}return await h.panicOnBuild(c),!0}return t.warnings&&q.warn(`${s} while bundling %rp definition`,o),!1}async function an(n){const{relativePath:o,outputRelativePath:r,loaded:t,specType:s,rootConfig:a,config:c,apiConfig:e,fileRecord:i,fs:u}=n,p=await tn(n);if(!p)return;const{coreConfig:w,mergedConfig:d}=p,f=l.resolve(u.cwd,o),y=new O(u),g={config:w,base:l.dirname(f),doc:{source:new S(f,await u.read(o)),parsed:JSON.parse(JSON.stringify(t))},externalRefResolver:y},{bundle:{parsed:C},problems:m,visitorsData:A}=await _(g);if(await en(m,r,u.cwd))return;const b=A["markdown/markdown"]?.markdocChunks??[],I=d.metadata,T=s==="asyncapi"||C.swagger!==void 0,R=await rn(s,C,I);T&&b.push(...J(R,b));const B=$(s,R,{rootConfig:a,config:c,apiConfig:e,mergedConfig:d,relativePath:r});return{type:s,document:R,config:d,relativePath:r,realRelativePath:i?.realRelativePath||r,customOutputRelativeFile:e.output?r:void 0,markdocChunks:b,isVirtual:i?.isVirtual,options:B}}async function sn(n,o){const{fs:r,getConfig:t}=o,s=await r.read(n),a=r.getFileInfo(n),{document:c,markdocChunks:e}=await nn(s)||{};if(!c){await h.panicOnBuildContentError(new Error("Failed to build GraphQL document"));return}const i=await t(),u=K(i.apis,n);i.graphql?.info?.description&&e?.unshift({node:{description:{value:i.graphql?.info?.description}},pointer:"#/info",markdown:i.graphql?.info?.description,relativePath:"",key:"graphql-docs"});const p=$("graphql",c,{rootConfig:null,config:i,apiConfig:u??{},mergedConfig:{graphql:{...i.graphql??{},...u?.graphql??{}}},relativePath:n});return{type:"graphql",document:c,config:{...i,...u},relativePath:n,realRelativePath:a?.realRelativePath||n,markdocChunks:e,isVirtual:a?.isVirtual,options:p}}export{$n as apiDocLoader,vn as apiDocsLoader,Z as collectGraphqlMarkdocChunks};
|
|
@@ -5,9 +5,12 @@ import type { MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
|
|
|
5
5
|
import type { AiDocumentsStore } from '../../../plugins/search/types.js';
|
|
6
6
|
type ApiDocument = OpenAPIDefinition | AsyncApiDefinition | Record<string, unknown>;
|
|
7
7
|
type AiDocumentsStoreParams = {
|
|
8
|
-
|
|
8
|
+
/** Read when the store runs: the markdoc rebuild in `afterRoutesCreated` replaces the items and the store built at route creation. */
|
|
9
|
+
getBuild: () => {
|
|
10
|
+
items: ApiItem[];
|
|
11
|
+
store?: ApiStore;
|
|
12
|
+
};
|
|
9
13
|
metadata: ApiDocsMetadata;
|
|
10
|
-
store?: ApiStore;
|
|
11
14
|
document?: ApiDocument;
|
|
12
15
|
specType: ApiSpecType;
|
|
13
16
|
excludeFromSearch?: boolean;
|
|
@@ -15,6 +18,6 @@ type AiDocumentsStoreParams = {
|
|
|
15
18
|
getSearchFacets: () => Map<string, SearchFacet>;
|
|
16
19
|
markdocTags?: Record<string, MarkdocTagSchema>;
|
|
17
20
|
};
|
|
18
|
-
export declare function getAiDocumentsStore({
|
|
21
|
+
export declare function getAiDocumentsStore({ getBuild, metadata, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown, _context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
|
|
19
22
|
export {};
|
|
20
23
|
//# sourceMappingURL=get-ai-search-documents.d.ts.map
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
`+
|
|
1
|
+
import x from"node:path";import{REDOCLY_TEAMS_RBAC as C}from"@redocly/config";import{nodeTypes as $,contentType as g,isGraphqlFieldsNode as pn,resolveGraphqlItemFields as un}from"@redocly/api-docs";import{normalizeApiVersion as dn}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as mn,canDownloadApiDefinition as hn,extractTeamsFromScopeItems as $n}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as K}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as X}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as yn}from"../../../../constants/common.js";import{isPlainObject as N}from"../../../../utils/guards/is-plain-object.js";import{ANONYMOUS_AUTH_DETAILS as gn}from"../../../constants/rbac.js";import{toMarkdown as j}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as bn}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as In}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as On}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as Pn}from"../../search/utils.js";import{extractDocumentSearchFacets as Sn}from"./search-facets.js";import{createApiDocsSearchIndexer as An,createLlmDescriptionFormatter as xn}from"./create-indexer.js";function O(e,s){return s==="openapi"&&"openapi"in e}function Z(e,s){return s==="asyncapi"&&"asyncapi"in e}function it({getBuild:e,metadata:s,document:c,specType:o,excludeFromSearch:n,basePath:r,getSearchFacets:t,markdocTags:i}){return async(l,f,d,p)=>{if(n)return;const{items:a,store:m}=e(),h={...p.markdocOptions?.tags,...i},{locale:en,translate:on}=await On(l.slug,p.getGlobalData?.().l10n),P=bn(h,en,on),L=p.getConfig(),D=In(l.fsPath),R=xn(P),V=An(r,R,m?.schemaStore,c,m?.exampleStore,m?.graphqlMeta),F=b=>{for(const u of b)V.addItem(u),u.items?.length&&F(u.items)};F(a);const sn=V.getResult(),_=new Map;for(const b of sn)_.set(b.url,b);const E=typeof s.title=="string"?s.title:void 0,q=dn(s.version),k=Sn(l.metadata||{},E,q,t),S=[],A=[],G=Cn(c,s),z=G?R(G):void 0,W=Tn(s,z,c,o,R),B=Ln(o,s,l.fsPath,L),rn=En(a,L,P),cn=W+B+`
|
|
2
|
+
`+rn,ln=W+B;A.push({title:E||"API Overview",description:z,content:cn,slug:r,fsPath:l.fsPath,includeInLLMsTxt:!0}),S.push({title:E||"API Overview",content:ln,url:r,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k});const fn=c&&O(c,o)?c.security:void 0,U=b=>{for(const u of b){if(!u.content||!u.link){u.items?.length&&U(u.items);continue}const an=_.get(u.link),J=u.content.contentType,Q=u[C],H=Q?$n(Q):void 0,Y=H?.length?H:void 0;if(J===g.ITEM){const y=kn(u,c,o)??nn(u,an,o,q,fn,P,m);if(y){const I=u.label||"";A.push({title:I,description:void 0,content:y,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:I,content:y,url:u.link,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k,rbacTeams:Y})}}else if(J===g.GROUP){const y=Un(u,L,o,P,m);if(y){const I=u.label||"";A.push({title:I,description:void 0,content:y.llmstxt,slug:u.link,fsPath:l.fsPath,includeInLLMsTxt:!1}),S.push({title:I,content:y.aiSearch,url:u.link,fsPath:l.fsPath,locale:D,product:l.product?.name,facets:k,rbacTeams:Y})}}u.items?.length&&U(u.items)}};return U(a),{async getLLMsTxts(){return A},async getSearchDocuments(){return S}}}}function Cn(e,s){const c=N(e?.info)?e.info:void 0,o=N(c?.["x-metadata"])?c["x-metadata"]:{},r=(typeof o.description=="string"?o.description:void 0)??c?.description??s.description;return typeof r=="string"?r||void 0:r&&typeof r=="object"?r:void 0}function Tn(e,s,c,o,n){const r=typeof e.title=="string"?e.title:"",t=typeof e.summary=="string"?e.summary:"",i=typeof e.version=="string"?e.version:"";let l=r?`# ${r}
|
|
3
3
|
|
|
4
|
-
`:"";if(
|
|
4
|
+
`:"";if(l+=s?`${s}
|
|
5
5
|
|
|
6
|
-
`:"",
|
|
6
|
+
`:"",l+=t?`${t}
|
|
7
7
|
|
|
8
|
-
`:"",
|
|
9
|
-
`:"",c){if(
|
|
10
|
-
`);const d=
|
|
8
|
+
`:"",l+=i?`Version: ${i}
|
|
9
|
+
`:"",c){if(O(c,o)){const{info:f}=c;f?.license?.name&&(l+=`License: ${f.license.name}
|
|
10
|
+
`);const d=f["x-metadata"],p=Object.entries(N(d)?d:{}).filter(([m,h])=>m!=="description"||typeof h!="string"),a=Pn(Object.fromEntries(p));a&&(l+=`
|
|
11
11
|
Metadata:
|
|
12
|
-
${
|
|
13
|
-
`)}else if(
|
|
14
|
-
`)}}return
|
|
15
|
-
`,
|
|
12
|
+
${a}
|
|
13
|
+
`)}else if(Z(c,o)){const{info:f}=c;f?.license?.name&&(l+=`License: ${f.license.name}
|
|
14
|
+
`)}}return l+=`
|
|
15
|
+
`,l+=Dn(c,o,n),l+=Rn(c,o,n),l}function Ln(e,s,c,o){if(!c)return"";let n,r,t;if(e==="openapi")n=x.posix.join(X,v(c,".yaml")),r="## Download OpenAPI description",t="OpenAPI definition";else if(e==="asyncapi")n=x.posix.join(X,v(c,".yaml")),r="## Download AsyncAPI description",t="AsyncAPI definition";else if(e==="graphql"){const f=x.posix.extname(c)||".graphql";n=x.posix.join(yn,v(c,f)),r="## Download GraphQL schema",t="GraphQL schema"}else return"";if(!hn(n,o.access?.rbac??{},o.access?.requiresLogin??!1,gn))return"";const l=typeof s.title=="string"&&s.title||t;return`${r}
|
|
16
16
|
|
|
17
|
-
- ${w({title:
|
|
17
|
+
- ${w({title:l,description:void 0,slug:n,siteUrl:o.seo?.siteUrl})}`}function Dn(e,s,c){if(!e)return"";if(O(e,s)){const{servers:o}=e;if(!o?.length)return"";let n=`## Servers
|
|
18
18
|
|
|
19
|
-
`;for(const
|
|
19
|
+
`;for(const r of o)if(r.description&&(n+=`${c(r.description)}
|
|
20
20
|
`),n+=`\`\`\`
|
|
21
|
-
${
|
|
21
|
+
${r.url}
|
|
22
22
|
\`\`\`
|
|
23
23
|
|
|
24
|
-
`,
|
|
25
|
-
`;for(const[t,i]of Object.entries(
|
|
24
|
+
`,r.variables){n+=`Variables:
|
|
25
|
+
`;for(const[t,i]of Object.entries(r.variables))n+=`- \`${t}\`${i.description?`: ${c(i.description).replace(/\s+/g," ")}`:""}
|
|
26
26
|
`,i.default&&(n+=` Default: ${JSON.stringify(i.default)}
|
|
27
|
-
`),i.enum&&(n+=` Enum: ${i.enum.map(
|
|
27
|
+
`),i.enum&&(n+=` Enum: ${i.enum.map(l=>JSON.stringify(l)).join(", ")}
|
|
28
28
|
`);n+=`
|
|
29
|
-
`}return n}if(
|
|
29
|
+
`}return n}if(Z(e,s)){const{servers:o}=e;if(!o||!Object.keys(o).length)return"";let n=`## Servers
|
|
30
30
|
|
|
31
|
-
`;for(const[
|
|
31
|
+
`;for(const[r,t]of Object.entries(o))n+=`### ${r}
|
|
32
32
|
|
|
33
33
|
`,t.description&&(n+=`${c(t.description)}
|
|
34
34
|
`),t.host&&(n+=`Host: ${t.host}
|
|
@@ -36,9 +36,9 @@ ${l.url}
|
|
|
36
36
|
`),t.protocolVersion&&(n+=`Protocol Version: ${t.protocolVersion}
|
|
37
37
|
`),t.pathname&&(n+=`Pathname: ${t.pathname}
|
|
38
38
|
`),n+=`
|
|
39
|
-
`;return n}return""}function
|
|
39
|
+
`;return n}return""}function Rn(e,s,c){if(!e||!O(e,s))return"";const o=e.components?.securitySchemes;if(!o)return"";let n=`## Security
|
|
40
40
|
|
|
41
|
-
`;for(const[
|
|
41
|
+
`;for(const[r,t]of Object.entries(o)){if(!t||"$ref"in t)continue;const i=t;n+=`### ${r}
|
|
42
42
|
|
|
43
43
|
`,i.description&&(n+=`${c(i.description)}
|
|
44
44
|
|
|
@@ -48,58 +48,58 @@ ${l.url}
|
|
|
48
48
|
`),i.scheme&&(n+=`Scheme: ${i.scheme}
|
|
49
49
|
`),i.bearerFormat&&(n+=`Bearer Format: ${i.bearerFormat}
|
|
50
50
|
`),i.openIdConnectUrl&&(n+=`OpenID Connect URL: ${i.openIdConnectUrl}
|
|
51
|
-
`);const
|
|
52
|
-
`),"tokenUrl"in
|
|
53
|
-
`),
|
|
54
|
-
`;for(const[d,p]of Object.entries(
|
|
51
|
+
`);const l=i.flows,f=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(f&&("authorizationUrl"in f&&f.authorizationUrl&&(n+=`Authorization URL: ${f.authorizationUrl}
|
|
52
|
+
`),"tokenUrl"in f&&f.tokenUrl&&(n+=`Token URL: ${f.tokenUrl}
|
|
53
|
+
`),f.scopes)){n+=`Scopes:
|
|
54
|
+
`;for(const[d,p]of Object.entries(f.scopes))n+=`- \`${d}\`: ${p}
|
|
55
55
|
`}n+=`
|
|
56
|
-
`}return n}function
|
|
56
|
+
`}return n}function En(e,s,c){let o="";const n=(r,t)=>{for(const i of r)if(i.link){if(i.content?.contentType===g.GROUP)o+=`${t} ${i.label||""}
|
|
57
57
|
|
|
58
|
-
`,i.items?.length&&n(i.items,t+"#");else if(i.content?.contentType===g.ITEM){if(!M(i,s))continue;const
|
|
58
|
+
`,i.items?.length&&n(i.items,t+"#");else if(i.content?.contentType===g.ITEM){if(!M(i,s))continue;const l=i,f=l.httpVerb,d=l.httpPath,p=f&&d?`${f.toUpperCase()} ${d}`:i.label||"",a=i.content?T(i.content.children,c):void 0;o+=` - ${w({title:p,description:a?a.slice(0,200):void 0,slug:K(i.link),siteUrl:s.seo?.siteUrl})}`}}};return n(e,"##"),o}function nn(e,s,c,o,n,r,t){if(!e.content)return;const i=e,l=e.label||"",f=T(e.content.children,r),d=e.content.meta?.deprecated;let p=`# ${l}${d?" (deprecated)":""}
|
|
59
59
|
|
|
60
|
-
`;if(
|
|
60
|
+
`;if(f&&(p+=`${f}
|
|
61
61
|
|
|
62
|
-
`),c==="openapi"||c==="asyncapi"){const
|
|
63
|
-
`:
|
|
64
|
-
`),
|
|
65
|
-
`);const
|
|
62
|
+
`),c==="openapi"||c==="asyncapi"){const a=i.httpVerb,m=i.httpPath;a&&m?p+=`Endpoint: ${a.toUpperCase()} ${m}
|
|
63
|
+
`:a&&(p+=`Method: ${a.toUpperCase()}
|
|
64
|
+
`),o&&(p+=`Version: ${o}
|
|
65
|
+
`);const h=vn(e.content.children,n);h&&(p+=`Security: ${h}
|
|
66
66
|
`)}return s?.parameters?.length&&c!=="graphql"&&(p+=`
|
|
67
|
-
`+
|
|
68
|
-
`),c==="graphql"&&(p+=
|
|
67
|
+
`+Nn(s.parameters)+`
|
|
68
|
+
`),c==="graphql"&&(p+=jn(e.content.children,t,r)),p}function kn(e,s,c){if(e.httpVerb!=="tool"||!s||!O(s,c))return;const o=e.content?.meta?.name,n=o?s["x-mcp"]?.tools?.find(t=>t.name===o):void 0;if(!n)return;let r=`# ${e.label||n.name}
|
|
69
69
|
|
|
70
|
-
`;return typeof n.description=="string"&&n.description&&(
|
|
70
|
+
`;return typeof n.description=="string"&&n.description&&(r+=`${n.description}
|
|
71
71
|
|
|
72
|
-
`),
|
|
72
|
+
`),r+=`## Input schema:
|
|
73
73
|
|
|
74
|
-
`,
|
|
74
|
+
`,r+=`\`\`\`json
|
|
75
75
|
${JSON.stringify(n.inputSchema,null,2)}
|
|
76
76
|
\`\`\`
|
|
77
77
|
|
|
78
|
-
`,n.outputSchema&&(
|
|
78
|
+
`,n.outputSchema&&(r+=`## Output schema:
|
|
79
79
|
|
|
80
|
-
`,
|
|
80
|
+
`,r+=`\`\`\`json
|
|
81
81
|
${JSON.stringify(n.outputSchema,null,2)}
|
|
82
82
|
\`\`\`
|
|
83
83
|
|
|
84
|
-
`),
|
|
84
|
+
`),r}function Un(e,s,c,o,n){if(!e.content)return;const r=e.label||"",t=T(e.content.children,o);let i=`# ${r}
|
|
85
85
|
|
|
86
86
|
`;if(t&&(i+=`${t}
|
|
87
87
|
|
|
88
|
-
`),c==="graphql"){let
|
|
88
|
+
`),c==="graphql"){let f="";const d=p=>{for(const a of p??[])if(!(!a.content||!M(a,s)))if(a.content.contentType===g.ITEM){const m=nn(a,void 0,c,void 0,void 0,o,n);m&&(f+=`${m}
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
-
`)}else
|
|
93
|
-
`;return
|
|
94
|
-
`),t.enum?
|
|
95
|
-
`:t.example&&(
|
|
96
|
-
`),
|
|
92
|
+
`)}else a.content.contentType===g.GROUP&&d(a.items)};return d(e.items),{llmstxt:i+f,aiSearch:i}}let l="";if(e.items?.length)for(const f of e.items){if(!f.link||!f.content||f.content.contentType!==g.ITEM||!M(f,s))continue;const d=f,p=d.httpVerb,a=d.httpPath,m=p&&a?`${p.toUpperCase()} ${a}`:f.label||"",h=f.content?T(f.content.children,o):void 0;l+=` - ${w({title:m,description:h?h.slice(0,200):void 0,slug:K(f.link),siteUrl:s.seo?.siteUrl})}`}return{llmstxt:i+l,aiSearch:i}}function vn(e,s){const c=[],o=n=>{for(const r of n)if(r.nodeType===$.SECURITY){const t=r;for(const i of t.requirements)for(const l of i.schemes)l[C]||l.name&&!c.includes(l.name)&&c.push(l.name)}else(r.nodeType===$.CONTAINER||r.nodeType===$.OVERVIEW_SECTION_WRAPPER)&&o(r.children)};if(o(e),c.length)return c.join(", ");if(s?.length){const n=s.flatMap(r=>Object.keys(r));if(n.length)return[...new Set(n)].join(", ")}}function Nn(e){const s={};for(const o of e){const n=`${o.place}${o.mediaType?` (${o.mediaType})`:""}`;s[n]||(s[n]=[]),s[n].push(o)}return Object.entries(s).map(([o,n])=>{const r=n.map(t=>{const i=[...t.path||[],t.name],l=Array.isArray(t.description)?t.description.join(" "):t.description;let f=` - \`${i.join(".")}\` (${t.type}${t.required?", required":""})
|
|
93
|
+
`;return l&&(f+=` ${l.trim()}
|
|
94
|
+
`),t.enum?f+=` Enum: ${t.enum.map(d=>JSON.stringify(d)).join(", ")}
|
|
95
|
+
`:t.example&&(f+=` Example: ${t.example}
|
|
96
|
+
`),f});return`## ${tn(o)}:
|
|
97
97
|
|
|
98
|
-
${
|
|
98
|
+
${r.join(`
|
|
99
99
|
`)}`}).join(`
|
|
100
|
-
`)}function
|
|
101
|
-
## ${
|
|
100
|
+
`)}function jn(e,s,c){let o="";const n=r=>{for(const t of r)if(t.nodeType===$.ITEM){const i=pn(t)?un(t,s??{}):void 0;i&&(o+=wn(i,t.variant,c))}else(t.nodeType===$.CONTAINER||t.nodeType===$.OVERVIEW_SECTION_WRAPPER)&&n(t.children)};return n(e),o}function wn(e,s,c){let n=`
|
|
101
|
+
## ${tn(s==="return-type"?"Return type":s==="graphql-args"||s==="arguments"?"Arguments":s==="graphql-fields"?"Fields":s)}:
|
|
102
102
|
|
|
103
|
-
`;const
|
|
104
|
-
`};if(e.type){const t=e.type.description?
|
|
105
|
-
`}else if(!e.fields.length)return"";for(const t of e.fields)n+=
|
|
103
|
+
`;const r=t=>{const i=t.description?j(Array.isArray(t.description)?t.description:[t.description],{renderTag:c}).trim():"";return` - \`${t.name}\` (${t.type.display})${i?`: ${i}`:""}
|
|
104
|
+
`};if(e.type){const t=e.type.description?j(Array.isArray(e.type.description)?e.type.description:[e.type.description],{renderTag:c}).trim():"";n+=` Type: ${e.type.display}`,t&&(n+=` - ${t}`),n+=`
|
|
105
|
+
`}else if(!e.fields.length)return"";for(const t of e.fields)n+=r(t);return n}function T(e,s){const c=[],o=r=>{for(const t of r)if(t.nodeType===$.MARKDOC){const i=t.content,l=Array.isArray(i)?i:[i],f=j(l,{renderTag:s}).trim();f&&c.push(f)}else(t.nodeType===$.CONTAINER||t.nodeType===$.OVERVIEW_SECTION_WRAPPER)&&o(t.children)};return o(e),c.join(" ").trim()||void 0}function tn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function M(e,s){return s.access?.requiresLogin?!0:mn({slug:e.link||"",[C]:e[C]},s)}export{it as getAiDocumentsStore};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type WithInfo = {
|
|
2
|
+
info?: {
|
|
3
|
+
'x-metadata'?: Record<string, unknown>;
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Merges the API config `metadata` into `info.x-metadata`, the config winning over the spec.
|
|
8
|
+
*
|
|
9
|
+
* Mutates `document` and its `info` in place and returns the same object. The bundle
|
|
10
|
+
* decorators collect the `#/info/description` chunk as a reference to the `info` object, so
|
|
11
|
+
* a copy would leave the resolved Markdoc AST on an orphan and the document with the raw string.
|
|
12
|
+
*
|
|
13
|
+
* @param document - the bundled document
|
|
14
|
+
* @param metadata - the config `metadata`, or none
|
|
15
|
+
* @returns the same document
|
|
16
|
+
*/
|
|
17
|
+
export declare function injectMetadata<T extends WithInfo>(document: T, metadata: Record<string, unknown> | undefined): T;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=inject-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(t,i){if(!i)return t;const a=t.info??{};return t.info=a,a["x-metadata"]={...a["x-metadata"],...i},t}export{n as injectMetadata};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";import{useMemo as l}from"react";import{QueryClientProvider as
|
|
1
|
+
import*as t from"react";import{useMemo as l}from"react";import{QueryClientProvider as m,QueryClient as c}from"@tanstack/react-query";import{RedocSchema as u,StoreProvider as i,GraphQLTypeViewByName as d,MarkdownAdapterProvider as n,createMarkdocAdapter as f}from"@redocly/api-docs";import{buildGraphqlStoreFromSdl as s}from"@redocly/api-docs/lib/adapters/graphql/buildStoreFromSdl.js";import{Catalog as p}from"@redocly/theme/components/Catalog/Catalog";import{CatalogEntity as y}from"@redocly/theme/components/Catalog/CatalogEntity/CatalogEntity";import{NotFound as h}from"@redocly/theme/layouts/NotFound";const E=new c({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),o=f();function S({sdl:e,typeName:a}){const r=l(()=>{try{return s(e)}catch{return null}},[e]);return r?t.createElement(i,{apiStore:r,options:{specType:"graphql"}},t.createElement(n,{value:o},t.createElement(d,{typeName:a,fieldExpandLevel:0}))):null}function w({pageProps:e}){return e.status==="notFound"?t.createElement(h,null):t.createElement(m,{client:E},"entities"in e&&t.createElement(p,{entitiesTypes:e.entitiesTypes,catalogConfig:e.catalogConfig,filters:e.filters,initialEntitiesList:e.entities,catalogSwitcherItems:e.catalogSwitcherItems,initialViewMode:e.initialViewMode}),"entity"in e&&t.createElement(n,{value:o},t.createElement(y,{RedocSchema:u,StoreProvider:i,GraphqlTypeRenderer:S})))}export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import S from"path";import{REDOCLY_ROUTE_RBAC as u,REDOCLY_TEAMS_RBAC as y}from"@redocly/config";import{deepMerge as T}from"../../../utils/object/deep-merge.js";import{parsePathVersions as D}from"../../../utils/path/parse-path-versions.js";import{buildWildcardRedirectsTree as w}from"../../utils/redirects/build-wildcard-redirects-tree.js";import{shaHexShort as E}from"../../utils/crypto/sha-hex-short.js";import{formatCustomScripts as h,formatCustomLinks as L}from"./format-custom-tags.js";import{applyL10nToRbacConfig as O,resolveDirectoryHashes as k}from"../../utils/rbac.js";import{isConsentEnabled as G}from"../consent/is-consent-enabled.js";import{copySeoAssets as B}from"./copy-seo-assets.js";import{normalizeRedirectSources as F}from"./normalize-redirect-sources.js";import{applyL10nToRedirects as _}from"./apply-l10n-to-redirects.js";import{DEFAULT_LOADERS as j}from"./loaders/index.js";import{resolveSearchFacets as x}from"./resolve-search-facets.js";import{telemetryTraceStep as M}from"../../../cli/telemetry/helpers/trace-step.js";import{transformMdAst as z}from"../markdown/runtime-transform.js";import{EntitlementsProvider as I}from"../../entitlements/entitlements-provider.js";async function ir(){return{id:"Config Parser",loaders:j,async processContent(e,{getConfig:a,fs:o}){await M("com.redocly.build.plugin.configParser",async t=>{const{contentDir:l,setGlobalConfig:s,setGlobalData:i}=e,r=await a(),n=r.access||{},m=O(o,n.rbac||{}),f={outdir:e.outdir,contentDir:l,consentEnabled:G(r.consent)},C=await h(r.scripts?.head,f),P=await L(r.links,f),R=await h(r.scripts?.body,f),d=T(r,{headScriptTags:C,linkTags:P,postBodyScriptTags:R});t?.setAttribute("config",JSON.stringify(d));const p=r.redirects?F(r.redirects):{},v=Object.keys(p),A=d.banner?.map(c=>typeof c=="object"&&c!==null&&c.rbac?{...c,[y]:c.rbac}:c);s({...d,banner:A,access:{...n,requiresLogin:!!n.requiresLogin,rbac:m},directoryPaths:await k(o,n.rbac),seo:r.seo&&await B(r.seo,f.contentDir,f.outdir),redirects:_(p,r.l10n),wildcardRedirectsTree:w(p),originalRedirectSources:v}),x(r.search?.filters?.facets||[],e.getSearchFacets,e.setSearchFacets);const b=I.instance(),g=!!b.canAccessFeature("removeAttribution");i({removeAttribution:b.pricingTier?g:!0,removeConsoleAttribution:g&&r.removeAttribution===!0})})},async afterRoutesCreated(e,a){V(e);const o=e.getGlobalConfig("banner");if(Array.isArray(o)){const t=await Promise.all(o.map(async(l,s)=>{const{content:i,...r}=l,{ast:n}=await e.parseMarkdoc({input:{content:i,relativePath:"redocly.yaml"},context:a,resource:`redocly.yaml#banner${s}`}),{renderableAst:m}=await z(n,{variables:{},partials:{}},e.serverOutDir);return{...r,ast:m,hash:E(i)}}));e.setGlobalConfig({banner:t})}}}}function V(e){const a=e.getGlobalConfig("access")?.rbac,o=e.getGlobalConfig("directoryPaths");if(!(!a||Object.keys(a).length===0))for(const t of e.getAllRoutes()){if(t.versions&&o){const l=D(t.fsPath)?.filePathInVersion||"index.md";for(const s of t.versions){const i=o[s.folderId],n=i==="."||i==="/"?"":i;s[u]={slug:s.link,fsPath:S.posix.join(n,"@"+s.version,l)}}}t[u]||t[y]||(t[u]={slug:t.slug,fsPath:t.fsPath})}}export{ir as configParserPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(
|
|
1
|
+
import v from"path";import{I18N_DIR_NAME as c,L10N_DIR_NAME as p,RESERVED_DIR_NAMES as u,VERSION_SEPARATOR as V,VERSIONED_FOLDER_REGEXP_MATCH as P}from"../../../constants/common.js";import{parsePathVersions as l}from"../../../../utils/path/parse-path-versions.js";import{compareVersions as g}from"../../../../utils/version/compare-versions.js";import{reporter as h}from"../../../tools/notifiers/reporter.js";import{logger as y}from"../../../tools/notifiers/logger.js";const A=async(r,{cache:i,fs:s})=>{const e=new Map,a=s.scan();await E(a);for(const{relativePath:n}of a){if(v.posix.basename(n)==="versions.yaml"){await F(n,e,i);continue}const o=l(n);if(o==null||u.includes(V+o.versionName))continue;const t=e.get(o.versionFolderPath)||{versionedFiles:new Map,versions:[]},f=t.versionedFiles.get(o.filePathInVersion)||new Set,d={version:o.versionName};f.add(d.version),!t.hasVersionsConfig&&t.versions.findIndex(m=>m.version===o.versionName)===-1&&t.versions.push(d),t.versionedFiles.set(o.filePathInVersion,f),e.set(o.versionFolderPath,t)}return I(e)};async function F(r,i,s){let e=v.posix.dirname(r);e==="."?e="/":e=e.endsWith("/")?e:e+"/",e.startsWith(c+"/")&&(e=e.slice(c.length+1)),e.startsWith(p+"/")&&(e=e.slice(p.length+1));const n=(await s.load(r,"yaml")).data;n.versions&&!Array.isArray(n.versions)?(await h.panicOnBuild(`Property 'versions' must be an array at %rp. Got '${typeof n.versions}'.`,r),n.versions=[]):(!n.versions||n.versions.length===0)&&y.warn("Property 'versions' is empty at %rp. This is likely a mistake.",r);const o=i.get(e)||{versionedFiles:new Map,versions:[]};o.hasVersionsConfig=!0,o.versions=n.versions||[],n.default&&(o.defaultVersion=n.default),i.set(e,o)}async function E(r){const i=new Set;for(const{relativePath:s}of r){const e=l(s);if(!(e?.versionFolderPath&&u.includes(e?.versionFolderPath))){if(e?.versionFolderPath==null){(s.match(P)?.length||0)>1&&await h.panicOnBuild(`Nested versions are not supported. Detected nested versions in path: "${s}".`);continue}i.has(e.versionFolderPath)||i.add(e.versionFolderPath)}}}function I(r){for(const[i,s]of r){const e=s.hasVersionsConfig?s.versions:s.versions.sort((o,t)=>g(t.version,o.version)),a=s.hasVersionsConfig?e[e.length-1]:e[0],n=s.defaultVersion||a?.version;r.set(i,{...s,versions:e,defaultVersion:n})}return r}function S(r,i){const s=l(r);return s==null?null:i.get(s.versionFolderPath)?.defaultVersion}export{S as getDefaultVersionByPath,A as versionsConfigLoader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as m}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as v,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as l}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,
|
|
1
|
+
import{CONFIG_FILE_NAME as s}from"../../../constants/common.js";import{slash as m}from"../../../utils/path/slash.js";import{reporter as r}from"../../tools/notifiers/reporter.js";import{copyStaticFile as v,FileNotFoundError as c}from"../../utils/fs.js";import{resolveSrcSet as l}from"../../utils/resolve-src-set.js";import{resolveAssetPath as f}from"../../utils/resolve-asset-path.js";const p=["png","svg","ico"];async function u(e={},o,n,t){const a={...e};if(e.image)try{a.image=await f(e.image,t,{fromFileRelativePath:o,contentDir:t.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.image": %rp',e.image):await r.panicOnBuild(`Cannot resolve "logo.image": %rp: ${i.message}`,e.image)}if(e.srcSet)try{a.srcSet=await l(e.srcSet,t,{fromFileRelativePath:s,contentDir:t.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError(`Cannot resolve "logo.srcSet" "${e.srcSet}"`):await r.panicOnBuild(`Cannot resolve "logo.srcSet" "${e.srcSet}": ${i.message}`)}if(e.favicon)try{a.favicon=await f(e.favicon,t,{fromFileRelativePath:s,contentDir:t.cwd,outdir:n})}catch(i){i instanceof c?await r.panicOnBuildContentError('Cannot resolve "logo.favicon": %rp',e.favicon):await r.panicOnBuild(`Cannot resolve "logo.favicon": %rp: ${i.message}`,e.favicon)}return a.favicon||(a.favicon=await w(n,t)),a}async function w(e,o){for(const n of p){const t=`favicon.${n}`,a=m(t);if(o.exists(a))return v(o.cwd,t,e)}}export{u as resolveLogoConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function s(t){return async e=>{const o=e.get("devOnboardingAdapter"),{data:n,total:
|
|
1
|
+
function s(t){return async e=>{const o=e.get("devOnboardingAdapter"),{data:n,total:r}=await o.getApiProducts();return e.json(n,200,{"X-Pagination-Total":r.toString(),"Cache-Control":"no-store"})}}function d(){return async t=>{const e=t.req.param("id"),o=!!t.req.query("expand");if(!e)return t.json({error:"Not found"},404);const n=decodeURI(e),a=await t.get("devOnboardingAdapter").getApiAccessStatus(n,o);return t.json(a,200,{"Cache-Control":"no-store"})}}export{d as getApiAccessStatus,s as listApiProducts};
|