@redocly/api-docs 0.2.0-next.5 → 0.2.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/RedocStandalone.d.ts +38 -0
- package/lib/RedocStandalone.js +1 -0
- package/lib/RedoclyApiDocs.js +1 -1
- package/lib/RedoclyApiDocsStandalone.d.ts +2 -0
- package/lib/RedoclyApiDocsStandalone.js +3 -3
- package/lib/adapters/asyncapi/items/overview/content.js +1 -1
- package/lib/adapters/graphql/group/utils.js +1 -1
- package/lib/adapters/graphql/utils/createApiItem.js +1 -1
- package/lib/adapters/openapi/build-code-sample-source.d.ts +1 -1
- package/lib/adapters/openapi/build-code-sample-source.js +1 -1
- package/lib/adapters/openapi/configure/merge-utils.d.ts +1 -1
- package/lib/adapters/openapi/configure/resolve-request-values.js +1 -1
- package/lib/adapters/openapi/index.js +1 -1
- package/lib/adapters/openapi/items/operation/content.js +1 -1
- package/lib/adapters/openapi/items/operation/item.js +1 -1
- package/lib/adapters/openapi/items/overview/content.js +1 -1
- package/lib/adapters/openapi/utils/merge-mock-server.d.ts +2 -2
- package/lib/adapters/utils/markdoc.d.ts +4 -1
- package/lib/adapters/utils/markdoc.js +1 -1
- package/lib/components/ErrorBoundary.d.ts +4 -2
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/Header/HeaderItem.js +5 -5
- package/lib/components/Header/HeaderPageActions.d.ts +4 -0
- package/lib/components/Header/HeaderPageActions.js +1 -0
- package/lib/components/Header/PageActions.d.ts +4 -0
- package/lib/components/Header/PageActions.js +11 -0
- package/lib/components/ItemContent/sections/MessagesSection.js +1 -1
- package/lib/components/Mcp/McpPrompt.js +1 -1
- package/lib/components/Mcp/McpTool.js +1 -1
- package/lib/components/Mcp/utils.d.ts +1 -1
- package/lib/components/Mcp/utils.js +1 -1
- package/lib/components/Schema/styled.js +4 -4
- package/lib/components/Schema/views/ArrayRenderer.js +1 -1
- package/lib/components/Schema/views/DiscriminatorPropertyRow.js +1 -1
- package/lib/components/Schema/views/Examples.js +1 -1
- package/lib/components/Search/index.d.ts +15 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Security/SecurityFlowDetail.js +1 -1
- package/lib/components/Security/styled.js +7 -7
- package/lib/components/StickySidebar/FloatingButton.d.ts +1 -0
- package/lib/components/StickySidebar/FloatingButton.js +32 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.d.ts +5 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.js +1 -0
- package/lib/components/StickySidebar/StickySidebar.js +33 -9
- package/lib/components/common/Breadcrumbs.js +2 -2
- package/lib/components/common/ResponseCodeTabs.js +1 -1
- package/lib/components/common/Tag.js +1 -1
- package/lib/components/common/ViewNested.js +2 -2
- package/lib/components/graphql/GraphQLFieldView.js +1 -1
- package/lib/components/graphql/RequiresScopesModal.js +3 -3
- package/lib/components/graphql/sections/GraphQLArgsSection.js +1 -1
- package/lib/components/markdoc/SchemaDefinition.js +1 -1
- package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.d.ts +9 -0
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.js +1 -0
- package/lib/components/panels/ExampleItem/ServerDropdown.js +1 -1
- package/lib/components/panels/ExampleItem/generate-request-sample.d.ts +28 -0
- package/lib/components/panels/ExampleItem/generate-request-sample.js +1 -0
- package/lib/components/panels/ExampleItem/styled.d.ts +1 -49
- package/lib/components/panels/ExampleItem/useActiveServer.d.ts +17 -0
- package/lib/components/panels/ExampleItem/useActiveServer.js +1 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.d.ts +23 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.js +1 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.d.ts +18 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.js +1 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.d.ts +3 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.js +7 -0
- package/lib/components/panels/GroupPanelItem.js +1 -1
- package/lib/components/panels/LanguageItem/LanguagePanelItem.js +5 -1
- package/lib/components/panels/LanguageItem/styled.js +17 -14
- package/lib/components/panels/McpExamplePanelItem.js +2 -2
- package/lib/components/panels/McpPanelItem.js +2 -2
- package/lib/components/panels/ServerItem/ServerItem.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.js +1 -1
- package/lib/components/panels/shared-panel-styles.js +1 -1
- package/lib/components/panels/styled.js +1 -1
- package/lib/components/pluggable/RedocResponseSamples.js +1 -1
- package/lib/hoc/withLicenseGate.d.ts +5 -0
- package/lib/hoc/withLicenseGate.js +1 -0
- package/lib/hoc/withStoreProvider.d.ts +2 -0
- package/lib/hoc/withStoreProvider.js +1 -1
- package/lib/hooks/useCopySpecSlice.d.ts +9 -0
- package/lib/hooks/useCopySpecSlice.js +1 -0
- package/lib/hooks/useInitialTelemetry.d.ts +2 -0
- package/lib/hooks/useInitialTelemetry.js +1 -0
- package/lib/hooks/useLicense.js +1 -1
- package/lib/hooks/useLicenseGate.d.ts +6 -0
- package/lib/hooks/useLicenseGate.js +1 -0
- package/lib/hooks/useScrollSpyUrlSync.js +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.js +1 -1
- package/lib/jotai/app.d.ts +6 -0
- package/lib/jotai/app.js +1 -1
- package/lib/jotai/examples.js +1 -1
- package/lib/jotai/store.d.ts +4 -0
- package/lib/jotai/store.js +1 -1
- package/lib/options/editionOverrides.d.ts +3 -0
- package/lib/options/editionOverrides.js +1 -0
- package/lib/options/helpers.d.ts +1 -2
- package/lib/options/helpers.js +1 -1
- package/lib/options/normalizeOptions.d.ts +1 -1
- package/lib/options/normalizeOptions.js +1 -1
- package/lib/options/standaloneLayoutVars.d.ts +3 -0
- package/lib/options/standaloneLayoutVars.js +1 -0
- package/lib/pages/ItemPage.js +4 -2
- package/lib/services/code-samples/apply-env-variables.d.ts +8 -0
- package/lib/services/code-samples/apply-env-variables.js +1 -0
- package/lib/services/code-samples/builder.js +1 -1
- package/lib/services/code-samples/language-availability.d.ts +4 -0
- package/lib/services/code-samples/language-availability.js +1 -0
- package/lib/services/code-samples/{replay/normalize-servers.d.ts → normalize-servers.d.ts} +1 -1
- package/lib/services/code-samples/normalize-servers.js +1 -0
- package/lib/services/code-samples/replay/from-openapi-document.d.ts +8 -1
- package/lib/services/code-samples/replay/from-openapi-document.js +1 -1
- package/lib/services/code-samples/replay/index.d.ts +1 -1
- package/lib/services/code-samples/replay/index.js +1 -1
- package/lib/services/code-samples/replay/replay-predefined-env.d.ts +1 -2
- package/lib/services/code-samples/replay/replay-predefined-env.js +1 -1
- package/lib/services/code-samples/server-env.d.ts +3 -0
- package/lib/services/code-samples/server-env.js +1 -0
- package/lib/services/code-samples/source.d.ts +3 -3
- package/lib/services/license/check.d.ts +1 -0
- package/lib/services/license/check.js +1 -1
- package/lib/services/operation-samples/index.js +1 -1
- package/lib/services/search/indexer.d.ts +9 -0
- package/lib/services/search/indexer.js +1 -0
- package/lib/services/search/types.d.ts +27 -0
- package/lib/services/search/types.js +0 -0
- package/lib/services/spec-slice/assistant-links.d.ts +9 -0
- package/lib/services/spec-slice/assistant-links.js +5 -0
- package/lib/services/spec-slice/asyncapi-slice.d.ts +5 -0
- package/lib/services/spec-slice/asyncapi-slice.js +1 -0
- package/lib/services/spec-slice/clone-strip.d.ts +1 -0
- package/lib/services/spec-slice/clone-strip.js +1 -0
- package/lib/services/spec-slice/component-closure.d.ts +6 -0
- package/lib/services/spec-slice/component-closure.js +1 -0
- package/lib/services/spec-slice/graphql-slice.d.ts +2 -0
- package/lib/services/spec-slice/graphql-slice.js +1 -0
- package/lib/services/spec-slice/index.d.ts +6 -0
- package/lib/services/spec-slice/index.js +1 -0
- package/lib/services/spec-slice/openapi-slice.d.ts +6 -0
- package/lib/services/spec-slice/openapi-slice.js +1 -0
- package/lib/services/spec-slice/resolve-scope.d.ts +4 -0
- package/lib/services/spec-slice/resolve-scope.js +1 -0
- package/lib/services/spec-slice/types.d.ts +37 -0
- package/lib/services/spec-slice/types.js +0 -0
- package/lib/standalone.d.ts +19 -0
- package/lib/standalone.js +2 -0
- package/lib/standaloneThemeConfig.d.ts +3 -0
- package/lib/standaloneThemeConfig.js +1 -0
- package/lib/telemetry/RedocTelemetry.d.ts +3 -0
- package/lib/telemetry/RedocTelemetry.js +1 -1
- package/lib/telemetry/defaults.d.ts +2 -0
- package/lib/telemetry/defaults.js +1 -0
- package/lib/types/code-samples-config.d.ts +68 -0
- package/lib/types/code-samples-config.js +0 -0
- package/lib/types/common.d.ts +1 -1
- package/lib/types/content.d.ts +4 -3
- package/lib/types/edition-config.d.ts +4 -0
- package/lib/types/edition-config.js +0 -0
- package/lib/types/events.d.ts +2 -2
- package/lib/types/openapi.d.ts +2 -1
- package/lib/types/options.d.ts +24 -88
- package/lib/utils/compose.d.ts +1 -0
- package/lib/utils/deep-link.d.ts +1 -0
- package/lib/utils/deep-link.js +1 -1
- package/lib/utils/extract-extensions.js +1 -1
- package/lib/utils/x-logo.d.ts +13 -0
- package/lib/utils/x-logo.js +1 -0
- package/package.json +19 -8
- package/lib/services/code-samples/replay/normalize-servers.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRecord as i,resolveJsonPointer as O}from"../../adapters/helpers.js";import{collectComponentClosure as C,buildComponentsFromClosure as b}from"./component-closure.js";import{cloneStrip as I}from"./clone-strip.js";import{parsePointerTokens as h}from"./openapi-slice.js";function A(n){return typeof n.asyncapi=="string"&&n.asyncapi.startsWith("3.")}const v=["asyncapi","id","info","defaultContentType","servers"];function x(n){const e=h(n);if(!(e.length<2)){if(e[0]==="channels")return{kind:"channel",channelId:e[1]};if(e[0]==="operations")return{kind:"async-operation",operationId:e[1]}}}function F(n,e){if(!A(n))return;if(e.kind==="document")return{document:I(n,new Map)};const t=S(n,e);if(!t)return;const{keptChannels:p,keptOperations:f}=t,s={};for(const o of v)n[o]!==void 0&&(s[o]=n[o]);const u=i(n.channels)?n.channels:{},a=i(n.operations)?n.operations:{},r={};for(const[o,d]of Object.entries(u))p.has(o)&&(r[o]=d);const c={};for(const[o,d]of Object.entries(a))f.has(o)&&(c[o]=d);s.channels=r,Object.keys(c).length&&(s.operations=c);const l=C(n,[s],o=>{if(o.startsWith("#/servers/"))return n.servers!==void 0;const d=h(o);return d[0]==="channels"?p.has(d[1]):d[0]==="operations"?f.has(d[1]):!1}),y=b(n,l.keep);return y&&(s.components=y),{document:I(s,l.inlineTargets)}}function g(n){if(!i(n)||!i(n.channel))return;const e=n.channel.$ref;if(typeof e!="string")return;const t=h(e);return t[0]==="channels"&&t.length>=2?t[1]:void 0}function R(n,e){return!i(n)||!Array.isArray(n.tags)?!1:n.tags.some(t=>i(t)&&t.name===e)}function S(n,e){const t=i(n.channels)?n.channels:{},p=i(n.operations)?n.operations:{},f=new Set,s=new Set,u=a=>{for(const[r,c]of Object.entries(p))g(c)===a&&s.add(r)};switch(e.kind){case"channel":{if(!(e.channelId in t))return;f.add(e.channelId),u(e.channelId);break}case"async-operation":{const a=p[e.operationId];if(!i(a))return;s.add(e.operationId);const r=g(a);r&&r in t&&f.add(r);break}case"tag":{for(const[a,r]of Object.entries(t))R(r,e.tagName)&&(f.add(a),u(a));if(f.size===0)return;break}default:return}for(const a of s){const r=p[a];if(!i(r))continue;const c=T(n,r.reply),k=i(c?.channel)?c.channel.$ref:void 0;if(typeof k!="string")continue;const l=h(k);l[0]==="channels"&&l[1]&&l[1]in t&&f.add(l[1])}return{keptChannels:f,keptOperations:s}}function T(n,e){if(i(e)){if(typeof e.$ref=="string"&&e.$ref.startsWith("#/")){const t=O(n,e.$ref);return i(t)?t:void 0}return e}}export{F as extractAsyncApiSlice,x as scopeFromAsyncApiPointer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cloneStrip(value: unknown, inlineTargets: ReadonlyMap<string, unknown>): unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as E,REDOCLY_ROUTE_RBAC as S}from"@redocly/config";import{isRecord as l}from"../../adapters/helpers.js";const h=new Set([E,S,"x-circular-ref","x-original-ref"]);function w(p,a){const r=new WeakSet,s=new Set,c=e=>{if(Array.isArray(e)){if(r.has(e))throw new Error("spec-slice: circular object graph in the source document");r.add(e);const t=e.map(c);return r.delete(e),t}if(!l(e))return e;if(r.has(e))throw new Error("spec-slice: circular object graph in the source document");const i=typeof e.$ref=="string"?e.$ref:void 0;if(i&&a.has(i)){if(s.has(i))return{};s.add(i),r.add(e);const t=c(a.get(i));s.delete(i);const n={};for(const[f,u]of Object.entries(e))f==="$ref"||h.has(f)||u===void 0||(n[f]=c(u));return r.delete(e),l(t)?{...t,...n}:t}r.add(e);const o={};for(const[t,n]of Object.entries(e))h.has(t)||n===void 0||(o[t]=c(n));return r.delete(e),o};return c(p)}export{w as cloneStrip};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ComponentClosure = {
|
|
2
|
+
keep: Map<string, Set<string>>;
|
|
3
|
+
inlineTargets: Map<string, unknown>;
|
|
4
|
+
};
|
|
5
|
+
export declare function collectComponentClosure(document: Record<string, unknown>, seeds: unknown[], retainRef?: (ref: string) => boolean): ComponentClosure;
|
|
6
|
+
export declare function buildComponentsFromClosure(document: Record<string, unknown>, keep: Map<string, Set<string>>): Record<string, unknown> | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRecord as r,resolveJsonPointer as N}from"../../adapters/helpers.js";import{encodeJsonPointerSegment as b}from"../../utils/refPointer.js";const O="#/components/";function $(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}function w(a,d,g){const u=new Map,p=new Map,f=[...d],h=new WeakSet;let c;const y=()=>{if(c)return c;c=new Map;const e=r(a.components)?a.components.schemas:void 0;if(r(e)){const n=`${O}schemas/`;for(const[o,t]of Object.entries(e))if(!(!r(t)||!Array.isArray(t.allOf)))for(const s of t.allOf){if(!r(s)||typeof s.$ref!="string"||!s.$ref.startsWith(n))continue;const i=$(s.$ref.slice(n.length)),m=e[i];if(!r(m)||!(m.discriminator||m["x-discriminator"]))continue;const k=c.get(i)??[];k.push(o),c.set(i,k)}}return c},l=(e,n)=>{const o=$(n);let t=u.get(e);if(t||(t=new Set,u.set(e,t)),t.has(o))return;const s=`${O}${e}/${n}`,i=N(a,s);if(i&&(t.add(o),f.push(i),e==="schemas"&&(i.discriminator||i["x-discriminator"])))for(const m of y().get(o)??[])l("schemas",b(m))},j=e=>{if(e.startsWith(O)){const[n,o]=e.slice(O.length).split("/");if(n&&o){l(n,o);return}}if(!g?.(e)&&e.startsWith("#/")){if(p.has(e))return;const n=N(a,e);if(!n)return;p.set(e,n),f.push(n);return}};for(;f.length;){const e=f.pop();if(Array.isArray(e)){f.push(...e);continue}if(!r(e)||h.has(e))continue;h.add(e);for(const[t,s]of Object.entries(e)){if(t==="$ref"&&typeof s=="string"){j(s);continue}if(t==="security"&&Array.isArray(s)){for(const i of s)if(r(i))for(const m of Object.keys(i))l("securitySchemes",b(m))}f.push(s)}const n=e.discriminator??e["x-discriminator"],o=r(n)?n.mapping:void 0;if(r(o))for(const t of Object.values(o))typeof t=="string"&&(t.startsWith("#/")?j(t):l("schemas",b(t)))}return{keep:u,inlineTargets:p}}function x(a,d){const g=a.components;if(!r(g)||d.size===0)return;const u={};for(const[p,f]of Object.entries(g)){const h=d.get(p);if(!h?.size||!r(f))continue;const c={};for(const[y,l]of Object.entries(f))h.has(y)&&(c[y]=l);Object.keys(c).length&&(u[p]=c)}return Object.keys(u).length?u:void 0}export{x as buildComponentsFromClosure,w as collectComponentClosure};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Kind as t,OperationTypeNode as O,parse as g,print as F,visit as Y}from"graphql";const C=new Set([t.SCALAR_TYPE_DEFINITION,t.OBJECT_TYPE_DEFINITION,t.INTERFACE_TYPE_DEFINITION,t.UNION_TYPE_DEFINITION,t.ENUM_TYPE_DEFINITION,t.INPUT_OBJECT_TYPE_DEFINITION]),A=new Set([t.SCALAR_TYPE_EXTENSION,t.OBJECT_TYPE_EXTENSION,t.INTERFACE_TYPE_EXTENSION,t.UNION_TYPE_EXTENSION,t.ENUM_TYPE_EXTENSION,t.INPUT_OBJECT_TYPE_EXTENSION]);function S(o){return C.has(o.kind)}function v(o){return A.has(o.kind)}const P={query:O.QUERY,mutation:O.MUTATION,subscription:O.SUBSCRIPTION},M=["query","mutation","subscription"],k={query:"Query",mutation:"Mutation",subscription:"Subscription"};function R(o){const i={typeDefs:new Map,typeExts:new Map,directiveDefs:new Map,schemaExts:[]};for(const n of o.definitions)if(S(n))i.typeDefs.set(n.name.value,n);else if(v(n)){const r=n.name.value,s=i.typeExts.get(r)??[];s.push(n),i.typeExts.set(r,s)}else n.kind===t.DIRECTIVE_DEFINITION?i.directiveDefs.set(n.name.value,n):n.kind===t.SCHEMA_DEFINITION?i.schemaDef=n:n.kind===t.SCHEMA_EXTENSION&&i.schemaExts.push(n);return i}function x(o){const i={typeNames:[],directiveNames:[],operationFields:new Map},n=r=>{if(r.kind==="graphql-type")i.typeNames.push(r.name);else if(r.kind==="graphql-directive")i.directiveNames.push(r.name);else{const s=i.operationFields.get(r.operationType)??[];s.push(r.name),i.operationFields.set(r.operationType,s)}};if(o.kind==="graphql-type"||o.kind==="graphql-directive"||o.kind==="graphql-operation")return n(o),i;if(o.kind==="graphql-group")return o.members.forEach(n),i}function w(o,i){const n=P[i];for(const r of[o.schemaDef,...o.schemaExts])for(const s of r?.operationTypes??[])if(s.operation===n)return s.type.name.value;return k[i]}function q(o,i,n){const r=[],s=new Set,c=[i,...o.typeExts.get(i.name.value)??[]];for(const d of c)if(!(d.kind!==t.OBJECT_TYPE_DEFINITION&&d.kind!==t.OBJECT_TYPE_EXTENSION))for(const T of d.fields??[]){const a=T.name.value;n.has(a)&&!s.has(a)&&(s.add(a),r.push(T))}return r}function B(o,i){const n=x(i);if(!n)return;let r;try{r=g(o,{noLocation:!0})}catch{return}const s=R(r),c=new Map,d=[];let T=!1;for(const e of M){const f=n.operationFields.get(e);if(!f?.length)continue;const E=w(s,e),I=s.typeDefs.get(E);if(I?.kind!==t.OBJECT_TYPE_DEFINITION)continue;const _=q(s,I,new Set(f));if(!_.length)continue;const y=c.get(E);c.set(E,{kind:t.OBJECT_TYPE_DEFINITION,name:I.name,description:I.description,directives:I.directives,fields:y?[...y.fields??[],..._]:_}),d.push({kind:t.OPERATION_TYPE_DEFINITION,operation:P[e],type:{kind:t.NAMED_TYPE,name:{kind:t.NAME,value:E}}}),E!==k[e]&&(T=!0)}const a=d.length&&(s.schemaDef||T)?{kind:t.SCHEMA_DEFINITION,description:s.schemaDef?.description,directives:s.schemaDef?.directives,operationTypes:d}:void 0,p=new Set,l=new Set,N=[],h=e=>{if(p.has(e))return;const f=s.typeDefs.get(e);if(!f)return;p.add(e);const E=c.get(e);if(E){N.push(E);return}N.push(f,...s.typeExts.get(e)??[])},D=e=>{if(l.has(e))return;const f=s.directiveDefs.get(e);f&&(l.add(e),N.push(f))};a&&N.push(a);for(const e of c.keys())h(e);for(const e of n.typeNames)h(e);for(const e of n.directiveNames)D(e);if(p.size===0&&l.size===0)return;for(;N.length;){const e=N.pop();e&&Y(e,{NamedType(f){h(f.name.value)},Directive(f){D(f.name.value)}})}const u=[];let m=!1;for(const e of r.definitions)if(e.kind===t.SCHEMA_DEFINITION)a&&(u.push(a),m=!0);else if(S(e)){const f=e.name.value;p.has(f)&&u.push(c.get(f)??e)}else if(v(e)){const f=e.name.value;p.has(f)&&!c.has(f)&&u.push(e)}else e.kind===t.DIRECTIVE_DEFINITION&&l.has(e.name.value)&&u.push(e);if(a&&!m&&u.unshift(a),u.length!==0)return F({kind:t.DOCUMENT,definitions:u})}export{B as extractGraphqlSlice};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ApiSpecType } from '../../types/common.js';
|
|
2
|
+
import type { SpecSliceScope } from './types.js';
|
|
3
|
+
export { resolveSpecSliceScope } from './resolve-scope.js';
|
|
4
|
+
export { ASSISTANT_LINK_BASES, buildInlinePromptLink, buildFetchSpecPromptLink, } from './assistant-links.js';
|
|
5
|
+
export type { SliceContentKind, SpecSliceScope } from './types.js';
|
|
6
|
+
export declare function buildSpecSlice(specType: ApiSpecType, document: unknown, scope: SpecSliceScope): Promise<string | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{dump as n}from"js-yaml";import{isRecord as f}from"../../adapters/helpers.js";import{apiSpecType as t}from"../../types/common.js";import{extractOpenApiSlice as c}from"./openapi-slice.js";import{extractAsyncApiSlice as p}from"./asyncapi-slice.js";import{resolveSpecSliceScope as x}from"./resolve-scope.js";import{ASSISTANT_LINK_BASES as h,buildInlinePromptLink as I,buildFetchSpecPromptLink as y}from"./assistant-links.js";async function s(o,e,i){switch(o){case t.GRAPHQL:{if(typeof e!="string")return;if(i.kind==="document")return e;const{extractGraphqlSlice:r}=await import("./graphql-slice.js");return r(e,i)}case t.OPENAPI:{if(f(e)){const r=c(e,i);if(r)return n(r.document,{noRefs:!0,lineWidth:-1})}return}case t.ASYNCAPI:{if(f(e)){const r=p(e,i);if(r)return n(r.document,{noRefs:!0,lineWidth:-1})}return}default:return}}export{h as ASSISTANT_LINK_BASES,y as buildFetchSpecPromptLink,I as buildInlinePromptLink,s as buildSpecSlice,x as resolveSpecSliceScope};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SpecSliceScope } from './types.js';
|
|
2
|
+
export declare function parsePointerTokens(pointer: string): string[];
|
|
3
|
+
export declare function operationScopeFromPointer(pointer: string, isWebhook: boolean | undefined): SpecSliceScope | undefined;
|
|
4
|
+
export declare function extractOpenApiSlice(document: Record<string, unknown>, scope: SpecSliceScope): {
|
|
5
|
+
document: Record<string, unknown>;
|
|
6
|
+
} | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isRecord as f}from"../../adapters/helpers.js";import{resolvePathItemRef as A}from"../../adapters/openapi/utils/resolvePathItemRef.js";import{JsonPointer as O}from"../../adapters/openapi/utils/JsonPointer.js";import{isOperationName as v}from"../../utils/http-methods.js";import{encodeJsonPointerSegment as w}from"../../utils/refPointer.js";import{DEFAULT_WEBHOOKS_TAG_NAME as x}from"../../constants/openapi.js";import{collectComponentClosure as S,buildComponentsFromClosure as T}from"./component-closure.js";import{cloneStrip as g}from"./clone-strip.js";const N=["openapi","info","jsonSchemaDialect","externalDocs","servers","security"];function I(e){const n=e.startsWith("/")||e.startsWith("#")?e:`/${e}`;try{return O.parse(n)}catch{return[]}}function L(e,n){const r=I(e);if(!(r.length<3||r[0]!=="paths"))return{kind:"operation",pathName:r[1],httpVerb:r[2],source:n?"webhooks":"paths"}}function W(e,n){if(typeof e.openapi!="string")return;if(n.kind==="document")return{document:g(e,new Map)};const r=M(e,n);if(!r)return;const{draft:s,extraSeeds:o=[]}=r,i=S(e,[s,...o]),t=T(e,i.keep);return t&&(s.components=t),{document:g(s,i.inlineTargets)}}function M(e,n){const r={};for(const p of N)e[p]!==void 0&&(r[p]=e[p]);if(n.kind==="schema"){const p=f(e.components)?e.components.schemas:void 0;if(!f(p)||!(n.name in p))return;r.paths={};const d={$ref:`#/components/schemas/${w(n.name)}`};return{draft:r,extraSeeds:[d]}}const s=e["x-webhooks"]?"x-webhooks":"webhooks",o=e["x-webhooks"]??e.webhooks;let i,t;if(n.kind==="operation"){i=new Map,t=new Map;const p=n.source==="webhooks"?o:e.paths,d=P(e,p,n.pathName,n.httpVerb);if(!d)return;(n.source==="webhooks"?t:i).set(n.pathName,d)}else if(n.kind==="tag"){if(i=k(e,e.paths,n.tagName,!1),t=k(e,o,n.tagName,!0),i.size===0&&t.size===0)return}else return;const a=new Set;for(const p of[...i.values(),...t.values()])for(const{operation:d}of p.operations){const l=d.tags;if(Array.isArray(l))for(const h of l)typeof h=="string"&&a.add(h)}const c=K(e,a);c.length&&(r.tags=c);const u=_(e,a);return u.length&&(r["x-tagGroups"]=u),r.paths=b(i),t.size&&(r[s]=b(t)),{draft:r}}function m(e,n){if(f(n))try{const r=A(e,n,e.openapi);return f(r)?r:void 0}catch{return}}function P(e,n,r,s){if(!f(n))return;const o=m(e,n[r]);if(!o)return;const i=o[s];if(f(i))return{pathItem:o,operations:[{operation:i,verbKey:s,isAdditional:!1}]};if(s==="query"&&f(o["x-query"]))return{pathItem:o,operations:[{operation:o["x-query"],verbKey:"x-query",isAdditional:!1}]};const t=f(o.additionalOperations)?o.additionalOperations[s]:void 0;if(f(t))return{pathItem:o,operations:[{operation:t,verbKey:s,isAdditional:!0}]}}function y(e,n,r){return(Array.isArray(e.tags)?e.tags:[r?x:""]).includes(n)}function k(e,n,r,s){const o=new Map;if(!f(n))return o;for(const i of Object.keys(n)){const t=m(e,n[i]);if(!t)continue;const a=[];for(const[c,u]of Object.entries(t))!v(c)||!f(u)||y(u,r,s)&&a.push({operation:u,verbKey:c,isAdditional:!1});if(f(t.additionalOperations))for(const[c,u]of Object.entries(t.additionalOperations))f(u)&&y(u,r,s)&&a.push({operation:u,verbKey:c,isAdditional:!0});a.length&&o.set(i,{pathItem:t,operations:a})}return o}const E=["summary","description","parameters","servers"];function b(e){const n={};for(const[r,{pathItem:s,operations:o}]of e){const i={};for(const a of E)s[a]!==void 0&&(i[a]=s[a]);const t={};for(const{operation:a,verbKey:c,isAdditional:u}of o)u?t[c]=a:i[c]=a;Object.keys(t).length&&(i.additionalOperations=t),n[r]=i}return n}function K(e,n){const r=Array.isArray(e.tags)?e.tags:[],s=new Map;for(const t of r)f(t)&&typeof t.name=="string"&&s.set(t.name,t);const o=new Set,i=t=>{if(o.has(t))return;const a=s.get(t);a&&(o.add(t),typeof a.parent=="string"&&i(a.parent))};for(const t of n)i(t);return r.filter(t=>f(t)&&o.has(t.name))}function _(e,n){const r=e["x-tagGroups"];if(!Array.isArray(r))return[];const s=[];for(const o of r){if(!f(o)||!Array.isArray(o.tags))continue;const i=o.tags.filter(t=>typeof t=="string"&&n.has(t));i.length&&s.push({...o,tags:i})}return s}export{W as extractOpenApiSlice,L as operationScopeFromPointer,I as parsePointerTokens};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiItemContent } from '../../types/store.js';
|
|
2
|
+
import type { ApiSpecType } from '../../types/common.js';
|
|
3
|
+
import type { SpecSliceScope } from './types.js';
|
|
4
|
+
export declare function resolveSpecSliceScope(specType: ApiSpecType, content: ApiItemContent | null | undefined, label: string | undefined, groupMemberContents?: Array<ApiItemContent | null | undefined>): SpecSliceScope | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{apiSpecType as u,contentType as t,itemVariant as i}from"../../types/common.js";import{BUILT_IN_DIRECTIVES as m,BUILT_IN_SCALARS as s}from"../../adapters/graphql/utils/constants.js";import{operationScopeFromPointer as T}from"./openapi-slice.js";import{scopeFromAsyncApiPointer as A}from"./asyncapi-slice.js";function V(e,r,n,p){if(r){if(r.contentType===t.OVERVIEW)return{kind:"document"};switch(e){case u.OPENAPI:return I(r);case u.ASYNCAPI:return S(r,n);case u.GRAPHQL:return r.contentType===t.GROUP?N(n,p):d(r);default:return}}}function I(e){if(e.contentType===t.GROUP){const r=e.meta?.name;return typeof r=="string"?{kind:"tag",tagName:r}:void 0}if(e.contentType===t.ITEM){if(e.itemVariant===i.HTTP_ITEM&&e.meta?.pointer)return T(e.meta.pointer,e.meta.isWebhook);if(e.itemVariant===i.SCHEMA&&e.meta?.name)return{kind:"schema",name:e.meta.name}}}const E={[i.QUERY]:"query",[i.MUTATION]:"mutation",[i.SUBSCRIPTION]:"subscription"},c=new Set([i.OBJECT,i.INTERFACE,i.INPUT,i.UNION,i.ENUM,i.SCALAR]);function d(e){if(e.contentType!==t.ITEM||!e.itemVariant)return;const r=e.meta?.name;if(typeof r!="string"||!r)return;const n=E[e.itemVariant];if(n)return{kind:"graphql-operation",operationType:n,name:r};if(c.has(e.itemVariant))return s.has(r)?void 0:{kind:"graphql-type",name:r};if(e.itemVariant===i.DIRECTIVE)return m.has(r)?void 0:{kind:"graphql-directive",name:r}}function N(e,r){if(!r?.length)return;const n=[],p=new Set;for(const o of r){const a=o?d(o):void 0;if(!a)continue;const f=`${a.kind}/${"operationType"in a?a.operationType:""}/${a.name}`;p.has(f)||(p.add(f),n.push(a))}return n.length?{kind:"graphql-group",label:e,members:n}:void 0}function S(e,r){if(e.contentType===t.GROUP)return r?{kind:"tag",tagName:r}:void 0;if(e.contentType===t.ITEM&&(e.itemVariant===i.CHANNEL||e.itemVariant===i.CHANNEL_OPERATION)&&e.meta?.pointer)return A(e.meta.pointer)}export{V as resolveSpecSliceScope};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type GraphqlOperationType = 'query' | 'mutation' | 'subscription';
|
|
2
|
+
export type GraphqlItemScope = {
|
|
3
|
+
kind: 'graphql-operation';
|
|
4
|
+
operationType: GraphqlOperationType;
|
|
5
|
+
name: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'graphql-type';
|
|
8
|
+
name: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'graphql-directive';
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
export type SpecSliceScope = {
|
|
14
|
+
kind: 'document';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'tag';
|
|
17
|
+
tagName: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'operation';
|
|
20
|
+
pathName: string;
|
|
21
|
+
httpVerb: string;
|
|
22
|
+
source: 'paths' | 'webhooks';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'schema';
|
|
25
|
+
name: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'channel';
|
|
28
|
+
channelId: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'async-operation';
|
|
31
|
+
operationId: string;
|
|
32
|
+
} | GraphqlItemScope | {
|
|
33
|
+
kind: 'graphql-group';
|
|
34
|
+
label?: string;
|
|
35
|
+
members: GraphqlItemScope[];
|
|
36
|
+
};
|
|
37
|
+
export type SliceContentKind = 'yaml' | 'graphql';
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RedocStandaloneProps } from './RedocStandalone.js';
|
|
2
|
+
import type { TypeOfUsage } from './telemetry/RedocTelemetry.js';
|
|
3
|
+
import { RedocStandalone } from './RedocStandalone.js';
|
|
4
|
+
export { RedocStandalone };
|
|
5
|
+
export type { RedocStandaloneProps };
|
|
6
|
+
type InitOptions = NonNullable<RedocStandaloneProps['options']> & {
|
|
7
|
+
router?: 'hash' | 'history';
|
|
8
|
+
disableTelemetry?: boolean;
|
|
9
|
+
specType?: RedocStandaloneProps['specType'];
|
|
10
|
+
/** The Docker image sets `type-of-usage="docker"` on the `<redoc>` element. */
|
|
11
|
+
typeOfUsage?: TypeOfUsage;
|
|
12
|
+
basePath?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function init(definitionOrDefinitionUrl: string | Record<string, unknown>, options?: InitOptions, element?: Element | null): void;
|
|
15
|
+
/**
|
|
16
|
+
* Attaches to server-rendered markup instead of replacing it. The definition must be
|
|
17
|
+
* the same pre-bundled document the server pass rendered from.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hydrate(definitionOrDefinitionUrl: string | Record<string, unknown>, options?: InitOptions, element?: Element | null): Promise<void>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createElement as f}from"react";import{createRoot as g,hydrateRoot as E}from"react-dom/client";import{HashRouter as R}from"react-router";import{RedocStandalone as y,prepareApiDocs as S}from"./RedocStandalone.js";import{RedoclyApiDocsStandalone as A}from"./RedoclyApiDocsStandalone.js";import{logoFromDefinition as T}from"./utils/x-logo.js";const C=["html","cli","react","docker"];function M(e,t){return C.includes(e)?e:t}function m(e){return typeof document<"u"?document.querySelector(e):null}function w(e){const t={};for(const o of Array.from(e.attributes))t[o.name]=o.value;return t}function U(e){const t=w(e),o={};for(const r in t){const s=r.replace(/-(.)/g,(n,c)=>c.toUpperCase());o[s]=t[r]}return o}function h(e,t,o,r){const{router:s,disableTelemetry:n,specType:c,typeOfUsage:i,basePath:p,...u}={...t,...U(o)};let l,a;return typeof e=="string"?c==="graphql"&&!H(e)?a=e:l=e:typeof e=="object"&&(a=e),{router:s,props:{definition:a,definitionUrl:l,specType:c,options:u,basePath:p,telemetryConfig:{typeOfUsage:M(i,r),...n!==void 0?{disabled:n===!0||String(n)==="true"}:{}}}}}function d(e,t){return t==="history"?e:f(R,null,e)}function b(e){if(e===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');return e}function q(e,t={},o=m("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"html");g(r).render(d(f(y,n),s))}const v=/server rendered HTML didn't match the client|error while hydrating|Minified React error #(418|423)/;async function L(e,t={},o=m("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"cli"),c=n.basePath??"/",i=await S({...n,basePath:c}),p=f(A,{items:i.items,store:i.store,basePath:c,options:i.options,logo:T(i.document),telemetryConfig:n.telemetryConfig,definition:i.document,definitionUrl:n.definitionUrl});if(r.childElementCount===0){g(r).render(d(p,s));return}E(r,d(p,s),{onRecoverableError:(u,l)=>{const a=u instanceof Error?u.message:String(u);v.test(a)||console.error(a,l)}})}function H(e){return!e.includes(`
|
|
2
|
+
`)&&/^[^\s]+$/.test(e)}function I(){const e=m("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&q(t,{},e)}I();export{y as RedocStandalone,L as hydrate,q as init};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ThemeDataTransferObject } from '@redocly/theme/core/openapi';
|
|
2
|
+
/** Theme config injected into the standalone render's `ThemeDataContext`; `undefined` keeps the theme defaults. */
|
|
3
|
+
export declare const STANDALONE_THEME_CONFIG: ThemeDataTransferObject['config'] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=void 0;export{e as STANDALONE_THEME_CONFIG};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Telemetry } from '@redocly/redoc-opentelemetry';
|
|
2
2
|
import type { EventType, EventPayload } from '@redocly/redoc-opentelemetry';
|
|
3
3
|
export type SpecType = 'openapi' | 'asyncapi' | 'graphql';
|
|
4
|
+
export type TypeOfUsage = 'html' | 'cli' | 'react' | 'docker';
|
|
4
5
|
export interface RedocTelemetryConfig {
|
|
5
6
|
specType: SpecType;
|
|
6
7
|
collectorUrl?: string;
|
|
7
8
|
serviceName?: string;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
serviceVersion?: string;
|
|
11
|
+
typeOfUsage?: TypeOfUsage;
|
|
10
12
|
}
|
|
11
13
|
export declare class RedocTelemetry extends Telemetry {
|
|
12
14
|
private specType;
|
|
15
|
+
readonly typeOfUsage: TypeOfUsage | undefined;
|
|
13
16
|
constructor(config: RedocTelemetryConfig);
|
|
14
17
|
send<T extends EventType>(event: T, data?: EventPayload<T>): void;
|
|
15
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Telemetry as
|
|
1
|
+
import{Telemetry as p}from"@redocly/redoc-opentelemetry";import o from"../../package.json"with{type:"json"};import{DEFAULT_SERVICE_NAME as t,TELEMETRY_DISABLED_BY_DEFAULT as c}from"./defaults.js";const E="https://otel.cloud.redocly.com/v1/traces";class n extends p{specType;typeOfUsage;constructor(e){super(),this.specType=e.specType,this.typeOfUsage=e.typeOfUsage,this.init({otel:{isProd:process.env.NODE_ENV==="production"||process.env.ENABLE_LOCAL_TELEMETRY==="true",serviceVersion:e.serviceVersion||`${o.name}@${o.version}`,version:"1.0.0",collectorTraceUrl:e.collectorUrl||E,serviceName:e.serviceName||t,tracerName:"client-telemetry"},disabled:e.disabled??c})}send(e,s){s&&Array.isArray(s)&&s.length>0&&(s=s.map(r=>r&&typeof r=="object"?{...r,specType:this.specType}:r)),super.send(e,s,{env:process.env.NODE_ENV})}}export{n as RedocTelemetry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const E=!0,t="realm-ui";export{t as DEFAULT_SERVICE_NAME,E as TELEMETRY_DISABLED_BY_DEFAULT};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type Languages = 'JavaScript' | 'Node.js' | 'curl' | 'Java8+Apache' | 'Java' | 'Python' | 'Go' | 'PHP' | 'C#' | 'C#+Newtonsoft' | 'Ruby' | 'R';
|
|
2
|
+
export interface BasicLanguageOptions {
|
|
3
|
+
indent?: string;
|
|
4
|
+
withImports?: boolean;
|
|
5
|
+
withComments?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface CodeSampleBasicConfig {
|
|
8
|
+
lang: Languages | 'Payload';
|
|
9
|
+
label: string;
|
|
10
|
+
key: string;
|
|
11
|
+
options?: BasicLanguageOptions;
|
|
12
|
+
}
|
|
13
|
+
export interface CurlCodeSampleConfig extends CodeSampleBasicConfig {
|
|
14
|
+
lang: 'curl';
|
|
15
|
+
options?: BasicLanguageOptions & {
|
|
16
|
+
binary?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface JavaScriptCodeSampleConfig extends CodeSampleBasicConfig {
|
|
20
|
+
lang: 'JavaScript';
|
|
21
|
+
options?: BasicLanguageOptions & {
|
|
22
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface GoCodeSampleConfig extends CodeSampleBasicConfig {
|
|
26
|
+
lang: 'Go';
|
|
27
|
+
}
|
|
28
|
+
export interface NodeJsCodeSampleConfig extends CodeSampleBasicConfig {
|
|
29
|
+
lang: 'Node.js';
|
|
30
|
+
}
|
|
31
|
+
export interface PythonCodeSampleConfig extends CodeSampleBasicConfig {
|
|
32
|
+
lang: 'Python';
|
|
33
|
+
}
|
|
34
|
+
export interface Java8CodeSampleConfig extends CodeSampleBasicConfig {
|
|
35
|
+
lang: 'Java8+Apache';
|
|
36
|
+
}
|
|
37
|
+
export interface JavaCodeSampleConfig extends CodeSampleBasicConfig {
|
|
38
|
+
lang: 'Java';
|
|
39
|
+
}
|
|
40
|
+
export interface CSharpCodeSampleConfig extends CodeSampleBasicConfig {
|
|
41
|
+
lang: 'C#';
|
|
42
|
+
}
|
|
43
|
+
export interface CSharpNewtonsoftCodeSampleConfig extends CodeSampleBasicConfig {
|
|
44
|
+
lang: 'C#+Newtonsoft';
|
|
45
|
+
}
|
|
46
|
+
export interface PHPCodeSampleConfig extends CodeSampleBasicConfig {
|
|
47
|
+
lang: 'PHP';
|
|
48
|
+
}
|
|
49
|
+
export interface RubyCodeSampleConfig extends CodeSampleBasicConfig {
|
|
50
|
+
lang: 'Ruby';
|
|
51
|
+
}
|
|
52
|
+
export interface RCodeSampleConfig extends CodeSampleBasicConfig {
|
|
53
|
+
lang: 'R';
|
|
54
|
+
}
|
|
55
|
+
export interface PayloadCodeSampleConfig extends CodeSampleBasicConfig {
|
|
56
|
+
lang: 'Payload';
|
|
57
|
+
}
|
|
58
|
+
export interface CustomLanguageCodeSampleConfig extends Omit<CodeSampleBasicConfig, 'lang'> {
|
|
59
|
+
lang: string;
|
|
60
|
+
}
|
|
61
|
+
export type CodeSampleConfig = CurlCodeSampleConfig | JavaScriptCodeSampleConfig | NodeJsCodeSampleConfig | PythonCodeSampleConfig | Java8CodeSampleConfig | JavaCodeSampleConfig | CSharpCodeSampleConfig | CSharpNewtonsoftCodeSampleConfig | PHPCodeSampleConfig | GoCodeSampleConfig | RubyCodeSampleConfig | RCodeSampleConfig;
|
|
62
|
+
export interface CodeSamplesConfig {
|
|
63
|
+
languages: (CodeSampleConfig | PayloadCodeSampleConfig | CustomLanguageCodeSampleConfig)[];
|
|
64
|
+
skipOptionalParameters?: boolean;
|
|
65
|
+
withOAuth2Call?: boolean;
|
|
66
|
+
onSampleTabClick?: (label: string) => void;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
File without changes
|
package/lib/types/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Node } from '@markdoc/markdoc';
|
|
2
2
|
import type { ConfigureRequestValues, ConfigureServerRequestValues } from '@redocly/theme/ext/configure';
|
|
3
|
-
import type { UserClaims } from '@redocly/theme/core/
|
|
3
|
+
import type { UserClaims } from '@redocly/theme/core/openapi';
|
|
4
4
|
export type { ConfigureRequestValues, ConfigureServerRequestValues };
|
|
5
5
|
export type { UserClaims };
|
|
6
6
|
export type { RbacScopeItems } from '@redocly/config';
|
package/lib/types/content.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { REDOCLY_TEAMS_RBAC } from '@redocly/config';
|
|
2
2
|
import type { Node } from '@markdoc/markdoc';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OpenAPIResponse } from './openapi.js';
|
|
4
|
+
import type { OpenAPIOperation } from './openapi.js';
|
|
4
5
|
import type { CodeSampleSource } from '../services/code-samples/index.js';
|
|
5
6
|
import type { BadgeData, ServerData, nodeTypes, panelKind } from './common.js';
|
|
6
7
|
import type { GroupItem, ApiItemContent, SecuritySchemeEntry } from './store.js';
|
|
@@ -405,7 +406,7 @@ export type ResponseExamplesPanelItem = BaseExamplePanelItem & {
|
|
|
405
406
|
kind: typeof panelKind.RESPONSE;
|
|
406
407
|
exampleIds?: string[];
|
|
407
408
|
responseCodes?: ResponseCodeEntry[];
|
|
408
|
-
|
|
409
|
+
hideHeaderTitle?: boolean;
|
|
409
410
|
exampleKey?: string;
|
|
410
411
|
};
|
|
411
412
|
export type GraphQLQueryPanelItem = BaseExamplePanelItem & {
|
|
@@ -468,7 +469,7 @@ export type OverviewPanelItem = ExternalLinkPanelItem | EmailPanelItem | KeyValu
|
|
|
468
469
|
export type McpPanelItem = KeyValuePanelItem | TagsPanelItem | ExternalLinkPanelItem | ConnectMcpButtonPanelItem;
|
|
469
470
|
export type McpExamplePanelItem = {
|
|
470
471
|
kind: typeof panelKind.MCP_EXAMPLE;
|
|
471
|
-
|
|
472
|
+
headerTitleTranslationKey: string;
|
|
472
473
|
data: unknown;
|
|
473
474
|
language?: string;
|
|
474
475
|
};
|
|
File without changes
|
package/lib/types/events.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Operation } from './options.js';
|
|
2
|
-
export type AnalyticsEventType = 'CodeSampleLanguageSwitched' | 'CodeSampleCopied' | 'OperationServerExpanded' | 'PanelToggle' | '
|
|
2
|
+
export type AnalyticsEventType = 'CodeSampleLanguageSwitched' | 'CodeSampleCopied' | 'OperationServerExpanded' | 'PanelToggle' | 'TryItOpen' | 'TryItSent' | 'TargetServerSwitched';
|
|
3
3
|
export type AnalyticsEvent = {
|
|
4
4
|
eventType: AnalyticsEventType;
|
|
5
|
-
resource: 'Redocly_CodeSample' | '
|
|
5
|
+
resource: 'Redocly_CodeSample' | 'Redocly_OperationTryIt' | 'Redocly_Operation';
|
|
6
6
|
action: 'LanguageSwitched' | 'PanelToggled' | 'Opened' | 'Closed' | 'NavigatedOverrideLink' | 'Sent' | 'ValidationFailed' | 'CodeSampleCopied' | 'TargetServerSwitched';
|
|
7
7
|
operationId?: string;
|
|
8
8
|
operationPath: string;
|
package/lib/types/openapi.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { REDOCLY_TEAMS_RBAC, RbacScopeItems } from '@redocly/config';
|
|
2
|
+
import type { ENTITY_RELATION_TYPES } from '@redocly/config';
|
|
2
3
|
import type { Node } from '@markdoc/markdoc';
|
|
3
4
|
import type { SecurityDetails as ThemeSecurityDetails } from '@redocly/theme/ext/configure';
|
|
4
5
|
import type { OpenAPIRef, RawLogo, Referenced, SeoData, ExternalDocsData, SecuritySchemeType, SecuritySchemeIn, ObjectValues } from './common.js';
|
package/lib/types/options.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LayoutVariant } from '@redocly/config';
|
|
2
|
+
import type { RedocConfig } from '@redocly/config';
|
|
3
|
+
import type { EditionAsyncApiConfig, EditionGraphQLConfig, EditionRedocConfig } from './edition-config.js';
|
|
2
4
|
import type { ConfigFunction, Node, Schema } from '@markdoc/markdoc';
|
|
3
5
|
import type { MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
|
|
4
|
-
import type { UserClaims } from '@redocly/theme/core/
|
|
6
|
+
import type { UserClaims } from '@redocly/theme/core/openapi';
|
|
5
7
|
import type { ConfigureRequestValues, ConfigureServerRequestValues } from '@redocly/theme/ext/configure';
|
|
6
8
|
import type { ReactElement } from 'react';
|
|
7
9
|
import type { ComponentType } from 'react';
|
|
@@ -9,8 +11,10 @@ import type { ApiSpecType, SidebarLogo } from './common.js';
|
|
|
9
11
|
import type { ProtocolVariant } from './asyncapi.js';
|
|
10
12
|
import type { GraphQLOptions } from './graphql.js';
|
|
11
13
|
import type { Events } from './events.js';
|
|
14
|
+
import type { CodeSamplesConfig } from './code-samples-config.js';
|
|
12
15
|
import type { OpenAPIInfo, OpenAPIOperation as OpenAPIOperationType, OpenAPIParameter, OpenAPIServer, OpenAPITag } from './openapi.js';
|
|
13
16
|
import type { Referenced } from './common.js';
|
|
17
|
+
export type * from './code-samples-config.js';
|
|
14
18
|
export type Operation = {
|
|
15
19
|
id: string;
|
|
16
20
|
path: string;
|
|
@@ -44,19 +48,30 @@ export type MarkdocOptions = {
|
|
|
44
48
|
* host supplies the parser (the standalone build supplies a Markdoc-based one; see
|
|
45
49
|
* `markdocParser`). It is the single seam where markdown text becomes an AST.
|
|
46
50
|
*/
|
|
47
|
-
export type MarkdownParser = (markdown: string, sanitizeOptions?:
|
|
51
|
+
export type MarkdownParser = (markdown: string, sanitizeOptions?: {
|
|
52
|
+
sanitize?: ApiDocsOptions['sanitize'];
|
|
53
|
+
unstable_hooks?: ApiDocsOptions['unstable_hooks'];
|
|
54
|
+
}) => Node | Node[] | undefined;
|
|
48
55
|
export type ApiDocsOptions = {
|
|
49
|
-
schemaDefinitionsTagName?: string;
|
|
50
56
|
corsProxyUrl?: string;
|
|
57
|
+
hideInfoMetadata: boolean;
|
|
58
|
+
hideReplay: boolean;
|
|
59
|
+
oAuth2RedirectURI?: string;
|
|
60
|
+
showSchemaCatalogLinks?: boolean;
|
|
61
|
+
licenseKey?: string;
|
|
62
|
+
feedback: NonNullable<RedocConfig['feedback']>;
|
|
63
|
+
mockServer?: {
|
|
64
|
+
url: string;
|
|
65
|
+
position: 'first' | 'last' | 'replace' | 'off';
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
schemaDefinitionsTagName?: string;
|
|
51
69
|
jsonSamplesExpandLevel: number;
|
|
52
70
|
generatedSamplesMaxDepth: number;
|
|
53
71
|
hideDownloadButtons: boolean;
|
|
54
|
-
hideInfoMetadata: boolean;
|
|
55
72
|
hideSchemaTitles: boolean;
|
|
56
73
|
hideSchemaPattern: boolean;
|
|
57
74
|
maxDisplayedEnumValues: number;
|
|
58
|
-
hideReplay: boolean;
|
|
59
|
-
oAuth2RedirectURI?: string;
|
|
60
75
|
onlyRequiredInSamples: boolean;
|
|
61
76
|
onDeepLinkClick: ((link: string) => void) | undefined | null;
|
|
62
77
|
schemasExpansionLevel?: number;
|
|
@@ -72,33 +87,23 @@ export type ApiDocsOptions = {
|
|
|
72
87
|
unstable_skipSamples?: boolean;
|
|
73
88
|
unstable_externalCodeSamples: Unstable_ExternalCodeSample[];
|
|
74
89
|
hidePropertiesPrefix: boolean;
|
|
75
|
-
showSchemaCatalogLinks?: boolean;
|
|
76
90
|
dynamicRequestValues?: ConfigureRequestValues | ConfigureServerRequestValues;
|
|
77
91
|
userClaims?: UserClaims;
|
|
78
92
|
protocol?: ProtocolVariant;
|
|
79
93
|
scrollYOffset: () => number;
|
|
80
94
|
hideLoading: boolean;
|
|
81
95
|
skipBundle: boolean;
|
|
82
|
-
hideSidebar: boolean;
|
|
83
96
|
basePath: string;
|
|
84
97
|
specType: ApiSpecType;
|
|
85
|
-
licenseKey?: string;
|
|
86
98
|
metadata: ApiDocsMetadata;
|
|
87
99
|
downloadUrls?: NormalizedDownloadUrl[];
|
|
88
100
|
layout: LayoutVariant;
|
|
89
|
-
feedback: NonNullable<RedocConfig['feedback']>;
|
|
90
|
-
mockServer?: {
|
|
91
|
-
url: string;
|
|
92
|
-
position: 'first' | 'last' | 'replace' | 'off';
|
|
93
|
-
description: string;
|
|
94
|
-
};
|
|
95
101
|
apiLogo?: SidebarLogo;
|
|
96
102
|
jsonSamplesDepth: number;
|
|
97
103
|
samplesMaxInlineArgs: number;
|
|
98
104
|
fieldExpandLevel: number;
|
|
99
|
-
baseUrlPath?: string;
|
|
100
105
|
} & GraphQLOptions;
|
|
101
|
-
export type RawApiDocsOptions =
|
|
106
|
+
export type RawApiDocsOptions = EditionRedocConfig & EditionAsyncApiConfig & EditionGraphQLConfig & {
|
|
102
107
|
specType: ApiSpecType;
|
|
103
108
|
markdownParser: MarkdownParser;
|
|
104
109
|
basePath?: string;
|
|
@@ -106,78 +111,10 @@ export type RawApiDocsOptions = RedocConfig & AsyncApiConfig & GraphQLConfig & {
|
|
|
106
111
|
requiredPropsFirst?: boolean;
|
|
107
112
|
licenseKey?: string;
|
|
108
113
|
protocol?: ProtocolVariant;
|
|
109
|
-
excludeFromSearch?: boolean;
|
|
110
114
|
dynamicRequestValues?: ConfigureRequestValues | ConfigureServerRequestValues;
|
|
111
115
|
userClaims?: UserClaims;
|
|
112
|
-
layout?:
|
|
116
|
+
layout?: EditionRedocConfig['layout'] | EditionAsyncApiConfig['layout'] | EditionGraphQLConfig['layout'];
|
|
113
117
|
};
|
|
114
|
-
export type Languages = 'JavaScript' | 'Node.js' | 'curl' | 'Java8+Apache' | 'Java' | 'Python' | 'Go' | 'PHP' | 'C#' | 'C#+Newtonsoft' | 'Ruby' | 'R';
|
|
115
|
-
export interface BasicLanguageOptions {
|
|
116
|
-
indent?: string;
|
|
117
|
-
withImports?: boolean;
|
|
118
|
-
withComments?: boolean;
|
|
119
|
-
}
|
|
120
|
-
interface CodeSampleBasicConfig {
|
|
121
|
-
lang: Languages | 'Payload';
|
|
122
|
-
label: string;
|
|
123
|
-
key: string;
|
|
124
|
-
options?: BasicLanguageOptions;
|
|
125
|
-
}
|
|
126
|
-
export interface CurlCodeSampleConfig extends CodeSampleBasicConfig {
|
|
127
|
-
lang: 'curl';
|
|
128
|
-
options?: BasicLanguageOptions & {
|
|
129
|
-
binary?: boolean;
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
export interface JavaScriptCodeSampleConfig extends CodeSampleBasicConfig {
|
|
133
|
-
lang: 'JavaScript';
|
|
134
|
-
options?: BasicLanguageOptions & {
|
|
135
|
-
credentials?: 'omit' | 'same-origin' | 'include';
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
export interface GoCodeSampleConfig extends CodeSampleBasicConfig {
|
|
139
|
-
lang: 'Go';
|
|
140
|
-
}
|
|
141
|
-
export interface NodeJsCodeSampleConfig extends CodeSampleBasicConfig {
|
|
142
|
-
lang: 'Node.js';
|
|
143
|
-
}
|
|
144
|
-
export interface PythonCodeSampleConfig extends CodeSampleBasicConfig {
|
|
145
|
-
lang: 'Python';
|
|
146
|
-
}
|
|
147
|
-
export interface Java8CodeSampleConfig extends CodeSampleBasicConfig {
|
|
148
|
-
lang: 'Java8+Apache';
|
|
149
|
-
}
|
|
150
|
-
export interface JavaCodeSampleConfig extends CodeSampleBasicConfig {
|
|
151
|
-
lang: 'Java';
|
|
152
|
-
}
|
|
153
|
-
export interface CSharpCodeSampleConfig extends CodeSampleBasicConfig {
|
|
154
|
-
lang: 'C#';
|
|
155
|
-
}
|
|
156
|
-
export interface CSharpNewtonsoftCodeSampleConfig extends CodeSampleBasicConfig {
|
|
157
|
-
lang: 'C#+Newtonsoft';
|
|
158
|
-
}
|
|
159
|
-
export interface PHPCodeSampleConfig extends CodeSampleBasicConfig {
|
|
160
|
-
lang: 'PHP';
|
|
161
|
-
}
|
|
162
|
-
export interface RubyCodeSampleConfig extends CodeSampleBasicConfig {
|
|
163
|
-
lang: 'Ruby';
|
|
164
|
-
}
|
|
165
|
-
export interface RCodeSampleConfig extends CodeSampleBasicConfig {
|
|
166
|
-
lang: 'R';
|
|
167
|
-
}
|
|
168
|
-
export interface PayloadCodeSampleConfig extends CodeSampleBasicConfig {
|
|
169
|
-
lang: 'Payload';
|
|
170
|
-
}
|
|
171
|
-
export interface CustomLanguageCodeSampleConfig extends Omit<CodeSampleBasicConfig, 'lang'> {
|
|
172
|
-
lang: string;
|
|
173
|
-
}
|
|
174
|
-
export type CodeSampleConfig = CurlCodeSampleConfig | JavaScriptCodeSampleConfig | NodeJsCodeSampleConfig | PythonCodeSampleConfig | Java8CodeSampleConfig | JavaCodeSampleConfig | CSharpCodeSampleConfig | CSharpNewtonsoftCodeSampleConfig | PHPCodeSampleConfig | GoCodeSampleConfig | RubyCodeSampleConfig | RCodeSampleConfig;
|
|
175
|
-
export interface CodeSamplesConfig {
|
|
176
|
-
languages: (CodeSampleConfig | PayloadCodeSampleConfig | CustomLanguageCodeSampleConfig)[];
|
|
177
|
-
skipOptionalParameters?: boolean;
|
|
178
|
-
withOAuth2Call?: boolean;
|
|
179
|
-
onSampleTabClick?: (label: string) => void;
|
|
180
|
-
}
|
|
181
118
|
export type Normalized<T> = {
|
|
182
119
|
[P in keyof T]-?: T[P];
|
|
183
120
|
};
|
|
@@ -257,4 +194,3 @@ export type HooksConfig = {
|
|
|
257
194
|
MiddlePanelFooter?: HookConfig<undefined>;
|
|
258
195
|
MiddlePanelHeader?: HookConfig<undefined>;
|
|
259
196
|
};
|
|
260
|
-
export {};
|
package/lib/utils/compose.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export declare function compose<P>(f: HOC<P>): (Component: ComponentType<P>) =>
|
|
|
4
4
|
export declare function compose<P>(f: HOC<P>, g: HOC<P>): (Component: ComponentType<P>) => FC<P>;
|
|
5
5
|
export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>): (Component: ComponentType<P>) => FC<P>;
|
|
6
6
|
export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>, i: HOC<P>): (Component: ComponentType<P>) => FC<P>;
|
|
7
|
+
export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>, i: HOC<P>, j: HOC<P>): (Component: ComponentType<P>) => FC<P>;
|
|
7
8
|
export {};
|
package/lib/utils/deep-link.d.ts
CHANGED
|
@@ -112,6 +112,7 @@ export declare function isGraphqlDeepLinkAncestor(hash: string, path: string): b
|
|
|
112
112
|
*/
|
|
113
113
|
export declare function getDeepLinkId(deepLink: string | undefined): string | undefined;
|
|
114
114
|
export declare function appendVariantSuffix(fieldParentsName: string[] | undefined, suffix: string): string[];
|
|
115
|
+
export declare function appendArraySuffix(fieldParentsName: string[]): string[];
|
|
115
116
|
/**
|
|
116
117
|
* Remove variant deep-link markers (`&oneof=N`, `&d=N`) from a field-parent path
|
|
117
118
|
* piece, leaving the human-readable name(s). The markers can sit mid-path
|
package/lib/utils/deep-link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{encodeBackSlashes as
|
|
1
|
+
import{encodeBackSlashes as g,tryDecodeURIComponent as a}from"./string.js";import{joinWithSeparator as i,normalizePath as x,toElementId as k}from"./url.js";import{resolveRouteByPathname as A}from"./routing.js";function h(t){const e=[];for(const[n,r]of Object.entries(t))r!==void 0&&e.push(`${n}=${r}`);return e.join("&")}function b(t,e){return t=g(t).replace(/^\/+/,""),(`/${t}#`+i(t,e)).toLowerCase()}function N(t,e,n){const r=b(e,n);return x(i(t,r))}function C(t){const e=t.startsWith("#")?t.slice(1):t;return a(e).toLowerCase()}function m(t){const e=a(t),n=e.indexOf("#");return n>=0?e.slice(n+1):""}function j(t){return h({t:t.t,in:t.in,c:t.c,cb:t.cb,ct:t.ct,path:t.path})}function F(t,e,n){let r=t;return n&&(r=`${r}&c=${n}`),e&&(r=i(r,e)),r}function I(t){const{section:e,messageKey:n,subsection:r}=t;if(!n)return e;let o=`${e}&m=${n}`;return r&&(o+=`&t=${r}`),o}function M(t){return h({t:t.t,path:t.path,arg:t.arg,rt:t.rt})}function v(t,e){return!t||!e?!1:a(t.startsWith("#")?t.slice(1):t).toLowerCase().includes(`path=${e.toLowerCase()}.`)}function z(t){return t&&m(t)||void 0}function H(t,e){const n=[...t??[]];return n.length>0?n[n.length-1]+=e:n.push(e),n}function q(t){return t.length===0?t:[...t.slice(0,-1),t[t.length-1]+"[]"]}const E=/&(?:oneof|d)=\d+/g;function G(t){return t.replace(E,"")}function U(t){return t.replace(/\[\]/g,"")}function V(t){return(t??[]).filter(e=>e.includes("&")).map(e=>e.slice(e.indexOf("&")))}function P(t,e){return t?a(t.startsWith("#")?t.slice(1):t).toLowerCase().match(new RegExp(`(?:^|[&/])${e}=([^/&]+)`))?.[1]:void 0}const O="callbacks",f=`${O}/`,w="callback-request",T="callback-response",y=[`/${w}`,`/${T}`];function p(t){const e=t.indexOf("path=");return e===-1?t:t.slice(0,e)}function Q(t){return t.replace(`/${f}`,"/")}function L(t,e){const n=`cb=${e}`;return t.endsWith(n)||t.includes(`${n}&`)}function R(t,e){const n=`/${e}`;return t.endsWith(n)||t.includes(`${n}/`)}function W(t,e){return t===e||t.startsWith(`${e}/`)}function J(t,e,n){if(!t||!e||!n)return!1;const r=C(t);if(!W(r,e))return!1;const o=p(r),c=n.toLowerCase();return L(o,c)||R(o,c)}function X(t,e,n){const r=p(t),o=n.toLowerCase();return r.startsWith(i(e,`${f}${o}/`))||r.startsWith(i(e,`${o}/`))||L(r,o)}function Y(t,e){const n=p(t).slice(e.length);return!(n.startsWith(`/${f}`)||n.includes("cb=")||y.some(o=>n.includes(o)))}function _(t){const e=["#tag","#operation","#paths"];for(const n of e)if(t.includes(n))return t.replace(n,"").toLowerCase();return""}function Z(t,e,n){const r=C(t);if(!r)return;const o=x(i(e,r));if(A(n,o))return o;const c=_(t);if(!c)return;const l=c.split("/").filter(Boolean);for(let s=l.length;s>0;s--){const $="/"+l.slice(0,s).join("/"),u=n.allRoutes.find(S=>S.path.endsWith($));if(!u)continue;const d=l.slice(s).join("/");return d?`${u.path}#${i(k(u.path,e),d)}`:u.path}}export{O as CALLBACKS_SECTION,w as CALLBACK_REQUEST_SECTION,T as CALLBACK_RESPONSE_SECTION,q as appendArraySuffix,H as appendVariantSuffix,I as buildAsyncApiSuffix,N as buildDeepLinkUrl,M as buildGraphqlSuffix,j as buildOpenApiFieldSuffix,F as buildOpenApiSectionSuffix,m as deepLinkToId,P as extractDeepLinkParamFromHash,z as getDeepLinkId,_ as getLegacyHash,W as hashIsForItem,X as hashIsInsideCallback,Y as hashIsOutsideCallbacks,J as hashTargetsCallback,C as hashToElementId,v as isGraphqlDeepLinkAncestor,b as makeDeepLink,Z as resolveLegacyHashToRoute,h as serializeFieldParams,U as stripArrayMarkers,Q as stripCallbacksSegment,G as stripVariantMarkers,V as variantMarkersOnly};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const x={"x-circular-ref":!0,"x-complex":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-badges":!0,"x-hideReplay":!0,"x-feedback":!0,"x-assertionType":!0,"x-rbac":!0,"x-seo":!0};function
|
|
1
|
+
const x={"x-circular-ref":!0,"x-complex":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-badges":!0,"x-hideReplay":!0,"x-feedback":!0,"x-assertionType":!0,"x-rbac":!0,"x-seo":!0,"x-keywords":!0,"x-mcp":!0,"x-metadata":!0,"x-summary":!0,"x-tags":!0,"x-usePkce":!0,"x-webhooks":!0};function a(r){return r in x}function n(r,t){return Object.keys(r).filter(e=>t===!0?e.startsWith("x-")&&!a(e):e.startsWith("x-")&&t.indexOf(e)>-1).reduce((e,u)=>(e[u]=r[u],e),{})}function i(r,t){return t===!1||t===void 0?{}:n(r,t)}export{n as extractExtensions,i as getExtensionsForDisplay,a as isRedocExtension};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type XLogo = {
|
|
2
|
+
url?: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
altText?: string;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export type LogoConfig = XLogo;
|
|
8
|
+
/**
|
|
9
|
+
* Derives the sidebar logo config from the definition's `info['x-logo']`
|
|
10
|
+
* extension, falling back to `info.contact.url` for the link.
|
|
11
|
+
*/
|
|
12
|
+
export declare function logoFromDefinition(definition: Record<string, unknown> | string | undefined): LogoConfig | undefined;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(n){if(typeof n=="string")return;const r=n?.info,o=r?.["x-logo"];if(!o?.url)return;const t=r?.contact;return{url:o.url,href:o.href||t?.url,altText:o.altText,backgroundColor:o.backgroundColor}}export{e as logoFromDefinition};
|