@redocly/redoc-reef 0.131.0 → 0.132.0-next.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 +22 -0
- package/dist/client/app/hooks/catalog/useCatalogSort.d.ts +1 -1
- package/dist/client/app/hooks/catalog/useCatalogSort.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
- package/dist/markdoc/helpers/extract-rbac-from-condition-node.d.ts +6 -15
- package/dist/markdoc/helpers/extract-rbac-from-condition-node.js +1 -1
- package/dist/markdoc/helpers/guards/is-function.d.ts +1 -0
- package/dist/markdoc/helpers/guards/is-variable.d.ts +3 -3
- package/dist/server/config/env-config.d.ts +1 -0
- package/dist/server/config/env-config.js +1 -1
- package/dist/server/config/env-schema.d.ts +3 -3
- package/dist/server/config/env-schemas/server-config.d.ts +3 -3
- package/dist/server/config/env-schemas/server-config.js +1 -1
- package/dist/server/esbuild/esbuild-logger.js +3 -3
- package/dist/server/plugins/catalog-entities/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/search/get-search-documents.d.ts +1 -1
- package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
- package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +2 -2
- package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
- package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
- package/dist/server/plugins/sidebars/index.d.ts +1 -1
- package/dist/server/plugins/sidebars/index.js +2 -2
- package/dist/server/providers/database/pagination/after-and-before.js +1 -1
- package/dist/server/providers/database/pagination/utils/create-cursor.d.ts +7 -1
- package/dist/server/providers/database/pagination/utils/create-cursor.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/helpers/colors.js +1 -1
- package/dist/server/web-server/utils/prepare-list-response.js +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @redocly/redoc-reef
|
|
2
2
|
|
|
3
|
+
## 0.132.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ce5a165177d: Added support for `or` functions in RBAC conditions within Markdoc content.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ce5a165177d: Fixed a bug where Markdoc content wrapped in an RBAC condition did not appear in search results for users with access.
|
|
12
|
+
- b3e65a364b6: Fixed out-of-memory error in the search indexer that occurred when indexing deeply nested schemas.
|
|
13
|
+
- cd5f1c2d680: Fixed an issue in `scorecardClassic` where the `minimumLevel` calculation in `targets` resulted in incorrect values.
|
|
14
|
+
- ea340565546: Fixed an issue where the catalog tile descriptions displayed Markdown syntax as raw text.
|
|
15
|
+
- f90fa0dd771: Enter prerelease mode.
|
|
16
|
+
- Updated dependencies [f90fa0dd771]
|
|
17
|
+
- @redocly/portal-plugin-mock-server@0.17.0-next.0
|
|
18
|
+
- @redocly/realm-asyncapi-sdk@0.10.0-next.0
|
|
19
|
+
- @redocly/portal-legacy-ui@0.15.0-next.0
|
|
20
|
+
- @redocly/asyncapi-docs@1.9.0-next.0
|
|
21
|
+
- @redocly/graphql-docs@1.9.0-next.0
|
|
22
|
+
- @redocly/openapi-docs@3.20.0-next.0
|
|
23
|
+
- @redocly/theme@0.64.0-next.0
|
|
24
|
+
|
|
3
25
|
## 0.131.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SortOption } from '@redocly/theme/core/types';
|
|
2
|
-
export declare function useCatalogSort(): {
|
|
2
|
+
export declare function useCatalogSort(defaultSortOption?: SortOption | null): {
|
|
3
3
|
sortOption: SortOption | null;
|
|
4
4
|
setSortOption: import("react").Dispatch<import("react").SetStateAction<SortOption | null>>;
|
|
5
5
|
handleSortClick: (sortKey: string, direction: "asc" | "desc") => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as c,useEffect as
|
|
1
|
+
import{useCallback as c,useEffect as m,useState as p}from"react";import{useSearchParams as f}from"react-router-dom";function O(l){const[s,a]=f(),u=s.get("sort")||null,[e,r]=p(u??l??null);m(()=>{const t=new URLSearchParams(s);e?t.set("sort",e):t.delete("sort"),a(t,{replace:!0})},[e,s,a]);const i=c((t,n)=>{const o=n==="desc"?t:`-${t}`;r(e===o?null:o)},[e,r]),S=c((t,n)=>{if(!t||!e)return!1;const o=n==="desc"?t:`-${t}`;return e===o},[e]);return{sortOption:e,setSortOption:r,handleSortClick:i,isColumnSorted:S}}export{O as useCatalogSort};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as m,useRef as w}from"react";import{withPathPrefix as R}from"@redocly/theme/core/utils";import{getNextPageParam as S}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as F}from"./useSearchTracker";function x({limit:o=20,filter:i,sort:s="type",search:n}={},r){const
|
|
1
|
+
import{useInfiniteQuery as y}from"@tanstack/react-query";import{useMemo as m,useRef as w}from"react";import{withPathPrefix as R}from"@redocly/theme/core/utils";import{getNextPageParam as S}from"../../../utils/catalog/get-next-page-param";import{useSearchTracker as F}from"./useSearchTracker";function x({limit:o=20,filter:i,sort:s="type,title",search:n}={},r){const l=r?r.items.map(e=>e.key).join("-"):[],c=w(!0),d=c.current&&r;c.current&&(c.current=!1);const a=y({queryFn:async e=>{const t=new URLSearchParams;i&&t.append("filter",i),s&&t.append("sort",s),o&&t.append("limit",o.toString()),n&&t.append("search",n),e.pageParam&&Object.entries(e.pageParam).forEach(([P,f])=>{f!=null&&t.append(P,f.toString())});const p=new URL(R("/bff/catalog-entities"),window.location.origin);p.search=t.toString();const u=await fetch(p.toString());if(!u.ok)throw new Error(`Failed to fetch catalog entities from ${p.pathname}`);return u.json()},queryKey:["bff/catalog-entities",{limit:o,filter:i,sort:s,search:n,initialDataKeys:l}],initialData:d?{pages:[r],pageParams:[null]}:void 0,initialPageParam:null,getNextPageParam:S,refetchOnMount:!0,placeholderData:e=>e}),h=m(()=>{const e=a.data?.pages||[];return e[e.length-1]?.page.total},[a.data?.pages]),g=m(()=>(a.data?.pages||[]).flatMap(e=>e.items||[]),[a.data?.pages]);return F({isLoading:a.isLoading||a.isFetching,items:g,apiResource:"entities",searchQuery:n??""}),{query:a,items:g,total:h}}export{x as useFetchCatalogEntities};
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import type { Node } from '@markdoc/markdoc';
|
|
2
2
|
/**
|
|
3
|
-
* Extracts
|
|
3
|
+
* Extracts RBAC team(s) from a conditional Markdoc node.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Supports:
|
|
6
|
+
* - `includes(rbac.teams, "team-name")` → returns an array with a single team string.
|
|
7
|
+
* - `or(includes(rbac.teams, "a"), includes(rbac.teams, "b"), ...)` → returns an array of team strings (only if every argument is an RBAC includes condition).
|
|
8
8
|
*
|
|
9
9
|
* @param node - The Markdoc conditional node with tag 'if' to analyze.
|
|
10
|
-
* @returns
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // For a node representing: {% if includes(rbac.teams, "admin") %}
|
|
15
|
-
* const teamName = extractRbacFromCondition(node);
|
|
16
|
-
* // Returns: "admin"
|
|
17
|
-
* ```
|
|
10
|
+
* @returns An array of team names, or `undefined` if the condition does not match an RBAC pattern.
|
|
18
11
|
*/
|
|
19
|
-
export declare function extractRbacFromCondition(node: Node
|
|
20
|
-
tag: 'if';
|
|
21
|
-
}): string | null;
|
|
12
|
+
export declare function extractRbacFromCondition(node: Node): string[] | undefined;
|
|
22
13
|
//# sourceMappingURL=extract-rbac-from-condition-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function n
|
|
1
|
+
import{isFunction as o}from"./guards/is-function.js";import{isVariable as c}from"./guards/is-variable.js";import{isConditionalNode as s}from"./guards/is-conditional-node.js";function i(n){const t=n.parameters;if(typeof t!="object")return;const r=t?.[0],e=t?.[1];if(!(!c(r)||typeof e!="string")&&!(r.path?.[0]!=="rbac"||r.path?.[1]!=="teams"))return e}function m(n){const t=n.parameters,r=[];for(const e of Object.values(t)){if(!o(e)||e.name!=="includes")continue;const a=i(e);a&&r.push(a)}return r}function b(n){if(!s(n))return;const t=n.attributes.primary;if(o(t)){if(t.name==="or")return m(t);if(t.name==="includes"){const r=i(t);if(r)return[r]}}}export{b as extractRbacFromCondition};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Variable } from '@markdoc/markdoc';
|
|
2
2
|
/**
|
|
3
|
-
* Checks if a given value is a Markdoc `Variable
|
|
3
|
+
* Checks if a given value is a Markdoc `Variable`.
|
|
4
4
|
*
|
|
5
5
|
* A valid variable must:
|
|
6
6
|
* - Be an object with a `$$mdtype` property
|
|
7
7
|
* - Have `$$mdtype` equal to `'Variable'`
|
|
8
8
|
*
|
|
9
9
|
* @param value - Any value to check.
|
|
10
|
-
* @returns `true` if the value is a Markdoc `Variable
|
|
10
|
+
* @returns `true` if the value is a Markdoc `Variable`, otherwise `false`.
|
|
11
11
|
*/
|
|
12
|
-
export declare function isVariable(value?: unknown): value is Variable
|
|
12
|
+
export declare function isVariable(value?: unknown): value is Variable;
|
|
13
13
|
//# sourceMappingURL=is-variable.d.ts.map
|
|
@@ -11,6 +11,7 @@ export type EnvConfigDerived = {
|
|
|
11
11
|
isBuildMode: boolean;
|
|
12
12
|
isDevelopMode: boolean;
|
|
13
13
|
isRuntimeMode: boolean;
|
|
14
|
+
logFormat: string | undefined;
|
|
14
15
|
};
|
|
15
16
|
export type EnvConfigWithDerived = EnvConfig & EnvConfigDerived;
|
|
16
17
|
export declare const envConfig: EnvConfigWithDerived;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readEnvVariable as u}from"../utils/envs/read-env-variable.js";import{envSchema as c}from"./env-schema.js";function
|
|
1
|
+
import{readEnvVariable as u}from"../utils/envs/read-env-variable.js";import{envSchema as c}from"./env-schema.js";function r(){const n=Object.fromEntries(Object.keys(process.env).map(e=>[e,u(e)]));return n.REDOCLY_PORTAL_VERSION=process.env.REDOCLY_PORTAL_VERSION,c.parse(n)}function o(){return r().REDOCLY_ENV??"development"}function i(){const n=process.env.REDOCLY_EXECUTION_MODE;return n==="build"||n==="develop"||n==="runtime"?n:"develop"}function s(){const e=r().REDOCLY_INTERNAL_DEV;return e==="true"||e==="1"}function v(){return r().REDOCLY_LOG_FORMAT}function d(n){switch(n){case"logFormat":return v();case"redoclyEnv":return o();case"executionMode":return i();case"isProductionEnv":return o()==="production";case"isPreviewEnv":return o()==="preview";case"isReunite":{const e=o(),t=s();return e==="production"||e==="preview"||e==="development"&&!t}case"isBuildMode":return i()==="build";case"isDevelopMode":return i()==="develop";case"isRuntimeMode":return i()==="runtime";default:return n}}const a=new Set(["logFormat","redoclyEnv","executionMode","isProductionEnv","isPreviewEnv","isReunite","isBuildMode","isDevelopMode","isRuntimeMode"]),p=Object.freeze(new Proxy({},{get(n,e){if(typeof e!="string")return;const t=e;return a.has(t)?d(t):r()[e]}}));export{p as envConfig};
|
|
@@ -7,7 +7,7 @@ export declare const envSchema: z.ZodObject<{
|
|
|
7
7
|
CI: z.ZodOptional<z.ZodString>;
|
|
8
8
|
} & {
|
|
9
9
|
PORT: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
|
|
10
|
+
REDOCLY_LOG_FORMAT: z.ZodOptional<z.ZodString>;
|
|
11
11
|
REDOCLY_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
12
12
|
TERM: z.ZodOptional<z.ZodString>;
|
|
13
13
|
INSPECT_MODE: z.ZodOptional<z.ZodString>;
|
|
@@ -87,7 +87,7 @@ export declare const envSchema: z.ZodObject<{
|
|
|
87
87
|
CI: z.ZodOptional<z.ZodString>;
|
|
88
88
|
} & {
|
|
89
89
|
PORT: z.ZodOptional<z.ZodNumber>;
|
|
90
|
-
|
|
90
|
+
REDOCLY_LOG_FORMAT: z.ZodOptional<z.ZodString>;
|
|
91
91
|
REDOCLY_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
92
92
|
TERM: z.ZodOptional<z.ZodString>;
|
|
93
93
|
INSPECT_MODE: z.ZodOptional<z.ZodString>;
|
|
@@ -167,7 +167,7 @@ export declare const envSchema: z.ZodObject<{
|
|
|
167
167
|
CI: z.ZodOptional<z.ZodString>;
|
|
168
168
|
} & {
|
|
169
169
|
PORT: z.ZodOptional<z.ZodNumber>;
|
|
170
|
-
|
|
170
|
+
REDOCLY_LOG_FORMAT: z.ZodOptional<z.ZodString>;
|
|
171
171
|
REDOCLY_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
172
172
|
TERM: z.ZodOptional<z.ZodString>;
|
|
173
173
|
INSPECT_MODE: z.ZodOptional<z.ZodString>;
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const serverConfigSchema: z.ZodObject<{
|
|
6
6
|
PORT: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
|
|
7
|
+
REDOCLY_LOG_FORMAT: z.ZodOptional<z.ZodString>;
|
|
8
8
|
REDOCLY_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
9
9
|
TERM: z.ZodOptional<z.ZodString>;
|
|
10
10
|
INSPECT_MODE: z.ZodOptional<z.ZodString>;
|
|
@@ -19,7 +19,7 @@ export declare const serverConfigSchema: z.ZodObject<{
|
|
|
19
19
|
REDOCLY_METADATA_OUTPUT_FOLDER: z.ZodOptional<z.ZodString>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
21
|
PORT?: number | undefined;
|
|
22
|
-
|
|
22
|
+
REDOCLY_LOG_FORMAT?: string | undefined;
|
|
23
23
|
REDOCLY_LOG_LEVEL?: string | undefined;
|
|
24
24
|
TERM?: string | undefined;
|
|
25
25
|
INSPECT_MODE?: string | undefined;
|
|
@@ -34,7 +34,7 @@ export declare const serverConfigSchema: z.ZodObject<{
|
|
|
34
34
|
REDOCLY_METADATA_OUTPUT_FOLDER?: string | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
PORT?: number | undefined;
|
|
37
|
-
|
|
37
|
+
REDOCLY_LOG_FORMAT?: string | undefined;
|
|
38
38
|
REDOCLY_LOG_LEVEL?: string | undefined;
|
|
39
39
|
TERM?: string | undefined;
|
|
40
40
|
INSPECT_MODE?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as E}from"zod";const t=E.object({PORT:E.coerce.number().optional(),
|
|
1
|
+
import{z as E}from"zod";const t=E.object({PORT:E.coerce.number().optional(),REDOCLY_LOG_FORMAT:E.string().optional(),REDOCLY_LOG_LEVEL:E.string().optional(),TERM:E.string().optional(),INSPECT_MODE:E.string().optional(),REDOCLY_PREFIX_PATHS:E.string().optional(),REDOCLY_CONTENT_DIR:E.string().optional(),REDOCLY_PORTAL_VERSION:E.string().optional(),REDOCLY_TELEMETRY:E.string().optional(),REDOCLY_TELEMETRY_ENDPOINT:E.string().url().optional(),TELEMETRY_DEV_DEBUG:E.enum(["true","false"]).optional(),WEB_SERVER_IDLE_TIMEOUT:E.string().optional(),REDOCLY_PROBLEMS_OUTPUT_FILE:E.string().optional(),REDOCLY_METADATA_OUTPUT_FOLDER:E.string().optional()});export{t as serverConfigSchema};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as f}from"../tools/notifiers/reporter.js";import{envConfig as u}from"../config/env-config.js";import{telemetry as m}from"../../cli/telemetry/index.js";import{stopAllCompilers as
|
|
2
|
-
`),hasMatched:!1};const
|
|
3
|
-
`),{lineText:s}=
|
|
1
|
+
import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as f}from"../tools/notifiers/reporter.js";import{envConfig as u}from"../config/env-config.js";import{telemetry as m}from"../../cli/telemetry/index.js";import{stopAllCompilers as w}from"./esbuild.js";import{getCodeframe as x}from"../utils/codeframes/codeframes.js";import{shutdowner as y}from"../tools/shutdowner.js";class S extends Error{errors;warnings;constructor({errors:r=[],warnings:e=[]}){super(),this.errors=r,this.warnings=e}}async function T({errors:n,warnings:r}){const e=await d(n,"error"),s=await d(r,"warning");r.forEach((t,o)=>{c.warn(s[o])}),n.forEach((t,o)=>{const i=t.location?.file||"";i&&i.includes("node_modules/")?(c.error(e[o]),m.sendCliErrorCaughtMessage({message:JSON.stringify(t)})):(c.contentError(e[o]),m.sendCliErrorCaughtMessage({message:JSON.stringify(t),scope:"content"}))}),n.length&&u.isBuildMode&&(await w(),await y.exitWithCode(1))}async function d(n,r){switch(u.logFormat){case"JSON":return n.map(e=>JSON.stringify(e));default:return await E.formatMessages(n,{kind:r,color:!1,terminalWidth:0})}}function C(n,r){if(!r?.lineText)return{line:1,column:1,lines:n.split(`
|
|
2
|
+
`),hasMatched:!1};const e=n.split(`
|
|
3
|
+
`),{lineText:s}=r,t=i=>{const a=i.indexOf(s);return a===-1?null:a};if(r.line&&r.line<=e.length&&t(e[r.line-1]))return{line:r.line,column:r.column||1,lines:e,hasMatched:!0};const o=e.findIndex(i=>t(i)!==null);if(o>=0){const i=t(e[o]);return{line:o+1,column:(i??0)+1,lines:e,hasMatched:!0}}return{line:1,column:1,lines:e,hasMatched:!1}}function W(n,r,e,s){const{line:t,column:o,lines:i,hasMatched:a}=C(e,s),{frame:h,start:p}=x({start:{line:t,character:o},end:{line:t,character:o+(s?.lineText?.length||0)},lines:i},!0),g=`${n}::${r}::${t}`,l={message:n,sourceFileRelativePath:r,sourceFileLocation:p,codeframe:h,hasMatched:a};return f.getCompilationProblem(g)||f.reportCompilationError({type:"ERROR",severity:"ERROR",...l}),l}export{S as EsbuildError,T as esbuildLogger,W as reportEsbuildError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sha1 as
|
|
1
|
+
import{sha1 as I}from"../../utils/crypto/sha1.js";import{isValidSanitizedString as D}from"../../utils/validate-and-sanitize-string";import{CatalogEntitiesService as F}from"./database/catalog-entities-service.js";import{createPaginationParamsValidator as E}from"../../providers/database/pagination/schemas";import{parseSearch as R}from"../../providers/database/pagination/search";import{OPERATORS as w}from"../../providers/database/pagination/constants.js";import{CacheService as P}from"../../persistence/cache/services/cache-service.js";import{CATALOG_FILTERS_CACHE_NAMESPACE as A,CATALOG_FILTERS_CACHE_TTL_IN_SECONDS as N}from"../../constants/plugins/catalog-entities.js";import{isValidIsoDate as V}from"../../utils/is-valid-iso-date.js";import{expandTeamsForRead as _}from"../../utils";import{getNotAccessibleCatalogResources as L}from"./utils/get-not-accessible-catalog-resources.js";const st={all:"all",domains:"domain",services:"service",teams:"team",users:"user","api-descriptions":"api-description","data-schemas":"data-schema"},O={team:{field:"type",operator:"equal",value:"user"},"api-description":{field:"type",operator:"equal",value:"api-operation"}},M=async({entitiesTypes:e,serverOutDir:i,catalogConfig:s,queries:t={},rbacTeams:o,excludedTypes:p,excludedEntities:c})=>{const u=await F.getInstance({baseDbDir:i}),f=T.concat("domains","owners"),l=E(f).parse(t),n=s.excludes?.map(a=>a.key)??[],g=e.filter(a=>a!=="all"),m=j(g,n);return l.filter?l.filter={op:w.AND,conditions:[l.filter,m]}:l.filter=m,await u.getEntitiesWithRelations({paginationParams:{sort:[{field:"type",order:"ASC"},{field:"title",order:"ASC"}],limit:10,...l},rbacTeams:o,excludedTypes:p,excludedEntities:c})},k=async({entityKey:e,serverOutDir:i,queries:s,rbacTeams:t,excludedTypes:o,excludedEntities:p})=>{const c=await F.getInstance({baseDbDir:i});let u=null;const f=s?.revision;f&&V(f)&&(u=f);const l=s?.version;if(!D(l,{pattern:/^[a-zA-Z0-9._-]+$/,maxLength:100,allowEmpty:!0}))return null;const n=await c.getEntityWithRelationsByKey({entityKey:e,filter:{revision:u,version:l},rbacTeams:t,excludedTypes:o,excludedEntities:p});if(!n)return null;const g=n.type==="data-schema"?await c.getRelatedEntities({entityKey:e,paginationParams:{limit:1,filter:{field:"type",operator:"equal",value:"api-description"}}}).then(b=>b.items?.[0]??null):null,m=O[n.type]??void 0,d=B(m,l,u),y=E(T).parse(s),h=await c.getRelatedEntities({entityKey:e,paginationParams:{limit:10,sort:y.sort?.length?y.sort:[{field:"title",order:"ASC"}],filter:d,search:s?.search?R(s?.search,["key","type","title","summary"]):void 0},rbacTeams:t,excludedTypes:o,excludedEntities:p});return{status:"success",entity:n,relatedEntity:g,relations:h}},q=e=>{const i=JSON.stringify({entitiesTypes:e.entitiesTypes.sort(),filtersConfig:e.filtersConfig,rbacTeams:e.rbacTeams,excludedTypes:e.excludedTypes,excludedEntities:e.excludedEntities});return I(i)},x=async({serverOutDir:e,entitiesTypes:i,filtersConfig:s,rbacTeams:t,excludedTypes:o,excludedEntities:p})=>{if(!s||s.length===0)return{};const c=q({entitiesTypes:i,filtersConfig:s,rbacTeams:t,excludedTypes:o,excludedEntities:p}),u=await P.getInstance({baseDbDir:e}),f=await u.get({key:c,namespace:A});if(f)return f;const l=await F.getInstance({baseDbDir:e}),n=[],g=new Map;for(const a of s)!a.options||a.options.length===0?n.push(a.property):g.set(a.property,a.options);const m=await l.getCatalogFilters({entitiesTypes:i,emptyFilters:n,rbacTeams:t,excludedTypes:o,excludedEntities:p}),d={};for(const a of s){const y=g.get(a.property);if(!y){const r=m[a.property];d[a.property]=r&&r.length>0?r:[];continue}const b=(await l.getCatalogFilters({entitiesTypes:i,emptyFilters:[a.property],rbacTeams:t,excludedTypes:o,excludedEntities:p}))[a.property];if(!b){d[a.property]=[];continue}const S=new Map;for(const r of b){const C=r.value.toLowerCase().trim();S.set(C,{originalValue:r.value,count:r.count})}d[a.property]=y.map(r=>{const C=r.toLowerCase().trim(),v=S.get(C);return{value:v?.originalValue??r,count:v?.count??0}}).filter(r=>r.count>0).sort((r,C)=>r.value.localeCompare(C.value))}return await u.set({key:c,value:d,namespace:A,ttlInSeconds:N}),d},K=async(e,{props:i},{variables:s},{serverOutDir:t,getRouteSharedDataByFsPath:o,getConfig:p})=>{const c=i?.catalogConfig||{};if(!e.params||!i?.catalogConfig)return{status:"notFound"};const[u,f,l]=e.params;if(!u)return{status:"notFound"};const n=z(c,u),g=n?.includes?.map(C=>C.type)??[];if(!n||n.hide)return{status:"notFound"};const m=_(p().rbac||{},s?.rbac.teams||[]),{catalogs:d,types:a,entities:y}=L({rbacConfig:p().rbac||{},currentRbacTeams:s?.rbac.teams||[]});if(d.includes(u))return{status:"notFound"};if(!l&&f!=="entities"){const C=await x({entitiesTypes:g,serverOutDir:t,filtersConfig:n.filters,rbacTeams:m,excludedTypes:a,excludedEntities:y}),v=e.queries?.viewMode??"table";return{status:"success",catalogSwitcherItems:W(c,n,d),entitiesTypes:g,entities:await M({entitiesTypes:g,serverOutDir:t,catalogConfig:n,queries:e.queries,rbacTeams:m,excludedTypes:a,excludedEntities:y}),catalogConfig:n,filters:C,initialViewMode:v}}const h=await k({entityKey:l,serverOutDir:t,queries:e.queries,rbacTeams:m,excludedTypes:a,excludedEntities:y});if(!h)return{status:"notFound"};const b=h?.entity.sourceFile,S=h?.entity.type==="api-description",r=b&&S&&o(b)||{};return{status:"success",entity:h.entity,relatedEntity:h.relatedEntity,relations:h.relations,entitiesCatalogConfig:c,catalogConfig:n,sharedDataIds:r}},z=(e,i)=>Object.values(e.catalogs??{}).find(s=>s&&typeof s=="object"&&"slug"in s&&s.slug===i),W=(e,i,s)=>Object.values(e.catalogs??{}).filter(t=>!t?.hide&&!s.includes(t?.slug??"")).map(t=>({labelTranslationKey:t?.catalogSwitcherLabelTranslationKey??t?.slug??"",slug:t?.slug??"",selected:t?.slug===i.slug})).sort((t,o)=>t.slug.localeCompare(o.slug)),j=(e,i)=>({op:"AND",conditions:[...e.length?[{field:"type",operator:"in",value:e}]:[],...i.length?[{field:"key",operator:"in",value:i,modifier:"not"}]:[]]}),B=(e,i,s)=>{let t=e;if(i!==void 0){const o={field:"version",operator:"equal",value:i};t=t?{op:w.AND,conditions:[t,o]}:o}if(s){const o={field:"revision",operator:"equal",value:s};t=t?{op:w.AND,conditions:[t,o]}:o}return t},T=["type","key","title","summary","tags","metadata","metadata.*","git","contact","links","id","source","sourceFile","createdAt","updatedAt"];var it=K;export{it as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RbacScopeItems } from '@redocly/config';
|
|
2
2
|
import type { FrontmatterKeywords } from '../../../types/index.js';
|
|
3
3
|
import type { AstToSearchNodeTransformer } from './walk-sections.js';
|
|
4
4
|
import { MdSearchDocument } from './md-search-document.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SEARCH_DOCUMENT_METADATA_KEY as
|
|
2
|
-
`," "],
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{SEARCH_DOCUMENT_METADATA_KEY as g}from"../../../constants/plugins/search.js";import{slugger as x}from"../../../../utils/slugger.js";import{TagNode as M}from"./nodes/tag-node.js";import{TextNode as U}from"./nodes/text-node.js";import{MdSearchDocument as D}from"./md-search-document.js";import{HeadingNode as N}from"./nodes/heading-node.js";const C=Symbol();function H(r,e){if(!r)return e;if(!e)return r;const d=[" ",`
|
|
2
|
+
`," "],u=d.some(o=>r.endsWith(o)),s=d.some(o=>e.startsWith(o));return r+(!u&&!s?" ":"")+e}function Y(r,e,d,u,s,a={},o){const h=new Map(Array.from({length:6},(t,c)=>[c,""])),i=new Map;let S=null,_=0;u=u??{},x.reset();for(const t of r.transform()){const c=t.getUrl(e),f={...u};for(const n of t.rbacTeams??[])f[n.toLowerCase()]="read";if(t instanceof U){const n=t.parentNode?.id,m=n?`${c}#${n}`:C,A=i.get(m),l=A??new D(d,e,[],a,f,s),E=Object.keys(l[$]??{});if(A&&t.rbacTeams&&t.rbacTeams.length>0&&(E.length===0||!E.every(p=>(t.rbacTeams||[]).includes(p)))){const p=new D(A?.title??d,c,t.getPath(h),a,f,s);p.text=t.content,i.set(`${c}#rbac-text-${_++}`,p)}else l.text=H(l.text,t.content),l.facets=a,i.set(m,l);continue}if(t instanceof M){const n=`${c}#${t.id}`,m=new D(t.content,t.getUrl(e),t.getPath(h),a,f,s);i.set(n,m);continue}if(t instanceof N){h.set(t.attributes.level,t.content);const n=new D(t.content,t.getUrl(e),t.getPath(h),a,f,s),m=`${c}#${t.id}`;i.set(m,n),S===null&&(S=n)}}const T=Array.from(i.values()),b=S??T[0];if(b&&o?.includes&&(b[g].curated=!0,b[g].includes=o.includes),o?.excludes)for(const t of T)t[g].curated=!0,t[g].excludes=o.excludes;return T}export{Y as getSearchDocuments};
|
|
@@ -4,7 +4,7 @@ export type SectionNodeParams = {
|
|
|
4
4
|
node: Node;
|
|
5
5
|
content: string;
|
|
6
6
|
parentNode: SearchParentNode;
|
|
7
|
-
|
|
7
|
+
rbacTeams?: string[];
|
|
8
8
|
};
|
|
9
9
|
export declare class SectionNode {
|
|
10
10
|
#private;
|
|
@@ -14,7 +14,7 @@ export declare class SectionNode {
|
|
|
14
14
|
get node(): Node;
|
|
15
15
|
get id(): string | number;
|
|
16
16
|
get parentNode(): SearchParentNode;
|
|
17
|
-
get
|
|
17
|
+
get rbacTeams(): string[] | undefined;
|
|
18
18
|
}
|
|
19
19
|
type Constructor<T = any> = new (...args: any[]) => T;
|
|
20
20
|
export declare function WithCounterId<TBase extends Constructor>(Base: TBase): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getInnerText as o}from"../../../../../markdoc/helpers/get-inner-text.js";import{slugger as c}from"../../../../../utils/slugger.js";class a{#t;#e;#r;#n;constructor(t){const{node:r,content:n,
|
|
1
|
+
import{getInnerText as o}from"../../../../../markdoc/helpers/get-inner-text.js";import{slugger as c}from"../../../../../utils/slugger.js";class a{#t;#e;#r;#n;constructor(t){const{node:r,content:n,rbacTeams:s,parentNode:i}=t;this.#t=r,this.#e=n,this.#r=i,this.#n=s}get attributes(){return this.#t.attributes}get content(){return this.#e}get node(){return this.#t}get id(){throw new Error("SectionNode needs an id mixin applied")}get parentNode(){return this.#r}get rbacTeams(){return this.#n}}function h(e){let t=0;return class extends e{#t=++t;get id(){return this.#t}}}function g(e){return class extends e{#t;constructor(...t){super(...t);const r=this;this.#t=c.slug(o(r.node.children),{replaceDots:!0,replaceSlashes:!0})}get id(){return this.#t}}}export{a as SectionNode,h as WithCounterId,g as WithSlugId};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as a}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as u}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as y}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as h}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as N}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as e}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as T,TagNode as n}from"./nodes/tag-node.js";import{HeadingNode as p}from"./nodes/heading-node.js";class C{#t;#o;#i;#s;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s}){if(this.#t=i,this.#o=t,this.#i=r,this.#s=s,!this.#t||!f(this.#t))throw new Error("ast is not a valid Markdoc Node.")}*transform(){yield*this.#
|
|
1
|
+
import{logger as a}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as u}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as y}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as h}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as N}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as e}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as T,TagNode as n}from"./nodes/tag-node.js";import{HeadingNode as p}from"./nodes/heading-node.js";class C{#t;#o;#i;#s;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s}){if(this.#t=i,this.#o=t,this.#i=r,this.#s=s,!this.#t||!f(this.#t))throw new Error("ast is not a valid Markdoc Node.")}*transform(){yield*this.#c(this.#t,{parentNode:null})}*#c(i,t,r=this.#s){if(!(!i||!f(i))){if(u(i)){if(this.#i)return;const s=N(i);s&&s.length>0&&(yield*this.#r(i,{...t,rbacTeams:s},r));return}if(y(i)){yield new e({node:i,content:r([i],{skipConditionals:this.#i}),...t});return}if(i.type==="heading"){yield new p({node:i,content:r([i],{skipConditionals:this.#i}),rbacTeams:t?.rbacTeams});return}if(i.type==="tag"){yield*this.#l(i,t,r);return}yield*this.#r(i,t,r)}}*#l(i,t,r=this.#s){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#c(this.#o[s],t,(c,l)=>r(c,{...l,variables:o}));return}a.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#r(i,t,r);return}case"markdoc-example":{const s=r([i],{skipConditionals:this.#i});yield new e({node:i,content:s,...t});return}case"code-snippet":{const s=h(i,"title"),o=r([i],{skipConditionals:this.#i});if(s){const c=new n({node:i,content:s,...t});t={...t,parentNode:c},yield c}o&&(yield new e({node:i,content:o,...t}));return}default:{const s=T.find(l=>l in i.attributes),o=(s&&h(i,s))??"",c=typeof o=="string"?o:r([o]);if(c){const l=new n({node:i,content:c,...t});t={...t,parentNode:l},yield l}yield*this.#r(i,t,r);return}}}*#r(i,t,r=this.#s){for(const s of[...Object.values(i.slots),...i.children])for(const o of this.#c(s,t,r))o instanceof p&&(t={...t,parentNode:o}),yield o}}export{C as AstToSearchNodeTransformer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as y from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";import{combineUrls as u}from"@redocly/theme/core/utils";import{SEARCH_DOCUMENT_METADATA_KEY as x}from"../../constants/plugins/search.js";import{removeMarkdownLinks as c,stripFormatting as a}from"./utils.js";import{normalizeFrontmatterKeywords as k}from"../helpers/normalize-frontmatter-keywords.js";const h=y.default||y;class q{#n=[];#r;#s;#e;#i;constructor(e,t,n){this.#r=e,this.#s=t,this.#e=n}addItem(e){const{result:t}=k(e.keywords||e.operationDefinition?.keywords);t?.excludes&&e.type==="section"&&e.id===""&&(this.#i=t.excludes);try{let n;switch(e.type){case"tag":n=this.#c(e);break;case"operation":const o=this.getOperation(e);n=this.#d(o,e[d]);break;case"section":n=this.#p(e);break;case"rsrc":case"prompt":case"tool":n=this.#o(e);break}if(!n)return;const s=[...new Set([...t?.excludes?t.excludes:[],...this.#i?this.#i:[]])];return(t||s.length)&&(n[x]={curated:!0,...t,excludes:s}),this.#n.push(n),n}catch(n){console.error("Cannot add item to search indexer",n.message)}}addInfo(e,t){const n=this.#e,s={id:n,url:n,text:a(c(e.description||"")),title:a(`${e.title} (${e.version})`),metadata:t};return this.#n.push(s),s}#o(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:e.name}}getResult(){return this.#n}getOperation(e){return h.getOperation(this.#r,e.operationDefinition,e.parent,{...this.#s,internal_skipSamples:!0},e.href)}#a(e){return[...e.path||[],e.name.toString()].join(".")+e.description+e.place}#d(e,t){if(e.type!=="operation")return;let n={};for(let i of e.parameters){if(i[d])continue;const r=i.schema?.example||i.example,p={name:i.name,description:a(c(i.description)),place:i.in+" parameters",mediaType:void 0,type:i.schema?.type.toString()||"unknown",deepLink:h.generateDeepLink(i),[d]:i[d],required:i.required,example:r?JSON.stringify(r):void 0,enum:i.schema?.enum?.length?i.schema.enum:void 0};n[this.#a(p)]=p}const s=new Set;this.#t(n,e.requestBody?.content?.mediaTypes[0]?.schema,e.requestBody?.content?.mediaTypes[0]?.name,"request fields",!1,[],s);for(let i of e.responses){const r=`response ${i.code} fields`;this.#t(n,i.content?.mediaTypes[0]?.schema,i.content?.mediaTypes[0]?.name,r,!0,[],s)}let o=u(this.#e,e.href);return{id:o,url:o,title:a(e.name),text:a(c(e.description||"")),httpMethod:e.httpVerb,httpPath:e.path,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation,security:e.security.map(i=>i.schemes.map(r=>r.id)).flat().filter(Boolean),parameters:Object.values(n),badges:e.badges.length?e.badges:void 0,[d]:t}}#t(e,t,n,s,o,l=[],i=new Set){if(!(!t||t.isCircular)){if(t.pointer){if(i.has(t.pointer))return;i.add(t.pointer)}if(t?.fields)for(let r of t.fields){if(t[d]||r.kind==="additionalProperties"||r.schema?.readOnly&&!o||r.schema?.writeOnly&&o)continue;const p=r.schema?.example||r.example,m=r.schema?.enum,f={name:r.name,description:a(r.description),place:s,mediaType:n,path:l,deepLink:h.generateDeepLink(r),type:r.schema?.type.toString()||"unknown",required:r.required||t.schema.required?.includes(r.name)||!1,example:p?JSON.stringify(p):void 0,enum:m?.length?m:void 0},g=this.#a(f);e[g]==null&&(e[g]=f,this.#t(e,r.schema,n,s,o,l.concat([r.name]),i))}t?.items&&this.#t(e,t.items,n,s,o,l,i)}}#c(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}#p(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}}export{q as SearchIndexer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import w from"picomatch";import{removeLeadingSlash as S}from"@redocly/theme/core/utils";import{parsePathVersions as O}from"../../../utils/path/parse-path-versions.js";import{logger as
|
|
2
|
-
- ${
|
|
3
|
-
- `)}`;
|
|
4
|
-
... and ${
|
|
1
|
+
import w from"node:path";import R from"picomatch";import{removeLeadingSlash as S}from"@redocly/theme/core/utils";import{parsePathVersions as O}from"../../../utils/path/parse-path-versions.js";import{logger as l}from"../../tools/notifiers/logger.js";import{ScorecardStatus as g}from"./types.js";import{getTarget as L}from"./loaders/scorecard.js";const P=15;async function $({actions:t,context:e,scorecardConfig:a,reuniteConfig:n}){l.info("Computing scorecard...");const i=a.levels||[],o=i[0],m=await t.loadOpenApiDefinitions(e),s=a.ignore||[],d=R(s),f=new Set,h=l.startTiming(),c={},p={};for(const r of m){if(!M(r,d,f))continue;const v=r.customOutputRelativeFile||r.realRelativePath;f.add(v);const u=await T(r,e,a,i,o);c[r.realRelativePath]=u,p[u.relativePath]=u}return l.infoTime(h,"Scorecard processed"),N(c,n,a),p}function M(t,e,a){if(t.isVirtual||!t.definition)return!1;const n=t.customOutputRelativeFile||t.realRelativePath,i=S(t.realRelativePath);return e(i)?(l.info(`Skipping scorecard calculation for ignored file: ${t.realRelativePath}`),!1):!a.has(n)}function D(t,e,a){return t-1<e?g.BelowMinimum:e<a-1?g.Minimum:g.Highest}async function T(t,e,a,n,i){let o=i.name;if(a.targets?.length){const r=await e.getConfig(w.posix.dirname(t.realRelativePath)),v=t.definition.info?.["x-metadata"]||{},u={title:t.definition.info?.title,version:t.definition.info?.version,...v,...r.metadata};o=await B(a,u)||i.name}const{data:{levels:m,scorecardLevelIdx:s,scorecardLevel:d}}=await e.cache.load(t.realRelativePath,"scorecard"),f=n.findIndex(r=>r.name===o),h=D(s,f,n.length),c=t.customOutputRelativeFile||t.realRelativePath,p=O(c)?.versionName;return{levels:m,status:h,targetLevel:o,scorecardLevel:d,scorecardLevelIdx:s,relativePath:c,title:t.definition.info?.title,version:p}}function N(t,e,a){const n=Object.values(t).filter(s=>s.status===g.BelowMinimum);if(n.length===0)return;const i=n.map(s=>s.relativePath);let o=`Detected OpenAPI definitions with score below minimum level:
|
|
2
|
+
- ${i.slice(0,P).map(()=>"%rp").join(`
|
|
3
|
+
- `)}`;i.length>P&&(o+=`
|
|
4
|
+
... and ${i.length-P} more`),e?.ignoreLint??a.ignoreNonCompliant?l.warn(o,...i):l.error(o,...i)}async function B(t,e){return(await L(t.targets,e))?.minimumLevel}export{$ as computeScorecard};
|
|
@@ -2,6 +2,6 @@ import type { LifecyclePluginInstance, PluginOptions } from '../../types';
|
|
|
2
2
|
import type { ResolvedNavItem } from '@redocly/config';
|
|
3
3
|
import type { ContentFs } from '../../fs/content-fs.js';
|
|
4
4
|
export declare function sidebarsPlugin({ contentDir, }: PluginOptions): Promise<LifecyclePluginInstance>;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function stripMarkdocFromDescriptions(items: ResolvedNavItem[]): void;
|
|
6
6
|
export declare function resolveSidebarId(relativePath: string, sidebarPath: string, fs: ContentFs): Promise<string | null>;
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{writeFileSync as tt}from"node:fs";import*as
|
|
1
|
+
import{writeFileSync as tt}from"node:fs";import*as d from"path";import{removeMarkdocTags as et}from"../../../markdoc/helpers/remove-markdoc-tags.js";import{withoutHash as ot}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as v,SIDEBAR_PREFIX as at,CONFIG_FILE_NAME as V}from"../../../constants/common.js";import{CATALOG_OUTPUT_FILE_NAME as rt}from"../../constants/common.js";import{findDeepFirst as M}from"../../../utils/tree/find-deep-first.js";import{isDefined as X}from"../../../utils/guards/is-defined.js";import{partition as it}from"../../../utils/array/partition.js";import{collectPropValueDeep as N}from"../../../utils/tree/collect-prop-value-deep.js";import{envConfig as st}from"../../config/env-config.js";import{isLocalLink as nt}from"../../../utils/path/is-local-link.js";import{normalizeRouteSlug as Y}from"../../../utils/path/normalize-route-slug.js";import{slash as lt}from"../../../utils/path/slash.js";import{parsePathVersions as ct}from"../../../utils/path/parse-path-versions.js";import{reporter as k}from"../../tools/notifiers/reporter.js";import{logger as B}from"../../tools/notifiers/logger.js";import{sha1 as ft}from"../../utils/crypto/sha1.js";import{collectItemsLinkedToSidebars as dt,resolveItems as J}from"../nav-utils.js";import{getExcludedFromLinkCheckerPatterns as ut,getSidebarReferences as mt,hasCircularDependency as gt}from"./utils.js";import{getLocaleFromRelativePath as pt}from"../../fs/utils/get-locale-from-relative-path.js";import{isSystemRouteSlug as ht}from"../../utils/system-routes.js";import{ENTITIES_MAP_GLOBAL_DATA_KEY as St}from"../../constants/plugins/catalog-entities.js";import{telemetryTraceStep as yt}from"../../../cli/telemetry/helpers/trace-step.js";import{isPathIgnored as Ft}from"../../utils/paths.js";const It=180,bt=170,Dt=10;async function Jt({contentDir:c}){return{id:"sidebars",async afterRoutesCreated(o,i){await yt("build.plugin.sidebars",async()=>{const{cache:p,fs:f}=i,b=o.getConfig(),D=new Map,C=new Set,x=[v,...f.localeFolders],j=o.getGlobalData()[St]||{},G=new Map;let R=f.scan(/sidebars.yaml$/).map(({relativePath:t})=>t).filter(t=>!Ft(t,b.ignore??[])&&t);const $=await mt(i,c,R),Q=it(R.filter(t=>!$.has(t)),t=>ct(t)?.versionFolderPath||t),_=ut(b),Z=await dt(b?.navbar,o,i,{navFile:V,excludedFromLinkCheckerPatterns:_});let P;const T=gt($);T&&Array.isArray(T)&&await k.panicOnBuildContentError(`Sidebar references have circular dependency. Please check your sidebar files.
|
|
2
2
|
Circular dependency chain: ${T.reverse().join(" -> ")}
|
|
3
|
-
`);for(const t of Q){const
|
|
3
|
+
`);for(const t of Q){const u=(await Promise.all(t.map(async s=>{const e=(await p.load(s,"yaml")).data;if(!Array.isArray(e)){await k.panicOnBuildContentErrorForRealFile('Invalid sidebar contents at %rp, items should be an array, got "%s"',s,f,s,typeof e);return}return{items:e,sidebarRelativePath:s,locale:pt(s)}}))).filter(X),r=(await A(u))?.firstLink;P||(P=r)}const H=Object.entries(b?.catalogClassic??{});for(const t of x){for(const[e,l]of H)await z(e,l,t);const u={},r=new Set,s=o.getAllRoutesForLocale(t);for(const e of s)if(W(e)&&e.fsPath&&!r.has(e.fsPath)){r.add(e.fsPath);let n=d.posix.dirname(e.fsPath);const h=d.parse(n).root;do u[n]=(u[n]||0)+1,n=d.dirname(n);while(n&&n!="."&&h!=n)}for(const e of s){if(D.has(e.slug))continue;const l=W(e),n=d.dirname(e.fsPath),h=u[n]===1,m=Et(e.baseSlug||e.slug);l&&h?await A([{items:[{directory:n}],sidebarRelativePath:"sidebar.yaml_"+m,locale:t}]):e.getSidebar!==void 0&&await A([{items:[{page:e.fsPath}],sidebarRelativePath:"sidebar.yaml_"+m,locale:t}])}for(const[e,l]of H)await z(e,l,t,!0)}if(R.length===0)for(const t of x){B.verbose("Creating default sidebar");const u=t===v,r=`sidebars.yaml${u?"":"_"+t}`,s=u?"":`${f.localizationFolder}/${t}`,e=(await A([{items:[{directory:`./${s}`}],sidebarRelativePath:r,locale:t,ignoredRoutes:C}]))?.firstLink;P||(P=e)}if(!o.getRouteBySlug("/")&&!o.getConfig().redirects?.["/"]){const u=o.getAllRoutes().find(s=>!ht(s.slug)),r=P?P.link:u?.baseSlug??null;if(r){const s=ot(r);o.addRedirect("/",{to:s,type:302}),B.info("Creating default redirect for index page => %s",s)}}const U=st.REDOCLY_METADATA_OUTPUT_FOLDER;U&&(B.info("Writing catalog data..."),tt(d.join(U,rt),JSON.stringify(Object.fromEntries(G.entries()))));function W(t){return C.has(t.slug)||j[t.fsPath]}async function A(t){if(t.length===0)return;const r=(await Promise.all(t.map(async({items:m,locale:I,sidebarRelativePath:g,ignoredRoutes:L})=>{const a=await J(m,d.dirname(d.join(c,g)),o,i,{locale:I,ignoredRoutes:L,navFile:g,excludedFromLinkCheckerPatterns:_});if(!a){await k.panicOnBuild("Failed to resolve sidebar configuration. Make sure %rp is valid",g);return}return a}))).flat().filter(X),s=N(r,"routeSlug"),e=t[0].sidebarRelativePath,l=q(e),n=new Set;for(const m of s){const I=o.getRouteBySlug(m)?.fsPath??"",g=j[I];g&&(Array.from(n).find(a=>a.key===g.key&&a.version===g.version)||n.add(g)),o.addRouteSharedData(m,"sidebar",l),D.set(Y(m),r)}const h=n.size===1?Array.from(n)[0]:void 0;return await o.createSharedData(l,{relatedNavbarItem:Z?.get(e),items:r,catalogEntity:h?{key:h.key,version:h.version}:void 0}),{firstLink:M(r,m=>!!m.link),resolved:r}}async function z(t,u,r,s=!1){const e=structuredClone(u);r&&r!==v&&e.items.forEach(a=>{a.directory=d.posix.join(f.localizationFolder||"",r,a.directory||"")});let l=await J(e.items,c,o,i,{groupCustomSidebars:!0,locale:r,navFile:V,excludedFromLinkCheckerPatterns:_});if(!l){await k.panicOnBuild(`Failed to resolve catalog configuration. Make sure catalog ${t} has valid config`);return}Pt(l);const n=r===v?"":"/"+r.toLowerCase(),h=r===v?"":`-${r}`,m=Y(d.posix.join(n,e.slug));if(s)for(const a of l){const S=M(a.items||[],F=>!!F.routeSlug);if(!S?.routeSlug)continue;const y=D.get(S.routeSlug);if(!y)continue;const O=N(y,"routeSlug"),w="current-catalog-info-"+a.routeSlug+h,E={catalog:{label:e.title,titleTranslationKey:e.titleTranslationKey,link:m,icon:e?.icon},item:{label:a.metadata?.title,link:a.link,icon:a.icon}};await o.createSharedData(w,E);for(const F of O)o.addRouteSharedData(F,"current-catalog-info",w),C.add(F);const K=M(y,F=>!!F.link&&!F.external&&nt(F.link)&&(!a.version||F.version===a.version));K&&(a.sidebar=[{...K,items:void 0}])}const I={},g=new Set;for(const a of l){if(!(a.routeSlug||a.sidebar?.[0]?.routeSlug)||!a.fsPath||g.has(a.fsPath))continue;g.add(a.fsPath);const y=d.dirname(a.fsPath);I[y]=(I[y]||0)+1}if(s){const a=await o.createSharedData("catalog-"+t+h,l.flatMap(S=>{const y=d.dirname(S.fsPath??""),O=I[y]===1,w=E=>({...E,fsPath:O?y:E.fsPath??""});return S.type==="group"&&S.items?.every(E=>E.type==="group")?(S.items||[]).map(w):w(S)}));o.addRouteSharedData(m,"catalog",a),Ct(r,l,G,I)}const L=N(l,"routeSlug");for(const a of L)C.add(a)}})}}}function Ct(c,o,i,p){if(c===v)for(const f of o){const b=f.routeSlug||f.sidebar?.[0]?.routeSlug;if(!b||!f.fsPath)continue;const D=d.dirname(f.fsPath),C=p[D]===1;i.set(b,{rootFileFsPath:f.fsPath,fsPath:C?D:f.fsPath,metadata:f.metadata||{},title:f.metadata?.title||f.label||"Untitled",version:f.version||"latest"})}}function Pt(c){const o=i=>{typeof i.metadata?.description=="string"&&(i.metadata={...i.metadata,description:et(i.metadata.description)})};for(const i of c)if(i.routeSlug)o(i);else for(const p of i.items||[])o(p)}function q(c){return at+lt(c)}async function qt(c,o,i){const p=d.posix.join(d.dirname(c),o);return await i.exists(p)?q(p):(await k.panicOnBuildContentErrorForRealFile("File %rp: Failed to create relative path for sidebars.yaml using %s",c,i,c,o),null)}function Et(c){const o=c.replaceAll("/","_");if(o.length>It){const i=o.slice(0,bt),p=ft(c).slice(0,Dt).replaceAll("/","_");return i+p}else return o}export{qt as resolveSidebarId,Jt as sidebarsPlugin,Pt as stripMarkdocFromDescriptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{and as
|
|
1
|
+
import{and as g,eq as v,gt as c,lt as a,or as b,sql as p}from"drizzle-orm";import{decodeCursor as q}from"./utils/decode-cursor.js";const G=e=>{if(e===null||typeof e!="object")return!1;const r=e;return typeof r.value=="string"&&typeof r.id=="string"},M=e=>{if(e===null||typeof e!="object")return!1;const r=e;return Array.isArray(r.values)&&r.values.every(f=>typeof f=="string")&&typeof r.id=="string"};function k(e,r,f){if(e.length!==r.length)return p`0`;const h=[];for(let t=0;t<e.length;t++){const C=p.identifier(e[t].field),y=r[t],m=e[t].order==="ASC",d=f==="after"&&m||f==="before"&&!m?c(C,y):a(C,y);if(t===0)h.push(d);else{const o=e.slice(0,t).map((i,S)=>v(p.identifier(i.field),r[S]));h.push(g(g(...o),d))}}return b(...h)}const N=(e,r)=>{const{after:f,before:h}=r;if(!f&&!h)return{sqlBuilder:e,whereCondition:null};const t=q(f),C=q(h),y=t!=null,m=C!=null&&!y,l=r.sort&&r.sort.length>0?r.sort:[{field:"id",order:"ASC"}],d=l[0],o=p.identifier(d.field),i=p.identifier("id");let S=null;function j(B,A){if(!B)return null;try{const n=JSON.parse(B);if(M(n)){const F=l[l.length-1]?.field==="id",I=n.id!=null,w=l.length===n.values.length+1&&F&&I,T=!F&&I&&l.length===n.values.length,x=T?[...l,{field:"id",order:l[0]?.order??"ASC"}]:l,E=w||T?[...n.values,n.id]:n.values;return k(x,E,A)}if(!G(n))return null;const s=String(n.value),u=String(n.id);return d.field==="id"?d.order==="ASC"?A==="after"?c(i,u):a(i,u):A==="after"?a(i,u):c(i,u):d.order==="ASC"?A==="after"?b(c(o,s),g(v(o,s),c(i,u))):b(a(o,s),g(v(o,s),a(i,u))):A==="after"?b(a(o,s),g(v(o,s),a(i,u))):b(c(o,s),g(v(o,s),c(i,u)))}catch{return null}}return y?S=j(t,"after"):m&&(S=j(C,"before")),{sqlBuilder:e,whereCondition:S}};export{N as applyAfterAndBefore};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import type { SortOption } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a cursor from an entity and the full sort definition.
|
|
4
|
+
* Encodes all sort field values so that "after" pagination is correct for multi-column sort
|
|
5
|
+
* (e.g. sort by type, title, id). Single-field sort still uses { value, id } for backward compat.
|
|
6
|
+
*/
|
|
1
7
|
export declare function createCursor<T extends {
|
|
2
8
|
id: string;
|
|
3
|
-
}>(entity: T,
|
|
9
|
+
}>(entity: T, sortOptions: SortOption[], nameTransformationsFromDatabase?: Record<string, string>): string;
|
|
4
10
|
//# sourceMappingURL=create-cursor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import{transformToCamelCase as d}from"./transform-to-camel-case.js";function c(r,t){return t?.[r]??d(r)}function S(r,t,u){if(!t.length){const n={value:String(r.id),id:String(r.id)};return Buffer.from(JSON.stringify(n)).toString("base64")}const i=t.map(n=>{const o=c(n.field,u),s=r[o];if(s===void 0&&n.field!=="id")throw new Error(`Cursor field '${n.field}' (key: ${String(o)}) not found in entity`);return String(s??r.id)}),e=r.id;if(e==null)return Buffer.from(JSON.stringify({values:i})).toString("base64");const f=String(e);if(i.length===1){const n={value:i[0],id:f};return Buffer.from(JSON.stringify(n)).toString("base64")}const g={values:i,id:f};return Buffer.from(JSON.stringify(g)).toString("base64")}export{S as createCursor};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
`},
|
|
3
|
-
`},
|
|
1
|
+
import*as O from"node:path";import{envConfig as S}from"../../config/env-config.js";import{maskEmail as E}from"./helpers/privacy/mask-email.js";import{maskSubject as T}from"./helpers/privacy/mask-subject.js";import{removePii as C}from"./helpers/privacy/remove-pii.js";import{removePiiFromUrl as $}from"./helpers/privacy/remove-pii-from-url.js";import{red as x,green as A,bold as j,blue as p,gray as i,yellow as P,cyan as w}from"./helpers/colors.js";var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const b={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function _(e,s){return b[e]>=b[s]}function z(e){if(!e)return;const s=e.toUpperCase();if(s in n)return s}const F={[n.INFO]:p,[n.SUCCESS]:A,[n.WARN]:P,[n.ERROR]:x,[n.HTTP]:w,[n.VERBOSE]:i},I={"%ap":e=>p(O.resolve(e)),"%rp":e=>p(O.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>p(e)},v={format(e){switch(S.logFormat){case"JSON":return U(e);default:return H(e)}},interpolate(e,...s){const a=Object.keys(I).map(t=>`(${t})`).join("|"),m=new RegExp(a,"g");let o,u=e;for(;(o=m.exec(e))!==null;){o.index===m.lastIndex&&m.lastIndex++;const t=s.shift();if(t===void 0)break;const r=o[0];u=u.replace(r,I[r](t))}return u}};var G=v;const H=e=>{const{level:s,message:a,duration:m,context:o}=e,u=S.isRuntimeMode,t=[F[s](j(`[${s.toLowerCase()}]`))];if(u&&t.push(i(`time="${N()}"`)),o){const{email:r,ipAddress:f,subject:l,method:d,pathname:c,statusCode:R,teams:h,apiFunction:g}=o;g&&t.push(p(`fn="${g}"`)),R&&t.push(y(R)),e.level===n.HTTP&&(d&&t.push(i(`method="${d}"`)),c&&t.push(i(`path="${$(c)}"`))),f&&t.push(i(`ip="${f}"`)),r&&t.push(i(`email="${E(r)}"`)),l&&t.push(i(`sub="${T(l)}"`)),h?.length&&t.push(i(`teams="${h.join(", ")}"`))}if(a){const r=u?`msg="${String(C(a)).replaceAll?.('"','\\"')}"`:String(a);t.push(r)}return e.level===n.HTTP&&o?.userAgent&&t.push(i(`agent="${o.userAgent}"`)),m&&t.push(M(m)),t.join(" ")+`
|
|
2
|
+
`},U=({context:e,message:s,...a})=>{const{method:m,pathname:o,statusCode:u,userAgent:t,subject:r,email:f,teams:l,apiFunction:d}=e||{},c={...a,email:f&&E(f),subject:r&&T(r),teams:l,apiFunction:d,...a.level===n.HTTP?{method:m,pathname:String($(o)),statusCode:u,userAgent:t}:{message:String(C(s))}};return S.isRuntimeMode&&(c.time=N()),JSON.stringify(c,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
|
|
3
|
+
`},y=e=>(e%500<100?x:e%400<100?P:A)(`status="${e}"`),N=()=>{let e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},M=e=>i(`dur="${Math.round(e)}ms"`);export{n as LogLevel,G as default,z as parseLogLevel,_ as shouldLog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createColors as e}from"colorette";import{envConfig as l}from"../../../config/env-config.js";const r=l.
|
|
1
|
+
import{createColors as e}from"colorette";import{envConfig as l}from"../../../config/env-config.js";const r=l.logFormat!=="JSON",{red:s,green:t,bold:c,blue:n,gray:a,yellow:g,cyan:m}=e({useColor:r}),d=o=>typeof o=="string"?o.replace(/\x1B[[(?);]{0,2}(;?\d)*./g,""):o;export{n as blue,c as bold,r as colorsAreEnabled,m as cyan,a as gray,t as green,s as red,d as stripColors,g as yellow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createCursor as l}from"../../providers/database/pagination/utils/create-cursor.js";import{
|
|
1
|
+
import{createCursor as l}from"../../providers/database/pagination/utils/create-cursor.js";import{DEFAULT_LIMIT as o}from"../../providers/database/pagination/limit.js";function c(e){return!!(e.after||e.before)}function g(e,i,r){const n=c(i),t=i.limit??o;if(n){if(i.before)return!0;if(i.after)return e.length===t}return r!==void 0&&i.skip!==void 0?i.skip+t<r:r!==void 0?t<r:e.length===t}function h(e){return!!(e.after||e.before||e.skip!==void 0&&e.skip>0)}function d({data:e,params:i,totalCount:r,nameTransformationsFromDatabase:n={},hasMore:t}){if(!e.length)return{object:"list",items:[],page:{total:0,limit:i.limit??o,hasNextPage:!1,hasPrevPage:!1,startCursor:null,endCursor:null}};const f=i.sort?.length?i.sort:[{field:"id",order:"ASC"}],s=t??g(e,i,r),u=h(i);return{object:"list",items:e,page:{total:r??0,limit:i.limit??o,hasNextPage:s,hasPrevPage:u,startCursor:l(e[0],f,n),endCursor:l(e[e.length-1],f,n)}}}export{d as prepareListResponse};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/redoc-reef",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0-next.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"reactjs-popup": "2.0.6",
|
|
78
78
|
"semver": "7.7.3",
|
|
79
79
|
"shiki": "3.21.0",
|
|
80
|
-
"simple-git": "3.
|
|
80
|
+
"simple-git": "3.32.3",
|
|
81
81
|
"sitemap": "7.1.1",
|
|
82
82
|
"stream-http": "3.2.0",
|
|
83
83
|
"styled-components": "5.3.11",
|
|
@@ -91,14 +91,14 @@
|
|
|
91
91
|
"xpath": "0.0.34",
|
|
92
92
|
"yaml-ast-parser": "0.0.43",
|
|
93
93
|
"zod": "^3.25.76",
|
|
94
|
-
"@redocly/
|
|
95
|
-
"@redocly/theme": "0.63.0",
|
|
96
|
-
"@redocly/portal-plugin-mock-server": "0.16.0",
|
|
97
|
-
"@redocly/asyncapi-docs": "1.8.0",
|
|
98
|
-
"@redocly/portal-legacy-ui": "0.14.0",
|
|
99
|
-
"@redocly/graphql-docs": "1.8.0",
|
|
94
|
+
"@redocly/asyncapi-docs": "1.9.0-next.0",
|
|
100
95
|
"@redocly/config": "0.44.1",
|
|
101
|
-
"@redocly/
|
|
96
|
+
"@redocly/graphql-docs": "1.9.0-next.0",
|
|
97
|
+
"@redocly/openapi-docs": "3.20.0-next.0",
|
|
98
|
+
"@redocly/portal-legacy-ui": "0.15.0-next.0",
|
|
99
|
+
"@redocly/portal-plugin-mock-server": "0.17.0-next.0",
|
|
100
|
+
"@redocly/realm-asyncapi-sdk": "0.10.0-next.0",
|
|
101
|
+
"@redocly/theme": "0.64.0-next.0"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
104
|
"react": "^19.2.4",
|