@redocly/asyncapi-docs 1.4.0-rc.2 → 1.5.0-custom.3
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,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var T=Object.create;var p=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var z=(o,n)=>{for(var t in n)p(o,t,{get:n[t],enumerable:!0})},b=(o,n,t,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of $(n))!k.call(o,r)&&r!==t&&p(o,r,{get:()=>n[r],enumerable:!(l=_(n,r))||l.enumerable});return o};var D=(o,n,t)=>(t=o!=null?T(j(o)):{},b(n||!o||!o.__esModule?p(t,"default",{value:o,enumerable:!0}):t,o)),F=o=>b(p({},"__esModule",{value:!0}),o);var B={};z(B,{Message:()=>R});module.exports=F(B);var e=require("react/jsx-runtime"),h=require("react"),v=D(require("styled-components")),i=require("@redocly/theme"),u=require("jotai"),a=require("@redocly/openapi-docs"),m=require("./common"),g=require("./JsonSchema"),y=require("../utils"),L=require("../hooks"),d=require("../jotai-store/app");const R=(0,h.memo)(({message:o,sectionId:n,id:t,onOneOfChange:l})=>{var r;const c=(0,u.useAtomValue)(d.routingBasePathAtom),s=(0,u.useAtomValue)(d.definitionAtom),{getProtocolLabel:P}=(0,L.useProtocolLabels)(),x=(0,h.useMemo)(()=>{var f;if(!((f=s?.components)===null||f===void 0)&&f.schemas)return{openapi:"3.0.0",info:{version:"1",title:"AsyncAPI",description:""},paths:{},components:{schemas:s.components.schemas}}},[(r=s?.components)===null||r===void 0?void 0:r.schemas]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(m.Information,{summary:o.summary,description:o.description,externalDocs:o.externalDocs}),o.headers&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(A,{children:[(0,e.jsx)(m.LinkToField,{to:(0,i.combineUrls)(c,(0,a.makeDeepLink)(n,`messages&m=${t}/headers`))}),"Headers"]}),(0,e.jsx)(g.JsonSchema,{schema:(0,y.getSchema)(o.headers),schemaResolved:x,slug:(0,i.combineUrls)(c,(0,a.makeDeepLink)(n,`messages&m=${t}&t=headers`))})]}),o.payload&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(A,{children:[(0,e.jsx)(m.LinkToField,{to:(0,i.combineUrls)(c,(0,a.makeDeepLink)(n,`messages&m=${t}/payload`))}),P("payload"),o.contentType&&(0,e.jsx)(w,{children:o.contentType})]}),(0,e.jsx)(g.JsonSchema,{onOneOfChange:l,schema:(0,y.getSchema)(o.payload),schemaResolved:x,slug:(0,i.combineUrls)(c,(0,a.makeDeepLink)(n,`messages&m=${t}&t=payload`))})]})]})}),A=(0,v.default)(i.H4)`
|
|
2
2
|
margin: var(--spacing-md) 0 0 0;
|
|
3
3
|
font-size: 18px;
|
|
4
4
|
position: relative;
|
|
@@ -8,7 +8,7 @@ var b=Object.create;var l=Object.defineProperty;var L=Object.getOwnPropertyDescr
|
|
|
8
8
|
visibility: visible;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
`,
|
|
11
|
+
`,w=v.default.span`
|
|
12
12
|
margin: 0px var(--spacing-xs);
|
|
13
13
|
color: var(--text-color-primary);
|
|
14
14
|
line-height: var(--line-height-lg);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
1
|
+
var U=Object.create;var k=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var Z=(e,s)=>{for(var r in s)k(e,r,{get:s[r],enumerable:!0})},R=(e,s,r,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let p of Q(s))!Y.call(e,p)&&p!==r&&k(e,p,{get:()=>s[p],enumerable:!(m=J(s,p))||m.enumerable});return e};var T=(e,s,r)=>(r=e!=null?U(X(e)):{},R(s||!e||!e.__esModule?k(r,"default",{value:e,enumerable:!0}):r,e)),ee=e=>R(k({},"__esModule",{value:!0}),e);var le={};Z(le,{MessageSection:()=>ae});module.exports=ee(le);var n=require("react/jsx-runtime"),f=T(require("styled-components")),S=require("jotai"),B=require("react-router-dom"),i=require("@redocly/openapi-docs"),l=require("@redocly/theme"),a=T(require("react")),oe=T(require("openapi-sampler")),W=require("./SamplesPanel"),z=require("./MessageBinding"),H=require("./MessageReferences"),v=require("../jotai-store/app"),F=require("./Message"),M=require("../utils"),_=require("./common"),K=require("../hooks");const ne=3,ae=a.default.memo(({messages:e,id:s})=>{var r;const m=(0,B.useLocation)(),p=(0,a.useMemo)(()=>e.find(o=>(0,i.pathIncludesLink)(m,`m=${o.key}`))||e[0],[e,m]),[c,E]=(0,a.useState)(p),[b,w]=(0,a.useState)(c.value.payload),N=(0,a.useCallback)(o=>{const t=(0,M.modifyPayload)(b,o);t&&w(t)},[]),u=(0,S.useAtomValue)(v.definitionAtom),V=(0,a.useCallback)(()=>{var o;return c.value.examples||[{payload:oe.sample(Object.assign({},(0,M.getSchema)(b)),{},!((o=u?.components)===null||o===void 0)&&o.schemas?{components:{schemas:u.components.schemas}}:void 0)}]},[b,c.value.examples,(r=u?.components)===null||r===void 0?void 0:r.schemas]),A=(0,S.useAtomValue)(v.layoutAtom),g=(0,S.useAtomValue)(v.routingBasePathAtom),P=A===l.LayoutVariant.STACKED,y=(0,a.useMemo)(()=>e.map(o=>({label:o.value.title||o.value.name||o.key,value:o.key})),[e]),[x,q]=(0,a.useState)(!1),L=(0,a.useRef)(null),I=(0,K.useTelemetry)();(0,a.useEffect)(()=>{var o;const t=e.find(d=>(0,i.pathIncludesLink)(m,`m=${d.key}`));t&&(E(t),!((o=t?.value)===null||o===void 0)&&o.payload&&w(t.value.payload))},[m,e]);const O=(0,a.useCallback)(({value:o})=>{var t;const d=e.find(h=>h.key===o);d&&(I.sendAsyncapiDocsSwitchMessageClickedMessage({message:d.key}),E(d),!((t=d?.value)===null||t===void 0)&&t.payload&&w(d.value.payload))},[e,I]),C=(0,a.useMemo)(()=>Object.entries(c.value.bindings||{}).map(([o,t])=>({key:o,value:t})),[c.value.bindings]),j=(0,a.useMemo)(()=>(0,l.combineUrls)(g,(0,i.makeDeepLink)(s,`messages&m=${c.key}`)),[s,g,c.key]);(0,a.useEffect)(()=>{if(!L.current)return;const o=()=>{var t;const d=(t=L.current)===null||t===void 0?void 0:t.querySelectorAll('button[role="tab"]'),h=Array.from(d||[]).some(D=>D.offsetWidth<D.scrollWidth);h!==x&&q(h)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[x,y]);const G=(0,a.useMemo)(()=>(0,l.combineUrls)(g,(0,i.makeDeepLink)(s,"messages")),[s,g]);return(0,n.jsxs)(te,{"data-component-name":"MessageSection/MessageSection",children:[(0,n.jsx)(i.Row,{layout:A,children:(0,n.jsxs)(i.SamplesMiddlePanel,{isStacked:P,children:[(0,n.jsxs)(se,{children:[(0,n.jsx)(_.LinkToField,{to:G}),"Messages"]}),e.length>1?(0,n.jsxs)($,{children:["Accepts ",(0,n.jsx)("span",{children:"one of"})," the following messages:"]}):(0,n.jsx)($,{children:"Accepts the following message:"})]})}),(0,n.jsxs)(i.Row,{layout:A,children:[(0,n.jsxs)(i.SamplesMiddlePanel,{isStacked:P,children:[(0,n.jsxs)(ie,{children:[(0,n.jsx)(_.LinkToField,{to:j}),y.length>ne||x?(0,n.jsx)(i.Dropdown,{options:y,value:c.key,onChange:O}):(0,n.jsx)(l.Segmented,{ref:L,size:"small",value:c.key,options:y,onChange:O})]}),(0,n.jsx)(F.Message,{message:c.value,sectionId:s,id:c.key,onOneOfChange:N})]}),(0,n.jsxs)(i.OperationSamplesPanel,{isStacked:P,className:"panel-container-response-samples",children:[(0,n.jsx)(W.SamplesPanel,{examples:V()}),!!C.length&&(0,n.jsx)(z.MessageBinding,{binding:C[0],slug:j}),(0,n.jsx)(H.MessageReferences,{messageKey:c.key})]})]})]})}),te=f.default.div`
|
|
2
2
|
padding: var(--spacing-xl) 0 0 0;
|
|
3
|
-
`,
|
|
3
|
+
`,se=(0,f.default)(l.H4)`
|
|
4
4
|
margin: 0 0 var(--spacing-xs) 0;
|
|
5
5
|
position: relative;
|
|
6
6
|
:hover {
|
|
7
|
-
${
|
|
7
|
+
${l.LinkIcon} {
|
|
8
8
|
opacity: 1;
|
|
9
9
|
visibility: visible;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
`,$=(0,f.default)(l.Typography)`
|
|
13
13
|
& > span {
|
|
14
14
|
font-weight: var(--font-weight-bold);
|
|
15
15
|
}
|
|
16
16
|
margin: 0 0 var(--spacing-sm) 0;
|
|
17
|
-
`,
|
|
17
|
+
`,ie=f.default.div`
|
|
18
18
|
position: relative;
|
|
19
19
|
:hover {
|
|
20
|
-
${
|
|
20
|
+
${l.LinkIcon} {
|
|
21
21
|
opacity: 1;
|
|
22
22
|
visibility: visible;
|
|
23
23
|
}
|
package/lib/utils/get-schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty;var
|
|
1
|
+
var t=Object.defineProperty;var e=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(o,a)=>{for(var n in a)t(o,n,{get:a[n],enumerable:!0})},h=(o,a,n,c)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of s(a))!m.call(o,r)&&r!==n&&t(o,r,{get:()=>a[r],enumerable:!(c=e(a,r))||c.enumerable});return o};var f=o=>h(t({},"__esModule",{value:!0}),o);var A={};p(A,{getSchema:()=>v});module.exports=f(A);var i=require("./avro-to-json-schema");const d=["application/vnd.apache.avro","application/vnd.apache.avro+json","application/vnd.apache.avro+yaml"];function S(o){return o?d.some(a=>o.startsWith(a)):!1}const v=o=>o?.schema?S(o.schemaFormat)?(0,i.avroToJsonSchema)(o.schema):o.schema:o;0&&(module.exports={getSchema});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/asyncapi-docs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-custom.3",
|
|
4
4
|
"description": "Async API docs for Redocly Realm",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@testing-library/react": "16.3.0",
|
|
20
20
|
"@types/jest": "29.5.11",
|
|
21
21
|
"@types/json-schema": "^7.0.15",
|
|
22
|
-
"@types/node": "22.
|
|
22
|
+
"@types/node": "22.18.13",
|
|
23
23
|
"@types/react": "^19.1.4",
|
|
24
24
|
"@types/styled-components": "5.1.34",
|
|
25
25
|
"esbuild-minify-dir": "^0.0.1",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@markdoc/markdoc": "0.5.2",
|
|
37
37
|
"jotai": "^2.11.1",
|
|
38
|
-
"openapi-sampler": "
|
|
38
|
+
"openapi-sampler": "1.6.2",
|
|
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.16.0-custom.3",
|
|
43
|
+
"@redocly/config": "0.38.0-custom.0",
|
|
44
|
+
"@redocly/theme": "0.60.0-custom.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^19.1.0"
|