@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 b=Object.create;var l=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var k=(o,e)=>{for(var t in e)l(o,t,{get:e[t],enumerable:!0})},f=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of T(e))!j.call(o,a)&&a!==t&&l(o,a,{get:()=>e[a],enumerable:!(s=L(e,a))||s.enumerable});return o};var P=(o,e,t)=>(t=o!=null?b($(o)):{},f(e||!o||!o.__esModule?l(t,"default",{value:o,enumerable:!0}):t,o)),z=o=>f(l({},"__esModule",{value:!0}),o);var _={};k(_,{Message:()=>D});module.exports=z(_);var r=require("react/jsx-runtime"),y=require("react"),p=P(require("styled-components")),i=require("@redocly/theme"),d=require("jotai"),n=require("@redocly/openapi-docs"),m=require("./common"),c=require("./JsonSchema"),h=require("../utils"),u=require("../hooks"),v=require("../jotai-store/app");const D=(0,y.memo)(({message:o,sectionId:e,id:t,onOneOfChange:s})=>{const a=(0,d.useAtomValue)(v.routingBasePathAtom),{getProtocolLabel:x}=(0,u.useProtocolLabels)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.Information,{summary:o.summary,description:o.description,externalDocs:o.externalDocs}),o.headers&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(g,{children:[(0,r.jsx)(m.LinkToField,{to:(0,i.combineUrls)(a,(0,n.makeDeepLink)(e,`messages&m=${t}/headers`))}),"Headers"]}),(0,r.jsx)(c.JsonSchema,{schema:(0,h.getSchema)(o.headers),slug:(0,i.combineUrls)(a,(0,n.makeDeepLink)(e,`messages&m=${t}&t=headers`))})]}),o.payload&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(g,{children:[(0,r.jsx)(m.LinkToField,{to:(0,i.combineUrls)(a,(0,n.makeDeepLink)(e,`messages&m=${t}/payload`))}),x("payload"),o.contentType&&(0,r.jsx)(F,{children:o.contentType})]}),(0,r.jsx)(c.JsonSchema,{onOneOfChange:s,schema:(0,h.getSchema)(o.payload),slug:(0,i.combineUrls)(a,(0,n.makeDeepLink)(e,`messages&m=${t}&t=payload`))})]})]})}),g=(0,p.default)(i.H4)`
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
- `,F=p.default.span`
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 q=Object.create;var v=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var X=(e,i)=>{for(var c in i)v(e,c,{get:i[c],enumerable:!0})},j=(e,i,c,p)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of U(i))!Q.call(e,s)&&s!==c&&v(e,s,{get:()=>i[s],enumerable:!(p=G(i,s))||p.enumerable});return e};var x=(e,i,c)=>(c=e!=null?q(J(e)):{},j(i||!e||!e.__esModule?v(c,"default",{value:e,enumerable:!0}):c,e)),Y=e=>j(v({},"__esModule",{value:!0}),e);var se={};X(se,{MessageSection:()=>oe});module.exports=Y(se);var o=require("react/jsx-runtime"),m=x(require("styled-components")),A=require("jotai"),R=require("react-router-dom"),l=require("@redocly/openapi-docs"),r=require("@redocly/theme"),a=x(require("react")),Z=x(require("openapi-sampler")),$=require("./SamplesPanel"),B=require("./MessageBinding"),W=require("./MessageReferences"),y=require("../jotai-store/app"),z=require("./Message"),h=require("../utils"),L=require("./common"),H=require("../hooks");const ee=3,oe=a.default.memo(({messages:e,id:i})=>{const c=(0,R.useLocation)(),p=(0,a.useMemo)(()=>e.find(n=>(0,l.pathIncludesLink)(c,`m=${n.key}`))||e[0],[e,c]),[s,T]=(0,a.useState)(p),[k,S]=(0,a.useState)(s.value.payload),F=(0,a.useCallback)(n=>{const t=(0,h.modifyPayload)(k,n);t&&S(t)},[]),K=(0,a.useCallback)(()=>s.value.examples||[{payload:Z.sample(Object.assign({},(0,h.getSchema)(k)))}],[k,s.value.examples]),M=(0,A.useAtomValue)(y.layoutAtom),u=(0,A.useAtomValue)(y.routingBasePathAtom),b=M===r.LayoutVariant.STACKED,f=(0,a.useMemo)(()=>e.map(n=>({label:n.value.title||n.value.name||n.key,value:n.key})),[e]),[w,N]=(0,a.useState)(!1),P=(0,a.useRef)(null),E=(0,H.useTelemetry)();(0,a.useEffect)(()=>{var n;const t=e.find(d=>(0,l.pathIncludesLink)(c,`m=${d.key}`));t&&(T(t),!((n=t?.value)===null||n===void 0)&&n.payload&&S(t.value.payload))},[c,e]);const I=(0,a.useCallback)(({value:n})=>{var t;const d=e.find(g=>g.key===n);d&&(E.sendAsyncapiDocsSwitchMessageClickedMessage({message:d.key}),T(d),!((t=d?.value)===null||t===void 0)&&t.payload&&S(d.value.payload))},[e,E]),O=(0,a.useMemo)(()=>Object.entries(s.value.bindings||{}).map(([n,t])=>({key:n,value:t})),[s.value.bindings]),C=(0,a.useMemo)(()=>(0,r.combineUrls)(u,(0,l.makeDeepLink)(i,`messages&m=${s.key}`)),[i,u,s.key]);(0,a.useEffect)(()=>{if(!P.current)return;const n=()=>{var t;const d=(t=P.current)===null||t===void 0?void 0:t.querySelectorAll('button[role="tab"]'),g=Array.from(d||[]).some(_=>_.offsetWidth<_.scrollWidth);g!==w&&N(g)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[w,f]);const V=(0,a.useMemo)(()=>(0,r.combineUrls)(u,(0,l.makeDeepLink)(i,"messages")),[i,u]);return(0,o.jsxs)(ae,{"data-component-name":"MessageSection/MessageSection",children:[(0,o.jsx)(l.Row,{layout:M,children:(0,o.jsxs)(l.SamplesMiddlePanel,{isStacked:b,children:[(0,o.jsxs)(ne,{children:[(0,o.jsx)(L.LinkToField,{to:V}),"Messages"]}),e.length>1?(0,o.jsxs)(D,{children:["Accepts ",(0,o.jsx)("span",{children:"one of"})," the following messages:"]}):(0,o.jsx)(D,{children:"Accepts the following message:"})]})}),(0,o.jsxs)(l.Row,{layout:M,children:[(0,o.jsxs)(l.SamplesMiddlePanel,{isStacked:b,children:[(0,o.jsxs)(te,{children:[(0,o.jsx)(L.LinkToField,{to:C}),f.length>ee||w?(0,o.jsx)(l.Dropdown,{options:f,value:s.key,onChange:I}):(0,o.jsx)(r.Segmented,{ref:P,size:"small",value:s.key,options:f,onChange:I})]}),(0,o.jsx)(z.Message,{message:s.value,sectionId:i,id:s.key,onOneOfChange:F})]}),(0,o.jsxs)(l.OperationSamplesPanel,{isStacked:b,className:"panel-container-response-samples",children:[(0,o.jsx)($.SamplesPanel,{examples:K()}),!!O.length&&(0,o.jsx)(B.MessageBinding,{binding:O[0],slug:C}),(0,o.jsx)(W.MessageReferences,{messageKey:s.key})]})]})]})}),ae=m.default.div`
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
- `,ne=(0,m.default)(r.H4)`
3
+ `,se=(0,f.default)(l.H4)`
4
4
  margin: 0 0 var(--spacing-xs) 0;
5
5
  position: relative;
6
6
  :hover {
7
- ${r.LinkIcon} {
7
+ ${l.LinkIcon} {
8
8
  opacity: 1;
9
9
  visibility: visible;
10
10
  }
11
11
  }
12
- `,D=(0,m.default)(r.Typography)`
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
- `,te=m.default.div`
17
+ `,ie=f.default.div`
18
18
  position: relative;
19
19
  :hover {
20
- ${r.LinkIcon} {
20
+ ${l.LinkIcon} {
21
21
  opacity: 1;
22
22
  visibility: visible;
23
23
  }
@@ -1 +1 @@
1
- var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var e=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var d=(o,m)=>{for(var c in m)t(o,c,{get:m[c],enumerable:!0})},p=(o,m,c,h)=>{if(m&&typeof m=="object"||typeof m=="function")for(let r of e(m))!i.call(o,r)&&r!==c&&t(o,r,{get:()=>m[r],enumerable:!(h=s(m,r))||h.enumerable});return o};var S=o=>p(t({},"__esModule",{value:!0}),o);var f={};d(f,{getSchema:()=>a});module.exports=S(f);var n=require("./avro-to-json-schema");const a=o=>o?.schema?(0,n.avroToJsonSchema)(o.schema):o;0&&(module.exports={getSchema});
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.4.0-rc.2",
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.15.3",
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": "^1.6.1",
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/config": "0.36.0-rc.1",
43
- "@redocly/theme": "0.59.0-rc.3",
44
- "@redocly/openapi-docs": "3.15.0-rc.6"
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"