UNPKG

@asyncapi/studio

Version:

One place that allows you to develop an AsyncAPI document, validate it, convert it to the latest version, preview the documentation and visualize the events flow.

207 lines (206 loc) 209 kB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{896:function(){},16164:function(){},34776:function(){},90572:function(e,n,t){Promise.resolve().then(t.bind(t,78559)),Promise.resolve().then(t.bind(t,10174)),Promise.resolve().then(t.bind(t,23634))},78559:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return nL}});var s=t(28148),r=t(95970),a=t(75075);class i{constructor(e={}){this.svcs=e}onInit(){}async afterAppInit(){}}var o=t(99672);function l(e,n,t){let s;return function(){for(var r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];let o=this,l=t&&!s;s&&clearTimeout(s),s=setTimeout(function(){s=null,t||e.apply(o,a)},n),l&&e.apply(o,a)}}function c(e){return e&&"object"==typeof e}function d(e,n){let t=Object.keys(e),s=Object.keys(n);if(t.length!==s.length)return!1;for(let s of t){let t=e[String(s)],r=n[String(s)],a=c(t)&&c(r);if(a&&!d(t,r)||!a&&t!==r)return!1}return!0}let p=e=>{var n;let{opener:t,className:a="relative",buttonHoverClassName:i,align:o="right",dataTest:l="button-dropdown",children:c}=e,[d,p]=(0,r.useState)(!1),m=(0,r.useRef)(null);return n=()=>p(!1),(0,r.useEffect)(()=>{function e(e){m.current&&!m.current.contains(e.target)&&n()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[m]),i=i||"hover:text-white",(0,s.jsxs)("div",{className:a,children:[(0,s.jsx)("button",{onClick:()=>p(!d),tabIndex:0,onKeyDown:()=>p(!d),type:"button",className:`flex p-2 text-sm rounded-md ${i} focus:outline-none focus:border-indigo-700 focus:shadow-outline-indigo transition ease-in-out duration-150`,"data-test":l,children:t}),(0,s.jsx)("div",{ref:m,onClick:()=>p(!1),tabIndex:0,onKeyDown:()=>p(!1),className:`${d?"visible":"invisible"} origin-top-right absolute ${"right"===o&&"right-0"} ${"left"===o&&"left-0"} mt-1 mr-3 w-64 rounded-md shadow-lg z-50`,children:(0,s.jsx)("div",{className:"rounded-md bg-gray-800 shadow-xs",children:(0,s.jsx)("div",{className:"py-1",children:c})})})]})};var m=t(33925);let h=e=>{let{children:n}=e;return(0,s.jsx)("div",{className:"aui-root",children:(0,s.jsx)(m.U,{children:n})})},u=e=>{let{toggle:n=!1,onChange:t}=e,[a,i]=(0,r.useState)(n),o=e=>{let n=!a;i(n),t(n)};return(0,s.jsx)("div",{onClick:o,tabIndex:0,onKeyDown:o,children:(0,s.jsx)("label",{htmlFor:"toggle",className:"flex items-center cursor-pointer",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("input",{type:"checkbox",className:"sr-only"}),(0,s.jsx)("div",{className:`w-12 h-6 rounded-full shadow-inner p-1 ${a?"bg-pink-500":"bg-gray-300"}`,children:(0,s.jsx)("div",{className:`w-6 h-4 rounded-full bg-white transition ${a?"transform translate-x-4":""}`})})]})})})};var g=t(37288);let f=e=>{let{placement:n="bottom",arrow:t=!0,animation:r="shift-away",className:a="text-xs bg-gray-900 text-center",hideOnClick:i=!1,children:o,...l}=e;return(0,s.jsx)(g.ZP,{placement:n,arrow:t,animation:r,className:a,hideOnClick:i,...l,children:o})};var y=t(13582);let x=(0,y.Ue)(()=>({initialized:!1,readOnly:!1,liveServer:!1,initErrors:[]})),b=(0,y.Ue)(e=>({documents:{},updateDocument(n,t){e(e=>({documents:{...e.documents,[String(n)]:{...e.documents[String(n)]||{},...t}}}))}})),v=localStorage.getItem("document")||`asyncapi: 3.0.0 info: title: Streetlights Kafka API version: 1.0.0 description: |- The Smartylighting Streetlights API allows you to remotely manage the city lights. ### Check out its awesome features: * Turn a specific streetlight on/off 🌃 * Dim a specific streetlight 😎 * Receive real-time information about environmental lighting conditions 📈 license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0 defaultContentType: application/json servers: scram-connections: host: test.mykafkacluster.org:18092 protocol: kafka-secure description: Test broker secured with scramSha256 security: - $ref: '#/components/securitySchemes/saslScram' tags: - name: env:test-scram description: >- This environment is meant for running internal tests through scramSha256 - name: kind:remote description: This server is a remote server. Not exposed by the application - name: visibility:private description: This resource is private and only available to certain users mtls-connections: host: test.mykafkacluster.org:28092 protocol: kafka-secure description: Test broker secured with X509 security: - $ref: '#/components/securitySchemes/certs' tags: - name: env:test-mtls description: This environment is meant for running internal tests through mtls - name: kind:remote description: This server is a remote server. Not exposed by the application - name: visibility:private description: This resource is private and only available to certain users channels: lightingMeasured: address: smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured messages: lightMeasured: $ref: '#/components/messages/lightMeasured' description: The topic on which measured values may be produced and consumed. parameters: streetlightId: $ref: '#/components/parameters/streetlightId' lightTurnOn: address: smartylighting.streetlights.1.0.action.{streetlightId}.turn.on messages: turnOn: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' lightTurnOff: address: smartylighting.streetlights.1.0.action.{streetlightId}.turn.off messages: turnOff: $ref: '#/components/messages/turnOnOff' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' lightsDim: address: smartylighting.streetlights.1.0.action.{streetlightId}.dim messages: dimLight: $ref: '#/components/messages/dimLight' parameters: streetlightId: $ref: '#/components/parameters/streetlightId' operations: receiveLightMeasurement: action: receive channel: $ref: '#/channels/lightingMeasured' summary: >- Inform about environmental lighting conditions of a particular streetlight. traits: - $ref: '#/components/operationTraits/kafka' messages: - $ref: '#/channels/lightingMeasured/messages/lightMeasured' turnOn: action: send channel: $ref: '#/channels/lightTurnOn' traits: - $ref: '#/components/operationTraits/kafka' messages: - $ref: '#/channels/lightTurnOn/messages/turnOn' turnOff: action: send channel: $ref: '#/channels/lightTurnOff' traits: - $ref: '#/components/operationTraits/kafka' messages: - $ref: '#/channels/lightTurnOff/messages/turnOff' dimLight: action: send channel: $ref: '#/channels/lightsDim' traits: - $ref: '#/components/operationTraits/kafka' messages: - $ref: '#/channels/lightsDim/messages/dimLight' components: messages: lightMeasured: name: lightMeasured title: Light measured summary: >- Inform about environmental lighting conditions of a particular streetlight. contentType: application/json traits: - $ref: '#/components/messageTraits/commonHeaders' payload: $ref: '#/components/schemas/lightMeasuredPayload' turnOnOff: name: turnOnOff title: Turn on/off summary: Command a particular streetlight to turn the lights on or off. traits: - $ref: '#/components/messageTraits/commonHeaders' payload: $ref: '#/components/schemas/turnOnOffPayload' dimLight: name: dimLight title: Dim light summary: Command a particular streetlight to dim the lights. traits: - $ref: '#/components/messageTraits/commonHeaders' payload: $ref: '#/components/schemas/dimLightPayload' schemas: lightMeasuredPayload: type: object properties: lumens: type: integer minimum: 0 description: Light intensity measured in lumens. sentAt: $ref: '#/components/schemas/sentAt' turnOnOffPayload: type: object properties: command: type: string enum: - 'on' - 'off' description: Whether to turn on or off the light. sentAt: $ref: '#/components/schemas/sentAt' dimLightPayload: type: object properties: percentage: type: integer description: Percentage to which the light should be dimmed to. minimum: 0 maximum: 100 sentAt: $ref: '#/components/schemas/sentAt' sentAt: type: string format: date-time description: Date and time when the message was sent. securitySchemes: saslScram: type: scramSha256 description: Provide your username and password for SASL/SCRAM authentication certs: type: X509 description: Download the certificate files from service provider parameters: streetlightId: description: The ID of the streetlight. messageTraits: commonHeaders: headers: type: object properties: my-app-header: type: integer minimum: 0 maximum: 100 operationTraits: kafka: bindings: kafka: clientId: type: string enum: - my-app-id `,j=(0,y.Ue)(e=>({files:{asyncapi:{uri:"asyncapi",name:"asyncapi",content:v,from:"storage",source:void 0,language:"{"===v.trimStart()[0]?"json":"yaml",modified:!1,stat:{mtime:new Date().getTime()}}},updateFile(n,t){e(e=>({files:{...e.files,[String(n)]:{...e.files[String(n)]||{},...t}}}))}})),w=(0,y.Ue)(()=>({editorHeight:"calc(100% - 161px)",templateRerender:!1}));var S=t(5710);let k=(0,y.Ue)((0,S.tJ)(()=>({show:{activityBar:!0,statusBar:!0,primarySidebar:!0,secondarySidebar:!0,primaryPanel:!0,secondaryPanel:!0,contextPanel:!0},secondaryPanelType:"template"}),{name:"studio-panels",getStorage:()=>localStorage})),N=(0,y.Ue)((0,S.tJ)(()=>({editor:{autoSaving:!0,savingDelay:625},governance:{show:{warnings:!0,informations:!0,hints:!0}},templates:{autoRendering:!0}}),{name:"studio-settings",getStorage:()=>localStorage})),$=e=>{let{propertyName:n,property:t,isRequired:r,setValue:a}=e;return t.enum?(0,s.jsxs)("select",{name:"template",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/2 block sm:text-sm rounded-md py-1 text-gray-700 border-pink-300 border-2",onChange:e=>a(n,e.target.value,r),children:[(0,s.jsx)("option",{value:"",children:"Please select server"}),t.enum.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}):(0,s.jsx)("input",{name:n,className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/2 block sm:text-sm rounded-md p-1 text-gray-700 border-pink-300 border-2",onChange:e=>a(n,e.target.value,r)})},T=e=>{let{propertyName:n,property:t,isRequired:r,setValue:a}=e;return(0,s.jsx)(u,{toggle:t.default,onChange:e=>a(n,e,r)})},C=e=>{switch(e.property.type){case"string":case"number":return(0,s.jsx)($,{...e});case"boolean":return(0,s.jsx)(T,{...e});default:return null}},I=(0,r.forwardRef)((e,n)=>{let{templateName:t,template:{properties:a={},required:i=[]},supportedProtocols:o=[],setConfirmDisabled:l}=e,[c,d]=(0,r.useState)({}),[p,m]=(0,r.useState)(!1),h=b(e=>e.documents.asyncapi?.document),{requiredProps:u,optionalProps:g,hasSupportedProtocols:f}=(0,r.useMemo)(()=>{let e={},n={},t=!0,s=h?.servers(),r=[];return Object.entries(s||{}).forEach(e=>{let[n,t]=e;t.protocol&&o.includes(t.protocol())&&r.push(n)}),o.length&&0===r.length?(t=!1,l(!0)):Object.keys(a).forEach(t=>{if("server"===t){let n={...a[String(t)]};n.enum=r,e[String(t)]=n}else i.includes(t)?e[String(t)]=a[String(t)]:n[String(t)]=a[String(t)]}),{requiredProps:e,optionalProps:n,hasSupportedProtocols:t}},[a,i,h]);(0,r.useEffect)(()=>{d({}),m(!1)},[t,d,m]),(0,r.useImperativeHandle)(n,()=>({getValues:()=>c}));let y=(0,r.useCallback)((e,n,t)=>{d(s=>(s[String(e)]=String(n),t&&l(i.some(e=>!s[String(e)])),s))},[i]),x=(0,r.useCallback)((e,n,r,a)=>(0,s.jsxs)("div",{className:`flex flex-col text-sm ${a?"mt-1":"mt-4"}`,children:[(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between",children:[(0,s.jsx)("label",{htmlFor:e,className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:(0,s.jsx)("span",{children:e})}),(0,s.jsx)(C,{propertyName:e,property:n,isRequired:r,setValue:y})]}),(0,s.jsx)("div",{className:"text-gray-400 text-xs mt-1",children:n.description})]},`${t}${e}`),[t]);return null!==h&&t?f?a&&Object.keys(a).length?(0,s.jsxs)("form",{className:"w-full",children:[Object.keys(u).length>0&&(0,s.jsxs)("div",{className:"mt-8",children:[(0,s.jsx)("h5",{className:"text-sm text-gray-400",children:"Required options"}),(0,s.jsx)("div",{children:Object.entries(u).map((e,n)=>{let[t,s]=e;return x(t,s,!0,0===n)})})]}),Object.keys(g).length>0&&(0,s.jsxs)("div",{className:"mt-8",children:[(0,s.jsxs)("div",{className:"flex flex-row justify-between",children:[(0,s.jsx)("h5",{className:"text-sm text-gray-400",children:"Advanced options (optional)"}),(0,s.jsx)("button",{type:"button",className:"text-sm underline text-pink-500",onClick:()=>m(e=>!e),children:p?"Hide advanced options":"Show advanced options"})]}),p&&(0,s.jsx)("div",{children:Object.entries(g).map((e,n)=>{let[t,s]=e;return x(t,s,!1,0===n)})})]})]}):(0,s.jsx)("div",{className:"text-sm text-gray-700 mt-10",children:"The given generation hasn't parameters to pass"}):(0,s.jsxs)("div",{className:"text-sm text-gray-700 mt-10 text-center",children:["AsyncAPI document doesn't have at least one server with supported protocols. For the selected generation, these are supported: ",o.join(", ")]}):null});var A=JSON.parse('{"@asyncapi/dotnet-nats-template":{"title":".NET Nats Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"version":{"description":"Version of the generated library","type":"string","default":"0.0.1"},"projectName":{"description":"Name of the generated library","type":"string","default":"AsyncapiNatsClient"},"repositoryUrl":{"description":"Repository url for the project file, often needed for release pipelines","type":"string"},"targetFramework":{"description":"The project target framework","type":"string","default":"netstandard2.0;netstandard2.1"},"packageVersion":{"description":"PackageVersion of the generated library","type":"string"},"assemblyVersion":{"description":"AssemblyVersion of the generated library","type":"string"},"fileVersion":{"description":"FileVersion of the generated library","type":"string"},"serializationLibrary":{"description":"Which serialization library should the models use? `newtonsoft` or `json` (system.text.json)","type":"string","default":"json"}},"required":[],"additionalProperties":false},"supportedProtocols":["nats"]},"@asyncapi/go-watermill-template":{"title":"GO Lang Watermill Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"moduleName":{"description":"name of the go module to be generated","type":"string","default":"go-async-api"}},"required":[],"additionalProperties":false},"supportedProtocols":["amqp"]},"@asyncapi/html-template":{"title":"HTML website","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"sidebarOrganization":{"description":"Defines how the sidebar should be organized. \'byTags\' to categorize operations by tags in the root of the document, `byTagsNoRoot` does the same but for pub/sub tags.","type":"string"},"baseHref":{"description":"Sets the base URL for links and forms.","type":"string"},"version":{"description":"Override the version of your application provided under `info.version` location in the specification file.","type":"string"},"singleFile":{"description":"If set this parameter to true generate single html file with scripts and styles inside","type":"boolean","default":false},"outFilename":{"description":"The name of the output HTML file","type":"string","default":"index.html"},"pdf":{"description":"Set to `true` to get index.pdf generated next to your index.html","type":"boolean","default":false},"pdfTimeout":{"description":"The timeout (in ms) used to generate the pdf","type":"number","default":30000},"favicon":{"description":"URL/Path of the favicon","type":"string","default":""},"config":{"description":"Stringified JSON or a path to a JSON file to override the default React component config. The config override is merged with the default config using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm.","type":"string","default":""}},"required":[],"additionalProperties":false}},"@asyncapi/java-spring-cloud-stream-template":{"title":"Java Spring Cloud Stream Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"actuator":{"description":"If present, it adds the dependencies for spring-boot-starter-web, spring-boot-starter-actuator and micrometer-registry-prometheus.","type":"boolean","default":false},"artifactId":{"description":"The Maven artifact id. Alternatively you can set the specification extension info.x-artifact-id","type":"string","default":"project-name"},"artifactType":{"description":"The type of project to generate, application or library. The default is application. When generating an application, the pom.xml file will contain the complete set of dependencies required to run an app, and it will contain an Application class with a main function. Otherwise the pom file will include only the dependencies required to compile a library.","type":"string","default":"application"},"binder":{"description":"The name of the binder implementation, one of kafka, rabbit or solace. Default: kafka. If you need other binders to be supported, please let us know!","type":"string","default":"kafka"},"dynamicType":{"description":"When using channels with parameters, i.e. dynamic topics where the topic could be different for each message, this determines whether to use the StreamBridge or a message header. StreamBridge can be used with all binders, but some binders such as Solace can use the topic set in a header for better performance. Possible values are streamBridge and header. Default is streamBridge.","type":"string","default":"streamBridge"},"groupId":{"description":"The Maven group id. Alternatively you can set the specification extension info.x-group-id","type":"string","default":"com.company"},"host":{"description":"The host connection property. Currently this only works with the Solace binder. Example: tcp://myhost.com:55555.","type":"string","default":"tcp://localhost:55555"},"javaPackage":{"description":"The Java package of the generated classes. Alternatively you can set the specification extension info.x-java-package","type":"string"},"msgVpn":{"description":"The message vpn connection property. Currently this only works with the Solace binder.","type":"string","default":"default"},"parametersToHeaders":{"description":"If true, this will create headers on the incoming messages for each channel parameter. Currently this only works with messages originating from Solace (using the solace_destination header) and RabbitMQ (using the amqp_receivedRoutingKey header.)","type":"boolean","default":false},"password":{"description":"The client password connection property. Currently this only works with the Solace binder.","type":"string","default":"default"},"reactive":{"description":"If true, this will generate reactive style functions using the Flux class. Defalt: false.","type":"boolean","default":false},"solaceSpringCloudVersion":{"description":"The version of the solace-spring-cloud-bom dependency used when generating an application. Alternatively you can set the specification extension info.x-solace-spring-cloud-version.","type":"string","default":"2.1.0"},"springBootVersion":{"description":"The version of Spring Boot used when generating an application. Alternatively you can set the specification extension info.x-spring-booot-version. Example: 2.2.6.RELEASE.","type":"string","default":"2.4.7"},"springCloudVersion":{"description":"The version of the spring-cloud-dependencies BOM dependency used when generating an application. Alternatively you can set the specification extension info.x-spring-cloud-version. Example: Hoxton.RELEASE.","type":"string","default":"2020.0.3"},"springCloudStreamVersion":{"description":"The version of the spring-cloud-stream dependency specified in the Maven file, when generating a library. When generating an application, the spring-cloud-dependencies BOM is used instead. Example: 3.0.1.RELEASE","type":"string","default":"3.1.3"},"username":{"description":"The client username connection property. Currently this only works with the Solace binder","type":"string","default":"default"},"view":{"description":"The view that the template uses. By default it is the client view, which means that when the document says publish, we subscribe. In the case of the provider view, when the document says publish, we publish. Values are client or provider. The default is client.","type":"string","default":"client"},"useServers":{"description":"This option works when binder is kafka. By default it is set to false. When set to true, it will concatenate all the urls in the servers section as a list of brokers for kafka.","type":"string"}},"required":[],"additionalProperties":false}},"@asyncapi/java-spring-template":{"title":"Java Spring Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"inverseOperations":{"description":"Generate application that will publish messages to `publish` operation of channels and read messages from `subscribe` operation of channels. Literally this flag just swap `publish` and `subscribe` operations in channels.","type":"boolean","default":false},"disableEqualsHashCode":{"description":"Disable generation of equals and hashCode methods for model classes.","type":"boolean","default":false},"listenerPollTimeout":{"description":"Only for Kafka. Timeout to use when polling the consumer.","type":"number","default":3000},"listenerConcurrency":{"description":"Only for Kafka. Number of threads to run in the listener containers.","type":"number","default":3},"connectionTimeout":{"description":"Only for MQTT. This value, measured in seconds, defines the maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails.","type":"number","default":30},"disconnectionTimeout":{"description":"Only for MQTT. The completion timeout in milliseconds when disconnecting. The default disconnect completion timeout is 5000 milliseconds.","type":"number","default":5000},"completionTimeout":{"description":"Only for MQTT. The completion timeout in milliseconds for operations. The default completion timeout is 30000 milliseconds.","type":"number","default":30000},"mqttClientId":{"description":"Only for MQTT. Provides the client identifier for the MQTT server. This parameter overrides the value of the clientId if it\'s set in the AsyncAPI file.","type":"string"},"asyncapiFileDir":{"description":"Parameter of @asyncapi/generator-hooks#createAsyncapiFile, allows to specify where original AsyncAPI file will be stored.","type":"string","default":"src/main/resources/api/"},"javaPackage":{"description":"The Java package of the generated classes. Alternatively you can set the specification extension info.x-java-package","type":"string","default":"com.asyncapi"},"addTypeInfoHeader":{"description":"Only for Kafka. Add type information to the message header","type":"boolean","default":true},"springBoot2":{"description":"Generate template files for the Spring Boot version 2. For kafka protocol it will also force to use spring-kafka 2.9.9","type":"boolean","default":false},"maven":{"description":"Generate pom.xml Maven build file instead of Gradle build","type":"boolean","default":false}},"required":[],"additionalProperties":false},"supportedProtocols":["kafka","amqp","mqtt"]},"@asyncapi/java-template":{"title":"Java Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"server":{"description":"The server you want to use in the code.","type":"string"},"asyncapiFileDir":{"description":"Custom location of the AsyncAPI file that you provided as an input in generation. By default it is located in the root of the output directory","type":"string"},"user":{"description":"Username for the server to generate code for","type":"string","default":"app"},"password":{"description":"Password for the server to generate code for","type":"string","default":"passw0rd"},"package":{"description":"Java package name for generated code","type":"string","default":"com.asyncapi"},"mqTopicPrefix":{"description":"MQ topic prefix. Used for ibmmq protocols. Default will work with dev MQ instance","type":"string","default":"dev//"}},"required":["server"],"additionalProperties":false},"supportedProtocols":["ibmmq","ibmmq-secure","kafka","kafka-secure"]},"@asyncapi/markdown-template":{"title":"Markdown Documentation","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"frontMatter":{"description":"The name of a JSON or YAML formatted file containing values to provide the YAML frontmatter for static-site or documentation generators. The file may contain {{title}} and {{version}} replaceable tags.","type":"string"},"outFilename":{"description":"The name of the output markdown file","type":"string","default":"asyncapi.md"},"toc":{"description":"Include a Table-of-Contents in the output markdown.","type":"boolean","default":true},"version":{"description":"Override the version of your application provided under `info.version` location in the specification file.","type":"string"}},"required":[],"additionalProperties":false}},"@asyncapi/nodejs-template":{"title":"NodeJS Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"server":{"description":"The server you want to use in the code.","type":"string"},"asyncapiFileDir":{"description":"Custom location of the AsyncAPI file that you provided as an input in generation. By default it is located in the root of the output directory","type":"string"},"securityScheme":{"description":"Name of the security scheme. Only scheme with X509 and Kafka protocol is supported for now.","type":"string"},"certFilesDir":{"description":"Directory where application certificates are located. This parameter is needed when you use X509 security scheme and your cert files are not located in the root of your application.","type":"string","default":"./"}},"required":["server"],"additionalProperties":false},"supportedProtocols":["amqp","mqtt","mqtts","kafka","kafka-secure","ws"]},"@asyncapi/nodejs-ws-template":{"title":"NodeJS WebSocket Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"server":{"description":"The server you want to use in the code.","type":"string"},"asyncapiFileDir":{"description":"Custom location of the AsyncAPI file that you provided as an input in generation. By default it is located in the root of the output directory","type":"string"}},"required":["server"],"additionalProperties":false},"supportedProtocols":["ws"]},"@asyncapi/python-paho-template":{"title":"Python Paho Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"view":{"description":"The view that the template uses. By default it is the client view, which means that when the document says publish, we subscribe. In the case of the provider view, when the document says publish, we publish. Values are client or provider. The default is client.","type":"string"}},"required":[],"additionalProperties":false}},"@asyncapi/ts-nats-template":{"title":"Typescript Nats Project","schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"generateTestClient":{"description":"Generate the test client","type":"boolean","default":false},"promisifyReplyCallback":{"description":"Use promises as callbacks for reply operation","type":"boolean","default":false}},"required":[],"additionalProperties":false},"supportedProtocols":["nats"]}}');let P=["@asyncapi/dotnet-nats-template","@asyncapi/go-watermill-template","@asyncapi/java-spring-cloud-stream-template","@asyncapi/java-spring-template","@asyncapi/nodejs-template","@asyncapi/nodejs-ws-template","@asyncapi/php-template","@asyncapi/python-paho-template","@asyncapi/ts-nats-template"],O=e=>Object.keys(A).map(n=>{let t="3.0.0"===e&&!P.includes(n);return(0,s.jsx)("option",{value:n,disabled:"3.0.0"===e&&!t,children:A[String(n)]?.title},n)}),E=(0,a.Ue)(()=>{let e=(0,a.dd)(),[n,t]=(0,r.useState)(""),{serverAPISvc:i}=eO(),[l,c]=(0,r.useState)(null),[d,p]=(0,r.useState)(!0),m=(0,r.useRef)(null),h=b(e=>e.documents.asyncapi?.document),u=h?.version()||"";(0,r.useEffect)(()=>{let e=n?A[String(n)].schema.required:[];p(!n||0!==e.length),c(null)},[n,c]);let g=async()=>{c(null);let s=await i.generate({asyncapi:j.getState().files.asyncapi.content,template:n,parameters:m.current?.getValues()});if(s.ok)e.hide(),t("");else{let e=await i.retrieveProblem(s);throw c(e),Error(e?.title)}};return(0,s.jsx)(U,{title:"Generate code/docs based on your AsyncAPI Document",warning:"3.0.0"===u&&"Not all generators currently offer support for AsyncAPI V3.",link:"https://github.com/asyncapi/studio/issues/980",confirmText:"Generate",confirmDisabled:d,onSubmit:()=>{o.ZP.promise(g(),{loading:"Generating...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Succesfully generated!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to generate."})})})},onCancel:()=>{setTimeout(()=>{t(""),c(null),p(!0),e.hide()},200)},closeAfterSumbit:!1,children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between text-sm",children:[(0,s.jsx)("label",{htmlFor:"generate",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"Generate"}),(0,s.jsxs)("select",{name:"generate",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/2 block sm:text-sm rounded-md py-1 text-gray-700 border-pink-300 border-2",onChange:e=>{t(e.target.value)},value:n,children:[(0,s.jsx)("option",{value:"",children:"Please Select"}),O(u)]})]}),n&&(0,s.jsx)("div",{className:"text-gray-400 text-xs mt-2 text-right",children:(0,s.jsx)("p",{children:(0,s.jsx)("a",{target:"_blank",href:`https://github.com/asyncapi/${n.replace("@asyncapi/","")}`,className:"underline text-pink-500",rel:"noreferrer",children:"Link to the Github Repository of selected generation →"})})}),(0,s.jsx)("div",{className:"flex content-center justify-center",children:(0,s.jsx)(I,{ref:m,templateName:n,template:n?A[String(n)]?.schema:{},supportedProtocols:n?A[String(n)]?.supportedProtocols:[],setConfirmDisabled:p})}),l&&(0,s.jsxs)("div",{className:"flex flex-col content-center justify-center mt-8 p-2 text-red-500 rounded-md bg-red-100",children:[(0,s.jsxs)("div",{className:"flex flex-row text-sm leading-5",children:[(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"text-red-500",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"inline-block h-5 w-5 mr-2 -mt-0.5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})})}),(0,s.jsx)("div",{children:l.title})]}),l.validationErrors&&l.validationErrors.length&&l.validationErrors.filter(e=>e.message).length?(0,s.jsx)("ul",{className:"text-xs mt-2 list-disc pl-7",children:l.validationErrors.map(e=>(0,s.jsx)("li",{children:e.message},e.message))}):(0,s.jsx)("p",{className:"text-xs mt-2 pl-7",children:l.detail})]})]})})}),D=e=>{let{active:n,tabs:t=[]}=e,[a,i]=(0,r.useState)(t.some(e=>e.name===n)?n:t[0]?.name);return 0===t.length?null:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex flex-row justify-between items-center border-b border-gray-300 text-white uppercase font-bold text-xs",children:(0,s.jsx)("ul",{className:"flex flex-row",children:t.map(e=>(0,s.jsx)("li",{className:"cursor-pointer",onClick:()=>i(e.name),tabIndex:0,role:"tab",onKeyDown:n=>{("Enter"===n.key||" "===n.key)&&i(e.name)},children:(0,s.jsx)("div",{className:`p-2 hover:text-pink-500 ${a===e.name?"text-pink-500 border-b-2 border-pink-500":"text-gray-500"}`,children:e.tab})},e.name))})}),(0,s.jsx)("div",{className:"overflow-auto h-64",children:(0,s.jsx)("ul",{children:t.map(e=>(0,s.jsx)("li",{className:`${a===e.name?"block":"hidden"}`,children:e.content},e.name))})})]})},M=e=>{let{label:n,state:t,setState:r}=e;return(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"flex flex-col mt-4 text-sm",children:[(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between",children:[(0,s.jsxs)("label",{htmlFor:`settings-governance-show-${n}`,className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:["Show\xa0",(0,s.jsx)("strong",{children:n}),"\xa0governance issues"]}),(0,s.jsx)(u,{toggle:t,onChange:r})]}),(0,s.jsxs)("div",{className:"text-gray-400 text-xs",children:["Show ",n," governance issues in the editor's\xa0",(0,s.jsx)("strong",{children:"Diagnostics"}),"\xa0tab."]})]})})},L=(0,a.Ue)(e=>{let{activeTab:n="editor"}=e,{settingsSvc:t}=eO(),i=t.get(),l=(0,a.dd)(),[c,d]=(0,r.useState)(i.editor.autoSaving),[p,m]=(0,r.useState)(i.editor.savingDelay),[h,g]=(0,r.useState)(i.governance.show.warnings),[f,y]=(0,r.useState)(i.governance.show.informations),[x,b]=(0,r.useState)(i.governance.show.hints),[v,j]=(0,r.useState)(i.templates.autoRendering),[w,S]=(0,r.useState)(!0),k=()=>({editor:{autoSaving:c,savingDelay:p},governance:{show:{warnings:h,informations:f,hints:x}},templates:{autoRendering:v}});(0,r.useEffect)(()=>{let e=k();S(t.isEqual(e))},[c,p,v,h,f,x]);let N=(0,r.useCallback)(()=>{l.hide()},[]),$=[{name:"editor",tab:(0,s.jsx)("span",{children:"Editor"}),content:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-col mt-4 text-sm",children:[(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between",children:[(0,s.jsx)("label",{htmlFor:"settings-auto-saving",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"Auto saving"}),(0,s.jsx)(u,{toggle:c,onChange:e=>d(e)})]}),(0,s.jsx)("div",{className:"text-gray-400 text-xs",children:"Save automatically after each change in the document or manually."})]}),(0,s.jsxs)("div",{className:"flex flex-col mt-4 text-sm",children:[(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between",children:[(0,s.jsx)("label",{htmlFor:"settings-template-delay",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"Delay (in miliseconds)"}),(0,s.jsxs)("select",{name:"settings-template-delay",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/4 block sm:text-sm rounded-md py-2 px-1 text-gray-700 border-pink-300 border-2",onChange:e=>m(JSON.parse(e.target.value)),value:c?p:"",disabled:!c,children:[(0,s.jsx)("option",{value:"",children:"Please Select"}),[250,500,625,750,875,1e3].map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsx)("div",{className:"text-gray-400 text-xs -mt-2",children:"Delay in saving the modified document."})]})]})},{name:"governance",tab:(0,s.jsx)("span",{children:"Governance"}),content:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(M,{label:"warning",state:h,setState:g}),(0,s.jsx)(M,{label:"information",state:f,setState:y}),(0,s.jsx)(M,{label:"hint",state:x,setState:b})]})},{name:"templates",tab:(0,s.jsx)("span",{children:"Templates"}),content:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex flex-col mt-4 text-sm",children:(0,s.jsxs)("div",{className:"flex flex-row content-center justify-between",children:[(0,s.jsx)("label",{htmlFor:"asyncapi-version",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"Auto rendering"}),(0,s.jsx)(u,{toggle:v,onChange:e=>j(e)})]})}),(0,s.jsx)("div",{className:"text-gray-400 text-xs",children:"Automatic rendering after each change in the document or manually."})]})}];return(0,s.jsx)(U,{title:"Studio settings",confirmText:"Save",confirmDisabled:w,onSubmit:()=>{let e=k();t.set(e),o.ZP.success((0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Settings succesfully saved!"})})),N()},onCancel:N,children:(0,s.jsx)(D,{active:n,tabs:$})})});var _=t(24274),R=t(33343);let U=e=>{let{title:n,description:t,warning:i,link:o,confirmText:l="Save",cancelText:c="Cancel",confirmDisabled:d=!0,cancelDisabled:p=!1,closeAfterSumbit:m=!0,onSubmit:h,onCancel:u=()=>{},containerClassName:g,children:f}=e,y=(0,a.dd)(),x=(0,r.useRef)(null),b=()=>{u(),y.hide()},v=(0,r.useCallback)(()=>{y.remove()},[]);return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(_.u.Root,{show:y.visible,as:r.Fragment,afterLeave:v,children:(0,s.jsx)(R.V,{as:"div",static:!0,className:"fixed z-50 inset-0 overflow-y-auto",initialFocus:x,open:y.visible,onClose:b,children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)(_.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(R.V.Overlay,{className:"fixed inset-0 bg-gray-800 bg-opacity-75 transition-opacity"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsx)(_.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,s.jsxs)("div",{className:`inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl w-2/5 sm:p-6 ${g}`,children:[(0,s.jsx)("div",{children:(0,s.jsxs)("div",{children:[(0,s.jsx)(R.V.Title,{as:"h3",className:"text-lg leading-6 font-medium text-gray-900",children:n}),t&&(0,s.jsx)("p",{className:"text-gray-500 text-xs",children:t}),i&&(0,s.jsx)("a",{href:o,className:"text-red-500 text-xs underline",target:"_blank",rel:"noreferrer",children:i}),(0,s.jsx)("div",{className:"my-8 space-y-4",children:f})]})}),(0,s.jsxs)("div",{className:`mt-5 sm:mt-6 sm:grid sm:gap-3 sm:grid-flow-row-dense ${h?"sm:grid-cols-2":""}`,children:[h&&(0,s.jsx)("button",{type:"button",className:`w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-pink-600 text-base font-medium text-white hover:bg-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-pink-500 sm:col-start-2 sm:text-sm ${d?"opacity-10":"opacity-100"}`,disabled:d,onClick:()=>{h&&h(),m&&y.hide()},"data-test":"modal-confirm-button",children:l}),(0,s.jsx)("button",{type:"button",className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-pink-500 sm:mt-0 sm:col-start-1 sm:text-sm",onClick:b,disabled:p,ref:x,children:c})]})]})})]})})})})},F=(0,a.Ue)(()=>{let{editorSvc:e,specificationSvc:n}=eO(),t=b(e=>e.documents.asyncapi?.document),a=n.latestVersion,[i,l]=(0,r.useState)(a),c=t?.version(),d=Object.keys(n.specs);c&&d.splice(0,d.indexOf(c)+1);let p=[...d].reverse();return(0,s.jsx)(U,{title:`Convert AsyncAPI ${c} document`,confirmText:"Convert",confirmDisabled:!i||0===d.length,onSubmit:()=>{o.ZP.promise(e.convertSpec(i),{loading:"Converting...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Document succesfully converted!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to convert document."})})})},children:(0,s.jsx)("div",{children:d.length>0?(0,s.jsxs)("div",{className:"flex content-center justify-center mt-4",children:[(0,s.jsx)("label",{htmlFor:"asyncapi-version",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"To version:"}),(0,s.jsxs)("select",{name:"asyncapi-version",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/2 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-1 text-gray-700 border-pink-300 border-2",onChange:e=>l(e.target.value),value:i,children:[(0,s.jsx)("option",{value:"",children:"Please Select"}),p.map(e=>(0,s.jsx)("option",{value:e,children:e===a?`${e} (latest)`:e},e))]})]}):(0,s.jsx)("div",{className:"flex content-center justify-center",children:"Uses the latest version."})})})}),H=(0,a.Ue)(e=>{let{convertOnlyToLatest:n=!1}=e,[t,a]=(0,r.useState)(""),{editorSvc:i,specificationSvc:l}=eO(),c=b(e=>e.documents.asyncapi?.document),d=c?.version()||"2.0.0-rc2",p=l.latestVersion,m=Object.keys(l.specs);d&&m.splice(0,m.indexOf(d)+1);let h=[...m].reverse(),u="";if(u=n?`Your document is using not latest version of AsyncAPI. Convert your document to latest (${p}) version`:"There is a new version of AsyncAPI. Convert your document to newest version if you want.",!x.getState().readOnly)return(0,s.jsx)(U,{title:n?"Convert AsyncAPI document to latest version":"Convert AsyncAPI document to newest version",confirmText:n?`Convert to ${p}`:"Convert",confirmDisabled:!1,onSubmit:function(){async function e(){try{await i.convertSpec(t)}catch(e){}}o.ZP.promise(e(),{loading:"Converting...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Document succesfully converted!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to convert document."})})})},children:(0,s.jsxs)("div",{className:"flex flex-col content-center justify-center text-center",children:[(0,s.jsx)("p",{children:u}),(0,s.jsx)("ul",{className:"mt-4",children:h.map(e=>"2.0.0"!==e&&(0,s.jsx)("li",{children:(0,s.jsxs)("a",{className:"underline",href:`https://www.asyncapi.com/blog/release-notes-${e}`,target:"_blank",rel:"nofollow noopener noreferrer",children:["See the release notes for ",e]})},e))}),!1===n?(0,s.jsxs)("div",{className:"flex content-center justify-center mt-4",children:[(0,s.jsx)("label",{htmlFor:"asyncapi-version",className:"flex justify-right items-center w-1/2 content-center font-medium text-gray-700",children:"To version:"}),(0,s.jsxs)("select",{name:"asyncapi-version",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 w-1/2 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-1 text-gray-700 border-pink-300 border-2",onChange:e=>a(e.target.value),value:t,children:[(0,s.jsxs)("option",{value:p,children:[p," (latest)"]},p),h.filter(e=>e!==p).map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}):null]})})}),q=(0,a.Ue)(()=>{let[e,n]=(0,r.useState)(""),{editorSvc:t}=eO();return(0,s.jsx)(U,{title:"Import AsyncAPI document from Base64",confirmText:"Import",confirmDisabled:!e,onSubmit:()=>{o.ZP.promise(t.importBase64(e),{loading:"Importing...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Document succesfully imported!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to import document."})})})},children:(0,s.jsxs)("div",{className:"flex content-center justify-center",children:[(0,s.jsx)("label",{htmlFor:"base64-source",className:"flex justify-right items-center content-center text-sm font-medium text-gray-700 hidden",children:"Base64 content"}),(0,s.jsx)("textarea",{name:"base64-source",placeholder:"Paste Base64 content here",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-3 text-gray-700 border-pink-300 border-2",onChange:e=>n(e.target.value),rows:10})]})})}),V=(0,a.Ue)(()=>{let[e,n]=(0,r.useState)(""),{editorSvc:t}=eO();return(0,s.jsx)(U,{title:"Import AsyncAPI document from URL",confirmText:"Import",confirmDisabled:!e,onSubmit:()=>{o.ZP.promise(t.importFromURL(e),{loading:"Importing...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Document succesfully imported!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to import document."})})})},children:(0,s.jsxs)("div",{className:"flex content-center justify-center",children:[(0,s.jsx)("label",{htmlFor:"url",className:"flex justify-right items-center content-center text-sm font-medium text-gray-700 hidden",children:"Document URL"}),(0,s.jsx)("input",{type:"url",name:"url",placeholder:"Paste URL here",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-3 text-gray-700 border-pink-300 border-2",onChange:e=>n(e.target.value)})]})})}),z=(0,a.Ue)(()=>{let[e,n]=(0,r.useState)(""),{editorSvc:t}=eO();return(0,s.jsx)(U,{title:"Import AsyncAPI document from Shared UUID",confirmText:"Import",confirmDisabled:!e,onSubmit:()=>{o.ZP.promise(t.importFromShareID(e),{loading:"Importing...",success:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold",children:"Document succesfully imported!"})}),error:(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"block text-bold text-red-400",children:"Failed to import document."})})})},children:(0,s.jsxs)("div",{className:"flex content-center justify-center",children:[(0,s.jsx)("label",{htmlFor:"url",className:"flex justify-right items-center content-center text-sm font-medium text-gray-700 hidden",children:"Shared UUID"}),(0,s.jsx)("input",{type:"url",name:"url",placeholder:"Paste UUID here",className:"shadow-sm focus:ring-pink-500 focus:border-pink-500 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-3 text-gray-700 border-pink-300 border-2",onChange:e=>n(e.target.value)})]})})});var B=t(55204),J="asyncapi: 3.0.0\nid: 'tag:stream.gitter.im,2022:api'\ninfo:\n title: Gitter Streaming API\n version: 1.0.0\nservers:\n production:\n host: stream.gitter.im\n pathname: /v1\n protocol: https\n protocolVersion: '1.1'\n security:\n - $ref: '#/components/securitySchemes/httpBearerToken'\nchannels:\n rooms:\n address: '/rooms/{roomId}/{resource}'\n messages:\n chatMessage:\n $ref: '#/components/messages/chatMessage'\n heartbeat:\n $ref: '#/components/messages/heartbeat'\n parameters:\n roomId:\n description: Id of the Gitter room.\n examples:\n - 53307860c3599d1de448e19d\n resource:\n enum:\n - chatMessages\n - events\n description: The resource to consume.\noperations:\n sendRoomInfo:\n action: send\n channel:\n $ref: '#/channels/rooms'\n bindings:\n http:\n method: POST\n messages:\n - $ref: '#/channels/rooms/messages/chatMessage'\n - $ref: '#/channels/rooms/messages/heartbeat'\ncomponents:\n securitySchemes:\n httpBearerToken:\n type: http\n scheme: bearer\n messages:\n chatMessage:\n summary: >-\n A message represents an individual chat message sent to a room. They are\n a sub-resource of a room.\n payload:\n schemaFormat: application/schema+yaml;version=draft-07\n schema:\n type: object\n properties:\n id:\n type: string\n description: ID of the message.\n text:\n type: string\n description: Original message in plain-text/markdown.\n html:\n type: string\n description: HTML formatted message.\n sent:\n type: string\n format: date-time\n description: ISO formatted date of the message.\n fromUser:\n type: object\n description: User that sent the message.\n properties:\n id:\n type: string\n description: Gitter User ID.\n username:\n type: string\n description: Gitter/GitHub username.\n displayName:\n type: string\n description: Gitter/GitHub user real name.\n url:\n type: string\n description: Path to the user on Gitter.\n avatarUrl:\n type: string\n format: uri\n description: User avatar URI.\n avatarUrlSmall:\n type: string\n format: uri\n description: User avatar URI (small).\n avatarUrlMedium:\n type: string\n format: uri\n description: User avatar URI (medium).\n v:\n type: number\n description: Version.\n gv:\n type: string\n