@redocly/asyncapi-docs
Version:
Async API docs for Redocly Realm
2 lines (1 loc) • 1.15 kB
JavaScript
import{useAtomValue as o}from"jotai";import{protocolAtom as c}from"./../jotai/app";const l={channel:"Channel",channels:"Channels",servers:"Servers",server:"Server",send:"Send",receive:"Receive",sendLabel:"Send",receiveLabel:"Receive",channelBinding:"Channel binding",payload:"Payload"},i={channel:"Topic",channels:"Topics",servers:"Brokers",server:"Broker",send:"Pub",receive:"Sub",sendLabel:"Publish",receiveLabel:"Subscribe",channelBinding:"Topic configuration",payload:"Value"},u={channel:"Exchange",channels:"Exchanges",servers:"Brokers",server:"Broker",send:"Pub",receive:"Cons",sendLabel:"Publish",receiveLabel:"Consume",channelBinding:"Exchange configuration",payload:"Payload"},v={channel:"Queue",channels:"Queues",servers:"Brokers",server:"Broker",send:"Pub",receive:"Cons",sendLabel:"Publish",receiveLabel:"Consume",channelBinding:"Queue configuration",payload:"Payload"};function b(n){const a=o(c);return{getProtocolLabel:(e,r)=>{var s;switch(a){case"kafka":return i[e]||r||"";case"amqp":return(((s=n?.amqp)===null||s===void 0?void 0:s.is)==="routingKey"?u[e]:v[e])||r||"";default:return l[e]||r||""}}}}export{b as useProtocolLabels};