@redocly/asyncapi-docs 1.2.0-next.2 → 1.2.0-next.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiInfo=void 0;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiInfo=void 0;const t=require("react/jsx-runtime"),n=require("jotai"),o=require("@redocly/openapi-docs"),d=require("@redocly/theme"),r=require("./common"),s=require("../jotai-store/app"),l=require("../hooks"),m=()=>{const e=(0,n.useAtomValue)(s.definitionAtom),i=(0,n.useAtomValue)(s.routingBasePathAtom),c=(0,n.useAtomValue)(s.markdocOptionsAtom),u=(0,l.useTranslate)(),a=(0,o.saveTextBeforeHeading)((0,o.getValueFromMdParsedExtension)(e.info,"description")||"");return(0,t.jsxs)(o.Section,{sectionId:i,children:[(0,t.jsxs)(r.ApiHeader,{children:[e.info.title," ",e.info.version,(0,t.jsx)(d.PageActions,{pageSlug:i})]}),a&&(0,t.jsx)(o.Markdown,{source:a,markdocOptions:c}),e.info.externalDocs&&(0,t.jsx)(r.ExternalDocumentationWrapper,{children:(0,t.jsx)(o.ExternalDocumentation,{externalDocs:e.info.externalDocs})}),e.info["x-metadata"]&&(0,t.jsx)(o.Metadata,{metadata:e.info["x-metadata"],translate:u})]})};exports.ApiInfo=m;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=exports&&exports.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.DownloadSpecification=void 0;const e=require("react/jsx-runtime"),i=require("react"),r=u(require("styled-components")),n=require("@redocly/theme"),p=require("@redocly/openapi-docs"),f=require("jotai"),m=require("../jotai-store/app"),x=require("../hooks");function w(){const o=(0,x.useTelemetry)(),c=(0,f.useAtomValue)(m.downloadUrlsAtom),a=(0,p.useDownloadInfo)({downloadUrls:c}),l=(0,i.useCallback)(t=>{switch(t){case"yaml":return(0,e.jsx)(n.DocumentIcon,{});case"json":return(0,e.jsx)(n.JsonIcon,{});default:return(0,e.jsx)(n.FileIcon,{})}},[]);return a?(0,e.jsx)(h,{children:(a||[]).map(({title:t,url:s,iconType:d})=>(0,e.jsxs)(_,{onClick:()=>o.send({type:"asyncapi_docs.download_definition.clicked"}),children:[(0,e.jsxs)(b,{children:[l(d),(0,e.jsx)("a",{href:s,target:"_blank",download:!0,rel:"noreferrer",children:t})]}),(0,e.jsx)("a",{href:s,target:"_blank",download:!0,rel:"noreferrer",children:(0,e.jsx)(n.Button,{variant:"text",size:"small",icon:(0,e.jsx)(n.DownloadIcon,{})})})]},t))}):(0,e.jsx)(e.Fragment,{})}exports.DownloadSpecification=(0,i.memo)(w);const _=r.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: baseline;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
padding-bottom: 0px;
|
|
11
11
|
border-bottom: none;
|
|
12
12
|
}
|
|
13
|
-
`,
|
|
13
|
+
`,b=r.default.span`
|
|
14
14
|
display: flex;
|
|
15
15
|
width: calc(100% - 25px);
|
|
16
16
|
gap: var(--spacing-xs);
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
white-space: nowrap;
|
|
30
30
|
}
|
|
31
|
-
`,
|
|
31
|
+
`,h=r.default.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
align-items: center;
|
|
34
34
|
align-self: flex-start;
|
package/lib/components/Server.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var x=exports&&exports.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Server=void 0;const e=require("react/jsx-runtime"),s=x(require("styled-components")),n=require("@redocly/theme"),f=require("react"),h=require("./ServerModal"),o=require("./common"),v=require("../hooks"),g=({server:t,showDetails:l})=>{const[r,i]=(0,f.useState)(!1),c=(0,v.useTelemetry)();(0,n.useModalScrollLock)(r);const d=a=>{switch(a){case"kafka":return(0,e.jsx)(n.KafkaIcon,{size:"20px"});case"amqp":return(0,e.jsx)(n.RabbitMQIcon,{size:"20px"});default:return(0,e.jsx)(n.DatabaseIcon,{size:"20px"})}},p=()=>{i(!0),c.send({type:"asyncapi_docs.server_modal.opened"})};return(0,e.jsxs)(m,{"data-component-name":"Server/Server",children:[(0,e.jsxs)(_,{children:[(0,e.jsx)(j,{children:d(t.value.protocol)}),(0,e.jsx)(S,{children:t.key})]}),(0,e.jsxs)(y,{children:[(0,e.jsx)(o.HostList,{children:t.value.host.split(" ").map((a,u)=>(0,e.jsx)("span",{children:a},u))}),(0,e.jsx)(n.CopyButton,{data:t.value.host},t.value.host)]}),l&&(0,e.jsx)(M,{onClick:p,children:(0,e.jsx)(o.MoreDetailsButton,{expanded:!1})}),r&&(0,e.jsx)(n.Portal,{mountId:"api-content",children:(0,e.jsx)(h.ServerModal,{server:t,onClose:()=>i(!1)})})]})};exports.Server=g;const m=s.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-xxs);
|
|
5
5
|
padding: var(--spacing-sm) var(--spacing-md);
|
|
6
|
-
`,
|
|
6
|
+
`,j=s.default.div`
|
|
7
7
|
width: 20px;
|
|
8
8
|
height: 20px;
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
11
11
|
justify-content: center;
|
|
12
|
-
`,
|
|
12
|
+
`,_=s.default.div`
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: row;
|
|
15
15
|
align-items: center;
|
|
16
16
|
gap: var(--spacing-xxs);
|
|
17
|
-
`,
|
|
17
|
+
`,y=s.default.span`
|
|
18
18
|
padding-left: var(--spacing-lg);
|
|
19
19
|
min-height: 24px;
|
|
20
20
|
display: flex;
|
|
21
21
|
align-items: center;
|
|
22
22
|
justify-content: space-between;
|
|
23
|
-
`,
|
|
23
|
+
`,S=s.default.span`
|
|
24
24
|
font-weight: var(--font-weight-semibold);
|
|
25
25
|
text-transform: capitalize;
|
|
26
|
-
`,
|
|
26
|
+
`,M=s.default.div`
|
|
27
27
|
padding-left: var(--spacing-lg);
|
|
28
28
|
`;
|
package/lib/types/async-api.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { ENTITY_RELATION_TYPES } from '@redocly/theme';
|
|
1
2
|
import type { Node } from '@markdoc/markdoc';
|
|
2
3
|
import type { ResolvedNavItem, REDOCLY_TEAMS_RBAC } from '@redocly/config';
|
|
3
4
|
import type { JSONSchema7 } from 'json-schema';
|
|
4
5
|
import type { ApiItemData } from './apiItem';
|
|
6
|
+
export type Referenced<T> = T | {
|
|
7
|
+
$ref: string;
|
|
8
|
+
};
|
|
5
9
|
export interface AsyncApiDefinition {
|
|
6
10
|
asyncapi: string;
|
|
7
11
|
id?: string;
|
|
@@ -17,6 +21,21 @@ export interface AsyncApiDefinition {
|
|
|
17
21
|
[REDOCLY_TEAMS_RBAC]?: Record<string, string>;
|
|
18
22
|
}[];
|
|
19
23
|
}
|
|
24
|
+
export interface AsyncApiDefinitionReferenced {
|
|
25
|
+
asyncapi: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
info: AsyncApiInfo;
|
|
28
|
+
servers?: Record<string, AsyncApiServer>;
|
|
29
|
+
defaultContentType?: string;
|
|
30
|
+
channels?: AsyncApiChannels;
|
|
31
|
+
operations?: AsyncApiOperationsReferenced;
|
|
32
|
+
components?: AsyncApiComponentsReferenced;
|
|
33
|
+
'x-tagGroups'?: {
|
|
34
|
+
name: string;
|
|
35
|
+
tags: string[];
|
|
36
|
+
[REDOCLY_TEAMS_RBAC]?: Record<string, string>;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
20
39
|
export interface AsyncApiInfo {
|
|
21
40
|
title: string;
|
|
22
41
|
version: string;
|
|
@@ -135,8 +154,22 @@ export interface AsyncApiParameter {
|
|
|
135
154
|
location?: string;
|
|
136
155
|
}
|
|
137
156
|
export interface AsyncApiMessage {
|
|
138
|
-
headers?:
|
|
139
|
-
payload?:
|
|
157
|
+
headers?: AsyncAPISchema;
|
|
158
|
+
payload?: AsyncAPISchema;
|
|
159
|
+
correlationId?: AsyncApiCorrelationId;
|
|
160
|
+
contentType?: string;
|
|
161
|
+
name?: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
summary?: string;
|
|
164
|
+
description?: string;
|
|
165
|
+
tags?: AsyncApiTag[];
|
|
166
|
+
externalDocs?: AsyncApiExternalDocs;
|
|
167
|
+
bindings?: AsyncApiMessageBinding;
|
|
168
|
+
examples?: AsyncApiMessageExample[];
|
|
169
|
+
}
|
|
170
|
+
export interface AsyncApiMessageReferenced {
|
|
171
|
+
headers?: AsyncAPISchema;
|
|
172
|
+
payload?: Referenced<AsyncAPISchema>;
|
|
140
173
|
correlationId?: AsyncApiCorrelationId;
|
|
141
174
|
contentType?: string;
|
|
142
175
|
name?: string;
|
|
@@ -174,6 +207,9 @@ export interface MultiFormatSchemaObject {
|
|
|
174
207
|
export interface AsyncApiOperations {
|
|
175
208
|
[name: string]: AsyncApiOperation;
|
|
176
209
|
}
|
|
210
|
+
export interface AsyncApiOperationsReferenced {
|
|
211
|
+
[name: string]: AsyncApiOperationReferenced;
|
|
212
|
+
}
|
|
177
213
|
export interface AsyncApiOperation {
|
|
178
214
|
action: 'send' | 'receive';
|
|
179
215
|
channel: AsyncApiChannel;
|
|
@@ -187,7 +223,29 @@ export interface AsyncApiOperation {
|
|
|
187
223
|
messages?: AsyncApiMessage[];
|
|
188
224
|
reply?: AsyncApiOperationReply;
|
|
189
225
|
'x-badges'?: AsyncApiXBadges[];
|
|
190
|
-
'x-
|
|
226
|
+
'x-catalog-relations'?: {
|
|
227
|
+
type: (typeof ENTITY_RELATION_TYPES)[number];
|
|
228
|
+
key: string;
|
|
229
|
+
}[];
|
|
230
|
+
[REDOCLY_TEAMS_RBAC]?: Record<string, string>;
|
|
231
|
+
}
|
|
232
|
+
export interface AsyncApiOperationReferenced {
|
|
233
|
+
action: 'send' | 'receive';
|
|
234
|
+
channel: AsyncApiChannel;
|
|
235
|
+
title?: string;
|
|
236
|
+
summary?: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
tags?: AsyncApiTag[];
|
|
239
|
+
externalDocs?: AsyncApiExternalDocs;
|
|
240
|
+
bindings?: AsyncApiOperationBinding;
|
|
241
|
+
traits?: AsyncApiOperationTraits[];
|
|
242
|
+
messages?: Referenced<AsyncApiMessage>[];
|
|
243
|
+
reply?: AsyncApiOperationReply;
|
|
244
|
+
'x-badges'?: AsyncApiXBadges[];
|
|
245
|
+
'x-catalog-relations'?: {
|
|
246
|
+
type: (typeof ENTITY_RELATION_TYPES)[number];
|
|
247
|
+
key: string;
|
|
248
|
+
}[];
|
|
191
249
|
[REDOCLY_TEAMS_RBAC]?: Record<string, string>;
|
|
192
250
|
}
|
|
193
251
|
export interface AsyncApiOperationReply {
|
|
@@ -222,6 +280,12 @@ export interface AsyncApiOperationKafkaBinding {
|
|
|
222
280
|
}
|
|
223
281
|
export interface AsyncApiComponents {
|
|
224
282
|
messages: Record<string, AsyncApiMessage>;
|
|
283
|
+
schemas: Record<string, AsyncAPISchema>;
|
|
284
|
+
tags: Record<string, AsyncApiTag>;
|
|
285
|
+
}
|
|
286
|
+
export interface AsyncApiComponentsReferenced {
|
|
287
|
+
messages: Record<string, AsyncApiMessageReferenced>;
|
|
288
|
+
schemas: Record<string, AsyncAPISchema>;
|
|
225
289
|
tags: Record<string, AsyncApiTag>;
|
|
226
290
|
}
|
|
227
291
|
export interface AvroSchema {
|
|
@@ -251,3 +315,4 @@ export type DownloadUrls = {
|
|
|
251
315
|
export type ChannelWithKey = AsyncApiChannel & {
|
|
252
316
|
key: string;
|
|
253
317
|
};
|
|
318
|
+
export type AsyncAPISchema = JSONSchema7 | MultiFormatSchemaObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/asyncapi-docs",
|
|
3
|
-
"version": "1.2.0-next.
|
|
3
|
+
"version": "1.2.0-next.4",
|
|
4
4
|
"description": "Async API docs for Redocly Realm",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"react-router-dom": "^6.21.1",
|
|
40
40
|
"styled-components": "5.3.11",
|
|
41
41
|
"web-vitals": "3.3.1",
|
|
42
|
-
"@redocly/
|
|
43
|
-
"@redocly/
|
|
44
|
-
"@redocly/
|
|
42
|
+
"@redocly/openapi-docs": "3.13.0-next.4",
|
|
43
|
+
"@redocly/theme": "0.57.0-next.3",
|
|
44
|
+
"@redocly/config": "0.28.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^19.1.0"
|