@redocly/api-docs 0.2.0-next.4 → 0.2.0-next.6
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/adapters/asyncapi/items/overview/content.js +1 -1
- package/lib/adapters/graphql/utils/createApiItem.js +1 -1
- package/lib/adapters/helpers.d.ts +2 -0
- package/lib/adapters/helpers.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/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/store.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 +1 -1
- package/lib/components/ItemContent/sections/MessagesSection.js +1 -1
- package/lib/components/Schema/styled.js +4 -4
- package/lib/components/Schema/views/ArrayRenderer.js +1 -1
- package/lib/components/Search/index.d.ts +15 -0
- package/lib/components/Search/index.js +1 -0
- 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/panels/ExampleItem/CallbackPayloadItem.js +2 -2
- package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/PayloadExampleItem.js +2 -2
- 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/selectors.d.ts +5 -2
- package/lib/components/panels/ExampleItem/selectors.js +1 -1
- package/lib/components/panels/ExampleItem/styled.d.ts +2 -49
- package/lib/components/panels/ExampleItem/styled.js +11 -5
- 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/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/pluggable/RedocExample.js +5 -2
- package/lib/hoc/withStoreProvider.js +1 -1
- package/lib/hooks/useInitialTelemetry.d.ts +2 -0
- package/lib/hooks/useInitialTelemetry.js +1 -0
- package/lib/hooks/useScrollSpyUrlSync.js +1 -1
- package/lib/index.d.ts +3 -0
- 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/itemStore.d.ts +1 -0
- package/lib/jotai/itemStore.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 -1
- package/lib/options/normalizeOptions.d.ts +1 -1
- package/lib/options/normalizeOptions.js +1 -1
- 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.d.ts +3 -5
- package/lib/services/code-samples/builder.js +1 -1
- package/lib/services/code-samples/discriminator.d.ts +16 -10
- package/lib/services/code-samples/discriminator.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.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/resolvers.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/operation-samples/index.js +1 -1
- package/lib/services/schema/dialects/jsonSchema.d.ts +5 -1
- package/lib/services/schema/dialects/jsonSchema.js +1 -1
- package/lib/services/schema/propertyTreeBuilder.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/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 +2 -1
- 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 +27 -85
- package/lib/types/store.d.ts +1 -1
- 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/scroll-anchoring.d.ts +2 -1
- package/lib/utils/x-logo.d.ts +13 -0
- package/lib/utils/x-logo.js +1 -0
- package/package.json +28 -7
- package/lib/services/code-samples/replay/normalize-servers.js +0 -1
|
@@ -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';
|
|
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,7 +87,6 @@ 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;
|
|
@@ -80,25 +94,19 @@ export type ApiDocsOptions = {
|
|
|
80
94
|
hideLoading: boolean;
|
|
81
95
|
skipBundle: boolean;
|
|
82
96
|
hideSidebar: boolean;
|
|
97
|
+
hideSearch: boolean;
|
|
83
98
|
basePath: string;
|
|
84
99
|
specType: ApiSpecType;
|
|
85
|
-
licenseKey?: string;
|
|
86
100
|
metadata: ApiDocsMetadata;
|
|
87
101
|
downloadUrls?: NormalizedDownloadUrl[];
|
|
88
102
|
layout: LayoutVariant;
|
|
89
|
-
feedback: NonNullable<RedocConfig['feedback']>;
|
|
90
|
-
mockServer?: {
|
|
91
|
-
url: string;
|
|
92
|
-
position: 'first' | 'last' | 'replace' | 'off';
|
|
93
|
-
description: string;
|
|
94
|
-
};
|
|
95
103
|
apiLogo?: SidebarLogo;
|
|
96
104
|
jsonSamplesDepth: number;
|
|
97
105
|
samplesMaxInlineArgs: number;
|
|
98
106
|
fieldExpandLevel: number;
|
|
99
107
|
baseUrlPath?: string;
|
|
100
108
|
} & GraphQLOptions;
|
|
101
|
-
export type RawApiDocsOptions =
|
|
109
|
+
export type RawApiDocsOptions = EditionRedocConfig & EditionAsyncApiConfig & EditionGraphQLConfig & {
|
|
102
110
|
specType: ApiSpecType;
|
|
103
111
|
markdownParser: MarkdownParser;
|
|
104
112
|
basePath?: string;
|
|
@@ -107,77 +115,12 @@ export type RawApiDocsOptions = RedocConfig & AsyncApiConfig & GraphQLConfig & {
|
|
|
107
115
|
licenseKey?: string;
|
|
108
116
|
protocol?: ProtocolVariant;
|
|
109
117
|
excludeFromSearch?: boolean;
|
|
118
|
+
/** Hides the standalone sidebar search. Portal embeds have their own search. */
|
|
119
|
+
hideSearch?: boolean;
|
|
110
120
|
dynamicRequestValues?: ConfigureRequestValues | ConfigureServerRequestValues;
|
|
111
121
|
userClaims?: UserClaims;
|
|
112
|
-
layout?:
|
|
122
|
+
layout?: EditionRedocConfig['layout'] | EditionAsyncApiConfig['layout'] | EditionGraphQLConfig['layout'];
|
|
113
123
|
};
|
|
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
124
|
export type Normalized<T> = {
|
|
182
125
|
[P in keyof T]-?: T[P];
|
|
183
126
|
};
|
|
@@ -257,4 +200,3 @@ export type HooksConfig = {
|
|
|
257
200
|
MiddlePanelFooter?: HookConfig<undefined>;
|
|
258
201
|
MiddlePanelHeader?: HookConfig<undefined>;
|
|
259
202
|
};
|
|
260
|
-
export {};
|
package/lib/types/store.d.ts
CHANGED
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};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/** Keeps the section under the reading line in view across a content-height swap
|
|
2
|
-
* (response code, oneOf, media type). Call synchronously from
|
|
2
|
+
* (response code, oneOf, media type, example selection). Call synchronously from
|
|
3
|
+
* the state write. */
|
|
3
4
|
export declare function keepReadingSectionAnchored(): void;
|
|
@@ -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> | undefined): LogoConfig | undefined;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function c(r){const n=r?.info,o=n?.["x-logo"];if(!o?.url)return;const t=n?.contact;return{url:o.url,href:o.href||t?.url,altText:o.altText,backgroundColor:o.backgroundColor}}export{c as logoFromDefinition};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/api-docs",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.6",
|
|
4
4
|
"description": "Redocly API Documentation Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -49,12 +49,15 @@
|
|
|
49
49
|
"url-template": "^2.0.8",
|
|
50
50
|
"web-vitals": "3.3.1",
|
|
51
51
|
"@redocly/allof-merge": "0.6.9",
|
|
52
|
-
"@redocly/config": "0.
|
|
53
|
-
"@redocly/redoc-opentelemetry": "0.2.
|
|
54
|
-
"@redocly/replay": "0.28.0-next.
|
|
55
|
-
"@redocly/theme": "^0.69.0-next.
|
|
52
|
+
"@redocly/config": "0.54.0",
|
|
53
|
+
"@redocly/redoc-opentelemetry": "0.2.4",
|
|
54
|
+
"@redocly/replay": "0.28.0-next.6",
|
|
55
|
+
"@redocly/theme": "^0.69.0-next.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
+
"@microsoft/api-extractor": "7.58.2",
|
|
59
|
+
"@playwright/test": "1.60.0",
|
|
60
|
+
"@redocly/ajv": "8.18.0",
|
|
58
61
|
"@testing-library/jest-dom": "6.6.3",
|
|
59
62
|
"@testing-library/react": "16.3.0",
|
|
60
63
|
"@types/js-yaml": "4.0.9",
|
|
@@ -64,11 +67,13 @@
|
|
|
64
67
|
"@types/react": "^19.2.7",
|
|
65
68
|
"@types/react-dom": "^19.2.3",
|
|
66
69
|
"@types/swagger2openapi": "^7.0.4",
|
|
67
|
-
"@vitejs/plugin-react
|
|
70
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
68
71
|
"@vitest/browser-playwright": "4.1.10",
|
|
69
72
|
"@vitest/coverage-v8": "4.1.10",
|
|
70
73
|
"esbuild": "0.28.1",
|
|
74
|
+
"flexsearch": "^0.8.2",
|
|
71
75
|
"globals": "^16.5.0",
|
|
76
|
+
"http-server": "14.1.1",
|
|
72
77
|
"jest-styled-components": "7.2.0",
|
|
73
78
|
"react": "^19.2.7",
|
|
74
79
|
"react-dom": "^19.2.7",
|
|
@@ -77,10 +82,19 @@
|
|
|
77
82
|
"tsx": "^4.20.6",
|
|
78
83
|
"typescript": "6.0.3",
|
|
79
84
|
"url": "~0.11.0",
|
|
80
|
-
"vite": "
|
|
85
|
+
"vite": "8.1.0",
|
|
81
86
|
"vitest": "4.1.10",
|
|
82
87
|
"vitest-browser-react": "^2.0.2"
|
|
83
88
|
},
|
|
89
|
+
"nx": {
|
|
90
|
+
"targets": {
|
|
91
|
+
"vitest:test": {
|
|
92
|
+
"dependsOn": [
|
|
93
|
+
"build"
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
84
98
|
"scripts": {
|
|
85
99
|
"start": "vite --open /docs",
|
|
86
100
|
"build": "pnpm run clean && pnpm run ts:check && pnpm run build:lib && pnpm run build:standalone && pnpm run build:minify",
|
|
@@ -90,10 +104,17 @@
|
|
|
90
104
|
"analyze:bundle": "vite build --mode analyze",
|
|
91
105
|
"watch": "tsgo -w -p tsconfig.build.json",
|
|
92
106
|
"clean": "rimraf bundle lib",
|
|
107
|
+
"prepare:community-source": "tsx ./scripts/prepare-community-source.ts",
|
|
108
|
+
"prepare:community-dependencies": "tsx ./scripts/prepare-community-dependencies.ts",
|
|
109
|
+
"apply:community-source": "tsx ./scripts/apply-changes-from-community-source.ts",
|
|
110
|
+
"stage:ce": "pnpm run prepare:community-dependencies && pnpm run prepare:community-source",
|
|
111
|
+
"e2e:ce": "pnpm run stage:ce && cd redoc && REDOC_THEME_PATH=../../theme/src npm run e2e",
|
|
112
|
+
"lint:ce": "cd redoc && test -d src && test -d e2e && test -f vitest.setup.ts && find src e2e vitest.setup.ts -type f \\( -name '*.ts' -o -name '*.tsx' -o -name '*.cts' -o -name '*.mts' \\) -print0 | xargs -0 ./node_modules/.bin/oxlint --max-warnings=0",
|
|
93
113
|
"test": "nx run vitest:test",
|
|
94
114
|
"test:update": "nx run vitest:test -u --skip-nx-cache",
|
|
95
115
|
"test:coverage:html": "nx run vitest:test --coverage --coverage.reporter=html --exclude 'tools/**'",
|
|
96
116
|
"test:tools": "vitest run tools",
|
|
117
|
+
"test:ce": "pnpm run stage:ce && cd redoc && npm run unit",
|
|
97
118
|
"ts:check": "tsgo -p tsconfig.build.json --noEmit --skipLibCheck"
|
|
98
119
|
}
|
|
99
120
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isAbsoluteUrl as l,removeQueryStringAndHash as o,resolveUrl as s}from"../../../adapters/openapi/utils/helpers.js";import{getUrlDirname as i}from"../../../adapters/openapi/utils/url.js";import{IS_BROWSER as u}from"../../../utils/environments.js";function f(e){const t=o(e);if(!t||t.endsWith("/"))return t;const r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function a(e){return e===void 0?o((()=>{if(!u)return globalThis.SSR_HOSTNAME||"";const r=window.location.href;return r.endsWith(".html")&&i(r)||r})()):l(e)?i(e):f(e)}function m(e,t){const r=a(t);return r?s(r,e):e}function S(e,t){let r=t;return r.length===0&&(r=[{url:"/"}]),r.map(n=>({...n,url:m(n.url,e),description:n.description||""}))}export{S as normalizeServers,m as resolveServerUrl};
|