defs.js 134 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077
  1. /** @preserve This file is generated by the script
  2. * ../bin/generate-defs.js, which is not in general included in a
  3. * distribution, but is available in the source repository e.g. at
  4. * https://github.com/squaremo/amqp.node/
  5. */
  6. "use strict";
  7. function decodeBasicQos(buffer) {
  8. var val, offset = 0, fields = {
  9. prefetchSize: void 0,
  10. prefetchCount: void 0,
  11. global: void 0
  12. };
  13. val = buffer.readUInt32BE(offset);
  14. offset += 4;
  15. fields.prefetchSize = val;
  16. val = buffer.readUInt16BE(offset);
  17. offset += 2;
  18. fields.prefetchCount = val;
  19. val = !!(1 & buffer[offset]);
  20. fields.global = val;
  21. return fields;
  22. }
  23. function encodeBasicQos(channel, fields) {
  24. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(19);
  25. buffer[0] = 1;
  26. buffer.writeUInt16BE(channel, 1);
  27. buffer.writeUInt32BE(3932170, 7);
  28. offset = 11;
  29. val = fields.prefetchSize;
  30. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'prefetchSize' is the wrong type; must be a number (but not NaN)");
  31. buffer.writeUInt32BE(val, offset);
  32. offset += 4;
  33. val = fields.prefetchCount;
  34. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'prefetchCount' is the wrong type; must be a number (but not NaN)");
  35. buffer.writeUInt16BE(val, offset);
  36. offset += 2;
  37. val = fields.global;
  38. void 0 === val && (val = !1);
  39. val && (bits += 1);
  40. buffer[offset] = bits;
  41. offset++;
  42. buffer[offset] = 206;
  43. buffer.writeUInt32BE(offset - 7, 3);
  44. return buffer;
  45. }
  46. function decodeBasicQosOk(buffer) {
  47. return {};
  48. }
  49. function encodeBasicQosOk(channel, fields) {
  50. var offset = 0, buffer = Buffer.alloc(12);
  51. buffer[0] = 1;
  52. buffer.writeUInt16BE(channel, 1);
  53. buffer.writeUInt32BE(3932171, 7);
  54. offset = 11;
  55. buffer[offset] = 206;
  56. buffer.writeUInt32BE(offset - 7, 3);
  57. return buffer;
  58. }
  59. function decodeBasicConsume(buffer) {
  60. var val, len, offset = 0, fields = {
  61. ticket: void 0,
  62. queue: void 0,
  63. consumerTag: void 0,
  64. noLocal: void 0,
  65. noAck: void 0,
  66. exclusive: void 0,
  67. nowait: void 0,
  68. arguments: void 0
  69. };
  70. val = buffer.readUInt16BE(offset);
  71. offset += 2;
  72. fields.ticket = val;
  73. len = buffer.readUInt8(offset);
  74. offset++;
  75. val = buffer.toString("utf8", offset, offset + len);
  76. offset += len;
  77. fields.queue = val;
  78. len = buffer.readUInt8(offset);
  79. offset++;
  80. val = buffer.toString("utf8", offset, offset + len);
  81. offset += len;
  82. fields.consumerTag = val;
  83. val = !!(1 & buffer[offset]);
  84. fields.noLocal = val;
  85. val = !!(2 & buffer[offset]);
  86. fields.noAck = val;
  87. val = !!(4 & buffer[offset]);
  88. fields.exclusive = val;
  89. val = !!(8 & buffer[offset]);
  90. fields.nowait = val;
  91. offset++;
  92. len = buffer.readUInt32BE(offset);
  93. offset += 4;
  94. val = decodeFields(buffer.subarray(offset, offset + len));
  95. offset += len;
  96. fields.arguments = val;
  97. return fields;
  98. }
  99. function encodeBasicConsume(channel, fields) {
  100. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  101. val = fields.queue;
  102. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  103. var queue_len = Buffer.byteLength(val, "utf8");
  104. varyingSize += queue_len;
  105. val = fields.consumerTag;
  106. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");
  107. var consumerTag_len = Buffer.byteLength(val, "utf8");
  108. varyingSize += consumerTag_len;
  109. val = fields.arguments;
  110. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  111. len = encodeTable(SCRATCH, val, scratchOffset);
  112. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  113. scratchOffset += len;
  114. varyingSize += arguments_encoded.length;
  115. var buffer = Buffer.alloc(17 + varyingSize);
  116. buffer[0] = 1;
  117. buffer.writeUInt16BE(channel, 1);
  118. buffer.writeUInt32BE(3932180, 7);
  119. offset = 11;
  120. val = fields.ticket;
  121. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  122. buffer.writeUInt16BE(val, offset);
  123. offset += 2;
  124. val = fields.queue;
  125. void 0 === val && (val = "");
  126. buffer[offset] = queue_len;
  127. offset++;
  128. buffer.write(val, offset, "utf8");
  129. offset += queue_len;
  130. val = fields.consumerTag;
  131. void 0 === val && (val = "");
  132. buffer[offset] = consumerTag_len;
  133. offset++;
  134. buffer.write(val, offset, "utf8");
  135. offset += consumerTag_len;
  136. val = fields.noLocal;
  137. void 0 === val && (val = !1);
  138. val && (bits += 1);
  139. val = fields.noAck;
  140. void 0 === val && (val = !1);
  141. val && (bits += 2);
  142. val = fields.exclusive;
  143. void 0 === val && (val = !1);
  144. val && (bits += 4);
  145. val = fields.nowait;
  146. void 0 === val && (val = !1);
  147. val && (bits += 8);
  148. buffer[offset] = bits;
  149. offset++;
  150. bits = 0;
  151. offset += arguments_encoded.copy(buffer, offset);
  152. buffer[offset] = 206;
  153. buffer.writeUInt32BE(offset - 7, 3);
  154. return buffer;
  155. }
  156. function decodeBasicConsumeOk(buffer) {
  157. var val, len, offset = 0, fields = {
  158. consumerTag: void 0
  159. };
  160. len = buffer.readUInt8(offset);
  161. offset++;
  162. val = buffer.toString("utf8", offset, offset + len);
  163. offset += len;
  164. fields.consumerTag = val;
  165. return fields;
  166. }
  167. function encodeBasicConsumeOk(channel, fields) {
  168. var offset = 0, val = null, varyingSize = 0;
  169. val = fields.consumerTag;
  170. if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'");
  171. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");
  172. var consumerTag_len = Buffer.byteLength(val, "utf8");
  173. varyingSize += consumerTag_len;
  174. var buffer = Buffer.alloc(13 + varyingSize);
  175. buffer[0] = 1;
  176. buffer.writeUInt16BE(channel, 1);
  177. buffer.writeUInt32BE(3932181, 7);
  178. offset = 11;
  179. val = fields.consumerTag;
  180. void 0 === val && (val = void 0);
  181. buffer[offset] = consumerTag_len;
  182. offset++;
  183. buffer.write(val, offset, "utf8");
  184. offset += consumerTag_len;
  185. buffer[offset] = 206;
  186. buffer.writeUInt32BE(offset - 7, 3);
  187. return buffer;
  188. }
  189. function decodeBasicCancel(buffer) {
  190. var val, len, offset = 0, fields = {
  191. consumerTag: void 0,
  192. nowait: void 0
  193. };
  194. len = buffer.readUInt8(offset);
  195. offset++;
  196. val = buffer.toString("utf8", offset, offset + len);
  197. offset += len;
  198. fields.consumerTag = val;
  199. val = !!(1 & buffer[offset]);
  200. fields.nowait = val;
  201. return fields;
  202. }
  203. function encodeBasicCancel(channel, fields) {
  204. var offset = 0, val = null, bits = 0, varyingSize = 0;
  205. val = fields.consumerTag;
  206. if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'");
  207. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");
  208. var consumerTag_len = Buffer.byteLength(val, "utf8");
  209. varyingSize += consumerTag_len;
  210. var buffer = Buffer.alloc(14 + varyingSize);
  211. buffer[0] = 1;
  212. buffer.writeUInt16BE(channel, 1);
  213. buffer.writeUInt32BE(3932190, 7);
  214. offset = 11;
  215. val = fields.consumerTag;
  216. void 0 === val && (val = void 0);
  217. buffer[offset] = consumerTag_len;
  218. offset++;
  219. buffer.write(val, offset, "utf8");
  220. offset += consumerTag_len;
  221. val = fields.nowait;
  222. void 0 === val && (val = !1);
  223. val && (bits += 1);
  224. buffer[offset] = bits;
  225. offset++;
  226. buffer[offset] = 206;
  227. buffer.writeUInt32BE(offset - 7, 3);
  228. return buffer;
  229. }
  230. function decodeBasicCancelOk(buffer) {
  231. var val, len, offset = 0, fields = {
  232. consumerTag: void 0
  233. };
  234. len = buffer.readUInt8(offset);
  235. offset++;
  236. val = buffer.toString("utf8", offset, offset + len);
  237. offset += len;
  238. fields.consumerTag = val;
  239. return fields;
  240. }
  241. function encodeBasicCancelOk(channel, fields) {
  242. var offset = 0, val = null, varyingSize = 0;
  243. val = fields.consumerTag;
  244. if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'");
  245. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");
  246. var consumerTag_len = Buffer.byteLength(val, "utf8");
  247. varyingSize += consumerTag_len;
  248. var buffer = Buffer.alloc(13 + varyingSize);
  249. buffer[0] = 1;
  250. buffer.writeUInt16BE(channel, 1);
  251. buffer.writeUInt32BE(3932191, 7);
  252. offset = 11;
  253. val = fields.consumerTag;
  254. void 0 === val && (val = void 0);
  255. buffer[offset] = consumerTag_len;
  256. offset++;
  257. buffer.write(val, offset, "utf8");
  258. offset += consumerTag_len;
  259. buffer[offset] = 206;
  260. buffer.writeUInt32BE(offset - 7, 3);
  261. return buffer;
  262. }
  263. function decodeBasicPublish(buffer) {
  264. var val, len, offset = 0, fields = {
  265. ticket: void 0,
  266. exchange: void 0,
  267. routingKey: void 0,
  268. mandatory: void 0,
  269. immediate: void 0
  270. };
  271. val = buffer.readUInt16BE(offset);
  272. offset += 2;
  273. fields.ticket = val;
  274. len = buffer.readUInt8(offset);
  275. offset++;
  276. val = buffer.toString("utf8", offset, offset + len);
  277. offset += len;
  278. fields.exchange = val;
  279. len = buffer.readUInt8(offset);
  280. offset++;
  281. val = buffer.toString("utf8", offset, offset + len);
  282. offset += len;
  283. fields.routingKey = val;
  284. val = !!(1 & buffer[offset]);
  285. fields.mandatory = val;
  286. val = !!(2 & buffer[offset]);
  287. fields.immediate = val;
  288. return fields;
  289. }
  290. function encodeBasicPublish(channel, fields) {
  291. var offset = 0, val = null, bits = 0, varyingSize = 0;
  292. val = fields.exchange;
  293. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  294. var exchange_len = Buffer.byteLength(val, "utf8");
  295. varyingSize += exchange_len;
  296. val = fields.routingKey;
  297. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  298. var routingKey_len = Buffer.byteLength(val, "utf8");
  299. varyingSize += routingKey_len;
  300. var buffer = Buffer.alloc(17 + varyingSize);
  301. buffer[0] = 1;
  302. buffer.writeUInt16BE(channel, 1);
  303. buffer.writeUInt32BE(3932200, 7);
  304. offset = 11;
  305. val = fields.ticket;
  306. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  307. buffer.writeUInt16BE(val, offset);
  308. offset += 2;
  309. val = fields.exchange;
  310. void 0 === val && (val = "");
  311. buffer[offset] = exchange_len;
  312. offset++;
  313. buffer.write(val, offset, "utf8");
  314. offset += exchange_len;
  315. val = fields.routingKey;
  316. void 0 === val && (val = "");
  317. buffer[offset] = routingKey_len;
  318. offset++;
  319. buffer.write(val, offset, "utf8");
  320. offset += routingKey_len;
  321. val = fields.mandatory;
  322. void 0 === val && (val = !1);
  323. val && (bits += 1);
  324. val = fields.immediate;
  325. void 0 === val && (val = !1);
  326. val && (bits += 2);
  327. buffer[offset] = bits;
  328. offset++;
  329. buffer[offset] = 206;
  330. buffer.writeUInt32BE(offset - 7, 3);
  331. return buffer;
  332. }
  333. function decodeBasicReturn(buffer) {
  334. var val, len, offset = 0, fields = {
  335. replyCode: void 0,
  336. replyText: void 0,
  337. exchange: void 0,
  338. routingKey: void 0
  339. };
  340. val = buffer.readUInt16BE(offset);
  341. offset += 2;
  342. fields.replyCode = val;
  343. len = buffer.readUInt8(offset);
  344. offset++;
  345. val = buffer.toString("utf8", offset, offset + len);
  346. offset += len;
  347. fields.replyText = val;
  348. len = buffer.readUInt8(offset);
  349. offset++;
  350. val = buffer.toString("utf8", offset, offset + len);
  351. offset += len;
  352. fields.exchange = val;
  353. len = buffer.readUInt8(offset);
  354. offset++;
  355. val = buffer.toString("utf8", offset, offset + len);
  356. offset += len;
  357. fields.routingKey = val;
  358. return fields;
  359. }
  360. function encodeBasicReturn(channel, fields) {
  361. var offset = 0, val = null, varyingSize = 0;
  362. val = fields.replyText;
  363. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");
  364. var replyText_len = Buffer.byteLength(val, "utf8");
  365. varyingSize += replyText_len;
  366. val = fields.exchange;
  367. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  368. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  369. var exchange_len = Buffer.byteLength(val, "utf8");
  370. varyingSize += exchange_len;
  371. val = fields.routingKey;
  372. if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'");
  373. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  374. var routingKey_len = Buffer.byteLength(val, "utf8");
  375. varyingSize += routingKey_len;
  376. var buffer = Buffer.alloc(17 + varyingSize);
  377. buffer[0] = 1;
  378. buffer.writeUInt16BE(channel, 1);
  379. buffer.writeUInt32BE(3932210, 7);
  380. offset = 11;
  381. val = fields.replyCode;
  382. if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'");
  383. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");
  384. buffer.writeUInt16BE(val, offset);
  385. offset += 2;
  386. val = fields.replyText;
  387. void 0 === val && (val = "");
  388. buffer[offset] = replyText_len;
  389. offset++;
  390. buffer.write(val, offset, "utf8");
  391. offset += replyText_len;
  392. val = fields.exchange;
  393. void 0 === val && (val = void 0);
  394. buffer[offset] = exchange_len;
  395. offset++;
  396. buffer.write(val, offset, "utf8");
  397. offset += exchange_len;
  398. val = fields.routingKey;
  399. void 0 === val && (val = void 0);
  400. buffer[offset] = routingKey_len;
  401. offset++;
  402. buffer.write(val, offset, "utf8");
  403. offset += routingKey_len;
  404. buffer[offset] = 206;
  405. buffer.writeUInt32BE(offset - 7, 3);
  406. return buffer;
  407. }
  408. function decodeBasicDeliver(buffer) {
  409. var val, len, offset = 0, fields = {
  410. consumerTag: void 0,
  411. deliveryTag: void 0,
  412. redelivered: void 0,
  413. exchange: void 0,
  414. routingKey: void 0
  415. };
  416. len = buffer.readUInt8(offset);
  417. offset++;
  418. val = buffer.toString("utf8", offset, offset + len);
  419. offset += len;
  420. fields.consumerTag = val;
  421. val = ints.readUInt64BE(buffer, offset);
  422. offset += 8;
  423. fields.deliveryTag = val;
  424. val = !!(1 & buffer[offset]);
  425. fields.redelivered = val;
  426. offset++;
  427. len = buffer.readUInt8(offset);
  428. offset++;
  429. val = buffer.toString("utf8", offset, offset + len);
  430. offset += len;
  431. fields.exchange = val;
  432. len = buffer.readUInt8(offset);
  433. offset++;
  434. val = buffer.toString("utf8", offset, offset + len);
  435. offset += len;
  436. fields.routingKey = val;
  437. return fields;
  438. }
  439. function encodeBasicDeliver(channel, fields) {
  440. var offset = 0, val = null, bits = 0, varyingSize = 0;
  441. val = fields.consumerTag;
  442. if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerTag'");
  443. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'consumerTag' is the wrong type; must be a string (up to 255 chars)");
  444. var consumerTag_len = Buffer.byteLength(val, "utf8");
  445. varyingSize += consumerTag_len;
  446. val = fields.exchange;
  447. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  448. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  449. var exchange_len = Buffer.byteLength(val, "utf8");
  450. varyingSize += exchange_len;
  451. val = fields.routingKey;
  452. if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'");
  453. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  454. var routingKey_len = Buffer.byteLength(val, "utf8");
  455. varyingSize += routingKey_len;
  456. var buffer = Buffer.alloc(24 + varyingSize);
  457. buffer[0] = 1;
  458. buffer.writeUInt16BE(channel, 1);
  459. buffer.writeUInt32BE(3932220, 7);
  460. offset = 11;
  461. val = fields.consumerTag;
  462. void 0 === val && (val = void 0);
  463. buffer[offset] = consumerTag_len;
  464. offset++;
  465. buffer.write(val, offset, "utf8");
  466. offset += consumerTag_len;
  467. val = fields.deliveryTag;
  468. if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'");
  469. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");
  470. ints.writeUInt64BE(buffer, val, offset);
  471. offset += 8;
  472. val = fields.redelivered;
  473. void 0 === val && (val = !1);
  474. val && (bits += 1);
  475. buffer[offset] = bits;
  476. offset++;
  477. bits = 0;
  478. val = fields.exchange;
  479. void 0 === val && (val = void 0);
  480. buffer[offset] = exchange_len;
  481. offset++;
  482. buffer.write(val, offset, "utf8");
  483. offset += exchange_len;
  484. val = fields.routingKey;
  485. void 0 === val && (val = void 0);
  486. buffer[offset] = routingKey_len;
  487. offset++;
  488. buffer.write(val, offset, "utf8");
  489. offset += routingKey_len;
  490. buffer[offset] = 206;
  491. buffer.writeUInt32BE(offset - 7, 3);
  492. return buffer;
  493. }
  494. function decodeBasicGet(buffer) {
  495. var val, len, offset = 0, fields = {
  496. ticket: void 0,
  497. queue: void 0,
  498. noAck: void 0
  499. };
  500. val = buffer.readUInt16BE(offset);
  501. offset += 2;
  502. fields.ticket = val;
  503. len = buffer.readUInt8(offset);
  504. offset++;
  505. val = buffer.toString("utf8", offset, offset + len);
  506. offset += len;
  507. fields.queue = val;
  508. val = !!(1 & buffer[offset]);
  509. fields.noAck = val;
  510. return fields;
  511. }
  512. function encodeBasicGet(channel, fields) {
  513. var offset = 0, val = null, bits = 0, varyingSize = 0;
  514. val = fields.queue;
  515. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  516. var queue_len = Buffer.byteLength(val, "utf8");
  517. varyingSize += queue_len;
  518. var buffer = Buffer.alloc(16 + varyingSize);
  519. buffer[0] = 1;
  520. buffer.writeUInt16BE(channel, 1);
  521. buffer.writeUInt32BE(3932230, 7);
  522. offset = 11;
  523. val = fields.ticket;
  524. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  525. buffer.writeUInt16BE(val, offset);
  526. offset += 2;
  527. val = fields.queue;
  528. void 0 === val && (val = "");
  529. buffer[offset] = queue_len;
  530. offset++;
  531. buffer.write(val, offset, "utf8");
  532. offset += queue_len;
  533. val = fields.noAck;
  534. void 0 === val && (val = !1);
  535. val && (bits += 1);
  536. buffer[offset] = bits;
  537. offset++;
  538. buffer[offset] = 206;
  539. buffer.writeUInt32BE(offset - 7, 3);
  540. return buffer;
  541. }
  542. function decodeBasicGetOk(buffer) {
  543. var val, len, offset = 0, fields = {
  544. deliveryTag: void 0,
  545. redelivered: void 0,
  546. exchange: void 0,
  547. routingKey: void 0,
  548. messageCount: void 0
  549. };
  550. val = ints.readUInt64BE(buffer, offset);
  551. offset += 8;
  552. fields.deliveryTag = val;
  553. val = !!(1 & buffer[offset]);
  554. fields.redelivered = val;
  555. offset++;
  556. len = buffer.readUInt8(offset);
  557. offset++;
  558. val = buffer.toString("utf8", offset, offset + len);
  559. offset += len;
  560. fields.exchange = val;
  561. len = buffer.readUInt8(offset);
  562. offset++;
  563. val = buffer.toString("utf8", offset, offset + len);
  564. offset += len;
  565. fields.routingKey = val;
  566. val = buffer.readUInt32BE(offset);
  567. offset += 4;
  568. fields.messageCount = val;
  569. return fields;
  570. }
  571. function encodeBasicGetOk(channel, fields) {
  572. var offset = 0, val = null, bits = 0, varyingSize = 0;
  573. val = fields.exchange;
  574. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  575. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  576. var exchange_len = Buffer.byteLength(val, "utf8");
  577. varyingSize += exchange_len;
  578. val = fields.routingKey;
  579. if (void 0 === val) throw new Error("Missing value for mandatory field 'routingKey'");
  580. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  581. var routingKey_len = Buffer.byteLength(val, "utf8");
  582. varyingSize += routingKey_len;
  583. var buffer = Buffer.alloc(27 + varyingSize);
  584. buffer[0] = 1;
  585. buffer.writeUInt16BE(channel, 1);
  586. buffer.writeUInt32BE(3932231, 7);
  587. offset = 11;
  588. val = fields.deliveryTag;
  589. if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'");
  590. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");
  591. ints.writeUInt64BE(buffer, val, offset);
  592. offset += 8;
  593. val = fields.redelivered;
  594. void 0 === val && (val = !1);
  595. val && (bits += 1);
  596. buffer[offset] = bits;
  597. offset++;
  598. bits = 0;
  599. val = fields.exchange;
  600. void 0 === val && (val = void 0);
  601. buffer[offset] = exchange_len;
  602. offset++;
  603. buffer.write(val, offset, "utf8");
  604. offset += exchange_len;
  605. val = fields.routingKey;
  606. void 0 === val && (val = void 0);
  607. buffer[offset] = routingKey_len;
  608. offset++;
  609. buffer.write(val, offset, "utf8");
  610. offset += routingKey_len;
  611. val = fields.messageCount;
  612. if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'");
  613. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");
  614. buffer.writeUInt32BE(val, offset);
  615. offset += 4;
  616. buffer[offset] = 206;
  617. buffer.writeUInt32BE(offset - 7, 3);
  618. return buffer;
  619. }
  620. function decodeBasicGetEmpty(buffer) {
  621. var val, len, offset = 0, fields = {
  622. clusterId: void 0
  623. };
  624. len = buffer.readUInt8(offset);
  625. offset++;
  626. val = buffer.toString("utf8", offset, offset + len);
  627. offset += len;
  628. fields.clusterId = val;
  629. return fields;
  630. }
  631. function encodeBasicGetEmpty(channel, fields) {
  632. var offset = 0, val = null, varyingSize = 0;
  633. val = fields.clusterId;
  634. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)");
  635. var clusterId_len = Buffer.byteLength(val, "utf8");
  636. varyingSize += clusterId_len;
  637. var buffer = Buffer.alloc(13 + varyingSize);
  638. buffer[0] = 1;
  639. buffer.writeUInt16BE(channel, 1);
  640. buffer.writeUInt32BE(3932232, 7);
  641. offset = 11;
  642. val = fields.clusterId;
  643. void 0 === val && (val = "");
  644. buffer[offset] = clusterId_len;
  645. offset++;
  646. buffer.write(val, offset, "utf8");
  647. offset += clusterId_len;
  648. buffer[offset] = 206;
  649. buffer.writeUInt32BE(offset - 7, 3);
  650. return buffer;
  651. }
  652. function decodeBasicAck(buffer) {
  653. var val, offset = 0, fields = {
  654. deliveryTag: void 0,
  655. multiple: void 0
  656. };
  657. val = ints.readUInt64BE(buffer, offset);
  658. offset += 8;
  659. fields.deliveryTag = val;
  660. val = !!(1 & buffer[offset]);
  661. fields.multiple = val;
  662. return fields;
  663. }
  664. function encodeBasicAck(channel, fields) {
  665. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21);
  666. buffer[0] = 1;
  667. buffer.writeUInt16BE(channel, 1);
  668. buffer.writeUInt32BE(3932240, 7);
  669. offset = 11;
  670. val = fields.deliveryTag;
  671. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");
  672. ints.writeUInt64BE(buffer, val, offset);
  673. offset += 8;
  674. val = fields.multiple;
  675. void 0 === val && (val = !1);
  676. val && (bits += 1);
  677. buffer[offset] = bits;
  678. offset++;
  679. buffer[offset] = 206;
  680. buffer.writeUInt32BE(offset - 7, 3);
  681. return buffer;
  682. }
  683. function decodeBasicReject(buffer) {
  684. var val, offset = 0, fields = {
  685. deliveryTag: void 0,
  686. requeue: void 0
  687. };
  688. val = ints.readUInt64BE(buffer, offset);
  689. offset += 8;
  690. fields.deliveryTag = val;
  691. val = !!(1 & buffer[offset]);
  692. fields.requeue = val;
  693. return fields;
  694. }
  695. function encodeBasicReject(channel, fields) {
  696. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21);
  697. buffer[0] = 1;
  698. buffer.writeUInt16BE(channel, 1);
  699. buffer.writeUInt32BE(3932250, 7);
  700. offset = 11;
  701. val = fields.deliveryTag;
  702. if (void 0 === val) throw new Error("Missing value for mandatory field 'deliveryTag'");
  703. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");
  704. ints.writeUInt64BE(buffer, val, offset);
  705. offset += 8;
  706. val = fields.requeue;
  707. void 0 === val && (val = !0);
  708. val && (bits += 1);
  709. buffer[offset] = bits;
  710. offset++;
  711. buffer[offset] = 206;
  712. buffer.writeUInt32BE(offset - 7, 3);
  713. return buffer;
  714. }
  715. function decodeBasicRecoverAsync(buffer) {
  716. var val, fields = {
  717. requeue: void 0
  718. };
  719. val = !!(1 & buffer[0]);
  720. fields.requeue = val;
  721. return fields;
  722. }
  723. function encodeBasicRecoverAsync(channel, fields) {
  724. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13);
  725. buffer[0] = 1;
  726. buffer.writeUInt16BE(channel, 1);
  727. buffer.writeUInt32BE(3932260, 7);
  728. offset = 11;
  729. val = fields.requeue;
  730. void 0 === val && (val = !1);
  731. val && (bits += 1);
  732. buffer[offset] = bits;
  733. offset++;
  734. buffer[offset] = 206;
  735. buffer.writeUInt32BE(offset - 7, 3);
  736. return buffer;
  737. }
  738. function decodeBasicRecover(buffer) {
  739. var val, fields = {
  740. requeue: void 0
  741. };
  742. val = !!(1 & buffer[0]);
  743. fields.requeue = val;
  744. return fields;
  745. }
  746. function encodeBasicRecover(channel, fields) {
  747. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13);
  748. buffer[0] = 1;
  749. buffer.writeUInt16BE(channel, 1);
  750. buffer.writeUInt32BE(3932270, 7);
  751. offset = 11;
  752. val = fields.requeue;
  753. void 0 === val && (val = !1);
  754. val && (bits += 1);
  755. buffer[offset] = bits;
  756. offset++;
  757. buffer[offset] = 206;
  758. buffer.writeUInt32BE(offset - 7, 3);
  759. return buffer;
  760. }
  761. function decodeBasicRecoverOk(buffer) {
  762. return {};
  763. }
  764. function encodeBasicRecoverOk(channel, fields) {
  765. var offset = 0, buffer = Buffer.alloc(12);
  766. buffer[0] = 1;
  767. buffer.writeUInt16BE(channel, 1);
  768. buffer.writeUInt32BE(3932271, 7);
  769. offset = 11;
  770. buffer[offset] = 206;
  771. buffer.writeUInt32BE(offset - 7, 3);
  772. return buffer;
  773. }
  774. function decodeBasicNack(buffer) {
  775. var val, offset = 0, fields = {
  776. deliveryTag: void 0,
  777. multiple: void 0,
  778. requeue: void 0
  779. };
  780. val = ints.readUInt64BE(buffer, offset);
  781. offset += 8;
  782. fields.deliveryTag = val;
  783. val = !!(1 & buffer[offset]);
  784. fields.multiple = val;
  785. val = !!(2 & buffer[offset]);
  786. fields.requeue = val;
  787. return fields;
  788. }
  789. function encodeBasicNack(channel, fields) {
  790. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(21);
  791. buffer[0] = 1;
  792. buffer.writeUInt16BE(channel, 1);
  793. buffer.writeUInt32BE(3932280, 7);
  794. offset = 11;
  795. val = fields.deliveryTag;
  796. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryTag' is the wrong type; must be a number (but not NaN)");
  797. ints.writeUInt64BE(buffer, val, offset);
  798. offset += 8;
  799. val = fields.multiple;
  800. void 0 === val && (val = !1);
  801. val && (bits += 1);
  802. val = fields.requeue;
  803. void 0 === val && (val = !0);
  804. val && (bits += 2);
  805. buffer[offset] = bits;
  806. offset++;
  807. buffer[offset] = 206;
  808. buffer.writeUInt32BE(offset - 7, 3);
  809. return buffer;
  810. }
  811. function decodeConnectionStart(buffer) {
  812. var val, len, offset = 0, fields = {
  813. versionMajor: void 0,
  814. versionMinor: void 0,
  815. serverProperties: void 0,
  816. mechanisms: void 0,
  817. locales: void 0
  818. };
  819. val = buffer[offset];
  820. offset++;
  821. fields.versionMajor = val;
  822. val = buffer[offset];
  823. offset++;
  824. fields.versionMinor = val;
  825. len = buffer.readUInt32BE(offset);
  826. offset += 4;
  827. val = decodeFields(buffer.subarray(offset, offset + len));
  828. offset += len;
  829. fields.serverProperties = val;
  830. len = buffer.readUInt32BE(offset);
  831. offset += 4;
  832. val = buffer.subarray(offset, offset + len);
  833. offset += len;
  834. fields.mechanisms = val;
  835. len = buffer.readUInt32BE(offset);
  836. offset += 4;
  837. val = buffer.subarray(offset, offset + len);
  838. offset += len;
  839. fields.locales = val;
  840. return fields;
  841. }
  842. function encodeConnectionStart(channel, fields) {
  843. var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0;
  844. val = fields.serverProperties;
  845. if (void 0 === val) throw new Error("Missing value for mandatory field 'serverProperties'");
  846. if ("object" != typeof val) throw new TypeError("Field 'serverProperties' is the wrong type; must be an object");
  847. len = encodeTable(SCRATCH, val, scratchOffset);
  848. var serverProperties_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  849. scratchOffset += len;
  850. varyingSize += serverProperties_encoded.length;
  851. val = fields.mechanisms;
  852. if (void 0 === val) val = Buffer.from("PLAIN"); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'mechanisms' is the wrong type; must be a Buffer");
  853. varyingSize += val.length;
  854. val = fields.locales;
  855. if (void 0 === val) val = Buffer.from("en_US"); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'locales' is the wrong type; must be a Buffer");
  856. varyingSize += val.length;
  857. var buffer = Buffer.alloc(22 + varyingSize);
  858. buffer[0] = 1;
  859. buffer.writeUInt16BE(channel, 1);
  860. buffer.writeUInt32BE(655370, 7);
  861. offset = 11;
  862. val = fields.versionMajor;
  863. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'versionMajor' is the wrong type; must be a number (but not NaN)");
  864. buffer.writeUInt8(val, offset);
  865. offset++;
  866. val = fields.versionMinor;
  867. if (void 0 === val) val = 9; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'versionMinor' is the wrong type; must be a number (but not NaN)");
  868. buffer.writeUInt8(val, offset);
  869. offset++;
  870. offset += serverProperties_encoded.copy(buffer, offset);
  871. val = fields.mechanisms;
  872. void 0 === val && (val = Buffer.from("PLAIN"));
  873. len = val.length;
  874. buffer.writeUInt32BE(len, offset);
  875. offset += 4;
  876. val.copy(buffer, offset);
  877. offset += len;
  878. val = fields.locales;
  879. void 0 === val && (val = Buffer.from("en_US"));
  880. len = val.length;
  881. buffer.writeUInt32BE(len, offset);
  882. offset += 4;
  883. val.copy(buffer, offset);
  884. offset += len;
  885. buffer[offset] = 206;
  886. buffer.writeUInt32BE(offset - 7, 3);
  887. return buffer;
  888. }
  889. function decodeConnectionStartOk(buffer) {
  890. var val, len, offset = 0, fields = {
  891. clientProperties: void 0,
  892. mechanism: void 0,
  893. response: void 0,
  894. locale: void 0
  895. };
  896. len = buffer.readUInt32BE(offset);
  897. offset += 4;
  898. val = decodeFields(buffer.subarray(offset, offset + len));
  899. offset += len;
  900. fields.clientProperties = val;
  901. len = buffer.readUInt8(offset);
  902. offset++;
  903. val = buffer.toString("utf8", offset, offset + len);
  904. offset += len;
  905. fields.mechanism = val;
  906. len = buffer.readUInt32BE(offset);
  907. offset += 4;
  908. val = buffer.subarray(offset, offset + len);
  909. offset += len;
  910. fields.response = val;
  911. len = buffer.readUInt8(offset);
  912. offset++;
  913. val = buffer.toString("utf8", offset, offset + len);
  914. offset += len;
  915. fields.locale = val;
  916. return fields;
  917. }
  918. function encodeConnectionStartOk(channel, fields) {
  919. var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0;
  920. val = fields.clientProperties;
  921. if (void 0 === val) throw new Error("Missing value for mandatory field 'clientProperties'");
  922. if ("object" != typeof val) throw new TypeError("Field 'clientProperties' is the wrong type; must be an object");
  923. len = encodeTable(SCRATCH, val, scratchOffset);
  924. var clientProperties_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  925. scratchOffset += len;
  926. varyingSize += clientProperties_encoded.length;
  927. val = fields.mechanism;
  928. if (void 0 === val) val = "PLAIN"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'mechanism' is the wrong type; must be a string (up to 255 chars)");
  929. var mechanism_len = Buffer.byteLength(val, "utf8");
  930. varyingSize += mechanism_len;
  931. val = fields.response;
  932. if (void 0 === val) throw new Error("Missing value for mandatory field 'response'");
  933. if (!Buffer.isBuffer(val)) throw new TypeError("Field 'response' is the wrong type; must be a Buffer");
  934. varyingSize += val.length;
  935. val = fields.locale;
  936. if (void 0 === val) val = "en_US"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'locale' is the wrong type; must be a string (up to 255 chars)");
  937. var locale_len = Buffer.byteLength(val, "utf8");
  938. varyingSize += locale_len;
  939. var buffer = Buffer.alloc(18 + varyingSize);
  940. buffer[0] = 1;
  941. buffer.writeUInt16BE(channel, 1);
  942. buffer.writeUInt32BE(655371, 7);
  943. offset = 11;
  944. offset += clientProperties_encoded.copy(buffer, offset);
  945. val = fields.mechanism;
  946. void 0 === val && (val = "PLAIN");
  947. buffer[offset] = mechanism_len;
  948. offset++;
  949. buffer.write(val, offset, "utf8");
  950. offset += mechanism_len;
  951. val = fields.response;
  952. void 0 === val && (val = Buffer.from(void 0));
  953. len = val.length;
  954. buffer.writeUInt32BE(len, offset);
  955. offset += 4;
  956. val.copy(buffer, offset);
  957. offset += len;
  958. val = fields.locale;
  959. void 0 === val && (val = "en_US");
  960. buffer[offset] = locale_len;
  961. offset++;
  962. buffer.write(val, offset, "utf8");
  963. offset += locale_len;
  964. buffer[offset] = 206;
  965. buffer.writeUInt32BE(offset - 7, 3);
  966. return buffer;
  967. }
  968. function decodeConnectionSecure(buffer) {
  969. var val, len, offset = 0, fields = {
  970. challenge: void 0
  971. };
  972. len = buffer.readUInt32BE(offset);
  973. offset += 4;
  974. val = buffer.subarray(offset, offset + len);
  975. offset += len;
  976. fields.challenge = val;
  977. return fields;
  978. }
  979. function encodeConnectionSecure(channel, fields) {
  980. var len, offset = 0, val = null, varyingSize = 0;
  981. val = fields.challenge;
  982. if (void 0 === val) throw new Error("Missing value for mandatory field 'challenge'");
  983. if (!Buffer.isBuffer(val)) throw new TypeError("Field 'challenge' is the wrong type; must be a Buffer");
  984. varyingSize += val.length;
  985. var buffer = Buffer.alloc(16 + varyingSize);
  986. buffer[0] = 1;
  987. buffer.writeUInt16BE(channel, 1);
  988. buffer.writeUInt32BE(655380, 7);
  989. offset = 11;
  990. val = fields.challenge;
  991. void 0 === val && (val = Buffer.from(void 0));
  992. len = val.length;
  993. buffer.writeUInt32BE(len, offset);
  994. offset += 4;
  995. val.copy(buffer, offset);
  996. offset += len;
  997. buffer[offset] = 206;
  998. buffer.writeUInt32BE(offset - 7, 3);
  999. return buffer;
  1000. }
  1001. function decodeConnectionSecureOk(buffer) {
  1002. var val, len, offset = 0, fields = {
  1003. response: void 0
  1004. };
  1005. len = buffer.readUInt32BE(offset);
  1006. offset += 4;
  1007. val = buffer.subarray(offset, offset + len);
  1008. offset += len;
  1009. fields.response = val;
  1010. return fields;
  1011. }
  1012. function encodeConnectionSecureOk(channel, fields) {
  1013. var len, offset = 0, val = null, varyingSize = 0;
  1014. val = fields.response;
  1015. if (void 0 === val) throw new Error("Missing value for mandatory field 'response'");
  1016. if (!Buffer.isBuffer(val)) throw new TypeError("Field 'response' is the wrong type; must be a Buffer");
  1017. varyingSize += val.length;
  1018. var buffer = Buffer.alloc(16 + varyingSize);
  1019. buffer[0] = 1;
  1020. buffer.writeUInt16BE(channel, 1);
  1021. buffer.writeUInt32BE(655381, 7);
  1022. offset = 11;
  1023. val = fields.response;
  1024. void 0 === val && (val = Buffer.from(void 0));
  1025. len = val.length;
  1026. buffer.writeUInt32BE(len, offset);
  1027. offset += 4;
  1028. val.copy(buffer, offset);
  1029. offset += len;
  1030. buffer[offset] = 206;
  1031. buffer.writeUInt32BE(offset - 7, 3);
  1032. return buffer;
  1033. }
  1034. function decodeConnectionTune(buffer) {
  1035. var val, offset = 0, fields = {
  1036. channelMax: void 0,
  1037. frameMax: void 0,
  1038. heartbeat: void 0
  1039. };
  1040. val = buffer.readUInt16BE(offset);
  1041. offset += 2;
  1042. fields.channelMax = val;
  1043. val = buffer.readUInt32BE(offset);
  1044. offset += 4;
  1045. fields.frameMax = val;
  1046. val = buffer.readUInt16BE(offset);
  1047. offset += 2;
  1048. fields.heartbeat = val;
  1049. return fields;
  1050. }
  1051. function encodeConnectionTune(channel, fields) {
  1052. var offset = 0, val = null, buffer = Buffer.alloc(20);
  1053. buffer[0] = 1;
  1054. buffer.writeUInt16BE(channel, 1);
  1055. buffer.writeUInt32BE(655390, 7);
  1056. offset = 11;
  1057. val = fields.channelMax;
  1058. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)");
  1059. buffer.writeUInt16BE(val, offset);
  1060. offset += 2;
  1061. val = fields.frameMax;
  1062. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)");
  1063. buffer.writeUInt32BE(val, offset);
  1064. offset += 4;
  1065. val = fields.heartbeat;
  1066. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)");
  1067. buffer.writeUInt16BE(val, offset);
  1068. offset += 2;
  1069. buffer[offset] = 206;
  1070. buffer.writeUInt32BE(offset - 7, 3);
  1071. return buffer;
  1072. }
  1073. function decodeConnectionTuneOk(buffer) {
  1074. var val, offset = 0, fields = {
  1075. channelMax: void 0,
  1076. frameMax: void 0,
  1077. heartbeat: void 0
  1078. };
  1079. val = buffer.readUInt16BE(offset);
  1080. offset += 2;
  1081. fields.channelMax = val;
  1082. val = buffer.readUInt32BE(offset);
  1083. offset += 4;
  1084. fields.frameMax = val;
  1085. val = buffer.readUInt16BE(offset);
  1086. offset += 2;
  1087. fields.heartbeat = val;
  1088. return fields;
  1089. }
  1090. function encodeConnectionTuneOk(channel, fields) {
  1091. var offset = 0, val = null, buffer = Buffer.alloc(20);
  1092. buffer[0] = 1;
  1093. buffer.writeUInt16BE(channel, 1);
  1094. buffer.writeUInt32BE(655391, 7);
  1095. offset = 11;
  1096. val = fields.channelMax;
  1097. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'channelMax' is the wrong type; must be a number (but not NaN)");
  1098. buffer.writeUInt16BE(val, offset);
  1099. offset += 2;
  1100. val = fields.frameMax;
  1101. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'frameMax' is the wrong type; must be a number (but not NaN)");
  1102. buffer.writeUInt32BE(val, offset);
  1103. offset += 4;
  1104. val = fields.heartbeat;
  1105. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'heartbeat' is the wrong type; must be a number (but not NaN)");
  1106. buffer.writeUInt16BE(val, offset);
  1107. offset += 2;
  1108. buffer[offset] = 206;
  1109. buffer.writeUInt32BE(offset - 7, 3);
  1110. return buffer;
  1111. }
  1112. function decodeConnectionOpen(buffer) {
  1113. var val, len, offset = 0, fields = {
  1114. virtualHost: void 0,
  1115. capabilities: void 0,
  1116. insist: void 0
  1117. };
  1118. len = buffer.readUInt8(offset);
  1119. offset++;
  1120. val = buffer.toString("utf8", offset, offset + len);
  1121. offset += len;
  1122. fields.virtualHost = val;
  1123. len = buffer.readUInt8(offset);
  1124. offset++;
  1125. val = buffer.toString("utf8", offset, offset + len);
  1126. offset += len;
  1127. fields.capabilities = val;
  1128. val = !!(1 & buffer[offset]);
  1129. fields.insist = val;
  1130. return fields;
  1131. }
  1132. function encodeConnectionOpen(channel, fields) {
  1133. var offset = 0, val = null, bits = 0, varyingSize = 0;
  1134. val = fields.virtualHost;
  1135. if (void 0 === val) val = "/"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'virtualHost' is the wrong type; must be a string (up to 255 chars)");
  1136. var virtualHost_len = Buffer.byteLength(val, "utf8");
  1137. varyingSize += virtualHost_len;
  1138. val = fields.capabilities;
  1139. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'capabilities' is the wrong type; must be a string (up to 255 chars)");
  1140. var capabilities_len = Buffer.byteLength(val, "utf8");
  1141. varyingSize += capabilities_len;
  1142. var buffer = Buffer.alloc(15 + varyingSize);
  1143. buffer[0] = 1;
  1144. buffer.writeUInt16BE(channel, 1);
  1145. buffer.writeUInt32BE(655400, 7);
  1146. offset = 11;
  1147. val = fields.virtualHost;
  1148. void 0 === val && (val = "/");
  1149. buffer[offset] = virtualHost_len;
  1150. offset++;
  1151. buffer.write(val, offset, "utf8");
  1152. offset += virtualHost_len;
  1153. val = fields.capabilities;
  1154. void 0 === val && (val = "");
  1155. buffer[offset] = capabilities_len;
  1156. offset++;
  1157. buffer.write(val, offset, "utf8");
  1158. offset += capabilities_len;
  1159. val = fields.insist;
  1160. void 0 === val && (val = !1);
  1161. val && (bits += 1);
  1162. buffer[offset] = bits;
  1163. offset++;
  1164. buffer[offset] = 206;
  1165. buffer.writeUInt32BE(offset - 7, 3);
  1166. return buffer;
  1167. }
  1168. function decodeConnectionOpenOk(buffer) {
  1169. var val, len, offset = 0, fields = {
  1170. knownHosts: void 0
  1171. };
  1172. len = buffer.readUInt8(offset);
  1173. offset++;
  1174. val = buffer.toString("utf8", offset, offset + len);
  1175. offset += len;
  1176. fields.knownHosts = val;
  1177. return fields;
  1178. }
  1179. function encodeConnectionOpenOk(channel, fields) {
  1180. var offset = 0, val = null, varyingSize = 0;
  1181. val = fields.knownHosts;
  1182. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'knownHosts' is the wrong type; must be a string (up to 255 chars)");
  1183. var knownHosts_len = Buffer.byteLength(val, "utf8");
  1184. varyingSize += knownHosts_len;
  1185. var buffer = Buffer.alloc(13 + varyingSize);
  1186. buffer[0] = 1;
  1187. buffer.writeUInt16BE(channel, 1);
  1188. buffer.writeUInt32BE(655401, 7);
  1189. offset = 11;
  1190. val = fields.knownHosts;
  1191. void 0 === val && (val = "");
  1192. buffer[offset] = knownHosts_len;
  1193. offset++;
  1194. buffer.write(val, offset, "utf8");
  1195. offset += knownHosts_len;
  1196. buffer[offset] = 206;
  1197. buffer.writeUInt32BE(offset - 7, 3);
  1198. return buffer;
  1199. }
  1200. function decodeConnectionClose(buffer) {
  1201. var val, len, offset = 0, fields = {
  1202. replyCode: void 0,
  1203. replyText: void 0,
  1204. classId: void 0,
  1205. methodId: void 0
  1206. };
  1207. val = buffer.readUInt16BE(offset);
  1208. offset += 2;
  1209. fields.replyCode = val;
  1210. len = buffer.readUInt8(offset);
  1211. offset++;
  1212. val = buffer.toString("utf8", offset, offset + len);
  1213. offset += len;
  1214. fields.replyText = val;
  1215. val = buffer.readUInt16BE(offset);
  1216. offset += 2;
  1217. fields.classId = val;
  1218. val = buffer.readUInt16BE(offset);
  1219. offset += 2;
  1220. fields.methodId = val;
  1221. return fields;
  1222. }
  1223. function encodeConnectionClose(channel, fields) {
  1224. var offset = 0, val = null, varyingSize = 0;
  1225. val = fields.replyText;
  1226. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");
  1227. var replyText_len = Buffer.byteLength(val, "utf8");
  1228. varyingSize += replyText_len;
  1229. var buffer = Buffer.alloc(19 + varyingSize);
  1230. buffer[0] = 1;
  1231. buffer.writeUInt16BE(channel, 1);
  1232. buffer.writeUInt32BE(655410, 7);
  1233. offset = 11;
  1234. val = fields.replyCode;
  1235. if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'");
  1236. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");
  1237. buffer.writeUInt16BE(val, offset);
  1238. offset += 2;
  1239. val = fields.replyText;
  1240. void 0 === val && (val = "");
  1241. buffer[offset] = replyText_len;
  1242. offset++;
  1243. buffer.write(val, offset, "utf8");
  1244. offset += replyText_len;
  1245. val = fields.classId;
  1246. if (void 0 === val) throw new Error("Missing value for mandatory field 'classId'");
  1247. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)");
  1248. buffer.writeUInt16BE(val, offset);
  1249. offset += 2;
  1250. val = fields.methodId;
  1251. if (void 0 === val) throw new Error("Missing value for mandatory field 'methodId'");
  1252. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)");
  1253. buffer.writeUInt16BE(val, offset);
  1254. offset += 2;
  1255. buffer[offset] = 206;
  1256. buffer.writeUInt32BE(offset - 7, 3);
  1257. return buffer;
  1258. }
  1259. function decodeConnectionCloseOk(buffer) {
  1260. return {};
  1261. }
  1262. function encodeConnectionCloseOk(channel, fields) {
  1263. var offset = 0, buffer = Buffer.alloc(12);
  1264. buffer[0] = 1;
  1265. buffer.writeUInt16BE(channel, 1);
  1266. buffer.writeUInt32BE(655411, 7);
  1267. offset = 11;
  1268. buffer[offset] = 206;
  1269. buffer.writeUInt32BE(offset - 7, 3);
  1270. return buffer;
  1271. }
  1272. function decodeConnectionBlocked(buffer) {
  1273. var val, len, offset = 0, fields = {
  1274. reason: void 0
  1275. };
  1276. len = buffer.readUInt8(offset);
  1277. offset++;
  1278. val = buffer.toString("utf8", offset, offset + len);
  1279. offset += len;
  1280. fields.reason = val;
  1281. return fields;
  1282. }
  1283. function encodeConnectionBlocked(channel, fields) {
  1284. var offset = 0, val = null, varyingSize = 0;
  1285. val = fields.reason;
  1286. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'reason' is the wrong type; must be a string (up to 255 chars)");
  1287. var reason_len = Buffer.byteLength(val, "utf8");
  1288. varyingSize += reason_len;
  1289. var buffer = Buffer.alloc(13 + varyingSize);
  1290. buffer[0] = 1;
  1291. buffer.writeUInt16BE(channel, 1);
  1292. buffer.writeUInt32BE(655420, 7);
  1293. offset = 11;
  1294. val = fields.reason;
  1295. void 0 === val && (val = "");
  1296. buffer[offset] = reason_len;
  1297. offset++;
  1298. buffer.write(val, offset, "utf8");
  1299. offset += reason_len;
  1300. buffer[offset] = 206;
  1301. buffer.writeUInt32BE(offset - 7, 3);
  1302. return buffer;
  1303. }
  1304. function decodeConnectionUnblocked(buffer) {
  1305. return {};
  1306. }
  1307. function encodeConnectionUnblocked(channel, fields) {
  1308. var offset = 0, buffer = Buffer.alloc(12);
  1309. buffer[0] = 1;
  1310. buffer.writeUInt16BE(channel, 1);
  1311. buffer.writeUInt32BE(655421, 7);
  1312. offset = 11;
  1313. buffer[offset] = 206;
  1314. buffer.writeUInt32BE(offset - 7, 3);
  1315. return buffer;
  1316. }
  1317. function decodeConnectionUpdateSecret(buffer) {
  1318. var val, len, offset = 0, fields = {
  1319. newSecret: void 0,
  1320. reason: void 0
  1321. };
  1322. len = buffer.readUInt32BE(offset);
  1323. offset += 4;
  1324. val = buffer.subarray(offset, offset + len);
  1325. offset += len;
  1326. fields.newSecret = val;
  1327. len = buffer.readUInt8(offset);
  1328. offset++;
  1329. val = buffer.toString("utf8", offset, offset + len);
  1330. offset += len;
  1331. fields.reason = val;
  1332. return fields;
  1333. }
  1334. function encodeConnectionUpdateSecret(channel, fields) {
  1335. var len, offset = 0, val = null, varyingSize = 0;
  1336. val = fields.newSecret;
  1337. if (void 0 === val) throw new Error("Missing value for mandatory field 'newSecret'");
  1338. if (!Buffer.isBuffer(val)) throw new TypeError("Field 'newSecret' is the wrong type; must be a Buffer");
  1339. varyingSize += val.length;
  1340. val = fields.reason;
  1341. if (void 0 === val) throw new Error("Missing value for mandatory field 'reason'");
  1342. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'reason' is the wrong type; must be a string (up to 255 chars)");
  1343. var reason_len = Buffer.byteLength(val, "utf8");
  1344. varyingSize += reason_len;
  1345. var buffer = Buffer.alloc(17 + varyingSize);
  1346. buffer[0] = 1;
  1347. buffer.writeUInt16BE(channel, 1);
  1348. buffer.writeUInt32BE(655430, 7);
  1349. offset = 11;
  1350. val = fields.newSecret;
  1351. void 0 === val && (val = Buffer.from(void 0));
  1352. len = val.length;
  1353. buffer.writeUInt32BE(len, offset);
  1354. offset += 4;
  1355. val.copy(buffer, offset);
  1356. offset += len;
  1357. val = fields.reason;
  1358. void 0 === val && (val = void 0);
  1359. buffer[offset] = reason_len;
  1360. offset++;
  1361. buffer.write(val, offset, "utf8");
  1362. offset += reason_len;
  1363. buffer[offset] = 206;
  1364. buffer.writeUInt32BE(offset - 7, 3);
  1365. return buffer;
  1366. }
  1367. function decodeConnectionUpdateSecretOk(buffer) {
  1368. return {};
  1369. }
  1370. function encodeConnectionUpdateSecretOk(channel, fields) {
  1371. var offset = 0, buffer = Buffer.alloc(12);
  1372. buffer[0] = 1;
  1373. buffer.writeUInt16BE(channel, 1);
  1374. buffer.writeUInt32BE(655431, 7);
  1375. offset = 11;
  1376. buffer[offset] = 206;
  1377. buffer.writeUInt32BE(offset - 7, 3);
  1378. return buffer;
  1379. }
  1380. function decodeChannelOpen(buffer) {
  1381. var val, len, offset = 0, fields = {
  1382. outOfBand: void 0
  1383. };
  1384. len = buffer.readUInt8(offset);
  1385. offset++;
  1386. val = buffer.toString("utf8", offset, offset + len);
  1387. offset += len;
  1388. fields.outOfBand = val;
  1389. return fields;
  1390. }
  1391. function encodeChannelOpen(channel, fields) {
  1392. var offset = 0, val = null, varyingSize = 0;
  1393. val = fields.outOfBand;
  1394. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'outOfBand' is the wrong type; must be a string (up to 255 chars)");
  1395. var outOfBand_len = Buffer.byteLength(val, "utf8");
  1396. varyingSize += outOfBand_len;
  1397. var buffer = Buffer.alloc(13 + varyingSize);
  1398. buffer[0] = 1;
  1399. buffer.writeUInt16BE(channel, 1);
  1400. buffer.writeUInt32BE(1310730, 7);
  1401. offset = 11;
  1402. val = fields.outOfBand;
  1403. void 0 === val && (val = "");
  1404. buffer[offset] = outOfBand_len;
  1405. offset++;
  1406. buffer.write(val, offset, "utf8");
  1407. offset += outOfBand_len;
  1408. buffer[offset] = 206;
  1409. buffer.writeUInt32BE(offset - 7, 3);
  1410. return buffer;
  1411. }
  1412. function decodeChannelOpenOk(buffer) {
  1413. var val, len, offset = 0, fields = {
  1414. channelId: void 0
  1415. };
  1416. len = buffer.readUInt32BE(offset);
  1417. offset += 4;
  1418. val = buffer.subarray(offset, offset + len);
  1419. offset += len;
  1420. fields.channelId = val;
  1421. return fields;
  1422. }
  1423. function encodeChannelOpenOk(channel, fields) {
  1424. var len, offset = 0, val = null, varyingSize = 0;
  1425. val = fields.channelId;
  1426. if (void 0 === val) val = Buffer.from(""); else if (!Buffer.isBuffer(val)) throw new TypeError("Field 'channelId' is the wrong type; must be a Buffer");
  1427. varyingSize += val.length;
  1428. var buffer = Buffer.alloc(16 + varyingSize);
  1429. buffer[0] = 1;
  1430. buffer.writeUInt16BE(channel, 1);
  1431. buffer.writeUInt32BE(1310731, 7);
  1432. offset = 11;
  1433. val = fields.channelId;
  1434. void 0 === val && (val = Buffer.from(""));
  1435. len = val.length;
  1436. buffer.writeUInt32BE(len, offset);
  1437. offset += 4;
  1438. val.copy(buffer, offset);
  1439. offset += len;
  1440. buffer[offset] = 206;
  1441. buffer.writeUInt32BE(offset - 7, 3);
  1442. return buffer;
  1443. }
  1444. function decodeChannelFlow(buffer) {
  1445. var val, fields = {
  1446. active: void 0
  1447. };
  1448. val = !!(1 & buffer[0]);
  1449. fields.active = val;
  1450. return fields;
  1451. }
  1452. function encodeChannelFlow(channel, fields) {
  1453. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13);
  1454. buffer[0] = 1;
  1455. buffer.writeUInt16BE(channel, 1);
  1456. buffer.writeUInt32BE(1310740, 7);
  1457. offset = 11;
  1458. val = fields.active;
  1459. if (void 0 === val) throw new Error("Missing value for mandatory field 'active'");
  1460. val && (bits += 1);
  1461. buffer[offset] = bits;
  1462. offset++;
  1463. buffer[offset] = 206;
  1464. buffer.writeUInt32BE(offset - 7, 3);
  1465. return buffer;
  1466. }
  1467. function decodeChannelFlowOk(buffer) {
  1468. var val, fields = {
  1469. active: void 0
  1470. };
  1471. val = !!(1 & buffer[0]);
  1472. fields.active = val;
  1473. return fields;
  1474. }
  1475. function encodeChannelFlowOk(channel, fields) {
  1476. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13);
  1477. buffer[0] = 1;
  1478. buffer.writeUInt16BE(channel, 1);
  1479. buffer.writeUInt32BE(1310741, 7);
  1480. offset = 11;
  1481. val = fields.active;
  1482. if (void 0 === val) throw new Error("Missing value for mandatory field 'active'");
  1483. val && (bits += 1);
  1484. buffer[offset] = bits;
  1485. offset++;
  1486. buffer[offset] = 206;
  1487. buffer.writeUInt32BE(offset - 7, 3);
  1488. return buffer;
  1489. }
  1490. function decodeChannelClose(buffer) {
  1491. var val, len, offset = 0, fields = {
  1492. replyCode: void 0,
  1493. replyText: void 0,
  1494. classId: void 0,
  1495. methodId: void 0
  1496. };
  1497. val = buffer.readUInt16BE(offset);
  1498. offset += 2;
  1499. fields.replyCode = val;
  1500. len = buffer.readUInt8(offset);
  1501. offset++;
  1502. val = buffer.toString("utf8", offset, offset + len);
  1503. offset += len;
  1504. fields.replyText = val;
  1505. val = buffer.readUInt16BE(offset);
  1506. offset += 2;
  1507. fields.classId = val;
  1508. val = buffer.readUInt16BE(offset);
  1509. offset += 2;
  1510. fields.methodId = val;
  1511. return fields;
  1512. }
  1513. function encodeChannelClose(channel, fields) {
  1514. var offset = 0, val = null, varyingSize = 0;
  1515. val = fields.replyText;
  1516. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyText' is the wrong type; must be a string (up to 255 chars)");
  1517. var replyText_len = Buffer.byteLength(val, "utf8");
  1518. varyingSize += replyText_len;
  1519. var buffer = Buffer.alloc(19 + varyingSize);
  1520. buffer[0] = 1;
  1521. buffer.writeUInt16BE(channel, 1);
  1522. buffer.writeUInt32BE(1310760, 7);
  1523. offset = 11;
  1524. val = fields.replyCode;
  1525. if (void 0 === val) throw new Error("Missing value for mandatory field 'replyCode'");
  1526. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'replyCode' is the wrong type; must be a number (but not NaN)");
  1527. buffer.writeUInt16BE(val, offset);
  1528. offset += 2;
  1529. val = fields.replyText;
  1530. void 0 === val && (val = "");
  1531. buffer[offset] = replyText_len;
  1532. offset++;
  1533. buffer.write(val, offset, "utf8");
  1534. offset += replyText_len;
  1535. val = fields.classId;
  1536. if (void 0 === val) throw new Error("Missing value for mandatory field 'classId'");
  1537. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'classId' is the wrong type; must be a number (but not NaN)");
  1538. buffer.writeUInt16BE(val, offset);
  1539. offset += 2;
  1540. val = fields.methodId;
  1541. if (void 0 === val) throw new Error("Missing value for mandatory field 'methodId'");
  1542. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'methodId' is the wrong type; must be a number (but not NaN)");
  1543. buffer.writeUInt16BE(val, offset);
  1544. offset += 2;
  1545. buffer[offset] = 206;
  1546. buffer.writeUInt32BE(offset - 7, 3);
  1547. return buffer;
  1548. }
  1549. function decodeChannelCloseOk(buffer) {
  1550. return {};
  1551. }
  1552. function encodeChannelCloseOk(channel, fields) {
  1553. var offset = 0, buffer = Buffer.alloc(12);
  1554. buffer[0] = 1;
  1555. buffer.writeUInt16BE(channel, 1);
  1556. buffer.writeUInt32BE(1310761, 7);
  1557. offset = 11;
  1558. buffer[offset] = 206;
  1559. buffer.writeUInt32BE(offset - 7, 3);
  1560. return buffer;
  1561. }
  1562. function decodeAccessRequest(buffer) {
  1563. var val, len, offset = 0, fields = {
  1564. realm: void 0,
  1565. exclusive: void 0,
  1566. passive: void 0,
  1567. active: void 0,
  1568. write: void 0,
  1569. read: void 0
  1570. };
  1571. len = buffer.readUInt8(offset);
  1572. offset++;
  1573. val = buffer.toString("utf8", offset, offset + len);
  1574. offset += len;
  1575. fields.realm = val;
  1576. val = !!(1 & buffer[offset]);
  1577. fields.exclusive = val;
  1578. val = !!(2 & buffer[offset]);
  1579. fields.passive = val;
  1580. val = !!(4 & buffer[offset]);
  1581. fields.active = val;
  1582. val = !!(8 & buffer[offset]);
  1583. fields.write = val;
  1584. val = !!(16 & buffer[offset]);
  1585. fields.read = val;
  1586. return fields;
  1587. }
  1588. function encodeAccessRequest(channel, fields) {
  1589. var offset = 0, val = null, bits = 0, varyingSize = 0;
  1590. val = fields.realm;
  1591. if (void 0 === val) val = "/data"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'realm' is the wrong type; must be a string (up to 255 chars)");
  1592. var realm_len = Buffer.byteLength(val, "utf8");
  1593. varyingSize += realm_len;
  1594. var buffer = Buffer.alloc(14 + varyingSize);
  1595. buffer[0] = 1;
  1596. buffer.writeUInt16BE(channel, 1);
  1597. buffer.writeUInt32BE(1966090, 7);
  1598. offset = 11;
  1599. val = fields.realm;
  1600. void 0 === val && (val = "/data");
  1601. buffer[offset] = realm_len;
  1602. offset++;
  1603. buffer.write(val, offset, "utf8");
  1604. offset += realm_len;
  1605. val = fields.exclusive;
  1606. void 0 === val && (val = !1);
  1607. val && (bits += 1);
  1608. val = fields.passive;
  1609. void 0 === val && (val = !0);
  1610. val && (bits += 2);
  1611. val = fields.active;
  1612. void 0 === val && (val = !0);
  1613. val && (bits += 4);
  1614. val = fields.write;
  1615. void 0 === val && (val = !0);
  1616. val && (bits += 8);
  1617. val = fields.read;
  1618. void 0 === val && (val = !0);
  1619. val && (bits += 16);
  1620. buffer[offset] = bits;
  1621. offset++;
  1622. buffer[offset] = 206;
  1623. buffer.writeUInt32BE(offset - 7, 3);
  1624. return buffer;
  1625. }
  1626. function decodeAccessRequestOk(buffer) {
  1627. var val, offset = 0, fields = {
  1628. ticket: void 0
  1629. };
  1630. val = buffer.readUInt16BE(offset);
  1631. offset += 2;
  1632. fields.ticket = val;
  1633. return fields;
  1634. }
  1635. function encodeAccessRequestOk(channel, fields) {
  1636. var offset = 0, val = null, buffer = Buffer.alloc(14);
  1637. buffer[0] = 1;
  1638. buffer.writeUInt16BE(channel, 1);
  1639. buffer.writeUInt32BE(1966091, 7);
  1640. offset = 11;
  1641. val = fields.ticket;
  1642. if (void 0 === val) val = 1; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  1643. buffer.writeUInt16BE(val, offset);
  1644. offset += 2;
  1645. buffer[offset] = 206;
  1646. buffer.writeUInt32BE(offset - 7, 3);
  1647. return buffer;
  1648. }
  1649. function decodeExchangeDeclare(buffer) {
  1650. var val, len, offset = 0, fields = {
  1651. ticket: void 0,
  1652. exchange: void 0,
  1653. type: void 0,
  1654. passive: void 0,
  1655. durable: void 0,
  1656. autoDelete: void 0,
  1657. internal: void 0,
  1658. nowait: void 0,
  1659. arguments: void 0
  1660. };
  1661. val = buffer.readUInt16BE(offset);
  1662. offset += 2;
  1663. fields.ticket = val;
  1664. len = buffer.readUInt8(offset);
  1665. offset++;
  1666. val = buffer.toString("utf8", offset, offset + len);
  1667. offset += len;
  1668. fields.exchange = val;
  1669. len = buffer.readUInt8(offset);
  1670. offset++;
  1671. val = buffer.toString("utf8", offset, offset + len);
  1672. offset += len;
  1673. fields.type = val;
  1674. val = !!(1 & buffer[offset]);
  1675. fields.passive = val;
  1676. val = !!(2 & buffer[offset]);
  1677. fields.durable = val;
  1678. val = !!(4 & buffer[offset]);
  1679. fields.autoDelete = val;
  1680. val = !!(8 & buffer[offset]);
  1681. fields.internal = val;
  1682. val = !!(16 & buffer[offset]);
  1683. fields.nowait = val;
  1684. offset++;
  1685. len = buffer.readUInt32BE(offset);
  1686. offset += 4;
  1687. val = decodeFields(buffer.subarray(offset, offset + len));
  1688. offset += len;
  1689. fields.arguments = val;
  1690. return fields;
  1691. }
  1692. function encodeExchangeDeclare(channel, fields) {
  1693. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  1694. val = fields.exchange;
  1695. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  1696. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  1697. var exchange_len = Buffer.byteLength(val, "utf8");
  1698. varyingSize += exchange_len;
  1699. val = fields.type;
  1700. if (void 0 === val) val = "direct"; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)");
  1701. var type_len = Buffer.byteLength(val, "utf8");
  1702. varyingSize += type_len;
  1703. val = fields.arguments;
  1704. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  1705. len = encodeTable(SCRATCH, val, scratchOffset);
  1706. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  1707. scratchOffset += len;
  1708. varyingSize += arguments_encoded.length;
  1709. var buffer = Buffer.alloc(17 + varyingSize);
  1710. buffer[0] = 1;
  1711. buffer.writeUInt16BE(channel, 1);
  1712. buffer.writeUInt32BE(2621450, 7);
  1713. offset = 11;
  1714. val = fields.ticket;
  1715. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  1716. buffer.writeUInt16BE(val, offset);
  1717. offset += 2;
  1718. val = fields.exchange;
  1719. void 0 === val && (val = void 0);
  1720. buffer[offset] = exchange_len;
  1721. offset++;
  1722. buffer.write(val, offset, "utf8");
  1723. offset += exchange_len;
  1724. val = fields.type;
  1725. void 0 === val && (val = "direct");
  1726. buffer[offset] = type_len;
  1727. offset++;
  1728. buffer.write(val, offset, "utf8");
  1729. offset += type_len;
  1730. val = fields.passive;
  1731. void 0 === val && (val = !1);
  1732. val && (bits += 1);
  1733. val = fields.durable;
  1734. void 0 === val && (val = !1);
  1735. val && (bits += 2);
  1736. val = fields.autoDelete;
  1737. void 0 === val && (val = !1);
  1738. val && (bits += 4);
  1739. val = fields.internal;
  1740. void 0 === val && (val = !1);
  1741. val && (bits += 8);
  1742. val = fields.nowait;
  1743. void 0 === val && (val = !1);
  1744. val && (bits += 16);
  1745. buffer[offset] = bits;
  1746. offset++;
  1747. bits = 0;
  1748. offset += arguments_encoded.copy(buffer, offset);
  1749. buffer[offset] = 206;
  1750. buffer.writeUInt32BE(offset - 7, 3);
  1751. return buffer;
  1752. }
  1753. function decodeExchangeDeclareOk(buffer) {
  1754. return {};
  1755. }
  1756. function encodeExchangeDeclareOk(channel, fields) {
  1757. var offset = 0, buffer = Buffer.alloc(12);
  1758. buffer[0] = 1;
  1759. buffer.writeUInt16BE(channel, 1);
  1760. buffer.writeUInt32BE(2621451, 7);
  1761. offset = 11;
  1762. buffer[offset] = 206;
  1763. buffer.writeUInt32BE(offset - 7, 3);
  1764. return buffer;
  1765. }
  1766. function decodeExchangeDelete(buffer) {
  1767. var val, len, offset = 0, fields = {
  1768. ticket: void 0,
  1769. exchange: void 0,
  1770. ifUnused: void 0,
  1771. nowait: void 0
  1772. };
  1773. val = buffer.readUInt16BE(offset);
  1774. offset += 2;
  1775. fields.ticket = val;
  1776. len = buffer.readUInt8(offset);
  1777. offset++;
  1778. val = buffer.toString("utf8", offset, offset + len);
  1779. offset += len;
  1780. fields.exchange = val;
  1781. val = !!(1 & buffer[offset]);
  1782. fields.ifUnused = val;
  1783. val = !!(2 & buffer[offset]);
  1784. fields.nowait = val;
  1785. return fields;
  1786. }
  1787. function encodeExchangeDelete(channel, fields) {
  1788. var offset = 0, val = null, bits = 0, varyingSize = 0;
  1789. val = fields.exchange;
  1790. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  1791. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  1792. var exchange_len = Buffer.byteLength(val, "utf8");
  1793. varyingSize += exchange_len;
  1794. var buffer = Buffer.alloc(16 + varyingSize);
  1795. buffer[0] = 1;
  1796. buffer.writeUInt16BE(channel, 1);
  1797. buffer.writeUInt32BE(2621460, 7);
  1798. offset = 11;
  1799. val = fields.ticket;
  1800. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  1801. buffer.writeUInt16BE(val, offset);
  1802. offset += 2;
  1803. val = fields.exchange;
  1804. void 0 === val && (val = void 0);
  1805. buffer[offset] = exchange_len;
  1806. offset++;
  1807. buffer.write(val, offset, "utf8");
  1808. offset += exchange_len;
  1809. val = fields.ifUnused;
  1810. void 0 === val && (val = !1);
  1811. val && (bits += 1);
  1812. val = fields.nowait;
  1813. void 0 === val && (val = !1);
  1814. val && (bits += 2);
  1815. buffer[offset] = bits;
  1816. offset++;
  1817. buffer[offset] = 206;
  1818. buffer.writeUInt32BE(offset - 7, 3);
  1819. return buffer;
  1820. }
  1821. function decodeExchangeDeleteOk(buffer) {
  1822. return {};
  1823. }
  1824. function encodeExchangeDeleteOk(channel, fields) {
  1825. var offset = 0, buffer = Buffer.alloc(12);
  1826. buffer[0] = 1;
  1827. buffer.writeUInt16BE(channel, 1);
  1828. buffer.writeUInt32BE(2621461, 7);
  1829. offset = 11;
  1830. buffer[offset] = 206;
  1831. buffer.writeUInt32BE(offset - 7, 3);
  1832. return buffer;
  1833. }
  1834. function decodeExchangeBind(buffer) {
  1835. var val, len, offset = 0, fields = {
  1836. ticket: void 0,
  1837. destination: void 0,
  1838. source: void 0,
  1839. routingKey: void 0,
  1840. nowait: void 0,
  1841. arguments: void 0
  1842. };
  1843. val = buffer.readUInt16BE(offset);
  1844. offset += 2;
  1845. fields.ticket = val;
  1846. len = buffer.readUInt8(offset);
  1847. offset++;
  1848. val = buffer.toString("utf8", offset, offset + len);
  1849. offset += len;
  1850. fields.destination = val;
  1851. len = buffer.readUInt8(offset);
  1852. offset++;
  1853. val = buffer.toString("utf8", offset, offset + len);
  1854. offset += len;
  1855. fields.source = val;
  1856. len = buffer.readUInt8(offset);
  1857. offset++;
  1858. val = buffer.toString("utf8", offset, offset + len);
  1859. offset += len;
  1860. fields.routingKey = val;
  1861. val = !!(1 & buffer[offset]);
  1862. fields.nowait = val;
  1863. offset++;
  1864. len = buffer.readUInt32BE(offset);
  1865. offset += 4;
  1866. val = decodeFields(buffer.subarray(offset, offset + len));
  1867. offset += len;
  1868. fields.arguments = val;
  1869. return fields;
  1870. }
  1871. function encodeExchangeBind(channel, fields) {
  1872. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  1873. val = fields.destination;
  1874. if (void 0 === val) throw new Error("Missing value for mandatory field 'destination'");
  1875. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)");
  1876. var destination_len = Buffer.byteLength(val, "utf8");
  1877. varyingSize += destination_len;
  1878. val = fields.source;
  1879. if (void 0 === val) throw new Error("Missing value for mandatory field 'source'");
  1880. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)");
  1881. var source_len = Buffer.byteLength(val, "utf8");
  1882. varyingSize += source_len;
  1883. val = fields.routingKey;
  1884. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  1885. var routingKey_len = Buffer.byteLength(val, "utf8");
  1886. varyingSize += routingKey_len;
  1887. val = fields.arguments;
  1888. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  1889. len = encodeTable(SCRATCH, val, scratchOffset);
  1890. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  1891. scratchOffset += len;
  1892. varyingSize += arguments_encoded.length;
  1893. var buffer = Buffer.alloc(18 + varyingSize);
  1894. buffer[0] = 1;
  1895. buffer.writeUInt16BE(channel, 1);
  1896. buffer.writeUInt32BE(2621470, 7);
  1897. offset = 11;
  1898. val = fields.ticket;
  1899. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  1900. buffer.writeUInt16BE(val, offset);
  1901. offset += 2;
  1902. val = fields.destination;
  1903. void 0 === val && (val = void 0);
  1904. buffer[offset] = destination_len;
  1905. offset++;
  1906. buffer.write(val, offset, "utf8");
  1907. offset += destination_len;
  1908. val = fields.source;
  1909. void 0 === val && (val = void 0);
  1910. buffer[offset] = source_len;
  1911. offset++;
  1912. buffer.write(val, offset, "utf8");
  1913. offset += source_len;
  1914. val = fields.routingKey;
  1915. void 0 === val && (val = "");
  1916. buffer[offset] = routingKey_len;
  1917. offset++;
  1918. buffer.write(val, offset, "utf8");
  1919. offset += routingKey_len;
  1920. val = fields.nowait;
  1921. void 0 === val && (val = !1);
  1922. val && (bits += 1);
  1923. buffer[offset] = bits;
  1924. offset++;
  1925. bits = 0;
  1926. offset += arguments_encoded.copy(buffer, offset);
  1927. buffer[offset] = 206;
  1928. buffer.writeUInt32BE(offset - 7, 3);
  1929. return buffer;
  1930. }
  1931. function decodeExchangeBindOk(buffer) {
  1932. return {};
  1933. }
  1934. function encodeExchangeBindOk(channel, fields) {
  1935. var offset = 0, buffer = Buffer.alloc(12);
  1936. buffer[0] = 1;
  1937. buffer.writeUInt16BE(channel, 1);
  1938. buffer.writeUInt32BE(2621471, 7);
  1939. offset = 11;
  1940. buffer[offset] = 206;
  1941. buffer.writeUInt32BE(offset - 7, 3);
  1942. return buffer;
  1943. }
  1944. function decodeExchangeUnbind(buffer) {
  1945. var val, len, offset = 0, fields = {
  1946. ticket: void 0,
  1947. destination: void 0,
  1948. source: void 0,
  1949. routingKey: void 0,
  1950. nowait: void 0,
  1951. arguments: void 0
  1952. };
  1953. val = buffer.readUInt16BE(offset);
  1954. offset += 2;
  1955. fields.ticket = val;
  1956. len = buffer.readUInt8(offset);
  1957. offset++;
  1958. val = buffer.toString("utf8", offset, offset + len);
  1959. offset += len;
  1960. fields.destination = val;
  1961. len = buffer.readUInt8(offset);
  1962. offset++;
  1963. val = buffer.toString("utf8", offset, offset + len);
  1964. offset += len;
  1965. fields.source = val;
  1966. len = buffer.readUInt8(offset);
  1967. offset++;
  1968. val = buffer.toString("utf8", offset, offset + len);
  1969. offset += len;
  1970. fields.routingKey = val;
  1971. val = !!(1 & buffer[offset]);
  1972. fields.nowait = val;
  1973. offset++;
  1974. len = buffer.readUInt32BE(offset);
  1975. offset += 4;
  1976. val = decodeFields(buffer.subarray(offset, offset + len));
  1977. offset += len;
  1978. fields.arguments = val;
  1979. return fields;
  1980. }
  1981. function encodeExchangeUnbind(channel, fields) {
  1982. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  1983. val = fields.destination;
  1984. if (void 0 === val) throw new Error("Missing value for mandatory field 'destination'");
  1985. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'destination' is the wrong type; must be a string (up to 255 chars)");
  1986. var destination_len = Buffer.byteLength(val, "utf8");
  1987. varyingSize += destination_len;
  1988. val = fields.source;
  1989. if (void 0 === val) throw new Error("Missing value for mandatory field 'source'");
  1990. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'source' is the wrong type; must be a string (up to 255 chars)");
  1991. var source_len = Buffer.byteLength(val, "utf8");
  1992. varyingSize += source_len;
  1993. val = fields.routingKey;
  1994. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  1995. var routingKey_len = Buffer.byteLength(val, "utf8");
  1996. varyingSize += routingKey_len;
  1997. val = fields.arguments;
  1998. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  1999. len = encodeTable(SCRATCH, val, scratchOffset);
  2000. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  2001. scratchOffset += len;
  2002. varyingSize += arguments_encoded.length;
  2003. var buffer = Buffer.alloc(18 + varyingSize);
  2004. buffer[0] = 1;
  2005. buffer.writeUInt16BE(channel, 1);
  2006. buffer.writeUInt32BE(2621480, 7);
  2007. offset = 11;
  2008. val = fields.ticket;
  2009. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2010. buffer.writeUInt16BE(val, offset);
  2011. offset += 2;
  2012. val = fields.destination;
  2013. void 0 === val && (val = void 0);
  2014. buffer[offset] = destination_len;
  2015. offset++;
  2016. buffer.write(val, offset, "utf8");
  2017. offset += destination_len;
  2018. val = fields.source;
  2019. void 0 === val && (val = void 0);
  2020. buffer[offset] = source_len;
  2021. offset++;
  2022. buffer.write(val, offset, "utf8");
  2023. offset += source_len;
  2024. val = fields.routingKey;
  2025. void 0 === val && (val = "");
  2026. buffer[offset] = routingKey_len;
  2027. offset++;
  2028. buffer.write(val, offset, "utf8");
  2029. offset += routingKey_len;
  2030. val = fields.nowait;
  2031. void 0 === val && (val = !1);
  2032. val && (bits += 1);
  2033. buffer[offset] = bits;
  2034. offset++;
  2035. bits = 0;
  2036. offset += arguments_encoded.copy(buffer, offset);
  2037. buffer[offset] = 206;
  2038. buffer.writeUInt32BE(offset - 7, 3);
  2039. return buffer;
  2040. }
  2041. function decodeExchangeUnbindOk(buffer) {
  2042. return {};
  2043. }
  2044. function encodeExchangeUnbindOk(channel, fields) {
  2045. var offset = 0, buffer = Buffer.alloc(12);
  2046. buffer[0] = 1;
  2047. buffer.writeUInt16BE(channel, 1);
  2048. buffer.writeUInt32BE(2621491, 7);
  2049. offset = 11;
  2050. buffer[offset] = 206;
  2051. buffer.writeUInt32BE(offset - 7, 3);
  2052. return buffer;
  2053. }
  2054. function decodeQueueDeclare(buffer) {
  2055. var val, len, offset = 0, fields = {
  2056. ticket: void 0,
  2057. queue: void 0,
  2058. passive: void 0,
  2059. durable: void 0,
  2060. exclusive: void 0,
  2061. autoDelete: void 0,
  2062. nowait: void 0,
  2063. arguments: void 0
  2064. };
  2065. val = buffer.readUInt16BE(offset);
  2066. offset += 2;
  2067. fields.ticket = val;
  2068. len = buffer.readUInt8(offset);
  2069. offset++;
  2070. val = buffer.toString("utf8", offset, offset + len);
  2071. offset += len;
  2072. fields.queue = val;
  2073. val = !!(1 & buffer[offset]);
  2074. fields.passive = val;
  2075. val = !!(2 & buffer[offset]);
  2076. fields.durable = val;
  2077. val = !!(4 & buffer[offset]);
  2078. fields.exclusive = val;
  2079. val = !!(8 & buffer[offset]);
  2080. fields.autoDelete = val;
  2081. val = !!(16 & buffer[offset]);
  2082. fields.nowait = val;
  2083. offset++;
  2084. len = buffer.readUInt32BE(offset);
  2085. offset += 4;
  2086. val = decodeFields(buffer.subarray(offset, offset + len));
  2087. offset += len;
  2088. fields.arguments = val;
  2089. return fields;
  2090. }
  2091. function encodeQueueDeclare(channel, fields) {
  2092. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  2093. val = fields.queue;
  2094. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2095. var queue_len = Buffer.byteLength(val, "utf8");
  2096. varyingSize += queue_len;
  2097. val = fields.arguments;
  2098. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  2099. len = encodeTable(SCRATCH, val, scratchOffset);
  2100. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  2101. scratchOffset += len;
  2102. varyingSize += arguments_encoded.length;
  2103. var buffer = Buffer.alloc(16 + varyingSize);
  2104. buffer[0] = 1;
  2105. buffer.writeUInt16BE(channel, 1);
  2106. buffer.writeUInt32BE(3276810, 7);
  2107. offset = 11;
  2108. val = fields.ticket;
  2109. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2110. buffer.writeUInt16BE(val, offset);
  2111. offset += 2;
  2112. val = fields.queue;
  2113. void 0 === val && (val = "");
  2114. buffer[offset] = queue_len;
  2115. offset++;
  2116. buffer.write(val, offset, "utf8");
  2117. offset += queue_len;
  2118. val = fields.passive;
  2119. void 0 === val && (val = !1);
  2120. val && (bits += 1);
  2121. val = fields.durable;
  2122. void 0 === val && (val = !1);
  2123. val && (bits += 2);
  2124. val = fields.exclusive;
  2125. void 0 === val && (val = !1);
  2126. val && (bits += 4);
  2127. val = fields.autoDelete;
  2128. void 0 === val && (val = !1);
  2129. val && (bits += 8);
  2130. val = fields.nowait;
  2131. void 0 === val && (val = !1);
  2132. val && (bits += 16);
  2133. buffer[offset] = bits;
  2134. offset++;
  2135. bits = 0;
  2136. offset += arguments_encoded.copy(buffer, offset);
  2137. buffer[offset] = 206;
  2138. buffer.writeUInt32BE(offset - 7, 3);
  2139. return buffer;
  2140. }
  2141. function decodeQueueDeclareOk(buffer) {
  2142. var val, len, offset = 0, fields = {
  2143. queue: void 0,
  2144. messageCount: void 0,
  2145. consumerCount: void 0
  2146. };
  2147. len = buffer.readUInt8(offset);
  2148. offset++;
  2149. val = buffer.toString("utf8", offset, offset + len);
  2150. offset += len;
  2151. fields.queue = val;
  2152. val = buffer.readUInt32BE(offset);
  2153. offset += 4;
  2154. fields.messageCount = val;
  2155. val = buffer.readUInt32BE(offset);
  2156. offset += 4;
  2157. fields.consumerCount = val;
  2158. return fields;
  2159. }
  2160. function encodeQueueDeclareOk(channel, fields) {
  2161. var offset = 0, val = null, varyingSize = 0;
  2162. val = fields.queue;
  2163. if (void 0 === val) throw new Error("Missing value for mandatory field 'queue'");
  2164. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2165. var queue_len = Buffer.byteLength(val, "utf8");
  2166. varyingSize += queue_len;
  2167. var buffer = Buffer.alloc(21 + varyingSize);
  2168. buffer[0] = 1;
  2169. buffer.writeUInt16BE(channel, 1);
  2170. buffer.writeUInt32BE(3276811, 7);
  2171. offset = 11;
  2172. val = fields.queue;
  2173. void 0 === val && (val = void 0);
  2174. buffer[offset] = queue_len;
  2175. offset++;
  2176. buffer.write(val, offset, "utf8");
  2177. offset += queue_len;
  2178. val = fields.messageCount;
  2179. if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'");
  2180. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");
  2181. buffer.writeUInt32BE(val, offset);
  2182. offset += 4;
  2183. val = fields.consumerCount;
  2184. if (void 0 === val) throw new Error("Missing value for mandatory field 'consumerCount'");
  2185. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'consumerCount' is the wrong type; must be a number (but not NaN)");
  2186. buffer.writeUInt32BE(val, offset);
  2187. offset += 4;
  2188. buffer[offset] = 206;
  2189. buffer.writeUInt32BE(offset - 7, 3);
  2190. return buffer;
  2191. }
  2192. function decodeQueueBind(buffer) {
  2193. var val, len, offset = 0, fields = {
  2194. ticket: void 0,
  2195. queue: void 0,
  2196. exchange: void 0,
  2197. routingKey: void 0,
  2198. nowait: void 0,
  2199. arguments: void 0
  2200. };
  2201. val = buffer.readUInt16BE(offset);
  2202. offset += 2;
  2203. fields.ticket = val;
  2204. len = buffer.readUInt8(offset);
  2205. offset++;
  2206. val = buffer.toString("utf8", offset, offset + len);
  2207. offset += len;
  2208. fields.queue = val;
  2209. len = buffer.readUInt8(offset);
  2210. offset++;
  2211. val = buffer.toString("utf8", offset, offset + len);
  2212. offset += len;
  2213. fields.exchange = val;
  2214. len = buffer.readUInt8(offset);
  2215. offset++;
  2216. val = buffer.toString("utf8", offset, offset + len);
  2217. offset += len;
  2218. fields.routingKey = val;
  2219. val = !!(1 & buffer[offset]);
  2220. fields.nowait = val;
  2221. offset++;
  2222. len = buffer.readUInt32BE(offset);
  2223. offset += 4;
  2224. val = decodeFields(buffer.subarray(offset, offset + len));
  2225. offset += len;
  2226. fields.arguments = val;
  2227. return fields;
  2228. }
  2229. function encodeQueueBind(channel, fields) {
  2230. var len, offset = 0, val = null, bits = 0, varyingSize = 0, scratchOffset = 0;
  2231. val = fields.queue;
  2232. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2233. var queue_len = Buffer.byteLength(val, "utf8");
  2234. varyingSize += queue_len;
  2235. val = fields.exchange;
  2236. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  2237. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  2238. var exchange_len = Buffer.byteLength(val, "utf8");
  2239. varyingSize += exchange_len;
  2240. val = fields.routingKey;
  2241. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  2242. var routingKey_len = Buffer.byteLength(val, "utf8");
  2243. varyingSize += routingKey_len;
  2244. val = fields.arguments;
  2245. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  2246. len = encodeTable(SCRATCH, val, scratchOffset);
  2247. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  2248. scratchOffset += len;
  2249. varyingSize += arguments_encoded.length;
  2250. var buffer = Buffer.alloc(18 + varyingSize);
  2251. buffer[0] = 1;
  2252. buffer.writeUInt16BE(channel, 1);
  2253. buffer.writeUInt32BE(3276820, 7);
  2254. offset = 11;
  2255. val = fields.ticket;
  2256. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2257. buffer.writeUInt16BE(val, offset);
  2258. offset += 2;
  2259. val = fields.queue;
  2260. void 0 === val && (val = "");
  2261. buffer[offset] = queue_len;
  2262. offset++;
  2263. buffer.write(val, offset, "utf8");
  2264. offset += queue_len;
  2265. val = fields.exchange;
  2266. void 0 === val && (val = void 0);
  2267. buffer[offset] = exchange_len;
  2268. offset++;
  2269. buffer.write(val, offset, "utf8");
  2270. offset += exchange_len;
  2271. val = fields.routingKey;
  2272. void 0 === val && (val = "");
  2273. buffer[offset] = routingKey_len;
  2274. offset++;
  2275. buffer.write(val, offset, "utf8");
  2276. offset += routingKey_len;
  2277. val = fields.nowait;
  2278. void 0 === val && (val = !1);
  2279. val && (bits += 1);
  2280. buffer[offset] = bits;
  2281. offset++;
  2282. bits = 0;
  2283. offset += arguments_encoded.copy(buffer, offset);
  2284. buffer[offset] = 206;
  2285. buffer.writeUInt32BE(offset - 7, 3);
  2286. return buffer;
  2287. }
  2288. function decodeQueueBindOk(buffer) {
  2289. return {};
  2290. }
  2291. function encodeQueueBindOk(channel, fields) {
  2292. var offset = 0, buffer = Buffer.alloc(12);
  2293. buffer[0] = 1;
  2294. buffer.writeUInt16BE(channel, 1);
  2295. buffer.writeUInt32BE(3276821, 7);
  2296. offset = 11;
  2297. buffer[offset] = 206;
  2298. buffer.writeUInt32BE(offset - 7, 3);
  2299. return buffer;
  2300. }
  2301. function decodeQueuePurge(buffer) {
  2302. var val, len, offset = 0, fields = {
  2303. ticket: void 0,
  2304. queue: void 0,
  2305. nowait: void 0
  2306. };
  2307. val = buffer.readUInt16BE(offset);
  2308. offset += 2;
  2309. fields.ticket = val;
  2310. len = buffer.readUInt8(offset);
  2311. offset++;
  2312. val = buffer.toString("utf8", offset, offset + len);
  2313. offset += len;
  2314. fields.queue = val;
  2315. val = !!(1 & buffer[offset]);
  2316. fields.nowait = val;
  2317. return fields;
  2318. }
  2319. function encodeQueuePurge(channel, fields) {
  2320. var offset = 0, val = null, bits = 0, varyingSize = 0;
  2321. val = fields.queue;
  2322. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2323. var queue_len = Buffer.byteLength(val, "utf8");
  2324. varyingSize += queue_len;
  2325. var buffer = Buffer.alloc(16 + varyingSize);
  2326. buffer[0] = 1;
  2327. buffer.writeUInt16BE(channel, 1);
  2328. buffer.writeUInt32BE(3276830, 7);
  2329. offset = 11;
  2330. val = fields.ticket;
  2331. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2332. buffer.writeUInt16BE(val, offset);
  2333. offset += 2;
  2334. val = fields.queue;
  2335. void 0 === val && (val = "");
  2336. buffer[offset] = queue_len;
  2337. offset++;
  2338. buffer.write(val, offset, "utf8");
  2339. offset += queue_len;
  2340. val = fields.nowait;
  2341. void 0 === val && (val = !1);
  2342. val && (bits += 1);
  2343. buffer[offset] = bits;
  2344. offset++;
  2345. buffer[offset] = 206;
  2346. buffer.writeUInt32BE(offset - 7, 3);
  2347. return buffer;
  2348. }
  2349. function decodeQueuePurgeOk(buffer) {
  2350. var val, offset = 0, fields = {
  2351. messageCount: void 0
  2352. };
  2353. val = buffer.readUInt32BE(offset);
  2354. offset += 4;
  2355. fields.messageCount = val;
  2356. return fields;
  2357. }
  2358. function encodeQueuePurgeOk(channel, fields) {
  2359. var offset = 0, val = null, buffer = Buffer.alloc(16);
  2360. buffer[0] = 1;
  2361. buffer.writeUInt16BE(channel, 1);
  2362. buffer.writeUInt32BE(3276831, 7);
  2363. offset = 11;
  2364. val = fields.messageCount;
  2365. if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'");
  2366. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");
  2367. buffer.writeUInt32BE(val, offset);
  2368. offset += 4;
  2369. buffer[offset] = 206;
  2370. buffer.writeUInt32BE(offset - 7, 3);
  2371. return buffer;
  2372. }
  2373. function decodeQueueDelete(buffer) {
  2374. var val, len, offset = 0, fields = {
  2375. ticket: void 0,
  2376. queue: void 0,
  2377. ifUnused: void 0,
  2378. ifEmpty: void 0,
  2379. nowait: void 0
  2380. };
  2381. val = buffer.readUInt16BE(offset);
  2382. offset += 2;
  2383. fields.ticket = val;
  2384. len = buffer.readUInt8(offset);
  2385. offset++;
  2386. val = buffer.toString("utf8", offset, offset + len);
  2387. offset += len;
  2388. fields.queue = val;
  2389. val = !!(1 & buffer[offset]);
  2390. fields.ifUnused = val;
  2391. val = !!(2 & buffer[offset]);
  2392. fields.ifEmpty = val;
  2393. val = !!(4 & buffer[offset]);
  2394. fields.nowait = val;
  2395. return fields;
  2396. }
  2397. function encodeQueueDelete(channel, fields) {
  2398. var offset = 0, val = null, bits = 0, varyingSize = 0;
  2399. val = fields.queue;
  2400. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2401. var queue_len = Buffer.byteLength(val, "utf8");
  2402. varyingSize += queue_len;
  2403. var buffer = Buffer.alloc(16 + varyingSize);
  2404. buffer[0] = 1;
  2405. buffer.writeUInt16BE(channel, 1);
  2406. buffer.writeUInt32BE(3276840, 7);
  2407. offset = 11;
  2408. val = fields.ticket;
  2409. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2410. buffer.writeUInt16BE(val, offset);
  2411. offset += 2;
  2412. val = fields.queue;
  2413. void 0 === val && (val = "");
  2414. buffer[offset] = queue_len;
  2415. offset++;
  2416. buffer.write(val, offset, "utf8");
  2417. offset += queue_len;
  2418. val = fields.ifUnused;
  2419. void 0 === val && (val = !1);
  2420. val && (bits += 1);
  2421. val = fields.ifEmpty;
  2422. void 0 === val && (val = !1);
  2423. val && (bits += 2);
  2424. val = fields.nowait;
  2425. void 0 === val && (val = !1);
  2426. val && (bits += 4);
  2427. buffer[offset] = bits;
  2428. offset++;
  2429. buffer[offset] = 206;
  2430. buffer.writeUInt32BE(offset - 7, 3);
  2431. return buffer;
  2432. }
  2433. function decodeQueueDeleteOk(buffer) {
  2434. var val, offset = 0, fields = {
  2435. messageCount: void 0
  2436. };
  2437. val = buffer.readUInt32BE(offset);
  2438. offset += 4;
  2439. fields.messageCount = val;
  2440. return fields;
  2441. }
  2442. function encodeQueueDeleteOk(channel, fields) {
  2443. var offset = 0, val = null, buffer = Buffer.alloc(16);
  2444. buffer[0] = 1;
  2445. buffer.writeUInt16BE(channel, 1);
  2446. buffer.writeUInt32BE(3276841, 7);
  2447. offset = 11;
  2448. val = fields.messageCount;
  2449. if (void 0 === val) throw new Error("Missing value for mandatory field 'messageCount'");
  2450. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'messageCount' is the wrong type; must be a number (but not NaN)");
  2451. buffer.writeUInt32BE(val, offset);
  2452. offset += 4;
  2453. buffer[offset] = 206;
  2454. buffer.writeUInt32BE(offset - 7, 3);
  2455. return buffer;
  2456. }
  2457. function decodeQueueUnbind(buffer) {
  2458. var val, len, offset = 0, fields = {
  2459. ticket: void 0,
  2460. queue: void 0,
  2461. exchange: void 0,
  2462. routingKey: void 0,
  2463. arguments: void 0
  2464. };
  2465. val = buffer.readUInt16BE(offset);
  2466. offset += 2;
  2467. fields.ticket = val;
  2468. len = buffer.readUInt8(offset);
  2469. offset++;
  2470. val = buffer.toString("utf8", offset, offset + len);
  2471. offset += len;
  2472. fields.queue = val;
  2473. len = buffer.readUInt8(offset);
  2474. offset++;
  2475. val = buffer.toString("utf8", offset, offset + len);
  2476. offset += len;
  2477. fields.exchange = val;
  2478. len = buffer.readUInt8(offset);
  2479. offset++;
  2480. val = buffer.toString("utf8", offset, offset + len);
  2481. offset += len;
  2482. fields.routingKey = val;
  2483. len = buffer.readUInt32BE(offset);
  2484. offset += 4;
  2485. val = decodeFields(buffer.subarray(offset, offset + len));
  2486. offset += len;
  2487. fields.arguments = val;
  2488. return fields;
  2489. }
  2490. function encodeQueueUnbind(channel, fields) {
  2491. var len, offset = 0, val = null, varyingSize = 0, scratchOffset = 0;
  2492. val = fields.queue;
  2493. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'queue' is the wrong type; must be a string (up to 255 chars)");
  2494. var queue_len = Buffer.byteLength(val, "utf8");
  2495. varyingSize += queue_len;
  2496. val = fields.exchange;
  2497. if (void 0 === val) throw new Error("Missing value for mandatory field 'exchange'");
  2498. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'exchange' is the wrong type; must be a string (up to 255 chars)");
  2499. var exchange_len = Buffer.byteLength(val, "utf8");
  2500. varyingSize += exchange_len;
  2501. val = fields.routingKey;
  2502. if (void 0 === val) val = ""; else if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'routingKey' is the wrong type; must be a string (up to 255 chars)");
  2503. var routingKey_len = Buffer.byteLength(val, "utf8");
  2504. varyingSize += routingKey_len;
  2505. val = fields.arguments;
  2506. if (void 0 === val) val = {}; else if ("object" != typeof val) throw new TypeError("Field 'arguments' is the wrong type; must be an object");
  2507. len = encodeTable(SCRATCH, val, scratchOffset);
  2508. var arguments_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  2509. scratchOffset += len;
  2510. varyingSize += arguments_encoded.length;
  2511. var buffer = Buffer.alloc(17 + varyingSize);
  2512. buffer[0] = 1;
  2513. buffer.writeUInt16BE(channel, 1);
  2514. buffer.writeUInt32BE(3276850, 7);
  2515. offset = 11;
  2516. val = fields.ticket;
  2517. if (void 0 === val) val = 0; else if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'ticket' is the wrong type; must be a number (but not NaN)");
  2518. buffer.writeUInt16BE(val, offset);
  2519. offset += 2;
  2520. val = fields.queue;
  2521. void 0 === val && (val = "");
  2522. buffer[offset] = queue_len;
  2523. offset++;
  2524. buffer.write(val, offset, "utf8");
  2525. offset += queue_len;
  2526. val = fields.exchange;
  2527. void 0 === val && (val = void 0);
  2528. buffer[offset] = exchange_len;
  2529. offset++;
  2530. buffer.write(val, offset, "utf8");
  2531. offset += exchange_len;
  2532. val = fields.routingKey;
  2533. void 0 === val && (val = "");
  2534. buffer[offset] = routingKey_len;
  2535. offset++;
  2536. buffer.write(val, offset, "utf8");
  2537. offset += routingKey_len;
  2538. offset += arguments_encoded.copy(buffer, offset);
  2539. buffer[offset] = 206;
  2540. buffer.writeUInt32BE(offset - 7, 3);
  2541. return buffer;
  2542. }
  2543. function decodeQueueUnbindOk(buffer) {
  2544. return {};
  2545. }
  2546. function encodeQueueUnbindOk(channel, fields) {
  2547. var offset = 0, buffer = Buffer.alloc(12);
  2548. buffer[0] = 1;
  2549. buffer.writeUInt16BE(channel, 1);
  2550. buffer.writeUInt32BE(3276851, 7);
  2551. offset = 11;
  2552. buffer[offset] = 206;
  2553. buffer.writeUInt32BE(offset - 7, 3);
  2554. return buffer;
  2555. }
  2556. function decodeTxSelect(buffer) {
  2557. return {};
  2558. }
  2559. function encodeTxSelect(channel, fields) {
  2560. var offset = 0, buffer = Buffer.alloc(12);
  2561. buffer[0] = 1;
  2562. buffer.writeUInt16BE(channel, 1);
  2563. buffer.writeUInt32BE(5898250, 7);
  2564. offset = 11;
  2565. buffer[offset] = 206;
  2566. buffer.writeUInt32BE(offset - 7, 3);
  2567. return buffer;
  2568. }
  2569. function decodeTxSelectOk(buffer) {
  2570. return {};
  2571. }
  2572. function encodeTxSelectOk(channel, fields) {
  2573. var offset = 0, buffer = Buffer.alloc(12);
  2574. buffer[0] = 1;
  2575. buffer.writeUInt16BE(channel, 1);
  2576. buffer.writeUInt32BE(5898251, 7);
  2577. offset = 11;
  2578. buffer[offset] = 206;
  2579. buffer.writeUInt32BE(offset - 7, 3);
  2580. return buffer;
  2581. }
  2582. function decodeTxCommit(buffer) {
  2583. return {};
  2584. }
  2585. function encodeTxCommit(channel, fields) {
  2586. var offset = 0, buffer = Buffer.alloc(12);
  2587. buffer[0] = 1;
  2588. buffer.writeUInt16BE(channel, 1);
  2589. buffer.writeUInt32BE(5898260, 7);
  2590. offset = 11;
  2591. buffer[offset] = 206;
  2592. buffer.writeUInt32BE(offset - 7, 3);
  2593. return buffer;
  2594. }
  2595. function decodeTxCommitOk(buffer) {
  2596. return {};
  2597. }
  2598. function encodeTxCommitOk(channel, fields) {
  2599. var offset = 0, buffer = Buffer.alloc(12);
  2600. buffer[0] = 1;
  2601. buffer.writeUInt16BE(channel, 1);
  2602. buffer.writeUInt32BE(5898261, 7);
  2603. offset = 11;
  2604. buffer[offset] = 206;
  2605. buffer.writeUInt32BE(offset - 7, 3);
  2606. return buffer;
  2607. }
  2608. function decodeTxRollback(buffer) {
  2609. return {};
  2610. }
  2611. function encodeTxRollback(channel, fields) {
  2612. var offset = 0, buffer = Buffer.alloc(12);
  2613. buffer[0] = 1;
  2614. buffer.writeUInt16BE(channel, 1);
  2615. buffer.writeUInt32BE(5898270, 7);
  2616. offset = 11;
  2617. buffer[offset] = 206;
  2618. buffer.writeUInt32BE(offset - 7, 3);
  2619. return buffer;
  2620. }
  2621. function decodeTxRollbackOk(buffer) {
  2622. return {};
  2623. }
  2624. function encodeTxRollbackOk(channel, fields) {
  2625. var offset = 0, buffer = Buffer.alloc(12);
  2626. buffer[0] = 1;
  2627. buffer.writeUInt16BE(channel, 1);
  2628. buffer.writeUInt32BE(5898271, 7);
  2629. offset = 11;
  2630. buffer[offset] = 206;
  2631. buffer.writeUInt32BE(offset - 7, 3);
  2632. return buffer;
  2633. }
  2634. function decodeConfirmSelect(buffer) {
  2635. var val, fields = {
  2636. nowait: void 0
  2637. };
  2638. val = !!(1 & buffer[0]);
  2639. fields.nowait = val;
  2640. return fields;
  2641. }
  2642. function encodeConfirmSelect(channel, fields) {
  2643. var offset = 0, val = null, bits = 0, buffer = Buffer.alloc(13);
  2644. buffer[0] = 1;
  2645. buffer.writeUInt16BE(channel, 1);
  2646. buffer.writeUInt32BE(5570570, 7);
  2647. offset = 11;
  2648. val = fields.nowait;
  2649. void 0 === val && (val = !1);
  2650. val && (bits += 1);
  2651. buffer[offset] = bits;
  2652. offset++;
  2653. buffer[offset] = 206;
  2654. buffer.writeUInt32BE(offset - 7, 3);
  2655. return buffer;
  2656. }
  2657. function decodeConfirmSelectOk(buffer) {
  2658. return {};
  2659. }
  2660. function encodeConfirmSelectOk(channel, fields) {
  2661. var offset = 0, buffer = Buffer.alloc(12);
  2662. buffer[0] = 1;
  2663. buffer.writeUInt16BE(channel, 1);
  2664. buffer.writeUInt32BE(5570571, 7);
  2665. offset = 11;
  2666. buffer[offset] = 206;
  2667. buffer.writeUInt32BE(offset - 7, 3);
  2668. return buffer;
  2669. }
  2670. function encodeBasicProperties(channel, size, fields) {
  2671. var val, len, offset = 0, flags = 0, scratchOffset = 0, varyingSize = 0;
  2672. val = fields.contentType;
  2673. if (void 0 != val) {
  2674. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'contentType' is the wrong type; must be a string (up to 255 chars)");
  2675. var contentType_len = Buffer.byteLength(val, "utf8");
  2676. varyingSize += 1;
  2677. varyingSize += contentType_len;
  2678. }
  2679. val = fields.contentEncoding;
  2680. if (void 0 != val) {
  2681. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'contentEncoding' is the wrong type; must be a string (up to 255 chars)");
  2682. var contentEncoding_len = Buffer.byteLength(val, "utf8");
  2683. varyingSize += 1;
  2684. varyingSize += contentEncoding_len;
  2685. }
  2686. val = fields.headers;
  2687. if (void 0 != val) {
  2688. if ("object" != typeof val) throw new TypeError("Field 'headers' is the wrong type; must be an object");
  2689. len = encodeTable(SCRATCH, val, scratchOffset);
  2690. var headers_encoded = SCRATCH.slice(scratchOffset, scratchOffset + len);
  2691. scratchOffset += len;
  2692. varyingSize += headers_encoded.length;
  2693. }
  2694. val = fields.deliveryMode;
  2695. if (void 0 != val) {
  2696. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'deliveryMode' is the wrong type; must be a number (but not NaN)");
  2697. varyingSize += 1;
  2698. }
  2699. val = fields.priority;
  2700. if (void 0 != val) {
  2701. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'priority' is the wrong type; must be a number (but not NaN)");
  2702. varyingSize += 1;
  2703. }
  2704. val = fields.correlationId;
  2705. if (void 0 != val) {
  2706. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'correlationId' is the wrong type; must be a string (up to 255 chars)");
  2707. var correlationId_len = Buffer.byteLength(val, "utf8");
  2708. varyingSize += 1;
  2709. varyingSize += correlationId_len;
  2710. }
  2711. val = fields.replyTo;
  2712. if (void 0 != val) {
  2713. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'replyTo' is the wrong type; must be a string (up to 255 chars)");
  2714. var replyTo_len = Buffer.byteLength(val, "utf8");
  2715. varyingSize += 1;
  2716. varyingSize += replyTo_len;
  2717. }
  2718. val = fields.expiration;
  2719. if (void 0 != val) {
  2720. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'expiration' is the wrong type; must be a string (up to 255 chars)");
  2721. var expiration_len = Buffer.byteLength(val, "utf8");
  2722. varyingSize += 1;
  2723. varyingSize += expiration_len;
  2724. }
  2725. val = fields.messageId;
  2726. if (void 0 != val) {
  2727. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'messageId' is the wrong type; must be a string (up to 255 chars)");
  2728. var messageId_len = Buffer.byteLength(val, "utf8");
  2729. varyingSize += 1;
  2730. varyingSize += messageId_len;
  2731. }
  2732. val = fields.timestamp;
  2733. if (void 0 != val) {
  2734. if ("number" != typeof val || isNaN(val)) throw new TypeError("Field 'timestamp' is the wrong type; must be a number (but not NaN)");
  2735. varyingSize += 8;
  2736. }
  2737. val = fields.type;
  2738. if (void 0 != val) {
  2739. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'type' is the wrong type; must be a string (up to 255 chars)");
  2740. var type_len = Buffer.byteLength(val, "utf8");
  2741. varyingSize += 1;
  2742. varyingSize += type_len;
  2743. }
  2744. val = fields.userId;
  2745. if (void 0 != val) {
  2746. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'userId' is the wrong type; must be a string (up to 255 chars)");
  2747. var userId_len = Buffer.byteLength(val, "utf8");
  2748. varyingSize += 1;
  2749. varyingSize += userId_len;
  2750. }
  2751. val = fields.appId;
  2752. if (void 0 != val) {
  2753. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'appId' is the wrong type; must be a string (up to 255 chars)");
  2754. var appId_len = Buffer.byteLength(val, "utf8");
  2755. varyingSize += 1;
  2756. varyingSize += appId_len;
  2757. }
  2758. val = fields.clusterId;
  2759. if (void 0 != val) {
  2760. if (!("string" == typeof val && Buffer.byteLength(val) < 256)) throw new TypeError("Field 'clusterId' is the wrong type; must be a string (up to 255 chars)");
  2761. var clusterId_len = Buffer.byteLength(val, "utf8");
  2762. varyingSize += 1;
  2763. varyingSize += clusterId_len;
  2764. }
  2765. var buffer = Buffer.alloc(22 + varyingSize);
  2766. buffer[0] = 2;
  2767. buffer.writeUInt16BE(channel, 1);
  2768. buffer.writeUInt32BE(3932160, 7);
  2769. ints.writeUInt64BE(buffer, size, 11);
  2770. flags = 0;
  2771. offset = 21;
  2772. val = fields.contentType;
  2773. if (void 0 != val) {
  2774. flags += 32768;
  2775. buffer[offset] = contentType_len;
  2776. offset++;
  2777. buffer.write(val, offset, "utf8");
  2778. offset += contentType_len;
  2779. }
  2780. val = fields.contentEncoding;
  2781. if (void 0 != val) {
  2782. flags += 16384;
  2783. buffer[offset] = contentEncoding_len;
  2784. offset++;
  2785. buffer.write(val, offset, "utf8");
  2786. offset += contentEncoding_len;
  2787. }
  2788. val = fields.headers;
  2789. if (void 0 != val) {
  2790. flags += 8192;
  2791. offset += headers_encoded.copy(buffer, offset);
  2792. }
  2793. val = fields.deliveryMode;
  2794. if (void 0 != val) {
  2795. flags += 4096;
  2796. buffer.writeUInt8(val, offset);
  2797. offset++;
  2798. }
  2799. val = fields.priority;
  2800. if (void 0 != val) {
  2801. flags += 2048;
  2802. buffer.writeUInt8(val, offset);
  2803. offset++;
  2804. }
  2805. val = fields.correlationId;
  2806. if (void 0 != val) {
  2807. flags += 1024;
  2808. buffer[offset] = correlationId_len;
  2809. offset++;
  2810. buffer.write(val, offset, "utf8");
  2811. offset += correlationId_len;
  2812. }
  2813. val = fields.replyTo;
  2814. if (void 0 != val) {
  2815. flags += 512;
  2816. buffer[offset] = replyTo_len;
  2817. offset++;
  2818. buffer.write(val, offset, "utf8");
  2819. offset += replyTo_len;
  2820. }
  2821. val = fields.expiration;
  2822. if (void 0 != val) {
  2823. flags += 256;
  2824. buffer[offset] = expiration_len;
  2825. offset++;
  2826. buffer.write(val, offset, "utf8");
  2827. offset += expiration_len;
  2828. }
  2829. val = fields.messageId;
  2830. if (void 0 != val) {
  2831. flags += 128;
  2832. buffer[offset] = messageId_len;
  2833. offset++;
  2834. buffer.write(val, offset, "utf8");
  2835. offset += messageId_len;
  2836. }
  2837. val = fields.timestamp;
  2838. if (void 0 != val) {
  2839. flags += 64;
  2840. ints.writeUInt64BE(buffer, val, offset);
  2841. offset += 8;
  2842. }
  2843. val = fields.type;
  2844. if (void 0 != val) {
  2845. flags += 32;
  2846. buffer[offset] = type_len;
  2847. offset++;
  2848. buffer.write(val, offset, "utf8");
  2849. offset += type_len;
  2850. }
  2851. val = fields.userId;
  2852. if (void 0 != val) {
  2853. flags += 16;
  2854. buffer[offset] = userId_len;
  2855. offset++;
  2856. buffer.write(val, offset, "utf8");
  2857. offset += userId_len;
  2858. }
  2859. val = fields.appId;
  2860. if (void 0 != val) {
  2861. flags += 8;
  2862. buffer[offset] = appId_len;
  2863. offset++;
  2864. buffer.write(val, offset, "utf8");
  2865. offset += appId_len;
  2866. }
  2867. val = fields.clusterId;
  2868. if (void 0 != val) {
  2869. flags += 4;
  2870. buffer[offset] = clusterId_len;
  2871. offset++;
  2872. buffer.write(val, offset, "utf8");
  2873. offset += clusterId_len;
  2874. }
  2875. buffer[offset] = 206;
  2876. buffer.writeUInt32BE(offset - 7, 3);
  2877. buffer.writeUInt16BE(flags, 19);
  2878. return buffer.subarray(0, offset + 1);
  2879. }
  2880. function decodeBasicProperties(buffer) {
  2881. var flags, val, len, offset = 2;
  2882. flags = buffer.readUInt16BE(0);
  2883. if (0 === flags) return {};
  2884. var fields = {
  2885. contentType: void 0,
  2886. contentEncoding: void 0,
  2887. headers: void 0,
  2888. deliveryMode: void 0,
  2889. priority: void 0,
  2890. correlationId: void 0,
  2891. replyTo: void 0,
  2892. expiration: void 0,
  2893. messageId: void 0,
  2894. timestamp: void 0,
  2895. type: void 0,
  2896. userId: void 0,
  2897. appId: void 0,
  2898. clusterId: void 0
  2899. };
  2900. if (32768 & flags) {
  2901. len = buffer.readUInt8(offset);
  2902. offset++;
  2903. val = buffer.toString("utf8", offset, offset + len);
  2904. offset += len;
  2905. fields.contentType = val;
  2906. }
  2907. if (16384 & flags) {
  2908. len = buffer.readUInt8(offset);
  2909. offset++;
  2910. val = buffer.toString("utf8", offset, offset + len);
  2911. offset += len;
  2912. fields.contentEncoding = val;
  2913. }
  2914. if (8192 & flags) {
  2915. len = buffer.readUInt32BE(offset);
  2916. offset += 4;
  2917. val = decodeFields(buffer.subarray(offset, offset + len));
  2918. offset += len;
  2919. fields.headers = val;
  2920. }
  2921. if (4096 & flags) {
  2922. val = buffer[offset];
  2923. offset++;
  2924. fields.deliveryMode = val;
  2925. }
  2926. if (2048 & flags) {
  2927. val = buffer[offset];
  2928. offset++;
  2929. fields.priority = val;
  2930. }
  2931. if (1024 & flags) {
  2932. len = buffer.readUInt8(offset);
  2933. offset++;
  2934. val = buffer.toString("utf8", offset, offset + len);
  2935. offset += len;
  2936. fields.correlationId = val;
  2937. }
  2938. if (512 & flags) {
  2939. len = buffer.readUInt8(offset);
  2940. offset++;
  2941. val = buffer.toString("utf8", offset, offset + len);
  2942. offset += len;
  2943. fields.replyTo = val;
  2944. }
  2945. if (256 & flags) {
  2946. len = buffer.readUInt8(offset);
  2947. offset++;
  2948. val = buffer.toString("utf8", offset, offset + len);
  2949. offset += len;
  2950. fields.expiration = val;
  2951. }
  2952. if (128 & flags) {
  2953. len = buffer.readUInt8(offset);
  2954. offset++;
  2955. val = buffer.toString("utf8", offset, offset + len);
  2956. offset += len;
  2957. fields.messageId = val;
  2958. }
  2959. if (64 & flags) {
  2960. val = ints.readUInt64BE(buffer, offset);
  2961. offset += 8;
  2962. fields.timestamp = val;
  2963. }
  2964. if (32 & flags) {
  2965. len = buffer.readUInt8(offset);
  2966. offset++;
  2967. val = buffer.toString("utf8", offset, offset + len);
  2968. offset += len;
  2969. fields.type = val;
  2970. }
  2971. if (16 & flags) {
  2972. len = buffer.readUInt8(offset);
  2973. offset++;
  2974. val = buffer.toString("utf8", offset, offset + len);
  2975. offset += len;
  2976. fields.userId = val;
  2977. }
  2978. if (8 & flags) {
  2979. len = buffer.readUInt8(offset);
  2980. offset++;
  2981. val = buffer.toString("utf8", offset, offset + len);
  2982. offset += len;
  2983. fields.appId = val;
  2984. }
  2985. if (4 & flags) {
  2986. len = buffer.readUInt8(offset);
  2987. offset++;
  2988. val = buffer.toString("utf8", offset, offset + len);
  2989. offset += len;
  2990. fields.clusterId = val;
  2991. }
  2992. return fields;
  2993. }
  2994. var codec = require("./codec"), ints = require("buffer-more-ints"), encodeTable = codec.encodeTable, decodeFields = codec.decodeFields, SCRATCH = Buffer.alloc(65536), EMPTY_OBJECT = Object.freeze({});
  2995. module.exports.constants = {
  2996. FRAME_METHOD: 1,
  2997. FRAME_HEADER: 2,
  2998. FRAME_BODY: 3,
  2999. FRAME_HEARTBEAT: 8,
  3000. FRAME_MIN_SIZE: 4096,
  3001. FRAME_END: 206,
  3002. REPLY_SUCCESS: 200,
  3003. CONTENT_TOO_LARGE: 311,
  3004. NO_ROUTE: 312,
  3005. NO_CONSUMERS: 313,
  3006. ACCESS_REFUSED: 403,
  3007. NOT_FOUND: 404,
  3008. RESOURCE_LOCKED: 405,
  3009. PRECONDITION_FAILED: 406,
  3010. CONNECTION_FORCED: 320,
  3011. INVALID_PATH: 402,
  3012. FRAME_ERROR: 501,
  3013. SYNTAX_ERROR: 502,
  3014. COMMAND_INVALID: 503,
  3015. CHANNEL_ERROR: 504,
  3016. UNEXPECTED_FRAME: 505,
  3017. RESOURCE_ERROR: 506,
  3018. NOT_ALLOWED: 530,
  3019. NOT_IMPLEMENTED: 540,
  3020. INTERNAL_ERROR: 541
  3021. };
  3022. module.exports.constant_strs = {
  3023. "1": "FRAME-METHOD",
  3024. "2": "FRAME-HEADER",
  3025. "3": "FRAME-BODY",
  3026. "8": "FRAME-HEARTBEAT",
  3027. "200": "REPLY-SUCCESS",
  3028. "206": "FRAME-END",
  3029. "311": "CONTENT-TOO-LARGE",
  3030. "312": "NO-ROUTE",
  3031. "313": "NO-CONSUMERS",
  3032. "320": "CONNECTION-FORCED",
  3033. "402": "INVALID-PATH",
  3034. "403": "ACCESS-REFUSED",
  3035. "404": "NOT-FOUND",
  3036. "405": "RESOURCE-LOCKED",
  3037. "406": "PRECONDITION-FAILED",
  3038. "501": "FRAME-ERROR",
  3039. "502": "SYNTAX-ERROR",
  3040. "503": "COMMAND-INVALID",
  3041. "504": "CHANNEL-ERROR",
  3042. "505": "UNEXPECTED-FRAME",
  3043. "506": "RESOURCE-ERROR",
  3044. "530": "NOT-ALLOWED",
  3045. "540": "NOT-IMPLEMENTED",
  3046. "541": "INTERNAL-ERROR",
  3047. "4096": "FRAME-MIN-SIZE"
  3048. };
  3049. module.exports.FRAME_OVERHEAD = 8;
  3050. module.exports.decode = function(id, buf) {
  3051. switch (id) {
  3052. case 3932170:
  3053. return decodeBasicQos(buf);
  3054. case 3932171:
  3055. return decodeBasicQosOk(buf);
  3056. case 3932180:
  3057. return decodeBasicConsume(buf);
  3058. case 3932181:
  3059. return decodeBasicConsumeOk(buf);
  3060. case 3932190:
  3061. return decodeBasicCancel(buf);
  3062. case 3932191:
  3063. return decodeBasicCancelOk(buf);
  3064. case 3932200:
  3065. return decodeBasicPublish(buf);
  3066. case 3932210:
  3067. return decodeBasicReturn(buf);
  3068. case 3932220:
  3069. return decodeBasicDeliver(buf);
  3070. case 3932230:
  3071. return decodeBasicGet(buf);
  3072. case 3932231:
  3073. return decodeBasicGetOk(buf);
  3074. case 3932232:
  3075. return decodeBasicGetEmpty(buf);
  3076. case 3932240:
  3077. return decodeBasicAck(buf);
  3078. case 3932250:
  3079. return decodeBasicReject(buf);
  3080. case 3932260:
  3081. return decodeBasicRecoverAsync(buf);
  3082. case 3932270:
  3083. return decodeBasicRecover(buf);
  3084. case 3932271:
  3085. return decodeBasicRecoverOk(buf);
  3086. case 3932280:
  3087. return decodeBasicNack(buf);
  3088. case 655370:
  3089. return decodeConnectionStart(buf);
  3090. case 655371:
  3091. return decodeConnectionStartOk(buf);
  3092. case 655380:
  3093. return decodeConnectionSecure(buf);
  3094. case 655381:
  3095. return decodeConnectionSecureOk(buf);
  3096. case 655390:
  3097. return decodeConnectionTune(buf);
  3098. case 655391:
  3099. return decodeConnectionTuneOk(buf);
  3100. case 655400:
  3101. return decodeConnectionOpen(buf);
  3102. case 655401:
  3103. return decodeConnectionOpenOk(buf);
  3104. case 655410:
  3105. return decodeConnectionClose(buf);
  3106. case 655411:
  3107. return decodeConnectionCloseOk(buf);
  3108. case 655420:
  3109. return decodeConnectionBlocked(buf);
  3110. case 655421:
  3111. return decodeConnectionUnblocked(buf);
  3112. case 655430:
  3113. return decodeConnectionUpdateSecret(buf);
  3114. case 655431:
  3115. return decodeConnectionUpdateSecretOk(buf);
  3116. case 1310730:
  3117. return decodeChannelOpen(buf);
  3118. case 1310731:
  3119. return decodeChannelOpenOk(buf);
  3120. case 1310740:
  3121. return decodeChannelFlow(buf);
  3122. case 1310741:
  3123. return decodeChannelFlowOk(buf);
  3124. case 1310760:
  3125. return decodeChannelClose(buf);
  3126. case 1310761:
  3127. return decodeChannelCloseOk(buf);
  3128. case 1966090:
  3129. return decodeAccessRequest(buf);
  3130. case 1966091:
  3131. return decodeAccessRequestOk(buf);
  3132. case 2621450:
  3133. return decodeExchangeDeclare(buf);
  3134. case 2621451:
  3135. return decodeExchangeDeclareOk(buf);
  3136. case 2621460:
  3137. return decodeExchangeDelete(buf);
  3138. case 2621461:
  3139. return decodeExchangeDeleteOk(buf);
  3140. case 2621470:
  3141. return decodeExchangeBind(buf);
  3142. case 2621471:
  3143. return decodeExchangeBindOk(buf);
  3144. case 2621480:
  3145. return decodeExchangeUnbind(buf);
  3146. case 2621491:
  3147. return decodeExchangeUnbindOk(buf);
  3148. case 3276810:
  3149. return decodeQueueDeclare(buf);
  3150. case 3276811:
  3151. return decodeQueueDeclareOk(buf);
  3152. case 3276820:
  3153. return decodeQueueBind(buf);
  3154. case 3276821:
  3155. return decodeQueueBindOk(buf);
  3156. case 3276830:
  3157. return decodeQueuePurge(buf);
  3158. case 3276831:
  3159. return decodeQueuePurgeOk(buf);
  3160. case 3276840:
  3161. return decodeQueueDelete(buf);
  3162. case 3276841:
  3163. return decodeQueueDeleteOk(buf);
  3164. case 3276850:
  3165. return decodeQueueUnbind(buf);
  3166. case 3276851:
  3167. return decodeQueueUnbindOk(buf);
  3168. case 5898250:
  3169. return decodeTxSelect(buf);
  3170. case 5898251:
  3171. return decodeTxSelectOk(buf);
  3172. case 5898260:
  3173. return decodeTxCommit(buf);
  3174. case 5898261:
  3175. return decodeTxCommitOk(buf);
  3176. case 5898270:
  3177. return decodeTxRollback(buf);
  3178. case 5898271:
  3179. return decodeTxRollbackOk(buf);
  3180. case 5570570:
  3181. return decodeConfirmSelect(buf);
  3182. case 5570571:
  3183. return decodeConfirmSelectOk(buf);
  3184. case 60:
  3185. return decodeBasicProperties(buf);
  3186. default:
  3187. throw new Error("Unknown class/method ID");
  3188. }
  3189. };
  3190. module.exports.encodeMethod = function(id, channel, fields) {
  3191. switch (id) {
  3192. case 3932170:
  3193. return encodeBasicQos(channel, fields);
  3194. case 3932171:
  3195. return encodeBasicQosOk(channel, fields);
  3196. case 3932180:
  3197. return encodeBasicConsume(channel, fields);
  3198. case 3932181:
  3199. return encodeBasicConsumeOk(channel, fields);
  3200. case 3932190:
  3201. return encodeBasicCancel(channel, fields);
  3202. case 3932191:
  3203. return encodeBasicCancelOk(channel, fields);
  3204. case 3932200:
  3205. return encodeBasicPublish(channel, fields);
  3206. case 3932210:
  3207. return encodeBasicReturn(channel, fields);
  3208. case 3932220:
  3209. return encodeBasicDeliver(channel, fields);
  3210. case 3932230:
  3211. return encodeBasicGet(channel, fields);
  3212. case 3932231:
  3213. return encodeBasicGetOk(channel, fields);
  3214. case 3932232:
  3215. return encodeBasicGetEmpty(channel, fields);
  3216. case 3932240:
  3217. return encodeBasicAck(channel, fields);
  3218. case 3932250:
  3219. return encodeBasicReject(channel, fields);
  3220. case 3932260:
  3221. return encodeBasicRecoverAsync(channel, fields);
  3222. case 3932270:
  3223. return encodeBasicRecover(channel, fields);
  3224. case 3932271:
  3225. return encodeBasicRecoverOk(channel, fields);
  3226. case 3932280:
  3227. return encodeBasicNack(channel, fields);
  3228. case 655370:
  3229. return encodeConnectionStart(channel, fields);
  3230. case 655371:
  3231. return encodeConnectionStartOk(channel, fields);
  3232. case 655380:
  3233. return encodeConnectionSecure(channel, fields);
  3234. case 655381:
  3235. return encodeConnectionSecureOk(channel, fields);
  3236. case 655390:
  3237. return encodeConnectionTune(channel, fields);
  3238. case 655391:
  3239. return encodeConnectionTuneOk(channel, fields);
  3240. case 655400:
  3241. return encodeConnectionOpen(channel, fields);
  3242. case 655401:
  3243. return encodeConnectionOpenOk(channel, fields);
  3244. case 655410:
  3245. return encodeConnectionClose(channel, fields);
  3246. case 655411:
  3247. return encodeConnectionCloseOk(channel, fields);
  3248. case 655420:
  3249. return encodeConnectionBlocked(channel, fields);
  3250. case 655421:
  3251. return encodeConnectionUnblocked(channel, fields);
  3252. case 655430:
  3253. return encodeConnectionUpdateSecret(channel, fields);
  3254. case 655431:
  3255. return encodeConnectionUpdateSecretOk(channel, fields);
  3256. case 1310730:
  3257. return encodeChannelOpen(channel, fields);
  3258. case 1310731:
  3259. return encodeChannelOpenOk(channel, fields);
  3260. case 1310740:
  3261. return encodeChannelFlow(channel, fields);
  3262. case 1310741:
  3263. return encodeChannelFlowOk(channel, fields);
  3264. case 1310760:
  3265. return encodeChannelClose(channel, fields);
  3266. case 1310761:
  3267. return encodeChannelCloseOk(channel, fields);
  3268. case 1966090:
  3269. return encodeAccessRequest(channel, fields);
  3270. case 1966091:
  3271. return encodeAccessRequestOk(channel, fields);
  3272. case 2621450:
  3273. return encodeExchangeDeclare(channel, fields);
  3274. case 2621451:
  3275. return encodeExchangeDeclareOk(channel, fields);
  3276. case 2621460:
  3277. return encodeExchangeDelete(channel, fields);
  3278. case 2621461:
  3279. return encodeExchangeDeleteOk(channel, fields);
  3280. case 2621470:
  3281. return encodeExchangeBind(channel, fields);
  3282. case 2621471:
  3283. return encodeExchangeBindOk(channel, fields);
  3284. case 2621480:
  3285. return encodeExchangeUnbind(channel, fields);
  3286. case 2621491:
  3287. return encodeExchangeUnbindOk(channel, fields);
  3288. case 3276810:
  3289. return encodeQueueDeclare(channel, fields);
  3290. case 3276811:
  3291. return encodeQueueDeclareOk(channel, fields);
  3292. case 3276820:
  3293. return encodeQueueBind(channel, fields);
  3294. case 3276821:
  3295. return encodeQueueBindOk(channel, fields);
  3296. case 3276830:
  3297. return encodeQueuePurge(channel, fields);
  3298. case 3276831:
  3299. return encodeQueuePurgeOk(channel, fields);
  3300. case 3276840:
  3301. return encodeQueueDelete(channel, fields);
  3302. case 3276841:
  3303. return encodeQueueDeleteOk(channel, fields);
  3304. case 3276850:
  3305. return encodeQueueUnbind(channel, fields);
  3306. case 3276851:
  3307. return encodeQueueUnbindOk(channel, fields);
  3308. case 5898250:
  3309. return encodeTxSelect(channel, fields);
  3310. case 5898251:
  3311. return encodeTxSelectOk(channel, fields);
  3312. case 5898260:
  3313. return encodeTxCommit(channel, fields);
  3314. case 5898261:
  3315. return encodeTxCommitOk(channel, fields);
  3316. case 5898270:
  3317. return encodeTxRollback(channel, fields);
  3318. case 5898271:
  3319. return encodeTxRollbackOk(channel, fields);
  3320. case 5570570:
  3321. return encodeConfirmSelect(channel, fields);
  3322. case 5570571:
  3323. return encodeConfirmSelectOk(channel, fields);
  3324. default:
  3325. throw new Error("Unknown class/method ID");
  3326. }
  3327. };
  3328. module.exports.encodeProperties = function(id, channel, size, fields) {
  3329. switch (id) {
  3330. case 60:
  3331. return encodeBasicProperties(channel, size, fields);
  3332. default:
  3333. throw new Error("Unknown class/properties ID");
  3334. }
  3335. };
  3336. module.exports.info = function(id) {
  3337. switch (id) {
  3338. case 3932170:
  3339. return methodInfoBasicQos;
  3340. case 3932171:
  3341. return methodInfoBasicQosOk;
  3342. case 3932180:
  3343. return methodInfoBasicConsume;
  3344. case 3932181:
  3345. return methodInfoBasicConsumeOk;
  3346. case 3932190:
  3347. return methodInfoBasicCancel;
  3348. case 3932191:
  3349. return methodInfoBasicCancelOk;
  3350. case 3932200:
  3351. return methodInfoBasicPublish;
  3352. case 3932210:
  3353. return methodInfoBasicReturn;
  3354. case 3932220:
  3355. return methodInfoBasicDeliver;
  3356. case 3932230:
  3357. return methodInfoBasicGet;
  3358. case 3932231:
  3359. return methodInfoBasicGetOk;
  3360. case 3932232:
  3361. return methodInfoBasicGetEmpty;
  3362. case 3932240:
  3363. return methodInfoBasicAck;
  3364. case 3932250:
  3365. return methodInfoBasicReject;
  3366. case 3932260:
  3367. return methodInfoBasicRecoverAsync;
  3368. case 3932270:
  3369. return methodInfoBasicRecover;
  3370. case 3932271:
  3371. return methodInfoBasicRecoverOk;
  3372. case 3932280:
  3373. return methodInfoBasicNack;
  3374. case 655370:
  3375. return methodInfoConnectionStart;
  3376. case 655371:
  3377. return methodInfoConnectionStartOk;
  3378. case 655380:
  3379. return methodInfoConnectionSecure;
  3380. case 655381:
  3381. return methodInfoConnectionSecureOk;
  3382. case 655390:
  3383. return methodInfoConnectionTune;
  3384. case 655391:
  3385. return methodInfoConnectionTuneOk;
  3386. case 655400:
  3387. return methodInfoConnectionOpen;
  3388. case 655401:
  3389. return methodInfoConnectionOpenOk;
  3390. case 655410:
  3391. return methodInfoConnectionClose;
  3392. case 655411:
  3393. return methodInfoConnectionCloseOk;
  3394. case 655420:
  3395. return methodInfoConnectionBlocked;
  3396. case 655421:
  3397. return methodInfoConnectionUnblocked;
  3398. case 655430:
  3399. return methodInfoConnectionUpdateSecret;
  3400. case 655431:
  3401. return methodInfoConnectionUpdateSecretOk;
  3402. case 1310730:
  3403. return methodInfoChannelOpen;
  3404. case 1310731:
  3405. return methodInfoChannelOpenOk;
  3406. case 1310740:
  3407. return methodInfoChannelFlow;
  3408. case 1310741:
  3409. return methodInfoChannelFlowOk;
  3410. case 1310760:
  3411. return methodInfoChannelClose;
  3412. case 1310761:
  3413. return methodInfoChannelCloseOk;
  3414. case 1966090:
  3415. return methodInfoAccessRequest;
  3416. case 1966091:
  3417. return methodInfoAccessRequestOk;
  3418. case 2621450:
  3419. return methodInfoExchangeDeclare;
  3420. case 2621451:
  3421. return methodInfoExchangeDeclareOk;
  3422. case 2621460:
  3423. return methodInfoExchangeDelete;
  3424. case 2621461:
  3425. return methodInfoExchangeDeleteOk;
  3426. case 2621470:
  3427. return methodInfoExchangeBind;
  3428. case 2621471:
  3429. return methodInfoExchangeBindOk;
  3430. case 2621480:
  3431. return methodInfoExchangeUnbind;
  3432. case 2621491:
  3433. return methodInfoExchangeUnbindOk;
  3434. case 3276810:
  3435. return methodInfoQueueDeclare;
  3436. case 3276811:
  3437. return methodInfoQueueDeclareOk;
  3438. case 3276820:
  3439. return methodInfoQueueBind;
  3440. case 3276821:
  3441. return methodInfoQueueBindOk;
  3442. case 3276830:
  3443. return methodInfoQueuePurge;
  3444. case 3276831:
  3445. return methodInfoQueuePurgeOk;
  3446. case 3276840:
  3447. return methodInfoQueueDelete;
  3448. case 3276841:
  3449. return methodInfoQueueDeleteOk;
  3450. case 3276850:
  3451. return methodInfoQueueUnbind;
  3452. case 3276851:
  3453. return methodInfoQueueUnbindOk;
  3454. case 5898250:
  3455. return methodInfoTxSelect;
  3456. case 5898251:
  3457. return methodInfoTxSelectOk;
  3458. case 5898260:
  3459. return methodInfoTxCommit;
  3460. case 5898261:
  3461. return methodInfoTxCommitOk;
  3462. case 5898270:
  3463. return methodInfoTxRollback;
  3464. case 5898271:
  3465. return methodInfoTxRollbackOk;
  3466. case 5570570:
  3467. return methodInfoConfirmSelect;
  3468. case 5570571:
  3469. return methodInfoConfirmSelectOk;
  3470. case 60:
  3471. return propertiesInfoBasicProperties;
  3472. default:
  3473. throw new Error("Unknown class/method ID");
  3474. }
  3475. };
  3476. module.exports.BasicQos = 3932170;
  3477. var methodInfoBasicQos = module.exports.methodInfoBasicQos = {
  3478. id: 3932170,
  3479. classId: 60,
  3480. methodId: 10,
  3481. name: "BasicQos",
  3482. args: [ {
  3483. type: "long",
  3484. name: "prefetchSize",
  3485. default: 0
  3486. }, {
  3487. type: "short",
  3488. name: "prefetchCount",
  3489. default: 0
  3490. }, {
  3491. type: "bit",
  3492. name: "global",
  3493. default: !1
  3494. } ]
  3495. };
  3496. module.exports.BasicQosOk = 3932171;
  3497. var methodInfoBasicQosOk = module.exports.methodInfoBasicQosOk = {
  3498. id: 3932171,
  3499. classId: 60,
  3500. methodId: 11,
  3501. name: "BasicQosOk",
  3502. args: []
  3503. };
  3504. module.exports.BasicConsume = 3932180;
  3505. var methodInfoBasicConsume = module.exports.methodInfoBasicConsume = {
  3506. id: 3932180,
  3507. classId: 60,
  3508. methodId: 20,
  3509. name: "BasicConsume",
  3510. args: [ {
  3511. type: "short",
  3512. name: "ticket",
  3513. default: 0
  3514. }, {
  3515. type: "shortstr",
  3516. name: "queue",
  3517. default: ""
  3518. }, {
  3519. type: "shortstr",
  3520. name: "consumerTag",
  3521. default: ""
  3522. }, {
  3523. type: "bit",
  3524. name: "noLocal",
  3525. default: !1
  3526. }, {
  3527. type: "bit",
  3528. name: "noAck",
  3529. default: !1
  3530. }, {
  3531. type: "bit",
  3532. name: "exclusive",
  3533. default: !1
  3534. }, {
  3535. type: "bit",
  3536. name: "nowait",
  3537. default: !1
  3538. }, {
  3539. type: "table",
  3540. name: "arguments",
  3541. default: {}
  3542. } ]
  3543. };
  3544. module.exports.BasicConsumeOk = 3932181;
  3545. var methodInfoBasicConsumeOk = module.exports.methodInfoBasicConsumeOk = {
  3546. id: 3932181,
  3547. classId: 60,
  3548. methodId: 21,
  3549. name: "BasicConsumeOk",
  3550. args: [ {
  3551. type: "shortstr",
  3552. name: "consumerTag"
  3553. } ]
  3554. };
  3555. module.exports.BasicCancel = 3932190;
  3556. var methodInfoBasicCancel = module.exports.methodInfoBasicCancel = {
  3557. id: 3932190,
  3558. classId: 60,
  3559. methodId: 30,
  3560. name: "BasicCancel",
  3561. args: [ {
  3562. type: "shortstr",
  3563. name: "consumerTag"
  3564. }, {
  3565. type: "bit",
  3566. name: "nowait",
  3567. default: !1
  3568. } ]
  3569. };
  3570. module.exports.BasicCancelOk = 3932191;
  3571. var methodInfoBasicCancelOk = module.exports.methodInfoBasicCancelOk = {
  3572. id: 3932191,
  3573. classId: 60,
  3574. methodId: 31,
  3575. name: "BasicCancelOk",
  3576. args: [ {
  3577. type: "shortstr",
  3578. name: "consumerTag"
  3579. } ]
  3580. };
  3581. module.exports.BasicPublish = 3932200;
  3582. var methodInfoBasicPublish = module.exports.methodInfoBasicPublish = {
  3583. id: 3932200,
  3584. classId: 60,
  3585. methodId: 40,
  3586. name: "BasicPublish",
  3587. args: [ {
  3588. type: "short",
  3589. name: "ticket",
  3590. default: 0
  3591. }, {
  3592. type: "shortstr",
  3593. name: "exchange",
  3594. default: ""
  3595. }, {
  3596. type: "shortstr",
  3597. name: "routingKey",
  3598. default: ""
  3599. }, {
  3600. type: "bit",
  3601. name: "mandatory",
  3602. default: !1
  3603. }, {
  3604. type: "bit",
  3605. name: "immediate",
  3606. default: !1
  3607. } ]
  3608. };
  3609. module.exports.BasicReturn = 3932210;
  3610. var methodInfoBasicReturn = module.exports.methodInfoBasicReturn = {
  3611. id: 3932210,
  3612. classId: 60,
  3613. methodId: 50,
  3614. name: "BasicReturn",
  3615. args: [ {
  3616. type: "short",
  3617. name: "replyCode"
  3618. }, {
  3619. type: "shortstr",
  3620. name: "replyText",
  3621. default: ""
  3622. }, {
  3623. type: "shortstr",
  3624. name: "exchange"
  3625. }, {
  3626. type: "shortstr",
  3627. name: "routingKey"
  3628. } ]
  3629. };
  3630. module.exports.BasicDeliver = 3932220;
  3631. var methodInfoBasicDeliver = module.exports.methodInfoBasicDeliver = {
  3632. id: 3932220,
  3633. classId: 60,
  3634. methodId: 60,
  3635. name: "BasicDeliver",
  3636. args: [ {
  3637. type: "shortstr",
  3638. name: "consumerTag"
  3639. }, {
  3640. type: "longlong",
  3641. name: "deliveryTag"
  3642. }, {
  3643. type: "bit",
  3644. name: "redelivered",
  3645. default: !1
  3646. }, {
  3647. type: "shortstr",
  3648. name: "exchange"
  3649. }, {
  3650. type: "shortstr",
  3651. name: "routingKey"
  3652. } ]
  3653. };
  3654. module.exports.BasicGet = 3932230;
  3655. var methodInfoBasicGet = module.exports.methodInfoBasicGet = {
  3656. id: 3932230,
  3657. classId: 60,
  3658. methodId: 70,
  3659. name: "BasicGet",
  3660. args: [ {
  3661. type: "short",
  3662. name: "ticket",
  3663. default: 0
  3664. }, {
  3665. type: "shortstr",
  3666. name: "queue",
  3667. default: ""
  3668. }, {
  3669. type: "bit",
  3670. name: "noAck",
  3671. default: !1
  3672. } ]
  3673. };
  3674. module.exports.BasicGetOk = 3932231;
  3675. var methodInfoBasicGetOk = module.exports.methodInfoBasicGetOk = {
  3676. id: 3932231,
  3677. classId: 60,
  3678. methodId: 71,
  3679. name: "BasicGetOk",
  3680. args: [ {
  3681. type: "longlong",
  3682. name: "deliveryTag"
  3683. }, {
  3684. type: "bit",
  3685. name: "redelivered",
  3686. default: !1
  3687. }, {
  3688. type: "shortstr",
  3689. name: "exchange"
  3690. }, {
  3691. type: "shortstr",
  3692. name: "routingKey"
  3693. }, {
  3694. type: "long",
  3695. name: "messageCount"
  3696. } ]
  3697. };
  3698. module.exports.BasicGetEmpty = 3932232;
  3699. var methodInfoBasicGetEmpty = module.exports.methodInfoBasicGetEmpty = {
  3700. id: 3932232,
  3701. classId: 60,
  3702. methodId: 72,
  3703. name: "BasicGetEmpty",
  3704. args: [ {
  3705. type: "shortstr",
  3706. name: "clusterId",
  3707. default: ""
  3708. } ]
  3709. };
  3710. module.exports.BasicAck = 3932240;
  3711. var methodInfoBasicAck = module.exports.methodInfoBasicAck = {
  3712. id: 3932240,
  3713. classId: 60,
  3714. methodId: 80,
  3715. name: "BasicAck",
  3716. args: [ {
  3717. type: "longlong",
  3718. name: "deliveryTag",
  3719. default: 0
  3720. }, {
  3721. type: "bit",
  3722. name: "multiple",
  3723. default: !1
  3724. } ]
  3725. };
  3726. module.exports.BasicReject = 3932250;
  3727. var methodInfoBasicReject = module.exports.methodInfoBasicReject = {
  3728. id: 3932250,
  3729. classId: 60,
  3730. methodId: 90,
  3731. name: "BasicReject",
  3732. args: [ {
  3733. type: "longlong",
  3734. name: "deliveryTag"
  3735. }, {
  3736. type: "bit",
  3737. name: "requeue",
  3738. default: !0
  3739. } ]
  3740. };
  3741. module.exports.BasicRecoverAsync = 3932260;
  3742. var methodInfoBasicRecoverAsync = module.exports.methodInfoBasicRecoverAsync = {
  3743. id: 3932260,
  3744. classId: 60,
  3745. methodId: 100,
  3746. name: "BasicRecoverAsync",
  3747. args: [ {
  3748. type: "bit",
  3749. name: "requeue",
  3750. default: !1
  3751. } ]
  3752. };
  3753. module.exports.BasicRecover = 3932270;
  3754. var methodInfoBasicRecover = module.exports.methodInfoBasicRecover = {
  3755. id: 3932270,
  3756. classId: 60,
  3757. methodId: 110,
  3758. name: "BasicRecover",
  3759. args: [ {
  3760. type: "bit",
  3761. name: "requeue",
  3762. default: !1
  3763. } ]
  3764. };
  3765. module.exports.BasicRecoverOk = 3932271;
  3766. var methodInfoBasicRecoverOk = module.exports.methodInfoBasicRecoverOk = {
  3767. id: 3932271,
  3768. classId: 60,
  3769. methodId: 111,
  3770. name: "BasicRecoverOk",
  3771. args: []
  3772. };
  3773. module.exports.BasicNack = 3932280;
  3774. var methodInfoBasicNack = module.exports.methodInfoBasicNack = {
  3775. id: 3932280,
  3776. classId: 60,
  3777. methodId: 120,
  3778. name: "BasicNack",
  3779. args: [ {
  3780. type: "longlong",
  3781. name: "deliveryTag",
  3782. default: 0
  3783. }, {
  3784. type: "bit",
  3785. name: "multiple",
  3786. default: !1
  3787. }, {
  3788. type: "bit",
  3789. name: "requeue",
  3790. default: !0
  3791. } ]
  3792. };
  3793. module.exports.ConnectionStart = 655370;
  3794. var methodInfoConnectionStart = module.exports.methodInfoConnectionStart = {
  3795. id: 655370,
  3796. classId: 10,
  3797. methodId: 10,
  3798. name: "ConnectionStart",
  3799. args: [ {
  3800. type: "octet",
  3801. name: "versionMajor",
  3802. default: 0
  3803. }, {
  3804. type: "octet",
  3805. name: "versionMinor",
  3806. default: 9
  3807. }, {
  3808. type: "table",
  3809. name: "serverProperties"
  3810. }, {
  3811. type: "longstr",
  3812. name: "mechanisms",
  3813. default: "PLAIN"
  3814. }, {
  3815. type: "longstr",
  3816. name: "locales",
  3817. default: "en_US"
  3818. } ]
  3819. };
  3820. module.exports.ConnectionStartOk = 655371;
  3821. var methodInfoConnectionStartOk = module.exports.methodInfoConnectionStartOk = {
  3822. id: 655371,
  3823. classId: 10,
  3824. methodId: 11,
  3825. name: "ConnectionStartOk",
  3826. args: [ {
  3827. type: "table",
  3828. name: "clientProperties"
  3829. }, {
  3830. type: "shortstr",
  3831. name: "mechanism",
  3832. default: "PLAIN"
  3833. }, {
  3834. type: "longstr",
  3835. name: "response"
  3836. }, {
  3837. type: "shortstr",
  3838. name: "locale",
  3839. default: "en_US"
  3840. } ]
  3841. };
  3842. module.exports.ConnectionSecure = 655380;
  3843. var methodInfoConnectionSecure = module.exports.methodInfoConnectionSecure = {
  3844. id: 655380,
  3845. classId: 10,
  3846. methodId: 20,
  3847. name: "ConnectionSecure",
  3848. args: [ {
  3849. type: "longstr",
  3850. name: "challenge"
  3851. } ]
  3852. };
  3853. module.exports.ConnectionSecureOk = 655381;
  3854. var methodInfoConnectionSecureOk = module.exports.methodInfoConnectionSecureOk = {
  3855. id: 655381,
  3856. classId: 10,
  3857. methodId: 21,
  3858. name: "ConnectionSecureOk",
  3859. args: [ {
  3860. type: "longstr",
  3861. name: "response"
  3862. } ]
  3863. };
  3864. module.exports.ConnectionTune = 655390;
  3865. var methodInfoConnectionTune = module.exports.methodInfoConnectionTune = {
  3866. id: 655390,
  3867. classId: 10,
  3868. methodId: 30,
  3869. name: "ConnectionTune",
  3870. args: [ {
  3871. type: "short",
  3872. name: "channelMax",
  3873. default: 0
  3874. }, {
  3875. type: "long",
  3876. name: "frameMax",
  3877. default: 0
  3878. }, {
  3879. type: "short",
  3880. name: "heartbeat",
  3881. default: 0
  3882. } ]
  3883. };
  3884. module.exports.ConnectionTuneOk = 655391;
  3885. var methodInfoConnectionTuneOk = module.exports.methodInfoConnectionTuneOk = {
  3886. id: 655391,
  3887. classId: 10,
  3888. methodId: 31,
  3889. name: "ConnectionTuneOk",
  3890. args: [ {
  3891. type: "short",
  3892. name: "channelMax",
  3893. default: 0
  3894. }, {
  3895. type: "long",
  3896. name: "frameMax",
  3897. default: 0
  3898. }, {
  3899. type: "short",
  3900. name: "heartbeat",
  3901. default: 0
  3902. } ]
  3903. };
  3904. module.exports.ConnectionOpen = 655400;
  3905. var methodInfoConnectionOpen = module.exports.methodInfoConnectionOpen = {
  3906. id: 655400,
  3907. classId: 10,
  3908. methodId: 40,
  3909. name: "ConnectionOpen",
  3910. args: [ {
  3911. type: "shortstr",
  3912. name: "virtualHost",
  3913. default: "/"
  3914. }, {
  3915. type: "shortstr",
  3916. name: "capabilities",
  3917. default: ""
  3918. }, {
  3919. type: "bit",
  3920. name: "insist",
  3921. default: !1
  3922. } ]
  3923. };
  3924. module.exports.ConnectionOpenOk = 655401;
  3925. var methodInfoConnectionOpenOk = module.exports.methodInfoConnectionOpenOk = {
  3926. id: 655401,
  3927. classId: 10,
  3928. methodId: 41,
  3929. name: "ConnectionOpenOk",
  3930. args: [ {
  3931. type: "shortstr",
  3932. name: "knownHosts",
  3933. default: ""
  3934. } ]
  3935. };
  3936. module.exports.ConnectionClose = 655410;
  3937. var methodInfoConnectionClose = module.exports.methodInfoConnectionClose = {
  3938. id: 655410,
  3939. classId: 10,
  3940. methodId: 50,
  3941. name: "ConnectionClose",
  3942. args: [ {
  3943. type: "short",
  3944. name: "replyCode"
  3945. }, {
  3946. type: "shortstr",
  3947. name: "replyText",
  3948. default: ""
  3949. }, {
  3950. type: "short",
  3951. name: "classId"
  3952. }, {
  3953. type: "short",
  3954. name: "methodId"
  3955. } ]
  3956. };
  3957. module.exports.ConnectionCloseOk = 655411;
  3958. var methodInfoConnectionCloseOk = module.exports.methodInfoConnectionCloseOk = {
  3959. id: 655411,
  3960. classId: 10,
  3961. methodId: 51,
  3962. name: "ConnectionCloseOk",
  3963. args: []
  3964. };
  3965. module.exports.ConnectionBlocked = 655420;
  3966. var methodInfoConnectionBlocked = module.exports.methodInfoConnectionBlocked = {
  3967. id: 655420,
  3968. classId: 10,
  3969. methodId: 60,
  3970. name: "ConnectionBlocked",
  3971. args: [ {
  3972. type: "shortstr",
  3973. name: "reason",
  3974. default: ""
  3975. } ]
  3976. };
  3977. module.exports.ConnectionUnblocked = 655421;
  3978. var methodInfoConnectionUnblocked = module.exports.methodInfoConnectionUnblocked = {
  3979. id: 655421,
  3980. classId: 10,
  3981. methodId: 61,
  3982. name: "ConnectionUnblocked",
  3983. args: []
  3984. };
  3985. module.exports.ConnectionUpdateSecret = 655430;
  3986. var methodInfoConnectionUpdateSecret = module.exports.methodInfoConnectionUpdateSecret = {
  3987. id: 655430,
  3988. classId: 10,
  3989. methodId: 70,
  3990. name: "ConnectionUpdateSecret",
  3991. args: [ {
  3992. type: "longstr",
  3993. name: "newSecret"
  3994. }, {
  3995. type: "shortstr",
  3996. name: "reason"
  3997. } ]
  3998. };
  3999. module.exports.ConnectionUpdateSecretOk = 655431;
  4000. var methodInfoConnectionUpdateSecretOk = module.exports.methodInfoConnectionUpdateSecretOk = {
  4001. id: 655431,
  4002. classId: 10,
  4003. methodId: 71,
  4004. name: "ConnectionUpdateSecretOk",
  4005. args: []
  4006. };
  4007. module.exports.ChannelOpen = 1310730;
  4008. var methodInfoChannelOpen = module.exports.methodInfoChannelOpen = {
  4009. id: 1310730,
  4010. classId: 20,
  4011. methodId: 10,
  4012. name: "ChannelOpen",
  4013. args: [ {
  4014. type: "shortstr",
  4015. name: "outOfBand",
  4016. default: ""
  4017. } ]
  4018. };
  4019. module.exports.ChannelOpenOk = 1310731;
  4020. var methodInfoChannelOpenOk = module.exports.methodInfoChannelOpenOk = {
  4021. id: 1310731,
  4022. classId: 20,
  4023. methodId: 11,
  4024. name: "ChannelOpenOk",
  4025. args: [ {
  4026. type: "longstr",
  4027. name: "channelId",
  4028. default: ""
  4029. } ]
  4030. };
  4031. module.exports.ChannelFlow = 1310740;
  4032. var methodInfoChannelFlow = module.exports.methodInfoChannelFlow = {
  4033. id: 1310740,
  4034. classId: 20,
  4035. methodId: 20,
  4036. name: "ChannelFlow",
  4037. args: [ {
  4038. type: "bit",
  4039. name: "active"
  4040. } ]
  4041. };
  4042. module.exports.ChannelFlowOk = 1310741;
  4043. var methodInfoChannelFlowOk = module.exports.methodInfoChannelFlowOk = {
  4044. id: 1310741,
  4045. classId: 20,
  4046. methodId: 21,
  4047. name: "ChannelFlowOk",
  4048. args: [ {
  4049. type: "bit",
  4050. name: "active"
  4051. } ]
  4052. };
  4053. module.exports.ChannelClose = 1310760;
  4054. var methodInfoChannelClose = module.exports.methodInfoChannelClose = {
  4055. id: 1310760,
  4056. classId: 20,
  4057. methodId: 40,
  4058. name: "ChannelClose",
  4059. args: [ {
  4060. type: "short",
  4061. name: "replyCode"
  4062. }, {
  4063. type: "shortstr",
  4064. name: "replyText",
  4065. default: ""
  4066. }, {
  4067. type: "short",
  4068. name: "classId"
  4069. }, {
  4070. type: "short",
  4071. name: "methodId"
  4072. } ]
  4073. };
  4074. module.exports.ChannelCloseOk = 1310761;
  4075. var methodInfoChannelCloseOk = module.exports.methodInfoChannelCloseOk = {
  4076. id: 1310761,
  4077. classId: 20,
  4078. methodId: 41,
  4079. name: "ChannelCloseOk",
  4080. args: []
  4081. };
  4082. module.exports.AccessRequest = 1966090;
  4083. var methodInfoAccessRequest = module.exports.methodInfoAccessRequest = {
  4084. id: 1966090,
  4085. classId: 30,
  4086. methodId: 10,
  4087. name: "AccessRequest",
  4088. args: [ {
  4089. type: "shortstr",
  4090. name: "realm",
  4091. default: "/data"
  4092. }, {
  4093. type: "bit",
  4094. name: "exclusive",
  4095. default: !1
  4096. }, {
  4097. type: "bit",
  4098. name: "passive",
  4099. default: !0
  4100. }, {
  4101. type: "bit",
  4102. name: "active",
  4103. default: !0
  4104. }, {
  4105. type: "bit",
  4106. name: "write",
  4107. default: !0
  4108. }, {
  4109. type: "bit",
  4110. name: "read",
  4111. default: !0
  4112. } ]
  4113. };
  4114. module.exports.AccessRequestOk = 1966091;
  4115. var methodInfoAccessRequestOk = module.exports.methodInfoAccessRequestOk = {
  4116. id: 1966091,
  4117. classId: 30,
  4118. methodId: 11,
  4119. name: "AccessRequestOk",
  4120. args: [ {
  4121. type: "short",
  4122. name: "ticket",
  4123. default: 1
  4124. } ]
  4125. };
  4126. module.exports.ExchangeDeclare = 2621450;
  4127. var methodInfoExchangeDeclare = module.exports.methodInfoExchangeDeclare = {
  4128. id: 2621450,
  4129. classId: 40,
  4130. methodId: 10,
  4131. name: "ExchangeDeclare",
  4132. args: [ {
  4133. type: "short",
  4134. name: "ticket",
  4135. default: 0
  4136. }, {
  4137. type: "shortstr",
  4138. name: "exchange"
  4139. }, {
  4140. type: "shortstr",
  4141. name: "type",
  4142. default: "direct"
  4143. }, {
  4144. type: "bit",
  4145. name: "passive",
  4146. default: !1
  4147. }, {
  4148. type: "bit",
  4149. name: "durable",
  4150. default: !1
  4151. }, {
  4152. type: "bit",
  4153. name: "autoDelete",
  4154. default: !1
  4155. }, {
  4156. type: "bit",
  4157. name: "internal",
  4158. default: !1
  4159. }, {
  4160. type: "bit",
  4161. name: "nowait",
  4162. default: !1
  4163. }, {
  4164. type: "table",
  4165. name: "arguments",
  4166. default: {}
  4167. } ]
  4168. };
  4169. module.exports.ExchangeDeclareOk = 2621451;
  4170. var methodInfoExchangeDeclareOk = module.exports.methodInfoExchangeDeclareOk = {
  4171. id: 2621451,
  4172. classId: 40,
  4173. methodId: 11,
  4174. name: "ExchangeDeclareOk",
  4175. args: []
  4176. };
  4177. module.exports.ExchangeDelete = 2621460;
  4178. var methodInfoExchangeDelete = module.exports.methodInfoExchangeDelete = {
  4179. id: 2621460,
  4180. classId: 40,
  4181. methodId: 20,
  4182. name: "ExchangeDelete",
  4183. args: [ {
  4184. type: "short",
  4185. name: "ticket",
  4186. default: 0
  4187. }, {
  4188. type: "shortstr",
  4189. name: "exchange"
  4190. }, {
  4191. type: "bit",
  4192. name: "ifUnused",
  4193. default: !1
  4194. }, {
  4195. type: "bit",
  4196. name: "nowait",
  4197. default: !1
  4198. } ]
  4199. };
  4200. module.exports.ExchangeDeleteOk = 2621461;
  4201. var methodInfoExchangeDeleteOk = module.exports.methodInfoExchangeDeleteOk = {
  4202. id: 2621461,
  4203. classId: 40,
  4204. methodId: 21,
  4205. name: "ExchangeDeleteOk",
  4206. args: []
  4207. };
  4208. module.exports.ExchangeBind = 2621470;
  4209. var methodInfoExchangeBind = module.exports.methodInfoExchangeBind = {
  4210. id: 2621470,
  4211. classId: 40,
  4212. methodId: 30,
  4213. name: "ExchangeBind",
  4214. args: [ {
  4215. type: "short",
  4216. name: "ticket",
  4217. default: 0
  4218. }, {
  4219. type: "shortstr",
  4220. name: "destination"
  4221. }, {
  4222. type: "shortstr",
  4223. name: "source"
  4224. }, {
  4225. type: "shortstr",
  4226. name: "routingKey",
  4227. default: ""
  4228. }, {
  4229. type: "bit",
  4230. name: "nowait",
  4231. default: !1
  4232. }, {
  4233. type: "table",
  4234. name: "arguments",
  4235. default: {}
  4236. } ]
  4237. };
  4238. module.exports.ExchangeBindOk = 2621471;
  4239. var methodInfoExchangeBindOk = module.exports.methodInfoExchangeBindOk = {
  4240. id: 2621471,
  4241. classId: 40,
  4242. methodId: 31,
  4243. name: "ExchangeBindOk",
  4244. args: []
  4245. };
  4246. module.exports.ExchangeUnbind = 2621480;
  4247. var methodInfoExchangeUnbind = module.exports.methodInfoExchangeUnbind = {
  4248. id: 2621480,
  4249. classId: 40,
  4250. methodId: 40,
  4251. name: "ExchangeUnbind",
  4252. args: [ {
  4253. type: "short",
  4254. name: "ticket",
  4255. default: 0
  4256. }, {
  4257. type: "shortstr",
  4258. name: "destination"
  4259. }, {
  4260. type: "shortstr",
  4261. name: "source"
  4262. }, {
  4263. type: "shortstr",
  4264. name: "routingKey",
  4265. default: ""
  4266. }, {
  4267. type: "bit",
  4268. name: "nowait",
  4269. default: !1
  4270. }, {
  4271. type: "table",
  4272. name: "arguments",
  4273. default: {}
  4274. } ]
  4275. };
  4276. module.exports.ExchangeUnbindOk = 2621491;
  4277. var methodInfoExchangeUnbindOk = module.exports.methodInfoExchangeUnbindOk = {
  4278. id: 2621491,
  4279. classId: 40,
  4280. methodId: 51,
  4281. name: "ExchangeUnbindOk",
  4282. args: []
  4283. };
  4284. module.exports.QueueDeclare = 3276810;
  4285. var methodInfoQueueDeclare = module.exports.methodInfoQueueDeclare = {
  4286. id: 3276810,
  4287. classId: 50,
  4288. methodId: 10,
  4289. name: "QueueDeclare",
  4290. args: [ {
  4291. type: "short",
  4292. name: "ticket",
  4293. default: 0
  4294. }, {
  4295. type: "shortstr",
  4296. name: "queue",
  4297. default: ""
  4298. }, {
  4299. type: "bit",
  4300. name: "passive",
  4301. default: !1
  4302. }, {
  4303. type: "bit",
  4304. name: "durable",
  4305. default: !1
  4306. }, {
  4307. type: "bit",
  4308. name: "exclusive",
  4309. default: !1
  4310. }, {
  4311. type: "bit",
  4312. name: "autoDelete",
  4313. default: !1
  4314. }, {
  4315. type: "bit",
  4316. name: "nowait",
  4317. default: !1
  4318. }, {
  4319. type: "table",
  4320. name: "arguments",
  4321. default: {}
  4322. } ]
  4323. };
  4324. module.exports.QueueDeclareOk = 3276811;
  4325. var methodInfoQueueDeclareOk = module.exports.methodInfoQueueDeclareOk = {
  4326. id: 3276811,
  4327. classId: 50,
  4328. methodId: 11,
  4329. name: "QueueDeclareOk",
  4330. args: [ {
  4331. type: "shortstr",
  4332. name: "queue"
  4333. }, {
  4334. type: "long",
  4335. name: "messageCount"
  4336. }, {
  4337. type: "long",
  4338. name: "consumerCount"
  4339. } ]
  4340. };
  4341. module.exports.QueueBind = 3276820;
  4342. var methodInfoQueueBind = module.exports.methodInfoQueueBind = {
  4343. id: 3276820,
  4344. classId: 50,
  4345. methodId: 20,
  4346. name: "QueueBind",
  4347. args: [ {
  4348. type: "short",
  4349. name: "ticket",
  4350. default: 0
  4351. }, {
  4352. type: "shortstr",
  4353. name: "queue",
  4354. default: ""
  4355. }, {
  4356. type: "shortstr",
  4357. name: "exchange"
  4358. }, {
  4359. type: "shortstr",
  4360. name: "routingKey",
  4361. default: ""
  4362. }, {
  4363. type: "bit",
  4364. name: "nowait",
  4365. default: !1
  4366. }, {
  4367. type: "table",
  4368. name: "arguments",
  4369. default: {}
  4370. } ]
  4371. };
  4372. module.exports.QueueBindOk = 3276821;
  4373. var methodInfoQueueBindOk = module.exports.methodInfoQueueBindOk = {
  4374. id: 3276821,
  4375. classId: 50,
  4376. methodId: 21,
  4377. name: "QueueBindOk",
  4378. args: []
  4379. };
  4380. module.exports.QueuePurge = 3276830;
  4381. var methodInfoQueuePurge = module.exports.methodInfoQueuePurge = {
  4382. id: 3276830,
  4383. classId: 50,
  4384. methodId: 30,
  4385. name: "QueuePurge",
  4386. args: [ {
  4387. type: "short",
  4388. name: "ticket",
  4389. default: 0
  4390. }, {
  4391. type: "shortstr",
  4392. name: "queue",
  4393. default: ""
  4394. }, {
  4395. type: "bit",
  4396. name: "nowait",
  4397. default: !1
  4398. } ]
  4399. };
  4400. module.exports.QueuePurgeOk = 3276831;
  4401. var methodInfoQueuePurgeOk = module.exports.methodInfoQueuePurgeOk = {
  4402. id: 3276831,
  4403. classId: 50,
  4404. methodId: 31,
  4405. name: "QueuePurgeOk",
  4406. args: [ {
  4407. type: "long",
  4408. name: "messageCount"
  4409. } ]
  4410. };
  4411. module.exports.QueueDelete = 3276840;
  4412. var methodInfoQueueDelete = module.exports.methodInfoQueueDelete = {
  4413. id: 3276840,
  4414. classId: 50,
  4415. methodId: 40,
  4416. name: "QueueDelete",
  4417. args: [ {
  4418. type: "short",
  4419. name: "ticket",
  4420. default: 0
  4421. }, {
  4422. type: "shortstr",
  4423. name: "queue",
  4424. default: ""
  4425. }, {
  4426. type: "bit",
  4427. name: "ifUnused",
  4428. default: !1
  4429. }, {
  4430. type: "bit",
  4431. name: "ifEmpty",
  4432. default: !1
  4433. }, {
  4434. type: "bit",
  4435. name: "nowait",
  4436. default: !1
  4437. } ]
  4438. };
  4439. module.exports.QueueDeleteOk = 3276841;
  4440. var methodInfoQueueDeleteOk = module.exports.methodInfoQueueDeleteOk = {
  4441. id: 3276841,
  4442. classId: 50,
  4443. methodId: 41,
  4444. name: "QueueDeleteOk",
  4445. args: [ {
  4446. type: "long",
  4447. name: "messageCount"
  4448. } ]
  4449. };
  4450. module.exports.QueueUnbind = 3276850;
  4451. var methodInfoQueueUnbind = module.exports.methodInfoQueueUnbind = {
  4452. id: 3276850,
  4453. classId: 50,
  4454. methodId: 50,
  4455. name: "QueueUnbind",
  4456. args: [ {
  4457. type: "short",
  4458. name: "ticket",
  4459. default: 0
  4460. }, {
  4461. type: "shortstr",
  4462. name: "queue",
  4463. default: ""
  4464. }, {
  4465. type: "shortstr",
  4466. name: "exchange"
  4467. }, {
  4468. type: "shortstr",
  4469. name: "routingKey",
  4470. default: ""
  4471. }, {
  4472. type: "table",
  4473. name: "arguments",
  4474. default: {}
  4475. } ]
  4476. };
  4477. module.exports.QueueUnbindOk = 3276851;
  4478. var methodInfoQueueUnbindOk = module.exports.methodInfoQueueUnbindOk = {
  4479. id: 3276851,
  4480. classId: 50,
  4481. methodId: 51,
  4482. name: "QueueUnbindOk",
  4483. args: []
  4484. };
  4485. module.exports.TxSelect = 5898250;
  4486. var methodInfoTxSelect = module.exports.methodInfoTxSelect = {
  4487. id: 5898250,
  4488. classId: 90,
  4489. methodId: 10,
  4490. name: "TxSelect",
  4491. args: []
  4492. };
  4493. module.exports.TxSelectOk = 5898251;
  4494. var methodInfoTxSelectOk = module.exports.methodInfoTxSelectOk = {
  4495. id: 5898251,
  4496. classId: 90,
  4497. methodId: 11,
  4498. name: "TxSelectOk",
  4499. args: []
  4500. };
  4501. module.exports.TxCommit = 5898260;
  4502. var methodInfoTxCommit = module.exports.methodInfoTxCommit = {
  4503. id: 5898260,
  4504. classId: 90,
  4505. methodId: 20,
  4506. name: "TxCommit",
  4507. args: []
  4508. };
  4509. module.exports.TxCommitOk = 5898261;
  4510. var methodInfoTxCommitOk = module.exports.methodInfoTxCommitOk = {
  4511. id: 5898261,
  4512. classId: 90,
  4513. methodId: 21,
  4514. name: "TxCommitOk",
  4515. args: []
  4516. };
  4517. module.exports.TxRollback = 5898270;
  4518. var methodInfoTxRollback = module.exports.methodInfoTxRollback = {
  4519. id: 5898270,
  4520. classId: 90,
  4521. methodId: 30,
  4522. name: "TxRollback",
  4523. args: []
  4524. };
  4525. module.exports.TxRollbackOk = 5898271;
  4526. var methodInfoTxRollbackOk = module.exports.methodInfoTxRollbackOk = {
  4527. id: 5898271,
  4528. classId: 90,
  4529. methodId: 31,
  4530. name: "TxRollbackOk",
  4531. args: []
  4532. };
  4533. module.exports.ConfirmSelect = 5570570;
  4534. var methodInfoConfirmSelect = module.exports.methodInfoConfirmSelect = {
  4535. id: 5570570,
  4536. classId: 85,
  4537. methodId: 10,
  4538. name: "ConfirmSelect",
  4539. args: [ {
  4540. type: "bit",
  4541. name: "nowait",
  4542. default: !1
  4543. } ]
  4544. };
  4545. module.exports.ConfirmSelectOk = 5570571;
  4546. var methodInfoConfirmSelectOk = module.exports.methodInfoConfirmSelectOk = {
  4547. id: 5570571,
  4548. classId: 85,
  4549. methodId: 11,
  4550. name: "ConfirmSelectOk",
  4551. args: []
  4552. };
  4553. module.exports.BasicProperties = 60;
  4554. var propertiesInfoBasicProperties = module.exports.propertiesInfoBasicProperties = {
  4555. id: 60,
  4556. name: "BasicProperties",
  4557. args: [ {
  4558. type: "shortstr",
  4559. name: "contentType"
  4560. }, {
  4561. type: "shortstr",
  4562. name: "contentEncoding"
  4563. }, {
  4564. type: "table",
  4565. name: "headers"
  4566. }, {
  4567. type: "octet",
  4568. name: "deliveryMode"
  4569. }, {
  4570. type: "octet",
  4571. name: "priority"
  4572. }, {
  4573. type: "shortstr",
  4574. name: "correlationId"
  4575. }, {
  4576. type: "shortstr",
  4577. name: "replyTo"
  4578. }, {
  4579. type: "shortstr",
  4580. name: "expiration"
  4581. }, {
  4582. type: "shortstr",
  4583. name: "messageId"
  4584. }, {
  4585. type: "timestamp",
  4586. name: "timestamp"
  4587. }, {
  4588. type: "shortstr",
  4589. name: "type"
  4590. }, {
  4591. type: "shortstr",
  4592. name: "userId"
  4593. }, {
  4594. type: "shortstr",
  4595. name: "appId"
  4596. }, {
  4597. type: "shortstr",
  4598. name: "clusterId"
  4599. } ]
  4600. };