aws-sdk-core-react-native.js 501 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["AWS"] = factory();
  8. else
  9. root["AWS"] = factory();
  10. })(this, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/ // The require function
  15. /******/ function __webpack_require__(moduleId) {
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId])
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ // Create a new module (and put it into the cache)
  20. /******/ var module = installedModules[moduleId] = {
  21. /******/ exports: {},
  22. /******/ id: moduleId,
  23. /******/ loaded: false
  24. /******/ };
  25. /******/ // Execute the module function
  26. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  27. /******/ // Flag the module as loaded
  28. /******/ module.loaded = true;
  29. /******/ // Return the exports of the module
  30. /******/ return module.exports;
  31. /******/ }
  32. /******/ // expose the modules object (__webpack_modules__)
  33. /******/ __webpack_require__.m = modules;
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/ // __webpack_public_path__
  37. /******/ __webpack_require__.p = "";
  38. /******/ // Load entry module and return exports
  39. /******/ return __webpack_require__(0);
  40. /******/ })
  41. /************************************************************************/
  42. /******/ ([
  43. /* 0 */
  44. /***/ (function(module, exports, __webpack_require__) {
  45. module.exports = __webpack_require__(1);
  46. /***/ }),
  47. /* 1 */
  48. /***/ (function(module, exports, __webpack_require__) {
  49. /**
  50. * The main AWS namespace
  51. */
  52. var AWS = { util: __webpack_require__(2) };
  53. /**
  54. * @api private
  55. * @!macro [new] nobrowser
  56. * @note This feature is not supported in the browser environment of the SDK.
  57. */
  58. var _hidden = {}; _hidden.toString(); // hack to parse macro
  59. /**
  60. * @api private
  61. */
  62. module.exports = AWS;
  63. AWS.util.update(AWS, {
  64. /**
  65. * @constant
  66. */
  67. VERSION: '2.1618.0',
  68. /**
  69. * @api private
  70. */
  71. Signers: {},
  72. /**
  73. * @api private
  74. */
  75. Protocol: {
  76. Json: __webpack_require__(18),
  77. Query: __webpack_require__(22),
  78. Rest: __webpack_require__(26),
  79. RestJson: __webpack_require__(27),
  80. RestXml: __webpack_require__(28)
  81. },
  82. /**
  83. * @api private
  84. */
  85. XML: {
  86. Builder: __webpack_require__(29),
  87. Parser: null // conditionally set based on environment
  88. },
  89. /**
  90. * @api private
  91. */
  92. JSON: {
  93. Builder: __webpack_require__(19),
  94. Parser: __webpack_require__(20)
  95. },
  96. /**
  97. * @api private
  98. */
  99. Model: {
  100. Api: __webpack_require__(34),
  101. Operation: __webpack_require__(35),
  102. Shape: __webpack_require__(24),
  103. Paginator: __webpack_require__(36),
  104. ResourceWaiter: __webpack_require__(37)
  105. },
  106. /**
  107. * @api private
  108. */
  109. apiLoader: __webpack_require__(38),
  110. /**
  111. * @api private
  112. */
  113. EndpointCache: __webpack_require__(39).EndpointCache
  114. });
  115. __webpack_require__(41);
  116. __webpack_require__(42);
  117. __webpack_require__(46);
  118. __webpack_require__(49);
  119. __webpack_require__(50);
  120. __webpack_require__(86);
  121. __webpack_require__(89);
  122. __webpack_require__(90);
  123. __webpack_require__(91);
  124. __webpack_require__(100);
  125. __webpack_require__(101);
  126. /**
  127. * @readonly
  128. * @return [AWS.SequentialExecutor] a collection of global event listeners that
  129. * are attached to every sent request.
  130. * @see AWS.Request AWS.Request for a list of events to listen for
  131. * @example Logging the time taken to send a request
  132. * AWS.events.on('send', function startSend(resp) {
  133. * resp.startTime = new Date().getTime();
  134. * }).on('complete', function calculateTime(resp) {
  135. * var time = (new Date().getTime() - resp.startTime) / 1000;
  136. * console.log('Request took ' + time + ' seconds');
  137. * });
  138. *
  139. * new AWS.S3().listBuckets(); // prints 'Request took 0.285 seconds'
  140. */
  141. AWS.events = new AWS.SequentialExecutor();
  142. //create endpoint cache lazily
  143. AWS.util.memoizedProperty(AWS, 'endpointCache', function() {
  144. return new AWS.EndpointCache(AWS.config.endpointCacheSize);
  145. }, true);
  146. /***/ }),
  147. /* 2 */
  148. /***/ (function(module, exports, __webpack_require__) {
  149. /* WEBPACK VAR INJECTION */(function(process, setImmediate) {/* eslint guard-for-in:0 */
  150. var AWS;
  151. /**
  152. * A set of utility methods for use with the AWS SDK.
  153. *
  154. * @!attribute abort
  155. * Return this value from an iterator function {each} or {arrayEach}
  156. * to break out of the iteration.
  157. * @example Breaking out of an iterator function
  158. * AWS.util.each({a: 1, b: 2, c: 3}, function(key, value) {
  159. * if (key == 'b') return AWS.util.abort;
  160. * });
  161. * @see each
  162. * @see arrayEach
  163. * @api private
  164. */
  165. var util = {
  166. environment: 'nodejs',
  167. engine: function engine() {
  168. if (util.isBrowser() && typeof navigator !== 'undefined') {
  169. return navigator.userAgent;
  170. } else {
  171. var engine = process.platform + '/' + process.version;
  172. if (process.env.AWS_EXECUTION_ENV) {
  173. engine += ' exec-env/' + process.env.AWS_EXECUTION_ENV;
  174. }
  175. return engine;
  176. }
  177. },
  178. userAgent: function userAgent() {
  179. var name = util.environment;
  180. var agent = 'aws-sdk-' + name + '/' + __webpack_require__(1).VERSION;
  181. if (name === 'nodejs') agent += ' ' + util.engine();
  182. return agent;
  183. },
  184. uriEscape: function uriEscape(string) {
  185. var output = encodeURIComponent(string);
  186. output = output.replace(/[^A-Za-z0-9_.~\-%]+/g, escape);
  187. // AWS percent-encodes some extra non-standard characters in a URI
  188. output = output.replace(/[*]/g, function(ch) {
  189. return '%' + ch.charCodeAt(0).toString(16).toUpperCase();
  190. });
  191. return output;
  192. },
  193. uriEscapePath: function uriEscapePath(string) {
  194. var parts = [];
  195. util.arrayEach(string.split('/'), function (part) {
  196. parts.push(util.uriEscape(part));
  197. });
  198. return parts.join('/');
  199. },
  200. urlParse: function urlParse(url) {
  201. return util.url.parse(url);
  202. },
  203. urlFormat: function urlFormat(url) {
  204. return util.url.format(url);
  205. },
  206. queryStringParse: function queryStringParse(qs) {
  207. return util.querystring.parse(qs);
  208. },
  209. queryParamsToString: function queryParamsToString(params) {
  210. var items = [];
  211. var escape = util.uriEscape;
  212. var sortedKeys = Object.keys(params).sort();
  213. util.arrayEach(sortedKeys, function(name) {
  214. var value = params[name];
  215. var ename = escape(name);
  216. var result = ename + '=';
  217. if (Array.isArray(value)) {
  218. var vals = [];
  219. util.arrayEach(value, function(item) { vals.push(escape(item)); });
  220. result = ename + '=' + vals.sort().join('&' + ename + '=');
  221. } else if (value !== undefined && value !== null) {
  222. result = ename + '=' + escape(value);
  223. }
  224. items.push(result);
  225. });
  226. return items.join('&');
  227. },
  228. readFileSync: function readFileSync(path) {
  229. if (util.isBrowser()) return null;
  230. return __webpack_require__(6).readFileSync(path, 'utf-8');
  231. },
  232. base64: {
  233. encode: function encode64(string) {
  234. if (typeof string === 'number') {
  235. throw util.error(new Error('Cannot base64 encode number ' + string));
  236. }
  237. if (string === null || typeof string === 'undefined') {
  238. return string;
  239. }
  240. var buf = util.buffer.toBuffer(string);
  241. return buf.toString('base64');
  242. },
  243. decode: function decode64(string) {
  244. if (typeof string === 'number') {
  245. throw util.error(new Error('Cannot base64 decode number ' + string));
  246. }
  247. if (string === null || typeof string === 'undefined') {
  248. return string;
  249. }
  250. return util.buffer.toBuffer(string, 'base64');
  251. }
  252. },
  253. buffer: {
  254. /**
  255. * Buffer constructor for Node buffer and buffer pollyfill
  256. */
  257. toBuffer: function(data, encoding) {
  258. return (typeof util.Buffer.from === 'function' && util.Buffer.from !== Uint8Array.from) ?
  259. util.Buffer.from(data, encoding) : new util.Buffer(data, encoding);
  260. },
  261. alloc: function(size, fill, encoding) {
  262. if (typeof size !== 'number') {
  263. throw new Error('size passed to alloc must be a number.');
  264. }
  265. if (typeof util.Buffer.alloc === 'function') {
  266. return util.Buffer.alloc(size, fill, encoding);
  267. } else {
  268. var buf = new util.Buffer(size);
  269. if (fill !== undefined && typeof buf.fill === 'function') {
  270. buf.fill(fill, undefined, undefined, encoding);
  271. }
  272. return buf;
  273. }
  274. },
  275. toStream: function toStream(buffer) {
  276. if (!util.Buffer.isBuffer(buffer)) buffer = util.buffer.toBuffer(buffer);
  277. var readable = new (util.stream.Readable)();
  278. var pos = 0;
  279. readable._read = function(size) {
  280. if (pos >= buffer.length) return readable.push(null);
  281. var end = pos + size;
  282. if (end > buffer.length) end = buffer.length;
  283. readable.push(buffer.slice(pos, end));
  284. pos = end;
  285. };
  286. return readable;
  287. },
  288. /**
  289. * Concatenates a list of Buffer objects.
  290. */
  291. concat: function(buffers) {
  292. var length = 0,
  293. offset = 0,
  294. buffer = null, i;
  295. for (i = 0; i < buffers.length; i++) {
  296. length += buffers[i].length;
  297. }
  298. buffer = util.buffer.alloc(length);
  299. for (i = 0; i < buffers.length; i++) {
  300. buffers[i].copy(buffer, offset);
  301. offset += buffers[i].length;
  302. }
  303. return buffer;
  304. }
  305. },
  306. string: {
  307. byteLength: function byteLength(string) {
  308. if (string === null || string === undefined) return 0;
  309. if (typeof string === 'string') string = util.buffer.toBuffer(string);
  310. if (typeof string.byteLength === 'number') {
  311. return string.byteLength;
  312. } else if (typeof string.length === 'number') {
  313. return string.length;
  314. } else if (typeof string.size === 'number') {
  315. return string.size;
  316. } else if (typeof string.path === 'string') {
  317. return __webpack_require__(6).lstatSync(string.path).size;
  318. } else {
  319. throw util.error(new Error('Cannot determine length of ' + string),
  320. { object: string });
  321. }
  322. },
  323. upperFirst: function upperFirst(string) {
  324. return string[0].toUpperCase() + string.substr(1);
  325. },
  326. lowerFirst: function lowerFirst(string) {
  327. return string[0].toLowerCase() + string.substr(1);
  328. }
  329. },
  330. ini: {
  331. parse: function string(ini) {
  332. var currentSection, map = {};
  333. util.arrayEach(ini.split(/\r?\n/), function(line) {
  334. line = line.split(/(^|\s)[;#]/)[0].trim(); // remove comments and trim
  335. var isSection = line[0] === '[' && line[line.length - 1] === ']';
  336. if (isSection) {
  337. currentSection = line.substring(1, line.length - 1);
  338. if (currentSection === '__proto__' || currentSection.split(/\s/)[1] === '__proto__') {
  339. throw util.error(
  340. new Error('Cannot load profile name \'' + currentSection + '\' from shared ini file.')
  341. );
  342. }
  343. } else if (currentSection) {
  344. var indexOfEqualsSign = line.indexOf('=');
  345. var start = 0;
  346. var end = line.length - 1;
  347. var isAssignment =
  348. indexOfEqualsSign !== -1 && indexOfEqualsSign !== start && indexOfEqualsSign !== end;
  349. if (isAssignment) {
  350. var name = line.substring(0, indexOfEqualsSign).trim();
  351. var value = line.substring(indexOfEqualsSign + 1).trim();
  352. map[currentSection] = map[currentSection] || {};
  353. map[currentSection][name] = value;
  354. }
  355. }
  356. });
  357. return map;
  358. }
  359. },
  360. fn: {
  361. noop: function() {},
  362. callback: function (err) { if (err) throw err; },
  363. /**
  364. * Turn a synchronous function into as "async" function by making it call
  365. * a callback. The underlying function is called with all but the last argument,
  366. * which is treated as the callback. The callback is passed passed a first argument
  367. * of null on success to mimick standard node callbacks.
  368. */
  369. makeAsync: function makeAsync(fn, expectedArgs) {
  370. if (expectedArgs && expectedArgs <= fn.length) {
  371. return fn;
  372. }
  373. return function() {
  374. var args = Array.prototype.slice.call(arguments, 0);
  375. var callback = args.pop();
  376. var result = fn.apply(null, args);
  377. callback(result);
  378. };
  379. }
  380. },
  381. /**
  382. * Date and time utility functions.
  383. */
  384. date: {
  385. /**
  386. * @return [Date] the current JavaScript date object. Since all
  387. * AWS services rely on this date object, you can override
  388. * this function to provide a special time value to AWS service
  389. * requests.
  390. */
  391. getDate: function getDate() {
  392. if (!AWS) AWS = __webpack_require__(1);
  393. if (AWS.config.systemClockOffset) { // use offset when non-zero
  394. return new Date(new Date().getTime() + AWS.config.systemClockOffset);
  395. } else {
  396. return new Date();
  397. }
  398. },
  399. /**
  400. * @return [String] the date in ISO-8601 format
  401. */
  402. iso8601: function iso8601(date) {
  403. if (date === undefined) { date = util.date.getDate(); }
  404. return date.toISOString().replace(/\.\d{3}Z$/, 'Z');
  405. },
  406. /**
  407. * @return [String] the date in RFC 822 format
  408. */
  409. rfc822: function rfc822(date) {
  410. if (date === undefined) { date = util.date.getDate(); }
  411. return date.toUTCString();
  412. },
  413. /**
  414. * @return [Integer] the UNIX timestamp value for the current time
  415. */
  416. unixTimestamp: function unixTimestamp(date) {
  417. if (date === undefined) { date = util.date.getDate(); }
  418. return date.getTime() / 1000;
  419. },
  420. /**
  421. * @param [String,number,Date] date
  422. * @return [Date]
  423. */
  424. from: function format(date) {
  425. if (typeof date === 'number') {
  426. return new Date(date * 1000); // unix timestamp
  427. } else {
  428. return new Date(date);
  429. }
  430. },
  431. /**
  432. * Given a Date or date-like value, this function formats the
  433. * date into a string of the requested value.
  434. * @param [String,number,Date] date
  435. * @param [String] formatter Valid formats are:
  436. # * 'iso8601'
  437. # * 'rfc822'
  438. # * 'unixTimestamp'
  439. * @return [String]
  440. */
  441. format: function format(date, formatter) {
  442. if (!formatter) formatter = 'iso8601';
  443. return util.date[formatter](util.date.from(date));
  444. },
  445. parseTimestamp: function parseTimestamp(value) {
  446. if (typeof value === 'number') { // unix timestamp (number)
  447. return new Date(value * 1000);
  448. } else if (value.match(/^\d+$/)) { // unix timestamp
  449. return new Date(value * 1000);
  450. } else if (value.match(/^\d{4}/)) { // iso8601
  451. return new Date(value);
  452. } else if (value.match(/^\w{3},/)) { // rfc822
  453. return new Date(value);
  454. } else {
  455. throw util.error(
  456. new Error('unhandled timestamp format: ' + value),
  457. {code: 'TimestampParserError'});
  458. }
  459. }
  460. },
  461. crypto: {
  462. crc32Table: [
  463. 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419,
  464. 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4,
  465. 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,
  466. 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
  467. 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856,
  468. 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
  469. 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,
  470. 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
  471. 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
  472. 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A,
  473. 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599,
  474. 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
  475. 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190,
  476. 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
  477. 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E,
  478. 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
  479. 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED,
  480. 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
  481. 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3,
  482. 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
  483. 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,
  484. 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,
  485. 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010,
  486. 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
  487. 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17,
  488. 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6,
  489. 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
  490. 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
  491. 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344,
  492. 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
  493. 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A,
  494. 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
  495. 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1,
  496. 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C,
  497. 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,
  498. 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
  499. 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE,
  500. 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,
  501. 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C,
  502. 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
  503. 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B,
  504. 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
  505. 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1,
  506. 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
  507. 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,
  508. 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,
  509. 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66,
  510. 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
  511. 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,
  512. 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8,
  513. 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B,
  514. 0x2D02EF8D],
  515. crc32: function crc32(data) {
  516. var tbl = util.crypto.crc32Table;
  517. var crc = 0 ^ -1;
  518. if (typeof data === 'string') {
  519. data = util.buffer.toBuffer(data);
  520. }
  521. for (var i = 0; i < data.length; i++) {
  522. var code = data.readUInt8(i);
  523. crc = (crc >>> 8) ^ tbl[(crc ^ code) & 0xFF];
  524. }
  525. return (crc ^ -1) >>> 0;
  526. },
  527. hmac: function hmac(key, string, digest, fn) {
  528. if (!digest) digest = 'binary';
  529. if (digest === 'buffer') { digest = undefined; }
  530. if (!fn) fn = 'sha256';
  531. if (typeof string === 'string') string = util.buffer.toBuffer(string);
  532. return util.crypto.lib.createHmac(fn, key).update(string).digest(digest);
  533. },
  534. md5: function md5(data, digest, callback) {
  535. return util.crypto.hash('md5', data, digest, callback);
  536. },
  537. sha256: function sha256(data, digest, callback) {
  538. return util.crypto.hash('sha256', data, digest, callback);
  539. },
  540. hash: function(algorithm, data, digest, callback) {
  541. var hash = util.crypto.createHash(algorithm);
  542. if (!digest) { digest = 'binary'; }
  543. if (digest === 'buffer') { digest = undefined; }
  544. if (typeof data === 'string') data = util.buffer.toBuffer(data);
  545. var sliceFn = util.arraySliceFn(data);
  546. var isBuffer = util.Buffer.isBuffer(data);
  547. //Identifying objects with an ArrayBuffer as buffers
  548. if (util.isBrowser() && typeof ArrayBuffer !== 'undefined' && data && data.buffer instanceof ArrayBuffer) isBuffer = true;
  549. if (callback && typeof data === 'object' &&
  550. typeof data.on === 'function' && !isBuffer) {
  551. data.on('data', function(chunk) { hash.update(chunk); });
  552. data.on('error', function(err) { callback(err); });
  553. data.on('end', function() { callback(null, hash.digest(digest)); });
  554. } else if (callback && sliceFn && !isBuffer &&
  555. typeof FileReader !== 'undefined') {
  556. // this might be a File/Blob
  557. var index = 0, size = 1024 * 512;
  558. var reader = new FileReader();
  559. reader.onerror = function() {
  560. callback(new Error('Failed to read data.'));
  561. };
  562. reader.onload = function() {
  563. var buf = new util.Buffer(new Uint8Array(reader.result));
  564. hash.update(buf);
  565. index += buf.length;
  566. reader._continueReading();
  567. };
  568. reader._continueReading = function() {
  569. if (index >= data.size) {
  570. callback(null, hash.digest(digest));
  571. return;
  572. }
  573. var back = index + size;
  574. if (back > data.size) back = data.size;
  575. reader.readAsArrayBuffer(sliceFn.call(data, index, back));
  576. };
  577. reader._continueReading();
  578. } else {
  579. if (util.isBrowser() && typeof data === 'object' && !isBuffer) {
  580. data = new util.Buffer(new Uint8Array(data));
  581. }
  582. var out = hash.update(data).digest(digest);
  583. if (callback) callback(null, out);
  584. return out;
  585. }
  586. },
  587. toHex: function toHex(data) {
  588. var out = [];
  589. for (var i = 0; i < data.length; i++) {
  590. out.push(('0' + data.charCodeAt(i).toString(16)).substr(-2, 2));
  591. }
  592. return out.join('');
  593. },
  594. createHash: function createHash(algorithm) {
  595. return util.crypto.lib.createHash(algorithm);
  596. }
  597. },
  598. /** @!ignore */
  599. /* Abort constant */
  600. abort: {},
  601. each: function each(object, iterFunction) {
  602. for (var key in object) {
  603. if (Object.prototype.hasOwnProperty.call(object, key)) {
  604. var ret = iterFunction.call(this, key, object[key]);
  605. if (ret === util.abort) break;
  606. }
  607. }
  608. },
  609. arrayEach: function arrayEach(array, iterFunction) {
  610. for (var idx in array) {
  611. if (Object.prototype.hasOwnProperty.call(array, idx)) {
  612. var ret = iterFunction.call(this, array[idx], parseInt(idx, 10));
  613. if (ret === util.abort) break;
  614. }
  615. }
  616. },
  617. update: function update(obj1, obj2) {
  618. util.each(obj2, function iterator(key, item) {
  619. obj1[key] = item;
  620. });
  621. return obj1;
  622. },
  623. merge: function merge(obj1, obj2) {
  624. return util.update(util.copy(obj1), obj2);
  625. },
  626. copy: function copy(object) {
  627. if (object === null || object === undefined) return object;
  628. var dupe = {};
  629. // jshint forin:false
  630. for (var key in object) {
  631. dupe[key] = object[key];
  632. }
  633. return dupe;
  634. },
  635. isEmpty: function isEmpty(obj) {
  636. for (var prop in obj) {
  637. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  638. return false;
  639. }
  640. }
  641. return true;
  642. },
  643. arraySliceFn: function arraySliceFn(obj) {
  644. var fn = obj.slice || obj.webkitSlice || obj.mozSlice;
  645. return typeof fn === 'function' ? fn : null;
  646. },
  647. isType: function isType(obj, type) {
  648. // handle cross-"frame" objects
  649. if (typeof type === 'function') type = util.typeName(type);
  650. return Object.prototype.toString.call(obj) === '[object ' + type + ']';
  651. },
  652. typeName: function typeName(type) {
  653. if (Object.prototype.hasOwnProperty.call(type, 'name')) return type.name;
  654. var str = type.toString();
  655. var match = str.match(/^\s*function (.+)\(/);
  656. return match ? match[1] : str;
  657. },
  658. error: function error(err, options) {
  659. var originalError = null;
  660. if (typeof err.message === 'string' && err.message !== '') {
  661. if (typeof options === 'string' || (options && options.message)) {
  662. originalError = util.copy(err);
  663. originalError.message = err.message;
  664. }
  665. }
  666. err.message = err.message || null;
  667. if (typeof options === 'string') {
  668. err.message = options;
  669. } else if (typeof options === 'object' && options !== null) {
  670. util.update(err, options);
  671. if (options.message)
  672. err.message = options.message;
  673. if (options.code || options.name)
  674. err.code = options.code || options.name;
  675. if (options.stack)
  676. err.stack = options.stack;
  677. }
  678. if (typeof Object.defineProperty === 'function') {
  679. Object.defineProperty(err, 'name', {writable: true, enumerable: false});
  680. Object.defineProperty(err, 'message', {enumerable: true});
  681. }
  682. err.name = String(options && options.name || err.name || err.code || 'Error');
  683. err.time = new Date();
  684. if (originalError) {
  685. err.originalError = originalError;
  686. }
  687. for (var key in options || {}) {
  688. if (key[0] === '[' && key[key.length - 1] === ']') {
  689. key = key.slice(1, -1);
  690. if (key === 'code' || key === 'message') {
  691. continue;
  692. }
  693. err['[' + key + ']'] = 'See error.' + key + ' for details.';
  694. Object.defineProperty(err, key, {
  695. value: err[key] || (options && options[key]) || (originalError && originalError[key]),
  696. enumerable: false,
  697. writable: true
  698. });
  699. }
  700. }
  701. return err;
  702. },
  703. /**
  704. * @api private
  705. */
  706. inherit: function inherit(klass, features) {
  707. var newObject = null;
  708. if (features === undefined) {
  709. features = klass;
  710. klass = Object;
  711. newObject = {};
  712. } else {
  713. var ctor = function ConstructorWrapper() {};
  714. ctor.prototype = klass.prototype;
  715. newObject = new ctor();
  716. }
  717. // constructor not supplied, create pass-through ctor
  718. if (features.constructor === Object) {
  719. features.constructor = function() {
  720. if (klass !== Object) {
  721. return klass.apply(this, arguments);
  722. }
  723. };
  724. }
  725. features.constructor.prototype = newObject;
  726. util.update(features.constructor.prototype, features);
  727. features.constructor.__super__ = klass;
  728. return features.constructor;
  729. },
  730. /**
  731. * @api private
  732. */
  733. mixin: function mixin() {
  734. var klass = arguments[0];
  735. for (var i = 1; i < arguments.length; i++) {
  736. // jshint forin:false
  737. for (var prop in arguments[i].prototype) {
  738. var fn = arguments[i].prototype[prop];
  739. if (prop !== 'constructor') {
  740. klass.prototype[prop] = fn;
  741. }
  742. }
  743. }
  744. return klass;
  745. },
  746. /**
  747. * @api private
  748. */
  749. hideProperties: function hideProperties(obj, props) {
  750. if (typeof Object.defineProperty !== 'function') return;
  751. util.arrayEach(props, function (key) {
  752. Object.defineProperty(obj, key, {
  753. enumerable: false, writable: true, configurable: true });
  754. });
  755. },
  756. /**
  757. * @api private
  758. */
  759. property: function property(obj, name, value, enumerable, isValue) {
  760. var opts = {
  761. configurable: true,
  762. enumerable: enumerable !== undefined ? enumerable : true
  763. };
  764. if (typeof value === 'function' && !isValue) {
  765. opts.get = value;
  766. }
  767. else {
  768. opts.value = value; opts.writable = true;
  769. }
  770. Object.defineProperty(obj, name, opts);
  771. },
  772. /**
  773. * @api private
  774. */
  775. memoizedProperty: function memoizedProperty(obj, name, get, enumerable) {
  776. var cachedValue = null;
  777. // build enumerable attribute for each value with lazy accessor.
  778. util.property(obj, name, function() {
  779. if (cachedValue === null) {
  780. cachedValue = get();
  781. }
  782. return cachedValue;
  783. }, enumerable);
  784. },
  785. /**
  786. * TODO Remove in major version revision
  787. * This backfill populates response data without the
  788. * top-level payload name.
  789. *
  790. * @api private
  791. */
  792. hoistPayloadMember: function hoistPayloadMember(resp) {
  793. var req = resp.request;
  794. var operationName = req.operation;
  795. var operation = req.service.api.operations[operationName];
  796. var output = operation.output;
  797. if (output.payload && !operation.hasEventOutput) {
  798. var payloadMember = output.members[output.payload];
  799. var responsePayload = resp.data[output.payload];
  800. if (payloadMember.type === 'structure') {
  801. util.each(responsePayload, function(key, value) {
  802. util.property(resp.data, key, value, false);
  803. });
  804. }
  805. }
  806. },
  807. /**
  808. * Compute SHA-256 checksums of streams
  809. *
  810. * @api private
  811. */
  812. computeSha256: function computeSha256(body, done) {
  813. if (util.isNode()) {
  814. var Stream = util.stream.Stream;
  815. var fs = __webpack_require__(6);
  816. if (typeof Stream === 'function' && body instanceof Stream) {
  817. if (typeof body.path === 'string') { // assume file object
  818. var settings = {};
  819. if (typeof body.start === 'number') {
  820. settings.start = body.start;
  821. }
  822. if (typeof body.end === 'number') {
  823. settings.end = body.end;
  824. }
  825. body = fs.createReadStream(body.path, settings);
  826. } else { // TODO support other stream types
  827. return done(new Error('Non-file stream objects are ' +
  828. 'not supported with SigV4'));
  829. }
  830. }
  831. }
  832. util.crypto.sha256(body, 'hex', function(err, sha) {
  833. if (err) done(err);
  834. else done(null, sha);
  835. });
  836. },
  837. /**
  838. * @api private
  839. */
  840. isClockSkewed: function isClockSkewed(serverTime) {
  841. if (serverTime) {
  842. util.property(AWS.config, 'isClockSkewed',
  843. Math.abs(new Date().getTime() - serverTime) >= 300000, false);
  844. return AWS.config.isClockSkewed;
  845. }
  846. },
  847. applyClockOffset: function applyClockOffset(serverTime) {
  848. if (serverTime)
  849. AWS.config.systemClockOffset = serverTime - new Date().getTime();
  850. },
  851. /**
  852. * @api private
  853. */
  854. extractRequestId: function extractRequestId(resp) {
  855. var requestId = resp.httpResponse.headers['x-amz-request-id'] ||
  856. resp.httpResponse.headers['x-amzn-requestid'];
  857. if (!requestId && resp.data && resp.data.ResponseMetadata) {
  858. requestId = resp.data.ResponseMetadata.RequestId;
  859. }
  860. if (requestId) {
  861. resp.requestId = requestId;
  862. }
  863. if (resp.error) {
  864. resp.error.requestId = requestId;
  865. }
  866. },
  867. /**
  868. * @api private
  869. */
  870. addPromises: function addPromises(constructors, PromiseDependency) {
  871. var deletePromises = false;
  872. if (PromiseDependency === undefined && AWS && AWS.config) {
  873. PromiseDependency = AWS.config.getPromisesDependency();
  874. }
  875. if (PromiseDependency === undefined && typeof Promise !== 'undefined') {
  876. PromiseDependency = Promise;
  877. }
  878. if (typeof PromiseDependency !== 'function') deletePromises = true;
  879. if (!Array.isArray(constructors)) constructors = [constructors];
  880. for (var ind = 0; ind < constructors.length; ind++) {
  881. var constructor = constructors[ind];
  882. if (deletePromises) {
  883. if (constructor.deletePromisesFromClass) {
  884. constructor.deletePromisesFromClass();
  885. }
  886. } else if (constructor.addPromisesToClass) {
  887. constructor.addPromisesToClass(PromiseDependency);
  888. }
  889. }
  890. },
  891. /**
  892. * @api private
  893. * Return a function that will return a promise whose fate is decided by the
  894. * callback behavior of the given method with `methodName`. The method to be
  895. * promisified should conform to node.js convention of accepting a callback as
  896. * last argument and calling that callback with error as the first argument
  897. * and success value on the second argument.
  898. */
  899. promisifyMethod: function promisifyMethod(methodName, PromiseDependency) {
  900. return function promise() {
  901. var self = this;
  902. var args = Array.prototype.slice.call(arguments);
  903. return new PromiseDependency(function(resolve, reject) {
  904. args.push(function(err, data) {
  905. if (err) {
  906. reject(err);
  907. } else {
  908. resolve(data);
  909. }
  910. });
  911. self[methodName].apply(self, args);
  912. });
  913. };
  914. },
  915. /**
  916. * @api private
  917. */
  918. isDualstackAvailable: function isDualstackAvailable(service) {
  919. if (!service) return false;
  920. var metadata = __webpack_require__(7);
  921. if (typeof service !== 'string') service = service.serviceIdentifier;
  922. if (typeof service !== 'string' || !metadata.hasOwnProperty(service)) return false;
  923. return !!metadata[service].dualstackAvailable;
  924. },
  925. /**
  926. * @api private
  927. */
  928. calculateRetryDelay: function calculateRetryDelay(retryCount, retryDelayOptions, err) {
  929. if (!retryDelayOptions) retryDelayOptions = {};
  930. var customBackoff = retryDelayOptions.customBackoff || null;
  931. if (typeof customBackoff === 'function') {
  932. return customBackoff(retryCount, err);
  933. }
  934. var base = typeof retryDelayOptions.base === 'number' ? retryDelayOptions.base : 100;
  935. var delay = Math.random() * (Math.pow(2, retryCount) * base);
  936. return delay;
  937. },
  938. /**
  939. * @api private
  940. */
  941. handleRequestWithRetries: function handleRequestWithRetries(httpRequest, options, cb) {
  942. if (!options) options = {};
  943. var http = AWS.HttpClient.getInstance();
  944. var httpOptions = options.httpOptions || {};
  945. var retryCount = 0;
  946. var errCallback = function(err) {
  947. var maxRetries = options.maxRetries || 0;
  948. if (err && err.code === 'TimeoutError') err.retryable = true;
  949. // Call `calculateRetryDelay()` only when relevant, see #3401
  950. if (err && err.retryable && retryCount < maxRetries) {
  951. var delay = util.calculateRetryDelay(retryCount, options.retryDelayOptions, err);
  952. if (delay >= 0) {
  953. retryCount++;
  954. setTimeout(sendRequest, delay + (err.retryAfter || 0));
  955. return;
  956. }
  957. }
  958. cb(err);
  959. };
  960. var sendRequest = function() {
  961. var data = '';
  962. http.handleRequest(httpRequest, httpOptions, function(httpResponse) {
  963. httpResponse.on('data', function(chunk) { data += chunk.toString(); });
  964. httpResponse.on('end', function() {
  965. var statusCode = httpResponse.statusCode;
  966. if (statusCode < 300) {
  967. cb(null, data);
  968. } else {
  969. var retryAfter = parseInt(httpResponse.headers['retry-after'], 10) * 1000 || 0;
  970. var err = util.error(new Error(),
  971. {
  972. statusCode: statusCode,
  973. retryable: statusCode >= 500 || statusCode === 429
  974. }
  975. );
  976. if (retryAfter && err.retryable) err.retryAfter = retryAfter;
  977. errCallback(err);
  978. }
  979. });
  980. }, errCallback);
  981. };
  982. AWS.util.defer(sendRequest);
  983. },
  984. /**
  985. * @api private
  986. */
  987. uuid: {
  988. v4: function uuidV4() {
  989. return __webpack_require__(8).v4();
  990. }
  991. },
  992. /**
  993. * @api private
  994. */
  995. convertPayloadToString: function convertPayloadToString(resp) {
  996. var req = resp.request;
  997. var operation = req.operation;
  998. var rules = req.service.api.operations[operation].output || {};
  999. if (rules.payload && resp.data[rules.payload]) {
  1000. resp.data[rules.payload] = resp.data[rules.payload].toString();
  1001. }
  1002. },
  1003. /**
  1004. * @api private
  1005. */
  1006. defer: function defer(callback) {
  1007. if (typeof process === 'object' && typeof process.nextTick === 'function') {
  1008. process.nextTick(callback);
  1009. } else if (typeof setImmediate === 'function') {
  1010. setImmediate(callback);
  1011. } else {
  1012. setTimeout(callback, 0);
  1013. }
  1014. },
  1015. /**
  1016. * @api private
  1017. */
  1018. getRequestPayloadShape: function getRequestPayloadShape(req) {
  1019. var operations = req.service.api.operations;
  1020. if (!operations) return undefined;
  1021. var operation = (operations || {})[req.operation];
  1022. if (!operation || !operation.input || !operation.input.payload) return undefined;
  1023. return operation.input.members[operation.input.payload];
  1024. },
  1025. getProfilesFromSharedConfig: function getProfilesFromSharedConfig(iniLoader, filename) {
  1026. var profiles = {};
  1027. var profilesFromConfig = {};
  1028. if (process.env[util.configOptInEnv]) {
  1029. var profilesFromConfig = iniLoader.loadFrom({
  1030. isConfig: true,
  1031. filename: process.env[util.sharedConfigFileEnv]
  1032. });
  1033. }
  1034. var profilesFromCreds= {};
  1035. try {
  1036. var profilesFromCreds = iniLoader.loadFrom({
  1037. filename: filename ||
  1038. (process.env[util.configOptInEnv] && process.env[util.sharedCredentialsFileEnv])
  1039. });
  1040. } catch (error) {
  1041. // if using config, assume it is fully descriptive without a credentials file:
  1042. if (!process.env[util.configOptInEnv]) throw error;
  1043. }
  1044. for (var i = 0, profileNames = Object.keys(profilesFromConfig); i < profileNames.length; i++) {
  1045. profiles[profileNames[i]] = objectAssign(profiles[profileNames[i]] || {}, profilesFromConfig[profileNames[i]]);
  1046. }
  1047. for (var i = 0, profileNames = Object.keys(profilesFromCreds); i < profileNames.length; i++) {
  1048. profiles[profileNames[i]] = objectAssign(profiles[profileNames[i]] || {}, profilesFromCreds[profileNames[i]]);
  1049. }
  1050. return profiles;
  1051. /**
  1052. * Roughly the semantics of `Object.assign(target, source)`
  1053. */
  1054. function objectAssign(target, source) {
  1055. for (var i = 0, keys = Object.keys(source); i < keys.length; i++) {
  1056. target[keys[i]] = source[keys[i]];
  1057. }
  1058. return target;
  1059. }
  1060. },
  1061. /**
  1062. * @api private
  1063. */
  1064. ARN: {
  1065. validate: function validateARN(str) {
  1066. return str && str.indexOf('arn:') === 0 && str.split(':').length >= 6;
  1067. },
  1068. parse: function parseARN(arn) {
  1069. var matched = arn.split(':');
  1070. return {
  1071. partition: matched[1],
  1072. service: matched[2],
  1073. region: matched[3],
  1074. accountId: matched[4],
  1075. resource: matched.slice(5).join(':')
  1076. };
  1077. },
  1078. build: function buildARN(arnObject) {
  1079. if (
  1080. arnObject.service === undefined ||
  1081. arnObject.region === undefined ||
  1082. arnObject.accountId === undefined ||
  1083. arnObject.resource === undefined
  1084. ) throw util.error(new Error('Input ARN object is invalid'));
  1085. return 'arn:'+ (arnObject.partition || 'aws') + ':' + arnObject.service +
  1086. ':' + arnObject.region + ':' + arnObject.accountId + ':' + arnObject.resource;
  1087. }
  1088. },
  1089. /**
  1090. * @api private
  1091. */
  1092. defaultProfile: 'default',
  1093. /**
  1094. * @api private
  1095. */
  1096. configOptInEnv: 'AWS_SDK_LOAD_CONFIG',
  1097. /**
  1098. * @api private
  1099. */
  1100. sharedCredentialsFileEnv: 'AWS_SHARED_CREDENTIALS_FILE',
  1101. /**
  1102. * @api private
  1103. */
  1104. sharedConfigFileEnv: 'AWS_CONFIG_FILE',
  1105. /**
  1106. * @api private
  1107. */
  1108. imdsDisabledEnv: 'AWS_EC2_METADATA_DISABLED'
  1109. };
  1110. /**
  1111. * @api private
  1112. */
  1113. module.exports = util;
  1114. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(4).setImmediate))
  1115. /***/ }),
  1116. /* 3 */
  1117. /***/ (function(module, exports) {
  1118. // shim for using process in browser
  1119. var process = module.exports = {};
  1120. // cached from whatever global is present so that test runners that stub it
  1121. // don't break things. But we need to wrap it in a try catch in case it is
  1122. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1123. // function because try/catches deoptimize in certain engines.
  1124. var cachedSetTimeout;
  1125. var cachedClearTimeout;
  1126. function defaultSetTimout() {
  1127. throw new Error('setTimeout has not been defined');
  1128. }
  1129. function defaultClearTimeout () {
  1130. throw new Error('clearTimeout has not been defined');
  1131. }
  1132. (function () {
  1133. try {
  1134. if (typeof setTimeout === 'function') {
  1135. cachedSetTimeout = setTimeout;
  1136. } else {
  1137. cachedSetTimeout = defaultSetTimout;
  1138. }
  1139. } catch (e) {
  1140. cachedSetTimeout = defaultSetTimout;
  1141. }
  1142. try {
  1143. if (typeof clearTimeout === 'function') {
  1144. cachedClearTimeout = clearTimeout;
  1145. } else {
  1146. cachedClearTimeout = defaultClearTimeout;
  1147. }
  1148. } catch (e) {
  1149. cachedClearTimeout = defaultClearTimeout;
  1150. }
  1151. } ())
  1152. function runTimeout(fun) {
  1153. if (cachedSetTimeout === setTimeout) {
  1154. //normal enviroments in sane situations
  1155. return setTimeout(fun, 0);
  1156. }
  1157. // if setTimeout wasn't available but was latter defined
  1158. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1159. cachedSetTimeout = setTimeout;
  1160. return setTimeout(fun, 0);
  1161. }
  1162. try {
  1163. // when when somebody has screwed with setTimeout but no I.E. maddness
  1164. return cachedSetTimeout(fun, 0);
  1165. } catch(e){
  1166. try {
  1167. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1168. return cachedSetTimeout.call(null, fun, 0);
  1169. } catch(e){
  1170. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  1171. return cachedSetTimeout.call(this, fun, 0);
  1172. }
  1173. }
  1174. }
  1175. function runClearTimeout(marker) {
  1176. if (cachedClearTimeout === clearTimeout) {
  1177. //normal enviroments in sane situations
  1178. return clearTimeout(marker);
  1179. }
  1180. // if clearTimeout wasn't available but was latter defined
  1181. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  1182. cachedClearTimeout = clearTimeout;
  1183. return clearTimeout(marker);
  1184. }
  1185. try {
  1186. // when when somebody has screwed with setTimeout but no I.E. maddness
  1187. return cachedClearTimeout(marker);
  1188. } catch (e){
  1189. try {
  1190. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1191. return cachedClearTimeout.call(null, marker);
  1192. } catch (e){
  1193. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  1194. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  1195. return cachedClearTimeout.call(this, marker);
  1196. }
  1197. }
  1198. }
  1199. var queue = [];
  1200. var draining = false;
  1201. var currentQueue;
  1202. var queueIndex = -1;
  1203. function cleanUpNextTick() {
  1204. if (!draining || !currentQueue) {
  1205. return;
  1206. }
  1207. draining = false;
  1208. if (currentQueue.length) {
  1209. queue = currentQueue.concat(queue);
  1210. } else {
  1211. queueIndex = -1;
  1212. }
  1213. if (queue.length) {
  1214. drainQueue();
  1215. }
  1216. }
  1217. function drainQueue() {
  1218. if (draining) {
  1219. return;
  1220. }
  1221. var timeout = runTimeout(cleanUpNextTick);
  1222. draining = true;
  1223. var len = queue.length;
  1224. while(len) {
  1225. currentQueue = queue;
  1226. queue = [];
  1227. while (++queueIndex < len) {
  1228. if (currentQueue) {
  1229. currentQueue[queueIndex].run();
  1230. }
  1231. }
  1232. queueIndex = -1;
  1233. len = queue.length;
  1234. }
  1235. currentQueue = null;
  1236. draining = false;
  1237. runClearTimeout(timeout);
  1238. }
  1239. process.nextTick = function (fun) {
  1240. var args = new Array(arguments.length - 1);
  1241. if (arguments.length > 1) {
  1242. for (var i = 1; i < arguments.length; i++) {
  1243. args[i - 1] = arguments[i];
  1244. }
  1245. }
  1246. queue.push(new Item(fun, args));
  1247. if (queue.length === 1 && !draining) {
  1248. runTimeout(drainQueue);
  1249. }
  1250. };
  1251. // v8 likes predictible objects
  1252. function Item(fun, array) {
  1253. this.fun = fun;
  1254. this.array = array;
  1255. }
  1256. Item.prototype.run = function () {
  1257. this.fun.apply(null, this.array);
  1258. };
  1259. process.title = 'browser';
  1260. process.browser = true;
  1261. process.env = {};
  1262. process.argv = [];
  1263. process.version = ''; // empty string to avoid regexp issues
  1264. process.versions = {};
  1265. function noop() {}
  1266. process.on = noop;
  1267. process.addListener = noop;
  1268. process.once = noop;
  1269. process.off = noop;
  1270. process.removeListener = noop;
  1271. process.removeAllListeners = noop;
  1272. process.emit = noop;
  1273. process.prependListener = noop;
  1274. process.prependOnceListener = noop;
  1275. process.listeners = function (name) { return [] }
  1276. process.binding = function (name) {
  1277. throw new Error('process.binding is not supported');
  1278. };
  1279. process.cwd = function () { return '/' };
  1280. process.chdir = function (dir) {
  1281. throw new Error('process.chdir is not supported');
  1282. };
  1283. process.umask = function() { return 0; };
  1284. /***/ }),
  1285. /* 4 */
  1286. /***/ (function(module, exports, __webpack_require__) {
  1287. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  1288. (typeof self !== "undefined" && self) ||
  1289. window;
  1290. var apply = Function.prototype.apply;
  1291. // DOM APIs, for completeness
  1292. exports.setTimeout = function() {
  1293. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  1294. };
  1295. exports.setInterval = function() {
  1296. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  1297. };
  1298. exports.clearTimeout =
  1299. exports.clearInterval = function(timeout) {
  1300. if (timeout) {
  1301. timeout.close();
  1302. }
  1303. };
  1304. function Timeout(id, clearFn) {
  1305. this._id = id;
  1306. this._clearFn = clearFn;
  1307. }
  1308. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  1309. Timeout.prototype.close = function() {
  1310. this._clearFn.call(scope, this._id);
  1311. };
  1312. // Does not start the time, just sets up the members needed.
  1313. exports.enroll = function(item, msecs) {
  1314. clearTimeout(item._idleTimeoutId);
  1315. item._idleTimeout = msecs;
  1316. };
  1317. exports.unenroll = function(item) {
  1318. clearTimeout(item._idleTimeoutId);
  1319. item._idleTimeout = -1;
  1320. };
  1321. exports._unrefActive = exports.active = function(item) {
  1322. clearTimeout(item._idleTimeoutId);
  1323. var msecs = item._idleTimeout;
  1324. if (msecs >= 0) {
  1325. item._idleTimeoutId = setTimeout(function onTimeout() {
  1326. if (item._onTimeout)
  1327. item._onTimeout();
  1328. }, msecs);
  1329. }
  1330. };
  1331. // setimmediate attaches itself to the global object
  1332. __webpack_require__(5);
  1333. // On some exotic environments, it's not clear which object `setimmediate` was
  1334. // able to install onto. Search each possibility in the same order as the
  1335. // `setimmediate` library.
  1336. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  1337. (typeof global !== "undefined" && global.setImmediate) ||
  1338. (this && this.setImmediate);
  1339. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  1340. (typeof global !== "undefined" && global.clearImmediate) ||
  1341. (this && this.clearImmediate);
  1342. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  1343. /***/ }),
  1344. /* 5 */
  1345. /***/ (function(module, exports, __webpack_require__) {
  1346. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  1347. "use strict";
  1348. if (global.setImmediate) {
  1349. return;
  1350. }
  1351. var nextHandle = 1; // Spec says greater than zero
  1352. var tasksByHandle = {};
  1353. var currentlyRunningATask = false;
  1354. var doc = global.document;
  1355. var registerImmediate;
  1356. function setImmediate(callback) {
  1357. // Callback can either be a function or a string
  1358. if (typeof callback !== "function") {
  1359. callback = new Function("" + callback);
  1360. }
  1361. // Copy function arguments
  1362. var args = new Array(arguments.length - 1);
  1363. for (var i = 0; i < args.length; i++) {
  1364. args[i] = arguments[i + 1];
  1365. }
  1366. // Store and register the task
  1367. var task = { callback: callback, args: args };
  1368. tasksByHandle[nextHandle] = task;
  1369. registerImmediate(nextHandle);
  1370. return nextHandle++;
  1371. }
  1372. function clearImmediate(handle) {
  1373. delete tasksByHandle[handle];
  1374. }
  1375. function run(task) {
  1376. var callback = task.callback;
  1377. var args = task.args;
  1378. switch (args.length) {
  1379. case 0:
  1380. callback();
  1381. break;
  1382. case 1:
  1383. callback(args[0]);
  1384. break;
  1385. case 2:
  1386. callback(args[0], args[1]);
  1387. break;
  1388. case 3:
  1389. callback(args[0], args[1], args[2]);
  1390. break;
  1391. default:
  1392. callback.apply(undefined, args);
  1393. break;
  1394. }
  1395. }
  1396. function runIfPresent(handle) {
  1397. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  1398. // So if we're currently running a task, we'll need to delay this invocation.
  1399. if (currentlyRunningATask) {
  1400. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  1401. // "too much recursion" error.
  1402. setTimeout(runIfPresent, 0, handle);
  1403. } else {
  1404. var task = tasksByHandle[handle];
  1405. if (task) {
  1406. currentlyRunningATask = true;
  1407. try {
  1408. run(task);
  1409. } finally {
  1410. clearImmediate(handle);
  1411. currentlyRunningATask = false;
  1412. }
  1413. }
  1414. }
  1415. }
  1416. function installNextTickImplementation() {
  1417. registerImmediate = function(handle) {
  1418. process.nextTick(function () { runIfPresent(handle); });
  1419. };
  1420. }
  1421. function canUsePostMessage() {
  1422. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  1423. // where `global.postMessage` means something completely different and can't be used for this purpose.
  1424. if (global.postMessage && !global.importScripts) {
  1425. var postMessageIsAsynchronous = true;
  1426. var oldOnMessage = global.onmessage;
  1427. global.onmessage = function() {
  1428. postMessageIsAsynchronous = false;
  1429. };
  1430. global.postMessage("", "*");
  1431. global.onmessage = oldOnMessage;
  1432. return postMessageIsAsynchronous;
  1433. }
  1434. }
  1435. function installPostMessageImplementation() {
  1436. // Installs an event handler on `global` for the `message` event: see
  1437. // * https://developer.mozilla.org/en/DOM/window.postMessage
  1438. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  1439. var messagePrefix = "setImmediate$" + Math.random() + "$";
  1440. var onGlobalMessage = function(event) {
  1441. if (event.source === global &&
  1442. typeof event.data === "string" &&
  1443. event.data.indexOf(messagePrefix) === 0) {
  1444. runIfPresent(+event.data.slice(messagePrefix.length));
  1445. }
  1446. };
  1447. if (global.addEventListener) {
  1448. global.addEventListener("message", onGlobalMessage, false);
  1449. } else {
  1450. global.attachEvent("onmessage", onGlobalMessage);
  1451. }
  1452. registerImmediate = function(handle) {
  1453. global.postMessage(messagePrefix + handle, "*");
  1454. };
  1455. }
  1456. function installMessageChannelImplementation() {
  1457. var channel = new MessageChannel();
  1458. channel.port1.onmessage = function(event) {
  1459. var handle = event.data;
  1460. runIfPresent(handle);
  1461. };
  1462. registerImmediate = function(handle) {
  1463. channel.port2.postMessage(handle);
  1464. };
  1465. }
  1466. function installReadyStateChangeImplementation() {
  1467. var html = doc.documentElement;
  1468. registerImmediate = function(handle) {
  1469. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  1470. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  1471. var script = doc.createElement("script");
  1472. script.onreadystatechange = function () {
  1473. runIfPresent(handle);
  1474. script.onreadystatechange = null;
  1475. html.removeChild(script);
  1476. script = null;
  1477. };
  1478. html.appendChild(script);
  1479. };
  1480. }
  1481. function installSetTimeoutImplementation() {
  1482. registerImmediate = function(handle) {
  1483. setTimeout(runIfPresent, 0, handle);
  1484. };
  1485. }
  1486. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  1487. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  1488. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  1489. // Don't get fooled by e.g. browserify environments.
  1490. if ({}.toString.call(global.process) === "[object process]") {
  1491. // For Node.js before 0.9
  1492. installNextTickImplementation();
  1493. } else if (canUsePostMessage()) {
  1494. // For non-IE10 modern browsers
  1495. installPostMessageImplementation();
  1496. } else if (global.MessageChannel) {
  1497. // For web workers, where supported
  1498. installMessageChannelImplementation();
  1499. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  1500. // For IE 6–8
  1501. installReadyStateChangeImplementation();
  1502. } else {
  1503. // For older browsers
  1504. installSetTimeoutImplementation();
  1505. }
  1506. attachTo.setImmediate = setImmediate;
  1507. attachTo.clearImmediate = clearImmediate;
  1508. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  1509. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(3)))
  1510. /***/ }),
  1511. /* 6 */
  1512. /***/ (function(module, exports) {
  1513. /* (ignored) */
  1514. /***/ }),
  1515. /* 7 */
  1516. /***/ (function(module, exports) {
  1517. module.exports = {"acm":{"name":"ACM","cors":true},"apigateway":{"name":"APIGateway","cors":true},"applicationautoscaling":{"prefix":"application-autoscaling","name":"ApplicationAutoScaling","cors":true},"appstream":{"name":"AppStream"},"autoscaling":{"name":"AutoScaling","cors":true},"batch":{"name":"Batch"},"budgets":{"name":"Budgets"},"clouddirectory":{"name":"CloudDirectory","versions":["2016-05-10*"]},"cloudformation":{"name":"CloudFormation","cors":true},"cloudfront":{"name":"CloudFront","versions":["2013-05-12*","2013-11-11*","2014-05-31*","2014-10-21*","2014-11-06*","2015-04-17*","2015-07-27*","2015-09-17*","2016-01-13*","2016-01-28*","2016-08-01*","2016-08-20*","2016-09-07*","2016-09-29*","2016-11-25*","2017-03-25*","2017-10-30*","2018-06-18*","2018-11-05*","2019-03-26*"],"cors":true},"cloudhsm":{"name":"CloudHSM","cors":true},"cloudsearch":{"name":"CloudSearch"},"cloudsearchdomain":{"name":"CloudSearchDomain"},"cloudtrail":{"name":"CloudTrail","cors":true},"cloudwatch":{"prefix":"monitoring","name":"CloudWatch","cors":true},"cloudwatchevents":{"prefix":"events","name":"CloudWatchEvents","versions":["2014-02-03*"],"cors":true},"cloudwatchlogs":{"prefix":"logs","name":"CloudWatchLogs","cors":true},"codebuild":{"name":"CodeBuild","cors":true},"codecommit":{"name":"CodeCommit","cors":true},"codedeploy":{"name":"CodeDeploy","cors":true},"codepipeline":{"name":"CodePipeline","cors":true},"cognitoidentity":{"prefix":"cognito-identity","name":"CognitoIdentity","cors":true},"cognitoidentityserviceprovider":{"prefix":"cognito-idp","name":"CognitoIdentityServiceProvider","cors":true},"cognitosync":{"prefix":"cognito-sync","name":"CognitoSync","cors":true},"configservice":{"prefix":"config","name":"ConfigService","cors":true},"cur":{"name":"CUR","cors":true},"datapipeline":{"name":"DataPipeline"},"devicefarm":{"name":"DeviceFarm","cors":true},"directconnect":{"name":"DirectConnect","cors":true},"directoryservice":{"prefix":"ds","name":"DirectoryService"},"discovery":{"name":"Discovery"},"dms":{"name":"DMS"},"dynamodb":{"name":"DynamoDB","cors":true},"dynamodbstreams":{"prefix":"streams.dynamodb","name":"DynamoDBStreams","cors":true},"ec2":{"name":"EC2","versions":["2013-06-15*","2013-10-15*","2014-02-01*","2014-05-01*","2014-06-15*","2014-09-01*","2014-10-01*","2015-03-01*","2015-04-15*","2015-10-01*","2016-04-01*","2016-09-15*"],"cors":true},"ecr":{"name":"ECR","cors":true},"ecs":{"name":"ECS","cors":true},"efs":{"prefix":"elasticfilesystem","name":"EFS","cors":true},"elasticache":{"name":"ElastiCache","versions":["2012-11-15*","2014-03-24*","2014-07-15*","2014-09-30*"],"cors":true},"elasticbeanstalk":{"name":"ElasticBeanstalk","cors":true},"elb":{"prefix":"elasticloadbalancing","name":"ELB","cors":true},"elbv2":{"prefix":"elasticloadbalancingv2","name":"ELBv2","cors":true},"emr":{"prefix":"elasticmapreduce","name":"EMR","cors":true},"es":{"name":"ES"},"elastictranscoder":{"name":"ElasticTranscoder","cors":true},"firehose":{"name":"Firehose","cors":true},"gamelift":{"name":"GameLift","cors":true},"glacier":{"name":"Glacier"},"health":{"name":"Health"},"iam":{"name":"IAM","cors":true},"importexport":{"name":"ImportExport"},"inspector":{"name":"Inspector","versions":["2015-08-18*"],"cors":true},"iot":{"name":"Iot","cors":true},"iotdata":{"prefix":"iot-data","name":"IotData","cors":true},"kinesis":{"name":"Kinesis","cors":true},"kinesisanalytics":{"name":"KinesisAnalytics"},"kms":{"name":"KMS","cors":true},"lambda":{"name":"Lambda","cors":true},"lexruntime":{"prefix":"runtime.lex","name":"LexRuntime","cors":true},"lightsail":{"name":"Lightsail"},"machinelearning":{"name":"MachineLearning","cors":true},"marketplacecommerceanalytics":{"name":"MarketplaceCommerceAnalytics","cors":true},"marketplacemetering":{"prefix":"meteringmarketplace","name":"MarketplaceMetering"},"mturk":{"prefix":"mturk-requester","name":"MTurk","cors":true},"mobileanalytics":{"name":"MobileAnalytics","cors":true},"opsworks":{"name":"OpsWorks","cors":true},"opsworkscm":{"name":"OpsWorksCM"},"organizations":{"name":"Organizations"},"pinpoint":{"name":"Pinpoint"},"polly":{"name":"Polly","cors":true},"rds":{"name":"RDS","versions":["2014-09-01*"],"cors":true},"redshift":{"name":"Redshift","cors":true},"rekognition":{"name":"Rekognition","cors":true},"resourcegroupstaggingapi":{"name":"ResourceGroupsTaggingAPI"},"route53":{"name":"Route53","cors":true},"route53domains":{"name":"Route53Domains","cors":true},"s3":{"name":"S3","dualstackAvailable":true,"cors":true},"s3control":{"name":"S3Control","dualstackAvailable":true,"xmlNoDefaultLists":true},"servicecatalog":{"name":"ServiceCatalog","cors":true},"ses":{"prefix":"email","name":"SES","cors":true},"shield":{"name":"Shield"},"simpledb":{"prefix":"sdb","name":"SimpleDB"},"sms":{"name":"SMS"},"snowball":{"name":"Snowball"},"sns":{"name":"SNS","cors":true},"sqs":{"name":"SQS","cors":true},"ssm":{"name":"SSM","cors":true},"storagegateway":{"name":"StorageGateway","cors":true},"stepfunctions":{"prefix":"states","name":"StepFunctions"},"sts":{"name":"STS","cors":true},"support":{"name":"Support"},"swf":{"name":"SWF"},"xray":{"name":"XRay","cors":true},"waf":{"name":"WAF","cors":true},"wafregional":{"prefix":"waf-regional","name":"WAFRegional"},"workdocs":{"name":"WorkDocs","cors":true},"workspaces":{"name":"WorkSpaces"},"codestar":{"name":"CodeStar"},"lexmodelbuildingservice":{"prefix":"lex-models","name":"LexModelBuildingService","cors":true},"marketplaceentitlementservice":{"prefix":"entitlement.marketplace","name":"MarketplaceEntitlementService"},"athena":{"name":"Athena","cors":true},"greengrass":{"name":"Greengrass"},"dax":{"name":"DAX"},"migrationhub":{"prefix":"AWSMigrationHub","name":"MigrationHub"},"cloudhsmv2":{"name":"CloudHSMV2","cors":true},"glue":{"name":"Glue"},"mobile":{"name":"Mobile"},"pricing":{"name":"Pricing","cors":true},"costexplorer":{"prefix":"ce","name":"CostExplorer","cors":true},"mediaconvert":{"name":"MediaConvert"},"medialive":{"name":"MediaLive"},"mediapackage":{"name":"MediaPackage"},"mediastore":{"name":"MediaStore"},"mediastoredata":{"prefix":"mediastore-data","name":"MediaStoreData","cors":true},"appsync":{"name":"AppSync"},"guardduty":{"name":"GuardDuty"},"mq":{"name":"MQ"},"comprehend":{"name":"Comprehend","cors":true},"iotjobsdataplane":{"prefix":"iot-jobs-data","name":"IoTJobsDataPlane"},"kinesisvideoarchivedmedia":{"prefix":"kinesis-video-archived-media","name":"KinesisVideoArchivedMedia","cors":true},"kinesisvideomedia":{"prefix":"kinesis-video-media","name":"KinesisVideoMedia","cors":true},"kinesisvideo":{"name":"KinesisVideo","cors":true},"sagemakerruntime":{"prefix":"runtime.sagemaker","name":"SageMakerRuntime"},"sagemaker":{"name":"SageMaker"},"translate":{"name":"Translate","cors":true},"resourcegroups":{"prefix":"resource-groups","name":"ResourceGroups","cors":true},"cloud9":{"name":"Cloud9"},"serverlessapplicationrepository":{"prefix":"serverlessrepo","name":"ServerlessApplicationRepository"},"servicediscovery":{"name":"ServiceDiscovery"},"workmail":{"name":"WorkMail"},"autoscalingplans":{"prefix":"autoscaling-plans","name":"AutoScalingPlans"},"transcribeservice":{"prefix":"transcribe","name":"TranscribeService"},"connect":{"name":"Connect","cors":true},"acmpca":{"prefix":"acm-pca","name":"ACMPCA"},"fms":{"name":"FMS"},"secretsmanager":{"name":"SecretsManager","cors":true},"iotanalytics":{"name":"IoTAnalytics","cors":true},"iot1clickdevicesservice":{"prefix":"iot1click-devices","name":"IoT1ClickDevicesService"},"iot1clickprojects":{"prefix":"iot1click-projects","name":"IoT1ClickProjects"},"pi":{"name":"PI"},"neptune":{"name":"Neptune"},"mediatailor":{"name":"MediaTailor"},"eks":{"name":"EKS"},"dlm":{"name":"DLM"},"signer":{"name":"Signer"},"chime":{"name":"Chime"},"pinpointemail":{"prefix":"pinpoint-email","name":"PinpointEmail"},"ram":{"name":"RAM"},"route53resolver":{"name":"Route53Resolver"},"pinpointsmsvoice":{"prefix":"sms-voice","name":"PinpointSMSVoice"},"quicksight":{"name":"QuickSight"},"rdsdataservice":{"prefix":"rds-data","name":"RDSDataService"},"amplify":{"name":"Amplify"},"datasync":{"name":"DataSync"},"robomaker":{"name":"RoboMaker"},"transfer":{"name":"Transfer"},"globalaccelerator":{"name":"GlobalAccelerator"},"comprehendmedical":{"name":"ComprehendMedical","cors":true},"kinesisanalyticsv2":{"name":"KinesisAnalyticsV2"},"mediaconnect":{"name":"MediaConnect"},"fsx":{"name":"FSx"},"securityhub":{"name":"SecurityHub"},"appmesh":{"name":"AppMesh","versions":["2018-10-01*"]},"licensemanager":{"prefix":"license-manager","name":"LicenseManager"},"kafka":{"name":"Kafka"},"apigatewaymanagementapi":{"name":"ApiGatewayManagementApi"},"apigatewayv2":{"name":"ApiGatewayV2"},"docdb":{"name":"DocDB"},"backup":{"name":"Backup"},"worklink":{"name":"WorkLink"},"textract":{"name":"Textract"},"managedblockchain":{"name":"ManagedBlockchain"},"mediapackagevod":{"prefix":"mediapackage-vod","name":"MediaPackageVod"},"groundstation":{"name":"GroundStation"},"iotthingsgraph":{"name":"IoTThingsGraph"},"iotevents":{"name":"IoTEvents"},"ioteventsdata":{"prefix":"iotevents-data","name":"IoTEventsData"},"personalize":{"name":"Personalize","cors":true},"personalizeevents":{"prefix":"personalize-events","name":"PersonalizeEvents","cors":true},"personalizeruntime":{"prefix":"personalize-runtime","name":"PersonalizeRuntime","cors":true},"applicationinsights":{"prefix":"application-insights","name":"ApplicationInsights"},"servicequotas":{"prefix":"service-quotas","name":"ServiceQuotas"},"ec2instanceconnect":{"prefix":"ec2-instance-connect","name":"EC2InstanceConnect"},"eventbridge":{"name":"EventBridge"},"lakeformation":{"name":"LakeFormation"},"forecastservice":{"prefix":"forecast","name":"ForecastService","cors":true},"forecastqueryservice":{"prefix":"forecastquery","name":"ForecastQueryService","cors":true},"qldb":{"name":"QLDB"},"qldbsession":{"prefix":"qldb-session","name":"QLDBSession"},"workmailmessageflow":{"name":"WorkMailMessageFlow"},"codestarnotifications":{"prefix":"codestar-notifications","name":"CodeStarNotifications"},"savingsplans":{"name":"SavingsPlans"},"sso":{"name":"SSO"},"ssooidc":{"prefix":"sso-oidc","name":"SSOOIDC"},"marketplacecatalog":{"prefix":"marketplace-catalog","name":"MarketplaceCatalog","cors":true},"dataexchange":{"name":"DataExchange"},"sesv2":{"name":"SESV2"},"migrationhubconfig":{"prefix":"migrationhub-config","name":"MigrationHubConfig"},"connectparticipant":{"name":"ConnectParticipant"},"appconfig":{"name":"AppConfig"},"iotsecuretunneling":{"name":"IoTSecureTunneling"},"wafv2":{"name":"WAFV2"},"elasticinference":{"prefix":"elastic-inference","name":"ElasticInference"},"imagebuilder":{"name":"Imagebuilder"},"schemas":{"name":"Schemas"},"accessanalyzer":{"name":"AccessAnalyzer"},"codegurureviewer":{"prefix":"codeguru-reviewer","name":"CodeGuruReviewer"},"codeguruprofiler":{"name":"CodeGuruProfiler"},"computeoptimizer":{"prefix":"compute-optimizer","name":"ComputeOptimizer"},"frauddetector":{"name":"FraudDetector"},"kendra":{"name":"Kendra"},"networkmanager":{"name":"NetworkManager"},"outposts":{"name":"Outposts"},"augmentedairuntime":{"prefix":"sagemaker-a2i-runtime","name":"AugmentedAIRuntime"},"ebs":{"name":"EBS"},"kinesisvideosignalingchannels":{"prefix":"kinesis-video-signaling","name":"KinesisVideoSignalingChannels","cors":true},"detective":{"name":"Detective"},"codestarconnections":{"prefix":"codestar-connections","name":"CodeStarconnections"},"synthetics":{"name":"Synthetics"},"iotsitewise":{"name":"IoTSiteWise"},"macie2":{"name":"Macie2"},"codeartifact":{"name":"CodeArtifact"},"ivs":{"name":"IVS"},"braket":{"name":"Braket"},"identitystore":{"name":"IdentityStore"},"appflow":{"name":"Appflow"},"redshiftdata":{"prefix":"redshift-data","name":"RedshiftData"},"ssoadmin":{"prefix":"sso-admin","name":"SSOAdmin"},"timestreamquery":{"prefix":"timestream-query","name":"TimestreamQuery"},"timestreamwrite":{"prefix":"timestream-write","name":"TimestreamWrite"},"s3outposts":{"name":"S3Outposts"},"databrew":{"name":"DataBrew"},"servicecatalogappregistry":{"prefix":"servicecatalog-appregistry","name":"ServiceCatalogAppRegistry"},"networkfirewall":{"prefix":"network-firewall","name":"NetworkFirewall"},"mwaa":{"name":"MWAA"},"amplifybackend":{"name":"AmplifyBackend"},"appintegrations":{"name":"AppIntegrations"},"connectcontactlens":{"prefix":"connect-contact-lens","name":"ConnectContactLens"},"devopsguru":{"prefix":"devops-guru","name":"DevOpsGuru"},"ecrpublic":{"prefix":"ecr-public","name":"ECRPUBLIC"},"lookoutvision":{"name":"LookoutVision"},"sagemakerfeaturestoreruntime":{"prefix":"sagemaker-featurestore-runtime","name":"SageMakerFeatureStoreRuntime"},"customerprofiles":{"prefix":"customer-profiles","name":"CustomerProfiles"},"auditmanager":{"name":"AuditManager"},"emrcontainers":{"prefix":"emr-containers","name":"EMRcontainers"},"healthlake":{"name":"HealthLake"},"sagemakeredge":{"prefix":"sagemaker-edge","name":"SagemakerEdge"},"amp":{"name":"Amp","cors":true},"greengrassv2":{"name":"GreengrassV2"},"iotdeviceadvisor":{"name":"IotDeviceAdvisor"},"iotfleethub":{"name":"IoTFleetHub"},"iotwireless":{"name":"IoTWireless"},"location":{"name":"Location","cors":true},"wellarchitected":{"name":"WellArchitected"},"lexmodelsv2":{"prefix":"models.lex.v2","name":"LexModelsV2"},"lexruntimev2":{"prefix":"runtime.lex.v2","name":"LexRuntimeV2","cors":true},"fis":{"name":"Fis"},"lookoutmetrics":{"name":"LookoutMetrics"},"mgn":{"name":"Mgn"},"lookoutequipment":{"name":"LookoutEquipment"},"nimble":{"name":"Nimble"},"finspace":{"name":"Finspace"},"finspacedata":{"prefix":"finspace-data","name":"Finspacedata"},"ssmcontacts":{"prefix":"ssm-contacts","name":"SSMContacts"},"ssmincidents":{"prefix":"ssm-incidents","name":"SSMIncidents"},"applicationcostprofiler":{"name":"ApplicationCostProfiler"},"apprunner":{"name":"AppRunner"},"proton":{"name":"Proton"},"route53recoverycluster":{"prefix":"route53-recovery-cluster","name":"Route53RecoveryCluster"},"route53recoverycontrolconfig":{"prefix":"route53-recovery-control-config","name":"Route53RecoveryControlConfig"},"route53recoveryreadiness":{"prefix":"route53-recovery-readiness","name":"Route53RecoveryReadiness"},"chimesdkidentity":{"prefix":"chime-sdk-identity","name":"ChimeSDKIdentity"},"chimesdkmessaging":{"prefix":"chime-sdk-messaging","name":"ChimeSDKMessaging"},"snowdevicemanagement":{"prefix":"snow-device-management","name":"SnowDeviceManagement"},"memorydb":{"name":"MemoryDB"},"opensearch":{"name":"OpenSearch"},"kafkaconnect":{"name":"KafkaConnect"},"voiceid":{"prefix":"voice-id","name":"VoiceID"},"wisdom":{"name":"Wisdom"},"account":{"name":"Account"},"cloudcontrol":{"name":"CloudControl"},"grafana":{"name":"Grafana"},"panorama":{"name":"Panorama"},"chimesdkmeetings":{"prefix":"chime-sdk-meetings","name":"ChimeSDKMeetings"},"resiliencehub":{"name":"Resiliencehub"},"migrationhubstrategy":{"name":"MigrationHubStrategy"},"appconfigdata":{"name":"AppConfigData"},"drs":{"name":"Drs"},"migrationhubrefactorspaces":{"prefix":"migration-hub-refactor-spaces","name":"MigrationHubRefactorSpaces"},"evidently":{"name":"Evidently"},"inspector2":{"name":"Inspector2"},"rbin":{"name":"Rbin"},"rum":{"name":"RUM"},"backupgateway":{"prefix":"backup-gateway","name":"BackupGateway"},"iottwinmaker":{"name":"IoTTwinMaker"},"workspacesweb":{"prefix":"workspaces-web","name":"WorkSpacesWeb"},"amplifyuibuilder":{"name":"AmplifyUIBuilder"},"keyspaces":{"name":"Keyspaces"},"billingconductor":{"name":"Billingconductor"},"pinpointsmsvoicev2":{"prefix":"pinpoint-sms-voice-v2","name":"PinpointSMSVoiceV2"},"ivschat":{"name":"Ivschat"},"chimesdkmediapipelines":{"prefix":"chime-sdk-media-pipelines","name":"ChimeSDKMediaPipelines"},"emrserverless":{"prefix":"emr-serverless","name":"EMRServerless"},"m2":{"name":"M2"},"connectcampaigns":{"name":"ConnectCampaigns"},"redshiftserverless":{"prefix":"redshift-serverless","name":"RedshiftServerless"},"rolesanywhere":{"name":"RolesAnywhere"},"licensemanagerusersubscriptions":{"prefix":"license-manager-user-subscriptions","name":"LicenseManagerUserSubscriptions"},"backupstorage":{"name":"BackupStorage"},"privatenetworks":{"name":"PrivateNetworks"},"supportapp":{"prefix":"support-app","name":"SupportApp"},"controltower":{"name":"ControlTower"},"iotfleetwise":{"name":"IoTFleetWise"},"migrationhuborchestrator":{"name":"MigrationHubOrchestrator"},"connectcases":{"name":"ConnectCases"},"resourceexplorer2":{"prefix":"resource-explorer-2","name":"ResourceExplorer2"},"scheduler":{"name":"Scheduler"},"chimesdkvoice":{"prefix":"chime-sdk-voice","name":"ChimeSDKVoice"},"ssmsap":{"prefix":"ssm-sap","name":"SsmSap"},"oam":{"name":"OAM"},"arczonalshift":{"prefix":"arc-zonal-shift","name":"ARCZonalShift"},"omics":{"name":"Omics"},"opensearchserverless":{"name":"OpenSearchServerless"},"securitylake":{"name":"SecurityLake"},"simspaceweaver":{"name":"SimSpaceWeaver"},"docdbelastic":{"prefix":"docdb-elastic","name":"DocDBElastic"},"sagemakergeospatial":{"prefix":"sagemaker-geospatial","name":"SageMakerGeospatial"},"codecatalyst":{"name":"CodeCatalyst"},"pipes":{"name":"Pipes"},"sagemakermetrics":{"prefix":"sagemaker-metrics","name":"SageMakerMetrics"},"kinesisvideowebrtcstorage":{"prefix":"kinesis-video-webrtc-storage","name":"KinesisVideoWebRTCStorage"},"licensemanagerlinuxsubscriptions":{"prefix":"license-manager-linux-subscriptions","name":"LicenseManagerLinuxSubscriptions"},"kendraranking":{"prefix":"kendra-ranking","name":"KendraRanking"},"cleanrooms":{"name":"CleanRooms"},"cloudtraildata":{"prefix":"cloudtrail-data","name":"CloudTrailData"},"tnb":{"name":"Tnb"},"internetmonitor":{"name":"InternetMonitor"},"ivsrealtime":{"prefix":"ivs-realtime","name":"IVSRealTime"},"vpclattice":{"prefix":"vpc-lattice","name":"VPCLattice"},"osis":{"name":"OSIS"},"mediapackagev2":{"name":"MediaPackageV2"},"paymentcryptography":{"prefix":"payment-cryptography","name":"PaymentCryptography"},"paymentcryptographydata":{"prefix":"payment-cryptography-data","name":"PaymentCryptographyData"},"codegurusecurity":{"prefix":"codeguru-security","name":"CodeGuruSecurity"},"verifiedpermissions":{"name":"VerifiedPermissions"},"appfabric":{"name":"AppFabric"},"medicalimaging":{"prefix":"medical-imaging","name":"MedicalImaging"},"entityresolution":{"name":"EntityResolution"},"managedblockchainquery":{"prefix":"managedblockchain-query","name":"ManagedBlockchainQuery"},"neptunedata":{"name":"Neptunedata"},"pcaconnectorad":{"prefix":"pca-connector-ad","name":"PcaConnectorAd"},"bedrock":{"name":"Bedrock"},"bedrockruntime":{"prefix":"bedrock-runtime","name":"BedrockRuntime"},"datazone":{"name":"DataZone"},"launchwizard":{"prefix":"launch-wizard","name":"LaunchWizard"},"trustedadvisor":{"name":"TrustedAdvisor"},"inspectorscan":{"prefix":"inspector-scan","name":"InspectorScan"},"bcmdataexports":{"prefix":"bcm-data-exports","name":"BCMDataExports"},"costoptimizationhub":{"prefix":"cost-optimization-hub","name":"CostOptimizationHub"},"eksauth":{"prefix":"eks-auth","name":"EKSAuth"},"freetier":{"name":"FreeTier"},"repostspace":{"name":"Repostspace"},"workspacesthinclient":{"prefix":"workspaces-thin-client","name":"WorkSpacesThinClient"},"b2bi":{"name":"B2bi"},"bedrockagent":{"prefix":"bedrock-agent","name":"BedrockAgent"},"bedrockagentruntime":{"prefix":"bedrock-agent-runtime","name":"BedrockAgentRuntime"},"qbusiness":{"name":"QBusiness"},"qconnect":{"name":"QConnect"},"cleanroomsml":{"name":"CleanRoomsML"},"marketplaceagreement":{"prefix":"marketplace-agreement","name":"MarketplaceAgreement"},"marketplacedeployment":{"prefix":"marketplace-deployment","name":"MarketplaceDeployment"},"networkmonitor":{"name":"NetworkMonitor"},"supplychain":{"name":"SupplyChain"},"artifact":{"name":"Artifact"},"chatbot":{"name":"Chatbot"},"timestreaminfluxdb":{"prefix":"timestream-influxdb","name":"TimestreamInfluxDB"},"codeconnections":{"name":"CodeConnections"},"deadline":{"name":"Deadline"},"controlcatalog":{"name":"ControlCatalog"},"route53profiles":{"name":"Route53Profiles"}}
  1518. /***/ }),
  1519. /* 8 */
  1520. /***/ (function(module, exports, __webpack_require__) {
  1521. "use strict";
  1522. Object.defineProperty(exports, "__esModule", {
  1523. value: true
  1524. });
  1525. Object.defineProperty(exports, "v1", {
  1526. enumerable: true,
  1527. get: function () {
  1528. return _v.default;
  1529. }
  1530. });
  1531. Object.defineProperty(exports, "v3", {
  1532. enumerable: true,
  1533. get: function () {
  1534. return _v2.default;
  1535. }
  1536. });
  1537. Object.defineProperty(exports, "v4", {
  1538. enumerable: true,
  1539. get: function () {
  1540. return _v3.default;
  1541. }
  1542. });
  1543. Object.defineProperty(exports, "v5", {
  1544. enumerable: true,
  1545. get: function () {
  1546. return _v4.default;
  1547. }
  1548. });
  1549. var _v = _interopRequireDefault(__webpack_require__(9));
  1550. var _v2 = _interopRequireDefault(__webpack_require__(12));
  1551. var _v3 = _interopRequireDefault(__webpack_require__(15));
  1552. var _v4 = _interopRequireDefault(__webpack_require__(16));
  1553. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1554. /***/ }),
  1555. /* 9 */
  1556. /***/ (function(module, exports, __webpack_require__) {
  1557. "use strict";
  1558. Object.defineProperty(exports, "__esModule", {
  1559. value: true
  1560. });
  1561. exports.default = void 0;
  1562. var _rng = _interopRequireDefault(__webpack_require__(10));
  1563. var _bytesToUuid = _interopRequireDefault(__webpack_require__(11));
  1564. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1565. // **`v1()` - Generate time-based UUID**
  1566. //
  1567. // Inspired by https://github.com/LiosK/UUID.js
  1568. // and http://docs.python.org/library/uuid.html
  1569. var _nodeId;
  1570. var _clockseq; // Previous uuid creation time
  1571. var _lastMSecs = 0;
  1572. var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
  1573. function v1(options, buf, offset) {
  1574. var i = buf && offset || 0;
  1575. var b = buf || [];
  1576. options = options || {};
  1577. var node = options.node || _nodeId;
  1578. var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
  1579. // specified. We do this lazily to minimize issues related to insufficient
  1580. // system entropy. See #189
  1581. if (node == null || clockseq == null) {
  1582. var seedBytes = options.random || (options.rng || _rng.default)();
  1583. if (node == null) {
  1584. // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
  1585. node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
  1586. }
  1587. if (clockseq == null) {
  1588. // Per 4.2.2, randomize (14 bit) clockseq
  1589. clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
  1590. }
  1591. } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
  1592. // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
  1593. // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
  1594. // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
  1595. var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
  1596. // cycle to simulate higher resolution clock
  1597. var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
  1598. var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
  1599. if (dt < 0 && options.clockseq === undefined) {
  1600. clockseq = clockseq + 1 & 0x3fff;
  1601. } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
  1602. // time interval
  1603. if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
  1604. nsecs = 0;
  1605. } // Per 4.2.1.2 Throw error if too many uuids are requested
  1606. if (nsecs >= 10000) {
  1607. throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
  1608. }
  1609. _lastMSecs = msecs;
  1610. _lastNSecs = nsecs;
  1611. _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
  1612. msecs += 12219292800000; // `time_low`
  1613. var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
  1614. b[i++] = tl >>> 24 & 0xff;
  1615. b[i++] = tl >>> 16 & 0xff;
  1616. b[i++] = tl >>> 8 & 0xff;
  1617. b[i++] = tl & 0xff; // `time_mid`
  1618. var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
  1619. b[i++] = tmh >>> 8 & 0xff;
  1620. b[i++] = tmh & 0xff; // `time_high_and_version`
  1621. b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
  1622. b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
  1623. b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
  1624. b[i++] = clockseq & 0xff; // `node`
  1625. for (var n = 0; n < 6; ++n) {
  1626. b[i + n] = node[n];
  1627. }
  1628. return buf ? buf : (0, _bytesToUuid.default)(b);
  1629. }
  1630. var _default = v1;
  1631. exports.default = _default;
  1632. /***/ }),
  1633. /* 10 */
  1634. /***/ (function(module, exports) {
  1635. "use strict";
  1636. Object.defineProperty(exports, "__esModule", {
  1637. value: true
  1638. });
  1639. exports.default = rng;
  1640. // Unique ID creation requires a high quality random # generator. In the browser we therefore
  1641. // require the crypto API and do not support built-in fallback to lower quality random number
  1642. // generators (like Math.random()).
  1643. // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
  1644. // find the complete implementation of crypto (msCrypto) on IE11.
  1645. var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
  1646. var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
  1647. function rng() {
  1648. if (!getRandomValues) {
  1649. throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
  1650. }
  1651. return getRandomValues(rnds8);
  1652. }
  1653. /***/ }),
  1654. /* 11 */
  1655. /***/ (function(module, exports) {
  1656. "use strict";
  1657. Object.defineProperty(exports, "__esModule", {
  1658. value: true
  1659. });
  1660. exports.default = void 0;
  1661. /**
  1662. * Convert array of 16 byte values to UUID string format of the form:
  1663. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  1664. */
  1665. var byteToHex = [];
  1666. for (var i = 0; i < 256; ++i) {
  1667. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  1668. }
  1669. function bytesToUuid(buf, offset) {
  1670. var i = offset || 0;
  1671. var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  1672. return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
  1673. }
  1674. var _default = bytesToUuid;
  1675. exports.default = _default;
  1676. /***/ }),
  1677. /* 12 */
  1678. /***/ (function(module, exports, __webpack_require__) {
  1679. "use strict";
  1680. Object.defineProperty(exports, "__esModule", {
  1681. value: true
  1682. });
  1683. exports.default = void 0;
  1684. var _v = _interopRequireDefault(__webpack_require__(13));
  1685. var _md = _interopRequireDefault(__webpack_require__(14));
  1686. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1687. const v3 = (0, _v.default)('v3', 0x30, _md.default);
  1688. var _default = v3;
  1689. exports.default = _default;
  1690. /***/ }),
  1691. /* 13 */
  1692. /***/ (function(module, exports, __webpack_require__) {
  1693. "use strict";
  1694. Object.defineProperty(exports, "__esModule", {
  1695. value: true
  1696. });
  1697. exports.default = _default;
  1698. exports.URL = exports.DNS = void 0;
  1699. var _bytesToUuid = _interopRequireDefault(__webpack_require__(11));
  1700. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1701. function uuidToBytes(uuid) {
  1702. // Note: We assume we're being passed a valid uuid string
  1703. var bytes = [];
  1704. uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
  1705. bytes.push(parseInt(hex, 16));
  1706. });
  1707. return bytes;
  1708. }
  1709. function stringToBytes(str) {
  1710. str = unescape(encodeURIComponent(str)); // UTF8 escape
  1711. var bytes = new Array(str.length);
  1712. for (var i = 0; i < str.length; i++) {
  1713. bytes[i] = str.charCodeAt(i);
  1714. }
  1715. return bytes;
  1716. }
  1717. const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
  1718. exports.DNS = DNS;
  1719. const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
  1720. exports.URL = URL;
  1721. function _default(name, version, hashfunc) {
  1722. var generateUUID = function (value, namespace, buf, offset) {
  1723. var off = buf && offset || 0;
  1724. if (typeof value == 'string') value = stringToBytes(value);
  1725. if (typeof namespace == 'string') namespace = uuidToBytes(namespace);
  1726. if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');
  1727. if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3
  1728. var bytes = hashfunc(namespace.concat(value));
  1729. bytes[6] = bytes[6] & 0x0f | version;
  1730. bytes[8] = bytes[8] & 0x3f | 0x80;
  1731. if (buf) {
  1732. for (var idx = 0; idx < 16; ++idx) {
  1733. buf[off + idx] = bytes[idx];
  1734. }
  1735. }
  1736. return buf || (0, _bytesToUuid.default)(bytes);
  1737. }; // Function#name is not settable on some platforms (#270)
  1738. try {
  1739. generateUUID.name = name;
  1740. } catch (err) {} // For CommonJS default export support
  1741. generateUUID.DNS = DNS;
  1742. generateUUID.URL = URL;
  1743. return generateUUID;
  1744. }
  1745. /***/ }),
  1746. /* 14 */
  1747. /***/ (function(module, exports) {
  1748. "use strict";
  1749. Object.defineProperty(exports, "__esModule", {
  1750. value: true
  1751. });
  1752. exports.default = void 0;
  1753. /*
  1754. * Browser-compatible JavaScript MD5
  1755. *
  1756. * Modification of JavaScript MD5
  1757. * https://github.com/blueimp/JavaScript-MD5
  1758. *
  1759. * Copyright 2011, Sebastian Tschan
  1760. * https://blueimp.net
  1761. *
  1762. * Licensed under the MIT license:
  1763. * https://opensource.org/licenses/MIT
  1764. *
  1765. * Based on
  1766. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  1767. * Digest Algorithm, as defined in RFC 1321.
  1768. * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
  1769. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  1770. * Distributed under the BSD License
  1771. * See http://pajhome.org.uk/crypt/md5 for more info.
  1772. */
  1773. function md5(bytes) {
  1774. if (typeof bytes == 'string') {
  1775. var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
  1776. bytes = new Array(msg.length);
  1777. for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
  1778. }
  1779. return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
  1780. }
  1781. /*
  1782. * Convert an array of little-endian words to an array of bytes
  1783. */
  1784. function md5ToHexEncodedArray(input) {
  1785. var i;
  1786. var x;
  1787. var output = [];
  1788. var length32 = input.length * 32;
  1789. var hexTab = '0123456789abcdef';
  1790. var hex;
  1791. for (i = 0; i < length32; i += 8) {
  1792. x = input[i >> 5] >>> i % 32 & 0xff;
  1793. hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
  1794. output.push(hex);
  1795. }
  1796. return output;
  1797. }
  1798. /*
  1799. * Calculate the MD5 of an array of little-endian words, and a bit length.
  1800. */
  1801. function wordsToMd5(x, len) {
  1802. /* append padding */
  1803. x[len >> 5] |= 0x80 << len % 32;
  1804. x[(len + 64 >>> 9 << 4) + 14] = len;
  1805. var i;
  1806. var olda;
  1807. var oldb;
  1808. var oldc;
  1809. var oldd;
  1810. var a = 1732584193;
  1811. var b = -271733879;
  1812. var c = -1732584194;
  1813. var d = 271733878;
  1814. for (i = 0; i < x.length; i += 16) {
  1815. olda = a;
  1816. oldb = b;
  1817. oldc = c;
  1818. oldd = d;
  1819. a = md5ff(a, b, c, d, x[i], 7, -680876936);
  1820. d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
  1821. c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
  1822. b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
  1823. a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
  1824. d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
  1825. c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
  1826. b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
  1827. a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
  1828. d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
  1829. c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
  1830. b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
  1831. a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
  1832. d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
  1833. c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
  1834. b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
  1835. a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
  1836. d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
  1837. c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
  1838. b = md5gg(b, c, d, a, x[i], 20, -373897302);
  1839. a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
  1840. d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
  1841. c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
  1842. b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
  1843. a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
  1844. d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
  1845. c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
  1846. b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
  1847. a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
  1848. d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
  1849. c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
  1850. b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
  1851. a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
  1852. d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
  1853. c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
  1854. b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
  1855. a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
  1856. d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
  1857. c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
  1858. b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
  1859. a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
  1860. d = md5hh(d, a, b, c, x[i], 11, -358537222);
  1861. c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
  1862. b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
  1863. a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
  1864. d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
  1865. c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
  1866. b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
  1867. a = md5ii(a, b, c, d, x[i], 6, -198630844);
  1868. d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
  1869. c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
  1870. b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
  1871. a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
  1872. d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
  1873. c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
  1874. b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
  1875. a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
  1876. d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
  1877. c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
  1878. b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
  1879. a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
  1880. d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
  1881. c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
  1882. b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
  1883. a = safeAdd(a, olda);
  1884. b = safeAdd(b, oldb);
  1885. c = safeAdd(c, oldc);
  1886. d = safeAdd(d, oldd);
  1887. }
  1888. return [a, b, c, d];
  1889. }
  1890. /*
  1891. * Convert an array bytes to an array of little-endian words
  1892. * Characters >255 have their high-byte silently ignored.
  1893. */
  1894. function bytesToWords(input) {
  1895. var i;
  1896. var output = [];
  1897. output[(input.length >> 2) - 1] = undefined;
  1898. for (i = 0; i < output.length; i += 1) {
  1899. output[i] = 0;
  1900. }
  1901. var length8 = input.length * 8;
  1902. for (i = 0; i < length8; i += 8) {
  1903. output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
  1904. }
  1905. return output;
  1906. }
  1907. /*
  1908. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  1909. * to work around bugs in some JS interpreters.
  1910. */
  1911. function safeAdd(x, y) {
  1912. var lsw = (x & 0xffff) + (y & 0xffff);
  1913. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  1914. return msw << 16 | lsw & 0xffff;
  1915. }
  1916. /*
  1917. * Bitwise rotate a 32-bit number to the left.
  1918. */
  1919. function bitRotateLeft(num, cnt) {
  1920. return num << cnt | num >>> 32 - cnt;
  1921. }
  1922. /*
  1923. * These functions implement the four basic operations the algorithm uses.
  1924. */
  1925. function md5cmn(q, a, b, x, s, t) {
  1926. return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
  1927. }
  1928. function md5ff(a, b, c, d, x, s, t) {
  1929. return md5cmn(b & c | ~b & d, a, b, x, s, t);
  1930. }
  1931. function md5gg(a, b, c, d, x, s, t) {
  1932. return md5cmn(b & d | c & ~d, a, b, x, s, t);
  1933. }
  1934. function md5hh(a, b, c, d, x, s, t) {
  1935. return md5cmn(b ^ c ^ d, a, b, x, s, t);
  1936. }
  1937. function md5ii(a, b, c, d, x, s, t) {
  1938. return md5cmn(c ^ (b | ~d), a, b, x, s, t);
  1939. }
  1940. var _default = md5;
  1941. exports.default = _default;
  1942. /***/ }),
  1943. /* 15 */
  1944. /***/ (function(module, exports, __webpack_require__) {
  1945. "use strict";
  1946. Object.defineProperty(exports, "__esModule", {
  1947. value: true
  1948. });
  1949. exports.default = void 0;
  1950. var _rng = _interopRequireDefault(__webpack_require__(10));
  1951. var _bytesToUuid = _interopRequireDefault(__webpack_require__(11));
  1952. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1953. function v4(options, buf, offset) {
  1954. var i = buf && offset || 0;
  1955. if (typeof options == 'string') {
  1956. buf = options === 'binary' ? new Array(16) : null;
  1957. options = null;
  1958. }
  1959. options = options || {};
  1960. var rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  1961. rnds[6] = rnds[6] & 0x0f | 0x40;
  1962. rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
  1963. if (buf) {
  1964. for (var ii = 0; ii < 16; ++ii) {
  1965. buf[i + ii] = rnds[ii];
  1966. }
  1967. }
  1968. return buf || (0, _bytesToUuid.default)(rnds);
  1969. }
  1970. var _default = v4;
  1971. exports.default = _default;
  1972. /***/ }),
  1973. /* 16 */
  1974. /***/ (function(module, exports, __webpack_require__) {
  1975. "use strict";
  1976. Object.defineProperty(exports, "__esModule", {
  1977. value: true
  1978. });
  1979. exports.default = void 0;
  1980. var _v = _interopRequireDefault(__webpack_require__(13));
  1981. var _sha = _interopRequireDefault(__webpack_require__(17));
  1982. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1983. const v5 = (0, _v.default)('v5', 0x50, _sha.default);
  1984. var _default = v5;
  1985. exports.default = _default;
  1986. /***/ }),
  1987. /* 17 */
  1988. /***/ (function(module, exports) {
  1989. "use strict";
  1990. Object.defineProperty(exports, "__esModule", {
  1991. value: true
  1992. });
  1993. exports.default = void 0;
  1994. // Adapted from Chris Veness' SHA1 code at
  1995. // http://www.movable-type.co.uk/scripts/sha1.html
  1996. function f(s, x, y, z) {
  1997. switch (s) {
  1998. case 0:
  1999. return x & y ^ ~x & z;
  2000. case 1:
  2001. return x ^ y ^ z;
  2002. case 2:
  2003. return x & y ^ x & z ^ y & z;
  2004. case 3:
  2005. return x ^ y ^ z;
  2006. }
  2007. }
  2008. function ROTL(x, n) {
  2009. return x << n | x >>> 32 - n;
  2010. }
  2011. function sha1(bytes) {
  2012. var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
  2013. var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
  2014. if (typeof bytes == 'string') {
  2015. var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
  2016. bytes = new Array(msg.length);
  2017. for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
  2018. }
  2019. bytes.push(0x80);
  2020. var l = bytes.length / 4 + 2;
  2021. var N = Math.ceil(l / 16);
  2022. var M = new Array(N);
  2023. for (var i = 0; i < N; i++) {
  2024. M[i] = new Array(16);
  2025. for (var j = 0; j < 16; j++) {
  2026. M[i][j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
  2027. }
  2028. }
  2029. M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
  2030. M[N - 1][14] = Math.floor(M[N - 1][14]);
  2031. M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
  2032. for (var i = 0; i < N; i++) {
  2033. var W = new Array(80);
  2034. for (var t = 0; t < 16; t++) W[t] = M[i][t];
  2035. for (var t = 16; t < 80; t++) {
  2036. W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
  2037. }
  2038. var a = H[0];
  2039. var b = H[1];
  2040. var c = H[2];
  2041. var d = H[3];
  2042. var e = H[4];
  2043. for (var t = 0; t < 80; t++) {
  2044. var s = Math.floor(t / 20);
  2045. var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
  2046. e = d;
  2047. d = c;
  2048. c = ROTL(b, 30) >>> 0;
  2049. b = a;
  2050. a = T;
  2051. }
  2052. H[0] = H[0] + a >>> 0;
  2053. H[1] = H[1] + b >>> 0;
  2054. H[2] = H[2] + c >>> 0;
  2055. H[3] = H[3] + d >>> 0;
  2056. H[4] = H[4] + e >>> 0;
  2057. }
  2058. return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
  2059. }
  2060. var _default = sha1;
  2061. exports.default = _default;
  2062. /***/ }),
  2063. /* 18 */
  2064. /***/ (function(module, exports, __webpack_require__) {
  2065. var util = __webpack_require__(2);
  2066. var JsonBuilder = __webpack_require__(19);
  2067. var JsonParser = __webpack_require__(20);
  2068. var populateHostPrefix = __webpack_require__(21).populateHostPrefix;
  2069. function buildRequest(req) {
  2070. var httpRequest = req.httpRequest;
  2071. var api = req.service.api;
  2072. var target = api.targetPrefix + '.' + api.operations[req.operation].name;
  2073. var version = api.jsonVersion || '1.0';
  2074. var input = api.operations[req.operation].input;
  2075. var builder = new JsonBuilder();
  2076. if (version === 1) version = '1.0';
  2077. if (api.awsQueryCompatible) {
  2078. if (!httpRequest.params) {
  2079. httpRequest.params = {};
  2080. }
  2081. // because Query protocol does this.
  2082. Object.assign(httpRequest.params, req.params);
  2083. }
  2084. httpRequest.body = builder.build(req.params || {}, input);
  2085. httpRequest.headers['Content-Type'] = 'application/x-amz-json-' + version;
  2086. httpRequest.headers['X-Amz-Target'] = target;
  2087. populateHostPrefix(req);
  2088. }
  2089. function extractError(resp) {
  2090. var error = {};
  2091. var httpResponse = resp.httpResponse;
  2092. error.code = httpResponse.headers['x-amzn-errortype'] || 'UnknownError';
  2093. if (typeof error.code === 'string') {
  2094. error.code = error.code.split(':')[0];
  2095. }
  2096. if (httpResponse.body.length > 0) {
  2097. try {
  2098. var e = JSON.parse(httpResponse.body.toString());
  2099. var code = e.__type || e.code || e.Code;
  2100. if (code) {
  2101. error.code = code.split('#').pop();
  2102. }
  2103. if (error.code === 'RequestEntityTooLarge') {
  2104. error.message = 'Request body must be less than 1 MB';
  2105. } else {
  2106. error.message = (e.message || e.Message || null);
  2107. }
  2108. // The minimized models do not have error shapes, so
  2109. // without expanding the model size, it's not possible
  2110. // to validate the response shape (members) or
  2111. // check if any are sensitive to logging.
  2112. // Assign the fields as non-enumerable, allowing specific access only.
  2113. for (var key in e || {}) {
  2114. if (key === 'code' || key === 'message') {
  2115. continue;
  2116. }
  2117. error['[' + key + ']'] = 'See error.' + key + ' for details.';
  2118. Object.defineProperty(error, key, {
  2119. value: e[key],
  2120. enumerable: false,
  2121. writable: true
  2122. });
  2123. }
  2124. } catch (e) {
  2125. error.statusCode = httpResponse.statusCode;
  2126. error.message = httpResponse.statusMessage;
  2127. }
  2128. } else {
  2129. error.statusCode = httpResponse.statusCode;
  2130. error.message = httpResponse.statusCode.toString();
  2131. }
  2132. resp.error = util.error(new Error(), error);
  2133. }
  2134. function extractData(resp) {
  2135. var body = resp.httpResponse.body.toString() || '{}';
  2136. if (resp.request.service.config.convertResponseTypes === false) {
  2137. resp.data = JSON.parse(body);
  2138. } else {
  2139. var operation = resp.request.service.api.operations[resp.request.operation];
  2140. var shape = operation.output || {};
  2141. var parser = new JsonParser();
  2142. resp.data = parser.parse(body, shape);
  2143. }
  2144. }
  2145. /**
  2146. * @api private
  2147. */
  2148. module.exports = {
  2149. buildRequest: buildRequest,
  2150. extractError: extractError,
  2151. extractData: extractData
  2152. };
  2153. /***/ }),
  2154. /* 19 */
  2155. /***/ (function(module, exports, __webpack_require__) {
  2156. var util = __webpack_require__(2);
  2157. function JsonBuilder() { }
  2158. JsonBuilder.prototype.build = function(value, shape) {
  2159. return JSON.stringify(translate(value, shape));
  2160. };
  2161. function translate(value, shape) {
  2162. if (!shape || value === undefined || value === null) return undefined;
  2163. switch (shape.type) {
  2164. case 'structure': return translateStructure(value, shape);
  2165. case 'map': return translateMap(value, shape);
  2166. case 'list': return translateList(value, shape);
  2167. default: return translateScalar(value, shape);
  2168. }
  2169. }
  2170. function translateStructure(structure, shape) {
  2171. if (shape.isDocument) {
  2172. return structure;
  2173. }
  2174. var struct = {};
  2175. util.each(structure, function(name, value) {
  2176. var memberShape = shape.members[name];
  2177. if (memberShape) {
  2178. if (memberShape.location !== 'body') return;
  2179. var locationName = memberShape.isLocationName ? memberShape.name : name;
  2180. var result = translate(value, memberShape);
  2181. if (result !== undefined) struct[locationName] = result;
  2182. }
  2183. });
  2184. return struct;
  2185. }
  2186. function translateList(list, shape) {
  2187. var out = [];
  2188. util.arrayEach(list, function(value) {
  2189. var result = translate(value, shape.member);
  2190. if (result !== undefined) out.push(result);
  2191. });
  2192. return out;
  2193. }
  2194. function translateMap(map, shape) {
  2195. var out = {};
  2196. util.each(map, function(key, value) {
  2197. var result = translate(value, shape.value);
  2198. if (result !== undefined) out[key] = result;
  2199. });
  2200. return out;
  2201. }
  2202. function translateScalar(value, shape) {
  2203. return shape.toWireFormat(value);
  2204. }
  2205. /**
  2206. * @api private
  2207. */
  2208. module.exports = JsonBuilder;
  2209. /***/ }),
  2210. /* 20 */
  2211. /***/ (function(module, exports, __webpack_require__) {
  2212. var util = __webpack_require__(2);
  2213. function JsonParser() { }
  2214. JsonParser.prototype.parse = function(value, shape) {
  2215. return translate(JSON.parse(value), shape);
  2216. };
  2217. function translate(value, shape) {
  2218. if (!shape || value === undefined) return undefined;
  2219. switch (shape.type) {
  2220. case 'structure': return translateStructure(value, shape);
  2221. case 'map': return translateMap(value, shape);
  2222. case 'list': return translateList(value, shape);
  2223. default: return translateScalar(value, shape);
  2224. }
  2225. }
  2226. function translateStructure(structure, shape) {
  2227. if (structure == null) return undefined;
  2228. if (shape.isDocument) return structure;
  2229. var struct = {};
  2230. var shapeMembers = shape.members;
  2231. var isAwsQueryCompatible = shape.api && shape.api.awsQueryCompatible;
  2232. util.each(shapeMembers, function(name, memberShape) {
  2233. var locationName = memberShape.isLocationName ? memberShape.name : name;
  2234. if (Object.prototype.hasOwnProperty.call(structure, locationName)) {
  2235. var value = structure[locationName];
  2236. var result = translate(value, memberShape);
  2237. if (result !== undefined) struct[name] = result;
  2238. } else if (isAwsQueryCompatible && memberShape.defaultValue) {
  2239. if (memberShape.type === 'list') {
  2240. struct[name] = typeof memberShape.defaultValue === 'function' ? memberShape.defaultValue() : memberShape.defaultValue;
  2241. }
  2242. }
  2243. });
  2244. return struct;
  2245. }
  2246. function translateList(list, shape) {
  2247. if (list == null) return undefined;
  2248. var out = [];
  2249. util.arrayEach(list, function(value) {
  2250. var result = translate(value, shape.member);
  2251. if (result === undefined) out.push(null);
  2252. else out.push(result);
  2253. });
  2254. return out;
  2255. }
  2256. function translateMap(map, shape) {
  2257. if (map == null) return undefined;
  2258. var out = {};
  2259. util.each(map, function(key, value) {
  2260. var result = translate(value, shape.value);
  2261. if (result === undefined) out[key] = null;
  2262. else out[key] = result;
  2263. });
  2264. return out;
  2265. }
  2266. function translateScalar(value, shape) {
  2267. return shape.toType(value);
  2268. }
  2269. /**
  2270. * @api private
  2271. */
  2272. module.exports = JsonParser;
  2273. /***/ }),
  2274. /* 21 */
  2275. /***/ (function(module, exports, __webpack_require__) {
  2276. var util = __webpack_require__(2);
  2277. var AWS = __webpack_require__(1);
  2278. /**
  2279. * Prepend prefix defined by API model to endpoint that's already
  2280. * constructed. This feature does not apply to operations using
  2281. * endpoint discovery and can be disabled.
  2282. * @api private
  2283. */
  2284. function populateHostPrefix(request) {
  2285. var enabled = request.service.config.hostPrefixEnabled;
  2286. if (!enabled) return request;
  2287. var operationModel = request.service.api.operations[request.operation];
  2288. //don't marshal host prefix when operation has endpoint discovery traits
  2289. if (hasEndpointDiscover(request)) return request;
  2290. if (operationModel.endpoint && operationModel.endpoint.hostPrefix) {
  2291. var hostPrefixNotation = operationModel.endpoint.hostPrefix;
  2292. var hostPrefix = expandHostPrefix(hostPrefixNotation, request.params, operationModel.input);
  2293. prependEndpointPrefix(request.httpRequest.endpoint, hostPrefix);
  2294. validateHostname(request.httpRequest.endpoint.hostname);
  2295. }
  2296. return request;
  2297. }
  2298. /**
  2299. * @api private
  2300. */
  2301. function hasEndpointDiscover(request) {
  2302. var api = request.service.api;
  2303. var operationModel = api.operations[request.operation];
  2304. var isEndpointOperation = api.endpointOperation && (api.endpointOperation === util.string.lowerFirst(operationModel.name));
  2305. return (operationModel.endpointDiscoveryRequired !== 'NULL' || isEndpointOperation === true);
  2306. }
  2307. /**
  2308. * @api private
  2309. */
  2310. function expandHostPrefix(hostPrefixNotation, params, shape) {
  2311. util.each(shape.members, function(name, member) {
  2312. if (member.hostLabel === true) {
  2313. if (typeof params[name] !== 'string' || params[name] === '') {
  2314. throw util.error(new Error(), {
  2315. message: 'Parameter ' + name + ' should be a non-empty string.',
  2316. code: 'InvalidParameter'
  2317. });
  2318. }
  2319. var regex = new RegExp('\\{' + name + '\\}', 'g');
  2320. hostPrefixNotation = hostPrefixNotation.replace(regex, params[name]);
  2321. }
  2322. });
  2323. return hostPrefixNotation;
  2324. }
  2325. /**
  2326. * @api private
  2327. */
  2328. function prependEndpointPrefix(endpoint, prefix) {
  2329. if (endpoint.host) {
  2330. endpoint.host = prefix + endpoint.host;
  2331. }
  2332. if (endpoint.hostname) {
  2333. endpoint.hostname = prefix + endpoint.hostname;
  2334. }
  2335. }
  2336. /**
  2337. * @api private
  2338. */
  2339. function validateHostname(hostname) {
  2340. var labels = hostname.split('.');
  2341. //Reference: https://tools.ietf.org/html/rfc1123#section-2
  2342. var hostPattern = /^[a-zA-Z0-9]{1}$|^[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]$/;
  2343. util.arrayEach(labels, function(label) {
  2344. if (!label.length || label.length < 1 || label.length > 63) {
  2345. throw util.error(new Error(), {
  2346. code: 'ValidationError',
  2347. message: 'Hostname label length should be between 1 to 63 characters, inclusive.'
  2348. });
  2349. }
  2350. if (!hostPattern.test(label)) {
  2351. throw AWS.util.error(new Error(),
  2352. {code: 'ValidationError', message: label + ' is not hostname compatible.'});
  2353. }
  2354. });
  2355. }
  2356. module.exports = {
  2357. populateHostPrefix: populateHostPrefix
  2358. };
  2359. /***/ }),
  2360. /* 22 */
  2361. /***/ (function(module, exports, __webpack_require__) {
  2362. var AWS = __webpack_require__(1);
  2363. var util = __webpack_require__(2);
  2364. var QueryParamSerializer = __webpack_require__(23);
  2365. var Shape = __webpack_require__(24);
  2366. var populateHostPrefix = __webpack_require__(21).populateHostPrefix;
  2367. function buildRequest(req) {
  2368. var operation = req.service.api.operations[req.operation];
  2369. var httpRequest = req.httpRequest;
  2370. httpRequest.headers['Content-Type'] =
  2371. 'application/x-www-form-urlencoded; charset=utf-8';
  2372. httpRequest.params = {
  2373. Version: req.service.api.apiVersion,
  2374. Action: operation.name
  2375. };
  2376. // convert the request parameters into a list of query params,
  2377. // e.g. Deeply.NestedParam.0.Name=value
  2378. var builder = new QueryParamSerializer();
  2379. builder.serialize(req.params, operation.input, function(name, value) {
  2380. httpRequest.params[name] = value;
  2381. });
  2382. httpRequest.body = util.queryParamsToString(httpRequest.params);
  2383. populateHostPrefix(req);
  2384. }
  2385. function extractError(resp) {
  2386. var data, body = resp.httpResponse.body.toString();
  2387. if (body.match('<UnknownOperationException')) {
  2388. data = {
  2389. Code: 'UnknownOperation',
  2390. Message: 'Unknown operation ' + resp.request.operation
  2391. };
  2392. } else {
  2393. try {
  2394. data = new AWS.XML.Parser().parse(body);
  2395. } catch (e) {
  2396. data = {
  2397. Code: resp.httpResponse.statusCode,
  2398. Message: resp.httpResponse.statusMessage
  2399. };
  2400. }
  2401. }
  2402. if (data.requestId && !resp.requestId) resp.requestId = data.requestId;
  2403. if (data.Errors) data = data.Errors;
  2404. if (data.Error) data = data.Error;
  2405. if (data.Code) {
  2406. resp.error = util.error(new Error(), {
  2407. code: data.Code,
  2408. message: data.Message
  2409. });
  2410. } else {
  2411. resp.error = util.error(new Error(), {
  2412. code: resp.httpResponse.statusCode,
  2413. message: null
  2414. });
  2415. }
  2416. }
  2417. function extractData(resp) {
  2418. var req = resp.request;
  2419. var operation = req.service.api.operations[req.operation];
  2420. var shape = operation.output || {};
  2421. var origRules = shape;
  2422. if (origRules.resultWrapper) {
  2423. var tmp = Shape.create({type: 'structure'});
  2424. tmp.members[origRules.resultWrapper] = shape;
  2425. tmp.memberNames = [origRules.resultWrapper];
  2426. util.property(shape, 'name', shape.resultWrapper);
  2427. shape = tmp;
  2428. }
  2429. var parser = new AWS.XML.Parser();
  2430. // TODO: Refactor XML Parser to parse RequestId from response.
  2431. if (shape && shape.members && !shape.members._XAMZRequestId) {
  2432. var requestIdShape = Shape.create(
  2433. { type: 'string' },
  2434. { api: { protocol: 'query' } },
  2435. 'requestId'
  2436. );
  2437. shape.members._XAMZRequestId = requestIdShape;
  2438. }
  2439. var data = parser.parse(resp.httpResponse.body.toString(), shape);
  2440. resp.requestId = data._XAMZRequestId || data.requestId;
  2441. if (data._XAMZRequestId) delete data._XAMZRequestId;
  2442. if (origRules.resultWrapper) {
  2443. if (data[origRules.resultWrapper]) {
  2444. util.update(data, data[origRules.resultWrapper]);
  2445. delete data[origRules.resultWrapper];
  2446. }
  2447. }
  2448. resp.data = data;
  2449. }
  2450. /**
  2451. * @api private
  2452. */
  2453. module.exports = {
  2454. buildRequest: buildRequest,
  2455. extractError: extractError,
  2456. extractData: extractData
  2457. };
  2458. /***/ }),
  2459. /* 23 */
  2460. /***/ (function(module, exports, __webpack_require__) {
  2461. var util = __webpack_require__(2);
  2462. function QueryParamSerializer() {
  2463. }
  2464. QueryParamSerializer.prototype.serialize = function(params, shape, fn) {
  2465. serializeStructure('', params, shape, fn);
  2466. };
  2467. function ucfirst(shape) {
  2468. if (shape.isQueryName || shape.api.protocol !== 'ec2') {
  2469. return shape.name;
  2470. } else {
  2471. return shape.name[0].toUpperCase() + shape.name.substr(1);
  2472. }
  2473. }
  2474. function serializeStructure(prefix, struct, rules, fn) {
  2475. util.each(rules.members, function(name, member) {
  2476. var value = struct[name];
  2477. if (value === null || value === undefined) return;
  2478. var memberName = ucfirst(member);
  2479. memberName = prefix ? prefix + '.' + memberName : memberName;
  2480. serializeMember(memberName, value, member, fn);
  2481. });
  2482. }
  2483. function serializeMap(name, map, rules, fn) {
  2484. var i = 1;
  2485. util.each(map, function (key, value) {
  2486. var prefix = rules.flattened ? '.' : '.entry.';
  2487. var position = prefix + (i++) + '.';
  2488. var keyName = position + (rules.key.name || 'key');
  2489. var valueName = position + (rules.value.name || 'value');
  2490. serializeMember(name + keyName, key, rules.key, fn);
  2491. serializeMember(name + valueName, value, rules.value, fn);
  2492. });
  2493. }
  2494. function serializeList(name, list, rules, fn) {
  2495. var memberRules = rules.member || {};
  2496. if (list.length === 0) {
  2497. fn.call(this, name, null);
  2498. return;
  2499. }
  2500. util.arrayEach(list, function (v, n) {
  2501. var suffix = '.' + (n + 1);
  2502. if (rules.api.protocol === 'ec2') {
  2503. // Do nothing for EC2
  2504. suffix = suffix + ''; // make linter happy
  2505. } else if (rules.flattened) {
  2506. if (memberRules.name) {
  2507. var parts = name.split('.');
  2508. parts.pop();
  2509. parts.push(ucfirst(memberRules));
  2510. name = parts.join('.');
  2511. }
  2512. } else {
  2513. suffix = '.' + (memberRules.name ? memberRules.name : 'member') + suffix;
  2514. }
  2515. serializeMember(name + suffix, v, memberRules, fn);
  2516. });
  2517. }
  2518. function serializeMember(name, value, rules, fn) {
  2519. if (value === null || value === undefined) return;
  2520. if (rules.type === 'structure') {
  2521. serializeStructure(name, value, rules, fn);
  2522. } else if (rules.type === 'list') {
  2523. serializeList(name, value, rules, fn);
  2524. } else if (rules.type === 'map') {
  2525. serializeMap(name, value, rules, fn);
  2526. } else {
  2527. fn(name, rules.toWireFormat(value).toString());
  2528. }
  2529. }
  2530. /**
  2531. * @api private
  2532. */
  2533. module.exports = QueryParamSerializer;
  2534. /***/ }),
  2535. /* 24 */
  2536. /***/ (function(module, exports, __webpack_require__) {
  2537. var Collection = __webpack_require__(25);
  2538. var util = __webpack_require__(2);
  2539. function property(obj, name, value) {
  2540. if (value !== null && value !== undefined) {
  2541. util.property.apply(this, arguments);
  2542. }
  2543. }
  2544. function memoizedProperty(obj, name) {
  2545. if (!obj.constructor.prototype[name]) {
  2546. util.memoizedProperty.apply(this, arguments);
  2547. }
  2548. }
  2549. function Shape(shape, options, memberName) {
  2550. options = options || {};
  2551. property(this, 'shape', shape.shape);
  2552. property(this, 'api', options.api, false);
  2553. property(this, 'type', shape.type);
  2554. property(this, 'enum', shape.enum);
  2555. property(this, 'min', shape.min);
  2556. property(this, 'max', shape.max);
  2557. property(this, 'pattern', shape.pattern);
  2558. property(this, 'location', shape.location || this.location || 'body');
  2559. property(this, 'name', this.name || shape.xmlName || shape.queryName ||
  2560. shape.locationName || memberName);
  2561. property(this, 'isStreaming', shape.streaming || this.isStreaming || false);
  2562. property(this, 'requiresLength', shape.requiresLength, false);
  2563. property(this, 'isComposite', shape.isComposite || false);
  2564. property(this, 'isShape', true, false);
  2565. property(this, 'isQueryName', Boolean(shape.queryName), false);
  2566. property(this, 'isLocationName', Boolean(shape.locationName), false);
  2567. property(this, 'isIdempotent', shape.idempotencyToken === true);
  2568. property(this, 'isJsonValue', shape.jsonvalue === true);
  2569. property(this, 'isSensitive', shape.sensitive === true || shape.prototype && shape.prototype.sensitive === true);
  2570. property(this, 'isEventStream', Boolean(shape.eventstream), false);
  2571. property(this, 'isEvent', Boolean(shape.event), false);
  2572. property(this, 'isEventPayload', Boolean(shape.eventpayload), false);
  2573. property(this, 'isEventHeader', Boolean(shape.eventheader), false);
  2574. property(this, 'isTimestampFormatSet', Boolean(shape.timestampFormat) || shape.prototype && shape.prototype.isTimestampFormatSet === true, false);
  2575. property(this, 'endpointDiscoveryId', Boolean(shape.endpointdiscoveryid), false);
  2576. property(this, 'hostLabel', Boolean(shape.hostLabel), false);
  2577. if (options.documentation) {
  2578. property(this, 'documentation', shape.documentation);
  2579. property(this, 'documentationUrl', shape.documentationUrl);
  2580. }
  2581. if (shape.xmlAttribute) {
  2582. property(this, 'isXmlAttribute', shape.xmlAttribute || false);
  2583. }
  2584. // type conversion and parsing
  2585. property(this, 'defaultValue', null);
  2586. this.toWireFormat = function(value) {
  2587. if (value === null || value === undefined) return '';
  2588. return value;
  2589. };
  2590. this.toType = function(value) { return value; };
  2591. }
  2592. /**
  2593. * @api private
  2594. */
  2595. Shape.normalizedTypes = {
  2596. character: 'string',
  2597. double: 'float',
  2598. long: 'integer',
  2599. short: 'integer',
  2600. biginteger: 'integer',
  2601. bigdecimal: 'float',
  2602. blob: 'binary'
  2603. };
  2604. /**
  2605. * @api private
  2606. */
  2607. Shape.types = {
  2608. 'structure': StructureShape,
  2609. 'list': ListShape,
  2610. 'map': MapShape,
  2611. 'boolean': BooleanShape,
  2612. 'timestamp': TimestampShape,
  2613. 'float': FloatShape,
  2614. 'integer': IntegerShape,
  2615. 'string': StringShape,
  2616. 'base64': Base64Shape,
  2617. 'binary': BinaryShape
  2618. };
  2619. Shape.resolve = function resolve(shape, options) {
  2620. if (shape.shape) {
  2621. var refShape = options.api.shapes[shape.shape];
  2622. if (!refShape) {
  2623. throw new Error('Cannot find shape reference: ' + shape.shape);
  2624. }
  2625. return refShape;
  2626. } else {
  2627. return null;
  2628. }
  2629. };
  2630. Shape.create = function create(shape, options, memberName) {
  2631. if (shape.isShape) return shape;
  2632. var refShape = Shape.resolve(shape, options);
  2633. if (refShape) {
  2634. var filteredKeys = Object.keys(shape);
  2635. if (!options.documentation) {
  2636. filteredKeys = filteredKeys.filter(function(name) {
  2637. return !name.match(/documentation/);
  2638. });
  2639. }
  2640. // create an inline shape with extra members
  2641. var InlineShape = function() {
  2642. refShape.constructor.call(this, shape, options, memberName);
  2643. };
  2644. InlineShape.prototype = refShape;
  2645. return new InlineShape();
  2646. } else {
  2647. // set type if not set
  2648. if (!shape.type) {
  2649. if (shape.members) shape.type = 'structure';
  2650. else if (shape.member) shape.type = 'list';
  2651. else if (shape.key) shape.type = 'map';
  2652. else shape.type = 'string';
  2653. }
  2654. // normalize types
  2655. var origType = shape.type;
  2656. if (Shape.normalizedTypes[shape.type]) {
  2657. shape.type = Shape.normalizedTypes[shape.type];
  2658. }
  2659. if (Shape.types[shape.type]) {
  2660. return new Shape.types[shape.type](shape, options, memberName);
  2661. } else {
  2662. throw new Error('Unrecognized shape type: ' + origType);
  2663. }
  2664. }
  2665. };
  2666. function CompositeShape(shape) {
  2667. Shape.apply(this, arguments);
  2668. property(this, 'isComposite', true);
  2669. if (shape.flattened) {
  2670. property(this, 'flattened', shape.flattened || false);
  2671. }
  2672. }
  2673. function StructureShape(shape, options) {
  2674. var self = this;
  2675. var requiredMap = null, firstInit = !this.isShape;
  2676. CompositeShape.apply(this, arguments);
  2677. if (firstInit) {
  2678. property(this, 'defaultValue', function() { return {}; });
  2679. property(this, 'members', {});
  2680. property(this, 'memberNames', []);
  2681. property(this, 'required', []);
  2682. property(this, 'isRequired', function() { return false; });
  2683. property(this, 'isDocument', Boolean(shape.document));
  2684. }
  2685. if (shape.members) {
  2686. property(this, 'members', new Collection(shape.members, options, function(name, member) {
  2687. return Shape.create(member, options, name);
  2688. }));
  2689. memoizedProperty(this, 'memberNames', function() {
  2690. return shape.xmlOrder || Object.keys(shape.members);
  2691. });
  2692. if (shape.event) {
  2693. memoizedProperty(this, 'eventPayloadMemberName', function() {
  2694. var members = self.members;
  2695. var memberNames = self.memberNames;
  2696. // iterate over members to find ones that are event payloads
  2697. for (var i = 0, iLen = memberNames.length; i < iLen; i++) {
  2698. if (members[memberNames[i]].isEventPayload) {
  2699. return memberNames[i];
  2700. }
  2701. }
  2702. });
  2703. memoizedProperty(this, 'eventHeaderMemberNames', function() {
  2704. var members = self.members;
  2705. var memberNames = self.memberNames;
  2706. var eventHeaderMemberNames = [];
  2707. // iterate over members to find ones that are event headers
  2708. for (var i = 0, iLen = memberNames.length; i < iLen; i++) {
  2709. if (members[memberNames[i]].isEventHeader) {
  2710. eventHeaderMemberNames.push(memberNames[i]);
  2711. }
  2712. }
  2713. return eventHeaderMemberNames;
  2714. });
  2715. }
  2716. }
  2717. if (shape.required) {
  2718. property(this, 'required', shape.required);
  2719. property(this, 'isRequired', function(name) {
  2720. if (!requiredMap) {
  2721. requiredMap = {};
  2722. for (var i = 0; i < shape.required.length; i++) {
  2723. requiredMap[shape.required[i]] = true;
  2724. }
  2725. }
  2726. return requiredMap[name];
  2727. }, false, true);
  2728. }
  2729. property(this, 'resultWrapper', shape.resultWrapper || null);
  2730. if (shape.payload) {
  2731. property(this, 'payload', shape.payload);
  2732. }
  2733. if (typeof shape.xmlNamespace === 'string') {
  2734. property(this, 'xmlNamespaceUri', shape.xmlNamespace);
  2735. } else if (typeof shape.xmlNamespace === 'object') {
  2736. property(this, 'xmlNamespacePrefix', shape.xmlNamespace.prefix);
  2737. property(this, 'xmlNamespaceUri', shape.xmlNamespace.uri);
  2738. }
  2739. }
  2740. function ListShape(shape, options) {
  2741. var self = this, firstInit = !this.isShape;
  2742. CompositeShape.apply(this, arguments);
  2743. if (firstInit) {
  2744. property(this, 'defaultValue', function() { return []; });
  2745. }
  2746. if (shape.member) {
  2747. memoizedProperty(this, 'member', function() {
  2748. return Shape.create(shape.member, options);
  2749. });
  2750. }
  2751. if (this.flattened) {
  2752. var oldName = this.name;
  2753. memoizedProperty(this, 'name', function() {
  2754. return self.member.name || oldName;
  2755. });
  2756. }
  2757. }
  2758. function MapShape(shape, options) {
  2759. var firstInit = !this.isShape;
  2760. CompositeShape.apply(this, arguments);
  2761. if (firstInit) {
  2762. property(this, 'defaultValue', function() { return {}; });
  2763. property(this, 'key', Shape.create({type: 'string'}, options));
  2764. property(this, 'value', Shape.create({type: 'string'}, options));
  2765. }
  2766. if (shape.key) {
  2767. memoizedProperty(this, 'key', function() {
  2768. return Shape.create(shape.key, options);
  2769. });
  2770. }
  2771. if (shape.value) {
  2772. memoizedProperty(this, 'value', function() {
  2773. return Shape.create(shape.value, options);
  2774. });
  2775. }
  2776. }
  2777. function TimestampShape(shape) {
  2778. var self = this;
  2779. Shape.apply(this, arguments);
  2780. if (shape.timestampFormat) {
  2781. property(this, 'timestampFormat', shape.timestampFormat);
  2782. } else if (self.isTimestampFormatSet && this.timestampFormat) {
  2783. property(this, 'timestampFormat', this.timestampFormat);
  2784. } else if (this.location === 'header') {
  2785. property(this, 'timestampFormat', 'rfc822');
  2786. } else if (this.location === 'querystring') {
  2787. property(this, 'timestampFormat', 'iso8601');
  2788. } else if (this.api) {
  2789. switch (this.api.protocol) {
  2790. case 'json':
  2791. case 'rest-json':
  2792. property(this, 'timestampFormat', 'unixTimestamp');
  2793. break;
  2794. case 'rest-xml':
  2795. case 'query':
  2796. case 'ec2':
  2797. property(this, 'timestampFormat', 'iso8601');
  2798. break;
  2799. }
  2800. }
  2801. this.toType = function(value) {
  2802. if (value === null || value === undefined) return null;
  2803. if (typeof value.toUTCString === 'function') return value;
  2804. return typeof value === 'string' || typeof value === 'number' ?
  2805. util.date.parseTimestamp(value) : null;
  2806. };
  2807. this.toWireFormat = function(value) {
  2808. return util.date.format(value, self.timestampFormat);
  2809. };
  2810. }
  2811. function StringShape() {
  2812. Shape.apply(this, arguments);
  2813. var nullLessProtocols = ['rest-xml', 'query', 'ec2'];
  2814. this.toType = function(value) {
  2815. value = this.api && nullLessProtocols.indexOf(this.api.protocol) > -1 ?
  2816. value || '' : value;
  2817. if (this.isJsonValue) {
  2818. return JSON.parse(value);
  2819. }
  2820. return value && typeof value.toString === 'function' ?
  2821. value.toString() : value;
  2822. };
  2823. this.toWireFormat = function(value) {
  2824. return this.isJsonValue ? JSON.stringify(value) : value;
  2825. };
  2826. }
  2827. function FloatShape() {
  2828. Shape.apply(this, arguments);
  2829. this.toType = function(value) {
  2830. if (value === null || value === undefined) return null;
  2831. return parseFloat(value);
  2832. };
  2833. this.toWireFormat = this.toType;
  2834. }
  2835. function IntegerShape() {
  2836. Shape.apply(this, arguments);
  2837. this.toType = function(value) {
  2838. if (value === null || value === undefined) return null;
  2839. return parseInt(value, 10);
  2840. };
  2841. this.toWireFormat = this.toType;
  2842. }
  2843. function BinaryShape() {
  2844. Shape.apply(this, arguments);
  2845. this.toType = function(value) {
  2846. var buf = util.base64.decode(value);
  2847. if (this.isSensitive && util.isNode() && typeof util.Buffer.alloc === 'function') {
  2848. /* Node.js can create a Buffer that is not isolated.
  2849. * i.e. buf.byteLength !== buf.buffer.byteLength
  2850. * This means that the sensitive data is accessible to anyone with access to buf.buffer.
  2851. * If this is the node shared Buffer, then other code within this process _could_ find this secret.
  2852. * Copy sensitive data to an isolated Buffer and zero the sensitive data.
  2853. * While this is safe to do here, copying this code somewhere else may produce unexpected results.
  2854. */
  2855. var secureBuf = util.Buffer.alloc(buf.length, buf);
  2856. buf.fill(0);
  2857. buf = secureBuf;
  2858. }
  2859. return buf;
  2860. };
  2861. this.toWireFormat = util.base64.encode;
  2862. }
  2863. function Base64Shape() {
  2864. BinaryShape.apply(this, arguments);
  2865. }
  2866. function BooleanShape() {
  2867. Shape.apply(this, arguments);
  2868. this.toType = function(value) {
  2869. if (typeof value === 'boolean') return value;
  2870. if (value === null || value === undefined) return null;
  2871. return value === 'true';
  2872. };
  2873. }
  2874. /**
  2875. * @api private
  2876. */
  2877. Shape.shapes = {
  2878. StructureShape: StructureShape,
  2879. ListShape: ListShape,
  2880. MapShape: MapShape,
  2881. StringShape: StringShape,
  2882. BooleanShape: BooleanShape,
  2883. Base64Shape: Base64Shape
  2884. };
  2885. /**
  2886. * @api private
  2887. */
  2888. module.exports = Shape;
  2889. /***/ }),
  2890. /* 25 */
  2891. /***/ (function(module, exports, __webpack_require__) {
  2892. var memoizedProperty = __webpack_require__(2).memoizedProperty;
  2893. function memoize(name, value, factory, nameTr) {
  2894. memoizedProperty(this, nameTr(name), function() {
  2895. return factory(name, value);
  2896. });
  2897. }
  2898. function Collection(iterable, options, factory, nameTr, callback) {
  2899. nameTr = nameTr || String;
  2900. var self = this;
  2901. for (var id in iterable) {
  2902. if (Object.prototype.hasOwnProperty.call(iterable, id)) {
  2903. memoize.call(self, id, iterable[id], factory, nameTr);
  2904. if (callback) callback(id, iterable[id]);
  2905. }
  2906. }
  2907. }
  2908. /**
  2909. * @api private
  2910. */
  2911. module.exports = Collection;
  2912. /***/ }),
  2913. /* 26 */
  2914. /***/ (function(module, exports, __webpack_require__) {
  2915. var util = __webpack_require__(2);
  2916. var populateHostPrefix = __webpack_require__(21).populateHostPrefix;
  2917. function populateMethod(req) {
  2918. req.httpRequest.method = req.service.api.operations[req.operation].httpMethod;
  2919. }
  2920. function generateURI(endpointPath, operationPath, input, params) {
  2921. var uri = [endpointPath, operationPath].join('/');
  2922. uri = uri.replace(/\/+/g, '/');
  2923. var queryString = {}, queryStringSet = false;
  2924. util.each(input.members, function (name, member) {
  2925. var paramValue = params[name];
  2926. if (paramValue === null || paramValue === undefined) return;
  2927. if (member.location === 'uri') {
  2928. var regex = new RegExp('\\{' + member.name + '(\\+)?\\}');
  2929. uri = uri.replace(regex, function(_, plus) {
  2930. var fn = plus ? util.uriEscapePath : util.uriEscape;
  2931. return fn(String(paramValue));
  2932. });
  2933. } else if (member.location === 'querystring') {
  2934. queryStringSet = true;
  2935. if (member.type === 'list') {
  2936. queryString[member.name] = paramValue.map(function(val) {
  2937. return util.uriEscape(member.member.toWireFormat(val).toString());
  2938. });
  2939. } else if (member.type === 'map') {
  2940. util.each(paramValue, function(key, value) {
  2941. if (Array.isArray(value)) {
  2942. queryString[key] = value.map(function(val) {
  2943. return util.uriEscape(String(val));
  2944. });
  2945. } else {
  2946. queryString[key] = util.uriEscape(String(value));
  2947. }
  2948. });
  2949. } else {
  2950. queryString[member.name] = util.uriEscape(member.toWireFormat(paramValue).toString());
  2951. }
  2952. }
  2953. });
  2954. if (queryStringSet) {
  2955. uri += (uri.indexOf('?') >= 0 ? '&' : '?');
  2956. var parts = [];
  2957. util.arrayEach(Object.keys(queryString).sort(), function(key) {
  2958. if (!Array.isArray(queryString[key])) {
  2959. queryString[key] = [queryString[key]];
  2960. }
  2961. for (var i = 0; i < queryString[key].length; i++) {
  2962. parts.push(util.uriEscape(String(key)) + '=' + queryString[key][i]);
  2963. }
  2964. });
  2965. uri += parts.join('&');
  2966. }
  2967. return uri;
  2968. }
  2969. function populateURI(req) {
  2970. var operation = req.service.api.operations[req.operation];
  2971. var input = operation.input;
  2972. var uri = generateURI(req.httpRequest.endpoint.path, operation.httpPath, input, req.params);
  2973. req.httpRequest.path = uri;
  2974. }
  2975. function populateHeaders(req) {
  2976. var operation = req.service.api.operations[req.operation];
  2977. util.each(operation.input.members, function (name, member) {
  2978. var value = req.params[name];
  2979. if (value === null || value === undefined) return;
  2980. if (member.location === 'headers' && member.type === 'map') {
  2981. util.each(value, function(key, memberValue) {
  2982. req.httpRequest.headers[member.name + key] = memberValue;
  2983. });
  2984. } else if (member.location === 'header') {
  2985. value = member.toWireFormat(value).toString();
  2986. if (member.isJsonValue) {
  2987. value = util.base64.encode(value);
  2988. }
  2989. req.httpRequest.headers[member.name] = value;
  2990. }
  2991. });
  2992. }
  2993. function buildRequest(req) {
  2994. populateMethod(req);
  2995. populateURI(req);
  2996. populateHeaders(req);
  2997. populateHostPrefix(req);
  2998. }
  2999. function extractError() {
  3000. }
  3001. function extractData(resp) {
  3002. var req = resp.request;
  3003. var data = {};
  3004. var r = resp.httpResponse;
  3005. var operation = req.service.api.operations[req.operation];
  3006. var output = operation.output;
  3007. // normalize headers names to lower-cased keys for matching
  3008. var headers = {};
  3009. util.each(r.headers, function (k, v) {
  3010. headers[k.toLowerCase()] = v;
  3011. });
  3012. util.each(output.members, function(name, member) {
  3013. var header = (member.name || name).toLowerCase();
  3014. if (member.location === 'headers' && member.type === 'map') {
  3015. data[name] = {};
  3016. var location = member.isLocationName ? member.name : '';
  3017. var pattern = new RegExp('^' + location + '(.+)', 'i');
  3018. util.each(r.headers, function (k, v) {
  3019. var result = k.match(pattern);
  3020. if (result !== null) {
  3021. data[name][result[1]] = v;
  3022. }
  3023. });
  3024. } else if (member.location === 'header') {
  3025. if (headers[header] !== undefined) {
  3026. var value = member.isJsonValue ?
  3027. util.base64.decode(headers[header]) :
  3028. headers[header];
  3029. data[name] = member.toType(value);
  3030. }
  3031. } else if (member.location === 'statusCode') {
  3032. data[name] = parseInt(r.statusCode, 10);
  3033. }
  3034. });
  3035. resp.data = data;
  3036. }
  3037. /**
  3038. * @api private
  3039. */
  3040. module.exports = {
  3041. buildRequest: buildRequest,
  3042. extractError: extractError,
  3043. extractData: extractData,
  3044. generateURI: generateURI
  3045. };
  3046. /***/ }),
  3047. /* 27 */
  3048. /***/ (function(module, exports, __webpack_require__) {
  3049. var util = __webpack_require__(2);
  3050. var Rest = __webpack_require__(26);
  3051. var Json = __webpack_require__(18);
  3052. var JsonBuilder = __webpack_require__(19);
  3053. var JsonParser = __webpack_require__(20);
  3054. var METHODS_WITHOUT_BODY = ['GET', 'HEAD', 'DELETE'];
  3055. function unsetContentLength(req) {
  3056. var payloadMember = util.getRequestPayloadShape(req);
  3057. if (
  3058. payloadMember === undefined &&
  3059. METHODS_WITHOUT_BODY.indexOf(req.httpRequest.method) >= 0
  3060. ) {
  3061. delete req.httpRequest.headers['Content-Length'];
  3062. }
  3063. }
  3064. function populateBody(req) {
  3065. var builder = new JsonBuilder();
  3066. var input = req.service.api.operations[req.operation].input;
  3067. if (input.payload) {
  3068. var params = {};
  3069. var payloadShape = input.members[input.payload];
  3070. params = req.params[input.payload];
  3071. if (payloadShape.type === 'structure') {
  3072. req.httpRequest.body = builder.build(params || {}, payloadShape);
  3073. applyContentTypeHeader(req);
  3074. } else if (params !== undefined) {
  3075. // non-JSON payload
  3076. req.httpRequest.body = params;
  3077. if (payloadShape.type === 'binary' || payloadShape.isStreaming) {
  3078. applyContentTypeHeader(req, true);
  3079. }
  3080. }
  3081. } else {
  3082. req.httpRequest.body = builder.build(req.params, input);
  3083. applyContentTypeHeader(req);
  3084. }
  3085. }
  3086. function applyContentTypeHeader(req, isBinary) {
  3087. if (!req.httpRequest.headers['Content-Type']) {
  3088. var type = isBinary ? 'binary/octet-stream' : 'application/json';
  3089. req.httpRequest.headers['Content-Type'] = type;
  3090. }
  3091. }
  3092. function buildRequest(req) {
  3093. Rest.buildRequest(req);
  3094. // never send body payload on GET/HEAD/DELETE
  3095. if (METHODS_WITHOUT_BODY.indexOf(req.httpRequest.method) < 0) {
  3096. populateBody(req);
  3097. }
  3098. }
  3099. function extractError(resp) {
  3100. Json.extractError(resp);
  3101. }
  3102. function extractData(resp) {
  3103. Rest.extractData(resp);
  3104. var req = resp.request;
  3105. var operation = req.service.api.operations[req.operation];
  3106. var rules = req.service.api.operations[req.operation].output || {};
  3107. var parser;
  3108. var hasEventOutput = operation.hasEventOutput;
  3109. if (rules.payload) {
  3110. var payloadMember = rules.members[rules.payload];
  3111. var body = resp.httpResponse.body;
  3112. if (payloadMember.isEventStream) {
  3113. parser = new JsonParser();
  3114. resp.data[payload] = util.createEventStream(
  3115. AWS.HttpClient.streamsApiVersion === 2 ? resp.httpResponse.stream : body,
  3116. parser,
  3117. payloadMember
  3118. );
  3119. } else if (payloadMember.type === 'structure' || payloadMember.type === 'list') {
  3120. var parser = new JsonParser();
  3121. resp.data[rules.payload] = parser.parse(body, payloadMember);
  3122. } else if (payloadMember.type === 'binary' || payloadMember.isStreaming) {
  3123. resp.data[rules.payload] = body;
  3124. } else {
  3125. resp.data[rules.payload] = payloadMember.toType(body);
  3126. }
  3127. } else {
  3128. var data = resp.data;
  3129. Json.extractData(resp);
  3130. resp.data = util.merge(data, resp.data);
  3131. }
  3132. }
  3133. /**
  3134. * @api private
  3135. */
  3136. module.exports = {
  3137. buildRequest: buildRequest,
  3138. extractError: extractError,
  3139. extractData: extractData,
  3140. unsetContentLength: unsetContentLength
  3141. };
  3142. /***/ }),
  3143. /* 28 */
  3144. /***/ (function(module, exports, __webpack_require__) {
  3145. var AWS = __webpack_require__(1);
  3146. var util = __webpack_require__(2);
  3147. var Rest = __webpack_require__(26);
  3148. function populateBody(req) {
  3149. var input = req.service.api.operations[req.operation].input;
  3150. var builder = new AWS.XML.Builder();
  3151. var params = req.params;
  3152. var payload = input.payload;
  3153. if (payload) {
  3154. var payloadMember = input.members[payload];
  3155. params = params[payload];
  3156. if (params === undefined) return;
  3157. if (payloadMember.type === 'structure') {
  3158. var rootElement = payloadMember.name;
  3159. req.httpRequest.body = builder.toXML(params, payloadMember, rootElement, true);
  3160. } else { // non-xml payload
  3161. req.httpRequest.body = params;
  3162. }
  3163. } else {
  3164. req.httpRequest.body = builder.toXML(params, input, input.name ||
  3165. input.shape || util.string.upperFirst(req.operation) + 'Request');
  3166. }
  3167. }
  3168. function buildRequest(req) {
  3169. Rest.buildRequest(req);
  3170. // never send body payload on GET/HEAD
  3171. if (['GET', 'HEAD'].indexOf(req.httpRequest.method) < 0) {
  3172. populateBody(req);
  3173. }
  3174. }
  3175. function extractError(resp) {
  3176. Rest.extractError(resp);
  3177. var data;
  3178. try {
  3179. data = new AWS.XML.Parser().parse(resp.httpResponse.body.toString());
  3180. } catch (e) {
  3181. data = {
  3182. Code: resp.httpResponse.statusCode,
  3183. Message: resp.httpResponse.statusMessage
  3184. };
  3185. }
  3186. if (data.Errors) data = data.Errors;
  3187. if (data.Error) data = data.Error;
  3188. if (data.Code) {
  3189. resp.error = util.error(new Error(), {
  3190. code: data.Code,
  3191. message: data.Message
  3192. });
  3193. } else {
  3194. resp.error = util.error(new Error(), {
  3195. code: resp.httpResponse.statusCode,
  3196. message: null
  3197. });
  3198. }
  3199. }
  3200. function extractData(resp) {
  3201. Rest.extractData(resp);
  3202. var parser;
  3203. var req = resp.request;
  3204. var body = resp.httpResponse.body;
  3205. var operation = req.service.api.operations[req.operation];
  3206. var output = operation.output;
  3207. var hasEventOutput = operation.hasEventOutput;
  3208. var payload = output.payload;
  3209. if (payload) {
  3210. var payloadMember = output.members[payload];
  3211. if (payloadMember.isEventStream) {
  3212. parser = new AWS.XML.Parser();
  3213. resp.data[payload] = util.createEventStream(
  3214. AWS.HttpClient.streamsApiVersion === 2 ? resp.httpResponse.stream : resp.httpResponse.body,
  3215. parser,
  3216. payloadMember
  3217. );
  3218. } else if (payloadMember.type === 'structure') {
  3219. parser = new AWS.XML.Parser();
  3220. resp.data[payload] = parser.parse(body.toString(), payloadMember);
  3221. } else if (payloadMember.type === 'binary' || payloadMember.isStreaming) {
  3222. resp.data[payload] = body;
  3223. } else {
  3224. resp.data[payload] = payloadMember.toType(body);
  3225. }
  3226. } else if (body.length > 0) {
  3227. parser = new AWS.XML.Parser();
  3228. var data = parser.parse(body.toString(), output);
  3229. util.update(resp.data, data);
  3230. }
  3231. }
  3232. /**
  3233. * @api private
  3234. */
  3235. module.exports = {
  3236. buildRequest: buildRequest,
  3237. extractError: extractError,
  3238. extractData: extractData
  3239. };
  3240. /***/ }),
  3241. /* 29 */
  3242. /***/ (function(module, exports, __webpack_require__) {
  3243. var util = __webpack_require__(2);
  3244. var XmlNode = __webpack_require__(30).XmlNode;
  3245. var XmlText = __webpack_require__(32).XmlText;
  3246. function XmlBuilder() { }
  3247. XmlBuilder.prototype.toXML = function(params, shape, rootElement, noEmpty) {
  3248. var xml = new XmlNode(rootElement);
  3249. applyNamespaces(xml, shape, true);
  3250. serialize(xml, params, shape);
  3251. return xml.children.length > 0 || noEmpty ? xml.toString() : '';
  3252. };
  3253. function serialize(xml, value, shape) {
  3254. switch (shape.type) {
  3255. case 'structure': return serializeStructure(xml, value, shape);
  3256. case 'map': return serializeMap(xml, value, shape);
  3257. case 'list': return serializeList(xml, value, shape);
  3258. default: return serializeScalar(xml, value, shape);
  3259. }
  3260. }
  3261. function serializeStructure(xml, params, shape) {
  3262. util.arrayEach(shape.memberNames, function(memberName) {
  3263. var memberShape = shape.members[memberName];
  3264. if (memberShape.location !== 'body') return;
  3265. var value = params[memberName];
  3266. var name = memberShape.name;
  3267. if (value !== undefined && value !== null) {
  3268. if (memberShape.isXmlAttribute) {
  3269. xml.addAttribute(name, value);
  3270. } else if (memberShape.flattened) {
  3271. serialize(xml, value, memberShape);
  3272. } else {
  3273. var element = new XmlNode(name);
  3274. xml.addChildNode(element);
  3275. applyNamespaces(element, memberShape);
  3276. serialize(element, value, memberShape);
  3277. }
  3278. }
  3279. });
  3280. }
  3281. function serializeMap(xml, map, shape) {
  3282. var xmlKey = shape.key.name || 'key';
  3283. var xmlValue = shape.value.name || 'value';
  3284. util.each(map, function(key, value) {
  3285. var entry = new XmlNode(shape.flattened ? shape.name : 'entry');
  3286. xml.addChildNode(entry);
  3287. var entryKey = new XmlNode(xmlKey);
  3288. var entryValue = new XmlNode(xmlValue);
  3289. entry.addChildNode(entryKey);
  3290. entry.addChildNode(entryValue);
  3291. serialize(entryKey, key, shape.key);
  3292. serialize(entryValue, value, shape.value);
  3293. });
  3294. }
  3295. function serializeList(xml, list, shape) {
  3296. if (shape.flattened) {
  3297. util.arrayEach(list, function(value) {
  3298. var name = shape.member.name || shape.name;
  3299. var element = new XmlNode(name);
  3300. xml.addChildNode(element);
  3301. serialize(element, value, shape.member);
  3302. });
  3303. } else {
  3304. util.arrayEach(list, function(value) {
  3305. var name = shape.member.name || 'member';
  3306. var element = new XmlNode(name);
  3307. xml.addChildNode(element);
  3308. serialize(element, value, shape.member);
  3309. });
  3310. }
  3311. }
  3312. function serializeScalar(xml, value, shape) {
  3313. xml.addChildNode(
  3314. new XmlText(shape.toWireFormat(value))
  3315. );
  3316. }
  3317. function applyNamespaces(xml, shape, isRoot) {
  3318. var uri, prefix = 'xmlns';
  3319. if (shape.xmlNamespaceUri) {
  3320. uri = shape.xmlNamespaceUri;
  3321. if (shape.xmlNamespacePrefix) prefix += ':' + shape.xmlNamespacePrefix;
  3322. } else if (isRoot && shape.api.xmlNamespaceUri) {
  3323. uri = shape.api.xmlNamespaceUri;
  3324. }
  3325. if (uri) xml.addAttribute(prefix, uri);
  3326. }
  3327. /**
  3328. * @api private
  3329. */
  3330. module.exports = XmlBuilder;
  3331. /***/ }),
  3332. /* 30 */
  3333. /***/ (function(module, exports, __webpack_require__) {
  3334. var escapeAttribute = __webpack_require__(31).escapeAttribute;
  3335. /**
  3336. * Represents an XML node.
  3337. * @api private
  3338. */
  3339. function XmlNode(name, children) {
  3340. if (children === void 0) { children = []; }
  3341. this.name = name;
  3342. this.children = children;
  3343. this.attributes = {};
  3344. }
  3345. XmlNode.prototype.addAttribute = function (name, value) {
  3346. this.attributes[name] = value;
  3347. return this;
  3348. };
  3349. XmlNode.prototype.addChildNode = function (child) {
  3350. this.children.push(child);
  3351. return this;
  3352. };
  3353. XmlNode.prototype.removeAttribute = function (name) {
  3354. delete this.attributes[name];
  3355. return this;
  3356. };
  3357. XmlNode.prototype.toString = function () {
  3358. var hasChildren = Boolean(this.children.length);
  3359. var xmlText = '<' + this.name;
  3360. // add attributes
  3361. var attributes = this.attributes;
  3362. for (var i = 0, attributeNames = Object.keys(attributes); i < attributeNames.length; i++) {
  3363. var attributeName = attributeNames[i];
  3364. var attribute = attributes[attributeName];
  3365. if (typeof attribute !== 'undefined' && attribute !== null) {
  3366. xmlText += ' ' + attributeName + '=\"' + escapeAttribute('' + attribute) + '\"';
  3367. }
  3368. }
  3369. return xmlText += !hasChildren ? '/>' : '>' + this.children.map(function (c) { return c.toString(); }).join('') + '</' + this.name + '>';
  3370. };
  3371. /**
  3372. * @api private
  3373. */
  3374. module.exports = {
  3375. XmlNode: XmlNode
  3376. };
  3377. /***/ }),
  3378. /* 31 */
  3379. /***/ (function(module, exports) {
  3380. /**
  3381. * Escapes characters that can not be in an XML attribute.
  3382. */
  3383. function escapeAttribute(value) {
  3384. return value.replace(/&/g, '&amp;').replace(/'/g, '&apos;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  3385. }
  3386. /**
  3387. * @api private
  3388. */
  3389. module.exports = {
  3390. escapeAttribute: escapeAttribute
  3391. };
  3392. /***/ }),
  3393. /* 32 */
  3394. /***/ (function(module, exports, __webpack_require__) {
  3395. var escapeElement = __webpack_require__(33).escapeElement;
  3396. /**
  3397. * Represents an XML text value.
  3398. * @api private
  3399. */
  3400. function XmlText(value) {
  3401. this.value = value;
  3402. }
  3403. XmlText.prototype.toString = function () {
  3404. return escapeElement('' + this.value);
  3405. };
  3406. /**
  3407. * @api private
  3408. */
  3409. module.exports = {
  3410. XmlText: XmlText
  3411. };
  3412. /***/ }),
  3413. /* 33 */
  3414. /***/ (function(module, exports) {
  3415. /**
  3416. * Escapes characters that can not be in an XML element.
  3417. */
  3418. function escapeElement(value) {
  3419. return value.replace(/&/g, '&amp;')
  3420. .replace(/</g, '&lt;')
  3421. .replace(/>/g, '&gt;')
  3422. .replace(/\r/g, '&#x0D;')
  3423. .replace(/\n/g, '&#x0A;')
  3424. .replace(/\u0085/g, '&#x85;')
  3425. .replace(/\u2028/, '&#x2028;');
  3426. }
  3427. /**
  3428. * @api private
  3429. */
  3430. module.exports = {
  3431. escapeElement: escapeElement
  3432. };
  3433. /***/ }),
  3434. /* 34 */
  3435. /***/ (function(module, exports, __webpack_require__) {
  3436. var Collection = __webpack_require__(25);
  3437. var Operation = __webpack_require__(35);
  3438. var Shape = __webpack_require__(24);
  3439. var Paginator = __webpack_require__(36);
  3440. var ResourceWaiter = __webpack_require__(37);
  3441. var metadata = __webpack_require__(7);
  3442. var util = __webpack_require__(2);
  3443. var property = util.property;
  3444. var memoizedProperty = util.memoizedProperty;
  3445. function Api(api, options) {
  3446. var self = this;
  3447. api = api || {};
  3448. options = options || {};
  3449. options.api = this;
  3450. api.metadata = api.metadata || {};
  3451. var serviceIdentifier = options.serviceIdentifier;
  3452. delete options.serviceIdentifier;
  3453. property(this, 'isApi', true, false);
  3454. property(this, 'apiVersion', api.metadata.apiVersion);
  3455. property(this, 'endpointPrefix', api.metadata.endpointPrefix);
  3456. property(this, 'signingName', api.metadata.signingName);
  3457. property(this, 'globalEndpoint', api.metadata.globalEndpoint);
  3458. property(this, 'signatureVersion', api.metadata.signatureVersion);
  3459. property(this, 'jsonVersion', api.metadata.jsonVersion);
  3460. property(this, 'targetPrefix', api.metadata.targetPrefix);
  3461. property(this, 'protocol', api.metadata.protocol);
  3462. property(this, 'timestampFormat', api.metadata.timestampFormat);
  3463. property(this, 'xmlNamespaceUri', api.metadata.xmlNamespace);
  3464. property(this, 'abbreviation', api.metadata.serviceAbbreviation);
  3465. property(this, 'fullName', api.metadata.serviceFullName);
  3466. property(this, 'serviceId', api.metadata.serviceId);
  3467. if (serviceIdentifier && metadata[serviceIdentifier]) {
  3468. property(this, 'xmlNoDefaultLists', metadata[serviceIdentifier].xmlNoDefaultLists, false);
  3469. }
  3470. memoizedProperty(this, 'className', function() {
  3471. var name = api.metadata.serviceAbbreviation || api.metadata.serviceFullName;
  3472. if (!name) return null;
  3473. name = name.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g, '');
  3474. if (name === 'ElasticLoadBalancing') name = 'ELB';
  3475. return name;
  3476. });
  3477. function addEndpointOperation(name, operation) {
  3478. if (operation.endpointoperation === true) {
  3479. property(self, 'endpointOperation', util.string.lowerFirst(name));
  3480. }
  3481. if (operation.endpointdiscovery && !self.hasRequiredEndpointDiscovery) {
  3482. property(
  3483. self,
  3484. 'hasRequiredEndpointDiscovery',
  3485. operation.endpointdiscovery.required === true
  3486. );
  3487. }
  3488. }
  3489. property(this, 'operations', new Collection(api.operations, options, function(name, operation) {
  3490. return new Operation(name, operation, options);
  3491. }, util.string.lowerFirst, addEndpointOperation));
  3492. property(this, 'shapes', new Collection(api.shapes, options, function(name, shape) {
  3493. return Shape.create(shape, options);
  3494. }));
  3495. property(this, 'paginators', new Collection(api.paginators, options, function(name, paginator) {
  3496. return new Paginator(name, paginator, options);
  3497. }));
  3498. property(this, 'waiters', new Collection(api.waiters, options, function(name, waiter) {
  3499. return new ResourceWaiter(name, waiter, options);
  3500. }, util.string.lowerFirst));
  3501. if (options.documentation) {
  3502. property(this, 'documentation', api.documentation);
  3503. property(this, 'documentationUrl', api.documentationUrl);
  3504. }
  3505. property(this, 'awsQueryCompatible', api.metadata.awsQueryCompatible);
  3506. }
  3507. /**
  3508. * @api private
  3509. */
  3510. module.exports = Api;
  3511. /***/ }),
  3512. /* 35 */
  3513. /***/ (function(module, exports, __webpack_require__) {
  3514. var Shape = __webpack_require__(24);
  3515. var util = __webpack_require__(2);
  3516. var property = util.property;
  3517. var memoizedProperty = util.memoizedProperty;
  3518. function Operation(name, operation, options) {
  3519. var self = this;
  3520. options = options || {};
  3521. property(this, 'name', operation.name || name);
  3522. property(this, 'api', options.api, false);
  3523. operation.http = operation.http || {};
  3524. property(this, 'endpoint', operation.endpoint);
  3525. property(this, 'httpMethod', operation.http.method || 'POST');
  3526. property(this, 'httpPath', operation.http.requestUri || '/');
  3527. property(this, 'authtype', operation.authtype || '');
  3528. property(
  3529. this,
  3530. 'endpointDiscoveryRequired',
  3531. operation.endpointdiscovery ?
  3532. (operation.endpointdiscovery.required ? 'REQUIRED' : 'OPTIONAL') :
  3533. 'NULL'
  3534. );
  3535. // httpChecksum replaces usage of httpChecksumRequired, but some APIs
  3536. // (s3control) still uses old trait.
  3537. var httpChecksumRequired = operation.httpChecksumRequired
  3538. || (operation.httpChecksum && operation.httpChecksum.requestChecksumRequired);
  3539. property(this, 'httpChecksumRequired', httpChecksumRequired, false);
  3540. memoizedProperty(this, 'input', function() {
  3541. if (!operation.input) {
  3542. return new Shape.create({type: 'structure'}, options);
  3543. }
  3544. return Shape.create(operation.input, options);
  3545. });
  3546. memoizedProperty(this, 'output', function() {
  3547. if (!operation.output) {
  3548. return new Shape.create({type: 'structure'}, options);
  3549. }
  3550. return Shape.create(operation.output, options);
  3551. });
  3552. memoizedProperty(this, 'errors', function() {
  3553. var list = [];
  3554. if (!operation.errors) return null;
  3555. for (var i = 0; i < operation.errors.length; i++) {
  3556. list.push(Shape.create(operation.errors[i], options));
  3557. }
  3558. return list;
  3559. });
  3560. memoizedProperty(this, 'paginator', function() {
  3561. return options.api.paginators[name];
  3562. });
  3563. if (options.documentation) {
  3564. property(this, 'documentation', operation.documentation);
  3565. property(this, 'documentationUrl', operation.documentationUrl);
  3566. }
  3567. // idempotentMembers only tracks top-level input shapes
  3568. memoizedProperty(this, 'idempotentMembers', function() {
  3569. var idempotentMembers = [];
  3570. var input = self.input;
  3571. var members = input.members;
  3572. if (!input.members) {
  3573. return idempotentMembers;
  3574. }
  3575. for (var name in members) {
  3576. if (!members.hasOwnProperty(name)) {
  3577. continue;
  3578. }
  3579. if (members[name].isIdempotent === true) {
  3580. idempotentMembers.push(name);
  3581. }
  3582. }
  3583. return idempotentMembers;
  3584. });
  3585. memoizedProperty(this, 'hasEventOutput', function() {
  3586. var output = self.output;
  3587. return hasEventStream(output);
  3588. });
  3589. }
  3590. function hasEventStream(topLevelShape) {
  3591. var members = topLevelShape.members;
  3592. var payload = topLevelShape.payload;
  3593. if (!topLevelShape.members) {
  3594. return false;
  3595. }
  3596. if (payload) {
  3597. var payloadMember = members[payload];
  3598. return payloadMember.isEventStream;
  3599. }
  3600. // check if any member is an event stream
  3601. for (var name in members) {
  3602. if (!members.hasOwnProperty(name)) {
  3603. if (members[name].isEventStream === true) {
  3604. return true;
  3605. }
  3606. }
  3607. }
  3608. return false;
  3609. }
  3610. /**
  3611. * @api private
  3612. */
  3613. module.exports = Operation;
  3614. /***/ }),
  3615. /* 36 */
  3616. /***/ (function(module, exports, __webpack_require__) {
  3617. var property = __webpack_require__(2).property;
  3618. function Paginator(name, paginator) {
  3619. property(this, 'inputToken', paginator.input_token);
  3620. property(this, 'limitKey', paginator.limit_key);
  3621. property(this, 'moreResults', paginator.more_results);
  3622. property(this, 'outputToken', paginator.output_token);
  3623. property(this, 'resultKey', paginator.result_key);
  3624. }
  3625. /**
  3626. * @api private
  3627. */
  3628. module.exports = Paginator;
  3629. /***/ }),
  3630. /* 37 */
  3631. /***/ (function(module, exports, __webpack_require__) {
  3632. var util = __webpack_require__(2);
  3633. var property = util.property;
  3634. function ResourceWaiter(name, waiter, options) {
  3635. options = options || {};
  3636. property(this, 'name', name);
  3637. property(this, 'api', options.api, false);
  3638. if (waiter.operation) {
  3639. property(this, 'operation', util.string.lowerFirst(waiter.operation));
  3640. }
  3641. var self = this;
  3642. var keys = [
  3643. 'type',
  3644. 'description',
  3645. 'delay',
  3646. 'maxAttempts',
  3647. 'acceptors'
  3648. ];
  3649. keys.forEach(function(key) {
  3650. var value = waiter[key];
  3651. if (value) {
  3652. property(self, key, value);
  3653. }
  3654. });
  3655. }
  3656. /**
  3657. * @api private
  3658. */
  3659. module.exports = ResourceWaiter;
  3660. /***/ }),
  3661. /* 38 */
  3662. /***/ (function(module, exports) {
  3663. function apiLoader(svc, version) {
  3664. if (!apiLoader.services.hasOwnProperty(svc)) {
  3665. throw new Error('InvalidService: Failed to load api for ' + svc);
  3666. }
  3667. return apiLoader.services[svc][version];
  3668. }
  3669. /**
  3670. * @api private
  3671. *
  3672. * This member of AWS.apiLoader is private, but changing it will necessitate a
  3673. * change to ../scripts/services-table-generator.ts
  3674. */
  3675. apiLoader.services = {};
  3676. /**
  3677. * @api private
  3678. */
  3679. module.exports = apiLoader;
  3680. /***/ }),
  3681. /* 39 */
  3682. /***/ (function(module, exports, __webpack_require__) {
  3683. "use strict";
  3684. Object.defineProperty(exports, "__esModule", { value: true });
  3685. var LRU_1 = __webpack_require__(40);
  3686. var CACHE_SIZE = 1000;
  3687. /**
  3688. * Inspired node-lru-cache[https://github.com/isaacs/node-lru-cache]
  3689. */
  3690. var EndpointCache = /** @class */ (function () {
  3691. function EndpointCache(maxSize) {
  3692. if (maxSize === void 0) { maxSize = CACHE_SIZE; }
  3693. this.maxSize = maxSize;
  3694. this.cache = new LRU_1.LRUCache(maxSize);
  3695. }
  3696. ;
  3697. Object.defineProperty(EndpointCache.prototype, "size", {
  3698. get: function () {
  3699. return this.cache.length;
  3700. },
  3701. enumerable: true,
  3702. configurable: true
  3703. });
  3704. EndpointCache.prototype.put = function (key, value) {
  3705. var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;
  3706. var endpointRecord = this.populateValue(value);
  3707. this.cache.put(keyString, endpointRecord);
  3708. };
  3709. EndpointCache.prototype.get = function (key) {
  3710. var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;
  3711. var now = Date.now();
  3712. var records = this.cache.get(keyString);
  3713. if (records) {
  3714. for (var i = records.length-1; i >= 0; i--) {
  3715. var record = records[i];
  3716. if (record.Expire < now) {
  3717. records.splice(i, 1);
  3718. }
  3719. }
  3720. if (records.length === 0) {
  3721. this.cache.remove(keyString);
  3722. return undefined;
  3723. }
  3724. }
  3725. return records;
  3726. };
  3727. EndpointCache.getKeyString = function (key) {
  3728. var identifiers = [];
  3729. var identifierNames = Object.keys(key).sort();
  3730. for (var i = 0; i < identifierNames.length; i++) {
  3731. var identifierName = identifierNames[i];
  3732. if (key[identifierName] === undefined)
  3733. continue;
  3734. identifiers.push(key[identifierName]);
  3735. }
  3736. return identifiers.join(' ');
  3737. };
  3738. EndpointCache.prototype.populateValue = function (endpoints) {
  3739. var now = Date.now();
  3740. return endpoints.map(function (endpoint) { return ({
  3741. Address: endpoint.Address || '',
  3742. Expire: now + (endpoint.CachePeriodInMinutes || 1) * 60 * 1000
  3743. }); });
  3744. };
  3745. EndpointCache.prototype.empty = function () {
  3746. this.cache.empty();
  3747. };
  3748. EndpointCache.prototype.remove = function (key) {
  3749. var keyString = typeof key !== 'string' ? EndpointCache.getKeyString(key) : key;
  3750. this.cache.remove(keyString);
  3751. };
  3752. return EndpointCache;
  3753. }());
  3754. exports.EndpointCache = EndpointCache;
  3755. /***/ }),
  3756. /* 40 */
  3757. /***/ (function(module, exports) {
  3758. "use strict";
  3759. Object.defineProperty(exports, "__esModule", { value: true });
  3760. var LinkedListNode = /** @class */ (function () {
  3761. function LinkedListNode(key, value) {
  3762. this.key = key;
  3763. this.value = value;
  3764. }
  3765. return LinkedListNode;
  3766. }());
  3767. var LRUCache = /** @class */ (function () {
  3768. function LRUCache(size) {
  3769. this.nodeMap = {};
  3770. this.size = 0;
  3771. if (typeof size !== 'number' || size < 1) {
  3772. throw new Error('Cache size can only be positive number');
  3773. }
  3774. this.sizeLimit = size;
  3775. }
  3776. Object.defineProperty(LRUCache.prototype, "length", {
  3777. get: function () {
  3778. return this.size;
  3779. },
  3780. enumerable: true,
  3781. configurable: true
  3782. });
  3783. LRUCache.prototype.prependToList = function (node) {
  3784. if (!this.headerNode) {
  3785. this.tailNode = node;
  3786. }
  3787. else {
  3788. this.headerNode.prev = node;
  3789. node.next = this.headerNode;
  3790. }
  3791. this.headerNode = node;
  3792. this.size++;
  3793. };
  3794. LRUCache.prototype.removeFromTail = function () {
  3795. if (!this.tailNode) {
  3796. return undefined;
  3797. }
  3798. var node = this.tailNode;
  3799. var prevNode = node.prev;
  3800. if (prevNode) {
  3801. prevNode.next = undefined;
  3802. }
  3803. node.prev = undefined;
  3804. this.tailNode = prevNode;
  3805. this.size--;
  3806. return node;
  3807. };
  3808. LRUCache.prototype.detachFromList = function (node) {
  3809. if (this.headerNode === node) {
  3810. this.headerNode = node.next;
  3811. }
  3812. if (this.tailNode === node) {
  3813. this.tailNode = node.prev;
  3814. }
  3815. if (node.prev) {
  3816. node.prev.next = node.next;
  3817. }
  3818. if (node.next) {
  3819. node.next.prev = node.prev;
  3820. }
  3821. node.next = undefined;
  3822. node.prev = undefined;
  3823. this.size--;
  3824. };
  3825. LRUCache.prototype.get = function (key) {
  3826. if (this.nodeMap[key]) {
  3827. var node = this.nodeMap[key];
  3828. this.detachFromList(node);
  3829. this.prependToList(node);
  3830. return node.value;
  3831. }
  3832. };
  3833. LRUCache.prototype.remove = function (key) {
  3834. if (this.nodeMap[key]) {
  3835. var node = this.nodeMap[key];
  3836. this.detachFromList(node);
  3837. delete this.nodeMap[key];
  3838. }
  3839. };
  3840. LRUCache.prototype.put = function (key, value) {
  3841. if (this.nodeMap[key]) {
  3842. this.remove(key);
  3843. }
  3844. else if (this.size === this.sizeLimit) {
  3845. var tailNode = this.removeFromTail();
  3846. var key_1 = tailNode.key;
  3847. delete this.nodeMap[key_1];
  3848. }
  3849. var newNode = new LinkedListNode(key, value);
  3850. this.nodeMap[key] = newNode;
  3851. this.prependToList(newNode);
  3852. };
  3853. LRUCache.prototype.empty = function () {
  3854. var keys = Object.keys(this.nodeMap);
  3855. for (var i = 0; i < keys.length; i++) {
  3856. var key = keys[i];
  3857. var node = this.nodeMap[key];
  3858. this.detachFromList(node);
  3859. delete this.nodeMap[key];
  3860. }
  3861. };
  3862. return LRUCache;
  3863. }());
  3864. exports.LRUCache = LRUCache;
  3865. /***/ }),
  3866. /* 41 */
  3867. /***/ (function(module, exports, __webpack_require__) {
  3868. var AWS = __webpack_require__(1);
  3869. /**
  3870. * @api private
  3871. * @!method on(eventName, callback)
  3872. * Registers an event listener callback for the event given by `eventName`.
  3873. * Parameters passed to the callback function depend on the individual event
  3874. * being triggered. See the event documentation for those parameters.
  3875. *
  3876. * @param eventName [String] the event name to register the listener for
  3877. * @param callback [Function] the listener callback function
  3878. * @param toHead [Boolean] attach the listener callback to the head of callback array if set to true.
  3879. * Default to be false.
  3880. * @return [AWS.SequentialExecutor] the same object for chaining
  3881. */
  3882. AWS.SequentialExecutor = AWS.util.inherit({
  3883. constructor: function SequentialExecutor() {
  3884. this._events = {};
  3885. },
  3886. /**
  3887. * @api private
  3888. */
  3889. listeners: function listeners(eventName) {
  3890. return this._events[eventName] ? this._events[eventName].slice(0) : [];
  3891. },
  3892. on: function on(eventName, listener, toHead) {
  3893. if (this._events[eventName]) {
  3894. toHead ?
  3895. this._events[eventName].unshift(listener) :
  3896. this._events[eventName].push(listener);
  3897. } else {
  3898. this._events[eventName] = [listener];
  3899. }
  3900. return this;
  3901. },
  3902. onAsync: function onAsync(eventName, listener, toHead) {
  3903. listener._isAsync = true;
  3904. return this.on(eventName, listener, toHead);
  3905. },
  3906. removeListener: function removeListener(eventName, listener) {
  3907. var listeners = this._events[eventName];
  3908. if (listeners) {
  3909. var length = listeners.length;
  3910. var position = -1;
  3911. for (var i = 0; i < length; ++i) {
  3912. if (listeners[i] === listener) {
  3913. position = i;
  3914. }
  3915. }
  3916. if (position > -1) {
  3917. listeners.splice(position, 1);
  3918. }
  3919. }
  3920. return this;
  3921. },
  3922. removeAllListeners: function removeAllListeners(eventName) {
  3923. if (eventName) {
  3924. delete this._events[eventName];
  3925. } else {
  3926. this._events = {};
  3927. }
  3928. return this;
  3929. },
  3930. /**
  3931. * @api private
  3932. */
  3933. emit: function emit(eventName, eventArgs, doneCallback) {
  3934. if (!doneCallback) doneCallback = function() { };
  3935. var listeners = this.listeners(eventName);
  3936. var count = listeners.length;
  3937. this.callListeners(listeners, eventArgs, doneCallback);
  3938. return count > 0;
  3939. },
  3940. /**
  3941. * @api private
  3942. */
  3943. callListeners: function callListeners(listeners, args, doneCallback, prevError) {
  3944. var self = this;
  3945. var error = prevError || null;
  3946. function callNextListener(err) {
  3947. if (err) {
  3948. error = AWS.util.error(error || new Error(), err);
  3949. if (self._haltHandlersOnError) {
  3950. return doneCallback.call(self, error);
  3951. }
  3952. }
  3953. self.callListeners(listeners, args, doneCallback, error);
  3954. }
  3955. while (listeners.length > 0) {
  3956. var listener = listeners.shift();
  3957. if (listener._isAsync) { // asynchronous listener
  3958. listener.apply(self, args.concat([callNextListener]));
  3959. return; // stop here, callNextListener will continue
  3960. } else { // synchronous listener
  3961. try {
  3962. listener.apply(self, args);
  3963. } catch (err) {
  3964. error = AWS.util.error(error || new Error(), err);
  3965. }
  3966. if (error && self._haltHandlersOnError) {
  3967. doneCallback.call(self, error);
  3968. return;
  3969. }
  3970. }
  3971. }
  3972. doneCallback.call(self, error);
  3973. },
  3974. /**
  3975. * Adds or copies a set of listeners from another list of
  3976. * listeners or SequentialExecutor object.
  3977. *
  3978. * @param listeners [map<String,Array<Function>>, AWS.SequentialExecutor]
  3979. * a list of events and callbacks, or an event emitter object
  3980. * containing listeners to add to this emitter object.
  3981. * @return [AWS.SequentialExecutor] the emitter object, for chaining.
  3982. * @example Adding listeners from a map of listeners
  3983. * emitter.addListeners({
  3984. * event1: [function() { ... }, function() { ... }],
  3985. * event2: [function() { ... }]
  3986. * });
  3987. * emitter.emit('event1'); // emitter has event1
  3988. * emitter.emit('event2'); // emitter has event2
  3989. * @example Adding listeners from another emitter object
  3990. * var emitter1 = new AWS.SequentialExecutor();
  3991. * emitter1.on('event1', function() { ... });
  3992. * emitter1.on('event2', function() { ... });
  3993. * var emitter2 = new AWS.SequentialExecutor();
  3994. * emitter2.addListeners(emitter1);
  3995. * emitter2.emit('event1'); // emitter2 has event1
  3996. * emitter2.emit('event2'); // emitter2 has event2
  3997. */
  3998. addListeners: function addListeners(listeners) {
  3999. var self = this;
  4000. // extract listeners if parameter is an SequentialExecutor object
  4001. if (listeners._events) listeners = listeners._events;
  4002. AWS.util.each(listeners, function(event, callbacks) {
  4003. if (typeof callbacks === 'function') callbacks = [callbacks];
  4004. AWS.util.arrayEach(callbacks, function(callback) {
  4005. self.on(event, callback);
  4006. });
  4007. });
  4008. return self;
  4009. },
  4010. /**
  4011. * Registers an event with {on} and saves the callback handle function
  4012. * as a property on the emitter object using a given `name`.
  4013. *
  4014. * @param name [String] the property name to set on this object containing
  4015. * the callback function handle so that the listener can be removed in
  4016. * the future.
  4017. * @param (see on)
  4018. * @return (see on)
  4019. * @example Adding a named listener DATA_CALLBACK
  4020. * var listener = function() { doSomething(); };
  4021. * emitter.addNamedListener('DATA_CALLBACK', 'data', listener);
  4022. *
  4023. * // the following prints: true
  4024. * console.log(emitter.DATA_CALLBACK == listener);
  4025. */
  4026. addNamedListener: function addNamedListener(name, eventName, callback, toHead) {
  4027. this[name] = callback;
  4028. this.addListener(eventName, callback, toHead);
  4029. return this;
  4030. },
  4031. /**
  4032. * @api private
  4033. */
  4034. addNamedAsyncListener: function addNamedAsyncListener(name, eventName, callback, toHead) {
  4035. callback._isAsync = true;
  4036. return this.addNamedListener(name, eventName, callback, toHead);
  4037. },
  4038. /**
  4039. * Helper method to add a set of named listeners using
  4040. * {addNamedListener}. The callback contains a parameter
  4041. * with a handle to the `addNamedListener` method.
  4042. *
  4043. * @callback callback function(add)
  4044. * The callback function is called immediately in order to provide
  4045. * the `add` function to the block. This simplifies the addition of
  4046. * a large group of named listeners.
  4047. * @param add [Function] the {addNamedListener} function to call
  4048. * when registering listeners.
  4049. * @example Adding a set of named listeners
  4050. * emitter.addNamedListeners(function(add) {
  4051. * add('DATA_CALLBACK', 'data', function() { ... });
  4052. * add('OTHER', 'otherEvent', function() { ... });
  4053. * add('LAST', 'lastEvent', function() { ... });
  4054. * });
  4055. *
  4056. * // these properties are now set:
  4057. * emitter.DATA_CALLBACK;
  4058. * emitter.OTHER;
  4059. * emitter.LAST;
  4060. */
  4061. addNamedListeners: function addNamedListeners(callback) {
  4062. var self = this;
  4063. callback(
  4064. function() {
  4065. self.addNamedListener.apply(self, arguments);
  4066. },
  4067. function() {
  4068. self.addNamedAsyncListener.apply(self, arguments);
  4069. }
  4070. );
  4071. return this;
  4072. }
  4073. });
  4074. /**
  4075. * {on} is the prefered method.
  4076. * @api private
  4077. */
  4078. AWS.SequentialExecutor.prototype.addListener = AWS.SequentialExecutor.prototype.on;
  4079. /**
  4080. * @api private
  4081. */
  4082. module.exports = AWS.SequentialExecutor;
  4083. /***/ }),
  4084. /* 42 */
  4085. /***/ (function(module, exports, __webpack_require__) {
  4086. /* WEBPACK VAR INJECTION */(function(process) {var AWS = __webpack_require__(1);
  4087. var Api = __webpack_require__(34);
  4088. var regionConfig = __webpack_require__(43);
  4089. var inherit = AWS.util.inherit;
  4090. var clientCount = 0;
  4091. var region_utils = __webpack_require__(45);
  4092. /**
  4093. * The service class representing an AWS service.
  4094. *
  4095. * @class_abstract This class is an abstract class.
  4096. *
  4097. * @!attribute apiVersions
  4098. * @return [Array<String>] the list of API versions supported by this service.
  4099. * @readonly
  4100. */
  4101. AWS.Service = inherit({
  4102. /**
  4103. * Create a new service object with a configuration object
  4104. *
  4105. * @param config [map] a map of configuration options
  4106. */
  4107. constructor: function Service(config) {
  4108. if (!this.loadServiceClass) {
  4109. throw AWS.util.error(new Error(),
  4110. 'Service must be constructed with `new\' operator');
  4111. }
  4112. if (config) {
  4113. if (config.region) {
  4114. var region = config.region;
  4115. if (region_utils.isFipsRegion(region)) {
  4116. config.region = region_utils.getRealRegion(region);
  4117. config.useFipsEndpoint = true;
  4118. }
  4119. if (region_utils.isGlobalRegion(region)) {
  4120. config.region = region_utils.getRealRegion(region);
  4121. }
  4122. }
  4123. if (typeof config.useDualstack === 'boolean'
  4124. && typeof config.useDualstackEndpoint !== 'boolean') {
  4125. config.useDualstackEndpoint = config.useDualstack;
  4126. }
  4127. }
  4128. var ServiceClass = this.loadServiceClass(config || {});
  4129. if (ServiceClass) {
  4130. var originalConfig = AWS.util.copy(config);
  4131. var svc = new ServiceClass(config);
  4132. Object.defineProperty(svc, '_originalConfig', {
  4133. get: function() { return originalConfig; },
  4134. enumerable: false,
  4135. configurable: true
  4136. });
  4137. svc._clientId = ++clientCount;
  4138. return svc;
  4139. }
  4140. this.initialize(config);
  4141. },
  4142. /**
  4143. * @api private
  4144. */
  4145. initialize: function initialize(config) {
  4146. var svcConfig = AWS.config[this.serviceIdentifier];
  4147. this.config = new AWS.Config(AWS.config);
  4148. if (svcConfig) this.config.update(svcConfig, true);
  4149. if (config) this.config.update(config, true);
  4150. this.validateService();
  4151. if (!this.config.endpoint) regionConfig.configureEndpoint(this);
  4152. this.config.endpoint = this.endpointFromTemplate(this.config.endpoint);
  4153. this.setEndpoint(this.config.endpoint);
  4154. //enable attaching listeners to service client
  4155. AWS.SequentialExecutor.call(this);
  4156. AWS.Service.addDefaultMonitoringListeners(this);
  4157. if ((this.config.clientSideMonitoring || AWS.Service._clientSideMonitoring) && this.publisher) {
  4158. var publisher = this.publisher;
  4159. this.addNamedListener('PUBLISH_API_CALL', 'apiCall', function PUBLISH_API_CALL(event) {
  4160. process.nextTick(function() {publisher.eventHandler(event);});
  4161. });
  4162. this.addNamedListener('PUBLISH_API_ATTEMPT', 'apiCallAttempt', function PUBLISH_API_ATTEMPT(event) {
  4163. process.nextTick(function() {publisher.eventHandler(event);});
  4164. });
  4165. }
  4166. },
  4167. /**
  4168. * @api private
  4169. */
  4170. validateService: function validateService() {
  4171. },
  4172. /**
  4173. * @api private
  4174. */
  4175. loadServiceClass: function loadServiceClass(serviceConfig) {
  4176. var config = serviceConfig;
  4177. if (!AWS.util.isEmpty(this.api)) {
  4178. return null;
  4179. } else if (config.apiConfig) {
  4180. return AWS.Service.defineServiceApi(this.constructor, config.apiConfig);
  4181. } else if (!this.constructor.services) {
  4182. return null;
  4183. } else {
  4184. config = new AWS.Config(AWS.config);
  4185. config.update(serviceConfig, true);
  4186. var version = config.apiVersions[this.constructor.serviceIdentifier];
  4187. version = version || config.apiVersion;
  4188. return this.getLatestServiceClass(version);
  4189. }
  4190. },
  4191. /**
  4192. * @api private
  4193. */
  4194. getLatestServiceClass: function getLatestServiceClass(version) {
  4195. version = this.getLatestServiceVersion(version);
  4196. if (this.constructor.services[version] === null) {
  4197. AWS.Service.defineServiceApi(this.constructor, version);
  4198. }
  4199. return this.constructor.services[version];
  4200. },
  4201. /**
  4202. * @api private
  4203. */
  4204. getLatestServiceVersion: function getLatestServiceVersion(version) {
  4205. if (!this.constructor.services || this.constructor.services.length === 0) {
  4206. throw new Error('No services defined on ' +
  4207. this.constructor.serviceIdentifier);
  4208. }
  4209. if (!version) {
  4210. version = 'latest';
  4211. } else if (AWS.util.isType(version, Date)) {
  4212. version = AWS.util.date.iso8601(version).split('T')[0];
  4213. }
  4214. if (Object.hasOwnProperty(this.constructor.services, version)) {
  4215. return version;
  4216. }
  4217. var keys = Object.keys(this.constructor.services).sort();
  4218. var selectedVersion = null;
  4219. for (var i = keys.length - 1; i >= 0; i--) {
  4220. // versions that end in "*" are not available on disk and can be
  4221. // skipped, so do not choose these as selectedVersions
  4222. if (keys[i][keys[i].length - 1] !== '*') {
  4223. selectedVersion = keys[i];
  4224. }
  4225. if (keys[i].substr(0, 10) <= version) {
  4226. return selectedVersion;
  4227. }
  4228. }
  4229. throw new Error('Could not find ' + this.constructor.serviceIdentifier +
  4230. ' API to satisfy version constraint `' + version + '\'');
  4231. },
  4232. /**
  4233. * @api private
  4234. */
  4235. api: {},
  4236. /**
  4237. * @api private
  4238. */
  4239. defaultRetryCount: 3,
  4240. /**
  4241. * @api private
  4242. */
  4243. customizeRequests: function customizeRequests(callback) {
  4244. if (!callback) {
  4245. this.customRequestHandler = null;
  4246. } else if (typeof callback === 'function') {
  4247. this.customRequestHandler = callback;
  4248. } else {
  4249. throw new Error('Invalid callback type \'' + typeof callback + '\' provided in customizeRequests');
  4250. }
  4251. },
  4252. /**
  4253. * Calls an operation on a service with the given input parameters.
  4254. *
  4255. * @param operation [String] the name of the operation to call on the service.
  4256. * @param params [map] a map of input options for the operation
  4257. * @callback callback function(err, data)
  4258. * If a callback is supplied, it is called when a response is returned
  4259. * from the service.
  4260. * @param err [Error] the error object returned from the request.
  4261. * Set to `null` if the request is successful.
  4262. * @param data [Object] the de-serialized data returned from
  4263. * the request. Set to `null` if a request error occurs.
  4264. */
  4265. makeRequest: function makeRequest(operation, params, callback) {
  4266. if (typeof params === 'function') {
  4267. callback = params;
  4268. params = null;
  4269. }
  4270. params = params || {};
  4271. if (this.config.params) { // copy only toplevel bound params
  4272. var rules = this.api.operations[operation];
  4273. if (rules) {
  4274. params = AWS.util.copy(params);
  4275. AWS.util.each(this.config.params, function(key, value) {
  4276. if (rules.input.members[key]) {
  4277. if (params[key] === undefined || params[key] === null) {
  4278. params[key] = value;
  4279. }
  4280. }
  4281. });
  4282. }
  4283. }
  4284. var request = new AWS.Request(this, operation, params);
  4285. this.addAllRequestListeners(request);
  4286. this.attachMonitoringEmitter(request);
  4287. if (callback) request.send(callback);
  4288. return request;
  4289. },
  4290. /**
  4291. * Calls an operation on a service with the given input parameters, without
  4292. * any authentication data. This method is useful for "public" API operations.
  4293. *
  4294. * @param operation [String] the name of the operation to call on the service.
  4295. * @param params [map] a map of input options for the operation
  4296. * @callback callback function(err, data)
  4297. * If a callback is supplied, it is called when a response is returned
  4298. * from the service.
  4299. * @param err [Error] the error object returned from the request.
  4300. * Set to `null` if the request is successful.
  4301. * @param data [Object] the de-serialized data returned from
  4302. * the request. Set to `null` if a request error occurs.
  4303. */
  4304. makeUnauthenticatedRequest: function makeUnauthenticatedRequest(operation, params, callback) {
  4305. if (typeof params === 'function') {
  4306. callback = params;
  4307. params = {};
  4308. }
  4309. var request = this.makeRequest(operation, params).toUnauthenticated();
  4310. return callback ? request.send(callback) : request;
  4311. },
  4312. /**
  4313. * Waits for a given state
  4314. *
  4315. * @param state [String] the state on the service to wait for
  4316. * @param params [map] a map of parameters to pass with each request
  4317. * @option params $waiter [map] a map of configuration options for the waiter
  4318. * @option params $waiter.delay [Number] The number of seconds to wait between
  4319. * requests
  4320. * @option params $waiter.maxAttempts [Number] The maximum number of requests
  4321. * to send while waiting
  4322. * @callback callback function(err, data)
  4323. * If a callback is supplied, it is called when a response is returned
  4324. * from the service.
  4325. * @param err [Error] the error object returned from the request.
  4326. * Set to `null` if the request is successful.
  4327. * @param data [Object] the de-serialized data returned from
  4328. * the request. Set to `null` if a request error occurs.
  4329. */
  4330. waitFor: function waitFor(state, params, callback) {
  4331. var waiter = new AWS.ResourceWaiter(this, state);
  4332. return waiter.wait(params, callback);
  4333. },
  4334. /**
  4335. * @api private
  4336. */
  4337. addAllRequestListeners: function addAllRequestListeners(request) {
  4338. var list = [AWS.events, AWS.EventListeners.Core, this.serviceInterface(),
  4339. AWS.EventListeners.CorePost];
  4340. for (var i = 0; i < list.length; i++) {
  4341. if (list[i]) request.addListeners(list[i]);
  4342. }
  4343. // disable parameter validation
  4344. if (!this.config.paramValidation) {
  4345. request.removeListener('validate',
  4346. AWS.EventListeners.Core.VALIDATE_PARAMETERS);
  4347. }
  4348. if (this.config.logger) { // add logging events
  4349. request.addListeners(AWS.EventListeners.Logger);
  4350. }
  4351. this.setupRequestListeners(request);
  4352. // call prototype's customRequestHandler
  4353. if (typeof this.constructor.prototype.customRequestHandler === 'function') {
  4354. this.constructor.prototype.customRequestHandler(request);
  4355. }
  4356. // call instance's customRequestHandler
  4357. if (Object.prototype.hasOwnProperty.call(this, 'customRequestHandler') && typeof this.customRequestHandler === 'function') {
  4358. this.customRequestHandler(request);
  4359. }
  4360. },
  4361. /**
  4362. * Event recording metrics for a whole API call.
  4363. * @returns {object} a subset of api call metrics
  4364. * @api private
  4365. */
  4366. apiCallEvent: function apiCallEvent(request) {
  4367. var api = request.service.api.operations[request.operation];
  4368. var monitoringEvent = {
  4369. Type: 'ApiCall',
  4370. Api: api ? api.name : request.operation,
  4371. Version: 1,
  4372. Service: request.service.api.serviceId || request.service.api.endpointPrefix,
  4373. Region: request.httpRequest.region,
  4374. MaxRetriesExceeded: 0,
  4375. UserAgent: request.httpRequest.getUserAgent(),
  4376. };
  4377. var response = request.response;
  4378. if (response.httpResponse.statusCode) {
  4379. monitoringEvent.FinalHttpStatusCode = response.httpResponse.statusCode;
  4380. }
  4381. if (response.error) {
  4382. var error = response.error;
  4383. var statusCode = response.httpResponse.statusCode;
  4384. if (statusCode > 299) {
  4385. if (error.code) monitoringEvent.FinalAwsException = error.code;
  4386. if (error.message) monitoringEvent.FinalAwsExceptionMessage = error.message;
  4387. } else {
  4388. if (error.code || error.name) monitoringEvent.FinalSdkException = error.code || error.name;
  4389. if (error.message) monitoringEvent.FinalSdkExceptionMessage = error.message;
  4390. }
  4391. }
  4392. return monitoringEvent;
  4393. },
  4394. /**
  4395. * Event recording metrics for an API call attempt.
  4396. * @returns {object} a subset of api call attempt metrics
  4397. * @api private
  4398. */
  4399. apiAttemptEvent: function apiAttemptEvent(request) {
  4400. var api = request.service.api.operations[request.operation];
  4401. var monitoringEvent = {
  4402. Type: 'ApiCallAttempt',
  4403. Api: api ? api.name : request.operation,
  4404. Version: 1,
  4405. Service: request.service.api.serviceId || request.service.api.endpointPrefix,
  4406. Fqdn: request.httpRequest.endpoint.hostname,
  4407. UserAgent: request.httpRequest.getUserAgent(),
  4408. };
  4409. var response = request.response;
  4410. if (response.httpResponse.statusCode) {
  4411. monitoringEvent.HttpStatusCode = response.httpResponse.statusCode;
  4412. }
  4413. if (
  4414. !request._unAuthenticated &&
  4415. request.service.config.credentials &&
  4416. request.service.config.credentials.accessKeyId
  4417. ) {
  4418. monitoringEvent.AccessKey = request.service.config.credentials.accessKeyId;
  4419. }
  4420. if (!response.httpResponse.headers) return monitoringEvent;
  4421. if (request.httpRequest.headers['x-amz-security-token']) {
  4422. monitoringEvent.SessionToken = request.httpRequest.headers['x-amz-security-token'];
  4423. }
  4424. if (response.httpResponse.headers['x-amzn-requestid']) {
  4425. monitoringEvent.XAmznRequestId = response.httpResponse.headers['x-amzn-requestid'];
  4426. }
  4427. if (response.httpResponse.headers['x-amz-request-id']) {
  4428. monitoringEvent.XAmzRequestId = response.httpResponse.headers['x-amz-request-id'];
  4429. }
  4430. if (response.httpResponse.headers['x-amz-id-2']) {
  4431. monitoringEvent.XAmzId2 = response.httpResponse.headers['x-amz-id-2'];
  4432. }
  4433. return monitoringEvent;
  4434. },
  4435. /**
  4436. * Add metrics of failed request.
  4437. * @api private
  4438. */
  4439. attemptFailEvent: function attemptFailEvent(request) {
  4440. var monitoringEvent = this.apiAttemptEvent(request);
  4441. var response = request.response;
  4442. var error = response.error;
  4443. if (response.httpResponse.statusCode > 299 ) {
  4444. if (error.code) monitoringEvent.AwsException = error.code;
  4445. if (error.message) monitoringEvent.AwsExceptionMessage = error.message;
  4446. } else {
  4447. if (error.code || error.name) monitoringEvent.SdkException = error.code || error.name;
  4448. if (error.message) monitoringEvent.SdkExceptionMessage = error.message;
  4449. }
  4450. return monitoringEvent;
  4451. },
  4452. /**
  4453. * Attach listeners to request object to fetch metrics of each request
  4454. * and emit data object through \'ApiCall\' and \'ApiCallAttempt\' events.
  4455. * @api private
  4456. */
  4457. attachMonitoringEmitter: function attachMonitoringEmitter(request) {
  4458. var attemptTimestamp; //timestamp marking the beginning of a request attempt
  4459. var attemptStartRealTime; //Start time of request attempt. Used to calculating attemptLatency
  4460. var attemptLatency; //latency from request sent out to http response reaching SDK
  4461. var callStartRealTime; //Start time of API call. Used to calculating API call latency
  4462. var attemptCount = 0; //request.retryCount is not reliable here
  4463. var region; //region cache region for each attempt since it can be updated in plase (e.g. s3)
  4464. var callTimestamp; //timestamp when the request is created
  4465. var self = this;
  4466. var addToHead = true;
  4467. request.on('validate', function () {
  4468. callStartRealTime = AWS.util.realClock.now();
  4469. callTimestamp = Date.now();
  4470. }, addToHead);
  4471. request.on('sign', function () {
  4472. attemptStartRealTime = AWS.util.realClock.now();
  4473. attemptTimestamp = Date.now();
  4474. region = request.httpRequest.region;
  4475. attemptCount++;
  4476. }, addToHead);
  4477. request.on('validateResponse', function() {
  4478. attemptLatency = Math.round(AWS.util.realClock.now() - attemptStartRealTime);
  4479. });
  4480. request.addNamedListener('API_CALL_ATTEMPT', 'success', function API_CALL_ATTEMPT() {
  4481. var apiAttemptEvent = self.apiAttemptEvent(request);
  4482. apiAttemptEvent.Timestamp = attemptTimestamp;
  4483. apiAttemptEvent.AttemptLatency = attemptLatency >= 0 ? attemptLatency : 0;
  4484. apiAttemptEvent.Region = region;
  4485. self.emit('apiCallAttempt', [apiAttemptEvent]);
  4486. });
  4487. request.addNamedListener('API_CALL_ATTEMPT_RETRY', 'retry', function API_CALL_ATTEMPT_RETRY() {
  4488. var apiAttemptEvent = self.attemptFailEvent(request);
  4489. apiAttemptEvent.Timestamp = attemptTimestamp;
  4490. //attemptLatency may not be available if fail before response
  4491. attemptLatency = attemptLatency ||
  4492. Math.round(AWS.util.realClock.now() - attemptStartRealTime);
  4493. apiAttemptEvent.AttemptLatency = attemptLatency >= 0 ? attemptLatency : 0;
  4494. apiAttemptEvent.Region = region;
  4495. self.emit('apiCallAttempt', [apiAttemptEvent]);
  4496. });
  4497. request.addNamedListener('API_CALL', 'complete', function API_CALL() {
  4498. var apiCallEvent = self.apiCallEvent(request);
  4499. apiCallEvent.AttemptCount = attemptCount;
  4500. if (apiCallEvent.AttemptCount <= 0) return;
  4501. apiCallEvent.Timestamp = callTimestamp;
  4502. var latency = Math.round(AWS.util.realClock.now() - callStartRealTime);
  4503. apiCallEvent.Latency = latency >= 0 ? latency : 0;
  4504. var response = request.response;
  4505. if (
  4506. response.error &&
  4507. response.error.retryable &&
  4508. typeof response.retryCount === 'number' &&
  4509. typeof response.maxRetries === 'number' &&
  4510. (response.retryCount >= response.maxRetries)
  4511. ) {
  4512. apiCallEvent.MaxRetriesExceeded = 1;
  4513. }
  4514. self.emit('apiCall', [apiCallEvent]);
  4515. });
  4516. },
  4517. /**
  4518. * Override this method to setup any custom request listeners for each
  4519. * new request to the service.
  4520. *
  4521. * @method_abstract This is an abstract method.
  4522. */
  4523. setupRequestListeners: function setupRequestListeners(request) {
  4524. },
  4525. /**
  4526. * Gets the signing name for a given request
  4527. * @api private
  4528. */
  4529. getSigningName: function getSigningName() {
  4530. return this.api.signingName || this.api.endpointPrefix;
  4531. },
  4532. /**
  4533. * Gets the signer class for a given request
  4534. * @api private
  4535. */
  4536. getSignerClass: function getSignerClass(request) {
  4537. var version;
  4538. // get operation authtype if present
  4539. var operation = null;
  4540. var authtype = '';
  4541. if (request) {
  4542. var operations = request.service.api.operations || {};
  4543. operation = operations[request.operation] || null;
  4544. authtype = operation ? operation.authtype : '';
  4545. }
  4546. if (this.config.signatureVersion) {
  4547. version = this.config.signatureVersion;
  4548. } else if (authtype === 'v4' || authtype === 'v4-unsigned-body') {
  4549. version = 'v4';
  4550. } else if (authtype === 'bearer') {
  4551. version = 'bearer';
  4552. } else {
  4553. version = this.api.signatureVersion;
  4554. }
  4555. return AWS.Signers.RequestSigner.getVersion(version);
  4556. },
  4557. /**
  4558. * @api private
  4559. */
  4560. serviceInterface: function serviceInterface() {
  4561. switch (this.api.protocol) {
  4562. case 'ec2': return AWS.EventListeners.Query;
  4563. case 'query': return AWS.EventListeners.Query;
  4564. case 'json': return AWS.EventListeners.Json;
  4565. case 'rest-json': return AWS.EventListeners.RestJson;
  4566. case 'rest-xml': return AWS.EventListeners.RestXml;
  4567. }
  4568. if (this.api.protocol) {
  4569. throw new Error('Invalid service `protocol\' ' +
  4570. this.api.protocol + ' in API config');
  4571. }
  4572. },
  4573. /**
  4574. * @api private
  4575. */
  4576. successfulResponse: function successfulResponse(resp) {
  4577. return resp.httpResponse.statusCode < 300;
  4578. },
  4579. /**
  4580. * How many times a failed request should be retried before giving up.
  4581. * the defaultRetryCount can be overriden by service classes.
  4582. *
  4583. * @api private
  4584. */
  4585. numRetries: function numRetries() {
  4586. if (this.config.maxRetries !== undefined) {
  4587. return this.config.maxRetries;
  4588. } else {
  4589. return this.defaultRetryCount;
  4590. }
  4591. },
  4592. /**
  4593. * @api private
  4594. */
  4595. retryDelays: function retryDelays(retryCount, err) {
  4596. return AWS.util.calculateRetryDelay(retryCount, this.config.retryDelayOptions, err);
  4597. },
  4598. /**
  4599. * @api private
  4600. */
  4601. retryableError: function retryableError(error) {
  4602. if (this.timeoutError(error)) return true;
  4603. if (this.networkingError(error)) return true;
  4604. if (this.expiredCredentialsError(error)) return true;
  4605. if (this.throttledError(error)) return true;
  4606. if (error.statusCode >= 500) return true;
  4607. return false;
  4608. },
  4609. /**
  4610. * @api private
  4611. */
  4612. networkingError: function networkingError(error) {
  4613. return error.code === 'NetworkingError';
  4614. },
  4615. /**
  4616. * @api private
  4617. */
  4618. timeoutError: function timeoutError(error) {
  4619. return error.code === 'TimeoutError';
  4620. },
  4621. /**
  4622. * @api private
  4623. */
  4624. expiredCredentialsError: function expiredCredentialsError(error) {
  4625. // TODO : this only handles *one* of the expired credential codes
  4626. return (error.code === 'ExpiredTokenException');
  4627. },
  4628. /**
  4629. * @api private
  4630. */
  4631. clockSkewError: function clockSkewError(error) {
  4632. switch (error.code) {
  4633. case 'RequestTimeTooSkewed':
  4634. case 'RequestExpired':
  4635. case 'InvalidSignatureException':
  4636. case 'SignatureDoesNotMatch':
  4637. case 'AuthFailure':
  4638. case 'RequestInTheFuture':
  4639. return true;
  4640. default: return false;
  4641. }
  4642. },
  4643. /**
  4644. * @api private
  4645. */
  4646. getSkewCorrectedDate: function getSkewCorrectedDate() {
  4647. return new Date(Date.now() + this.config.systemClockOffset);
  4648. },
  4649. /**
  4650. * @api private
  4651. */
  4652. applyClockOffset: function applyClockOffset(newServerTime) {
  4653. if (newServerTime) {
  4654. this.config.systemClockOffset = newServerTime - Date.now();
  4655. }
  4656. },
  4657. /**
  4658. * @api private
  4659. */
  4660. isClockSkewed: function isClockSkewed(newServerTime) {
  4661. if (newServerTime) {
  4662. return Math.abs(this.getSkewCorrectedDate().getTime() - newServerTime) >= 300000;
  4663. }
  4664. },
  4665. /**
  4666. * @api private
  4667. */
  4668. throttledError: function throttledError(error) {
  4669. // this logic varies between services
  4670. if (error.statusCode === 429) return true;
  4671. switch (error.code) {
  4672. case 'ProvisionedThroughputExceededException':
  4673. case 'Throttling':
  4674. case 'ThrottlingException':
  4675. case 'RequestLimitExceeded':
  4676. case 'RequestThrottled':
  4677. case 'RequestThrottledException':
  4678. case 'TooManyRequestsException':
  4679. case 'TransactionInProgressException': //dynamodb
  4680. case 'EC2ThrottledException':
  4681. return true;
  4682. default:
  4683. return false;
  4684. }
  4685. },
  4686. /**
  4687. * @api private
  4688. */
  4689. endpointFromTemplate: function endpointFromTemplate(endpoint) {
  4690. if (typeof endpoint !== 'string') return endpoint;
  4691. var e = endpoint;
  4692. e = e.replace(/\{service\}/g, this.api.endpointPrefix);
  4693. e = e.replace(/\{region\}/g, this.config.region);
  4694. e = e.replace(/\{scheme\}/g, this.config.sslEnabled ? 'https' : 'http');
  4695. return e;
  4696. },
  4697. /**
  4698. * @api private
  4699. */
  4700. setEndpoint: function setEndpoint(endpoint) {
  4701. this.endpoint = new AWS.Endpoint(endpoint, this.config);
  4702. },
  4703. /**
  4704. * @api private
  4705. */
  4706. paginationConfig: function paginationConfig(operation, throwException) {
  4707. var paginator = this.api.operations[operation].paginator;
  4708. if (!paginator) {
  4709. if (throwException) {
  4710. var e = new Error();
  4711. throw AWS.util.error(e, 'No pagination configuration for ' + operation);
  4712. }
  4713. return null;
  4714. }
  4715. return paginator;
  4716. }
  4717. });
  4718. AWS.util.update(AWS.Service, {
  4719. /**
  4720. * Adds one method for each operation described in the api configuration
  4721. *
  4722. * @api private
  4723. */
  4724. defineMethods: function defineMethods(svc) {
  4725. AWS.util.each(svc.prototype.api.operations, function iterator(method) {
  4726. if (svc.prototype[method]) return;
  4727. var operation = svc.prototype.api.operations[method];
  4728. if (operation.authtype === 'none') {
  4729. svc.prototype[method] = function (params, callback) {
  4730. return this.makeUnauthenticatedRequest(method, params, callback);
  4731. };
  4732. } else {
  4733. svc.prototype[method] = function (params, callback) {
  4734. return this.makeRequest(method, params, callback);
  4735. };
  4736. }
  4737. });
  4738. },
  4739. /**
  4740. * Defines a new Service class using a service identifier and list of versions
  4741. * including an optional set of features (functions) to apply to the class
  4742. * prototype.
  4743. *
  4744. * @param serviceIdentifier [String] the identifier for the service
  4745. * @param versions [Array<String>] a list of versions that work with this
  4746. * service
  4747. * @param features [Object] an object to attach to the prototype
  4748. * @return [Class<Service>] the service class defined by this function.
  4749. */
  4750. defineService: function defineService(serviceIdentifier, versions, features) {
  4751. AWS.Service._serviceMap[serviceIdentifier] = true;
  4752. if (!Array.isArray(versions)) {
  4753. features = versions;
  4754. versions = [];
  4755. }
  4756. var svc = inherit(AWS.Service, features || {});
  4757. if (typeof serviceIdentifier === 'string') {
  4758. AWS.Service.addVersions(svc, versions);
  4759. var identifier = svc.serviceIdentifier || serviceIdentifier;
  4760. svc.serviceIdentifier = identifier;
  4761. } else { // defineService called with an API
  4762. svc.prototype.api = serviceIdentifier;
  4763. AWS.Service.defineMethods(svc);
  4764. }
  4765. AWS.SequentialExecutor.call(this.prototype);
  4766. //util.clientSideMonitoring is only available in node
  4767. if (!this.prototype.publisher && AWS.util.clientSideMonitoring) {
  4768. var Publisher = AWS.util.clientSideMonitoring.Publisher;
  4769. var configProvider = AWS.util.clientSideMonitoring.configProvider;
  4770. var publisherConfig = configProvider();
  4771. this.prototype.publisher = new Publisher(publisherConfig);
  4772. if (publisherConfig.enabled) {
  4773. //if csm is enabled in environment, SDK should send all metrics
  4774. AWS.Service._clientSideMonitoring = true;
  4775. }
  4776. }
  4777. AWS.SequentialExecutor.call(svc.prototype);
  4778. AWS.Service.addDefaultMonitoringListeners(svc.prototype);
  4779. return svc;
  4780. },
  4781. /**
  4782. * @api private
  4783. */
  4784. addVersions: function addVersions(svc, versions) {
  4785. if (!Array.isArray(versions)) versions = [versions];
  4786. svc.services = svc.services || {};
  4787. for (var i = 0; i < versions.length; i++) {
  4788. if (svc.services[versions[i]] === undefined) {
  4789. svc.services[versions[i]] = null;
  4790. }
  4791. }
  4792. svc.apiVersions = Object.keys(svc.services).sort();
  4793. },
  4794. /**
  4795. * @api private
  4796. */
  4797. defineServiceApi: function defineServiceApi(superclass, version, apiConfig) {
  4798. var svc = inherit(superclass, {
  4799. serviceIdentifier: superclass.serviceIdentifier
  4800. });
  4801. function setApi(api) {
  4802. if (api.isApi) {
  4803. svc.prototype.api = api;
  4804. } else {
  4805. svc.prototype.api = new Api(api, {
  4806. serviceIdentifier: superclass.serviceIdentifier
  4807. });
  4808. }
  4809. }
  4810. if (typeof version === 'string') {
  4811. if (apiConfig) {
  4812. setApi(apiConfig);
  4813. } else {
  4814. try {
  4815. setApi(AWS.apiLoader(superclass.serviceIdentifier, version));
  4816. } catch (err) {
  4817. throw AWS.util.error(err, {
  4818. message: 'Could not find API configuration ' +
  4819. superclass.serviceIdentifier + '-' + version
  4820. });
  4821. }
  4822. }
  4823. if (!Object.prototype.hasOwnProperty.call(superclass.services, version)) {
  4824. superclass.apiVersions = superclass.apiVersions.concat(version).sort();
  4825. }
  4826. superclass.services[version] = svc;
  4827. } else {
  4828. setApi(version);
  4829. }
  4830. AWS.Service.defineMethods(svc);
  4831. return svc;
  4832. },
  4833. /**
  4834. * @api private
  4835. */
  4836. hasService: function(identifier) {
  4837. return Object.prototype.hasOwnProperty.call(AWS.Service._serviceMap, identifier);
  4838. },
  4839. /**
  4840. * @param attachOn attach default monitoring listeners to object
  4841. *
  4842. * Each monitoring event should be emitted from service client to service constructor prototype and then
  4843. * to global service prototype like bubbling up. These default monitoring events listener will transfer
  4844. * the monitoring events to the upper layer.
  4845. * @api private
  4846. */
  4847. addDefaultMonitoringListeners: function addDefaultMonitoringListeners(attachOn) {
  4848. attachOn.addNamedListener('MONITOR_EVENTS_BUBBLE', 'apiCallAttempt', function EVENTS_BUBBLE(event) {
  4849. var baseClass = Object.getPrototypeOf(attachOn);
  4850. if (baseClass._events) baseClass.emit('apiCallAttempt', [event]);
  4851. });
  4852. attachOn.addNamedListener('CALL_EVENTS_BUBBLE', 'apiCall', function CALL_EVENTS_BUBBLE(event) {
  4853. var baseClass = Object.getPrototypeOf(attachOn);
  4854. if (baseClass._events) baseClass.emit('apiCall', [event]);
  4855. });
  4856. },
  4857. /**
  4858. * @api private
  4859. */
  4860. _serviceMap: {}
  4861. });
  4862. AWS.util.mixin(AWS.Service, AWS.SequentialExecutor);
  4863. /**
  4864. * @api private
  4865. */
  4866. module.exports = AWS.Service;
  4867. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  4868. /***/ }),
  4869. /* 43 */
  4870. /***/ (function(module, exports, __webpack_require__) {
  4871. var util = __webpack_require__(2);
  4872. var regionConfig = __webpack_require__(44);
  4873. function generateRegionPrefix(region) {
  4874. if (!region) return null;
  4875. var parts = region.split('-');
  4876. if (parts.length < 3) return null;
  4877. return parts.slice(0, parts.length - 2).join('-') + '-*';
  4878. }
  4879. function derivedKeys(service) {
  4880. var region = service.config.region;
  4881. var regionPrefix = generateRegionPrefix(region);
  4882. var endpointPrefix = service.api.endpointPrefix;
  4883. return [
  4884. [region, endpointPrefix],
  4885. [regionPrefix, endpointPrefix],
  4886. [region, '*'],
  4887. [regionPrefix, '*'],
  4888. ['*', endpointPrefix],
  4889. [region, 'internal-*'],
  4890. ['*', '*']
  4891. ].map(function(item) {
  4892. return item[0] && item[1] ? item.join('/') : null;
  4893. });
  4894. }
  4895. function applyConfig(service, config) {
  4896. util.each(config, function(key, value) {
  4897. if (key === 'globalEndpoint') return;
  4898. if (service.config[key] === undefined || service.config[key] === null) {
  4899. service.config[key] = value;
  4900. }
  4901. });
  4902. }
  4903. function configureEndpoint(service) {
  4904. var keys = derivedKeys(service);
  4905. var useFipsEndpoint = service.config.useFipsEndpoint;
  4906. var useDualstackEndpoint = service.config.useDualstackEndpoint;
  4907. for (var i = 0; i < keys.length; i++) {
  4908. var key = keys[i];
  4909. if (!key) continue;
  4910. var rules = useFipsEndpoint
  4911. ? useDualstackEndpoint
  4912. ? regionConfig.dualstackFipsRules
  4913. : regionConfig.fipsRules
  4914. : useDualstackEndpoint
  4915. ? regionConfig.dualstackRules
  4916. : regionConfig.rules;
  4917. if (Object.prototype.hasOwnProperty.call(rules, key)) {
  4918. var config = rules[key];
  4919. if (typeof config === 'string') {
  4920. config = regionConfig.patterns[config];
  4921. }
  4922. // set global endpoint
  4923. service.isGlobalEndpoint = !!config.globalEndpoint;
  4924. if (config.signingRegion) {
  4925. service.signingRegion = config.signingRegion;
  4926. }
  4927. // signature version
  4928. if (!config.signatureVersion) {
  4929. // Note: config is a global object and should not be mutated here.
  4930. // However, we are retaining this line for backwards compatibility.
  4931. // The non-v4 signatureVersion will be set in a copied object below.
  4932. config.signatureVersion = 'v4';
  4933. }
  4934. var useBearer = (service.api && service.api.signatureVersion) === 'bearer';
  4935. // merge config
  4936. applyConfig(service, Object.assign(
  4937. {},
  4938. config,
  4939. { signatureVersion: useBearer ? 'bearer' : config.signatureVersion }
  4940. ));
  4941. return;
  4942. }
  4943. }
  4944. }
  4945. function getEndpointSuffix(region) {
  4946. var regionRegexes = {
  4947. '^(us|eu|ap|sa|ca|me)\\-\\w+\\-\\d+$': 'amazonaws.com',
  4948. '^cn\\-\\w+\\-\\d+$': 'amazonaws.com.cn',
  4949. '^us\\-gov\\-\\w+\\-\\d+$': 'amazonaws.com',
  4950. '^us\\-iso\\-\\w+\\-\\d+$': 'c2s.ic.gov',
  4951. '^us\\-isob\\-\\w+\\-\\d+$': 'sc2s.sgov.gov'
  4952. };
  4953. var defaultSuffix = 'amazonaws.com';
  4954. var regexes = Object.keys(regionRegexes);
  4955. for (var i = 0; i < regexes.length; i++) {
  4956. var regionPattern = RegExp(regexes[i]);
  4957. var dnsSuffix = regionRegexes[regexes[i]];
  4958. if (regionPattern.test(region)) return dnsSuffix;
  4959. }
  4960. return defaultSuffix;
  4961. }
  4962. /**
  4963. * @api private
  4964. */
  4965. module.exports = {
  4966. configureEndpoint: configureEndpoint,
  4967. getEndpointSuffix: getEndpointSuffix,
  4968. };
  4969. /***/ }),
  4970. /* 44 */
  4971. /***/ (function(module, exports) {
  4972. module.exports = {"rules":{"*/*":{"endpoint":"{service}.{region}.amazonaws.com"},"cn-*/*":{"endpoint":"{service}.{region}.amazonaws.com.cn"},"eu-isoe-*/*":"euIsoe","us-iso-*/*":"usIso","us-isob-*/*":"usIsob","us-isof-*/*":"usIsof","*/budgets":"globalSSL","*/cloudfront":"globalSSL","*/sts":"globalSSL","*/importexport":{"endpoint":"{service}.amazonaws.com","signatureVersion":"v2","globalEndpoint":true},"*/route53":"globalSSL","cn-*/route53":{"endpoint":"{service}.amazonaws.com.cn","globalEndpoint":true,"signingRegion":"cn-northwest-1"},"us-gov-*/route53":"globalGovCloud","us-iso-*/route53":{"endpoint":"{service}.c2s.ic.gov","globalEndpoint":true,"signingRegion":"us-iso-east-1"},"us-isob-*/route53":{"endpoint":"{service}.sc2s.sgov.gov","globalEndpoint":true,"signingRegion":"us-isob-east-1"},"*/waf":"globalSSL","*/iam":"globalSSL","cn-*/iam":{"endpoint":"{service}.cn-north-1.amazonaws.com.cn","globalEndpoint":true,"signingRegion":"cn-north-1"},"us-iso-*/iam":{"endpoint":"{service}.us-iso-east-1.c2s.ic.gov","globalEndpoint":true,"signingRegion":"us-iso-east-1"},"us-gov-*/iam":"globalGovCloud","*/ce":{"endpoint":"{service}.us-east-1.amazonaws.com","globalEndpoint":true,"signingRegion":"us-east-1"},"cn-*/ce":{"endpoint":"{service}.cn-northwest-1.amazonaws.com.cn","globalEndpoint":true,"signingRegion":"cn-northwest-1"},"us-gov-*/sts":{"endpoint":"{service}.{region}.amazonaws.com"},"us-gov-west-1/s3":"s3signature","us-west-1/s3":"s3signature","us-west-2/s3":"s3signature","eu-west-1/s3":"s3signature","ap-southeast-1/s3":"s3signature","ap-southeast-2/s3":"s3signature","ap-northeast-1/s3":"s3signature","sa-east-1/s3":"s3signature","us-east-1/s3":{"endpoint":"{service}.amazonaws.com","signatureVersion":"s3"},"us-east-1/sdb":{"endpoint":"{service}.amazonaws.com","signatureVersion":"v2"},"*/sdb":{"endpoint":"{service}.{region}.amazonaws.com","signatureVersion":"v2"},"*/resource-explorer-2":"dualstackByDefault","*/kendra-ranking":"dualstackByDefault","*/internetmonitor":"dualstackByDefault","*/codecatalyst":"globalDualstackByDefault"},"fipsRules":{"*/*":"fipsStandard","us-gov-*/*":"fipsStandard","us-iso-*/*":{"endpoint":"{service}-fips.{region}.c2s.ic.gov"},"us-iso-*/dms":"usIso","us-isob-*/*":{"endpoint":"{service}-fips.{region}.sc2s.sgov.gov"},"us-isob-*/dms":"usIsob","cn-*/*":{"endpoint":"{service}-fips.{region}.amazonaws.com.cn"},"*/api.ecr":"fips.api.ecr","*/api.sagemaker":"fips.api.sagemaker","*/batch":"fipsDotPrefix","*/eks":"fipsDotPrefix","*/models.lex":"fips.models.lex","*/runtime.lex":"fips.runtime.lex","*/runtime.sagemaker":{"endpoint":"runtime-fips.sagemaker.{region}.amazonaws.com"},"*/iam":"fipsWithoutRegion","*/route53":"fipsWithoutRegion","*/transcribe":"fipsDotPrefix","*/waf":"fipsWithoutRegion","us-gov-*/transcribe":"fipsDotPrefix","us-gov-*/api.ecr":"fips.api.ecr","us-gov-*/models.lex":"fips.models.lex","us-gov-*/runtime.lex":"fips.runtime.lex","us-gov-*/access-analyzer":"fipsWithServiceOnly","us-gov-*/acm":"fipsWithServiceOnly","us-gov-*/acm-pca":"fipsWithServiceOnly","us-gov-*/api.sagemaker":"fipsWithServiceOnly","us-gov-*/appconfig":"fipsWithServiceOnly","us-gov-*/application-autoscaling":"fipsWithServiceOnly","us-gov-*/autoscaling":"fipsWithServiceOnly","us-gov-*/autoscaling-plans":"fipsWithServiceOnly","us-gov-*/batch":"fipsWithServiceOnly","us-gov-*/cassandra":"fipsWithServiceOnly","us-gov-*/clouddirectory":"fipsWithServiceOnly","us-gov-*/cloudformation":"fipsWithServiceOnly","us-gov-*/cloudshell":"fipsWithServiceOnly","us-gov-*/cloudtrail":"fipsWithServiceOnly","us-gov-*/config":"fipsWithServiceOnly","us-gov-*/connect":"fipsWithServiceOnly","us-gov-*/databrew":"fipsWithServiceOnly","us-gov-*/dlm":"fipsWithServiceOnly","us-gov-*/dms":"fipsWithServiceOnly","us-gov-*/dynamodb":"fipsWithServiceOnly","us-gov-*/ec2":"fipsWithServiceOnly","us-gov-*/eks":"fipsWithServiceOnly","us-gov-*/elasticache":"fipsWithServiceOnly","us-gov-*/elasticbeanstalk":"fipsWithServiceOnly","us-gov-*/elasticloadbalancing":"fipsWithServiceOnly","us-gov-*/elasticmapreduce":"fipsWithServiceOnly","us-gov-*/events":"fipsWithServiceOnly","us-gov-*/fis":"fipsWithServiceOnly","us-gov-*/glacier":"fipsWithServiceOnly","us-gov-*/greengrass":"fipsWithServiceOnly","us-gov-*/guardduty":"fipsWithServiceOnly","us-gov-*/identitystore":"fipsWithServiceOnly","us-gov-*/imagebuilder":"fipsWithServiceOnly","us-gov-*/kafka":"fipsWithServiceOnly","us-gov-*/kinesis":"fipsWithServiceOnly","us-gov-*/logs":"fipsWithServiceOnly","us-gov-*/mediaconvert":"fipsWithServiceOnly","us-gov-*/monitoring":"fipsWithServiceOnly","us-gov-*/networkmanager":"fipsWithServiceOnly","us-gov-*/organizations":"fipsWithServiceOnly","us-gov-*/outposts":"fipsWithServiceOnly","us-gov-*/participant.connect":"fipsWithServiceOnly","us-gov-*/ram":"fipsWithServiceOnly","us-gov-*/rds":"fipsWithServiceOnly","us-gov-*/redshift":"fipsWithServiceOnly","us-gov-*/resource-groups":"fipsWithServiceOnly","us-gov-*/runtime.sagemaker":"fipsWithServiceOnly","us-gov-*/serverlessrepo":"fipsWithServiceOnly","us-gov-*/servicecatalog-appregistry":"fipsWithServiceOnly","us-gov-*/servicequotas":"fipsWithServiceOnly","us-gov-*/sns":"fipsWithServiceOnly","us-gov-*/sqs":"fipsWithServiceOnly","us-gov-*/ssm":"fipsWithServiceOnly","us-gov-*/streams.dynamodb":"fipsWithServiceOnly","us-gov-*/sts":"fipsWithServiceOnly","us-gov-*/support":"fipsWithServiceOnly","us-gov-*/swf":"fipsWithServiceOnly","us-gov-west-1/states":"fipsWithServiceOnly","us-iso-east-1/elasticfilesystem":{"endpoint":"elasticfilesystem-fips.{region}.c2s.ic.gov"},"us-gov-west-1/organizations":"fipsWithServiceOnly","us-gov-west-1/route53":{"endpoint":"route53.us-gov.amazonaws.com"},"*/resource-explorer-2":"fipsDualstackByDefault","*/kendra-ranking":"dualstackByDefault","*/internetmonitor":"dualstackByDefault","*/codecatalyst":"fipsGlobalDualstackByDefault"},"dualstackRules":{"*/*":{"endpoint":"{service}.{region}.api.aws"},"cn-*/*":{"endpoint":"{service}.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackLegacy","cn-*/s3":"dualstackLegacyCn","*/s3-control":"dualstackLegacy","cn-*/s3-control":"dualstackLegacyCn","ap-south-1/ec2":"dualstackLegacyEc2","eu-west-1/ec2":"dualstackLegacyEc2","sa-east-1/ec2":"dualstackLegacyEc2","us-east-1/ec2":"dualstackLegacyEc2","us-east-2/ec2":"dualstackLegacyEc2","us-west-2/ec2":"dualstackLegacyEc2"},"dualstackFipsRules":{"*/*":{"endpoint":"{service}-fips.{region}.api.aws"},"cn-*/*":{"endpoint":"{service}-fips.{region}.api.amazonwebservices.com.cn"},"*/s3":"dualstackFipsLegacy","cn-*/s3":"dualstackFipsLegacyCn","*/s3-control":"dualstackFipsLegacy","cn-*/s3-control":"dualstackFipsLegacyCn"},"patterns":{"globalSSL":{"endpoint":"https://{service}.amazonaws.com","globalEndpoint":true,"signingRegion":"us-east-1"},"globalGovCloud":{"endpoint":"{service}.us-gov.amazonaws.com","globalEndpoint":true,"signingRegion":"us-gov-west-1"},"s3signature":{"endpoint":"{service}.{region}.amazonaws.com","signatureVersion":"s3"},"euIsoe":{"endpoint":"{service}.{region}.cloud.adc-e.uk"},"usIso":{"endpoint":"{service}.{region}.c2s.ic.gov"},"usIsob":{"endpoint":"{service}.{region}.sc2s.sgov.gov"},"usIsof":{"endpoint":"{service}.{region}.csp.hci.ic.gov"},"fipsStandard":{"endpoint":"{service}-fips.{region}.amazonaws.com"},"fipsDotPrefix":{"endpoint":"fips.{service}.{region}.amazonaws.com"},"fipsWithoutRegion":{"endpoint":"{service}-fips.amazonaws.com"},"fips.api.ecr":{"endpoint":"ecr-fips.{region}.amazonaws.com"},"fips.api.sagemaker":{"endpoint":"api-fips.sagemaker.{region}.amazonaws.com"},"fips.models.lex":{"endpoint":"models-fips.lex.{region}.amazonaws.com"},"fips.runtime.lex":{"endpoint":"runtime-fips.lex.{region}.amazonaws.com"},"fipsWithServiceOnly":{"endpoint":"{service}.{region}.amazonaws.com"},"dualstackLegacy":{"endpoint":"{service}.dualstack.{region}.amazonaws.com"},"dualstackLegacyCn":{"endpoint":"{service}.dualstack.{region}.amazonaws.com.cn"},"dualstackFipsLegacy":{"endpoint":"{service}-fips.dualstack.{region}.amazonaws.com"},"dualstackFipsLegacyCn":{"endpoint":"{service}-fips.dualstack.{region}.amazonaws.com.cn"},"dualstackLegacyEc2":{"endpoint":"api.ec2.{region}.aws"},"dualstackByDefault":{"endpoint":"{service}.{region}.api.aws"},"fipsDualstackByDefault":{"endpoint":"{service}-fips.{region}.api.aws"},"globalDualstackByDefault":{"endpoint":"{service}.global.api.aws"},"fipsGlobalDualstackByDefault":{"endpoint":"{service}-fips.global.api.aws"}}}
  4973. /***/ }),
  4974. /* 45 */
  4975. /***/ (function(module, exports) {
  4976. function isFipsRegion(region) {
  4977. return typeof region === 'string' && (region.startsWith('fips-') || region.endsWith('-fips'));
  4978. }
  4979. function isGlobalRegion(region) {
  4980. return typeof region === 'string' && ['aws-global', 'aws-us-gov-global'].includes(region);
  4981. }
  4982. function getRealRegion(region) {
  4983. return ['fips-aws-global', 'aws-fips', 'aws-global'].includes(region)
  4984. ? 'us-east-1'
  4985. : ['fips-aws-us-gov-global', 'aws-us-gov-global'].includes(region)
  4986. ? 'us-gov-west-1'
  4987. : region.replace(/fips-(dkr-|prod-)?|-fips/, '');
  4988. }
  4989. module.exports = {
  4990. isFipsRegion: isFipsRegion,
  4991. isGlobalRegion: isGlobalRegion,
  4992. getRealRegion: getRealRegion
  4993. };
  4994. /***/ }),
  4995. /* 46 */
  4996. /***/ (function(module, exports, __webpack_require__) {
  4997. var AWS = __webpack_require__(1);
  4998. __webpack_require__(47);
  4999. __webpack_require__(48);
  5000. var PromisesDependency;
  5001. /**
  5002. * The main configuration class used by all service objects to set
  5003. * the region, credentials, and other options for requests.
  5004. *
  5005. * By default, credentials and region settings are left unconfigured.
  5006. * This should be configured by the application before using any
  5007. * AWS service APIs.
  5008. *
  5009. * In order to set global configuration options, properties should
  5010. * be assigned to the global {AWS.config} object.
  5011. *
  5012. * @see AWS.config
  5013. *
  5014. * @!group General Configuration Options
  5015. *
  5016. * @!attribute credentials
  5017. * @return [AWS.Credentials] the AWS credentials to sign requests with.
  5018. *
  5019. * @!attribute region
  5020. * @example Set the global region setting to us-west-2
  5021. * AWS.config.update({region: 'us-west-2'});
  5022. * @return [AWS.Credentials] The region to send service requests to.
  5023. * @see http://docs.amazonwebservices.com/general/latest/gr/rande.html
  5024. * A list of available endpoints for each AWS service
  5025. *
  5026. * @!attribute maxRetries
  5027. * @return [Integer] the maximum amount of retries to perform for a
  5028. * service request. By default this value is calculated by the specific
  5029. * service object that the request is being made to.
  5030. *
  5031. * @!attribute maxRedirects
  5032. * @return [Integer] the maximum amount of redirects to follow for a
  5033. * service request. Defaults to 10.
  5034. *
  5035. * @!attribute paramValidation
  5036. * @return [Boolean|map] whether input parameters should be validated against
  5037. * the operation description before sending the request. Defaults to true.
  5038. * Pass a map to enable any of the following specific validation features:
  5039. *
  5040. * * **min** [Boolean] &mdash; Validates that a value meets the min
  5041. * constraint. This is enabled by default when paramValidation is set
  5042. * to `true`.
  5043. * * **max** [Boolean] &mdash; Validates that a value meets the max
  5044. * constraint.
  5045. * * **pattern** [Boolean] &mdash; Validates that a string value matches a
  5046. * regular expression.
  5047. * * **enum** [Boolean] &mdash; Validates that a string value matches one
  5048. * of the allowable enum values.
  5049. *
  5050. * @!attribute computeChecksums
  5051. * @return [Boolean] whether to compute checksums for payload bodies when
  5052. * the service accepts it (currently supported in S3 and SQS only).
  5053. *
  5054. * @!attribute convertResponseTypes
  5055. * @return [Boolean] whether types are converted when parsing response data.
  5056. * Currently only supported for JSON based services. Turning this off may
  5057. * improve performance on large response payloads. Defaults to `true`.
  5058. *
  5059. * @!attribute correctClockSkew
  5060. * @return [Boolean] whether to apply a clock skew correction and retry
  5061. * requests that fail because of an skewed client clock. Defaults to
  5062. * `false`.
  5063. *
  5064. * @!attribute sslEnabled
  5065. * @return [Boolean] whether SSL is enabled for requests
  5066. *
  5067. * @!attribute s3ForcePathStyle
  5068. * @return [Boolean] whether to force path style URLs for S3 objects
  5069. *
  5070. * @!attribute s3BucketEndpoint
  5071. * @note Setting this configuration option requires an `endpoint` to be
  5072. * provided explicitly to the service constructor.
  5073. * @return [Boolean] whether the provided endpoint addresses an individual
  5074. * bucket (false if it addresses the root API endpoint).
  5075. *
  5076. * @!attribute s3DisableBodySigning
  5077. * @return [Boolean] whether to disable S3 body signing when using signature version `v4`.
  5078. * Body signing can only be disabled when using https. Defaults to `true`.
  5079. *
  5080. * @!attribute s3UsEast1RegionalEndpoint
  5081. * @return ['legacy'|'regional'] when region is set to 'us-east-1', whether to send s3
  5082. * request to global endpoints or 'us-east-1' regional endpoints. This config is only
  5083. * applicable to S3 client;
  5084. * Defaults to 'legacy'
  5085. * @!attribute s3UseArnRegion
  5086. * @return [Boolean] whether to override the request region with the region inferred
  5087. * from requested resource's ARN. Only available for S3 buckets
  5088. * Defaults to `true`
  5089. *
  5090. * @!attribute useAccelerateEndpoint
  5091. * @note This configuration option is only compatible with S3 while accessing
  5092. * dns-compatible buckets.
  5093. * @return [Boolean] Whether to use the Accelerate endpoint with the S3 service.
  5094. * Defaults to `false`.
  5095. *
  5096. * @!attribute retryDelayOptions
  5097. * @example Set the base retry delay for all services to 300 ms
  5098. * AWS.config.update({retryDelayOptions: {base: 300}});
  5099. * // Delays with maxRetries = 3: 300, 600, 1200
  5100. * @example Set a custom backoff function to provide delay values on retries
  5101. * AWS.config.update({retryDelayOptions: {customBackoff: function(retryCount, err) {
  5102. * // returns delay in ms
  5103. * }}});
  5104. * @return [map] A set of options to configure the retry delay on retryable errors.
  5105. * Currently supported options are:
  5106. *
  5107. * * **base** [Integer] &mdash; The base number of milliseconds to use in the
  5108. * exponential backoff for operation retries. Defaults to 100 ms for all services except
  5109. * DynamoDB, where it defaults to 50ms.
  5110. *
  5111. * * **customBackoff ** [function] &mdash; A custom function that accepts a
  5112. * retry count and error and returns the amount of time to delay in
  5113. * milliseconds. If the result is a non-zero negative value, no further
  5114. * retry attempts will be made. The `base` option will be ignored if this
  5115. * option is supplied. The function is only called for retryable errors.
  5116. *
  5117. * @!attribute httpOptions
  5118. * @return [map] A set of options to pass to the low-level HTTP request.
  5119. * Currently supported options are:
  5120. *
  5121. * * **proxy** [String] &mdash; the URL to proxy requests through
  5122. * * **agent** [http.Agent, https.Agent] &mdash; the Agent object to perform
  5123. * HTTP requests with. Used for connection pooling. Note that for
  5124. * SSL connections, a special Agent object is used in order to enable
  5125. * peer certificate verification. This feature is only supported in the
  5126. * Node.js environment.
  5127. * * **connectTimeout** [Integer] &mdash; Sets the socket to timeout after
  5128. * failing to establish a connection with the server after
  5129. * `connectTimeout` milliseconds. This timeout has no effect once a socket
  5130. * connection has been established.
  5131. * * **timeout** [Integer] &mdash; The number of milliseconds a request can
  5132. * take before automatically being terminated.
  5133. * Defaults to two minutes (120000).
  5134. * * **xhrAsync** [Boolean] &mdash; Whether the SDK will send asynchronous
  5135. * HTTP requests. Used in the browser environment only. Set to false to
  5136. * send requests synchronously. Defaults to true (async on).
  5137. * * **xhrWithCredentials** [Boolean] &mdash; Sets the "withCredentials"
  5138. * property of an XMLHttpRequest object. Used in the browser environment
  5139. * only. Defaults to false.
  5140. * @!attribute logger
  5141. * @return [#write,#log] an object that responds to .write() (like a stream)
  5142. * or .log() (like the console object) in order to log information about
  5143. * requests
  5144. *
  5145. * @!attribute systemClockOffset
  5146. * @return [Number] an offset value in milliseconds to apply to all signing
  5147. * times. Use this to compensate for clock skew when your system may be
  5148. * out of sync with the service time. Note that this configuration option
  5149. * can only be applied to the global `AWS.config` object and cannot be
  5150. * overridden in service-specific configuration. Defaults to 0 milliseconds.
  5151. *
  5152. * @!attribute signatureVersion
  5153. * @return [String] the signature version to sign requests with (overriding
  5154. * the API configuration). Possible values are: 'v2', 'v3', 'v4'.
  5155. *
  5156. * @!attribute signatureCache
  5157. * @return [Boolean] whether the signature to sign requests with (overriding
  5158. * the API configuration) is cached. Only applies to the signature version 'v4'.
  5159. * Defaults to `true`.
  5160. *
  5161. * @!attribute endpointDiscoveryEnabled
  5162. * @return [Boolean|undefined] whether to call operations with endpoints
  5163. * given by service dynamically. Setting this config to `true` will enable
  5164. * endpoint discovery for all applicable operations. Setting it to `false`
  5165. * will explicitly disable endpoint discovery even though operations that
  5166. * require endpoint discovery will presumably fail. Leaving it to
  5167. * `undefined` means SDK only do endpoint discovery when it's required.
  5168. * Defaults to `undefined`
  5169. *
  5170. * @!attribute endpointCacheSize
  5171. * @return [Number] the size of the global cache storing endpoints from endpoint
  5172. * discovery operations. Once endpoint cache is created, updating this setting
  5173. * cannot change existing cache size.
  5174. * Defaults to 1000
  5175. *
  5176. * @!attribute hostPrefixEnabled
  5177. * @return [Boolean] whether to marshal request parameters to the prefix of
  5178. * hostname. Defaults to `true`.
  5179. *
  5180. * @!attribute stsRegionalEndpoints
  5181. * @return ['legacy'|'regional'] whether to send sts request to global endpoints or
  5182. * regional endpoints.
  5183. * Defaults to 'legacy'.
  5184. *
  5185. * @!attribute useFipsEndpoint
  5186. * @return [Boolean] Enables FIPS compatible endpoints. Defaults to `false`.
  5187. *
  5188. * @!attribute useDualstackEndpoint
  5189. * @return [Boolean] Enables IPv6 dualstack endpoint. Defaults to `false`.
  5190. */
  5191. AWS.Config = AWS.util.inherit({
  5192. /**
  5193. * @!endgroup
  5194. */
  5195. /**
  5196. * Creates a new configuration object. This is the object that passes
  5197. * option data along to service requests, including credentials, security,
  5198. * region information, and some service specific settings.
  5199. *
  5200. * @example Creating a new configuration object with credentials and region
  5201. * var config = new AWS.Config({
  5202. * accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2'
  5203. * });
  5204. * @option options accessKeyId [String] your AWS access key ID.
  5205. * @option options secretAccessKey [String] your AWS secret access key.
  5206. * @option options sessionToken [AWS.Credentials] the optional AWS
  5207. * session token to sign requests with.
  5208. * @option options credentials [AWS.Credentials] the AWS credentials
  5209. * to sign requests with. You can either specify this object, or
  5210. * specify the accessKeyId and secretAccessKey options directly.
  5211. * @option options credentialProvider [AWS.CredentialProviderChain] the
  5212. * provider chain used to resolve credentials if no static `credentials`
  5213. * property is set.
  5214. * @option options region [String] the region to send service requests to.
  5215. * See {region} for more information.
  5216. * @option options maxRetries [Integer] the maximum amount of retries to
  5217. * attempt with a request. See {maxRetries} for more information.
  5218. * @option options maxRedirects [Integer] the maximum amount of redirects to
  5219. * follow with a request. See {maxRedirects} for more information.
  5220. * @option options sslEnabled [Boolean] whether to enable SSL for
  5221. * requests.
  5222. * @option options paramValidation [Boolean|map] whether input parameters
  5223. * should be validated against the operation description before sending
  5224. * the request. Defaults to true. Pass a map to enable any of the
  5225. * following specific validation features:
  5226. *
  5227. * * **min** [Boolean] &mdash; Validates that a value meets the min
  5228. * constraint. This is enabled by default when paramValidation is set
  5229. * to `true`.
  5230. * * **max** [Boolean] &mdash; Validates that a value meets the max
  5231. * constraint.
  5232. * * **pattern** [Boolean] &mdash; Validates that a string value matches a
  5233. * regular expression.
  5234. * * **enum** [Boolean] &mdash; Validates that a string value matches one
  5235. * of the allowable enum values.
  5236. * @option options computeChecksums [Boolean] whether to compute checksums
  5237. * for payload bodies when the service accepts it (currently supported
  5238. * in S3 only)
  5239. * @option options convertResponseTypes [Boolean] whether types are converted
  5240. * when parsing response data. Currently only supported for JSON based
  5241. * services. Turning this off may improve performance on large response
  5242. * payloads. Defaults to `true`.
  5243. * @option options correctClockSkew [Boolean] whether to apply a clock skew
  5244. * correction and retry requests that fail because of an skewed client
  5245. * clock. Defaults to `false`.
  5246. * @option options s3ForcePathStyle [Boolean] whether to force path
  5247. * style URLs for S3 objects.
  5248. * @option options s3BucketEndpoint [Boolean] whether the provided endpoint
  5249. * addresses an individual bucket (false if it addresses the root API
  5250. * endpoint). Note that setting this configuration option requires an
  5251. * `endpoint` to be provided explicitly to the service constructor.
  5252. * @option options s3DisableBodySigning [Boolean] whether S3 body signing
  5253. * should be disabled when using signature version `v4`. Body signing
  5254. * can only be disabled when using https. Defaults to `true`.
  5255. * @option options s3UsEast1RegionalEndpoint ['legacy'|'regional'] when region
  5256. * is set to 'us-east-1', whether to send s3 request to global endpoints or
  5257. * 'us-east-1' regional endpoints. This config is only applicable to S3 client.
  5258. * Defaults to `legacy`
  5259. * @option options s3UseArnRegion [Boolean] whether to override the request region
  5260. * with the region inferred from requested resource's ARN. Only available for S3 buckets
  5261. * Defaults to `true`
  5262. *
  5263. * @option options retryDelayOptions [map] A set of options to configure
  5264. * the retry delay on retryable errors. Currently supported options are:
  5265. *
  5266. * * **base** [Integer] &mdash; The base number of milliseconds to use in the
  5267. * exponential backoff for operation retries. Defaults to 100 ms for all
  5268. * services except DynamoDB, where it defaults to 50ms.
  5269. * * **customBackoff ** [function] &mdash; A custom function that accepts a
  5270. * retry count and error and returns the amount of time to delay in
  5271. * milliseconds. If the result is a non-zero negative value, no further
  5272. * retry attempts will be made. The `base` option will be ignored if this
  5273. * option is supplied. The function is only called for retryable errors.
  5274. * @option options httpOptions [map] A set of options to pass to the low-level
  5275. * HTTP request. Currently supported options are:
  5276. *
  5277. * * **proxy** [String] &mdash; the URL to proxy requests through
  5278. * * **agent** [http.Agent, https.Agent] &mdash; the Agent object to perform
  5279. * HTTP requests with. Used for connection pooling. Defaults to the global
  5280. * agent (`http.globalAgent`) for non-SSL connections. Note that for
  5281. * SSL connections, a special Agent object is used in order to enable
  5282. * peer certificate verification. This feature is only available in the
  5283. * Node.js environment.
  5284. * * **connectTimeout** [Integer] &mdash; Sets the socket to timeout after
  5285. * failing to establish a connection with the server after
  5286. * `connectTimeout` milliseconds. This timeout has no effect once a socket
  5287. * connection has been established.
  5288. * * **timeout** [Integer] &mdash; Sets the socket to timeout after timeout
  5289. * milliseconds of inactivity on the socket. Defaults to two minutes
  5290. * (120000).
  5291. * * **xhrAsync** [Boolean] &mdash; Whether the SDK will send asynchronous
  5292. * HTTP requests. Used in the browser environment only. Set to false to
  5293. * send requests synchronously. Defaults to true (async on).
  5294. * * **xhrWithCredentials** [Boolean] &mdash; Sets the "withCredentials"
  5295. * property of an XMLHttpRequest object. Used in the browser environment
  5296. * only. Defaults to false.
  5297. * @option options apiVersion [String, Date] a String in YYYY-MM-DD format
  5298. * (or a date) that represents the latest possible API version that can be
  5299. * used in all services (unless overridden by `apiVersions`). Specify
  5300. * 'latest' to use the latest possible version.
  5301. * @option options apiVersions [map<String, String|Date>] a map of service
  5302. * identifiers (the lowercase service class name) with the API version to
  5303. * use when instantiating a service. Specify 'latest' for each individual
  5304. * that can use the latest available version.
  5305. * @option options logger [#write,#log] an object that responds to .write()
  5306. * (like a stream) or .log() (like the console object) in order to log
  5307. * information about requests
  5308. * @option options systemClockOffset [Number] an offset value in milliseconds
  5309. * to apply to all signing times. Use this to compensate for clock skew
  5310. * when your system may be out of sync with the service time. Note that
  5311. * this configuration option can only be applied to the global `AWS.config`
  5312. * object and cannot be overridden in service-specific configuration.
  5313. * Defaults to 0 milliseconds.
  5314. * @option options signatureVersion [String] the signature version to sign
  5315. * requests with (overriding the API configuration). Possible values are:
  5316. * 'v2', 'v3', 'v4'.
  5317. * @option options signatureCache [Boolean] whether the signature to sign
  5318. * requests with (overriding the API configuration) is cached. Only applies
  5319. * to the signature version 'v4'. Defaults to `true`.
  5320. * @option options dynamoDbCrc32 [Boolean] whether to validate the CRC32
  5321. * checksum of HTTP response bodies returned by DynamoDB. Default: `true`.
  5322. * @option options useAccelerateEndpoint [Boolean] Whether to use the
  5323. * S3 Transfer Acceleration endpoint with the S3 service. Default: `false`.
  5324. * @option options clientSideMonitoring [Boolean] whether to collect and
  5325. * publish this client's performance metrics of all its API requests.
  5326. * @option options endpointDiscoveryEnabled [Boolean|undefined] whether to
  5327. * call operations with endpoints given by service dynamically. Setting this
  5328. * config to `true` will enable endpoint discovery for all applicable operations.
  5329. * Setting it to `false` will explicitly disable endpoint discovery even though
  5330. * operations that require endpoint discovery will presumably fail. Leaving it
  5331. * to `undefined` means SDK will only do endpoint discovery when it's required.
  5332. * Defaults to `undefined`
  5333. * @option options endpointCacheSize [Number] the size of the global cache storing
  5334. * endpoints from endpoint discovery operations. Once endpoint cache is created,
  5335. * updating this setting cannot change existing cache size.
  5336. * Defaults to 1000
  5337. * @option options hostPrefixEnabled [Boolean] whether to marshal request
  5338. * parameters to the prefix of hostname.
  5339. * Defaults to `true`.
  5340. * @option options stsRegionalEndpoints ['legacy'|'regional'] whether to send sts request
  5341. * to global endpoints or regional endpoints.
  5342. * Defaults to 'legacy'.
  5343. * @option options useFipsEndpoint [Boolean] Enables FIPS compatible endpoints.
  5344. * Defaults to `false`.
  5345. * @option options useDualstackEndpoint [Boolean] Enables IPv6 dualstack endpoint.
  5346. * Defaults to `false`.
  5347. */
  5348. constructor: function Config(options) {
  5349. if (options === undefined) options = {};
  5350. options = this.extractCredentials(options);
  5351. AWS.util.each.call(this, this.keys, function (key, value) {
  5352. this.set(key, options[key], value);
  5353. });
  5354. },
  5355. /**
  5356. * @!group Managing Credentials
  5357. */
  5358. /**
  5359. * Loads credentials from the configuration object. This is used internally
  5360. * by the SDK to ensure that refreshable {Credentials} objects are properly
  5361. * refreshed and loaded when sending a request. If you want to ensure that
  5362. * your credentials are loaded prior to a request, you can use this method
  5363. * directly to provide accurate credential data stored in the object.
  5364. *
  5365. * @note If you configure the SDK with static or environment credentials,
  5366. * the credential data should already be present in {credentials} attribute.
  5367. * This method is primarily necessary to load credentials from asynchronous
  5368. * sources, or sources that can refresh credentials periodically.
  5369. * @example Getting your access key
  5370. * AWS.config.getCredentials(function(err) {
  5371. * if (err) console.log(err.stack); // credentials not loaded
  5372. * else console.log("Access Key:", AWS.config.credentials.accessKeyId);
  5373. * })
  5374. * @callback callback function(err)
  5375. * Called when the {credentials} have been properly set on the configuration
  5376. * object.
  5377. *
  5378. * @param err [Error] if this is set, credentials were not successfully
  5379. * loaded and this error provides information why.
  5380. * @see credentials
  5381. * @see Credentials
  5382. */
  5383. getCredentials: function getCredentials(callback) {
  5384. var self = this;
  5385. function finish(err) {
  5386. callback(err, err ? null : self.credentials);
  5387. }
  5388. function credError(msg, err) {
  5389. return new AWS.util.error(err || new Error(), {
  5390. code: 'CredentialsError',
  5391. message: msg,
  5392. name: 'CredentialsError'
  5393. });
  5394. }
  5395. function getAsyncCredentials() {
  5396. self.credentials.get(function(err) {
  5397. if (err) {
  5398. var msg = 'Could not load credentials from ' +
  5399. self.credentials.constructor.name;
  5400. err = credError(msg, err);
  5401. }
  5402. finish(err);
  5403. });
  5404. }
  5405. function getStaticCredentials() {
  5406. var err = null;
  5407. if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {
  5408. err = credError('Missing credentials');
  5409. }
  5410. finish(err);
  5411. }
  5412. if (self.credentials) {
  5413. if (typeof self.credentials.get === 'function') {
  5414. getAsyncCredentials();
  5415. } else { // static credentials
  5416. getStaticCredentials();
  5417. }
  5418. } else if (self.credentialProvider) {
  5419. self.credentialProvider.resolve(function(err, creds) {
  5420. if (err) {
  5421. err = credError('Could not load credentials from any providers', err);
  5422. }
  5423. self.credentials = creds;
  5424. finish(err);
  5425. });
  5426. } else {
  5427. finish(credError('No credentials to load'));
  5428. }
  5429. },
  5430. /**
  5431. * Loads token from the configuration object. This is used internally
  5432. * by the SDK to ensure that refreshable {Token} objects are properly
  5433. * refreshed and loaded when sending a request. If you want to ensure that
  5434. * your token is loaded prior to a request, you can use this method
  5435. * directly to provide accurate token data stored in the object.
  5436. *
  5437. * @note If you configure the SDK with static token, the token data should
  5438. * already be present in {token} attribute. This method is primarily necessary
  5439. * to load token from asynchronous sources, or sources that can refresh
  5440. * token periodically.
  5441. * @example Getting your access token
  5442. * AWS.config.getToken(function(err) {
  5443. * if (err) console.log(err.stack); // token not loaded
  5444. * else console.log("Token:", AWS.config.token.token);
  5445. * })
  5446. * @callback callback function(err)
  5447. * Called when the {token} have been properly set on the configuration object.
  5448. *
  5449. * @param err [Error] if this is set, token was not successfully loaded and
  5450. * this error provides information why.
  5451. * @see token
  5452. */
  5453. getToken: function getToken(callback) {
  5454. var self = this;
  5455. function finish(err) {
  5456. callback(err, err ? null : self.token);
  5457. }
  5458. function tokenError(msg, err) {
  5459. return new AWS.util.error(err || new Error(), {
  5460. code: 'TokenError',
  5461. message: msg,
  5462. name: 'TokenError'
  5463. });
  5464. }
  5465. function getAsyncToken() {
  5466. self.token.get(function(err) {
  5467. if (err) {
  5468. var msg = 'Could not load token from ' +
  5469. self.token.constructor.name;
  5470. err = tokenError(msg, err);
  5471. }
  5472. finish(err);
  5473. });
  5474. }
  5475. function getStaticToken() {
  5476. var err = null;
  5477. if (!self.token.token) {
  5478. err = tokenError('Missing token');
  5479. }
  5480. finish(err);
  5481. }
  5482. if (self.token) {
  5483. if (typeof self.token.get === 'function') {
  5484. getAsyncToken();
  5485. } else { // static token
  5486. getStaticToken();
  5487. }
  5488. } else if (self.tokenProvider) {
  5489. self.tokenProvider.resolve(function(err, token) {
  5490. if (err) {
  5491. err = tokenError('Could not load token from any providers', err);
  5492. }
  5493. self.token = token;
  5494. finish(err);
  5495. });
  5496. } else {
  5497. finish(tokenError('No token to load'));
  5498. }
  5499. },
  5500. /**
  5501. * @!group Loading and Setting Configuration Options
  5502. */
  5503. /**
  5504. * @overload update(options, allowUnknownKeys = false)
  5505. * Updates the current configuration object with new options.
  5506. *
  5507. * @example Update maxRetries property of a configuration object
  5508. * config.update({maxRetries: 10});
  5509. * @param [Object] options a map of option keys and values.
  5510. * @param [Boolean] allowUnknownKeys whether unknown keys can be set on
  5511. * the configuration object. Defaults to `false`.
  5512. * @see constructor
  5513. */
  5514. update: function update(options, allowUnknownKeys) {
  5515. allowUnknownKeys = allowUnknownKeys || false;
  5516. options = this.extractCredentials(options);
  5517. AWS.util.each.call(this, options, function (key, value) {
  5518. if (allowUnknownKeys || Object.prototype.hasOwnProperty.call(this.keys, key) ||
  5519. AWS.Service.hasService(key)) {
  5520. this.set(key, value);
  5521. }
  5522. });
  5523. },
  5524. /**
  5525. * Loads configuration data from a JSON file into this config object.
  5526. * @note Loading configuration will reset all existing configuration
  5527. * on the object.
  5528. * @!macro nobrowser
  5529. * @param path [String] the path relative to your process's current
  5530. * working directory to load configuration from.
  5531. * @return [AWS.Config] the same configuration object
  5532. */
  5533. loadFromPath: function loadFromPath(path) {
  5534. this.clear();
  5535. var options = JSON.parse(AWS.util.readFileSync(path));
  5536. var fileSystemCreds = new AWS.FileSystemCredentials(path);
  5537. var chain = new AWS.CredentialProviderChain();
  5538. chain.providers.unshift(fileSystemCreds);
  5539. chain.resolve(function (err, creds) {
  5540. if (err) throw err;
  5541. else options.credentials = creds;
  5542. });
  5543. this.constructor(options);
  5544. return this;
  5545. },
  5546. /**
  5547. * Clears configuration data on this object
  5548. *
  5549. * @api private
  5550. */
  5551. clear: function clear() {
  5552. /*jshint forin:false */
  5553. AWS.util.each.call(this, this.keys, function (key) {
  5554. delete this[key];
  5555. });
  5556. // reset credential provider
  5557. this.set('credentials', undefined);
  5558. this.set('credentialProvider', undefined);
  5559. },
  5560. /**
  5561. * Sets a property on the configuration object, allowing for a
  5562. * default value
  5563. * @api private
  5564. */
  5565. set: function set(property, value, defaultValue) {
  5566. if (value === undefined) {
  5567. if (defaultValue === undefined) {
  5568. defaultValue = this.keys[property];
  5569. }
  5570. if (typeof defaultValue === 'function') {
  5571. this[property] = defaultValue.call(this);
  5572. } else {
  5573. this[property] = defaultValue;
  5574. }
  5575. } else if (property === 'httpOptions' && this[property]) {
  5576. // deep merge httpOptions
  5577. this[property] = AWS.util.merge(this[property], value);
  5578. } else {
  5579. this[property] = value;
  5580. }
  5581. },
  5582. /**
  5583. * All of the keys with their default values.
  5584. *
  5585. * @constant
  5586. * @api private
  5587. */
  5588. keys: {
  5589. credentials: null,
  5590. credentialProvider: null,
  5591. region: null,
  5592. logger: null,
  5593. apiVersions: {},
  5594. apiVersion: null,
  5595. endpoint: undefined,
  5596. httpOptions: {
  5597. timeout: 120000
  5598. },
  5599. maxRetries: undefined,
  5600. maxRedirects: 10,
  5601. paramValidation: true,
  5602. sslEnabled: true,
  5603. s3ForcePathStyle: false,
  5604. s3BucketEndpoint: false,
  5605. s3DisableBodySigning: true,
  5606. s3UsEast1RegionalEndpoint: 'legacy',
  5607. s3UseArnRegion: undefined,
  5608. computeChecksums: true,
  5609. convertResponseTypes: true,
  5610. correctClockSkew: false,
  5611. customUserAgent: null,
  5612. dynamoDbCrc32: true,
  5613. systemClockOffset: 0,
  5614. signatureVersion: null,
  5615. signatureCache: true,
  5616. retryDelayOptions: {},
  5617. useAccelerateEndpoint: false,
  5618. clientSideMonitoring: false,
  5619. endpointDiscoveryEnabled: undefined,
  5620. endpointCacheSize: 1000,
  5621. hostPrefixEnabled: true,
  5622. stsRegionalEndpoints: 'legacy',
  5623. useFipsEndpoint: false,
  5624. useDualstackEndpoint: false,
  5625. token: null
  5626. },
  5627. /**
  5628. * Extracts accessKeyId, secretAccessKey and sessionToken
  5629. * from a configuration hash.
  5630. *
  5631. * @api private
  5632. */
  5633. extractCredentials: function extractCredentials(options) {
  5634. if (options.accessKeyId && options.secretAccessKey) {
  5635. options = AWS.util.copy(options);
  5636. options.credentials = new AWS.Credentials(options);
  5637. }
  5638. return options;
  5639. },
  5640. /**
  5641. * Sets the promise dependency the SDK will use wherever Promises are returned.
  5642. * Passing `null` will force the SDK to use native Promises if they are available.
  5643. * If native Promises are not available, passing `null` will have no effect.
  5644. * @param [Constructor] dep A reference to a Promise constructor
  5645. */
  5646. setPromisesDependency: function setPromisesDependency(dep) {
  5647. PromisesDependency = dep;
  5648. // if null was passed in, we should try to use native promises
  5649. if (dep === null && typeof Promise === 'function') {
  5650. PromisesDependency = Promise;
  5651. }
  5652. var constructors = [AWS.Request, AWS.Credentials, AWS.CredentialProviderChain];
  5653. if (AWS.S3) {
  5654. constructors.push(AWS.S3);
  5655. if (AWS.S3.ManagedUpload) {
  5656. constructors.push(AWS.S3.ManagedUpload);
  5657. }
  5658. }
  5659. AWS.util.addPromises(constructors, PromisesDependency);
  5660. },
  5661. /**
  5662. * Gets the promise dependency set by `AWS.config.setPromisesDependency`.
  5663. */
  5664. getPromisesDependency: function getPromisesDependency() {
  5665. return PromisesDependency;
  5666. }
  5667. });
  5668. /**
  5669. * @return [AWS.Config] The global configuration object singleton instance
  5670. * @readonly
  5671. * @see AWS.Config
  5672. */
  5673. AWS.config = new AWS.Config();
  5674. /***/ }),
  5675. /* 47 */
  5676. /***/ (function(module, exports, __webpack_require__) {
  5677. var AWS = __webpack_require__(1);
  5678. /**
  5679. * Represents your AWS security credentials, specifically the
  5680. * {accessKeyId}, {secretAccessKey}, and optional {sessionToken}.
  5681. * Creating a `Credentials` object allows you to pass around your
  5682. * security information to configuration and service objects.
  5683. *
  5684. * Note that this class typically does not need to be constructed manually,
  5685. * as the {AWS.Config} and {AWS.Service} classes both accept simple
  5686. * options hashes with the three keys. These structures will be converted
  5687. * into Credentials objects automatically.
  5688. *
  5689. * ## Expiring and Refreshing Credentials
  5690. *
  5691. * Occasionally credentials can expire in the middle of a long-running
  5692. * application. In this case, the SDK will automatically attempt to
  5693. * refresh the credentials from the storage location if the Credentials
  5694. * class implements the {refresh} method.
  5695. *
  5696. * If you are implementing a credential storage location, you
  5697. * will want to create a subclass of the `Credentials` class and
  5698. * override the {refresh} method. This method allows credentials to be
  5699. * retrieved from the backing store, be it a file system, database, or
  5700. * some network storage. The method should reset the credential attributes
  5701. * on the object.
  5702. *
  5703. * @!attribute expired
  5704. * @return [Boolean] whether the credentials have been expired and
  5705. * require a refresh. Used in conjunction with {expireTime}.
  5706. * @!attribute expireTime
  5707. * @return [Date] a time when credentials should be considered expired. Used
  5708. * in conjunction with {expired}.
  5709. * @!attribute accessKeyId
  5710. * @return [String] the AWS access key ID
  5711. * @!attribute secretAccessKey
  5712. * @return [String] the AWS secret access key
  5713. * @!attribute sessionToken
  5714. * @return [String] an optional AWS session token
  5715. */
  5716. AWS.Credentials = AWS.util.inherit({
  5717. /**
  5718. * A credentials object can be created using positional arguments or an options
  5719. * hash.
  5720. *
  5721. * @overload AWS.Credentials(accessKeyId, secretAccessKey, sessionToken=null)
  5722. * Creates a Credentials object with a given set of credential information
  5723. * as positional arguments.
  5724. * @param accessKeyId [String] the AWS access key ID
  5725. * @param secretAccessKey [String] the AWS secret access key
  5726. * @param sessionToken [String] the optional AWS session token
  5727. * @example Create a credentials object with AWS credentials
  5728. * var creds = new AWS.Credentials('akid', 'secret', 'session');
  5729. * @overload AWS.Credentials(options)
  5730. * Creates a Credentials object with a given set of credential information
  5731. * as an options hash.
  5732. * @option options accessKeyId [String] the AWS access key ID
  5733. * @option options secretAccessKey [String] the AWS secret access key
  5734. * @option options sessionToken [String] the optional AWS session token
  5735. * @example Create a credentials object with AWS credentials
  5736. * var creds = new AWS.Credentials({
  5737. * accessKeyId: 'akid', secretAccessKey: 'secret', sessionToken: 'session'
  5738. * });
  5739. */
  5740. constructor: function Credentials() {
  5741. // hide secretAccessKey from being displayed with util.inspect
  5742. AWS.util.hideProperties(this, ['secretAccessKey']);
  5743. this.expired = false;
  5744. this.expireTime = null;
  5745. this.refreshCallbacks = [];
  5746. if (arguments.length === 1 && typeof arguments[0] === 'object') {
  5747. var creds = arguments[0].credentials || arguments[0];
  5748. this.accessKeyId = creds.accessKeyId;
  5749. this.secretAccessKey = creds.secretAccessKey;
  5750. this.sessionToken = creds.sessionToken;
  5751. } else {
  5752. this.accessKeyId = arguments[0];
  5753. this.secretAccessKey = arguments[1];
  5754. this.sessionToken = arguments[2];
  5755. }
  5756. },
  5757. /**
  5758. * @return [Integer] the number of seconds before {expireTime} during which
  5759. * the credentials will be considered expired.
  5760. */
  5761. expiryWindow: 15,
  5762. /**
  5763. * @return [Boolean] whether the credentials object should call {refresh}
  5764. * @note Subclasses should override this method to provide custom refresh
  5765. * logic.
  5766. */
  5767. needsRefresh: function needsRefresh() {
  5768. var currentTime = AWS.util.date.getDate().getTime();
  5769. var adjustedTime = new Date(currentTime + this.expiryWindow * 1000);
  5770. if (this.expireTime && adjustedTime > this.expireTime) {
  5771. return true;
  5772. } else {
  5773. return this.expired || !this.accessKeyId || !this.secretAccessKey;
  5774. }
  5775. },
  5776. /**
  5777. * Gets the existing credentials, refreshing them if they are not yet loaded
  5778. * or have expired. Users should call this method before using {refresh},
  5779. * as this will not attempt to reload credentials when they are already
  5780. * loaded into the object.
  5781. *
  5782. * @callback callback function(err)
  5783. * When this callback is called with no error, it means either credentials
  5784. * do not need to be refreshed or refreshed credentials information has
  5785. * been loaded into the object (as the `accessKeyId`, `secretAccessKey`,
  5786. * and `sessionToken` properties).
  5787. * @param err [Error] if an error occurred, this value will be filled
  5788. */
  5789. get: function get(callback) {
  5790. var self = this;
  5791. if (this.needsRefresh()) {
  5792. this.refresh(function(err) {
  5793. if (!err) self.expired = false; // reset expired flag
  5794. if (callback) callback(err);
  5795. });
  5796. } else if (callback) {
  5797. callback();
  5798. }
  5799. },
  5800. /**
  5801. * @!method getPromise()
  5802. * Returns a 'thenable' promise.
  5803. * Gets the existing credentials, refreshing them if they are not yet loaded
  5804. * or have expired. Users should call this method before using {refresh},
  5805. * as this will not attempt to reload credentials when they are already
  5806. * loaded into the object.
  5807. *
  5808. * Two callbacks can be provided to the `then` method on the returned promise.
  5809. * The first callback will be called if the promise is fulfilled, and the second
  5810. * callback will be called if the promise is rejected.
  5811. * @callback fulfilledCallback function()
  5812. * Called if the promise is fulfilled. When this callback is called, it
  5813. * means either credentials do not need to be refreshed or refreshed
  5814. * credentials information has been loaded into the object (as the
  5815. * `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
  5816. * @callback rejectedCallback function(err)
  5817. * Called if the promise is rejected.
  5818. * @param err [Error] if an error occurred, this value will be filled
  5819. * @return [Promise] A promise that represents the state of the `get` call.
  5820. * @example Calling the `getPromise` method.
  5821. * var promise = credProvider.getPromise();
  5822. * promise.then(function() { ... }, function(err) { ... });
  5823. */
  5824. /**
  5825. * @!method refreshPromise()
  5826. * Returns a 'thenable' promise.
  5827. * Refreshes the credentials. Users should call {get} before attempting
  5828. * to forcibly refresh credentials.
  5829. *
  5830. * Two callbacks can be provided to the `then` method on the returned promise.
  5831. * The first callback will be called if the promise is fulfilled, and the second
  5832. * callback will be called if the promise is rejected.
  5833. * @callback fulfilledCallback function()
  5834. * Called if the promise is fulfilled. When this callback is called, it
  5835. * means refreshed credentials information has been loaded into the object
  5836. * (as the `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
  5837. * @callback rejectedCallback function(err)
  5838. * Called if the promise is rejected.
  5839. * @param err [Error] if an error occurred, this value will be filled
  5840. * @return [Promise] A promise that represents the state of the `refresh` call.
  5841. * @example Calling the `refreshPromise` method.
  5842. * var promise = credProvider.refreshPromise();
  5843. * promise.then(function() { ... }, function(err) { ... });
  5844. */
  5845. /**
  5846. * Refreshes the credentials. Users should call {get} before attempting
  5847. * to forcibly refresh credentials.
  5848. *
  5849. * @callback callback function(err)
  5850. * When this callback is called with no error, it means refreshed
  5851. * credentials information has been loaded into the object (as the
  5852. * `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
  5853. * @param err [Error] if an error occurred, this value will be filled
  5854. * @note Subclasses should override this class to reset the
  5855. * {accessKeyId}, {secretAccessKey} and optional {sessionToken}
  5856. * on the credentials object and then call the callback with
  5857. * any error information.
  5858. * @see get
  5859. */
  5860. refresh: function refresh(callback) {
  5861. this.expired = false;
  5862. callback();
  5863. },
  5864. /**
  5865. * @api private
  5866. * @param callback
  5867. */
  5868. coalesceRefresh: function coalesceRefresh(callback, sync) {
  5869. var self = this;
  5870. if (self.refreshCallbacks.push(callback) === 1) {
  5871. self.load(function onLoad(err) {
  5872. AWS.util.arrayEach(self.refreshCallbacks, function(callback) {
  5873. if (sync) {
  5874. callback(err);
  5875. } else {
  5876. // callback could throw, so defer to ensure all callbacks are notified
  5877. AWS.util.defer(function () {
  5878. callback(err);
  5879. });
  5880. }
  5881. });
  5882. self.refreshCallbacks.length = 0;
  5883. });
  5884. }
  5885. },
  5886. /**
  5887. * @api private
  5888. * @param callback
  5889. */
  5890. load: function load(callback) {
  5891. callback();
  5892. }
  5893. });
  5894. /**
  5895. * @api private
  5896. */
  5897. AWS.Credentials.addPromisesToClass = function addPromisesToClass(PromiseDependency) {
  5898. this.prototype.getPromise = AWS.util.promisifyMethod('get', PromiseDependency);
  5899. this.prototype.refreshPromise = AWS.util.promisifyMethod('refresh', PromiseDependency);
  5900. };
  5901. /**
  5902. * @api private
  5903. */
  5904. AWS.Credentials.deletePromisesFromClass = function deletePromisesFromClass() {
  5905. delete this.prototype.getPromise;
  5906. delete this.prototype.refreshPromise;
  5907. };
  5908. AWS.util.addPromises(AWS.Credentials);
  5909. /***/ }),
  5910. /* 48 */
  5911. /***/ (function(module, exports, __webpack_require__) {
  5912. var AWS = __webpack_require__(1);
  5913. /**
  5914. * Creates a credential provider chain that searches for AWS credentials
  5915. * in a list of credential providers specified by the {providers} property.
  5916. *
  5917. * By default, the chain will use the {defaultProviders} to resolve credentials.
  5918. * These providers will look in the environment using the
  5919. * {AWS.EnvironmentCredentials} class with the 'AWS' and 'AMAZON' prefixes.
  5920. *
  5921. * ## Setting Providers
  5922. *
  5923. * Each provider in the {providers} list should be a function that returns
  5924. * a {AWS.Credentials} object, or a hardcoded credentials object. The function
  5925. * form allows for delayed execution of the credential construction.
  5926. *
  5927. * ## Resolving Credentials from a Chain
  5928. *
  5929. * Call {resolve} to return the first valid credential object that can be
  5930. * loaded by the provider chain.
  5931. *
  5932. * For example, to resolve a chain with a custom provider that checks a file
  5933. * on disk after the set of {defaultProviders}:
  5934. *
  5935. * ```javascript
  5936. * var diskProvider = new AWS.FileSystemCredentials('./creds.json');
  5937. * var chain = new AWS.CredentialProviderChain();
  5938. * chain.providers.push(diskProvider);
  5939. * chain.resolve();
  5940. * ```
  5941. *
  5942. * The above code will return the `diskProvider` object if the
  5943. * file contains credentials and the `defaultProviders` do not contain
  5944. * any credential settings.
  5945. *
  5946. * @!attribute providers
  5947. * @return [Array<AWS.Credentials, Function>]
  5948. * a list of credentials objects or functions that return credentials
  5949. * objects. If the provider is a function, the function will be
  5950. * executed lazily when the provider needs to be checked for valid
  5951. * credentials. By default, this object will be set to the
  5952. * {defaultProviders}.
  5953. * @see defaultProviders
  5954. */
  5955. AWS.CredentialProviderChain = AWS.util.inherit(AWS.Credentials, {
  5956. /**
  5957. * Creates a new CredentialProviderChain with a default set of providers
  5958. * specified by {defaultProviders}.
  5959. */
  5960. constructor: function CredentialProviderChain(providers) {
  5961. if (providers) {
  5962. this.providers = providers;
  5963. } else {
  5964. this.providers = AWS.CredentialProviderChain.defaultProviders.slice(0);
  5965. }
  5966. this.resolveCallbacks = [];
  5967. },
  5968. /**
  5969. * @!method resolvePromise()
  5970. * Returns a 'thenable' promise.
  5971. * Resolves the provider chain by searching for the first set of
  5972. * credentials in {providers}.
  5973. *
  5974. * Two callbacks can be provided to the `then` method on the returned promise.
  5975. * The first callback will be called if the promise is fulfilled, and the second
  5976. * callback will be called if the promise is rejected.
  5977. * @callback fulfilledCallback function(credentials)
  5978. * Called if the promise is fulfilled and the provider resolves the chain
  5979. * to a credentials object
  5980. * @param credentials [AWS.Credentials] the credentials object resolved
  5981. * by the provider chain.
  5982. * @callback rejectedCallback function(error)
  5983. * Called if the promise is rejected.
  5984. * @param err [Error] the error object returned if no credentials are found.
  5985. * @return [Promise] A promise that represents the state of the `resolve` method call.
  5986. * @example Calling the `resolvePromise` method.
  5987. * var promise = chain.resolvePromise();
  5988. * promise.then(function(credentials) { ... }, function(err) { ... });
  5989. */
  5990. /**
  5991. * Resolves the provider chain by searching for the first set of
  5992. * credentials in {providers}.
  5993. *
  5994. * @callback callback function(err, credentials)
  5995. * Called when the provider resolves the chain to a credentials object
  5996. * or null if no credentials can be found.
  5997. *
  5998. * @param err [Error] the error object returned if no credentials are
  5999. * found.
  6000. * @param credentials [AWS.Credentials] the credentials object resolved
  6001. * by the provider chain.
  6002. * @return [AWS.CredentialProviderChain] the provider, for chaining.
  6003. */
  6004. resolve: function resolve(callback) {
  6005. var self = this;
  6006. if (self.providers.length === 0) {
  6007. callback(new Error('No providers'));
  6008. return self;
  6009. }
  6010. if (self.resolveCallbacks.push(callback) === 1) {
  6011. var index = 0;
  6012. var providers = self.providers.slice(0);
  6013. function resolveNext(err, creds) {
  6014. if ((!err && creds) || index === providers.length) {
  6015. AWS.util.arrayEach(self.resolveCallbacks, function (callback) {
  6016. callback(err, creds);
  6017. });
  6018. self.resolveCallbacks.length = 0;
  6019. return;
  6020. }
  6021. var provider = providers[index++];
  6022. if (typeof provider === 'function') {
  6023. creds = provider.call();
  6024. } else {
  6025. creds = provider;
  6026. }
  6027. if (creds.get) {
  6028. creds.get(function (getErr) {
  6029. resolveNext(getErr, getErr ? null : creds);
  6030. });
  6031. } else {
  6032. resolveNext(null, creds);
  6033. }
  6034. }
  6035. resolveNext();
  6036. }
  6037. return self;
  6038. }
  6039. });
  6040. /**
  6041. * The default set of providers used by a vanilla CredentialProviderChain.
  6042. *
  6043. * In the browser:
  6044. *
  6045. * ```javascript
  6046. * AWS.CredentialProviderChain.defaultProviders = []
  6047. * ```
  6048. *
  6049. * In Node.js:
  6050. *
  6051. * ```javascript
  6052. * AWS.CredentialProviderChain.defaultProviders = [
  6053. * function () { return new AWS.EnvironmentCredentials('AWS'); },
  6054. * function () { return new AWS.EnvironmentCredentials('AMAZON'); },
  6055. * function () { return new AWS.SsoCredentials(); },
  6056. * function () { return new AWS.SharedIniFileCredentials(); },
  6057. * function () { return new AWS.ECSCredentials(); },
  6058. * function () { return new AWS.ProcessCredentials(); },
  6059. * function () { return new AWS.TokenFileWebIdentityCredentials(); },
  6060. * function () { return new AWS.EC2MetadataCredentials() }
  6061. * ]
  6062. * ```
  6063. */
  6064. AWS.CredentialProviderChain.defaultProviders = [];
  6065. /**
  6066. * @api private
  6067. */
  6068. AWS.CredentialProviderChain.addPromisesToClass = function addPromisesToClass(PromiseDependency) {
  6069. this.prototype.resolvePromise = AWS.util.promisifyMethod('resolve', PromiseDependency);
  6070. };
  6071. /**
  6072. * @api private
  6073. */
  6074. AWS.CredentialProviderChain.deletePromisesFromClass = function deletePromisesFromClass() {
  6075. delete this.prototype.resolvePromise;
  6076. };
  6077. AWS.util.addPromises(AWS.CredentialProviderChain);
  6078. /***/ }),
  6079. /* 49 */
  6080. /***/ (function(module, exports, __webpack_require__) {
  6081. var AWS = __webpack_require__(1);
  6082. var inherit = AWS.util.inherit;
  6083. /**
  6084. * The endpoint that a service will talk to, for example,
  6085. * `'https://ec2.ap-southeast-1.amazonaws.com'`. If
  6086. * you need to override an endpoint for a service, you can
  6087. * set the endpoint on a service by passing the endpoint
  6088. * object with the `endpoint` option key:
  6089. *
  6090. * ```javascript
  6091. * var ep = new AWS.Endpoint('awsproxy.example.com');
  6092. * var s3 = new AWS.S3({endpoint: ep});
  6093. * s3.service.endpoint.hostname == 'awsproxy.example.com'
  6094. * ```
  6095. *
  6096. * Note that if you do not specify a protocol, the protocol will
  6097. * be selected based on your current {AWS.config} configuration.
  6098. *
  6099. * @!attribute protocol
  6100. * @return [String] the protocol (http or https) of the endpoint
  6101. * URL
  6102. * @!attribute hostname
  6103. * @return [String] the host portion of the endpoint, e.g.,
  6104. * example.com
  6105. * @!attribute host
  6106. * @return [String] the host portion of the endpoint including
  6107. * the port, e.g., example.com:80
  6108. * @!attribute port
  6109. * @return [Integer] the port of the endpoint
  6110. * @!attribute href
  6111. * @return [String] the full URL of the endpoint
  6112. */
  6113. AWS.Endpoint = inherit({
  6114. /**
  6115. * @overload Endpoint(endpoint)
  6116. * Constructs a new endpoint given an endpoint URL. If the
  6117. * URL omits a protocol (http or https), the default protocol
  6118. * set in the global {AWS.config} will be used.
  6119. * @param endpoint [String] the URL to construct an endpoint from
  6120. */
  6121. constructor: function Endpoint(endpoint, config) {
  6122. AWS.util.hideProperties(this, ['slashes', 'auth', 'hash', 'search', 'query']);
  6123. if (typeof endpoint === 'undefined' || endpoint === null) {
  6124. throw new Error('Invalid endpoint: ' + endpoint);
  6125. } else if (typeof endpoint !== 'string') {
  6126. return AWS.util.copy(endpoint);
  6127. }
  6128. if (!endpoint.match(/^http/)) {
  6129. var useSSL = config && config.sslEnabled !== undefined ?
  6130. config.sslEnabled : AWS.config.sslEnabled;
  6131. endpoint = (useSSL ? 'https' : 'http') + '://' + endpoint;
  6132. }
  6133. AWS.util.update(this, AWS.util.urlParse(endpoint));
  6134. // Ensure the port property is set as an integer
  6135. if (this.port) {
  6136. this.port = parseInt(this.port, 10);
  6137. } else {
  6138. this.port = this.protocol === 'https:' ? 443 : 80;
  6139. }
  6140. }
  6141. });
  6142. /**
  6143. * The low level HTTP request object, encapsulating all HTTP header
  6144. * and body data sent by a service request.
  6145. *
  6146. * @!attribute method
  6147. * @return [String] the HTTP method of the request
  6148. * @!attribute path
  6149. * @return [String] the path portion of the URI, e.g.,
  6150. * "/list/?start=5&num=10"
  6151. * @!attribute headers
  6152. * @return [map<String,String>]
  6153. * a map of header keys and their respective values
  6154. * @!attribute body
  6155. * @return [String] the request body payload
  6156. * @!attribute endpoint
  6157. * @return [AWS.Endpoint] the endpoint for the request
  6158. * @!attribute region
  6159. * @api private
  6160. * @return [String] the region, for signing purposes only.
  6161. */
  6162. AWS.HttpRequest = inherit({
  6163. /**
  6164. * @api private
  6165. */
  6166. constructor: function HttpRequest(endpoint, region) {
  6167. endpoint = new AWS.Endpoint(endpoint);
  6168. this.method = 'POST';
  6169. this.path = endpoint.path || '/';
  6170. this.headers = {};
  6171. this.body = '';
  6172. this.endpoint = endpoint;
  6173. this.region = region;
  6174. this._userAgent = '';
  6175. this.setUserAgent();
  6176. },
  6177. /**
  6178. * @api private
  6179. */
  6180. setUserAgent: function setUserAgent() {
  6181. this._userAgent = this.headers[this.getUserAgentHeaderName()] = AWS.util.userAgent();
  6182. },
  6183. getUserAgentHeaderName: function getUserAgentHeaderName() {
  6184. var prefix = AWS.util.isBrowser() ? 'X-Amz-' : '';
  6185. return prefix + 'User-Agent';
  6186. },
  6187. /**
  6188. * @api private
  6189. */
  6190. appendToUserAgent: function appendToUserAgent(agentPartial) {
  6191. if (typeof agentPartial === 'string' && agentPartial) {
  6192. this._userAgent += ' ' + agentPartial;
  6193. }
  6194. this.headers[this.getUserAgentHeaderName()] = this._userAgent;
  6195. },
  6196. /**
  6197. * @api private
  6198. */
  6199. getUserAgent: function getUserAgent() {
  6200. return this._userAgent;
  6201. },
  6202. /**
  6203. * @return [String] the part of the {path} excluding the
  6204. * query string
  6205. */
  6206. pathname: function pathname() {
  6207. return this.path.split('?', 1)[0];
  6208. },
  6209. /**
  6210. * @return [String] the query string portion of the {path}
  6211. */
  6212. search: function search() {
  6213. var query = this.path.split('?', 2)[1];
  6214. if (query) {
  6215. query = AWS.util.queryStringParse(query);
  6216. return AWS.util.queryParamsToString(query);
  6217. }
  6218. return '';
  6219. },
  6220. /**
  6221. * @api private
  6222. * update httpRequest endpoint with endpoint string
  6223. */
  6224. updateEndpoint: function updateEndpoint(endpointStr) {
  6225. var newEndpoint = new AWS.Endpoint(endpointStr);
  6226. this.endpoint = newEndpoint;
  6227. this.path = newEndpoint.path || '/';
  6228. if (this.headers['Host']) {
  6229. this.headers['Host'] = newEndpoint.host;
  6230. }
  6231. }
  6232. });
  6233. /**
  6234. * The low level HTTP response object, encapsulating all HTTP header
  6235. * and body data returned from the request.
  6236. *
  6237. * @!attribute statusCode
  6238. * @return [Integer] the HTTP status code of the response (e.g., 200, 404)
  6239. * @!attribute headers
  6240. * @return [map<String,String>]
  6241. * a map of response header keys and their respective values
  6242. * @!attribute body
  6243. * @return [String] the response body payload
  6244. * @!attribute [r] streaming
  6245. * @return [Boolean] whether this response is being streamed at a low-level.
  6246. * Defaults to `false` (buffered reads). Do not modify this manually, use
  6247. * {createUnbufferedStream} to convert the stream to unbuffered mode
  6248. * instead.
  6249. */
  6250. AWS.HttpResponse = inherit({
  6251. /**
  6252. * @api private
  6253. */
  6254. constructor: function HttpResponse() {
  6255. this.statusCode = undefined;
  6256. this.headers = {};
  6257. this.body = undefined;
  6258. this.streaming = false;
  6259. this.stream = null;
  6260. },
  6261. /**
  6262. * Disables buffering on the HTTP response and returns the stream for reading.
  6263. * @return [Stream, XMLHttpRequest, null] the underlying stream object.
  6264. * Use this object to directly read data off of the stream.
  6265. * @note This object is only available after the {AWS.Request~httpHeaders}
  6266. * event has fired. This method must be called prior to
  6267. * {AWS.Request~httpData}.
  6268. * @example Taking control of a stream
  6269. * request.on('httpHeaders', function(statusCode, headers) {
  6270. * if (statusCode < 300) {
  6271. * if (headers.etag === 'xyz') {
  6272. * // pipe the stream, disabling buffering
  6273. * var stream = this.response.httpResponse.createUnbufferedStream();
  6274. * stream.pipe(process.stdout);
  6275. * } else { // abort this request and set a better error message
  6276. * this.abort();
  6277. * this.response.error = new Error('Invalid ETag');
  6278. * }
  6279. * }
  6280. * }).send(console.log);
  6281. */
  6282. createUnbufferedStream: function createUnbufferedStream() {
  6283. this.streaming = true;
  6284. return this.stream;
  6285. }
  6286. });
  6287. AWS.HttpClient = inherit({});
  6288. /**
  6289. * @api private
  6290. */
  6291. AWS.HttpClient.getInstance = function getInstance() {
  6292. if (this.singleton === undefined) {
  6293. this.singleton = new this();
  6294. }
  6295. return this.singleton;
  6296. };
  6297. /***/ }),
  6298. /* 50 */
  6299. /***/ (function(module, exports, __webpack_require__) {
  6300. /* WEBPACK VAR INJECTION */(function(process) {var AWS = __webpack_require__(1);
  6301. var SequentialExecutor = __webpack_require__(41);
  6302. var DISCOVER_ENDPOINT = __webpack_require__(51).discoverEndpoint;
  6303. /**
  6304. * The namespace used to register global event listeners for request building
  6305. * and sending.
  6306. */
  6307. AWS.EventListeners = {
  6308. /**
  6309. * @!attribute VALIDATE_CREDENTIALS
  6310. * A request listener that validates whether the request is being
  6311. * sent with credentials.
  6312. * Handles the {AWS.Request~validate 'validate' Request event}
  6313. * @example Sending a request without validating credentials
  6314. * var listener = AWS.EventListeners.Core.VALIDATE_CREDENTIALS;
  6315. * request.removeListener('validate', listener);
  6316. * @readonly
  6317. * @return [Function]
  6318. * @!attribute VALIDATE_REGION
  6319. * A request listener that validates whether the region is set
  6320. * for a request.
  6321. * Handles the {AWS.Request~validate 'validate' Request event}
  6322. * @example Sending a request without validating region configuration
  6323. * var listener = AWS.EventListeners.Core.VALIDATE_REGION;
  6324. * request.removeListener('validate', listener);
  6325. * @readonly
  6326. * @return [Function]
  6327. * @!attribute VALIDATE_PARAMETERS
  6328. * A request listener that validates input parameters in a request.
  6329. * Handles the {AWS.Request~validate 'validate' Request event}
  6330. * @example Sending a request without validating parameters
  6331. * var listener = AWS.EventListeners.Core.VALIDATE_PARAMETERS;
  6332. * request.removeListener('validate', listener);
  6333. * @example Disable parameter validation globally
  6334. * AWS.EventListeners.Core.removeListener('validate',
  6335. * AWS.EventListeners.Core.VALIDATE_REGION);
  6336. * @readonly
  6337. * @return [Function]
  6338. * @!attribute SEND
  6339. * A request listener that initiates the HTTP connection for a
  6340. * request being sent. Handles the {AWS.Request~send 'send' Request event}
  6341. * @example Replacing the HTTP handler
  6342. * var listener = AWS.EventListeners.Core.SEND;
  6343. * request.removeListener('send', listener);
  6344. * request.on('send', function(response) {
  6345. * customHandler.send(response);
  6346. * });
  6347. * @return [Function]
  6348. * @readonly
  6349. * @!attribute HTTP_DATA
  6350. * A request listener that reads data from the HTTP connection in order
  6351. * to build the response data.
  6352. * Handles the {AWS.Request~httpData 'httpData' Request event}.
  6353. * Remove this handler if you are overriding the 'httpData' event and
  6354. * do not want extra data processing and buffering overhead.
  6355. * @example Disabling default data processing
  6356. * var listener = AWS.EventListeners.Core.HTTP_DATA;
  6357. * request.removeListener('httpData', listener);
  6358. * @return [Function]
  6359. * @readonly
  6360. */
  6361. Core: {} /* doc hack */
  6362. };
  6363. /**
  6364. * @api private
  6365. */
  6366. function getOperationAuthtype(req) {
  6367. if (!req.service.api.operations) {
  6368. return '';
  6369. }
  6370. var operation = req.service.api.operations[req.operation];
  6371. return operation ? operation.authtype : '';
  6372. }
  6373. /**
  6374. * @api private
  6375. */
  6376. function getIdentityType(req) {
  6377. var service = req.service;
  6378. if (service.config.signatureVersion) {
  6379. return service.config.signatureVersion;
  6380. }
  6381. if (service.api.signatureVersion) {
  6382. return service.api.signatureVersion;
  6383. }
  6384. return getOperationAuthtype(req);
  6385. }
  6386. AWS.EventListeners = {
  6387. Core: new SequentialExecutor().addNamedListeners(function(add, addAsync) {
  6388. addAsync(
  6389. 'VALIDATE_CREDENTIALS', 'validate',
  6390. function VALIDATE_CREDENTIALS(req, done) {
  6391. if (!req.service.api.signatureVersion && !req.service.config.signatureVersion) return done(); // none
  6392. var identityType = getIdentityType(req);
  6393. if (identityType === 'bearer') {
  6394. req.service.config.getToken(function(err) {
  6395. if (err) {
  6396. req.response.error = AWS.util.error(err, {code: 'TokenError'});
  6397. }
  6398. done();
  6399. });
  6400. return;
  6401. }
  6402. req.service.config.getCredentials(function(err) {
  6403. if (err) {
  6404. req.response.error = AWS.util.error(err,
  6405. {
  6406. code: 'CredentialsError',
  6407. message: 'Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1'
  6408. }
  6409. );
  6410. }
  6411. done();
  6412. });
  6413. });
  6414. add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {
  6415. if (!req.service.isGlobalEndpoint) {
  6416. var dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
  6417. if (!req.service.config.region) {
  6418. req.response.error = AWS.util.error(new Error(),
  6419. {code: 'ConfigError', message: 'Missing region in config'});
  6420. } else if (!dnsHostRegex.test(req.service.config.region)) {
  6421. req.response.error = AWS.util.error(new Error(),
  6422. {code: 'ConfigError', message: 'Invalid region in config'});
  6423. }
  6424. }
  6425. });
  6426. add('BUILD_IDEMPOTENCY_TOKENS', 'validate', function BUILD_IDEMPOTENCY_TOKENS(req) {
  6427. if (!req.service.api.operations) {
  6428. return;
  6429. }
  6430. var operation = req.service.api.operations[req.operation];
  6431. if (!operation) {
  6432. return;
  6433. }
  6434. var idempotentMembers = operation.idempotentMembers;
  6435. if (!idempotentMembers.length) {
  6436. return;
  6437. }
  6438. // creates a copy of params so user's param object isn't mutated
  6439. var params = AWS.util.copy(req.params);
  6440. for (var i = 0, iLen = idempotentMembers.length; i < iLen; i++) {
  6441. if (!params[idempotentMembers[i]]) {
  6442. // add the member
  6443. params[idempotentMembers[i]] = AWS.util.uuid.v4();
  6444. }
  6445. }
  6446. req.params = params;
  6447. });
  6448. add('VALIDATE_PARAMETERS', 'validate', function VALIDATE_PARAMETERS(req) {
  6449. if (!req.service.api.operations) {
  6450. return;
  6451. }
  6452. var rules = req.service.api.operations[req.operation].input;
  6453. var validation = req.service.config.paramValidation;
  6454. new AWS.ParamValidator(validation).validate(rules, req.params);
  6455. });
  6456. add('COMPUTE_CHECKSUM', 'afterBuild', function COMPUTE_CHECKSUM(req) {
  6457. if (!req.service.api.operations) {
  6458. return;
  6459. }
  6460. var operation = req.service.api.operations[req.operation];
  6461. if (!operation) {
  6462. return;
  6463. }
  6464. var body = req.httpRequest.body;
  6465. var isNonStreamingPayload = body && (AWS.util.Buffer.isBuffer(body) || typeof body === 'string');
  6466. var headers = req.httpRequest.headers;
  6467. if (
  6468. operation.httpChecksumRequired &&
  6469. req.service.config.computeChecksums &&
  6470. isNonStreamingPayload &&
  6471. !headers['Content-MD5']
  6472. ) {
  6473. var md5 = AWS.util.crypto.md5(body, 'base64');
  6474. headers['Content-MD5'] = md5;
  6475. }
  6476. });
  6477. addAsync('COMPUTE_SHA256', 'afterBuild', function COMPUTE_SHA256(req, done) {
  6478. req.haltHandlersOnError();
  6479. if (!req.service.api.operations) {
  6480. return;
  6481. }
  6482. var operation = req.service.api.operations[req.operation];
  6483. var authtype = operation ? operation.authtype : '';
  6484. if (!req.service.api.signatureVersion && !authtype && !req.service.config.signatureVersion) return done(); // none
  6485. if (req.service.getSignerClass(req) === AWS.Signers.V4) {
  6486. var body = req.httpRequest.body || '';
  6487. if (authtype.indexOf('unsigned-body') >= 0) {
  6488. req.httpRequest.headers['X-Amz-Content-Sha256'] = 'UNSIGNED-PAYLOAD';
  6489. return done();
  6490. }
  6491. AWS.util.computeSha256(body, function(err, sha) {
  6492. if (err) {
  6493. done(err);
  6494. }
  6495. else {
  6496. req.httpRequest.headers['X-Amz-Content-Sha256'] = sha;
  6497. done();
  6498. }
  6499. });
  6500. } else {
  6501. done();
  6502. }
  6503. });
  6504. add('SET_CONTENT_LENGTH', 'afterBuild', function SET_CONTENT_LENGTH(req) {
  6505. var authtype = getOperationAuthtype(req);
  6506. var payloadMember = AWS.util.getRequestPayloadShape(req);
  6507. if (req.httpRequest.headers['Content-Length'] === undefined) {
  6508. try {
  6509. var length = AWS.util.string.byteLength(req.httpRequest.body);
  6510. req.httpRequest.headers['Content-Length'] = length;
  6511. } catch (err) {
  6512. if (payloadMember && payloadMember.isStreaming) {
  6513. if (payloadMember.requiresLength) {
  6514. //streaming payload requires length(s3, glacier)
  6515. throw err;
  6516. } else if (authtype.indexOf('unsigned-body') >= 0) {
  6517. //unbounded streaming payload(lex, mediastore)
  6518. req.httpRequest.headers['Transfer-Encoding'] = 'chunked';
  6519. return;
  6520. } else {
  6521. throw err;
  6522. }
  6523. }
  6524. throw err;
  6525. }
  6526. }
  6527. });
  6528. add('SET_HTTP_HOST', 'afterBuild', function SET_HTTP_HOST(req) {
  6529. req.httpRequest.headers['Host'] = req.httpRequest.endpoint.host;
  6530. });
  6531. add('SET_TRACE_ID', 'afterBuild', function SET_TRACE_ID(req) {
  6532. var traceIdHeaderName = 'X-Amzn-Trace-Id';
  6533. if (AWS.util.isNode() && !Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)) {
  6534. var ENV_LAMBDA_FUNCTION_NAME = 'AWS_LAMBDA_FUNCTION_NAME';
  6535. var ENV_TRACE_ID = '_X_AMZN_TRACE_ID';
  6536. var functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
  6537. var traceId = process.env[ENV_TRACE_ID];
  6538. if (
  6539. typeof functionName === 'string' &&
  6540. functionName.length > 0 &&
  6541. typeof traceId === 'string' &&
  6542. traceId.length > 0
  6543. ) {
  6544. req.httpRequest.headers[traceIdHeaderName] = traceId;
  6545. }
  6546. }
  6547. });
  6548. add('RESTART', 'restart', function RESTART() {
  6549. var err = this.response.error;
  6550. if (!err || !err.retryable) return;
  6551. this.httpRequest = new AWS.HttpRequest(
  6552. this.service.endpoint,
  6553. this.service.region
  6554. );
  6555. if (this.response.retryCount < this.service.config.maxRetries) {
  6556. this.response.retryCount++;
  6557. } else {
  6558. this.response.error = null;
  6559. }
  6560. });
  6561. var addToHead = true;
  6562. addAsync('DISCOVER_ENDPOINT', 'sign', DISCOVER_ENDPOINT, addToHead);
  6563. addAsync('SIGN', 'sign', function SIGN(req, done) {
  6564. var service = req.service;
  6565. var identityType = getIdentityType(req);
  6566. if (!identityType || identityType.length === 0) return done(); // none
  6567. if (identityType === 'bearer') {
  6568. service.config.getToken(function (err, token) {
  6569. if (err) {
  6570. req.response.error = err;
  6571. return done();
  6572. }
  6573. try {
  6574. var SignerClass = service.getSignerClass(req);
  6575. var signer = new SignerClass(req.httpRequest);
  6576. signer.addAuthorization(token);
  6577. } catch (e) {
  6578. req.response.error = e;
  6579. }
  6580. done();
  6581. });
  6582. } else {
  6583. service.config.getCredentials(function (err, credentials) {
  6584. if (err) {
  6585. req.response.error = err;
  6586. return done();
  6587. }
  6588. try {
  6589. var date = service.getSkewCorrectedDate();
  6590. var SignerClass = service.getSignerClass(req);
  6591. var operations = req.service.api.operations || {};
  6592. var operation = operations[req.operation];
  6593. var signer = new SignerClass(req.httpRequest,
  6594. service.getSigningName(req),
  6595. {
  6596. signatureCache: service.config.signatureCache,
  6597. operation: operation,
  6598. signatureVersion: service.api.signatureVersion
  6599. });
  6600. signer.setServiceClientId(service._clientId);
  6601. // clear old authorization headers
  6602. delete req.httpRequest.headers['Authorization'];
  6603. delete req.httpRequest.headers['Date'];
  6604. delete req.httpRequest.headers['X-Amz-Date'];
  6605. // add new authorization
  6606. signer.addAuthorization(credentials, date);
  6607. req.signedAt = date;
  6608. } catch (e) {
  6609. req.response.error = e;
  6610. }
  6611. done();
  6612. });
  6613. }
  6614. });
  6615. add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {
  6616. if (this.service.successfulResponse(resp, this)) {
  6617. resp.data = {};
  6618. resp.error = null;
  6619. } else {
  6620. resp.data = null;
  6621. resp.error = AWS.util.error(new Error(),
  6622. {code: 'UnknownError', message: 'An unknown error occurred.'});
  6623. }
  6624. });
  6625. add('ERROR', 'error', function ERROR(err, resp) {
  6626. var awsQueryCompatible = resp.request.service.api.awsQueryCompatible;
  6627. if (awsQueryCompatible) {
  6628. var headers = resp.httpResponse.headers;
  6629. var queryErrorCode = headers ? headers['x-amzn-query-error'] : undefined;
  6630. if (queryErrorCode && queryErrorCode.includes(';')) {
  6631. resp.error.code = queryErrorCode.split(';')[0];
  6632. }
  6633. }
  6634. }, true);
  6635. addAsync('SEND', 'send', function SEND(resp, done) {
  6636. resp.httpResponse._abortCallback = done;
  6637. resp.error = null;
  6638. resp.data = null;
  6639. function callback(httpResp) {
  6640. resp.httpResponse.stream = httpResp;
  6641. var stream = resp.request.httpRequest.stream;
  6642. var service = resp.request.service;
  6643. var api = service.api;
  6644. var operationName = resp.request.operation;
  6645. var operation = api.operations[operationName] || {};
  6646. httpResp.on('headers', function onHeaders(statusCode, headers, statusMessage) {
  6647. resp.request.emit(
  6648. 'httpHeaders',
  6649. [statusCode, headers, resp, statusMessage]
  6650. );
  6651. if (!resp.httpResponse.streaming) {
  6652. if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check
  6653. // if we detect event streams, we're going to have to
  6654. // return the stream immediately
  6655. if (operation.hasEventOutput && service.successfulResponse(resp)) {
  6656. // skip reading the IncomingStream
  6657. resp.request.emit('httpDone');
  6658. done();
  6659. return;
  6660. }
  6661. httpResp.on('readable', function onReadable() {
  6662. var data = httpResp.read();
  6663. if (data !== null) {
  6664. resp.request.emit('httpData', [data, resp]);
  6665. }
  6666. });
  6667. } else { // legacy streams API
  6668. httpResp.on('data', function onData(data) {
  6669. resp.request.emit('httpData', [data, resp]);
  6670. });
  6671. }
  6672. }
  6673. });
  6674. httpResp.on('end', function onEnd() {
  6675. if (!stream || !stream.didCallback) {
  6676. if (AWS.HttpClient.streamsApiVersion === 2 && (operation.hasEventOutput && service.successfulResponse(resp))) {
  6677. // don't concatenate response chunks when streaming event stream data when response is successful
  6678. return;
  6679. }
  6680. resp.request.emit('httpDone');
  6681. done();
  6682. }
  6683. });
  6684. }
  6685. function progress(httpResp) {
  6686. httpResp.on('sendProgress', function onSendProgress(value) {
  6687. resp.request.emit('httpUploadProgress', [value, resp]);
  6688. });
  6689. httpResp.on('receiveProgress', function onReceiveProgress(value) {
  6690. resp.request.emit('httpDownloadProgress', [value, resp]);
  6691. });
  6692. }
  6693. function error(err) {
  6694. if (err.code !== 'RequestAbortedError') {
  6695. var errCode = err.code === 'TimeoutError' ? err.code : 'NetworkingError';
  6696. err = AWS.util.error(err, {
  6697. code: errCode,
  6698. region: resp.request.httpRequest.region,
  6699. hostname: resp.request.httpRequest.endpoint.hostname,
  6700. retryable: true
  6701. });
  6702. }
  6703. resp.error = err;
  6704. resp.request.emit('httpError', [resp.error, resp], function() {
  6705. done();
  6706. });
  6707. }
  6708. function executeSend() {
  6709. var http = AWS.HttpClient.getInstance();
  6710. var httpOptions = resp.request.service.config.httpOptions || {};
  6711. try {
  6712. var stream = http.handleRequest(resp.request.httpRequest, httpOptions,
  6713. callback, error);
  6714. progress(stream);
  6715. } catch (err) {
  6716. error(err);
  6717. }
  6718. }
  6719. var timeDiff = (resp.request.service.getSkewCorrectedDate() - this.signedAt) / 1000;
  6720. if (timeDiff >= 60 * 10) { // if we signed 10min ago, re-sign
  6721. this.emit('sign', [this], function(err) {
  6722. if (err) done(err);
  6723. else executeSend();
  6724. });
  6725. } else {
  6726. executeSend();
  6727. }
  6728. });
  6729. add('HTTP_HEADERS', 'httpHeaders',
  6730. function HTTP_HEADERS(statusCode, headers, resp, statusMessage) {
  6731. resp.httpResponse.statusCode = statusCode;
  6732. resp.httpResponse.statusMessage = statusMessage;
  6733. resp.httpResponse.headers = headers;
  6734. resp.httpResponse.body = AWS.util.buffer.toBuffer('');
  6735. resp.httpResponse.buffers = [];
  6736. resp.httpResponse.numBytes = 0;
  6737. var dateHeader = headers.date || headers.Date;
  6738. var service = resp.request.service;
  6739. if (dateHeader) {
  6740. var serverTime = Date.parse(dateHeader);
  6741. if (service.config.correctClockSkew
  6742. && service.isClockSkewed(serverTime)) {
  6743. service.applyClockOffset(serverTime);
  6744. }
  6745. }
  6746. });
  6747. add('HTTP_DATA', 'httpData', function HTTP_DATA(chunk, resp) {
  6748. if (chunk) {
  6749. if (AWS.util.isNode()) {
  6750. resp.httpResponse.numBytes += chunk.length;
  6751. var total = resp.httpResponse.headers['content-length'];
  6752. var progress = { loaded: resp.httpResponse.numBytes, total: total };
  6753. resp.request.emit('httpDownloadProgress', [progress, resp]);
  6754. }
  6755. resp.httpResponse.buffers.push(AWS.util.buffer.toBuffer(chunk));
  6756. }
  6757. });
  6758. add('HTTP_DONE', 'httpDone', function HTTP_DONE(resp) {
  6759. // convert buffers array into single buffer
  6760. if (resp.httpResponse.buffers && resp.httpResponse.buffers.length > 0) {
  6761. var body = AWS.util.buffer.concat(resp.httpResponse.buffers);
  6762. resp.httpResponse.body = body;
  6763. }
  6764. delete resp.httpResponse.numBytes;
  6765. delete resp.httpResponse.buffers;
  6766. });
  6767. add('FINALIZE_ERROR', 'retry', function FINALIZE_ERROR(resp) {
  6768. if (resp.httpResponse.statusCode) {
  6769. resp.error.statusCode = resp.httpResponse.statusCode;
  6770. if (resp.error.retryable === undefined) {
  6771. resp.error.retryable = this.service.retryableError(resp.error, this);
  6772. }
  6773. }
  6774. });
  6775. add('INVALIDATE_CREDENTIALS', 'retry', function INVALIDATE_CREDENTIALS(resp) {
  6776. if (!resp.error) return;
  6777. switch (resp.error.code) {
  6778. case 'RequestExpired': // EC2 only
  6779. case 'ExpiredTokenException':
  6780. case 'ExpiredToken':
  6781. resp.error.retryable = true;
  6782. resp.request.service.config.credentials.expired = true;
  6783. }
  6784. });
  6785. add('EXPIRED_SIGNATURE', 'retry', function EXPIRED_SIGNATURE(resp) {
  6786. var err = resp.error;
  6787. if (!err) return;
  6788. if (typeof err.code === 'string' && typeof err.message === 'string') {
  6789. if (err.code.match(/Signature/) && err.message.match(/expired/)) {
  6790. resp.error.retryable = true;
  6791. }
  6792. }
  6793. });
  6794. add('CLOCK_SKEWED', 'retry', function CLOCK_SKEWED(resp) {
  6795. if (!resp.error) return;
  6796. if (this.service.clockSkewError(resp.error)
  6797. && this.service.config.correctClockSkew) {
  6798. resp.error.retryable = true;
  6799. }
  6800. });
  6801. add('REDIRECT', 'retry', function REDIRECT(resp) {
  6802. if (resp.error && resp.error.statusCode >= 300 &&
  6803. resp.error.statusCode < 400 && resp.httpResponse.headers['location']) {
  6804. this.httpRequest.endpoint =
  6805. new AWS.Endpoint(resp.httpResponse.headers['location']);
  6806. this.httpRequest.headers['Host'] = this.httpRequest.endpoint.host;
  6807. this.httpRequest.path = this.httpRequest.endpoint.path;
  6808. resp.error.redirect = true;
  6809. resp.error.retryable = true;
  6810. }
  6811. });
  6812. add('RETRY_CHECK', 'retry', function RETRY_CHECK(resp) {
  6813. if (resp.error) {
  6814. if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {
  6815. resp.error.retryDelay = 0;
  6816. } else if (resp.retryCount < resp.maxRetries) {
  6817. resp.error.retryDelay = this.service.retryDelays(resp.retryCount, resp.error) || 0;
  6818. }
  6819. }
  6820. });
  6821. addAsync('RESET_RETRY_STATE', 'afterRetry', function RESET_RETRY_STATE(resp, done) {
  6822. var delay, willRetry = false;
  6823. if (resp.error) {
  6824. delay = resp.error.retryDelay || 0;
  6825. if (resp.error.retryable && resp.retryCount < resp.maxRetries) {
  6826. resp.retryCount++;
  6827. willRetry = true;
  6828. } else if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {
  6829. resp.redirectCount++;
  6830. willRetry = true;
  6831. }
  6832. }
  6833. // delay < 0 is a signal from customBackoff to skip retries
  6834. if (willRetry && delay >= 0) {
  6835. resp.error = null;
  6836. setTimeout(done, delay);
  6837. } else {
  6838. done();
  6839. }
  6840. });
  6841. }),
  6842. CorePost: new SequentialExecutor().addNamedListeners(function(add) {
  6843. add('EXTRACT_REQUEST_ID', 'extractData', AWS.util.extractRequestId);
  6844. add('EXTRACT_REQUEST_ID', 'extractError', AWS.util.extractRequestId);
  6845. add('ENOTFOUND_ERROR', 'httpError', function ENOTFOUND_ERROR(err) {
  6846. function isDNSError(err) {
  6847. return err.errno === 'ENOTFOUND' ||
  6848. typeof err.errno === 'number' &&
  6849. typeof AWS.util.getSystemErrorName === 'function' &&
  6850. ['EAI_NONAME', 'EAI_NODATA'].indexOf(AWS.util.getSystemErrorName(err.errno) >= 0);
  6851. }
  6852. if (err.code === 'NetworkingError' && isDNSError(err)) {
  6853. var message = 'Inaccessible host: `' + err.hostname + '\' at port `' + err.port +
  6854. '\'. This service may not be available in the `' + err.region +
  6855. '\' region.';
  6856. this.response.error = AWS.util.error(new Error(message), {
  6857. code: 'UnknownEndpoint',
  6858. region: err.region,
  6859. hostname: err.hostname,
  6860. retryable: true,
  6861. originalError: err
  6862. });
  6863. }
  6864. });
  6865. }),
  6866. Logger: new SequentialExecutor().addNamedListeners(function(add) {
  6867. add('LOG_REQUEST', 'complete', function LOG_REQUEST(resp) {
  6868. var req = resp.request;
  6869. var logger = req.service.config.logger;
  6870. if (!logger) return;
  6871. function filterSensitiveLog(inputShape, shape) {
  6872. if (!shape) {
  6873. return shape;
  6874. }
  6875. if (inputShape.isSensitive) {
  6876. return '***SensitiveInformation***';
  6877. }
  6878. switch (inputShape.type) {
  6879. case 'structure':
  6880. var struct = {};
  6881. AWS.util.each(shape, function(subShapeName, subShape) {
  6882. if (Object.prototype.hasOwnProperty.call(inputShape.members, subShapeName)) {
  6883. struct[subShapeName] = filterSensitiveLog(inputShape.members[subShapeName], subShape);
  6884. } else {
  6885. struct[subShapeName] = subShape;
  6886. }
  6887. });
  6888. return struct;
  6889. case 'list':
  6890. var list = [];
  6891. AWS.util.arrayEach(shape, function(subShape, index) {
  6892. list.push(filterSensitiveLog(inputShape.member, subShape));
  6893. });
  6894. return list;
  6895. case 'map':
  6896. var map = {};
  6897. AWS.util.each(shape, function(key, value) {
  6898. map[key] = filterSensitiveLog(inputShape.value, value);
  6899. });
  6900. return map;
  6901. default:
  6902. return shape;
  6903. }
  6904. }
  6905. function buildMessage() {
  6906. var time = resp.request.service.getSkewCorrectedDate().getTime();
  6907. var delta = (time - req.startTime.getTime()) / 1000;
  6908. var ansi = logger.isTTY ? true : false;
  6909. var status = resp.httpResponse.statusCode;
  6910. var censoredParams = req.params;
  6911. if (
  6912. req.service.api.operations &&
  6913. req.service.api.operations[req.operation] &&
  6914. req.service.api.operations[req.operation].input
  6915. ) {
  6916. var inputShape = req.service.api.operations[req.operation].input;
  6917. censoredParams = filterSensitiveLog(inputShape, req.params);
  6918. }
  6919. var params = __webpack_require__(52).inspect(censoredParams, true, null);
  6920. var message = '';
  6921. if (ansi) message += '\x1B[33m';
  6922. message += '[AWS ' + req.service.serviceIdentifier + ' ' + status;
  6923. message += ' ' + delta.toString() + 's ' + resp.retryCount + ' retries]';
  6924. if (ansi) message += '\x1B[0;1m';
  6925. message += ' ' + AWS.util.string.lowerFirst(req.operation);
  6926. message += '(' + params + ')';
  6927. if (ansi) message += '\x1B[0m';
  6928. return message;
  6929. }
  6930. var line = buildMessage();
  6931. if (typeof logger.log === 'function') {
  6932. logger.log(line);
  6933. } else if (typeof logger.write === 'function') {
  6934. logger.write(line + '\n');
  6935. }
  6936. });
  6937. }),
  6938. Json: new SequentialExecutor().addNamedListeners(function(add) {
  6939. var svc = __webpack_require__(18);
  6940. add('BUILD', 'build', svc.buildRequest);
  6941. add('EXTRACT_DATA', 'extractData', svc.extractData);
  6942. add('EXTRACT_ERROR', 'extractError', svc.extractError);
  6943. }),
  6944. Rest: new SequentialExecutor().addNamedListeners(function(add) {
  6945. var svc = __webpack_require__(26);
  6946. add('BUILD', 'build', svc.buildRequest);
  6947. add('EXTRACT_DATA', 'extractData', svc.extractData);
  6948. add('EXTRACT_ERROR', 'extractError', svc.extractError);
  6949. }),
  6950. RestJson: new SequentialExecutor().addNamedListeners(function(add) {
  6951. var svc = __webpack_require__(27);
  6952. add('BUILD', 'build', svc.buildRequest);
  6953. add('EXTRACT_DATA', 'extractData', svc.extractData);
  6954. add('EXTRACT_ERROR', 'extractError', svc.extractError);
  6955. add('UNSET_CONTENT_LENGTH', 'afterBuild', svc.unsetContentLength);
  6956. }),
  6957. RestXml: new SequentialExecutor().addNamedListeners(function(add) {
  6958. var svc = __webpack_require__(28);
  6959. add('BUILD', 'build', svc.buildRequest);
  6960. add('EXTRACT_DATA', 'extractData', svc.extractData);
  6961. add('EXTRACT_ERROR', 'extractError', svc.extractError);
  6962. }),
  6963. Query: new SequentialExecutor().addNamedListeners(function(add) {
  6964. var svc = __webpack_require__(22);
  6965. add('BUILD', 'build', svc.buildRequest);
  6966. add('EXTRACT_DATA', 'extractData', svc.extractData);
  6967. add('EXTRACT_ERROR', 'extractError', svc.extractError);
  6968. })
  6969. };
  6970. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  6971. /***/ }),
  6972. /* 51 */
  6973. /***/ (function(module, exports, __webpack_require__) {
  6974. /* WEBPACK VAR INJECTION */(function(process) {var AWS = __webpack_require__(1);
  6975. var util = __webpack_require__(2);
  6976. var endpointDiscoveryEnabledEnvs = ['AWS_ENABLE_ENDPOINT_DISCOVERY', 'AWS_ENDPOINT_DISCOVERY_ENABLED'];
  6977. /**
  6978. * Generate key (except resources and operation part) to index the endpoints in the cache
  6979. * If input shape has endpointdiscoveryid trait then use
  6980. * accessKey + operation + resources + region + service as cache key
  6981. * If input shape doesn't have endpointdiscoveryid trait then use
  6982. * accessKey + region + service as cache key
  6983. * @return [map<String,String>] object with keys to index endpoints.
  6984. * @api private
  6985. */
  6986. function getCacheKey(request) {
  6987. var service = request.service;
  6988. var api = service.api || {};
  6989. var operations = api.operations;
  6990. var identifiers = {};
  6991. if (service.config.region) {
  6992. identifiers.region = service.config.region;
  6993. }
  6994. if (api.serviceId) {
  6995. identifiers.serviceId = api.serviceId;
  6996. }
  6997. if (service.config.credentials.accessKeyId) {
  6998. identifiers.accessKeyId = service.config.credentials.accessKeyId;
  6999. }
  7000. return identifiers;
  7001. }
  7002. /**
  7003. * Recursive helper for marshallCustomIdentifiers().
  7004. * Looks for required string input members that have 'endpointdiscoveryid' trait.
  7005. * @api private
  7006. */
  7007. function marshallCustomIdentifiersHelper(result, params, shape) {
  7008. if (!shape || params === undefined || params === null) return;
  7009. if (shape.type === 'structure' && shape.required && shape.required.length > 0) {
  7010. util.arrayEach(shape.required, function(name) {
  7011. var memberShape = shape.members[name];
  7012. if (memberShape.endpointDiscoveryId === true) {
  7013. var locationName = memberShape.isLocationName ? memberShape.name : name;
  7014. result[locationName] = String(params[name]);
  7015. } else {
  7016. marshallCustomIdentifiersHelper(result, params[name], memberShape);
  7017. }
  7018. });
  7019. }
  7020. }
  7021. /**
  7022. * Get custom identifiers for cache key.
  7023. * Identifies custom identifiers by checking each shape's `endpointDiscoveryId` trait.
  7024. * @param [object] request object
  7025. * @param [object] input shape of the given operation's api
  7026. * @api private
  7027. */
  7028. function marshallCustomIdentifiers(request, shape) {
  7029. var identifiers = {};
  7030. marshallCustomIdentifiersHelper(identifiers, request.params, shape);
  7031. return identifiers;
  7032. }
  7033. /**
  7034. * Call endpoint discovery operation when it's optional.
  7035. * When endpoint is available in cache then use the cached endpoints. If endpoints
  7036. * are unavailable then use regional endpoints and call endpoint discovery operation
  7037. * asynchronously. This is turned off by default.
  7038. * @param [object] request object
  7039. * @api private
  7040. */
  7041. function optionalDiscoverEndpoint(request) {
  7042. var service = request.service;
  7043. var api = service.api;
  7044. var operationModel = api.operations ? api.operations[request.operation] : undefined;
  7045. var inputShape = operationModel ? operationModel.input : undefined;
  7046. var identifiers = marshallCustomIdentifiers(request, inputShape);
  7047. var cacheKey = getCacheKey(request);
  7048. if (Object.keys(identifiers).length > 0) {
  7049. cacheKey = util.update(cacheKey, identifiers);
  7050. if (operationModel) cacheKey.operation = operationModel.name;
  7051. }
  7052. var endpoints = AWS.endpointCache.get(cacheKey);
  7053. if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
  7054. //endpoint operation is being made but response not yet received
  7055. //or endpoint operation just failed in 1 minute
  7056. return;
  7057. } else if (endpoints && endpoints.length > 0) {
  7058. //found endpoint record from cache
  7059. request.httpRequest.updateEndpoint(endpoints[0].Address);
  7060. } else {
  7061. //endpoint record not in cache or outdated. make discovery operation
  7062. var endpointRequest = service.makeRequest(api.endpointOperation, {
  7063. Operation: operationModel.name,
  7064. Identifiers: identifiers,
  7065. });
  7066. addApiVersionHeader(endpointRequest);
  7067. endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
  7068. endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);
  7069. //put in a placeholder for endpoints already requested, prevent
  7070. //too much in-flight calls
  7071. AWS.endpointCache.put(cacheKey, [{
  7072. Address: '',
  7073. CachePeriodInMinutes: 1
  7074. }]);
  7075. endpointRequest.send(function(err, data) {
  7076. if (data && data.Endpoints) {
  7077. AWS.endpointCache.put(cacheKey, data.Endpoints);
  7078. } else if (err) {
  7079. AWS.endpointCache.put(cacheKey, [{
  7080. Address: '',
  7081. CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute
  7082. }]);
  7083. }
  7084. });
  7085. }
  7086. }
  7087. var requestQueue = {};
  7088. /**
  7089. * Call endpoint discovery operation when it's required.
  7090. * When endpoint is available in cache then use cached ones. If endpoints are
  7091. * unavailable then SDK should call endpoint operation then use returned new
  7092. * endpoint for the api call. SDK will automatically attempt to do endpoint
  7093. * discovery. This is turned off by default
  7094. * @param [object] request object
  7095. * @api private
  7096. */
  7097. function requiredDiscoverEndpoint(request, done) {
  7098. var service = request.service;
  7099. var api = service.api;
  7100. var operationModel = api.operations ? api.operations[request.operation] : undefined;
  7101. var inputShape = operationModel ? operationModel.input : undefined;
  7102. var identifiers = marshallCustomIdentifiers(request, inputShape);
  7103. var cacheKey = getCacheKey(request);
  7104. if (Object.keys(identifiers).length > 0) {
  7105. cacheKey = util.update(cacheKey, identifiers);
  7106. if (operationModel) cacheKey.operation = operationModel.name;
  7107. }
  7108. var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);
  7109. var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys
  7110. if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
  7111. //endpoint operation is being made but response not yet received
  7112. //push request object to a pending queue
  7113. if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];
  7114. requestQueue[cacheKeyStr].push({request: request, callback: done});
  7115. return;
  7116. } else if (endpoints && endpoints.length > 0) {
  7117. request.httpRequest.updateEndpoint(endpoints[0].Address);
  7118. done();
  7119. } else {
  7120. var endpointRequest = service.makeRequest(api.endpointOperation, {
  7121. Operation: operationModel.name,
  7122. Identifiers: identifiers,
  7123. });
  7124. endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
  7125. addApiVersionHeader(endpointRequest);
  7126. //put in a placeholder for endpoints already requested, prevent
  7127. //too much in-flight calls
  7128. AWS.endpointCache.put(cacheKeyStr, [{
  7129. Address: '',
  7130. CachePeriodInMinutes: 60 //long-live cache
  7131. }]);
  7132. endpointRequest.send(function(err, data) {
  7133. if (err) {
  7134. request.response.error = util.error(err, { retryable: false });
  7135. AWS.endpointCache.remove(cacheKey);
  7136. //fail all the pending requests in batch
  7137. if (requestQueue[cacheKeyStr]) {
  7138. var pendingRequests = requestQueue[cacheKeyStr];
  7139. util.arrayEach(pendingRequests, function(requestContext) {
  7140. requestContext.request.response.error = util.error(err, { retryable: false });
  7141. requestContext.callback();
  7142. });
  7143. delete requestQueue[cacheKeyStr];
  7144. }
  7145. } else if (data) {
  7146. AWS.endpointCache.put(cacheKeyStr, data.Endpoints);
  7147. request.httpRequest.updateEndpoint(data.Endpoints[0].Address);
  7148. //update the endpoint for all the pending requests in batch
  7149. if (requestQueue[cacheKeyStr]) {
  7150. var pendingRequests = requestQueue[cacheKeyStr];
  7151. util.arrayEach(pendingRequests, function(requestContext) {
  7152. requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);
  7153. requestContext.callback();
  7154. });
  7155. delete requestQueue[cacheKeyStr];
  7156. }
  7157. }
  7158. done();
  7159. });
  7160. }
  7161. }
  7162. /**
  7163. * add api version header to endpoint operation
  7164. * @api private
  7165. */
  7166. function addApiVersionHeader(endpointRequest) {
  7167. var api = endpointRequest.service.api;
  7168. var apiVersion = api.apiVersion;
  7169. if (apiVersion && !endpointRequest.httpRequest.headers['x-amz-api-version']) {
  7170. endpointRequest.httpRequest.headers['x-amz-api-version'] = apiVersion;
  7171. }
  7172. }
  7173. /**
  7174. * If api call gets invalid endpoint exception, SDK should attempt to remove the invalid
  7175. * endpoint from cache.
  7176. * @api private
  7177. */
  7178. function invalidateCachedEndpoints(response) {
  7179. var error = response.error;
  7180. var httpResponse = response.httpResponse;
  7181. if (error &&
  7182. (error.code === 'InvalidEndpointException' || httpResponse.statusCode === 421)
  7183. ) {
  7184. var request = response.request;
  7185. var operations = request.service.api.operations || {};
  7186. var inputShape = operations[request.operation] ? operations[request.operation].input : undefined;
  7187. var identifiers = marshallCustomIdentifiers(request, inputShape);
  7188. var cacheKey = getCacheKey(request);
  7189. if (Object.keys(identifiers).length > 0) {
  7190. cacheKey = util.update(cacheKey, identifiers);
  7191. if (operations[request.operation]) cacheKey.operation = operations[request.operation].name;
  7192. }
  7193. AWS.endpointCache.remove(cacheKey);
  7194. }
  7195. }
  7196. /**
  7197. * If endpoint is explicitly configured, SDK should not do endpoint discovery in anytime.
  7198. * @param [object] client Service client object.
  7199. * @api private
  7200. */
  7201. function hasCustomEndpoint(client) {
  7202. //if set endpoint is set for specific client, enable endpoint discovery will raise an error.
  7203. if (client._originalConfig && client._originalConfig.endpoint && client._originalConfig.endpointDiscoveryEnabled === true) {
  7204. throw util.error(new Error(), {
  7205. code: 'ConfigurationException',
  7206. message: 'Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'
  7207. });
  7208. };
  7209. var svcConfig = AWS.config[client.serviceIdentifier] || {};
  7210. return Boolean(AWS.config.endpoint || svcConfig.endpoint || (client._originalConfig && client._originalConfig.endpoint));
  7211. }
  7212. /**
  7213. * @api private
  7214. */
  7215. function isFalsy(value) {
  7216. return ['false', '0'].indexOf(value) >= 0;
  7217. }
  7218. /**
  7219. * If endpoint discovery should perform for this request when no operation requires endpoint
  7220. * discovery for the given service.
  7221. * SDK performs config resolution in order like below:
  7222. * 1. If set in client configuration.
  7223. * 2. If set in env AWS_ENABLE_ENDPOINT_DISCOVERY.
  7224. * 3. If set in shared ini config file with key 'endpoint_discovery_enabled'.
  7225. * @param [object] request request object.
  7226. * @returns [boolean|undefined] if endpoint discovery config is not set in any source, this
  7227. * function returns undefined
  7228. * @api private
  7229. */
  7230. function resolveEndpointDiscoveryConfig(request) {
  7231. var service = request.service || {};
  7232. if (service.config.endpointDiscoveryEnabled !== undefined) {
  7233. return service.config.endpointDiscoveryEnabled;
  7234. }
  7235. //shared ini file is only available in Node
  7236. //not to check env in browser
  7237. if (util.isBrowser()) return undefined;
  7238. // If any of recognized endpoint discovery config env is set
  7239. for (var i = 0; i < endpointDiscoveryEnabledEnvs.length; i++) {
  7240. var env = endpointDiscoveryEnabledEnvs[i];
  7241. if (Object.prototype.hasOwnProperty.call(process.env, env)) {
  7242. if (process.env[env] === '' || process.env[env] === undefined) {
  7243. throw util.error(new Error(), {
  7244. code: 'ConfigurationException',
  7245. message: 'environmental variable ' + env + ' cannot be set to nothing'
  7246. });
  7247. }
  7248. return !isFalsy(process.env[env]);
  7249. }
  7250. }
  7251. var configFile = {};
  7252. try {
  7253. configFile = AWS.util.iniLoader ? AWS.util.iniLoader.loadFrom({
  7254. isConfig: true,
  7255. filename: process.env[AWS.util.sharedConfigFileEnv]
  7256. }) : {};
  7257. } catch (e) {}
  7258. var sharedFileConfig = configFile[
  7259. process.env.AWS_PROFILE || AWS.util.defaultProfile
  7260. ] || {};
  7261. if (Object.prototype.hasOwnProperty.call(sharedFileConfig, 'endpoint_discovery_enabled')) {
  7262. if (sharedFileConfig.endpoint_discovery_enabled === undefined) {
  7263. throw util.error(new Error(), {
  7264. code: 'ConfigurationException',
  7265. message: 'config file entry \'endpoint_discovery_enabled\' cannot be set to nothing'
  7266. });
  7267. }
  7268. return !isFalsy(sharedFileConfig.endpoint_discovery_enabled);
  7269. }
  7270. return undefined;
  7271. }
  7272. /**
  7273. * attach endpoint discovery logic to request object
  7274. * @param [object] request
  7275. * @api private
  7276. */
  7277. function discoverEndpoint(request, done) {
  7278. var service = request.service || {};
  7279. if (hasCustomEndpoint(service) || request.isPresigned()) return done();
  7280. var operations = service.api.operations || {};
  7281. var operationModel = operations[request.operation];
  7282. var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';
  7283. var isEnabled = resolveEndpointDiscoveryConfig(request);
  7284. var hasRequiredEndpointDiscovery = service.api.hasRequiredEndpointDiscovery;
  7285. if (isEnabled || hasRequiredEndpointDiscovery) {
  7286. // Once a customer enables endpoint discovery, the SDK should start appending
  7287. // the string endpoint-discovery to the user-agent on all requests.
  7288. request.httpRequest.appendToUserAgent('endpoint-discovery');
  7289. }
  7290. switch (isEndpointDiscoveryRequired) {
  7291. case 'OPTIONAL':
  7292. if (isEnabled || hasRequiredEndpointDiscovery) {
  7293. // For a given service; if at least one operation requires endpoint discovery then the SDK must enable endpoint discovery
  7294. // by default for all operations of that service, including operations where endpoint discovery is optional.
  7295. optionalDiscoverEndpoint(request);
  7296. request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
  7297. }
  7298. done();
  7299. break;
  7300. case 'REQUIRED':
  7301. if (isEnabled === false) {
  7302. // For a given operation; if endpoint discovery is required and it has been disabled on the SDK client,
  7303. // then the SDK must return a clear and actionable exception.
  7304. request.response.error = util.error(new Error(), {
  7305. code: 'ConfigurationException',
  7306. message: 'Endpoint Discovery is disabled but ' + service.api.className + '.' + request.operation +
  7307. '() requires it. Please check your configurations.'
  7308. });
  7309. done();
  7310. break;
  7311. }
  7312. request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
  7313. requiredDiscoverEndpoint(request, done);
  7314. break;
  7315. case 'NULL':
  7316. default:
  7317. done();
  7318. break;
  7319. }
  7320. }
  7321. module.exports = {
  7322. discoverEndpoint: discoverEndpoint,
  7323. requiredDiscoverEndpoint: requiredDiscoverEndpoint,
  7324. optionalDiscoverEndpoint: optionalDiscoverEndpoint,
  7325. marshallCustomIdentifiers: marshallCustomIdentifiers,
  7326. getCacheKey: getCacheKey,
  7327. invalidateCachedEndpoint: invalidateCachedEndpoints,
  7328. };
  7329. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  7330. /***/ }),
  7331. /* 52 */
  7332. /***/ (function(module, exports, __webpack_require__) {
  7333. /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors.
  7334. //
  7335. // Permission is hereby granted, free of charge, to any person obtaining a
  7336. // copy of this software and associated documentation files (the
  7337. // "Software"), to deal in the Software without restriction, including
  7338. // without limitation the rights to use, copy, modify, merge, publish,
  7339. // distribute, sublicense, and/or sell copies of the Software, and to permit
  7340. // persons to whom the Software is furnished to do so, subject to the
  7341. // following conditions:
  7342. //
  7343. // The above copyright notice and this permission notice shall be included
  7344. // in all copies or substantial portions of the Software.
  7345. //
  7346. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  7347. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7348. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  7349. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  7350. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  7351. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7352. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  7353. var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
  7354. function getOwnPropertyDescriptors(obj) {
  7355. var keys = Object.keys(obj);
  7356. var descriptors = {};
  7357. for (var i = 0; i < keys.length; i++) {
  7358. descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
  7359. }
  7360. return descriptors;
  7361. };
  7362. var formatRegExp = /%[sdj%]/g;
  7363. exports.format = function(f) {
  7364. if (!isString(f)) {
  7365. var objects = [];
  7366. for (var i = 0; i < arguments.length; i++) {
  7367. objects.push(inspect(arguments[i]));
  7368. }
  7369. return objects.join(' ');
  7370. }
  7371. var i = 1;
  7372. var args = arguments;
  7373. var len = args.length;
  7374. var str = String(f).replace(formatRegExp, function(x) {
  7375. if (x === '%%') return '%';
  7376. if (i >= len) return x;
  7377. switch (x) {
  7378. case '%s': return String(args[i++]);
  7379. case '%d': return Number(args[i++]);
  7380. case '%j':
  7381. try {
  7382. return JSON.stringify(args[i++]);
  7383. } catch (_) {
  7384. return '[Circular]';
  7385. }
  7386. default:
  7387. return x;
  7388. }
  7389. });
  7390. for (var x = args[i]; i < len; x = args[++i]) {
  7391. if (isNull(x) || !isObject(x)) {
  7392. str += ' ' + x;
  7393. } else {
  7394. str += ' ' + inspect(x);
  7395. }
  7396. }
  7397. return str;
  7398. };
  7399. // Mark that a method should not be used.
  7400. // Returns a modified function which warns once by default.
  7401. // If --no-deprecation is set, then it is a no-op.
  7402. exports.deprecate = function(fn, msg) {
  7403. if (typeof process !== 'undefined' && process.noDeprecation === true) {
  7404. return fn;
  7405. }
  7406. // Allow for deprecating things in the process of starting up.
  7407. if (typeof process === 'undefined') {
  7408. return function() {
  7409. return exports.deprecate(fn, msg).apply(this, arguments);
  7410. };
  7411. }
  7412. var warned = false;
  7413. function deprecated() {
  7414. if (!warned) {
  7415. if (process.throwDeprecation) {
  7416. throw new Error(msg);
  7417. } else if (process.traceDeprecation) {
  7418. console.trace(msg);
  7419. } else {
  7420. console.error(msg);
  7421. }
  7422. warned = true;
  7423. }
  7424. return fn.apply(this, arguments);
  7425. }
  7426. return deprecated;
  7427. };
  7428. var debugs = {};
  7429. var debugEnvRegex = /^$/;
  7430. if (process.env.NODE_DEBUG) {
  7431. var debugEnv = process.env.NODE_DEBUG;
  7432. debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
  7433. .replace(/\*/g, '.*')
  7434. .replace(/,/g, '$|^')
  7435. .toUpperCase();
  7436. debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
  7437. }
  7438. exports.debuglog = function(set) {
  7439. set = set.toUpperCase();
  7440. if (!debugs[set]) {
  7441. if (debugEnvRegex.test(set)) {
  7442. var pid = process.pid;
  7443. debugs[set] = function() {
  7444. var msg = exports.format.apply(exports, arguments);
  7445. console.error('%s %d: %s', set, pid, msg);
  7446. };
  7447. } else {
  7448. debugs[set] = function() {};
  7449. }
  7450. }
  7451. return debugs[set];
  7452. };
  7453. /**
  7454. * Echos the value of a value. Trys to print the value out
  7455. * in the best way possible given the different types.
  7456. *
  7457. * @param {Object} obj The object to print out.
  7458. * @param {Object} opts Optional options object that alters the output.
  7459. */
  7460. /* legacy: obj, showHidden, depth, colors*/
  7461. function inspect(obj, opts) {
  7462. // default options
  7463. var ctx = {
  7464. seen: [],
  7465. stylize: stylizeNoColor
  7466. };
  7467. // legacy...
  7468. if (arguments.length >= 3) ctx.depth = arguments[2];
  7469. if (arguments.length >= 4) ctx.colors = arguments[3];
  7470. if (isBoolean(opts)) {
  7471. // legacy...
  7472. ctx.showHidden = opts;
  7473. } else if (opts) {
  7474. // got an "options" object
  7475. exports._extend(ctx, opts);
  7476. }
  7477. // set default options
  7478. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  7479. if (isUndefined(ctx.depth)) ctx.depth = 2;
  7480. if (isUndefined(ctx.colors)) ctx.colors = false;
  7481. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  7482. if (ctx.colors) ctx.stylize = stylizeWithColor;
  7483. return formatValue(ctx, obj, ctx.depth);
  7484. }
  7485. exports.inspect = inspect;
  7486. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  7487. inspect.colors = {
  7488. 'bold' : [1, 22],
  7489. 'italic' : [3, 23],
  7490. 'underline' : [4, 24],
  7491. 'inverse' : [7, 27],
  7492. 'white' : [37, 39],
  7493. 'grey' : [90, 39],
  7494. 'black' : [30, 39],
  7495. 'blue' : [34, 39],
  7496. 'cyan' : [36, 39],
  7497. 'green' : [32, 39],
  7498. 'magenta' : [35, 39],
  7499. 'red' : [31, 39],
  7500. 'yellow' : [33, 39]
  7501. };
  7502. // Don't use 'blue' not visible on cmd.exe
  7503. inspect.styles = {
  7504. 'special': 'cyan',
  7505. 'number': 'yellow',
  7506. 'boolean': 'yellow',
  7507. 'undefined': 'grey',
  7508. 'null': 'bold',
  7509. 'string': 'green',
  7510. 'date': 'magenta',
  7511. // "name": intentionally not styling
  7512. 'regexp': 'red'
  7513. };
  7514. function stylizeWithColor(str, styleType) {
  7515. var style = inspect.styles[styleType];
  7516. if (style) {
  7517. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  7518. '\u001b[' + inspect.colors[style][1] + 'm';
  7519. } else {
  7520. return str;
  7521. }
  7522. }
  7523. function stylizeNoColor(str, styleType) {
  7524. return str;
  7525. }
  7526. function arrayToHash(array) {
  7527. var hash = {};
  7528. array.forEach(function(val, idx) {
  7529. hash[val] = true;
  7530. });
  7531. return hash;
  7532. }
  7533. function formatValue(ctx, value, recurseTimes) {
  7534. // Provide a hook for user-specified inspect functions.
  7535. // Check that value is an object with an inspect function on it
  7536. if (ctx.customInspect &&
  7537. value &&
  7538. isFunction(value.inspect) &&
  7539. // Filter out the util module, it's inspect function is special
  7540. value.inspect !== exports.inspect &&
  7541. // Also filter out any prototype objects using the circular check.
  7542. !(value.constructor && value.constructor.prototype === value)) {
  7543. var ret = value.inspect(recurseTimes, ctx);
  7544. if (!isString(ret)) {
  7545. ret = formatValue(ctx, ret, recurseTimes);
  7546. }
  7547. return ret;
  7548. }
  7549. // Primitive types cannot have properties
  7550. var primitive = formatPrimitive(ctx, value);
  7551. if (primitive) {
  7552. return primitive;
  7553. }
  7554. // Look up the keys of the object.
  7555. var keys = Object.keys(value);
  7556. var visibleKeys = arrayToHash(keys);
  7557. if (ctx.showHidden) {
  7558. keys = Object.getOwnPropertyNames(value);
  7559. }
  7560. // IE doesn't make error fields non-enumerable
  7561. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  7562. if (isError(value)
  7563. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  7564. return formatError(value);
  7565. }
  7566. // Some type of object without properties can be shortcutted.
  7567. if (keys.length === 0) {
  7568. if (isFunction(value)) {
  7569. var name = value.name ? ': ' + value.name : '';
  7570. return ctx.stylize('[Function' + name + ']', 'special');
  7571. }
  7572. if (isRegExp(value)) {
  7573. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7574. }
  7575. if (isDate(value)) {
  7576. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  7577. }
  7578. if (isError(value)) {
  7579. return formatError(value);
  7580. }
  7581. }
  7582. var base = '', array = false, braces = ['{', '}'];
  7583. // Make Array say that they are Array
  7584. if (isArray(value)) {
  7585. array = true;
  7586. braces = ['[', ']'];
  7587. }
  7588. // Make functions say that they are functions
  7589. if (isFunction(value)) {
  7590. var n = value.name ? ': ' + value.name : '';
  7591. base = ' [Function' + n + ']';
  7592. }
  7593. // Make RegExps say that they are RegExps
  7594. if (isRegExp(value)) {
  7595. base = ' ' + RegExp.prototype.toString.call(value);
  7596. }
  7597. // Make dates with properties first say the date
  7598. if (isDate(value)) {
  7599. base = ' ' + Date.prototype.toUTCString.call(value);
  7600. }
  7601. // Make error with message first say the error
  7602. if (isError(value)) {
  7603. base = ' ' + formatError(value);
  7604. }
  7605. if (keys.length === 0 && (!array || value.length == 0)) {
  7606. return braces[0] + base + braces[1];
  7607. }
  7608. if (recurseTimes < 0) {
  7609. if (isRegExp(value)) {
  7610. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7611. } else {
  7612. return ctx.stylize('[Object]', 'special');
  7613. }
  7614. }
  7615. ctx.seen.push(value);
  7616. var output;
  7617. if (array) {
  7618. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  7619. } else {
  7620. output = keys.map(function(key) {
  7621. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  7622. });
  7623. }
  7624. ctx.seen.pop();
  7625. return reduceToSingleString(output, base, braces);
  7626. }
  7627. function formatPrimitive(ctx, value) {
  7628. if (isUndefined(value))
  7629. return ctx.stylize('undefined', 'undefined');
  7630. if (isString(value)) {
  7631. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  7632. .replace(/'/g, "\\'")
  7633. .replace(/\\"/g, '"') + '\'';
  7634. return ctx.stylize(simple, 'string');
  7635. }
  7636. if (isNumber(value))
  7637. return ctx.stylize('' + value, 'number');
  7638. if (isBoolean(value))
  7639. return ctx.stylize('' + value, 'boolean');
  7640. // For some reason typeof null is "object", so special case here.
  7641. if (isNull(value))
  7642. return ctx.stylize('null', 'null');
  7643. }
  7644. function formatError(value) {
  7645. return '[' + Error.prototype.toString.call(value) + ']';
  7646. }
  7647. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  7648. var output = [];
  7649. for (var i = 0, l = value.length; i < l; ++i) {
  7650. if (hasOwnProperty(value, String(i))) {
  7651. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7652. String(i), true));
  7653. } else {
  7654. output.push('');
  7655. }
  7656. }
  7657. keys.forEach(function(key) {
  7658. if (!key.match(/^\d+$/)) {
  7659. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7660. key, true));
  7661. }
  7662. });
  7663. return output;
  7664. }
  7665. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  7666. var name, str, desc;
  7667. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  7668. if (desc.get) {
  7669. if (desc.set) {
  7670. str = ctx.stylize('[Getter/Setter]', 'special');
  7671. } else {
  7672. str = ctx.stylize('[Getter]', 'special');
  7673. }
  7674. } else {
  7675. if (desc.set) {
  7676. str = ctx.stylize('[Setter]', 'special');
  7677. }
  7678. }
  7679. if (!hasOwnProperty(visibleKeys, key)) {
  7680. name = '[' + key + ']';
  7681. }
  7682. if (!str) {
  7683. if (ctx.seen.indexOf(desc.value) < 0) {
  7684. if (isNull(recurseTimes)) {
  7685. str = formatValue(ctx, desc.value, null);
  7686. } else {
  7687. str = formatValue(ctx, desc.value, recurseTimes - 1);
  7688. }
  7689. if (str.indexOf('\n') > -1) {
  7690. if (array) {
  7691. str = str.split('\n').map(function(line) {
  7692. return ' ' + line;
  7693. }).join('\n').slice(2);
  7694. } else {
  7695. str = '\n' + str.split('\n').map(function(line) {
  7696. return ' ' + line;
  7697. }).join('\n');
  7698. }
  7699. }
  7700. } else {
  7701. str = ctx.stylize('[Circular]', 'special');
  7702. }
  7703. }
  7704. if (isUndefined(name)) {
  7705. if (array && key.match(/^\d+$/)) {
  7706. return str;
  7707. }
  7708. name = JSON.stringify('' + key);
  7709. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  7710. name = name.slice(1, -1);
  7711. name = ctx.stylize(name, 'name');
  7712. } else {
  7713. name = name.replace(/'/g, "\\'")
  7714. .replace(/\\"/g, '"')
  7715. .replace(/(^"|"$)/g, "'");
  7716. name = ctx.stylize(name, 'string');
  7717. }
  7718. }
  7719. return name + ': ' + str;
  7720. }
  7721. function reduceToSingleString(output, base, braces) {
  7722. var numLinesEst = 0;
  7723. var length = output.reduce(function(prev, cur) {
  7724. numLinesEst++;
  7725. if (cur.indexOf('\n') >= 0) numLinesEst++;
  7726. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  7727. }, 0);
  7728. if (length > 60) {
  7729. return braces[0] +
  7730. (base === '' ? '' : base + '\n ') +
  7731. ' ' +
  7732. output.join(',\n ') +
  7733. ' ' +
  7734. braces[1];
  7735. }
  7736. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  7737. }
  7738. // NOTE: These type checking functions intentionally don't use `instanceof`
  7739. // because it is fragile and can be easily faked with `Object.create()`.
  7740. exports.types = __webpack_require__(53);
  7741. function isArray(ar) {
  7742. return Array.isArray(ar);
  7743. }
  7744. exports.isArray = isArray;
  7745. function isBoolean(arg) {
  7746. return typeof arg === 'boolean';
  7747. }
  7748. exports.isBoolean = isBoolean;
  7749. function isNull(arg) {
  7750. return arg === null;
  7751. }
  7752. exports.isNull = isNull;
  7753. function isNullOrUndefined(arg) {
  7754. return arg == null;
  7755. }
  7756. exports.isNullOrUndefined = isNullOrUndefined;
  7757. function isNumber(arg) {
  7758. return typeof arg === 'number';
  7759. }
  7760. exports.isNumber = isNumber;
  7761. function isString(arg) {
  7762. return typeof arg === 'string';
  7763. }
  7764. exports.isString = isString;
  7765. function isSymbol(arg) {
  7766. return typeof arg === 'symbol';
  7767. }
  7768. exports.isSymbol = isSymbol;
  7769. function isUndefined(arg) {
  7770. return arg === void 0;
  7771. }
  7772. exports.isUndefined = isUndefined;
  7773. function isRegExp(re) {
  7774. return isObject(re) && objectToString(re) === '[object RegExp]';
  7775. }
  7776. exports.isRegExp = isRegExp;
  7777. exports.types.isRegExp = isRegExp;
  7778. function isObject(arg) {
  7779. return typeof arg === 'object' && arg !== null;
  7780. }
  7781. exports.isObject = isObject;
  7782. function isDate(d) {
  7783. return isObject(d) && objectToString(d) === '[object Date]';
  7784. }
  7785. exports.isDate = isDate;
  7786. exports.types.isDate = isDate;
  7787. function isError(e) {
  7788. return isObject(e) &&
  7789. (objectToString(e) === '[object Error]' || e instanceof Error);
  7790. }
  7791. exports.isError = isError;
  7792. exports.types.isNativeError = isError;
  7793. function isFunction(arg) {
  7794. return typeof arg === 'function';
  7795. }
  7796. exports.isFunction = isFunction;
  7797. function isPrimitive(arg) {
  7798. return arg === null ||
  7799. typeof arg === 'boolean' ||
  7800. typeof arg === 'number' ||
  7801. typeof arg === 'string' ||
  7802. typeof arg === 'symbol' || // ES6 symbol
  7803. typeof arg === 'undefined';
  7804. }
  7805. exports.isPrimitive = isPrimitive;
  7806. exports.isBuffer = __webpack_require__(84);
  7807. function objectToString(o) {
  7808. return Object.prototype.toString.call(o);
  7809. }
  7810. function pad(n) {
  7811. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  7812. }
  7813. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  7814. 'Oct', 'Nov', 'Dec'];
  7815. // 26 Feb 16:19:34
  7816. function timestamp() {
  7817. var d = new Date();
  7818. var time = [pad(d.getHours()),
  7819. pad(d.getMinutes()),
  7820. pad(d.getSeconds())].join(':');
  7821. return [d.getDate(), months[d.getMonth()], time].join(' ');
  7822. }
  7823. // log is just a thin wrapper to console.log that prepends a timestamp
  7824. exports.log = function() {
  7825. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  7826. };
  7827. /**
  7828. * Inherit the prototype methods from one constructor into another.
  7829. *
  7830. * The Function.prototype.inherits from lang.js rewritten as a standalone
  7831. * function (not on Function.prototype). NOTE: If this file is to be loaded
  7832. * during bootstrapping this function needs to be rewritten using some native
  7833. * functions as prototype setup using normal JavaScript does not work as
  7834. * expected during bootstrapping (see mirror.js in r114903).
  7835. *
  7836. * @param {function} ctor Constructor function which needs to inherit the
  7837. * prototype.
  7838. * @param {function} superCtor Constructor function to inherit prototype from.
  7839. */
  7840. exports.inherits = __webpack_require__(85);
  7841. exports._extend = function(origin, add) {
  7842. // Don't do anything if add isn't an object
  7843. if (!add || !isObject(add)) return origin;
  7844. var keys = Object.keys(add);
  7845. var i = keys.length;
  7846. while (i--) {
  7847. origin[keys[i]] = add[keys[i]];
  7848. }
  7849. return origin;
  7850. };
  7851. function hasOwnProperty(obj, prop) {
  7852. return Object.prototype.hasOwnProperty.call(obj, prop);
  7853. }
  7854. var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
  7855. exports.promisify = function promisify(original) {
  7856. if (typeof original !== 'function')
  7857. throw new TypeError('The "original" argument must be of type Function');
  7858. if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
  7859. var fn = original[kCustomPromisifiedSymbol];
  7860. if (typeof fn !== 'function') {
  7861. throw new TypeError('The "util.promisify.custom" argument must be of type Function');
  7862. }
  7863. Object.defineProperty(fn, kCustomPromisifiedSymbol, {
  7864. value: fn, enumerable: false, writable: false, configurable: true
  7865. });
  7866. return fn;
  7867. }
  7868. function fn() {
  7869. var promiseResolve, promiseReject;
  7870. var promise = new Promise(function (resolve, reject) {
  7871. promiseResolve = resolve;
  7872. promiseReject = reject;
  7873. });
  7874. var args = [];
  7875. for (var i = 0; i < arguments.length; i++) {
  7876. args.push(arguments[i]);
  7877. }
  7878. args.push(function (err, value) {
  7879. if (err) {
  7880. promiseReject(err);
  7881. } else {
  7882. promiseResolve(value);
  7883. }
  7884. });
  7885. try {
  7886. original.apply(this, args);
  7887. } catch (err) {
  7888. promiseReject(err);
  7889. }
  7890. return promise;
  7891. }
  7892. Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
  7893. if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
  7894. value: fn, enumerable: false, writable: false, configurable: true
  7895. });
  7896. return Object.defineProperties(
  7897. fn,
  7898. getOwnPropertyDescriptors(original)
  7899. );
  7900. }
  7901. exports.promisify.custom = kCustomPromisifiedSymbol
  7902. function callbackifyOnRejected(reason, cb) {
  7903. // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
  7904. // Because `null` is a special error value in callbacks which means "no error
  7905. // occurred", we error-wrap so the callback consumer can distinguish between
  7906. // "the promise rejected with null" or "the promise fulfilled with undefined".
  7907. if (!reason) {
  7908. var newReason = new Error('Promise was rejected with a falsy value');
  7909. newReason.reason = reason;
  7910. reason = newReason;
  7911. }
  7912. return cb(reason);
  7913. }
  7914. function callbackify(original) {
  7915. if (typeof original !== 'function') {
  7916. throw new TypeError('The "original" argument must be of type Function');
  7917. }
  7918. // We DO NOT return the promise as it gives the user a false sense that
  7919. // the promise is actually somehow related to the callback's execution
  7920. // and that the callback throwing will reject the promise.
  7921. function callbackified() {
  7922. var args = [];
  7923. for (var i = 0; i < arguments.length; i++) {
  7924. args.push(arguments[i]);
  7925. }
  7926. var maybeCb = args.pop();
  7927. if (typeof maybeCb !== 'function') {
  7928. throw new TypeError('The last argument must be of type Function');
  7929. }
  7930. var self = this;
  7931. var cb = function() {
  7932. return maybeCb.apply(self, arguments);
  7933. };
  7934. // In true node style we process the callback on `nextTick` with all the
  7935. // implications (stack, `uncaughtException`, `async_hooks`)
  7936. original.apply(this, args)
  7937. .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
  7938. function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
  7939. }
  7940. Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
  7941. Object.defineProperties(callbackified,
  7942. getOwnPropertyDescriptors(original));
  7943. return callbackified;
  7944. }
  7945. exports.callbackify = callbackify;
  7946. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  7947. /***/ }),
  7948. /* 53 */
  7949. /***/ (function(module, exports, __webpack_require__) {
  7950. // Currently in sync with Node.js lib/internal/util/types.js
  7951. // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
  7952. 'use strict';
  7953. var isArgumentsObject = __webpack_require__(54);
  7954. var isGeneratorFunction = __webpack_require__(77);
  7955. var whichTypedArray = __webpack_require__(78);
  7956. var isTypedArray = __webpack_require__(83);
  7957. function uncurryThis(f) {
  7958. return f.call.bind(f);
  7959. }
  7960. var BigIntSupported = typeof BigInt !== 'undefined';
  7961. var SymbolSupported = typeof Symbol !== 'undefined';
  7962. var ObjectToString = uncurryThis(Object.prototype.toString);
  7963. var numberValue = uncurryThis(Number.prototype.valueOf);
  7964. var stringValue = uncurryThis(String.prototype.valueOf);
  7965. var booleanValue = uncurryThis(Boolean.prototype.valueOf);
  7966. if (BigIntSupported) {
  7967. var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
  7968. }
  7969. if (SymbolSupported) {
  7970. var symbolValue = uncurryThis(Symbol.prototype.valueOf);
  7971. }
  7972. function checkBoxedPrimitive(value, prototypeValueOf) {
  7973. if (typeof value !== 'object') {
  7974. return false;
  7975. }
  7976. try {
  7977. prototypeValueOf(value);
  7978. return true;
  7979. } catch(e) {
  7980. return false;
  7981. }
  7982. }
  7983. exports.isArgumentsObject = isArgumentsObject;
  7984. exports.isGeneratorFunction = isGeneratorFunction;
  7985. exports.isTypedArray = isTypedArray;
  7986. // Taken from here and modified for better browser support
  7987. // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
  7988. function isPromise(input) {
  7989. return (
  7990. (
  7991. typeof Promise !== 'undefined' &&
  7992. input instanceof Promise
  7993. ) ||
  7994. (
  7995. input !== null &&
  7996. typeof input === 'object' &&
  7997. typeof input.then === 'function' &&
  7998. typeof input.catch === 'function'
  7999. )
  8000. );
  8001. }
  8002. exports.isPromise = isPromise;
  8003. function isArrayBufferView(value) {
  8004. if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
  8005. return ArrayBuffer.isView(value);
  8006. }
  8007. return (
  8008. isTypedArray(value) ||
  8009. isDataView(value)
  8010. );
  8011. }
  8012. exports.isArrayBufferView = isArrayBufferView;
  8013. function isUint8Array(value) {
  8014. return whichTypedArray(value) === 'Uint8Array';
  8015. }
  8016. exports.isUint8Array = isUint8Array;
  8017. function isUint8ClampedArray(value) {
  8018. return whichTypedArray(value) === 'Uint8ClampedArray';
  8019. }
  8020. exports.isUint8ClampedArray = isUint8ClampedArray;
  8021. function isUint16Array(value) {
  8022. return whichTypedArray(value) === 'Uint16Array';
  8023. }
  8024. exports.isUint16Array = isUint16Array;
  8025. function isUint32Array(value) {
  8026. return whichTypedArray(value) === 'Uint32Array';
  8027. }
  8028. exports.isUint32Array = isUint32Array;
  8029. function isInt8Array(value) {
  8030. return whichTypedArray(value) === 'Int8Array';
  8031. }
  8032. exports.isInt8Array = isInt8Array;
  8033. function isInt16Array(value) {
  8034. return whichTypedArray(value) === 'Int16Array';
  8035. }
  8036. exports.isInt16Array = isInt16Array;
  8037. function isInt32Array(value) {
  8038. return whichTypedArray(value) === 'Int32Array';
  8039. }
  8040. exports.isInt32Array = isInt32Array;
  8041. function isFloat32Array(value) {
  8042. return whichTypedArray(value) === 'Float32Array';
  8043. }
  8044. exports.isFloat32Array = isFloat32Array;
  8045. function isFloat64Array(value) {
  8046. return whichTypedArray(value) === 'Float64Array';
  8047. }
  8048. exports.isFloat64Array = isFloat64Array;
  8049. function isBigInt64Array(value) {
  8050. return whichTypedArray(value) === 'BigInt64Array';
  8051. }
  8052. exports.isBigInt64Array = isBigInt64Array;
  8053. function isBigUint64Array(value) {
  8054. return whichTypedArray(value) === 'BigUint64Array';
  8055. }
  8056. exports.isBigUint64Array = isBigUint64Array;
  8057. function isMapToString(value) {
  8058. return ObjectToString(value) === '[object Map]';
  8059. }
  8060. isMapToString.working = (
  8061. typeof Map !== 'undefined' &&
  8062. isMapToString(new Map())
  8063. );
  8064. function isMap(value) {
  8065. if (typeof Map === 'undefined') {
  8066. return false;
  8067. }
  8068. return isMapToString.working
  8069. ? isMapToString(value)
  8070. : value instanceof Map;
  8071. }
  8072. exports.isMap = isMap;
  8073. function isSetToString(value) {
  8074. return ObjectToString(value) === '[object Set]';
  8075. }
  8076. isSetToString.working = (
  8077. typeof Set !== 'undefined' &&
  8078. isSetToString(new Set())
  8079. );
  8080. function isSet(value) {
  8081. if (typeof Set === 'undefined') {
  8082. return false;
  8083. }
  8084. return isSetToString.working
  8085. ? isSetToString(value)
  8086. : value instanceof Set;
  8087. }
  8088. exports.isSet = isSet;
  8089. function isWeakMapToString(value) {
  8090. return ObjectToString(value) === '[object WeakMap]';
  8091. }
  8092. isWeakMapToString.working = (
  8093. typeof WeakMap !== 'undefined' &&
  8094. isWeakMapToString(new WeakMap())
  8095. );
  8096. function isWeakMap(value) {
  8097. if (typeof WeakMap === 'undefined') {
  8098. return false;
  8099. }
  8100. return isWeakMapToString.working
  8101. ? isWeakMapToString(value)
  8102. : value instanceof WeakMap;
  8103. }
  8104. exports.isWeakMap = isWeakMap;
  8105. function isWeakSetToString(value) {
  8106. return ObjectToString(value) === '[object WeakSet]';
  8107. }
  8108. isWeakSetToString.working = (
  8109. typeof WeakSet !== 'undefined' &&
  8110. isWeakSetToString(new WeakSet())
  8111. );
  8112. function isWeakSet(value) {
  8113. return isWeakSetToString(value);
  8114. }
  8115. exports.isWeakSet = isWeakSet;
  8116. function isArrayBufferToString(value) {
  8117. return ObjectToString(value) === '[object ArrayBuffer]';
  8118. }
  8119. isArrayBufferToString.working = (
  8120. typeof ArrayBuffer !== 'undefined' &&
  8121. isArrayBufferToString(new ArrayBuffer())
  8122. );
  8123. function isArrayBuffer(value) {
  8124. if (typeof ArrayBuffer === 'undefined') {
  8125. return false;
  8126. }
  8127. return isArrayBufferToString.working
  8128. ? isArrayBufferToString(value)
  8129. : value instanceof ArrayBuffer;
  8130. }
  8131. exports.isArrayBuffer = isArrayBuffer;
  8132. function isDataViewToString(value) {
  8133. return ObjectToString(value) === '[object DataView]';
  8134. }
  8135. isDataViewToString.working = (
  8136. typeof ArrayBuffer !== 'undefined' &&
  8137. typeof DataView !== 'undefined' &&
  8138. isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
  8139. );
  8140. function isDataView(value) {
  8141. if (typeof DataView === 'undefined') {
  8142. return false;
  8143. }
  8144. return isDataViewToString.working
  8145. ? isDataViewToString(value)
  8146. : value instanceof DataView;
  8147. }
  8148. exports.isDataView = isDataView;
  8149. // Store a copy of SharedArrayBuffer in case it's deleted elsewhere
  8150. var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
  8151. function isSharedArrayBufferToString(value) {
  8152. return ObjectToString(value) === '[object SharedArrayBuffer]';
  8153. }
  8154. function isSharedArrayBuffer(value) {
  8155. if (typeof SharedArrayBufferCopy === 'undefined') {
  8156. return false;
  8157. }
  8158. if (typeof isSharedArrayBufferToString.working === 'undefined') {
  8159. isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
  8160. }
  8161. return isSharedArrayBufferToString.working
  8162. ? isSharedArrayBufferToString(value)
  8163. : value instanceof SharedArrayBufferCopy;
  8164. }
  8165. exports.isSharedArrayBuffer = isSharedArrayBuffer;
  8166. function isAsyncFunction(value) {
  8167. return ObjectToString(value) === '[object AsyncFunction]';
  8168. }
  8169. exports.isAsyncFunction = isAsyncFunction;
  8170. function isMapIterator(value) {
  8171. return ObjectToString(value) === '[object Map Iterator]';
  8172. }
  8173. exports.isMapIterator = isMapIterator;
  8174. function isSetIterator(value) {
  8175. return ObjectToString(value) === '[object Set Iterator]';
  8176. }
  8177. exports.isSetIterator = isSetIterator;
  8178. function isGeneratorObject(value) {
  8179. return ObjectToString(value) === '[object Generator]';
  8180. }
  8181. exports.isGeneratorObject = isGeneratorObject;
  8182. function isWebAssemblyCompiledModule(value) {
  8183. return ObjectToString(value) === '[object WebAssembly.Module]';
  8184. }
  8185. exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
  8186. function isNumberObject(value) {
  8187. return checkBoxedPrimitive(value, numberValue);
  8188. }
  8189. exports.isNumberObject = isNumberObject;
  8190. function isStringObject(value) {
  8191. return checkBoxedPrimitive(value, stringValue);
  8192. }
  8193. exports.isStringObject = isStringObject;
  8194. function isBooleanObject(value) {
  8195. return checkBoxedPrimitive(value, booleanValue);
  8196. }
  8197. exports.isBooleanObject = isBooleanObject;
  8198. function isBigIntObject(value) {
  8199. return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
  8200. }
  8201. exports.isBigIntObject = isBigIntObject;
  8202. function isSymbolObject(value) {
  8203. return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
  8204. }
  8205. exports.isSymbolObject = isSymbolObject;
  8206. function isBoxedPrimitive(value) {
  8207. return (
  8208. isNumberObject(value) ||
  8209. isStringObject(value) ||
  8210. isBooleanObject(value) ||
  8211. isBigIntObject(value) ||
  8212. isSymbolObject(value)
  8213. );
  8214. }
  8215. exports.isBoxedPrimitive = isBoxedPrimitive;
  8216. function isAnyArrayBuffer(value) {
  8217. return typeof Uint8Array !== 'undefined' && (
  8218. isArrayBuffer(value) ||
  8219. isSharedArrayBuffer(value)
  8220. );
  8221. }
  8222. exports.isAnyArrayBuffer = isAnyArrayBuffer;
  8223. ['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
  8224. Object.defineProperty(exports, method, {
  8225. enumerable: false,
  8226. value: function() {
  8227. throw new Error(method + ' is not supported in userland');
  8228. }
  8229. });
  8230. });
  8231. /***/ }),
  8232. /* 54 */
  8233. /***/ (function(module, exports, __webpack_require__) {
  8234. 'use strict';
  8235. var hasToStringTag = __webpack_require__(55)();
  8236. var callBound = __webpack_require__(57);
  8237. var $toString = callBound('Object.prototype.toString');
  8238. var isStandardArguments = function isArguments(value) {
  8239. if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
  8240. return false;
  8241. }
  8242. return $toString(value) === '[object Arguments]';
  8243. };
  8244. var isLegacyArguments = function isArguments(value) {
  8245. if (isStandardArguments(value)) {
  8246. return true;
  8247. }
  8248. return value !== null &&
  8249. typeof value === 'object' &&
  8250. typeof value.length === 'number' &&
  8251. value.length >= 0 &&
  8252. $toString(value) !== '[object Array]' &&
  8253. $toString(value.callee) === '[object Function]';
  8254. };
  8255. var supportsStandardArguments = (function () {
  8256. return isStandardArguments(arguments);
  8257. }());
  8258. isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
  8259. module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
  8260. /***/ }),
  8261. /* 55 */
  8262. /***/ (function(module, exports, __webpack_require__) {
  8263. 'use strict';
  8264. var hasSymbols = __webpack_require__(56);
  8265. /** @type {import('.')} */
  8266. module.exports = function hasToStringTagShams() {
  8267. return hasSymbols() && !!Symbol.toStringTag;
  8268. };
  8269. /***/ }),
  8270. /* 56 */
  8271. /***/ (function(module, exports) {
  8272. 'use strict';
  8273. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  8274. module.exports = function hasSymbols() {
  8275. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  8276. if (typeof Symbol.iterator === 'symbol') { return true; }
  8277. var obj = {};
  8278. var sym = Symbol('test');
  8279. var symObj = Object(sym);
  8280. if (typeof sym === 'string') { return false; }
  8281. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  8282. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  8283. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  8284. // if (sym instanceof Symbol) { return false; }
  8285. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  8286. // if (!(symObj instanceof Symbol)) { return false; }
  8287. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  8288. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  8289. var symVal = 42;
  8290. obj[sym] = symVal;
  8291. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  8292. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  8293. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  8294. var syms = Object.getOwnPropertySymbols(obj);
  8295. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  8296. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  8297. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  8298. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  8299. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  8300. }
  8301. return true;
  8302. };
  8303. /***/ }),
  8304. /* 57 */
  8305. /***/ (function(module, exports, __webpack_require__) {
  8306. 'use strict';
  8307. var GetIntrinsic = __webpack_require__(58);
  8308. var callBind = __webpack_require__(71);
  8309. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  8310. module.exports = function callBoundIntrinsic(name, allowMissing) {
  8311. var intrinsic = GetIntrinsic(name, !!allowMissing);
  8312. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  8313. return callBind(intrinsic);
  8314. }
  8315. return intrinsic;
  8316. };
  8317. /***/ }),
  8318. /* 58 */
  8319. /***/ (function(module, exports, __webpack_require__) {
  8320. 'use strict';
  8321. var undefined;
  8322. var $Error = __webpack_require__(59);
  8323. var $EvalError = __webpack_require__(60);
  8324. var $RangeError = __webpack_require__(61);
  8325. var $ReferenceError = __webpack_require__(62);
  8326. var $SyntaxError = __webpack_require__(63);
  8327. var $TypeError = __webpack_require__(64);
  8328. var $URIError = __webpack_require__(65);
  8329. var $Function = Function;
  8330. // eslint-disable-next-line consistent-return
  8331. var getEvalledConstructor = function (expressionSyntax) {
  8332. try {
  8333. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  8334. } catch (e) {}
  8335. };
  8336. var $gOPD = Object.getOwnPropertyDescriptor;
  8337. if ($gOPD) {
  8338. try {
  8339. $gOPD({}, '');
  8340. } catch (e) {
  8341. $gOPD = null; // this is IE 8, which has a broken gOPD
  8342. }
  8343. }
  8344. var throwTypeError = function () {
  8345. throw new $TypeError();
  8346. };
  8347. var ThrowTypeError = $gOPD
  8348. ? (function () {
  8349. try {
  8350. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  8351. arguments.callee; // IE 8 does not throw here
  8352. return throwTypeError;
  8353. } catch (calleeThrows) {
  8354. try {
  8355. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  8356. return $gOPD(arguments, 'callee').get;
  8357. } catch (gOPDthrows) {
  8358. return throwTypeError;
  8359. }
  8360. }
  8361. }())
  8362. : throwTypeError;
  8363. var hasSymbols = __webpack_require__(66)();
  8364. var hasProto = __webpack_require__(67)();
  8365. var getProto = Object.getPrototypeOf || (
  8366. hasProto
  8367. ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
  8368. : null
  8369. );
  8370. var needsEval = {};
  8371. var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
  8372. var INTRINSICS = {
  8373. __proto__: null,
  8374. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  8375. '%Array%': Array,
  8376. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  8377. '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
  8378. '%AsyncFromSyncIteratorPrototype%': undefined,
  8379. '%AsyncFunction%': needsEval,
  8380. '%AsyncGenerator%': needsEval,
  8381. '%AsyncGeneratorFunction%': needsEval,
  8382. '%AsyncIteratorPrototype%': needsEval,
  8383. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  8384. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  8385. '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
  8386. '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
  8387. '%Boolean%': Boolean,
  8388. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  8389. '%Date%': Date,
  8390. '%decodeURI%': decodeURI,
  8391. '%decodeURIComponent%': decodeURIComponent,
  8392. '%encodeURI%': encodeURI,
  8393. '%encodeURIComponent%': encodeURIComponent,
  8394. '%Error%': $Error,
  8395. '%eval%': eval, // eslint-disable-line no-eval
  8396. '%EvalError%': $EvalError,
  8397. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  8398. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  8399. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  8400. '%Function%': $Function,
  8401. '%GeneratorFunction%': needsEval,
  8402. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  8403. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  8404. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  8405. '%isFinite%': isFinite,
  8406. '%isNaN%': isNaN,
  8407. '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
  8408. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  8409. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  8410. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
  8411. '%Math%': Math,
  8412. '%Number%': Number,
  8413. '%Object%': Object,
  8414. '%parseFloat%': parseFloat,
  8415. '%parseInt%': parseInt,
  8416. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  8417. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  8418. '%RangeError%': $RangeError,
  8419. '%ReferenceError%': $ReferenceError,
  8420. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  8421. '%RegExp%': RegExp,
  8422. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  8423. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
  8424. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  8425. '%String%': String,
  8426. '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
  8427. '%Symbol%': hasSymbols ? Symbol : undefined,
  8428. '%SyntaxError%': $SyntaxError,
  8429. '%ThrowTypeError%': ThrowTypeError,
  8430. '%TypedArray%': TypedArray,
  8431. '%TypeError%': $TypeError,
  8432. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  8433. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  8434. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  8435. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  8436. '%URIError%': $URIError,
  8437. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  8438. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  8439. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  8440. };
  8441. if (getProto) {
  8442. try {
  8443. null.error; // eslint-disable-line no-unused-expressions
  8444. } catch (e) {
  8445. // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
  8446. var errorProto = getProto(getProto(e));
  8447. INTRINSICS['%Error.prototype%'] = errorProto;
  8448. }
  8449. }
  8450. var doEval = function doEval(name) {
  8451. var value;
  8452. if (name === '%AsyncFunction%') {
  8453. value = getEvalledConstructor('async function () {}');
  8454. } else if (name === '%GeneratorFunction%') {
  8455. value = getEvalledConstructor('function* () {}');
  8456. } else if (name === '%AsyncGeneratorFunction%') {
  8457. value = getEvalledConstructor('async function* () {}');
  8458. } else if (name === '%AsyncGenerator%') {
  8459. var fn = doEval('%AsyncGeneratorFunction%');
  8460. if (fn) {
  8461. value = fn.prototype;
  8462. }
  8463. } else if (name === '%AsyncIteratorPrototype%') {
  8464. var gen = doEval('%AsyncGenerator%');
  8465. if (gen && getProto) {
  8466. value = getProto(gen.prototype);
  8467. }
  8468. }
  8469. INTRINSICS[name] = value;
  8470. return value;
  8471. };
  8472. var LEGACY_ALIASES = {
  8473. __proto__: null,
  8474. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  8475. '%ArrayPrototype%': ['Array', 'prototype'],
  8476. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  8477. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  8478. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  8479. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  8480. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  8481. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  8482. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  8483. '%BooleanPrototype%': ['Boolean', 'prototype'],
  8484. '%DataViewPrototype%': ['DataView', 'prototype'],
  8485. '%DatePrototype%': ['Date', 'prototype'],
  8486. '%ErrorPrototype%': ['Error', 'prototype'],
  8487. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  8488. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  8489. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  8490. '%FunctionPrototype%': ['Function', 'prototype'],
  8491. '%Generator%': ['GeneratorFunction', 'prototype'],
  8492. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  8493. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  8494. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  8495. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  8496. '%JSONParse%': ['JSON', 'parse'],
  8497. '%JSONStringify%': ['JSON', 'stringify'],
  8498. '%MapPrototype%': ['Map', 'prototype'],
  8499. '%NumberPrototype%': ['Number', 'prototype'],
  8500. '%ObjectPrototype%': ['Object', 'prototype'],
  8501. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  8502. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  8503. '%PromisePrototype%': ['Promise', 'prototype'],
  8504. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  8505. '%Promise_all%': ['Promise', 'all'],
  8506. '%Promise_reject%': ['Promise', 'reject'],
  8507. '%Promise_resolve%': ['Promise', 'resolve'],
  8508. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  8509. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  8510. '%RegExpPrototype%': ['RegExp', 'prototype'],
  8511. '%SetPrototype%': ['Set', 'prototype'],
  8512. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  8513. '%StringPrototype%': ['String', 'prototype'],
  8514. '%SymbolPrototype%': ['Symbol', 'prototype'],
  8515. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  8516. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  8517. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  8518. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  8519. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  8520. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  8521. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  8522. '%URIErrorPrototype%': ['URIError', 'prototype'],
  8523. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  8524. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  8525. };
  8526. var bind = __webpack_require__(68);
  8527. var hasOwn = __webpack_require__(70);
  8528. var $concat = bind.call(Function.call, Array.prototype.concat);
  8529. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  8530. var $replace = bind.call(Function.call, String.prototype.replace);
  8531. var $strSlice = bind.call(Function.call, String.prototype.slice);
  8532. var $exec = bind.call(Function.call, RegExp.prototype.exec);
  8533. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  8534. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  8535. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  8536. var stringToPath = function stringToPath(string) {
  8537. var first = $strSlice(string, 0, 1);
  8538. var last = $strSlice(string, -1);
  8539. if (first === '%' && last !== '%') {
  8540. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  8541. } else if (last === '%' && first !== '%') {
  8542. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  8543. }
  8544. var result = [];
  8545. $replace(string, rePropName, function (match, number, quote, subString) {
  8546. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  8547. });
  8548. return result;
  8549. };
  8550. /* end adaptation */
  8551. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  8552. var intrinsicName = name;
  8553. var alias;
  8554. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  8555. alias = LEGACY_ALIASES[intrinsicName];
  8556. intrinsicName = '%' + alias[0] + '%';
  8557. }
  8558. if (hasOwn(INTRINSICS, intrinsicName)) {
  8559. var value = INTRINSICS[intrinsicName];
  8560. if (value === needsEval) {
  8561. value = doEval(intrinsicName);
  8562. }
  8563. if (typeof value === 'undefined' && !allowMissing) {
  8564. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  8565. }
  8566. return {
  8567. alias: alias,
  8568. name: intrinsicName,
  8569. value: value
  8570. };
  8571. }
  8572. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  8573. };
  8574. module.exports = function GetIntrinsic(name, allowMissing) {
  8575. if (typeof name !== 'string' || name.length === 0) {
  8576. throw new $TypeError('intrinsic name must be a non-empty string');
  8577. }
  8578. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  8579. throw new $TypeError('"allowMissing" argument must be a boolean');
  8580. }
  8581. if ($exec(/^%?[^%]*%?$/, name) === null) {
  8582. throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
  8583. }
  8584. var parts = stringToPath(name);
  8585. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  8586. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  8587. var intrinsicRealName = intrinsic.name;
  8588. var value = intrinsic.value;
  8589. var skipFurtherCaching = false;
  8590. var alias = intrinsic.alias;
  8591. if (alias) {
  8592. intrinsicBaseName = alias[0];
  8593. $spliceApply(parts, $concat([0, 1], alias));
  8594. }
  8595. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  8596. var part = parts[i];
  8597. var first = $strSlice(part, 0, 1);
  8598. var last = $strSlice(part, -1);
  8599. if (
  8600. (
  8601. (first === '"' || first === "'" || first === '`')
  8602. || (last === '"' || last === "'" || last === '`')
  8603. )
  8604. && first !== last
  8605. ) {
  8606. throw new $SyntaxError('property names with quotes must have matching quotes');
  8607. }
  8608. if (part === 'constructor' || !isOwn) {
  8609. skipFurtherCaching = true;
  8610. }
  8611. intrinsicBaseName += '.' + part;
  8612. intrinsicRealName = '%' + intrinsicBaseName + '%';
  8613. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  8614. value = INTRINSICS[intrinsicRealName];
  8615. } else if (value != null) {
  8616. if (!(part in value)) {
  8617. if (!allowMissing) {
  8618. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  8619. }
  8620. return void undefined;
  8621. }
  8622. if ($gOPD && (i + 1) >= parts.length) {
  8623. var desc = $gOPD(value, part);
  8624. isOwn = !!desc;
  8625. // By convention, when a data property is converted to an accessor
  8626. // property to emulate a data property that does not suffer from
  8627. // the override mistake, that accessor's getter is marked with
  8628. // an `originalValue` property. Here, when we detect this, we
  8629. // uphold the illusion by pretending to see that original data
  8630. // property, i.e., returning the value rather than the getter
  8631. // itself.
  8632. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  8633. value = desc.get;
  8634. } else {
  8635. value = value[part];
  8636. }
  8637. } else {
  8638. isOwn = hasOwn(value, part);
  8639. value = value[part];
  8640. }
  8641. if (isOwn && !skipFurtherCaching) {
  8642. INTRINSICS[intrinsicRealName] = value;
  8643. }
  8644. }
  8645. }
  8646. return value;
  8647. };
  8648. /***/ }),
  8649. /* 59 */
  8650. /***/ (function(module, exports) {
  8651. 'use strict';
  8652. /** @type {import('.')} */
  8653. module.exports = Error;
  8654. /***/ }),
  8655. /* 60 */
  8656. /***/ (function(module, exports) {
  8657. 'use strict';
  8658. /** @type {import('./eval')} */
  8659. module.exports = EvalError;
  8660. /***/ }),
  8661. /* 61 */
  8662. /***/ (function(module, exports) {
  8663. 'use strict';
  8664. /** @type {import('./range')} */
  8665. module.exports = RangeError;
  8666. /***/ }),
  8667. /* 62 */
  8668. /***/ (function(module, exports) {
  8669. 'use strict';
  8670. /** @type {import('./ref')} */
  8671. module.exports = ReferenceError;
  8672. /***/ }),
  8673. /* 63 */
  8674. /***/ (function(module, exports) {
  8675. 'use strict';
  8676. /** @type {import('./syntax')} */
  8677. module.exports = SyntaxError;
  8678. /***/ }),
  8679. /* 64 */
  8680. /***/ (function(module, exports) {
  8681. 'use strict';
  8682. /** @type {import('./type')} */
  8683. module.exports = TypeError;
  8684. /***/ }),
  8685. /* 65 */
  8686. /***/ (function(module, exports) {
  8687. 'use strict';
  8688. /** @type {import('./uri')} */
  8689. module.exports = URIError;
  8690. /***/ }),
  8691. /* 66 */
  8692. /***/ (function(module, exports, __webpack_require__) {
  8693. 'use strict';
  8694. var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  8695. var hasSymbolSham = __webpack_require__(56);
  8696. module.exports = function hasNativeSymbols() {
  8697. if (typeof origSymbol !== 'function') { return false; }
  8698. if (typeof Symbol !== 'function') { return false; }
  8699. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  8700. if (typeof Symbol('bar') !== 'symbol') { return false; }
  8701. return hasSymbolSham();
  8702. };
  8703. /***/ }),
  8704. /* 67 */
  8705. /***/ (function(module, exports) {
  8706. 'use strict';
  8707. var test = {
  8708. __proto__: null,
  8709. foo: {}
  8710. };
  8711. var $Object = Object;
  8712. /** @type {import('.')} */
  8713. module.exports = function hasProto() {
  8714. // @ts-expect-error: TS errors on an inherited property for some reason
  8715. return { __proto__: test }.foo === test.foo
  8716. && !(test instanceof $Object);
  8717. };
  8718. /***/ }),
  8719. /* 68 */
  8720. /***/ (function(module, exports, __webpack_require__) {
  8721. 'use strict';
  8722. var implementation = __webpack_require__(69);
  8723. module.exports = Function.prototype.bind || implementation;
  8724. /***/ }),
  8725. /* 69 */
  8726. /***/ (function(module, exports) {
  8727. 'use strict';
  8728. /* eslint no-invalid-this: 1 */
  8729. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  8730. var toStr = Object.prototype.toString;
  8731. var max = Math.max;
  8732. var funcType = '[object Function]';
  8733. var concatty = function concatty(a, b) {
  8734. var arr = [];
  8735. for (var i = 0; i < a.length; i += 1) {
  8736. arr[i] = a[i];
  8737. }
  8738. for (var j = 0; j < b.length; j += 1) {
  8739. arr[j + a.length] = b[j];
  8740. }
  8741. return arr;
  8742. };
  8743. var slicy = function slicy(arrLike, offset) {
  8744. var arr = [];
  8745. for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
  8746. arr[j] = arrLike[i];
  8747. }
  8748. return arr;
  8749. };
  8750. var joiny = function (arr, joiner) {
  8751. var str = '';
  8752. for (var i = 0; i < arr.length; i += 1) {
  8753. str += arr[i];
  8754. if (i + 1 < arr.length) {
  8755. str += joiner;
  8756. }
  8757. }
  8758. return str;
  8759. };
  8760. module.exports = function bind(that) {
  8761. var target = this;
  8762. if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
  8763. throw new TypeError(ERROR_MESSAGE + target);
  8764. }
  8765. var args = slicy(arguments, 1);
  8766. var bound;
  8767. var binder = function () {
  8768. if (this instanceof bound) {
  8769. var result = target.apply(
  8770. this,
  8771. concatty(args, arguments)
  8772. );
  8773. if (Object(result) === result) {
  8774. return result;
  8775. }
  8776. return this;
  8777. }
  8778. return target.apply(
  8779. that,
  8780. concatty(args, arguments)
  8781. );
  8782. };
  8783. var boundLength = max(0, target.length - args.length);
  8784. var boundArgs = [];
  8785. for (var i = 0; i < boundLength; i++) {
  8786. boundArgs[i] = '$' + i;
  8787. }
  8788. bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
  8789. if (target.prototype) {
  8790. var Empty = function Empty() {};
  8791. Empty.prototype = target.prototype;
  8792. bound.prototype = new Empty();
  8793. Empty.prototype = null;
  8794. }
  8795. return bound;
  8796. };
  8797. /***/ }),
  8798. /* 70 */
  8799. /***/ (function(module, exports, __webpack_require__) {
  8800. 'use strict';
  8801. var call = Function.prototype.call;
  8802. var $hasOwn = Object.prototype.hasOwnProperty;
  8803. var bind = __webpack_require__(68);
  8804. /** @type {import('.')} */
  8805. module.exports = bind.call(call, $hasOwn);
  8806. /***/ }),
  8807. /* 71 */
  8808. /***/ (function(module, exports, __webpack_require__) {
  8809. 'use strict';
  8810. var bind = __webpack_require__(68);
  8811. var GetIntrinsic = __webpack_require__(58);
  8812. var setFunctionLength = __webpack_require__(72);
  8813. var $TypeError = __webpack_require__(64);
  8814. var $apply = GetIntrinsic('%Function.prototype.apply%');
  8815. var $call = GetIntrinsic('%Function.prototype.call%');
  8816. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  8817. var $defineProperty = __webpack_require__(74);
  8818. var $max = GetIntrinsic('%Math.max%');
  8819. module.exports = function callBind(originalFunction) {
  8820. if (typeof originalFunction !== 'function') {
  8821. throw new $TypeError('a function is required');
  8822. }
  8823. var func = $reflectApply(bind, $call, arguments);
  8824. return setFunctionLength(
  8825. func,
  8826. 1 + $max(0, originalFunction.length - (arguments.length - 1)),
  8827. true
  8828. );
  8829. };
  8830. var applyBind = function applyBind() {
  8831. return $reflectApply(bind, $apply, arguments);
  8832. };
  8833. if ($defineProperty) {
  8834. $defineProperty(module.exports, 'apply', { value: applyBind });
  8835. } else {
  8836. module.exports.apply = applyBind;
  8837. }
  8838. /***/ }),
  8839. /* 72 */
  8840. /***/ (function(module, exports, __webpack_require__) {
  8841. 'use strict';
  8842. var GetIntrinsic = __webpack_require__(58);
  8843. var define = __webpack_require__(73);
  8844. var hasDescriptors = __webpack_require__(76)();
  8845. var gOPD = __webpack_require__(75);
  8846. var $TypeError = __webpack_require__(64);
  8847. var $floor = GetIntrinsic('%Math.floor%');
  8848. /** @type {import('.')} */
  8849. module.exports = function setFunctionLength(fn, length) {
  8850. if (typeof fn !== 'function') {
  8851. throw new $TypeError('`fn` is not a function');
  8852. }
  8853. if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
  8854. throw new $TypeError('`length` must be a positive 32-bit integer');
  8855. }
  8856. var loose = arguments.length > 2 && !!arguments[2];
  8857. var functionLengthIsConfigurable = true;
  8858. var functionLengthIsWritable = true;
  8859. if ('length' in fn && gOPD) {
  8860. var desc = gOPD(fn, 'length');
  8861. if (desc && !desc.configurable) {
  8862. functionLengthIsConfigurable = false;
  8863. }
  8864. if (desc && !desc.writable) {
  8865. functionLengthIsWritable = false;
  8866. }
  8867. }
  8868. if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
  8869. if (hasDescriptors) {
  8870. define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
  8871. } else {
  8872. define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
  8873. }
  8874. }
  8875. return fn;
  8876. };
  8877. /***/ }),
  8878. /* 73 */
  8879. /***/ (function(module, exports, __webpack_require__) {
  8880. 'use strict';
  8881. var $defineProperty = __webpack_require__(74);
  8882. var $SyntaxError = __webpack_require__(63);
  8883. var $TypeError = __webpack_require__(64);
  8884. var gopd = __webpack_require__(75);
  8885. /** @type {import('.')} */
  8886. module.exports = function defineDataProperty(
  8887. obj,
  8888. property,
  8889. value
  8890. ) {
  8891. if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
  8892. throw new $TypeError('`obj` must be an object or a function`');
  8893. }
  8894. if (typeof property !== 'string' && typeof property !== 'symbol') {
  8895. throw new $TypeError('`property` must be a string or a symbol`');
  8896. }
  8897. if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
  8898. throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
  8899. }
  8900. if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
  8901. throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
  8902. }
  8903. if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
  8904. throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
  8905. }
  8906. if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
  8907. throw new $TypeError('`loose`, if provided, must be a boolean');
  8908. }
  8909. var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
  8910. var nonWritable = arguments.length > 4 ? arguments[4] : null;
  8911. var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
  8912. var loose = arguments.length > 6 ? arguments[6] : false;
  8913. /* @type {false | TypedPropertyDescriptor<unknown>} */
  8914. var desc = !!gopd && gopd(obj, property);
  8915. if ($defineProperty) {
  8916. $defineProperty(obj, property, {
  8917. configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
  8918. enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
  8919. value: value,
  8920. writable: nonWritable === null && desc ? desc.writable : !nonWritable
  8921. });
  8922. } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
  8923. // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
  8924. obj[property] = value; // eslint-disable-line no-param-reassign
  8925. } else {
  8926. throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
  8927. }
  8928. };
  8929. /***/ }),
  8930. /* 74 */
  8931. /***/ (function(module, exports, __webpack_require__) {
  8932. 'use strict';
  8933. var GetIntrinsic = __webpack_require__(58);
  8934. /** @type {import('.')} */
  8935. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;
  8936. if ($defineProperty) {
  8937. try {
  8938. $defineProperty({}, 'a', { value: 1 });
  8939. } catch (e) {
  8940. // IE 8 has a broken defineProperty
  8941. $defineProperty = false;
  8942. }
  8943. }
  8944. module.exports = $defineProperty;
  8945. /***/ }),
  8946. /* 75 */
  8947. /***/ (function(module, exports, __webpack_require__) {
  8948. 'use strict';
  8949. var GetIntrinsic = __webpack_require__(58);
  8950. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  8951. if ($gOPD) {
  8952. try {
  8953. $gOPD([], 'length');
  8954. } catch (e) {
  8955. // IE 8 has a broken gOPD
  8956. $gOPD = null;
  8957. }
  8958. }
  8959. module.exports = $gOPD;
  8960. /***/ }),
  8961. /* 76 */
  8962. /***/ (function(module, exports, __webpack_require__) {
  8963. 'use strict';
  8964. var $defineProperty = __webpack_require__(74);
  8965. var hasPropertyDescriptors = function hasPropertyDescriptors() {
  8966. return !!$defineProperty;
  8967. };
  8968. hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
  8969. // node v0.6 has a bug where array lengths can be Set but not Defined
  8970. if (!$defineProperty) {
  8971. return null;
  8972. }
  8973. try {
  8974. return $defineProperty([], 'length', { value: 1 }).length !== 1;
  8975. } catch (e) {
  8976. // In Firefox 4-22, defining length on an array throws an exception.
  8977. return true;
  8978. }
  8979. };
  8980. module.exports = hasPropertyDescriptors;
  8981. /***/ }),
  8982. /* 77 */
  8983. /***/ (function(module, exports, __webpack_require__) {
  8984. 'use strict';
  8985. var toStr = Object.prototype.toString;
  8986. var fnToStr = Function.prototype.toString;
  8987. var isFnRegex = /^\s*(?:function)?\*/;
  8988. var hasToStringTag = __webpack_require__(55)();
  8989. var getProto = Object.getPrototypeOf;
  8990. var getGeneratorFunc = function () { // eslint-disable-line consistent-return
  8991. if (!hasToStringTag) {
  8992. return false;
  8993. }
  8994. try {
  8995. return Function('return function*() {}')();
  8996. } catch (e) {
  8997. }
  8998. };
  8999. var GeneratorFunction;
  9000. module.exports = function isGeneratorFunction(fn) {
  9001. if (typeof fn !== 'function') {
  9002. return false;
  9003. }
  9004. if (isFnRegex.test(fnToStr.call(fn))) {
  9005. return true;
  9006. }
  9007. if (!hasToStringTag) {
  9008. var str = toStr.call(fn);
  9009. return str === '[object GeneratorFunction]';
  9010. }
  9011. if (!getProto) {
  9012. return false;
  9013. }
  9014. if (typeof GeneratorFunction === 'undefined') {
  9015. var generatorFunc = getGeneratorFunc();
  9016. GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
  9017. }
  9018. return getProto(fn) === GeneratorFunction;
  9019. };
  9020. /***/ }),
  9021. /* 78 */
  9022. /***/ (function(module, exports, __webpack_require__) {
  9023. /* WEBPACK VAR INJECTION */(function(global) {'use strict';
  9024. var forEach = __webpack_require__(79);
  9025. var availableTypedArrays = __webpack_require__(81);
  9026. var callBind = __webpack_require__(71);
  9027. var callBound = __webpack_require__(57);
  9028. var gOPD = __webpack_require__(75);
  9029. /** @type {(O: object) => string} */
  9030. var $toString = callBound('Object.prototype.toString');
  9031. var hasToStringTag = __webpack_require__(55)();
  9032. var g = typeof globalThis === 'undefined' ? global : globalThis;
  9033. var typedArrays = availableTypedArrays();
  9034. var $slice = callBound('String.prototype.slice');
  9035. var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
  9036. /** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
  9037. var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
  9038. for (var i = 0; i < array.length; i += 1) {
  9039. if (array[i] === value) {
  9040. return i;
  9041. }
  9042. }
  9043. return -1;
  9044. };
  9045. /** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */
  9046. /** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */
  9047. var cache = { __proto__: null };
  9048. if (hasToStringTag && gOPD && getPrototypeOf) {
  9049. forEach(typedArrays, function (typedArray) {
  9050. var arr = new g[typedArray]();
  9051. if (Symbol.toStringTag in arr) {
  9052. var proto = getPrototypeOf(arr);
  9053. // @ts-expect-error TS won't narrow inside a closure
  9054. var descriptor = gOPD(proto, Symbol.toStringTag);
  9055. if (!descriptor) {
  9056. var superProto = getPrototypeOf(proto);
  9057. // @ts-expect-error TS won't narrow inside a closure
  9058. descriptor = gOPD(superProto, Symbol.toStringTag);
  9059. }
  9060. // @ts-expect-error TODO: fix
  9061. cache['$' + typedArray] = callBind(descriptor.get);
  9062. }
  9063. });
  9064. } else {
  9065. forEach(typedArrays, function (typedArray) {
  9066. var arr = new g[typedArray]();
  9067. var fn = arr.slice || arr.set;
  9068. if (fn) {
  9069. // @ts-expect-error TODO: fix
  9070. cache['$' + typedArray] = callBind(fn);
  9071. }
  9072. });
  9073. }
  9074. /** @type {(value: object) => false | import('.').TypedArrayName} */
  9075. var tryTypedArrays = function tryAllTypedArrays(value) {
  9076. /** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
  9077. forEach(
  9078. // eslint-disable-next-line no-extra-parens
  9079. /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
  9080. /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
  9081. function (getter, typedArray) {
  9082. if (!found) {
  9083. try {
  9084. // @ts-expect-error TODO: fix
  9085. if ('$' + getter(value) === typedArray) {
  9086. found = $slice(typedArray, 1);
  9087. }
  9088. } catch (e) { /**/ }
  9089. }
  9090. }
  9091. );
  9092. return found;
  9093. };
  9094. /** @type {(value: object) => false | import('.').TypedArrayName} */
  9095. var trySlices = function tryAllSlices(value) {
  9096. /** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
  9097. forEach(
  9098. // eslint-disable-next-line no-extra-parens
  9099. /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
  9100. /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
  9101. if (!found) {
  9102. try {
  9103. // @ts-expect-error TODO: fix
  9104. getter(value);
  9105. found = $slice(name, 1);
  9106. } catch (e) { /**/ }
  9107. }
  9108. }
  9109. );
  9110. return found;
  9111. };
  9112. /** @type {import('.')} */
  9113. module.exports = function whichTypedArray(value) {
  9114. if (!value || typeof value !== 'object') { return false; }
  9115. if (!hasToStringTag) {
  9116. /** @type {string} */
  9117. var tag = $slice($toString(value), 8, -1);
  9118. if ($indexOf(typedArrays, tag) > -1) {
  9119. return tag;
  9120. }
  9121. if (tag !== 'Object') {
  9122. return false;
  9123. }
  9124. // node < 0.6 hits here on real Typed Arrays
  9125. return trySlices(value);
  9126. }
  9127. if (!gOPD) { return null; } // unknown engine
  9128. return tryTypedArrays(value);
  9129. };
  9130. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  9131. /***/ }),
  9132. /* 79 */
  9133. /***/ (function(module, exports, __webpack_require__) {
  9134. 'use strict';
  9135. var isCallable = __webpack_require__(80);
  9136. var toStr = Object.prototype.toString;
  9137. var hasOwnProperty = Object.prototype.hasOwnProperty;
  9138. var forEachArray = function forEachArray(array, iterator, receiver) {
  9139. for (var i = 0, len = array.length; i < len; i++) {
  9140. if (hasOwnProperty.call(array, i)) {
  9141. if (receiver == null) {
  9142. iterator(array[i], i, array);
  9143. } else {
  9144. iterator.call(receiver, array[i], i, array);
  9145. }
  9146. }
  9147. }
  9148. };
  9149. var forEachString = function forEachString(string, iterator, receiver) {
  9150. for (var i = 0, len = string.length; i < len; i++) {
  9151. // no such thing as a sparse string.
  9152. if (receiver == null) {
  9153. iterator(string.charAt(i), i, string);
  9154. } else {
  9155. iterator.call(receiver, string.charAt(i), i, string);
  9156. }
  9157. }
  9158. };
  9159. var forEachObject = function forEachObject(object, iterator, receiver) {
  9160. for (var k in object) {
  9161. if (hasOwnProperty.call(object, k)) {
  9162. if (receiver == null) {
  9163. iterator(object[k], k, object);
  9164. } else {
  9165. iterator.call(receiver, object[k], k, object);
  9166. }
  9167. }
  9168. }
  9169. };
  9170. var forEach = function forEach(list, iterator, thisArg) {
  9171. if (!isCallable(iterator)) {
  9172. throw new TypeError('iterator must be a function');
  9173. }
  9174. var receiver;
  9175. if (arguments.length >= 3) {
  9176. receiver = thisArg;
  9177. }
  9178. if (toStr.call(list) === '[object Array]') {
  9179. forEachArray(list, iterator, receiver);
  9180. } else if (typeof list === 'string') {
  9181. forEachString(list, iterator, receiver);
  9182. } else {
  9183. forEachObject(list, iterator, receiver);
  9184. }
  9185. };
  9186. module.exports = forEach;
  9187. /***/ }),
  9188. /* 80 */
  9189. /***/ (function(module, exports) {
  9190. 'use strict';
  9191. var fnToStr = Function.prototype.toString;
  9192. var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
  9193. var badArrayLike;
  9194. var isCallableMarker;
  9195. if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
  9196. try {
  9197. badArrayLike = Object.defineProperty({}, 'length', {
  9198. get: function () {
  9199. throw isCallableMarker;
  9200. }
  9201. });
  9202. isCallableMarker = {};
  9203. // eslint-disable-next-line no-throw-literal
  9204. reflectApply(function () { throw 42; }, null, badArrayLike);
  9205. } catch (_) {
  9206. if (_ !== isCallableMarker) {
  9207. reflectApply = null;
  9208. }
  9209. }
  9210. } else {
  9211. reflectApply = null;
  9212. }
  9213. var constructorRegex = /^\s*class\b/;
  9214. var isES6ClassFn = function isES6ClassFunction(value) {
  9215. try {
  9216. var fnStr = fnToStr.call(value);
  9217. return constructorRegex.test(fnStr);
  9218. } catch (e) {
  9219. return false; // not a function
  9220. }
  9221. };
  9222. var tryFunctionObject = function tryFunctionToStr(value) {
  9223. try {
  9224. if (isES6ClassFn(value)) { return false; }
  9225. fnToStr.call(value);
  9226. return true;
  9227. } catch (e) {
  9228. return false;
  9229. }
  9230. };
  9231. var toStr = Object.prototype.toString;
  9232. var objectClass = '[object Object]';
  9233. var fnClass = '[object Function]';
  9234. var genClass = '[object GeneratorFunction]';
  9235. var ddaClass = '[object HTMLAllCollection]'; // IE 11
  9236. var ddaClass2 = '[object HTML document.all class]';
  9237. var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
  9238. var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
  9239. var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
  9240. var isDDA = function isDocumentDotAll() { return false; };
  9241. if (typeof document === 'object') {
  9242. // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
  9243. var all = document.all;
  9244. if (toStr.call(all) === toStr.call(document.all)) {
  9245. isDDA = function isDocumentDotAll(value) {
  9246. /* globals document: false */
  9247. // in IE 6-8, typeof document.all is "object" and it's truthy
  9248. if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
  9249. try {
  9250. var str = toStr.call(value);
  9251. return (
  9252. str === ddaClass
  9253. || str === ddaClass2
  9254. || str === ddaClass3 // opera 12.16
  9255. || str === objectClass // IE 6-8
  9256. ) && value('') == null; // eslint-disable-line eqeqeq
  9257. } catch (e) { /**/ }
  9258. }
  9259. return false;
  9260. };
  9261. }
  9262. }
  9263. module.exports = reflectApply
  9264. ? function isCallable(value) {
  9265. if (isDDA(value)) { return true; }
  9266. if (!value) { return false; }
  9267. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  9268. try {
  9269. reflectApply(value, null, badArrayLike);
  9270. } catch (e) {
  9271. if (e !== isCallableMarker) { return false; }
  9272. }
  9273. return !isES6ClassFn(value) && tryFunctionObject(value);
  9274. }
  9275. : function isCallable(value) {
  9276. if (isDDA(value)) { return true; }
  9277. if (!value) { return false; }
  9278. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  9279. if (hasToStringTag) { return tryFunctionObject(value); }
  9280. if (isES6ClassFn(value)) { return false; }
  9281. var strClass = toStr.call(value);
  9282. if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
  9283. return tryFunctionObject(value);
  9284. };
  9285. /***/ }),
  9286. /* 81 */
  9287. /***/ (function(module, exports, __webpack_require__) {
  9288. /* WEBPACK VAR INJECTION */(function(global) {'use strict';
  9289. var possibleNames = __webpack_require__(82);
  9290. var g = typeof globalThis === 'undefined' ? global : globalThis;
  9291. /** @type {import('.')} */
  9292. module.exports = function availableTypedArrays() {
  9293. var /** @type {ReturnType<typeof availableTypedArrays>} */ out = [];
  9294. for (var i = 0; i < possibleNames.length; i++) {
  9295. if (typeof g[possibleNames[i]] === 'function') {
  9296. // @ts-expect-error
  9297. out[out.length] = possibleNames[i];
  9298. }
  9299. }
  9300. return out;
  9301. };
  9302. /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
  9303. /***/ }),
  9304. /* 82 */
  9305. /***/ (function(module, exports) {
  9306. 'use strict';
  9307. /** @type {import('.')} */
  9308. module.exports = [
  9309. 'Float32Array',
  9310. 'Float64Array',
  9311. 'Int8Array',
  9312. 'Int16Array',
  9313. 'Int32Array',
  9314. 'Uint8Array',
  9315. 'Uint8ClampedArray',
  9316. 'Uint16Array',
  9317. 'Uint32Array',
  9318. 'BigInt64Array',
  9319. 'BigUint64Array'
  9320. ];
  9321. /***/ }),
  9322. /* 83 */
  9323. /***/ (function(module, exports, __webpack_require__) {
  9324. 'use strict';
  9325. var whichTypedArray = __webpack_require__(78);
  9326. /** @type {import('.')} */
  9327. module.exports = function isTypedArray(value) {
  9328. return !!whichTypedArray(value);
  9329. };
  9330. /***/ }),
  9331. /* 84 */
  9332. /***/ (function(module, exports) {
  9333. module.exports = function isBuffer(arg) {
  9334. return arg && typeof arg === 'object'
  9335. && typeof arg.copy === 'function'
  9336. && typeof arg.fill === 'function'
  9337. && typeof arg.readUInt8 === 'function';
  9338. }
  9339. /***/ }),
  9340. /* 85 */
  9341. /***/ (function(module, exports) {
  9342. if (typeof Object.create === 'function') {
  9343. // implementation from standard node.js 'util' module
  9344. module.exports = function inherits(ctor, superCtor) {
  9345. if (superCtor) {
  9346. ctor.super_ = superCtor
  9347. ctor.prototype = Object.create(superCtor.prototype, {
  9348. constructor: {
  9349. value: ctor,
  9350. enumerable: false,
  9351. writable: true,
  9352. configurable: true
  9353. }
  9354. })
  9355. }
  9356. };
  9357. } else {
  9358. // old school shim for old browsers
  9359. module.exports = function inherits(ctor, superCtor) {
  9360. if (superCtor) {
  9361. ctor.super_ = superCtor
  9362. var TempCtor = function () {}
  9363. TempCtor.prototype = superCtor.prototype
  9364. ctor.prototype = new TempCtor()
  9365. ctor.prototype.constructor = ctor
  9366. }
  9367. }
  9368. }
  9369. /***/ }),
  9370. /* 86 */
  9371. /***/ (function(module, exports, __webpack_require__) {
  9372. /* WEBPACK VAR INJECTION */(function(process) {var AWS = __webpack_require__(1);
  9373. var AcceptorStateMachine = __webpack_require__(87);
  9374. var inherit = AWS.util.inherit;
  9375. var domain = AWS.util.domain;
  9376. var jmespath = __webpack_require__(88);
  9377. /**
  9378. * @api private
  9379. */
  9380. var hardErrorStates = {success: 1, error: 1, complete: 1};
  9381. function isTerminalState(machine) {
  9382. return Object.prototype.hasOwnProperty.call(hardErrorStates, machine._asm.currentState);
  9383. }
  9384. var fsm = new AcceptorStateMachine();
  9385. fsm.setupStates = function() {
  9386. var transition = function(_, done) {
  9387. var self = this;
  9388. self._haltHandlersOnError = false;
  9389. self.emit(self._asm.currentState, function(err) {
  9390. if (err) {
  9391. if (isTerminalState(self)) {
  9392. if (domain && self.domain instanceof domain.Domain) {
  9393. err.domainEmitter = self;
  9394. err.domain = self.domain;
  9395. err.domainThrown = false;
  9396. self.domain.emit('error', err);
  9397. } else {
  9398. throw err;
  9399. }
  9400. } else {
  9401. self.response.error = err;
  9402. done(err);
  9403. }
  9404. } else {
  9405. done(self.response.error);
  9406. }
  9407. });
  9408. };
  9409. this.addState('validate', 'build', 'error', transition);
  9410. this.addState('build', 'afterBuild', 'restart', transition);
  9411. this.addState('afterBuild', 'sign', 'restart', transition);
  9412. this.addState('sign', 'send', 'retry', transition);
  9413. this.addState('retry', 'afterRetry', 'afterRetry', transition);
  9414. this.addState('afterRetry', 'sign', 'error', transition);
  9415. this.addState('send', 'validateResponse', 'retry', transition);
  9416. this.addState('validateResponse', 'extractData', 'extractError', transition);
  9417. this.addState('extractError', 'extractData', 'retry', transition);
  9418. this.addState('extractData', 'success', 'retry', transition);
  9419. this.addState('restart', 'build', 'error', transition);
  9420. this.addState('success', 'complete', 'complete', transition);
  9421. this.addState('error', 'complete', 'complete', transition);
  9422. this.addState('complete', null, null, transition);
  9423. };
  9424. fsm.setupStates();
  9425. /**
  9426. * ## Asynchronous Requests
  9427. *
  9428. * All requests made through the SDK are asynchronous and use a
  9429. * callback interface. Each service method that kicks off a request
  9430. * returns an `AWS.Request` object that you can use to register
  9431. * callbacks.
  9432. *
  9433. * For example, the following service method returns the request
  9434. * object as "request", which can be used to register callbacks:
  9435. *
  9436. * ```javascript
  9437. * // request is an AWS.Request object
  9438. * var request = ec2.describeInstances();
  9439. *
  9440. * // register callbacks on request to retrieve response data
  9441. * request.on('success', function(response) {
  9442. * console.log(response.data);
  9443. * });
  9444. * ```
  9445. *
  9446. * When a request is ready to be sent, the {send} method should
  9447. * be called:
  9448. *
  9449. * ```javascript
  9450. * request.send();
  9451. * ```
  9452. *
  9453. * Since registered callbacks may or may not be idempotent, requests should only
  9454. * be sent once. To perform the same operation multiple times, you will need to
  9455. * create multiple request objects, each with its own registered callbacks.
  9456. *
  9457. * ## Removing Default Listeners for Events
  9458. *
  9459. * Request objects are built with default listeners for the various events,
  9460. * depending on the service type. In some cases, you may want to remove
  9461. * some built-in listeners to customize behaviour. Doing this requires
  9462. * access to the built-in listener functions, which are exposed through
  9463. * the {AWS.EventListeners.Core} namespace. For instance, you may
  9464. * want to customize the HTTP handler used when sending a request. In this
  9465. * case, you can remove the built-in listener associated with the 'send'
  9466. * event, the {AWS.EventListeners.Core.SEND} listener and add your own.
  9467. *
  9468. * ## Multiple Callbacks and Chaining
  9469. *
  9470. * You can register multiple callbacks on any request object. The
  9471. * callbacks can be registered for different events, or all for the
  9472. * same event. In addition, you can chain callback registration, for
  9473. * example:
  9474. *
  9475. * ```javascript
  9476. * request.
  9477. * on('success', function(response) {
  9478. * console.log("Success!");
  9479. * }).
  9480. * on('error', function(error, response) {
  9481. * console.log("Error!");
  9482. * }).
  9483. * on('complete', function(response) {
  9484. * console.log("Always!");
  9485. * }).
  9486. * send();
  9487. * ```
  9488. *
  9489. * The above example will print either "Success! Always!", or "Error! Always!",
  9490. * depending on whether the request succeeded or not.
  9491. *
  9492. * @!attribute httpRequest
  9493. * @readonly
  9494. * @!group HTTP Properties
  9495. * @return [AWS.HttpRequest] the raw HTTP request object
  9496. * containing request headers and body information
  9497. * sent by the service.
  9498. *
  9499. * @!attribute startTime
  9500. * @readonly
  9501. * @!group Operation Properties
  9502. * @return [Date] the time that the request started
  9503. *
  9504. * @!group Request Building Events
  9505. *
  9506. * @!event validate(request)
  9507. * Triggered when a request is being validated. Listeners
  9508. * should throw an error if the request should not be sent.
  9509. * @param request [Request] the request object being sent
  9510. * @see AWS.EventListeners.Core.VALIDATE_CREDENTIALS
  9511. * @see AWS.EventListeners.Core.VALIDATE_REGION
  9512. * @example Ensuring that a certain parameter is set before sending a request
  9513. * var req = s3.putObject(params);
  9514. * req.on('validate', function() {
  9515. * if (!req.params.Body.match(/^Hello\s/)) {
  9516. * throw new Error('Body must start with "Hello "');
  9517. * }
  9518. * });
  9519. * req.send(function(err, data) { ... });
  9520. *
  9521. * @!event build(request)
  9522. * Triggered when the request payload is being built. Listeners
  9523. * should fill the necessary information to send the request
  9524. * over HTTP.
  9525. * @param (see AWS.Request~validate)
  9526. * @example Add a custom HTTP header to a request
  9527. * var req = s3.putObject(params);
  9528. * req.on('build', function() {
  9529. * req.httpRequest.headers['Custom-Header'] = 'value';
  9530. * });
  9531. * req.send(function(err, data) { ... });
  9532. *
  9533. * @!event sign(request)
  9534. * Triggered when the request is being signed. Listeners should
  9535. * add the correct authentication headers and/or adjust the body,
  9536. * depending on the authentication mechanism being used.
  9537. * @param (see AWS.Request~validate)
  9538. *
  9539. * @!group Request Sending Events
  9540. *
  9541. * @!event send(response)
  9542. * Triggered when the request is ready to be sent. Listeners
  9543. * should call the underlying transport layer to initiate
  9544. * the sending of the request.
  9545. * @param response [Response] the response object
  9546. * @context [Request] the request object that was sent
  9547. * @see AWS.EventListeners.Core.SEND
  9548. *
  9549. * @!event retry(response)
  9550. * Triggered when a request failed and might need to be retried or redirected.
  9551. * If the response is retryable, the listener should set the
  9552. * `response.error.retryable` property to `true`, and optionally set
  9553. * `response.error.retryDelay` to the millisecond delay for the next attempt.
  9554. * In the case of a redirect, `response.error.redirect` should be set to
  9555. * `true` with `retryDelay` set to an optional delay on the next request.
  9556. *
  9557. * If a listener decides that a request should not be retried,
  9558. * it should set both `retryable` and `redirect` to false.
  9559. *
  9560. * Note that a retryable error will be retried at most
  9561. * {AWS.Config.maxRetries} times (based on the service object's config).
  9562. * Similarly, a request that is redirected will only redirect at most
  9563. * {AWS.Config.maxRedirects} times.
  9564. *
  9565. * @param (see AWS.Request~send)
  9566. * @context (see AWS.Request~send)
  9567. * @example Adding a custom retry for a 404 response
  9568. * request.on('retry', function(response) {
  9569. * // this resource is not yet available, wait 10 seconds to get it again
  9570. * if (response.httpResponse.statusCode === 404 && response.error) {
  9571. * response.error.retryable = true; // retry this error
  9572. * response.error.retryDelay = 10000; // wait 10 seconds
  9573. * }
  9574. * });
  9575. *
  9576. * @!group Data Parsing Events
  9577. *
  9578. * @!event extractError(response)
  9579. * Triggered on all non-2xx requests so that listeners can extract
  9580. * error details from the response body. Listeners to this event
  9581. * should set the `response.error` property.
  9582. * @param (see AWS.Request~send)
  9583. * @context (see AWS.Request~send)
  9584. *
  9585. * @!event extractData(response)
  9586. * Triggered in successful requests to allow listeners to
  9587. * de-serialize the response body into `response.data`.
  9588. * @param (see AWS.Request~send)
  9589. * @context (see AWS.Request~send)
  9590. *
  9591. * @!group Completion Events
  9592. *
  9593. * @!event success(response)
  9594. * Triggered when the request completed successfully.
  9595. * `response.data` will contain the response data and
  9596. * `response.error` will be null.
  9597. * @param (see AWS.Request~send)
  9598. * @context (see AWS.Request~send)
  9599. *
  9600. * @!event error(error, response)
  9601. * Triggered when an error occurs at any point during the
  9602. * request. `response.error` will contain details about the error
  9603. * that occurred. `response.data` will be null.
  9604. * @param error [Error] the error object containing details about
  9605. * the error that occurred.
  9606. * @param (see AWS.Request~send)
  9607. * @context (see AWS.Request~send)
  9608. *
  9609. * @!event complete(response)
  9610. * Triggered whenever a request cycle completes. `response.error`
  9611. * should be checked, since the request may have failed.
  9612. * @param (see AWS.Request~send)
  9613. * @context (see AWS.Request~send)
  9614. *
  9615. * @!group HTTP Events
  9616. *
  9617. * @!event httpHeaders(statusCode, headers, response, statusMessage)
  9618. * Triggered when headers are sent by the remote server
  9619. * @param statusCode [Integer] the HTTP response code
  9620. * @param headers [map<String,String>] the response headers
  9621. * @param (see AWS.Request~send)
  9622. * @param statusMessage [String] A status message corresponding to the HTTP
  9623. * response code
  9624. * @context (see AWS.Request~send)
  9625. *
  9626. * @!event httpData(chunk, response)
  9627. * Triggered when data is sent by the remote server
  9628. * @param chunk [Buffer] the buffer data containing the next data chunk
  9629. * from the server
  9630. * @param (see AWS.Request~send)
  9631. * @context (see AWS.Request~send)
  9632. * @see AWS.EventListeners.Core.HTTP_DATA
  9633. *
  9634. * @!event httpUploadProgress(progress, response)
  9635. * Triggered when the HTTP request has uploaded more data
  9636. * @param progress [map] An object containing the `loaded` and `total` bytes
  9637. * of the request.
  9638. * @param (see AWS.Request~send)
  9639. * @context (see AWS.Request~send)
  9640. * @note This event will not be emitted in Node.js 0.8.x.
  9641. *
  9642. * @!event httpDownloadProgress(progress, response)
  9643. * Triggered when the HTTP request has downloaded more data
  9644. * @param progress [map] An object containing the `loaded` and `total` bytes
  9645. * of the request.
  9646. * @param (see AWS.Request~send)
  9647. * @context (see AWS.Request~send)
  9648. * @note This event will not be emitted in Node.js 0.8.x.
  9649. *
  9650. * @!event httpError(error, response)
  9651. * Triggered when the HTTP request failed
  9652. * @param error [Error] the error object that was thrown
  9653. * @param (see AWS.Request~send)
  9654. * @context (see AWS.Request~send)
  9655. *
  9656. * @!event httpDone(response)
  9657. * Triggered when the server is finished sending data
  9658. * @param (see AWS.Request~send)
  9659. * @context (see AWS.Request~send)
  9660. *
  9661. * @see AWS.Response
  9662. */
  9663. AWS.Request = inherit({
  9664. /**
  9665. * Creates a request for an operation on a given service with
  9666. * a set of input parameters.
  9667. *
  9668. * @param service [AWS.Service] the service to perform the operation on
  9669. * @param operation [String] the operation to perform on the service
  9670. * @param params [Object] parameters to send to the operation.
  9671. * See the operation's documentation for the format of the
  9672. * parameters.
  9673. */
  9674. constructor: function Request(service, operation, params) {
  9675. var endpoint = service.endpoint;
  9676. var region = service.config.region;
  9677. var customUserAgent = service.config.customUserAgent;
  9678. if (service.signingRegion) {
  9679. region = service.signingRegion;
  9680. } else if (service.isGlobalEndpoint) {
  9681. region = 'us-east-1';
  9682. }
  9683. this.domain = domain && domain.active;
  9684. this.service = service;
  9685. this.operation = operation;
  9686. this.params = params || {};
  9687. this.httpRequest = new AWS.HttpRequest(endpoint, region);
  9688. this.httpRequest.appendToUserAgent(customUserAgent);
  9689. this.startTime = service.getSkewCorrectedDate();
  9690. this.response = new AWS.Response(this);
  9691. this._asm = new AcceptorStateMachine(fsm.states, 'validate');
  9692. this._haltHandlersOnError = false;
  9693. AWS.SequentialExecutor.call(this);
  9694. this.emit = this.emitEvent;
  9695. },
  9696. /**
  9697. * @!group Sending a Request
  9698. */
  9699. /**
  9700. * @overload send(callback = null)
  9701. * Sends the request object.
  9702. *
  9703. * @callback callback function(err, data)
  9704. * If a callback is supplied, it is called when a response is returned
  9705. * from the service.
  9706. * @context [AWS.Request] the request object being sent.
  9707. * @param err [Error] the error object returned from the request.
  9708. * Set to `null` if the request is successful.
  9709. * @param data [Object] the de-serialized data returned from
  9710. * the request. Set to `null` if a request error occurs.
  9711. * @example Sending a request with a callback
  9712. * request = s3.putObject({Bucket: 'bucket', Key: 'key'});
  9713. * request.send(function(err, data) { console.log(err, data); });
  9714. * @example Sending a request with no callback (using event handlers)
  9715. * request = s3.putObject({Bucket: 'bucket', Key: 'key'});
  9716. * request.on('complete', function(response) { ... }); // register a callback
  9717. * request.send();
  9718. */
  9719. send: function send(callback) {
  9720. if (callback) {
  9721. // append to user agent
  9722. this.httpRequest.appendToUserAgent('callback');
  9723. this.on('complete', function (resp) {
  9724. callback.call(resp, resp.error, resp.data);
  9725. });
  9726. }
  9727. this.runTo();
  9728. return this.response;
  9729. },
  9730. /**
  9731. * @!method promise()
  9732. * Sends the request and returns a 'thenable' promise.
  9733. *
  9734. * Two callbacks can be provided to the `then` method on the returned promise.
  9735. * The first callback will be called if the promise is fulfilled, and the second
  9736. * callback will be called if the promise is rejected.
  9737. * @callback fulfilledCallback function(data)
  9738. * Called if the promise is fulfilled.
  9739. * @param data [Object] the de-serialized data returned from the request.
  9740. * @callback rejectedCallback function(error)
  9741. * Called if the promise is rejected.
  9742. * @param error [Error] the error object returned from the request.
  9743. * @return [Promise] A promise that represents the state of the request.
  9744. * @example Sending a request using promises.
  9745. * var request = s3.putObject({Bucket: 'bucket', Key: 'key'});
  9746. * var result = request.promise();
  9747. * result.then(function(data) { ... }, function(error) { ... });
  9748. */
  9749. /**
  9750. * @api private
  9751. */
  9752. build: function build(callback) {
  9753. return this.runTo('send', callback);
  9754. },
  9755. /**
  9756. * @api private
  9757. */
  9758. runTo: function runTo(state, done) {
  9759. this._asm.runTo(state, done, this);
  9760. return this;
  9761. },
  9762. /**
  9763. * Aborts a request, emitting the error and complete events.
  9764. *
  9765. * @!macro nobrowser
  9766. * @example Aborting a request after sending
  9767. * var params = {
  9768. * Bucket: 'bucket', Key: 'key',
  9769. * Body: Buffer.alloc(1024 * 1024 * 5) // 5MB payload
  9770. * };
  9771. * var request = s3.putObject(params);
  9772. * request.send(function (err, data) {
  9773. * if (err) console.log("Error:", err.code, err.message);
  9774. * else console.log(data);
  9775. * });
  9776. *
  9777. * // abort request in 1 second
  9778. * setTimeout(request.abort.bind(request), 1000);
  9779. *
  9780. * // prints "Error: RequestAbortedError Request aborted by user"
  9781. * @return [AWS.Request] the same request object, for chaining.
  9782. * @since v1.4.0
  9783. */
  9784. abort: function abort() {
  9785. this.removeAllListeners('validateResponse');
  9786. this.removeAllListeners('extractError');
  9787. this.on('validateResponse', function addAbortedError(resp) {
  9788. resp.error = AWS.util.error(new Error('Request aborted by user'), {
  9789. code: 'RequestAbortedError', retryable: false
  9790. });
  9791. });
  9792. if (this.httpRequest.stream && !this.httpRequest.stream.didCallback) { // abort HTTP stream
  9793. this.httpRequest.stream.abort();
  9794. if (this.httpRequest._abortCallback) {
  9795. this.httpRequest._abortCallback();
  9796. } else {
  9797. this.removeAllListeners('send'); // haven't sent yet, so let's not
  9798. }
  9799. }
  9800. return this;
  9801. },
  9802. /**
  9803. * Iterates over each page of results given a pageable request, calling
  9804. * the provided callback with each page of data. After all pages have been
  9805. * retrieved, the callback is called with `null` data.
  9806. *
  9807. * @note This operation can generate multiple requests to a service.
  9808. * @example Iterating over multiple pages of objects in an S3 bucket
  9809. * var pages = 1;
  9810. * s3.listObjects().eachPage(function(err, data) {
  9811. * if (err) return;
  9812. * console.log("Page", pages++);
  9813. * console.log(data);
  9814. * });
  9815. * @example Iterating over multiple pages with an asynchronous callback
  9816. * s3.listObjects(params).eachPage(function(err, data, done) {
  9817. * doSomethingAsyncAndOrExpensive(function() {
  9818. * // The next page of results isn't fetched until done is called
  9819. * done();
  9820. * });
  9821. * });
  9822. * @callback callback function(err, data, [doneCallback])
  9823. * Called with each page of resulting data from the request. If the
  9824. * optional `doneCallback` is provided in the function, it must be called
  9825. * when the callback is complete.
  9826. *
  9827. * @param err [Error] an error object, if an error occurred.
  9828. * @param data [Object] a single page of response data. If there is no
  9829. * more data, this object will be `null`.
  9830. * @param doneCallback [Function] an optional done callback. If this
  9831. * argument is defined in the function declaration, it should be called
  9832. * when the next page is ready to be retrieved. This is useful for
  9833. * controlling serial pagination across asynchronous operations.
  9834. * @return [Boolean] if the callback returns `false`, pagination will
  9835. * stop.
  9836. *
  9837. * @see AWS.Request.eachItem
  9838. * @see AWS.Response.nextPage
  9839. * @since v1.4.0
  9840. */
  9841. eachPage: function eachPage(callback) {
  9842. // Make all callbacks async-ish
  9843. callback = AWS.util.fn.makeAsync(callback, 3);
  9844. function wrappedCallback(response) {
  9845. callback.call(response, response.error, response.data, function (result) {
  9846. if (result === false) return;
  9847. if (response.hasNextPage()) {
  9848. response.nextPage().on('complete', wrappedCallback).send();
  9849. } else {
  9850. callback.call(response, null, null, AWS.util.fn.noop);
  9851. }
  9852. });
  9853. }
  9854. this.on('complete', wrappedCallback).send();
  9855. },
  9856. /**
  9857. * Enumerates over individual items of a request, paging the responses if
  9858. * necessary.
  9859. *
  9860. * @api experimental
  9861. * @since v1.4.0
  9862. */
  9863. eachItem: function eachItem(callback) {
  9864. var self = this;
  9865. function wrappedCallback(err, data) {
  9866. if (err) return callback(err, null);
  9867. if (data === null) return callback(null, null);
  9868. var config = self.service.paginationConfig(self.operation);
  9869. var resultKey = config.resultKey;
  9870. if (Array.isArray(resultKey)) resultKey = resultKey[0];
  9871. var items = jmespath.search(data, resultKey);
  9872. var continueIteration = true;
  9873. AWS.util.arrayEach(items, function(item) {
  9874. continueIteration = callback(null, item);
  9875. if (continueIteration === false) {
  9876. return AWS.util.abort;
  9877. }
  9878. });
  9879. return continueIteration;
  9880. }
  9881. this.eachPage(wrappedCallback);
  9882. },
  9883. /**
  9884. * @return [Boolean] whether the operation can return multiple pages of
  9885. * response data.
  9886. * @see AWS.Response.eachPage
  9887. * @since v1.4.0
  9888. */
  9889. isPageable: function isPageable() {
  9890. return this.service.paginationConfig(this.operation) ? true : false;
  9891. },
  9892. /**
  9893. * Sends the request and converts the request object into a readable stream
  9894. * that can be read from or piped into a writable stream.
  9895. *
  9896. * @note The data read from a readable stream contains only
  9897. * the raw HTTP body contents.
  9898. * @example Manually reading from a stream
  9899. * request.createReadStream().on('data', function(data) {
  9900. * console.log("Got data:", data.toString());
  9901. * });
  9902. * @example Piping a request body into a file
  9903. * var out = fs.createWriteStream('/path/to/outfile.jpg');
  9904. * s3.service.getObject(params).createReadStream().pipe(out);
  9905. * @return [Stream] the readable stream object that can be piped
  9906. * or read from (by registering 'data' event listeners).
  9907. * @!macro nobrowser
  9908. */
  9909. createReadStream: function createReadStream() {
  9910. var streams = AWS.util.stream;
  9911. var req = this;
  9912. var stream = null;
  9913. if (AWS.HttpClient.streamsApiVersion === 2) {
  9914. stream = new streams.PassThrough();
  9915. process.nextTick(function() { req.send(); });
  9916. } else {
  9917. stream = new streams.Stream();
  9918. stream.readable = true;
  9919. stream.sent = false;
  9920. stream.on('newListener', function(event) {
  9921. if (!stream.sent && event === 'data') {
  9922. stream.sent = true;
  9923. process.nextTick(function() { req.send(); });
  9924. }
  9925. });
  9926. }
  9927. this.on('error', function(err) {
  9928. stream.emit('error', err);
  9929. });
  9930. this.on('httpHeaders', function streamHeaders(statusCode, headers, resp) {
  9931. if (statusCode < 300) {
  9932. req.removeListener('httpData', AWS.EventListeners.Core.HTTP_DATA);
  9933. req.removeListener('httpError', AWS.EventListeners.Core.HTTP_ERROR);
  9934. req.on('httpError', function streamHttpError(error) {
  9935. resp.error = error;
  9936. resp.error.retryable = false;
  9937. });
  9938. var shouldCheckContentLength = false;
  9939. var expectedLen;
  9940. if (req.httpRequest.method !== 'HEAD') {
  9941. expectedLen = parseInt(headers['content-length'], 10);
  9942. }
  9943. if (expectedLen !== undefined && !isNaN(expectedLen) && expectedLen >= 0) {
  9944. shouldCheckContentLength = true;
  9945. var receivedLen = 0;
  9946. }
  9947. var checkContentLengthAndEmit = function checkContentLengthAndEmit() {
  9948. if (shouldCheckContentLength && receivedLen !== expectedLen) {
  9949. stream.emit('error', AWS.util.error(
  9950. new Error('Stream content length mismatch. Received ' +
  9951. receivedLen + ' of ' + expectedLen + ' bytes.'),
  9952. { code: 'StreamContentLengthMismatch' }
  9953. ));
  9954. } else if (AWS.HttpClient.streamsApiVersion === 2) {
  9955. stream.end();
  9956. } else {
  9957. stream.emit('end');
  9958. }
  9959. };
  9960. var httpStream = resp.httpResponse.createUnbufferedStream();
  9961. if (AWS.HttpClient.streamsApiVersion === 2) {
  9962. if (shouldCheckContentLength) {
  9963. var lengthAccumulator = new streams.PassThrough();
  9964. lengthAccumulator._write = function(chunk) {
  9965. if (chunk && chunk.length) {
  9966. receivedLen += chunk.length;
  9967. }
  9968. return streams.PassThrough.prototype._write.apply(this, arguments);
  9969. };
  9970. lengthAccumulator.on('end', checkContentLengthAndEmit);
  9971. stream.on('error', function(err) {
  9972. shouldCheckContentLength = false;
  9973. httpStream.unpipe(lengthAccumulator);
  9974. lengthAccumulator.emit('end');
  9975. lengthAccumulator.end();
  9976. });
  9977. httpStream.pipe(lengthAccumulator).pipe(stream, { end: false });
  9978. } else {
  9979. httpStream.pipe(stream);
  9980. }
  9981. } else {
  9982. if (shouldCheckContentLength) {
  9983. httpStream.on('data', function(arg) {
  9984. if (arg && arg.length) {
  9985. receivedLen += arg.length;
  9986. }
  9987. });
  9988. }
  9989. httpStream.on('data', function(arg) {
  9990. stream.emit('data', arg);
  9991. });
  9992. httpStream.on('end', checkContentLengthAndEmit);
  9993. }
  9994. httpStream.on('error', function(err) {
  9995. shouldCheckContentLength = false;
  9996. stream.emit('error', err);
  9997. });
  9998. }
  9999. });
  10000. return stream;
  10001. },
  10002. /**
  10003. * @param [Array,Response] args This should be the response object,
  10004. * or an array of args to send to the event.
  10005. * @api private
  10006. */
  10007. emitEvent: function emit(eventName, args, done) {
  10008. if (typeof args === 'function') { done = args; args = null; }
  10009. if (!done) done = function() { };
  10010. if (!args) args = this.eventParameters(eventName, this.response);
  10011. var origEmit = AWS.SequentialExecutor.prototype.emit;
  10012. origEmit.call(this, eventName, args, function (err) {
  10013. if (err) this.response.error = err;
  10014. done.call(this, err);
  10015. });
  10016. },
  10017. /**
  10018. * @api private
  10019. */
  10020. eventParameters: function eventParameters(eventName) {
  10021. switch (eventName) {
  10022. case 'restart':
  10023. case 'validate':
  10024. case 'sign':
  10025. case 'build':
  10026. case 'afterValidate':
  10027. case 'afterBuild':
  10028. return [this];
  10029. case 'error':
  10030. return [this.response.error, this.response];
  10031. default:
  10032. return [this.response];
  10033. }
  10034. },
  10035. /**
  10036. * @api private
  10037. */
  10038. presign: function presign(expires, callback) {
  10039. if (!callback && typeof expires === 'function') {
  10040. callback = expires;
  10041. expires = null;
  10042. }
  10043. return new AWS.Signers.Presign().sign(this.toGet(), expires, callback);
  10044. },
  10045. /**
  10046. * @api private
  10047. */
  10048. isPresigned: function isPresigned() {
  10049. return Object.prototype.hasOwnProperty.call(this.httpRequest.headers, 'presigned-expires');
  10050. },
  10051. /**
  10052. * @api private
  10053. */
  10054. toUnauthenticated: function toUnauthenticated() {
  10055. this._unAuthenticated = true;
  10056. this.removeListener('validate', AWS.EventListeners.Core.VALIDATE_CREDENTIALS);
  10057. this.removeListener('sign', AWS.EventListeners.Core.SIGN);
  10058. return this;
  10059. },
  10060. /**
  10061. * @api private
  10062. */
  10063. toGet: function toGet() {
  10064. if (this.service.api.protocol === 'query' ||
  10065. this.service.api.protocol === 'ec2') {
  10066. this.removeListener('build', this.buildAsGet);
  10067. this.addListener('build', this.buildAsGet);
  10068. }
  10069. return this;
  10070. },
  10071. /**
  10072. * @api private
  10073. */
  10074. buildAsGet: function buildAsGet(request) {
  10075. request.httpRequest.method = 'GET';
  10076. request.httpRequest.path = request.service.endpoint.path +
  10077. '?' + request.httpRequest.body;
  10078. request.httpRequest.body = '';
  10079. // don't need these headers on a GET request
  10080. delete request.httpRequest.headers['Content-Length'];
  10081. delete request.httpRequest.headers['Content-Type'];
  10082. },
  10083. /**
  10084. * @api private
  10085. */
  10086. haltHandlersOnError: function haltHandlersOnError() {
  10087. this._haltHandlersOnError = true;
  10088. }
  10089. });
  10090. /**
  10091. * @api private
  10092. */
  10093. AWS.Request.addPromisesToClass = function addPromisesToClass(PromiseDependency) {
  10094. this.prototype.promise = function promise() {
  10095. var self = this;
  10096. // append to user agent
  10097. this.httpRequest.appendToUserAgent('promise');
  10098. return new PromiseDependency(function(resolve, reject) {
  10099. self.on('complete', function(resp) {
  10100. if (resp.error) {
  10101. reject(resp.error);
  10102. } else {
  10103. // define $response property so that it is not enumerable
  10104. // this prevents circular reference errors when stringifying the JSON object
  10105. resolve(Object.defineProperty(
  10106. resp.data || {},
  10107. '$response',
  10108. {value: resp}
  10109. ));
  10110. }
  10111. });
  10112. self.runTo();
  10113. });
  10114. };
  10115. };
  10116. /**
  10117. * @api private
  10118. */
  10119. AWS.Request.deletePromisesFromClass = function deletePromisesFromClass() {
  10120. delete this.prototype.promise;
  10121. };
  10122. AWS.util.addPromises(AWS.Request);
  10123. AWS.util.mixin(AWS.Request, AWS.SequentialExecutor);
  10124. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  10125. /***/ }),
  10126. /* 87 */
  10127. /***/ (function(module, exports) {
  10128. function AcceptorStateMachine(states, state) {
  10129. this.currentState = state || null;
  10130. this.states = states || {};
  10131. }
  10132. AcceptorStateMachine.prototype.runTo = function runTo(finalState, done, bindObject, inputError) {
  10133. if (typeof finalState === 'function') {
  10134. inputError = bindObject; bindObject = done;
  10135. done = finalState; finalState = null;
  10136. }
  10137. var self = this;
  10138. var state = self.states[self.currentState];
  10139. state.fn.call(bindObject || self, inputError, function(err) {
  10140. if (err) {
  10141. if (state.fail) self.currentState = state.fail;
  10142. else return done ? done.call(bindObject, err) : null;
  10143. } else {
  10144. if (state.accept) self.currentState = state.accept;
  10145. else return done ? done.call(bindObject) : null;
  10146. }
  10147. if (self.currentState === finalState) {
  10148. return done ? done.call(bindObject, err) : null;
  10149. }
  10150. self.runTo(finalState, done, bindObject, err);
  10151. });
  10152. };
  10153. AcceptorStateMachine.prototype.addState = function addState(name, acceptState, failState, fn) {
  10154. if (typeof acceptState === 'function') {
  10155. fn = acceptState; acceptState = null; failState = null;
  10156. } else if (typeof failState === 'function') {
  10157. fn = failState; failState = null;
  10158. }
  10159. if (!this.currentState) this.currentState = name;
  10160. this.states[name] = { accept: acceptState, fail: failState, fn: fn };
  10161. return this;
  10162. };
  10163. /**
  10164. * @api private
  10165. */
  10166. module.exports = AcceptorStateMachine;
  10167. /***/ }),
  10168. /* 88 */
  10169. /***/ (function(module, exports, __webpack_require__) {
  10170. (function(exports) {
  10171. "use strict";
  10172. function isArray(obj) {
  10173. if (obj !== null) {
  10174. return Object.prototype.toString.call(obj) === "[object Array]";
  10175. } else {
  10176. return false;
  10177. }
  10178. }
  10179. function isObject(obj) {
  10180. if (obj !== null) {
  10181. return Object.prototype.toString.call(obj) === "[object Object]";
  10182. } else {
  10183. return false;
  10184. }
  10185. }
  10186. function strictDeepEqual(first, second) {
  10187. // Check the scalar case first.
  10188. if (first === second) {
  10189. return true;
  10190. }
  10191. // Check if they are the same type.
  10192. var firstType = Object.prototype.toString.call(first);
  10193. if (firstType !== Object.prototype.toString.call(second)) {
  10194. return false;
  10195. }
  10196. // We know that first and second have the same type so we can just check the
  10197. // first type from now on.
  10198. if (isArray(first) === true) {
  10199. // Short circuit if they're not the same length;
  10200. if (first.length !== second.length) {
  10201. return false;
  10202. }
  10203. for (var i = 0; i < first.length; i++) {
  10204. if (strictDeepEqual(first[i], second[i]) === false) {
  10205. return false;
  10206. }
  10207. }
  10208. return true;
  10209. }
  10210. if (isObject(first) === true) {
  10211. // An object is equal if it has the same key/value pairs.
  10212. var keysSeen = {};
  10213. for (var key in first) {
  10214. if (hasOwnProperty.call(first, key)) {
  10215. if (strictDeepEqual(first[key], second[key]) === false) {
  10216. return false;
  10217. }
  10218. keysSeen[key] = true;
  10219. }
  10220. }
  10221. // Now check that there aren't any keys in second that weren't
  10222. // in first.
  10223. for (var key2 in second) {
  10224. if (hasOwnProperty.call(second, key2)) {
  10225. if (keysSeen[key2] !== true) {
  10226. return false;
  10227. }
  10228. }
  10229. }
  10230. return true;
  10231. }
  10232. return false;
  10233. }
  10234. function isFalse(obj) {
  10235. // From the spec:
  10236. // A false value corresponds to the following values:
  10237. // Empty list
  10238. // Empty object
  10239. // Empty string
  10240. // False boolean
  10241. // null value
  10242. // First check the scalar values.
  10243. if (obj === "" || obj === false || obj === null) {
  10244. return true;
  10245. } else if (isArray(obj) && obj.length === 0) {
  10246. // Check for an empty array.
  10247. return true;
  10248. } else if (isObject(obj)) {
  10249. // Check for an empty object.
  10250. for (var key in obj) {
  10251. // If there are any keys, then
  10252. // the object is not empty so the object
  10253. // is not false.
  10254. if (obj.hasOwnProperty(key)) {
  10255. return false;
  10256. }
  10257. }
  10258. return true;
  10259. } else {
  10260. return false;
  10261. }
  10262. }
  10263. function objValues(obj) {
  10264. var keys = Object.keys(obj);
  10265. var values = [];
  10266. for (var i = 0; i < keys.length; i++) {
  10267. values.push(obj[keys[i]]);
  10268. }
  10269. return values;
  10270. }
  10271. function merge(a, b) {
  10272. var merged = {};
  10273. for (var key in a) {
  10274. merged[key] = a[key];
  10275. }
  10276. for (var key2 in b) {
  10277. merged[key2] = b[key2];
  10278. }
  10279. return merged;
  10280. }
  10281. var trimLeft;
  10282. if (typeof String.prototype.trimLeft === "function") {
  10283. trimLeft = function(str) {
  10284. return str.trimLeft();
  10285. };
  10286. } else {
  10287. trimLeft = function(str) {
  10288. return str.match(/^\s*(.*)/)[1];
  10289. };
  10290. }
  10291. // Type constants used to define functions.
  10292. var TYPE_NUMBER = 0;
  10293. var TYPE_ANY = 1;
  10294. var TYPE_STRING = 2;
  10295. var TYPE_ARRAY = 3;
  10296. var TYPE_OBJECT = 4;
  10297. var TYPE_BOOLEAN = 5;
  10298. var TYPE_EXPREF = 6;
  10299. var TYPE_NULL = 7;
  10300. var TYPE_ARRAY_NUMBER = 8;
  10301. var TYPE_ARRAY_STRING = 9;
  10302. var TYPE_NAME_TABLE = {
  10303. 0: 'number',
  10304. 1: 'any',
  10305. 2: 'string',
  10306. 3: 'array',
  10307. 4: 'object',
  10308. 5: 'boolean',
  10309. 6: 'expression',
  10310. 7: 'null',
  10311. 8: 'Array<number>',
  10312. 9: 'Array<string>'
  10313. };
  10314. var TOK_EOF = "EOF";
  10315. var TOK_UNQUOTEDIDENTIFIER = "UnquotedIdentifier";
  10316. var TOK_QUOTEDIDENTIFIER = "QuotedIdentifier";
  10317. var TOK_RBRACKET = "Rbracket";
  10318. var TOK_RPAREN = "Rparen";
  10319. var TOK_COMMA = "Comma";
  10320. var TOK_COLON = "Colon";
  10321. var TOK_RBRACE = "Rbrace";
  10322. var TOK_NUMBER = "Number";
  10323. var TOK_CURRENT = "Current";
  10324. var TOK_EXPREF = "Expref";
  10325. var TOK_PIPE = "Pipe";
  10326. var TOK_OR = "Or";
  10327. var TOK_AND = "And";
  10328. var TOK_EQ = "EQ";
  10329. var TOK_GT = "GT";
  10330. var TOK_LT = "LT";
  10331. var TOK_GTE = "GTE";
  10332. var TOK_LTE = "LTE";
  10333. var TOK_NE = "NE";
  10334. var TOK_FLATTEN = "Flatten";
  10335. var TOK_STAR = "Star";
  10336. var TOK_FILTER = "Filter";
  10337. var TOK_DOT = "Dot";
  10338. var TOK_NOT = "Not";
  10339. var TOK_LBRACE = "Lbrace";
  10340. var TOK_LBRACKET = "Lbracket";
  10341. var TOK_LPAREN= "Lparen";
  10342. var TOK_LITERAL= "Literal";
  10343. // The "&", "[", "<", ">" tokens
  10344. // are not in basicToken because
  10345. // there are two token variants
  10346. // ("&&", "[?", "<=", ">="). This is specially handled
  10347. // below.
  10348. var basicTokens = {
  10349. ".": TOK_DOT,
  10350. "*": TOK_STAR,
  10351. ",": TOK_COMMA,
  10352. ":": TOK_COLON,
  10353. "{": TOK_LBRACE,
  10354. "}": TOK_RBRACE,
  10355. "]": TOK_RBRACKET,
  10356. "(": TOK_LPAREN,
  10357. ")": TOK_RPAREN,
  10358. "@": TOK_CURRENT
  10359. };
  10360. var operatorStartToken = {
  10361. "<": true,
  10362. ">": true,
  10363. "=": true,
  10364. "!": true
  10365. };
  10366. var skipChars = {
  10367. " ": true,
  10368. "\t": true,
  10369. "\n": true
  10370. };
  10371. function isAlpha(ch) {
  10372. return (ch >= "a" && ch <= "z") ||
  10373. (ch >= "A" && ch <= "Z") ||
  10374. ch === "_";
  10375. }
  10376. function isNum(ch) {
  10377. return (ch >= "0" && ch <= "9") ||
  10378. ch === "-";
  10379. }
  10380. function isAlphaNum(ch) {
  10381. return (ch >= "a" && ch <= "z") ||
  10382. (ch >= "A" && ch <= "Z") ||
  10383. (ch >= "0" && ch <= "9") ||
  10384. ch === "_";
  10385. }
  10386. function Lexer() {
  10387. }
  10388. Lexer.prototype = {
  10389. tokenize: function(stream) {
  10390. var tokens = [];
  10391. this._current = 0;
  10392. var start;
  10393. var identifier;
  10394. var token;
  10395. while (this._current < stream.length) {
  10396. if (isAlpha(stream[this._current])) {
  10397. start = this._current;
  10398. identifier = this._consumeUnquotedIdentifier(stream);
  10399. tokens.push({type: TOK_UNQUOTEDIDENTIFIER,
  10400. value: identifier,
  10401. start: start});
  10402. } else if (basicTokens[stream[this._current]] !== undefined) {
  10403. tokens.push({type: basicTokens[stream[this._current]],
  10404. value: stream[this._current],
  10405. start: this._current});
  10406. this._current++;
  10407. } else if (isNum(stream[this._current])) {
  10408. token = this._consumeNumber(stream);
  10409. tokens.push(token);
  10410. } else if (stream[this._current] === "[") {
  10411. // No need to increment this._current. This happens
  10412. // in _consumeLBracket
  10413. token = this._consumeLBracket(stream);
  10414. tokens.push(token);
  10415. } else if (stream[this._current] === "\"") {
  10416. start = this._current;
  10417. identifier = this._consumeQuotedIdentifier(stream);
  10418. tokens.push({type: TOK_QUOTEDIDENTIFIER,
  10419. value: identifier,
  10420. start: start});
  10421. } else if (stream[this._current] === "'") {
  10422. start = this._current;
  10423. identifier = this._consumeRawStringLiteral(stream);
  10424. tokens.push({type: TOK_LITERAL,
  10425. value: identifier,
  10426. start: start});
  10427. } else if (stream[this._current] === "`") {
  10428. start = this._current;
  10429. var literal = this._consumeLiteral(stream);
  10430. tokens.push({type: TOK_LITERAL,
  10431. value: literal,
  10432. start: start});
  10433. } else if (operatorStartToken[stream[this._current]] !== undefined) {
  10434. tokens.push(this._consumeOperator(stream));
  10435. } else if (skipChars[stream[this._current]] !== undefined) {
  10436. // Ignore whitespace.
  10437. this._current++;
  10438. } else if (stream[this._current] === "&") {
  10439. start = this._current;
  10440. this._current++;
  10441. if (stream[this._current] === "&") {
  10442. this._current++;
  10443. tokens.push({type: TOK_AND, value: "&&", start: start});
  10444. } else {
  10445. tokens.push({type: TOK_EXPREF, value: "&", start: start});
  10446. }
  10447. } else if (stream[this._current] === "|") {
  10448. start = this._current;
  10449. this._current++;
  10450. if (stream[this._current] === "|") {
  10451. this._current++;
  10452. tokens.push({type: TOK_OR, value: "||", start: start});
  10453. } else {
  10454. tokens.push({type: TOK_PIPE, value: "|", start: start});
  10455. }
  10456. } else {
  10457. var error = new Error("Unknown character:" + stream[this._current]);
  10458. error.name = "LexerError";
  10459. throw error;
  10460. }
  10461. }
  10462. return tokens;
  10463. },
  10464. _consumeUnquotedIdentifier: function(stream) {
  10465. var start = this._current;
  10466. this._current++;
  10467. while (this._current < stream.length && isAlphaNum(stream[this._current])) {
  10468. this._current++;
  10469. }
  10470. return stream.slice(start, this._current);
  10471. },
  10472. _consumeQuotedIdentifier: function(stream) {
  10473. var start = this._current;
  10474. this._current++;
  10475. var maxLength = stream.length;
  10476. while (stream[this._current] !== "\"" && this._current < maxLength) {
  10477. // You can escape a double quote and you can escape an escape.
  10478. var current = this._current;
  10479. if (stream[current] === "\\" && (stream[current + 1] === "\\" ||
  10480. stream[current + 1] === "\"")) {
  10481. current += 2;
  10482. } else {
  10483. current++;
  10484. }
  10485. this._current = current;
  10486. }
  10487. this._current++;
  10488. return JSON.parse(stream.slice(start, this._current));
  10489. },
  10490. _consumeRawStringLiteral: function(stream) {
  10491. var start = this._current;
  10492. this._current++;
  10493. var maxLength = stream.length;
  10494. while (stream[this._current] !== "'" && this._current < maxLength) {
  10495. // You can escape a single quote and you can escape an escape.
  10496. var current = this._current;
  10497. if (stream[current] === "\\" && (stream[current + 1] === "\\" ||
  10498. stream[current + 1] === "'")) {
  10499. current += 2;
  10500. } else {
  10501. current++;
  10502. }
  10503. this._current = current;
  10504. }
  10505. this._current++;
  10506. var literal = stream.slice(start + 1, this._current - 1);
  10507. return literal.replace("\\'", "'");
  10508. },
  10509. _consumeNumber: function(stream) {
  10510. var start = this._current;
  10511. this._current++;
  10512. var maxLength = stream.length;
  10513. while (isNum(stream[this._current]) && this._current < maxLength) {
  10514. this._current++;
  10515. }
  10516. var value = parseInt(stream.slice(start, this._current));
  10517. return {type: TOK_NUMBER, value: value, start: start};
  10518. },
  10519. _consumeLBracket: function(stream) {
  10520. var start = this._current;
  10521. this._current++;
  10522. if (stream[this._current] === "?") {
  10523. this._current++;
  10524. return {type: TOK_FILTER, value: "[?", start: start};
  10525. } else if (stream[this._current] === "]") {
  10526. this._current++;
  10527. return {type: TOK_FLATTEN, value: "[]", start: start};
  10528. } else {
  10529. return {type: TOK_LBRACKET, value: "[", start: start};
  10530. }
  10531. },
  10532. _consumeOperator: function(stream) {
  10533. var start = this._current;
  10534. var startingChar = stream[start];
  10535. this._current++;
  10536. if (startingChar === "!") {
  10537. if (stream[this._current] === "=") {
  10538. this._current++;
  10539. return {type: TOK_NE, value: "!=", start: start};
  10540. } else {
  10541. return {type: TOK_NOT, value: "!", start: start};
  10542. }
  10543. } else if (startingChar === "<") {
  10544. if (stream[this._current] === "=") {
  10545. this._current++;
  10546. return {type: TOK_LTE, value: "<=", start: start};
  10547. } else {
  10548. return {type: TOK_LT, value: "<", start: start};
  10549. }
  10550. } else if (startingChar === ">") {
  10551. if (stream[this._current] === "=") {
  10552. this._current++;
  10553. return {type: TOK_GTE, value: ">=", start: start};
  10554. } else {
  10555. return {type: TOK_GT, value: ">", start: start};
  10556. }
  10557. } else if (startingChar === "=") {
  10558. if (stream[this._current] === "=") {
  10559. this._current++;
  10560. return {type: TOK_EQ, value: "==", start: start};
  10561. }
  10562. }
  10563. },
  10564. _consumeLiteral: function(stream) {
  10565. this._current++;
  10566. var start = this._current;
  10567. var maxLength = stream.length;
  10568. var literal;
  10569. while(stream[this._current] !== "`" && this._current < maxLength) {
  10570. // You can escape a literal char or you can escape the escape.
  10571. var current = this._current;
  10572. if (stream[current] === "\\" && (stream[current + 1] === "\\" ||
  10573. stream[current + 1] === "`")) {
  10574. current += 2;
  10575. } else {
  10576. current++;
  10577. }
  10578. this._current = current;
  10579. }
  10580. var literalString = trimLeft(stream.slice(start, this._current));
  10581. literalString = literalString.replace("\\`", "`");
  10582. if (this._looksLikeJSON(literalString)) {
  10583. literal = JSON.parse(literalString);
  10584. } else {
  10585. // Try to JSON parse it as "<literal>"
  10586. literal = JSON.parse("\"" + literalString + "\"");
  10587. }
  10588. // +1 gets us to the ending "`", +1 to move on to the next char.
  10589. this._current++;
  10590. return literal;
  10591. },
  10592. _looksLikeJSON: function(literalString) {
  10593. var startingChars = "[{\"";
  10594. var jsonLiterals = ["true", "false", "null"];
  10595. var numberLooking = "-0123456789";
  10596. if (literalString === "") {
  10597. return false;
  10598. } else if (startingChars.indexOf(literalString[0]) >= 0) {
  10599. return true;
  10600. } else if (jsonLiterals.indexOf(literalString) >= 0) {
  10601. return true;
  10602. } else if (numberLooking.indexOf(literalString[0]) >= 0) {
  10603. try {
  10604. JSON.parse(literalString);
  10605. return true;
  10606. } catch (ex) {
  10607. return false;
  10608. }
  10609. } else {
  10610. return false;
  10611. }
  10612. }
  10613. };
  10614. var bindingPower = {};
  10615. bindingPower[TOK_EOF] = 0;
  10616. bindingPower[TOK_UNQUOTEDIDENTIFIER] = 0;
  10617. bindingPower[TOK_QUOTEDIDENTIFIER] = 0;
  10618. bindingPower[TOK_RBRACKET] = 0;
  10619. bindingPower[TOK_RPAREN] = 0;
  10620. bindingPower[TOK_COMMA] = 0;
  10621. bindingPower[TOK_RBRACE] = 0;
  10622. bindingPower[TOK_NUMBER] = 0;
  10623. bindingPower[TOK_CURRENT] = 0;
  10624. bindingPower[TOK_EXPREF] = 0;
  10625. bindingPower[TOK_PIPE] = 1;
  10626. bindingPower[TOK_OR] = 2;
  10627. bindingPower[TOK_AND] = 3;
  10628. bindingPower[TOK_EQ] = 5;
  10629. bindingPower[TOK_GT] = 5;
  10630. bindingPower[TOK_LT] = 5;
  10631. bindingPower[TOK_GTE] = 5;
  10632. bindingPower[TOK_LTE] = 5;
  10633. bindingPower[TOK_NE] = 5;
  10634. bindingPower[TOK_FLATTEN] = 9;
  10635. bindingPower[TOK_STAR] = 20;
  10636. bindingPower[TOK_FILTER] = 21;
  10637. bindingPower[TOK_DOT] = 40;
  10638. bindingPower[TOK_NOT] = 45;
  10639. bindingPower[TOK_LBRACE] = 50;
  10640. bindingPower[TOK_LBRACKET] = 55;
  10641. bindingPower[TOK_LPAREN] = 60;
  10642. function Parser() {
  10643. }
  10644. Parser.prototype = {
  10645. parse: function(expression) {
  10646. this._loadTokens(expression);
  10647. this.index = 0;
  10648. var ast = this.expression(0);
  10649. if (this._lookahead(0) !== TOK_EOF) {
  10650. var t = this._lookaheadToken(0);
  10651. var error = new Error(
  10652. "Unexpected token type: " + t.type + ", value: " + t.value);
  10653. error.name = "ParserError";
  10654. throw error;
  10655. }
  10656. return ast;
  10657. },
  10658. _loadTokens: function(expression) {
  10659. var lexer = new Lexer();
  10660. var tokens = lexer.tokenize(expression);
  10661. tokens.push({type: TOK_EOF, value: "", start: expression.length});
  10662. this.tokens = tokens;
  10663. },
  10664. expression: function(rbp) {
  10665. var leftToken = this._lookaheadToken(0);
  10666. this._advance();
  10667. var left = this.nud(leftToken);
  10668. var currentToken = this._lookahead(0);
  10669. while (rbp < bindingPower[currentToken]) {
  10670. this._advance();
  10671. left = this.led(currentToken, left);
  10672. currentToken = this._lookahead(0);
  10673. }
  10674. return left;
  10675. },
  10676. _lookahead: function(number) {
  10677. return this.tokens[this.index + number].type;
  10678. },
  10679. _lookaheadToken: function(number) {
  10680. return this.tokens[this.index + number];
  10681. },
  10682. _advance: function() {
  10683. this.index++;
  10684. },
  10685. nud: function(token) {
  10686. var left;
  10687. var right;
  10688. var expression;
  10689. switch (token.type) {
  10690. case TOK_LITERAL:
  10691. return {type: "Literal", value: token.value};
  10692. case TOK_UNQUOTEDIDENTIFIER:
  10693. return {type: "Field", name: token.value};
  10694. case TOK_QUOTEDIDENTIFIER:
  10695. var node = {type: "Field", name: token.value};
  10696. if (this._lookahead(0) === TOK_LPAREN) {
  10697. throw new Error("Quoted identifier not allowed for function names.");
  10698. }
  10699. return node;
  10700. case TOK_NOT:
  10701. right = this.expression(bindingPower.Not);
  10702. return {type: "NotExpression", children: [right]};
  10703. case TOK_STAR:
  10704. left = {type: "Identity"};
  10705. right = null;
  10706. if (this._lookahead(0) === TOK_RBRACKET) {
  10707. // This can happen in a multiselect,
  10708. // [a, b, *]
  10709. right = {type: "Identity"};
  10710. } else {
  10711. right = this._parseProjectionRHS(bindingPower.Star);
  10712. }
  10713. return {type: "ValueProjection", children: [left, right]};
  10714. case TOK_FILTER:
  10715. return this.led(token.type, {type: "Identity"});
  10716. case TOK_LBRACE:
  10717. return this._parseMultiselectHash();
  10718. case TOK_FLATTEN:
  10719. left = {type: TOK_FLATTEN, children: [{type: "Identity"}]};
  10720. right = this._parseProjectionRHS(bindingPower.Flatten);
  10721. return {type: "Projection", children: [left, right]};
  10722. case TOK_LBRACKET:
  10723. if (this._lookahead(0) === TOK_NUMBER || this._lookahead(0) === TOK_COLON) {
  10724. right = this._parseIndexExpression();
  10725. return this._projectIfSlice({type: "Identity"}, right);
  10726. } else if (this._lookahead(0) === TOK_STAR &&
  10727. this._lookahead(1) === TOK_RBRACKET) {
  10728. this._advance();
  10729. this._advance();
  10730. right = this._parseProjectionRHS(bindingPower.Star);
  10731. return {type: "Projection",
  10732. children: [{type: "Identity"}, right]};
  10733. }
  10734. return this._parseMultiselectList();
  10735. case TOK_CURRENT:
  10736. return {type: TOK_CURRENT};
  10737. case TOK_EXPREF:
  10738. expression = this.expression(bindingPower.Expref);
  10739. return {type: "ExpressionReference", children: [expression]};
  10740. case TOK_LPAREN:
  10741. var args = [];
  10742. while (this._lookahead(0) !== TOK_RPAREN) {
  10743. if (this._lookahead(0) === TOK_CURRENT) {
  10744. expression = {type: TOK_CURRENT};
  10745. this._advance();
  10746. } else {
  10747. expression = this.expression(0);
  10748. }
  10749. args.push(expression);
  10750. }
  10751. this._match(TOK_RPAREN);
  10752. return args[0];
  10753. default:
  10754. this._errorToken(token);
  10755. }
  10756. },
  10757. led: function(tokenName, left) {
  10758. var right;
  10759. switch(tokenName) {
  10760. case TOK_DOT:
  10761. var rbp = bindingPower.Dot;
  10762. if (this._lookahead(0) !== TOK_STAR) {
  10763. right = this._parseDotRHS(rbp);
  10764. return {type: "Subexpression", children: [left, right]};
  10765. }
  10766. // Creating a projection.
  10767. this._advance();
  10768. right = this._parseProjectionRHS(rbp);
  10769. return {type: "ValueProjection", children: [left, right]};
  10770. case TOK_PIPE:
  10771. right = this.expression(bindingPower.Pipe);
  10772. return {type: TOK_PIPE, children: [left, right]};
  10773. case TOK_OR:
  10774. right = this.expression(bindingPower.Or);
  10775. return {type: "OrExpression", children: [left, right]};
  10776. case TOK_AND:
  10777. right = this.expression(bindingPower.And);
  10778. return {type: "AndExpression", children: [left, right]};
  10779. case TOK_LPAREN:
  10780. var name = left.name;
  10781. var args = [];
  10782. var expression, node;
  10783. while (this._lookahead(0) !== TOK_RPAREN) {
  10784. if (this._lookahead(0) === TOK_CURRENT) {
  10785. expression = {type: TOK_CURRENT};
  10786. this._advance();
  10787. } else {
  10788. expression = this.expression(0);
  10789. }
  10790. if (this._lookahead(0) === TOK_COMMA) {
  10791. this._match(TOK_COMMA);
  10792. }
  10793. args.push(expression);
  10794. }
  10795. this._match(TOK_RPAREN);
  10796. node = {type: "Function", name: name, children: args};
  10797. return node;
  10798. case TOK_FILTER:
  10799. var condition = this.expression(0);
  10800. this._match(TOK_RBRACKET);
  10801. if (this._lookahead(0) === TOK_FLATTEN) {
  10802. right = {type: "Identity"};
  10803. } else {
  10804. right = this._parseProjectionRHS(bindingPower.Filter);
  10805. }
  10806. return {type: "FilterProjection", children: [left, right, condition]};
  10807. case TOK_FLATTEN:
  10808. var leftNode = {type: TOK_FLATTEN, children: [left]};
  10809. var rightNode = this._parseProjectionRHS(bindingPower.Flatten);
  10810. return {type: "Projection", children: [leftNode, rightNode]};
  10811. case TOK_EQ:
  10812. case TOK_NE:
  10813. case TOK_GT:
  10814. case TOK_GTE:
  10815. case TOK_LT:
  10816. case TOK_LTE:
  10817. return this._parseComparator(left, tokenName);
  10818. case TOK_LBRACKET:
  10819. var token = this._lookaheadToken(0);
  10820. if (token.type === TOK_NUMBER || token.type === TOK_COLON) {
  10821. right = this._parseIndexExpression();
  10822. return this._projectIfSlice(left, right);
  10823. }
  10824. this._match(TOK_STAR);
  10825. this._match(TOK_RBRACKET);
  10826. right = this._parseProjectionRHS(bindingPower.Star);
  10827. return {type: "Projection", children: [left, right]};
  10828. default:
  10829. this._errorToken(this._lookaheadToken(0));
  10830. }
  10831. },
  10832. _match: function(tokenType) {
  10833. if (this._lookahead(0) === tokenType) {
  10834. this._advance();
  10835. } else {
  10836. var t = this._lookaheadToken(0);
  10837. var error = new Error("Expected " + tokenType + ", got: " + t.type);
  10838. error.name = "ParserError";
  10839. throw error;
  10840. }
  10841. },
  10842. _errorToken: function(token) {
  10843. var error = new Error("Invalid token (" +
  10844. token.type + "): \"" +
  10845. token.value + "\"");
  10846. error.name = "ParserError";
  10847. throw error;
  10848. },
  10849. _parseIndexExpression: function() {
  10850. if (this._lookahead(0) === TOK_COLON || this._lookahead(1) === TOK_COLON) {
  10851. return this._parseSliceExpression();
  10852. } else {
  10853. var node = {
  10854. type: "Index",
  10855. value: this._lookaheadToken(0).value};
  10856. this._advance();
  10857. this._match(TOK_RBRACKET);
  10858. return node;
  10859. }
  10860. },
  10861. _projectIfSlice: function(left, right) {
  10862. var indexExpr = {type: "IndexExpression", children: [left, right]};
  10863. if (right.type === "Slice") {
  10864. return {
  10865. type: "Projection",
  10866. children: [indexExpr, this._parseProjectionRHS(bindingPower.Star)]
  10867. };
  10868. } else {
  10869. return indexExpr;
  10870. }
  10871. },
  10872. _parseSliceExpression: function() {
  10873. // [start:end:step] where each part is optional, as well as the last
  10874. // colon.
  10875. var parts = [null, null, null];
  10876. var index = 0;
  10877. var currentToken = this._lookahead(0);
  10878. while (currentToken !== TOK_RBRACKET && index < 3) {
  10879. if (currentToken === TOK_COLON) {
  10880. index++;
  10881. this._advance();
  10882. } else if (currentToken === TOK_NUMBER) {
  10883. parts[index] = this._lookaheadToken(0).value;
  10884. this._advance();
  10885. } else {
  10886. var t = this._lookahead(0);
  10887. var error = new Error("Syntax error, unexpected token: " +
  10888. t.value + "(" + t.type + ")");
  10889. error.name = "Parsererror";
  10890. throw error;
  10891. }
  10892. currentToken = this._lookahead(0);
  10893. }
  10894. this._match(TOK_RBRACKET);
  10895. return {
  10896. type: "Slice",
  10897. children: parts
  10898. };
  10899. },
  10900. _parseComparator: function(left, comparator) {
  10901. var right = this.expression(bindingPower[comparator]);
  10902. return {type: "Comparator", name: comparator, children: [left, right]};
  10903. },
  10904. _parseDotRHS: function(rbp) {
  10905. var lookahead = this._lookahead(0);
  10906. var exprTokens = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER, TOK_STAR];
  10907. if (exprTokens.indexOf(lookahead) >= 0) {
  10908. return this.expression(rbp);
  10909. } else if (lookahead === TOK_LBRACKET) {
  10910. this._match(TOK_LBRACKET);
  10911. return this._parseMultiselectList();
  10912. } else if (lookahead === TOK_LBRACE) {
  10913. this._match(TOK_LBRACE);
  10914. return this._parseMultiselectHash();
  10915. }
  10916. },
  10917. _parseProjectionRHS: function(rbp) {
  10918. var right;
  10919. if (bindingPower[this._lookahead(0)] < 10) {
  10920. right = {type: "Identity"};
  10921. } else if (this._lookahead(0) === TOK_LBRACKET) {
  10922. right = this.expression(rbp);
  10923. } else if (this._lookahead(0) === TOK_FILTER) {
  10924. right = this.expression(rbp);
  10925. } else if (this._lookahead(0) === TOK_DOT) {
  10926. this._match(TOK_DOT);
  10927. right = this._parseDotRHS(rbp);
  10928. } else {
  10929. var t = this._lookaheadToken(0);
  10930. var error = new Error("Sytanx error, unexpected token: " +
  10931. t.value + "(" + t.type + ")");
  10932. error.name = "ParserError";
  10933. throw error;
  10934. }
  10935. return right;
  10936. },
  10937. _parseMultiselectList: function() {
  10938. var expressions = [];
  10939. while (this._lookahead(0) !== TOK_RBRACKET) {
  10940. var expression = this.expression(0);
  10941. expressions.push(expression);
  10942. if (this._lookahead(0) === TOK_COMMA) {
  10943. this._match(TOK_COMMA);
  10944. if (this._lookahead(0) === TOK_RBRACKET) {
  10945. throw new Error("Unexpected token Rbracket");
  10946. }
  10947. }
  10948. }
  10949. this._match(TOK_RBRACKET);
  10950. return {type: "MultiSelectList", children: expressions};
  10951. },
  10952. _parseMultiselectHash: function() {
  10953. var pairs = [];
  10954. var identifierTypes = [TOK_UNQUOTEDIDENTIFIER, TOK_QUOTEDIDENTIFIER];
  10955. var keyToken, keyName, value, node;
  10956. for (;;) {
  10957. keyToken = this._lookaheadToken(0);
  10958. if (identifierTypes.indexOf(keyToken.type) < 0) {
  10959. throw new Error("Expecting an identifier token, got: " +
  10960. keyToken.type);
  10961. }
  10962. keyName = keyToken.value;
  10963. this._advance();
  10964. this._match(TOK_COLON);
  10965. value = this.expression(0);
  10966. node = {type: "KeyValuePair", name: keyName, value: value};
  10967. pairs.push(node);
  10968. if (this._lookahead(0) === TOK_COMMA) {
  10969. this._match(TOK_COMMA);
  10970. } else if (this._lookahead(0) === TOK_RBRACE) {
  10971. this._match(TOK_RBRACE);
  10972. break;
  10973. }
  10974. }
  10975. return {type: "MultiSelectHash", children: pairs};
  10976. }
  10977. };
  10978. function TreeInterpreter(runtime) {
  10979. this.runtime = runtime;
  10980. }
  10981. TreeInterpreter.prototype = {
  10982. search: function(node, value) {
  10983. return this.visit(node, value);
  10984. },
  10985. visit: function(node, value) {
  10986. var matched, current, result, first, second, field, left, right, collected, i;
  10987. switch (node.type) {
  10988. case "Field":
  10989. if (value !== null && isObject(value)) {
  10990. field = value[node.name];
  10991. if (field === undefined) {
  10992. return null;
  10993. } else {
  10994. return field;
  10995. }
  10996. }
  10997. return null;
  10998. case "Subexpression":
  10999. result = this.visit(node.children[0], value);
  11000. for (i = 1; i < node.children.length; i++) {
  11001. result = this.visit(node.children[1], result);
  11002. if (result === null) {
  11003. return null;
  11004. }
  11005. }
  11006. return result;
  11007. case "IndexExpression":
  11008. left = this.visit(node.children[0], value);
  11009. right = this.visit(node.children[1], left);
  11010. return right;
  11011. case "Index":
  11012. if (!isArray(value)) {
  11013. return null;
  11014. }
  11015. var index = node.value;
  11016. if (index < 0) {
  11017. index = value.length + index;
  11018. }
  11019. result = value[index];
  11020. if (result === undefined) {
  11021. result = null;
  11022. }
  11023. return result;
  11024. case "Slice":
  11025. if (!isArray(value)) {
  11026. return null;
  11027. }
  11028. var sliceParams = node.children.slice(0);
  11029. var computed = this.computeSliceParams(value.length, sliceParams);
  11030. var start = computed[0];
  11031. var stop = computed[1];
  11032. var step = computed[2];
  11033. result = [];
  11034. if (step > 0) {
  11035. for (i = start; i < stop; i += step) {
  11036. result.push(value[i]);
  11037. }
  11038. } else {
  11039. for (i = start; i > stop; i += step) {
  11040. result.push(value[i]);
  11041. }
  11042. }
  11043. return result;
  11044. case "Projection":
  11045. // Evaluate left child.
  11046. var base = this.visit(node.children[0], value);
  11047. if (!isArray(base)) {
  11048. return null;
  11049. }
  11050. collected = [];
  11051. for (i = 0; i < base.length; i++) {
  11052. current = this.visit(node.children[1], base[i]);
  11053. if (current !== null) {
  11054. collected.push(current);
  11055. }
  11056. }
  11057. return collected;
  11058. case "ValueProjection":
  11059. // Evaluate left child.
  11060. base = this.visit(node.children[0], value);
  11061. if (!isObject(base)) {
  11062. return null;
  11063. }
  11064. collected = [];
  11065. var values = objValues(base);
  11066. for (i = 0; i < values.length; i++) {
  11067. current = this.visit(node.children[1], values[i]);
  11068. if (current !== null) {
  11069. collected.push(current);
  11070. }
  11071. }
  11072. return collected;
  11073. case "FilterProjection":
  11074. base = this.visit(node.children[0], value);
  11075. if (!isArray(base)) {
  11076. return null;
  11077. }
  11078. var filtered = [];
  11079. var finalResults = [];
  11080. for (i = 0; i < base.length; i++) {
  11081. matched = this.visit(node.children[2], base[i]);
  11082. if (!isFalse(matched)) {
  11083. filtered.push(base[i]);
  11084. }
  11085. }
  11086. for (var j = 0; j < filtered.length; j++) {
  11087. current = this.visit(node.children[1], filtered[j]);
  11088. if (current !== null) {
  11089. finalResults.push(current);
  11090. }
  11091. }
  11092. return finalResults;
  11093. case "Comparator":
  11094. first = this.visit(node.children[0], value);
  11095. second = this.visit(node.children[1], value);
  11096. switch(node.name) {
  11097. case TOK_EQ:
  11098. result = strictDeepEqual(first, second);
  11099. break;
  11100. case TOK_NE:
  11101. result = !strictDeepEqual(first, second);
  11102. break;
  11103. case TOK_GT:
  11104. result = first > second;
  11105. break;
  11106. case TOK_GTE:
  11107. result = first >= second;
  11108. break;
  11109. case TOK_LT:
  11110. result = first < second;
  11111. break;
  11112. case TOK_LTE:
  11113. result = first <= second;
  11114. break;
  11115. default:
  11116. throw new Error("Unknown comparator: " + node.name);
  11117. }
  11118. return result;
  11119. case TOK_FLATTEN:
  11120. var original = this.visit(node.children[0], value);
  11121. if (!isArray(original)) {
  11122. return null;
  11123. }
  11124. var merged = [];
  11125. for (i = 0; i < original.length; i++) {
  11126. current = original[i];
  11127. if (isArray(current)) {
  11128. merged.push.apply(merged, current);
  11129. } else {
  11130. merged.push(current);
  11131. }
  11132. }
  11133. return merged;
  11134. case "Identity":
  11135. return value;
  11136. case "MultiSelectList":
  11137. if (value === null) {
  11138. return null;
  11139. }
  11140. collected = [];
  11141. for (i = 0; i < node.children.length; i++) {
  11142. collected.push(this.visit(node.children[i], value));
  11143. }
  11144. return collected;
  11145. case "MultiSelectHash":
  11146. if (value === null) {
  11147. return null;
  11148. }
  11149. collected = {};
  11150. var child;
  11151. for (i = 0; i < node.children.length; i++) {
  11152. child = node.children[i];
  11153. collected[child.name] = this.visit(child.value, value);
  11154. }
  11155. return collected;
  11156. case "OrExpression":
  11157. matched = this.visit(node.children[0], value);
  11158. if (isFalse(matched)) {
  11159. matched = this.visit(node.children[1], value);
  11160. }
  11161. return matched;
  11162. case "AndExpression":
  11163. first = this.visit(node.children[0], value);
  11164. if (isFalse(first) === true) {
  11165. return first;
  11166. }
  11167. return this.visit(node.children[1], value);
  11168. case "NotExpression":
  11169. first = this.visit(node.children[0], value);
  11170. return isFalse(first);
  11171. case "Literal":
  11172. return node.value;
  11173. case TOK_PIPE:
  11174. left = this.visit(node.children[0], value);
  11175. return this.visit(node.children[1], left);
  11176. case TOK_CURRENT:
  11177. return value;
  11178. case "Function":
  11179. var resolvedArgs = [];
  11180. for (i = 0; i < node.children.length; i++) {
  11181. resolvedArgs.push(this.visit(node.children[i], value));
  11182. }
  11183. return this.runtime.callFunction(node.name, resolvedArgs);
  11184. case "ExpressionReference":
  11185. var refNode = node.children[0];
  11186. // Tag the node with a specific attribute so the type
  11187. // checker verify the type.
  11188. refNode.jmespathType = TOK_EXPREF;
  11189. return refNode;
  11190. default:
  11191. throw new Error("Unknown node type: " + node.type);
  11192. }
  11193. },
  11194. computeSliceParams: function(arrayLength, sliceParams) {
  11195. var start = sliceParams[0];
  11196. var stop = sliceParams[1];
  11197. var step = sliceParams[2];
  11198. var computed = [null, null, null];
  11199. if (step === null) {
  11200. step = 1;
  11201. } else if (step === 0) {
  11202. var error = new Error("Invalid slice, step cannot be 0");
  11203. error.name = "RuntimeError";
  11204. throw error;
  11205. }
  11206. var stepValueNegative = step < 0 ? true : false;
  11207. if (start === null) {
  11208. start = stepValueNegative ? arrayLength - 1 : 0;
  11209. } else {
  11210. start = this.capSliceRange(arrayLength, start, step);
  11211. }
  11212. if (stop === null) {
  11213. stop = stepValueNegative ? -1 : arrayLength;
  11214. } else {
  11215. stop = this.capSliceRange(arrayLength, stop, step);
  11216. }
  11217. computed[0] = start;
  11218. computed[1] = stop;
  11219. computed[2] = step;
  11220. return computed;
  11221. },
  11222. capSliceRange: function(arrayLength, actualValue, step) {
  11223. if (actualValue < 0) {
  11224. actualValue += arrayLength;
  11225. if (actualValue < 0) {
  11226. actualValue = step < 0 ? -1 : 0;
  11227. }
  11228. } else if (actualValue >= arrayLength) {
  11229. actualValue = step < 0 ? arrayLength - 1 : arrayLength;
  11230. }
  11231. return actualValue;
  11232. }
  11233. };
  11234. function Runtime(interpreter) {
  11235. this._interpreter = interpreter;
  11236. this.functionTable = {
  11237. // name: [function, <signature>]
  11238. // The <signature> can be:
  11239. //
  11240. // {
  11241. // args: [[type1, type2], [type1, type2]],
  11242. // variadic: true|false
  11243. // }
  11244. //
  11245. // Each arg in the arg list is a list of valid types
  11246. // (if the function is overloaded and supports multiple
  11247. // types. If the type is "any" then no type checking
  11248. // occurs on the argument. Variadic is optional
  11249. // and if not provided is assumed to be false.
  11250. abs: {_func: this._functionAbs, _signature: [{types: [TYPE_NUMBER]}]},
  11251. avg: {_func: this._functionAvg, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},
  11252. ceil: {_func: this._functionCeil, _signature: [{types: [TYPE_NUMBER]}]},
  11253. contains: {
  11254. _func: this._functionContains,
  11255. _signature: [{types: [TYPE_STRING, TYPE_ARRAY]},
  11256. {types: [TYPE_ANY]}]},
  11257. "ends_with": {
  11258. _func: this._functionEndsWith,
  11259. _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},
  11260. floor: {_func: this._functionFloor, _signature: [{types: [TYPE_NUMBER]}]},
  11261. length: {
  11262. _func: this._functionLength,
  11263. _signature: [{types: [TYPE_STRING, TYPE_ARRAY, TYPE_OBJECT]}]},
  11264. map: {
  11265. _func: this._functionMap,
  11266. _signature: [{types: [TYPE_EXPREF]}, {types: [TYPE_ARRAY]}]},
  11267. max: {
  11268. _func: this._functionMax,
  11269. _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},
  11270. "merge": {
  11271. _func: this._functionMerge,
  11272. _signature: [{types: [TYPE_OBJECT], variadic: true}]
  11273. },
  11274. "max_by": {
  11275. _func: this._functionMaxBy,
  11276. _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]
  11277. },
  11278. sum: {_func: this._functionSum, _signature: [{types: [TYPE_ARRAY_NUMBER]}]},
  11279. "starts_with": {
  11280. _func: this._functionStartsWith,
  11281. _signature: [{types: [TYPE_STRING]}, {types: [TYPE_STRING]}]},
  11282. min: {
  11283. _func: this._functionMin,
  11284. _signature: [{types: [TYPE_ARRAY_NUMBER, TYPE_ARRAY_STRING]}]},
  11285. "min_by": {
  11286. _func: this._functionMinBy,
  11287. _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]
  11288. },
  11289. type: {_func: this._functionType, _signature: [{types: [TYPE_ANY]}]},
  11290. keys: {_func: this._functionKeys, _signature: [{types: [TYPE_OBJECT]}]},
  11291. values: {_func: this._functionValues, _signature: [{types: [TYPE_OBJECT]}]},
  11292. sort: {_func: this._functionSort, _signature: [{types: [TYPE_ARRAY_STRING, TYPE_ARRAY_NUMBER]}]},
  11293. "sort_by": {
  11294. _func: this._functionSortBy,
  11295. _signature: [{types: [TYPE_ARRAY]}, {types: [TYPE_EXPREF]}]
  11296. },
  11297. join: {
  11298. _func: this._functionJoin,
  11299. _signature: [
  11300. {types: [TYPE_STRING]},
  11301. {types: [TYPE_ARRAY_STRING]}
  11302. ]
  11303. },
  11304. reverse: {
  11305. _func: this._functionReverse,
  11306. _signature: [{types: [TYPE_STRING, TYPE_ARRAY]}]},
  11307. "to_array": {_func: this._functionToArray, _signature: [{types: [TYPE_ANY]}]},
  11308. "to_string": {_func: this._functionToString, _signature: [{types: [TYPE_ANY]}]},
  11309. "to_number": {_func: this._functionToNumber, _signature: [{types: [TYPE_ANY]}]},
  11310. "not_null": {
  11311. _func: this._functionNotNull,
  11312. _signature: [{types: [TYPE_ANY], variadic: true}]
  11313. }
  11314. };
  11315. }
  11316. Runtime.prototype = {
  11317. callFunction: function(name, resolvedArgs) {
  11318. var functionEntry = this.functionTable[name];
  11319. if (functionEntry === undefined) {
  11320. throw new Error("Unknown function: " + name + "()");
  11321. }
  11322. this._validateArgs(name, resolvedArgs, functionEntry._signature);
  11323. return functionEntry._func.call(this, resolvedArgs);
  11324. },
  11325. _validateArgs: function(name, args, signature) {
  11326. // Validating the args requires validating
  11327. // the correct arity and the correct type of each arg.
  11328. // If the last argument is declared as variadic, then we need
  11329. // a minimum number of args to be required. Otherwise it has to
  11330. // be an exact amount.
  11331. var pluralized;
  11332. if (signature[signature.length - 1].variadic) {
  11333. if (args.length < signature.length) {
  11334. pluralized = signature.length === 1 ? " argument" : " arguments";
  11335. throw new Error("ArgumentError: " + name + "() " +
  11336. "takes at least" + signature.length + pluralized +
  11337. " but received " + args.length);
  11338. }
  11339. } else if (args.length !== signature.length) {
  11340. pluralized = signature.length === 1 ? " argument" : " arguments";
  11341. throw new Error("ArgumentError: " + name + "() " +
  11342. "takes " + signature.length + pluralized +
  11343. " but received " + args.length);
  11344. }
  11345. var currentSpec;
  11346. var actualType;
  11347. var typeMatched;
  11348. for (var i = 0; i < signature.length; i++) {
  11349. typeMatched = false;
  11350. currentSpec = signature[i].types;
  11351. actualType = this._getTypeName(args[i]);
  11352. for (var j = 0; j < currentSpec.length; j++) {
  11353. if (this._typeMatches(actualType, currentSpec[j], args[i])) {
  11354. typeMatched = true;
  11355. break;
  11356. }
  11357. }
  11358. if (!typeMatched) {
  11359. var expected = currentSpec
  11360. .map(function(typeIdentifier) {
  11361. return TYPE_NAME_TABLE[typeIdentifier];
  11362. })
  11363. .join(',');
  11364. throw new Error("TypeError: " + name + "() " +
  11365. "expected argument " + (i + 1) +
  11366. " to be type " + expected +
  11367. " but received type " +
  11368. TYPE_NAME_TABLE[actualType] + " instead.");
  11369. }
  11370. }
  11371. },
  11372. _typeMatches: function(actual, expected, argValue) {
  11373. if (expected === TYPE_ANY) {
  11374. return true;
  11375. }
  11376. if (expected === TYPE_ARRAY_STRING ||
  11377. expected === TYPE_ARRAY_NUMBER ||
  11378. expected === TYPE_ARRAY) {
  11379. // The expected type can either just be array,
  11380. // or it can require a specific subtype (array of numbers).
  11381. //
  11382. // The simplest case is if "array" with no subtype is specified.
  11383. if (expected === TYPE_ARRAY) {
  11384. return actual === TYPE_ARRAY;
  11385. } else if (actual === TYPE_ARRAY) {
  11386. // Otherwise we need to check subtypes.
  11387. // I think this has potential to be improved.
  11388. var subtype;
  11389. if (expected === TYPE_ARRAY_NUMBER) {
  11390. subtype = TYPE_NUMBER;
  11391. } else if (expected === TYPE_ARRAY_STRING) {
  11392. subtype = TYPE_STRING;
  11393. }
  11394. for (var i = 0; i < argValue.length; i++) {
  11395. if (!this._typeMatches(
  11396. this._getTypeName(argValue[i]), subtype,
  11397. argValue[i])) {
  11398. return false;
  11399. }
  11400. }
  11401. return true;
  11402. }
  11403. } else {
  11404. return actual === expected;
  11405. }
  11406. },
  11407. _getTypeName: function(obj) {
  11408. switch (Object.prototype.toString.call(obj)) {
  11409. case "[object String]":
  11410. return TYPE_STRING;
  11411. case "[object Number]":
  11412. return TYPE_NUMBER;
  11413. case "[object Array]":
  11414. return TYPE_ARRAY;
  11415. case "[object Boolean]":
  11416. return TYPE_BOOLEAN;
  11417. case "[object Null]":
  11418. return TYPE_NULL;
  11419. case "[object Object]":
  11420. // Check if it's an expref. If it has, it's been
  11421. // tagged with a jmespathType attr of 'Expref';
  11422. if (obj.jmespathType === TOK_EXPREF) {
  11423. return TYPE_EXPREF;
  11424. } else {
  11425. return TYPE_OBJECT;
  11426. }
  11427. }
  11428. },
  11429. _functionStartsWith: function(resolvedArgs) {
  11430. return resolvedArgs[0].lastIndexOf(resolvedArgs[1]) === 0;
  11431. },
  11432. _functionEndsWith: function(resolvedArgs) {
  11433. var searchStr = resolvedArgs[0];
  11434. var suffix = resolvedArgs[1];
  11435. return searchStr.indexOf(suffix, searchStr.length - suffix.length) !== -1;
  11436. },
  11437. _functionReverse: function(resolvedArgs) {
  11438. var typeName = this._getTypeName(resolvedArgs[0]);
  11439. if (typeName === TYPE_STRING) {
  11440. var originalStr = resolvedArgs[0];
  11441. var reversedStr = "";
  11442. for (var i = originalStr.length - 1; i >= 0; i--) {
  11443. reversedStr += originalStr[i];
  11444. }
  11445. return reversedStr;
  11446. } else {
  11447. var reversedArray = resolvedArgs[0].slice(0);
  11448. reversedArray.reverse();
  11449. return reversedArray;
  11450. }
  11451. },
  11452. _functionAbs: function(resolvedArgs) {
  11453. return Math.abs(resolvedArgs[0]);
  11454. },
  11455. _functionCeil: function(resolvedArgs) {
  11456. return Math.ceil(resolvedArgs[0]);
  11457. },
  11458. _functionAvg: function(resolvedArgs) {
  11459. var sum = 0;
  11460. var inputArray = resolvedArgs[0];
  11461. for (var i = 0; i < inputArray.length; i++) {
  11462. sum += inputArray[i];
  11463. }
  11464. return sum / inputArray.length;
  11465. },
  11466. _functionContains: function(resolvedArgs) {
  11467. return resolvedArgs[0].indexOf(resolvedArgs[1]) >= 0;
  11468. },
  11469. _functionFloor: function(resolvedArgs) {
  11470. return Math.floor(resolvedArgs[0]);
  11471. },
  11472. _functionLength: function(resolvedArgs) {
  11473. if (!isObject(resolvedArgs[0])) {
  11474. return resolvedArgs[0].length;
  11475. } else {
  11476. // As far as I can tell, there's no way to get the length
  11477. // of an object without O(n) iteration through the object.
  11478. return Object.keys(resolvedArgs[0]).length;
  11479. }
  11480. },
  11481. _functionMap: function(resolvedArgs) {
  11482. var mapped = [];
  11483. var interpreter = this._interpreter;
  11484. var exprefNode = resolvedArgs[0];
  11485. var elements = resolvedArgs[1];
  11486. for (var i = 0; i < elements.length; i++) {
  11487. mapped.push(interpreter.visit(exprefNode, elements[i]));
  11488. }
  11489. return mapped;
  11490. },
  11491. _functionMerge: function(resolvedArgs) {
  11492. var merged = {};
  11493. for (var i = 0; i < resolvedArgs.length; i++) {
  11494. var current = resolvedArgs[i];
  11495. for (var key in current) {
  11496. merged[key] = current[key];
  11497. }
  11498. }
  11499. return merged;
  11500. },
  11501. _functionMax: function(resolvedArgs) {
  11502. if (resolvedArgs[0].length > 0) {
  11503. var typeName = this._getTypeName(resolvedArgs[0][0]);
  11504. if (typeName === TYPE_NUMBER) {
  11505. return Math.max.apply(Math, resolvedArgs[0]);
  11506. } else {
  11507. var elements = resolvedArgs[0];
  11508. var maxElement = elements[0];
  11509. for (var i = 1; i < elements.length; i++) {
  11510. if (maxElement.localeCompare(elements[i]) < 0) {
  11511. maxElement = elements[i];
  11512. }
  11513. }
  11514. return maxElement;
  11515. }
  11516. } else {
  11517. return null;
  11518. }
  11519. },
  11520. _functionMin: function(resolvedArgs) {
  11521. if (resolvedArgs[0].length > 0) {
  11522. var typeName = this._getTypeName(resolvedArgs[0][0]);
  11523. if (typeName === TYPE_NUMBER) {
  11524. return Math.min.apply(Math, resolvedArgs[0]);
  11525. } else {
  11526. var elements = resolvedArgs[0];
  11527. var minElement = elements[0];
  11528. for (var i = 1; i < elements.length; i++) {
  11529. if (elements[i].localeCompare(minElement) < 0) {
  11530. minElement = elements[i];
  11531. }
  11532. }
  11533. return minElement;
  11534. }
  11535. } else {
  11536. return null;
  11537. }
  11538. },
  11539. _functionSum: function(resolvedArgs) {
  11540. var sum = 0;
  11541. var listToSum = resolvedArgs[0];
  11542. for (var i = 0; i < listToSum.length; i++) {
  11543. sum += listToSum[i];
  11544. }
  11545. return sum;
  11546. },
  11547. _functionType: function(resolvedArgs) {
  11548. switch (this._getTypeName(resolvedArgs[0])) {
  11549. case TYPE_NUMBER:
  11550. return "number";
  11551. case TYPE_STRING:
  11552. return "string";
  11553. case TYPE_ARRAY:
  11554. return "array";
  11555. case TYPE_OBJECT:
  11556. return "object";
  11557. case TYPE_BOOLEAN:
  11558. return "boolean";
  11559. case TYPE_EXPREF:
  11560. return "expref";
  11561. case TYPE_NULL:
  11562. return "null";
  11563. }
  11564. },
  11565. _functionKeys: function(resolvedArgs) {
  11566. return Object.keys(resolvedArgs[0]);
  11567. },
  11568. _functionValues: function(resolvedArgs) {
  11569. var obj = resolvedArgs[0];
  11570. var keys = Object.keys(obj);
  11571. var values = [];
  11572. for (var i = 0; i < keys.length; i++) {
  11573. values.push(obj[keys[i]]);
  11574. }
  11575. return values;
  11576. },
  11577. _functionJoin: function(resolvedArgs) {
  11578. var joinChar = resolvedArgs[0];
  11579. var listJoin = resolvedArgs[1];
  11580. return listJoin.join(joinChar);
  11581. },
  11582. _functionToArray: function(resolvedArgs) {
  11583. if (this._getTypeName(resolvedArgs[0]) === TYPE_ARRAY) {
  11584. return resolvedArgs[0];
  11585. } else {
  11586. return [resolvedArgs[0]];
  11587. }
  11588. },
  11589. _functionToString: function(resolvedArgs) {
  11590. if (this._getTypeName(resolvedArgs[0]) === TYPE_STRING) {
  11591. return resolvedArgs[0];
  11592. } else {
  11593. return JSON.stringify(resolvedArgs[0]);
  11594. }
  11595. },
  11596. _functionToNumber: function(resolvedArgs) {
  11597. var typeName = this._getTypeName(resolvedArgs[0]);
  11598. var convertedValue;
  11599. if (typeName === TYPE_NUMBER) {
  11600. return resolvedArgs[0];
  11601. } else if (typeName === TYPE_STRING) {
  11602. convertedValue = +resolvedArgs[0];
  11603. if (!isNaN(convertedValue)) {
  11604. return convertedValue;
  11605. }
  11606. }
  11607. return null;
  11608. },
  11609. _functionNotNull: function(resolvedArgs) {
  11610. for (var i = 0; i < resolvedArgs.length; i++) {
  11611. if (this._getTypeName(resolvedArgs[i]) !== TYPE_NULL) {
  11612. return resolvedArgs[i];
  11613. }
  11614. }
  11615. return null;
  11616. },
  11617. _functionSort: function(resolvedArgs) {
  11618. var sortedArray = resolvedArgs[0].slice(0);
  11619. sortedArray.sort();
  11620. return sortedArray;
  11621. },
  11622. _functionSortBy: function(resolvedArgs) {
  11623. var sortedArray = resolvedArgs[0].slice(0);
  11624. if (sortedArray.length === 0) {
  11625. return sortedArray;
  11626. }
  11627. var interpreter = this._interpreter;
  11628. var exprefNode = resolvedArgs[1];
  11629. var requiredType = this._getTypeName(
  11630. interpreter.visit(exprefNode, sortedArray[0]));
  11631. if ([TYPE_NUMBER, TYPE_STRING].indexOf(requiredType) < 0) {
  11632. throw new Error("TypeError");
  11633. }
  11634. var that = this;
  11635. // In order to get a stable sort out of an unstable
  11636. // sort algorithm, we decorate/sort/undecorate (DSU)
  11637. // by creating a new list of [index, element] pairs.
  11638. // In the cmp function, if the evaluated elements are
  11639. // equal, then the index will be used as the tiebreaker.
  11640. // After the decorated list has been sorted, it will be
  11641. // undecorated to extract the original elements.
  11642. var decorated = [];
  11643. for (var i = 0; i < sortedArray.length; i++) {
  11644. decorated.push([i, sortedArray[i]]);
  11645. }
  11646. decorated.sort(function(a, b) {
  11647. var exprA = interpreter.visit(exprefNode, a[1]);
  11648. var exprB = interpreter.visit(exprefNode, b[1]);
  11649. if (that._getTypeName(exprA) !== requiredType) {
  11650. throw new Error(
  11651. "TypeError: expected " + requiredType + ", received " +
  11652. that._getTypeName(exprA));
  11653. } else if (that._getTypeName(exprB) !== requiredType) {
  11654. throw new Error(
  11655. "TypeError: expected " + requiredType + ", received " +
  11656. that._getTypeName(exprB));
  11657. }
  11658. if (exprA > exprB) {
  11659. return 1;
  11660. } else if (exprA < exprB) {
  11661. return -1;
  11662. } else {
  11663. // If they're equal compare the items by their
  11664. // order to maintain relative order of equal keys
  11665. // (i.e. to get a stable sort).
  11666. return a[0] - b[0];
  11667. }
  11668. });
  11669. // Undecorate: extract out the original list elements.
  11670. for (var j = 0; j < decorated.length; j++) {
  11671. sortedArray[j] = decorated[j][1];
  11672. }
  11673. return sortedArray;
  11674. },
  11675. _functionMaxBy: function(resolvedArgs) {
  11676. var exprefNode = resolvedArgs[1];
  11677. var resolvedArray = resolvedArgs[0];
  11678. var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);
  11679. var maxNumber = -Infinity;
  11680. var maxRecord;
  11681. var current;
  11682. for (var i = 0; i < resolvedArray.length; i++) {
  11683. current = keyFunction(resolvedArray[i]);
  11684. if (current > maxNumber) {
  11685. maxNumber = current;
  11686. maxRecord = resolvedArray[i];
  11687. }
  11688. }
  11689. return maxRecord;
  11690. },
  11691. _functionMinBy: function(resolvedArgs) {
  11692. var exprefNode = resolvedArgs[1];
  11693. var resolvedArray = resolvedArgs[0];
  11694. var keyFunction = this.createKeyFunction(exprefNode, [TYPE_NUMBER, TYPE_STRING]);
  11695. var minNumber = Infinity;
  11696. var minRecord;
  11697. var current;
  11698. for (var i = 0; i < resolvedArray.length; i++) {
  11699. current = keyFunction(resolvedArray[i]);
  11700. if (current < minNumber) {
  11701. minNumber = current;
  11702. minRecord = resolvedArray[i];
  11703. }
  11704. }
  11705. return minRecord;
  11706. },
  11707. createKeyFunction: function(exprefNode, allowedTypes) {
  11708. var that = this;
  11709. var interpreter = this._interpreter;
  11710. var keyFunc = function(x) {
  11711. var current = interpreter.visit(exprefNode, x);
  11712. if (allowedTypes.indexOf(that._getTypeName(current)) < 0) {
  11713. var msg = "TypeError: expected one of " + allowedTypes +
  11714. ", received " + that._getTypeName(current);
  11715. throw new Error(msg);
  11716. }
  11717. return current;
  11718. };
  11719. return keyFunc;
  11720. }
  11721. };
  11722. function compile(stream) {
  11723. var parser = new Parser();
  11724. var ast = parser.parse(stream);
  11725. return ast;
  11726. }
  11727. function tokenize(stream) {
  11728. var lexer = new Lexer();
  11729. return lexer.tokenize(stream);
  11730. }
  11731. function search(data, expression) {
  11732. var parser = new Parser();
  11733. // This needs to be improved. Both the interpreter and runtime depend on
  11734. // each other. The runtime needs the interpreter to support exprefs.
  11735. // There's likely a clean way to avoid the cyclic dependency.
  11736. var runtime = new Runtime();
  11737. var interpreter = new TreeInterpreter(runtime);
  11738. runtime._interpreter = interpreter;
  11739. var node = parser.parse(expression);
  11740. return interpreter.search(node, data);
  11741. }
  11742. exports.tokenize = tokenize;
  11743. exports.compile = compile;
  11744. exports.search = search;
  11745. exports.strictDeepEqual = strictDeepEqual;
  11746. })( false ? this.jmespath = {} : exports);
  11747. /***/ }),
  11748. /* 89 */
  11749. /***/ (function(module, exports, __webpack_require__) {
  11750. var AWS = __webpack_require__(1);
  11751. var inherit = AWS.util.inherit;
  11752. var jmespath = __webpack_require__(88);
  11753. /**
  11754. * This class encapsulates the response information
  11755. * from a service request operation sent through {AWS.Request}.
  11756. * The response object has two main properties for getting information
  11757. * back from a request:
  11758. *
  11759. * ## The `data` property
  11760. *
  11761. * The `response.data` property contains the serialized object data
  11762. * retrieved from the service request. For instance, for an
  11763. * Amazon DynamoDB `listTables` method call, the response data might
  11764. * look like:
  11765. *
  11766. * ```
  11767. * > resp.data
  11768. * { TableNames:
  11769. * [ 'table1', 'table2', ... ] }
  11770. * ```
  11771. *
  11772. * The `data` property can be null if an error occurs (see below).
  11773. *
  11774. * ## The `error` property
  11775. *
  11776. * In the event of a service error (or transfer error), the
  11777. * `response.error` property will be filled with the given
  11778. * error data in the form:
  11779. *
  11780. * ```
  11781. * { code: 'SHORT_UNIQUE_ERROR_CODE',
  11782. * message: 'Some human readable error message' }
  11783. * ```
  11784. *
  11785. * In the case of an error, the `data` property will be `null`.
  11786. * Note that if you handle events that can be in a failure state,
  11787. * you should always check whether `response.error` is set
  11788. * before attempting to access the `response.data` property.
  11789. *
  11790. * @!attribute data
  11791. * @readonly
  11792. * @!group Data Properties
  11793. * @note Inside of a {AWS.Request~httpData} event, this
  11794. * property contains a single raw packet instead of the
  11795. * full de-serialized service response.
  11796. * @return [Object] the de-serialized response data
  11797. * from the service.
  11798. *
  11799. * @!attribute error
  11800. * An structure containing information about a service
  11801. * or networking error.
  11802. * @readonly
  11803. * @!group Data Properties
  11804. * @note This attribute is only filled if a service or
  11805. * networking error occurs.
  11806. * @return [Error]
  11807. * * code [String] a unique short code representing the
  11808. * error that was emitted.
  11809. * * message [String] a longer human readable error message
  11810. * * retryable [Boolean] whether the error message is
  11811. * retryable.
  11812. * * statusCode [Numeric] in the case of a request that reached the service,
  11813. * this value contains the response status code.
  11814. * * time [Date] the date time object when the error occurred.
  11815. * * hostname [String] set when a networking error occurs to easily
  11816. * identify the endpoint of the request.
  11817. * * region [String] set when a networking error occurs to easily
  11818. * identify the region of the request.
  11819. *
  11820. * @!attribute requestId
  11821. * @readonly
  11822. * @!group Data Properties
  11823. * @return [String] the unique request ID associated with the response.
  11824. * Log this value when debugging requests for AWS support.
  11825. *
  11826. * @!attribute retryCount
  11827. * @readonly
  11828. * @!group Operation Properties
  11829. * @return [Integer] the number of retries that were
  11830. * attempted before the request was completed.
  11831. *
  11832. * @!attribute redirectCount
  11833. * @readonly
  11834. * @!group Operation Properties
  11835. * @return [Integer] the number of redirects that were
  11836. * followed before the request was completed.
  11837. *
  11838. * @!attribute httpResponse
  11839. * @readonly
  11840. * @!group HTTP Properties
  11841. * @return [AWS.HttpResponse] the raw HTTP response object
  11842. * containing the response headers and body information
  11843. * from the server.
  11844. *
  11845. * @see AWS.Request
  11846. */
  11847. AWS.Response = inherit({
  11848. /**
  11849. * @api private
  11850. */
  11851. constructor: function Response(request) {
  11852. this.request = request;
  11853. this.data = null;
  11854. this.error = null;
  11855. this.retryCount = 0;
  11856. this.redirectCount = 0;
  11857. this.httpResponse = new AWS.HttpResponse();
  11858. if (request) {
  11859. this.maxRetries = request.service.numRetries();
  11860. this.maxRedirects = request.service.config.maxRedirects;
  11861. }
  11862. },
  11863. /**
  11864. * Creates a new request for the next page of response data, calling the
  11865. * callback with the page data if a callback is provided.
  11866. *
  11867. * @callback callback function(err, data)
  11868. * Called when a page of data is returned from the next request.
  11869. *
  11870. * @param err [Error] an error object, if an error occurred in the request
  11871. * @param data [Object] the next page of data, or null, if there are no
  11872. * more pages left.
  11873. * @return [AWS.Request] the request object for the next page of data
  11874. * @return [null] if no callback is provided and there are no pages left
  11875. * to retrieve.
  11876. * @since v1.4.0
  11877. */
  11878. nextPage: function nextPage(callback) {
  11879. var config;
  11880. var service = this.request.service;
  11881. var operation = this.request.operation;
  11882. try {
  11883. config = service.paginationConfig(operation, true);
  11884. } catch (e) { this.error = e; }
  11885. if (!this.hasNextPage()) {
  11886. if (callback) callback(this.error, null);
  11887. else if (this.error) throw this.error;
  11888. return null;
  11889. }
  11890. var params = AWS.util.copy(this.request.params);
  11891. if (!this.nextPageTokens) {
  11892. return callback ? callback(null, null) : null;
  11893. } else {
  11894. var inputTokens = config.inputToken;
  11895. if (typeof inputTokens === 'string') inputTokens = [inputTokens];
  11896. for (var i = 0; i < inputTokens.length; i++) {
  11897. params[inputTokens[i]] = this.nextPageTokens[i];
  11898. }
  11899. return service.makeRequest(this.request.operation, params, callback);
  11900. }
  11901. },
  11902. /**
  11903. * @return [Boolean] whether more pages of data can be returned by further
  11904. * requests
  11905. * @since v1.4.0
  11906. */
  11907. hasNextPage: function hasNextPage() {
  11908. this.cacheNextPageTokens();
  11909. if (this.nextPageTokens) return true;
  11910. if (this.nextPageTokens === undefined) return undefined;
  11911. else return false;
  11912. },
  11913. /**
  11914. * @api private
  11915. */
  11916. cacheNextPageTokens: function cacheNextPageTokens() {
  11917. if (Object.prototype.hasOwnProperty.call(this, 'nextPageTokens')) return this.nextPageTokens;
  11918. this.nextPageTokens = undefined;
  11919. var config = this.request.service.paginationConfig(this.request.operation);
  11920. if (!config) return this.nextPageTokens;
  11921. this.nextPageTokens = null;
  11922. if (config.moreResults) {
  11923. if (!jmespath.search(this.data, config.moreResults)) {
  11924. return this.nextPageTokens;
  11925. }
  11926. }
  11927. var exprs = config.outputToken;
  11928. if (typeof exprs === 'string') exprs = [exprs];
  11929. AWS.util.arrayEach.call(this, exprs, function (expr) {
  11930. var output = jmespath.search(this.data, expr);
  11931. if (output) {
  11932. this.nextPageTokens = this.nextPageTokens || [];
  11933. this.nextPageTokens.push(output);
  11934. }
  11935. });
  11936. return this.nextPageTokens;
  11937. }
  11938. });
  11939. /***/ }),
  11940. /* 90 */
  11941. /***/ (function(module, exports, __webpack_require__) {
  11942. /**
  11943. * Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  11944. *
  11945. * Licensed under the Apache License, Version 2.0 (the "License"). You
  11946. * may not use this file except in compliance with the License. A copy of
  11947. * the License is located at
  11948. *
  11949. * http://aws.amazon.com/apache2.0/
  11950. *
  11951. * or in the "license" file accompanying this file. This file is
  11952. * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  11953. * ANY KIND, either express or implied. See the License for the specific
  11954. * language governing permissions and limitations under the License.
  11955. */
  11956. var AWS = __webpack_require__(1);
  11957. var inherit = AWS.util.inherit;
  11958. var jmespath = __webpack_require__(88);
  11959. /**
  11960. * @api private
  11961. */
  11962. function CHECK_ACCEPTORS(resp) {
  11963. var waiter = resp.request._waiter;
  11964. var acceptors = waiter.config.acceptors;
  11965. var acceptorMatched = false;
  11966. var state = 'retry';
  11967. acceptors.forEach(function(acceptor) {
  11968. if (!acceptorMatched) {
  11969. var matcher = waiter.matchers[acceptor.matcher];
  11970. if (matcher && matcher(resp, acceptor.expected, acceptor.argument)) {
  11971. acceptorMatched = true;
  11972. state = acceptor.state;
  11973. }
  11974. }
  11975. });
  11976. if (!acceptorMatched && resp.error) state = 'failure';
  11977. if (state === 'success') {
  11978. waiter.setSuccess(resp);
  11979. } else {
  11980. waiter.setError(resp, state === 'retry');
  11981. }
  11982. }
  11983. /**
  11984. * @api private
  11985. */
  11986. AWS.ResourceWaiter = inherit({
  11987. /**
  11988. * Waits for a given state on a service object
  11989. * @param service [Service] the service object to wait on
  11990. * @param state [String] the state (defined in waiter configuration) to wait
  11991. * for.
  11992. * @example Create a waiter for running EC2 instances
  11993. * var ec2 = new AWS.EC2;
  11994. * var waiter = new AWS.ResourceWaiter(ec2, 'instanceRunning');
  11995. */
  11996. constructor: function constructor(service, state) {
  11997. this.service = service;
  11998. this.state = state;
  11999. this.loadWaiterConfig(this.state);
  12000. },
  12001. service: null,
  12002. state: null,
  12003. config: null,
  12004. matchers: {
  12005. path: function(resp, expected, argument) {
  12006. try {
  12007. var result = jmespath.search(resp.data, argument);
  12008. } catch (err) {
  12009. return false;
  12010. }
  12011. return jmespath.strictDeepEqual(result,expected);
  12012. },
  12013. pathAll: function(resp, expected, argument) {
  12014. try {
  12015. var results = jmespath.search(resp.data, argument);
  12016. } catch (err) {
  12017. return false;
  12018. }
  12019. if (!Array.isArray(results)) results = [results];
  12020. var numResults = results.length;
  12021. if (!numResults) return false;
  12022. for (var ind = 0 ; ind < numResults; ind++) {
  12023. if (!jmespath.strictDeepEqual(results[ind], expected)) {
  12024. return false;
  12025. }
  12026. }
  12027. return true;
  12028. },
  12029. pathAny: function(resp, expected, argument) {
  12030. try {
  12031. var results = jmespath.search(resp.data, argument);
  12032. } catch (err) {
  12033. return false;
  12034. }
  12035. if (!Array.isArray(results)) results = [results];
  12036. var numResults = results.length;
  12037. for (var ind = 0 ; ind < numResults; ind++) {
  12038. if (jmespath.strictDeepEqual(results[ind], expected)) {
  12039. return true;
  12040. }
  12041. }
  12042. return false;
  12043. },
  12044. status: function(resp, expected) {
  12045. var statusCode = resp.httpResponse.statusCode;
  12046. return (typeof statusCode === 'number') && (statusCode === expected);
  12047. },
  12048. error: function(resp, expected) {
  12049. if (typeof expected === 'string' && resp.error) {
  12050. return expected === resp.error.code;
  12051. }
  12052. // if expected is not string, can be boolean indicating presence of error
  12053. return expected === !!resp.error;
  12054. }
  12055. },
  12056. listeners: new AWS.SequentialExecutor().addNamedListeners(function(add) {
  12057. add('RETRY_CHECK', 'retry', function(resp) {
  12058. var waiter = resp.request._waiter;
  12059. if (resp.error && resp.error.code === 'ResourceNotReady') {
  12060. resp.error.retryDelay = (waiter.config.delay || 0) * 1000;
  12061. }
  12062. });
  12063. add('CHECK_OUTPUT', 'extractData', CHECK_ACCEPTORS);
  12064. add('CHECK_ERROR', 'extractError', CHECK_ACCEPTORS);
  12065. }),
  12066. /**
  12067. * @return [AWS.Request]
  12068. */
  12069. wait: function wait(params, callback) {
  12070. if (typeof params === 'function') {
  12071. callback = params; params = undefined;
  12072. }
  12073. if (params && params.$waiter) {
  12074. params = AWS.util.copy(params);
  12075. if (typeof params.$waiter.delay === 'number') {
  12076. this.config.delay = params.$waiter.delay;
  12077. }
  12078. if (typeof params.$waiter.maxAttempts === 'number') {
  12079. this.config.maxAttempts = params.$waiter.maxAttempts;
  12080. }
  12081. delete params.$waiter;
  12082. }
  12083. var request = this.service.makeRequest(this.config.operation, params);
  12084. request._waiter = this;
  12085. request.response.maxRetries = this.config.maxAttempts;
  12086. request.addListeners(this.listeners);
  12087. if (callback) request.send(callback);
  12088. return request;
  12089. },
  12090. setSuccess: function setSuccess(resp) {
  12091. resp.error = null;
  12092. resp.data = resp.data || {};
  12093. resp.request.removeAllListeners('extractData');
  12094. },
  12095. setError: function setError(resp, retryable) {
  12096. resp.data = null;
  12097. resp.error = AWS.util.error(resp.error || new Error(), {
  12098. code: 'ResourceNotReady',
  12099. message: 'Resource is not in the state ' + this.state,
  12100. retryable: retryable
  12101. });
  12102. },
  12103. /**
  12104. * Loads waiter configuration from API configuration
  12105. *
  12106. * @api private
  12107. */
  12108. loadWaiterConfig: function loadWaiterConfig(state) {
  12109. if (!this.service.api.waiters[state]) {
  12110. throw new AWS.util.error(new Error(), {
  12111. code: 'StateNotFoundError',
  12112. message: 'State ' + state + ' not found.'
  12113. });
  12114. }
  12115. this.config = AWS.util.copy(this.service.api.waiters[state]);
  12116. }
  12117. });
  12118. /***/ }),
  12119. /* 91 */
  12120. /***/ (function(module, exports, __webpack_require__) {
  12121. var AWS = __webpack_require__(1);
  12122. var inherit = AWS.util.inherit;
  12123. /**
  12124. * @api private
  12125. */
  12126. AWS.Signers.RequestSigner = inherit({
  12127. constructor: function RequestSigner(request) {
  12128. this.request = request;
  12129. },
  12130. setServiceClientId: function setServiceClientId(id) {
  12131. this.serviceClientId = id;
  12132. },
  12133. getServiceClientId: function getServiceClientId() {
  12134. return this.serviceClientId;
  12135. }
  12136. });
  12137. AWS.Signers.RequestSigner.getVersion = function getVersion(version) {
  12138. switch (version) {
  12139. case 'v2': return AWS.Signers.V2;
  12140. case 'v3': return AWS.Signers.V3;
  12141. case 's3v4': return AWS.Signers.V4;
  12142. case 'v4': return AWS.Signers.V4;
  12143. case 's3': return AWS.Signers.S3;
  12144. case 'v3https': return AWS.Signers.V3Https;
  12145. case 'bearer': return AWS.Signers.Bearer;
  12146. }
  12147. throw new Error('Unknown signing version ' + version);
  12148. };
  12149. __webpack_require__(92);
  12150. __webpack_require__(93);
  12151. __webpack_require__(94);
  12152. __webpack_require__(95);
  12153. __webpack_require__(97);
  12154. __webpack_require__(98);
  12155. __webpack_require__(99);
  12156. /***/ }),
  12157. /* 92 */
  12158. /***/ (function(module, exports, __webpack_require__) {
  12159. var AWS = __webpack_require__(1);
  12160. var inherit = AWS.util.inherit;
  12161. /**
  12162. * @api private
  12163. */
  12164. AWS.Signers.V2 = inherit(AWS.Signers.RequestSigner, {
  12165. addAuthorization: function addAuthorization(credentials, date) {
  12166. if (!date) date = AWS.util.date.getDate();
  12167. var r = this.request;
  12168. r.params.Timestamp = AWS.util.date.iso8601(date);
  12169. r.params.SignatureVersion = '2';
  12170. r.params.SignatureMethod = 'HmacSHA256';
  12171. r.params.AWSAccessKeyId = credentials.accessKeyId;
  12172. if (credentials.sessionToken) {
  12173. r.params.SecurityToken = credentials.sessionToken;
  12174. }
  12175. delete r.params.Signature; // delete old Signature for re-signing
  12176. r.params.Signature = this.signature(credentials);
  12177. r.body = AWS.util.queryParamsToString(r.params);
  12178. r.headers['Content-Length'] = r.body.length;
  12179. },
  12180. signature: function signature(credentials) {
  12181. return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');
  12182. },
  12183. stringToSign: function stringToSign() {
  12184. var parts = [];
  12185. parts.push(this.request.method);
  12186. parts.push(this.request.endpoint.host.toLowerCase());
  12187. parts.push(this.request.pathname());
  12188. parts.push(AWS.util.queryParamsToString(this.request.params));
  12189. return parts.join('\n');
  12190. }
  12191. });
  12192. /**
  12193. * @api private
  12194. */
  12195. module.exports = AWS.Signers.V2;
  12196. /***/ }),
  12197. /* 93 */
  12198. /***/ (function(module, exports, __webpack_require__) {
  12199. var AWS = __webpack_require__(1);
  12200. var inherit = AWS.util.inherit;
  12201. /**
  12202. * @api private
  12203. */
  12204. AWS.Signers.V3 = inherit(AWS.Signers.RequestSigner, {
  12205. addAuthorization: function addAuthorization(credentials, date) {
  12206. var datetime = AWS.util.date.rfc822(date);
  12207. this.request.headers['X-Amz-Date'] = datetime;
  12208. if (credentials.sessionToken) {
  12209. this.request.headers['x-amz-security-token'] = credentials.sessionToken;
  12210. }
  12211. this.request.headers['X-Amzn-Authorization'] =
  12212. this.authorization(credentials, datetime);
  12213. },
  12214. authorization: function authorization(credentials) {
  12215. return 'AWS3 ' +
  12216. 'AWSAccessKeyId=' + credentials.accessKeyId + ',' +
  12217. 'Algorithm=HmacSHA256,' +
  12218. 'SignedHeaders=' + this.signedHeaders() + ',' +
  12219. 'Signature=' + this.signature(credentials);
  12220. },
  12221. signedHeaders: function signedHeaders() {
  12222. var headers = [];
  12223. AWS.util.arrayEach(this.headersToSign(), function iterator(h) {
  12224. headers.push(h.toLowerCase());
  12225. });
  12226. return headers.sort().join(';');
  12227. },
  12228. canonicalHeaders: function canonicalHeaders() {
  12229. var headers = this.request.headers;
  12230. var parts = [];
  12231. AWS.util.arrayEach(this.headersToSign(), function iterator(h) {
  12232. parts.push(h.toLowerCase().trim() + ':' + String(headers[h]).trim());
  12233. });
  12234. return parts.sort().join('\n') + '\n';
  12235. },
  12236. headersToSign: function headersToSign() {
  12237. var headers = [];
  12238. AWS.util.each(this.request.headers, function iterator(k) {
  12239. if (k === 'Host' || k === 'Content-Encoding' || k.match(/^X-Amz/i)) {
  12240. headers.push(k);
  12241. }
  12242. });
  12243. return headers;
  12244. },
  12245. signature: function signature(credentials) {
  12246. return AWS.util.crypto.hmac(credentials.secretAccessKey, this.stringToSign(), 'base64');
  12247. },
  12248. stringToSign: function stringToSign() {
  12249. var parts = [];
  12250. parts.push(this.request.method);
  12251. parts.push('/');
  12252. parts.push('');
  12253. parts.push(this.canonicalHeaders());
  12254. parts.push(this.request.body);
  12255. return AWS.util.crypto.sha256(parts.join('\n'));
  12256. }
  12257. });
  12258. /**
  12259. * @api private
  12260. */
  12261. module.exports = AWS.Signers.V3;
  12262. /***/ }),
  12263. /* 94 */
  12264. /***/ (function(module, exports, __webpack_require__) {
  12265. var AWS = __webpack_require__(1);
  12266. var inherit = AWS.util.inherit;
  12267. __webpack_require__(93);
  12268. /**
  12269. * @api private
  12270. */
  12271. AWS.Signers.V3Https = inherit(AWS.Signers.V3, {
  12272. authorization: function authorization(credentials) {
  12273. return 'AWS3-HTTPS ' +
  12274. 'AWSAccessKeyId=' + credentials.accessKeyId + ',' +
  12275. 'Algorithm=HmacSHA256,' +
  12276. 'Signature=' + this.signature(credentials);
  12277. },
  12278. stringToSign: function stringToSign() {
  12279. return this.request.headers['X-Amz-Date'];
  12280. }
  12281. });
  12282. /**
  12283. * @api private
  12284. */
  12285. module.exports = AWS.Signers.V3Https;
  12286. /***/ }),
  12287. /* 95 */
  12288. /***/ (function(module, exports, __webpack_require__) {
  12289. var AWS = __webpack_require__(1);
  12290. var v4Credentials = __webpack_require__(96);
  12291. var inherit = AWS.util.inherit;
  12292. /**
  12293. * @api private
  12294. */
  12295. var expiresHeader = 'presigned-expires';
  12296. /**
  12297. * @api private
  12298. */
  12299. AWS.Signers.V4 = inherit(AWS.Signers.RequestSigner, {
  12300. constructor: function V4(request, serviceName, options) {
  12301. AWS.Signers.RequestSigner.call(this, request);
  12302. this.serviceName = serviceName;
  12303. options = options || {};
  12304. this.signatureCache = typeof options.signatureCache === 'boolean' ? options.signatureCache : true;
  12305. this.operation = options.operation;
  12306. this.signatureVersion = options.signatureVersion;
  12307. },
  12308. algorithm: 'AWS4-HMAC-SHA256',
  12309. addAuthorization: function addAuthorization(credentials, date) {
  12310. var datetime = AWS.util.date.iso8601(date).replace(/[:\-]|\.\d{3}/g, '');
  12311. if (this.isPresigned()) {
  12312. this.updateForPresigned(credentials, datetime);
  12313. } else {
  12314. this.addHeaders(credentials, datetime);
  12315. }
  12316. this.request.headers['Authorization'] =
  12317. this.authorization(credentials, datetime);
  12318. },
  12319. addHeaders: function addHeaders(credentials, datetime) {
  12320. this.request.headers['X-Amz-Date'] = datetime;
  12321. if (credentials.sessionToken) {
  12322. this.request.headers['x-amz-security-token'] = credentials.sessionToken;
  12323. }
  12324. },
  12325. updateForPresigned: function updateForPresigned(credentials, datetime) {
  12326. var credString = this.credentialString(datetime);
  12327. var qs = {
  12328. 'X-Amz-Date': datetime,
  12329. 'X-Amz-Algorithm': this.algorithm,
  12330. 'X-Amz-Credential': credentials.accessKeyId + '/' + credString,
  12331. 'X-Amz-Expires': this.request.headers[expiresHeader],
  12332. 'X-Amz-SignedHeaders': this.signedHeaders()
  12333. };
  12334. if (credentials.sessionToken) {
  12335. qs['X-Amz-Security-Token'] = credentials.sessionToken;
  12336. }
  12337. if (this.request.headers['Content-Type']) {
  12338. qs['Content-Type'] = this.request.headers['Content-Type'];
  12339. }
  12340. if (this.request.headers['Content-MD5']) {
  12341. qs['Content-MD5'] = this.request.headers['Content-MD5'];
  12342. }
  12343. if (this.request.headers['Cache-Control']) {
  12344. qs['Cache-Control'] = this.request.headers['Cache-Control'];
  12345. }
  12346. // need to pull in any other X-Amz-* headers
  12347. AWS.util.each.call(this, this.request.headers, function(key, value) {
  12348. if (key === expiresHeader) return;
  12349. if (this.isSignableHeader(key)) {
  12350. var lowerKey = key.toLowerCase();
  12351. // Metadata should be normalized
  12352. if (lowerKey.indexOf('x-amz-meta-') === 0) {
  12353. qs[lowerKey] = value;
  12354. } else if (lowerKey.indexOf('x-amz-') === 0) {
  12355. qs[key] = value;
  12356. }
  12357. }
  12358. });
  12359. var sep = this.request.path.indexOf('?') >= 0 ? '&' : '?';
  12360. this.request.path += sep + AWS.util.queryParamsToString(qs);
  12361. },
  12362. authorization: function authorization(credentials, datetime) {
  12363. var parts = [];
  12364. var credString = this.credentialString(datetime);
  12365. parts.push(this.algorithm + ' Credential=' +
  12366. credentials.accessKeyId + '/' + credString);
  12367. parts.push('SignedHeaders=' + this.signedHeaders());
  12368. parts.push('Signature=' + this.signature(credentials, datetime));
  12369. return parts.join(', ');
  12370. },
  12371. signature: function signature(credentials, datetime) {
  12372. var signingKey = v4Credentials.getSigningKey(
  12373. credentials,
  12374. datetime.substr(0, 8),
  12375. this.request.region,
  12376. this.serviceName,
  12377. this.signatureCache
  12378. );
  12379. return AWS.util.crypto.hmac(signingKey, this.stringToSign(datetime), 'hex');
  12380. },
  12381. stringToSign: function stringToSign(datetime) {
  12382. var parts = [];
  12383. parts.push('AWS4-HMAC-SHA256');
  12384. parts.push(datetime);
  12385. parts.push(this.credentialString(datetime));
  12386. parts.push(this.hexEncodedHash(this.canonicalString()));
  12387. return parts.join('\n');
  12388. },
  12389. canonicalString: function canonicalString() {
  12390. var parts = [], pathname = this.request.pathname();
  12391. if (this.serviceName !== 's3' && this.signatureVersion !== 's3v4') pathname = AWS.util.uriEscapePath(pathname);
  12392. parts.push(this.request.method);
  12393. parts.push(pathname);
  12394. parts.push(this.request.search());
  12395. parts.push(this.canonicalHeaders() + '\n');
  12396. parts.push(this.signedHeaders());
  12397. parts.push(this.hexEncodedBodyHash());
  12398. return parts.join('\n');
  12399. },
  12400. canonicalHeaders: function canonicalHeaders() {
  12401. var headers = [];
  12402. AWS.util.each.call(this, this.request.headers, function (key, item) {
  12403. headers.push([key, item]);
  12404. });
  12405. headers.sort(function (a, b) {
  12406. return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : 1;
  12407. });
  12408. var parts = [];
  12409. AWS.util.arrayEach.call(this, headers, function (item) {
  12410. var key = item[0].toLowerCase();
  12411. if (this.isSignableHeader(key)) {
  12412. var value = item[1];
  12413. if (typeof value === 'undefined' || value === null || typeof value.toString !== 'function') {
  12414. throw AWS.util.error(new Error('Header ' + key + ' contains invalid value'), {
  12415. code: 'InvalidHeader'
  12416. });
  12417. }
  12418. parts.push(key + ':' +
  12419. this.canonicalHeaderValues(value.toString()));
  12420. }
  12421. });
  12422. return parts.join('\n');
  12423. },
  12424. canonicalHeaderValues: function canonicalHeaderValues(values) {
  12425. return values.replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '');
  12426. },
  12427. signedHeaders: function signedHeaders() {
  12428. var keys = [];
  12429. AWS.util.each.call(this, this.request.headers, function (key) {
  12430. key = key.toLowerCase();
  12431. if (this.isSignableHeader(key)) keys.push(key);
  12432. });
  12433. return keys.sort().join(';');
  12434. },
  12435. credentialString: function credentialString(datetime) {
  12436. return v4Credentials.createScope(
  12437. datetime.substr(0, 8),
  12438. this.request.region,
  12439. this.serviceName
  12440. );
  12441. },
  12442. hexEncodedHash: function hash(string) {
  12443. return AWS.util.crypto.sha256(string, 'hex');
  12444. },
  12445. hexEncodedBodyHash: function hexEncodedBodyHash() {
  12446. var request = this.request;
  12447. if (this.isPresigned() && (['s3', 's3-object-lambda'].indexOf(this.serviceName) > -1) && !request.body) {
  12448. return 'UNSIGNED-PAYLOAD';
  12449. } else if (request.headers['X-Amz-Content-Sha256']) {
  12450. return request.headers['X-Amz-Content-Sha256'];
  12451. } else {
  12452. return this.hexEncodedHash(this.request.body || '');
  12453. }
  12454. },
  12455. unsignableHeaders: [
  12456. 'authorization',
  12457. 'content-type',
  12458. 'content-length',
  12459. 'user-agent',
  12460. expiresHeader,
  12461. 'expect',
  12462. 'x-amzn-trace-id'
  12463. ],
  12464. isSignableHeader: function isSignableHeader(key) {
  12465. if (key.toLowerCase().indexOf('x-amz-') === 0) return true;
  12466. return this.unsignableHeaders.indexOf(key) < 0;
  12467. },
  12468. isPresigned: function isPresigned() {
  12469. return this.request.headers[expiresHeader] ? true : false;
  12470. }
  12471. });
  12472. /**
  12473. * @api private
  12474. */
  12475. module.exports = AWS.Signers.V4;
  12476. /***/ }),
  12477. /* 96 */
  12478. /***/ (function(module, exports, __webpack_require__) {
  12479. var AWS = __webpack_require__(1);
  12480. /**
  12481. * @api private
  12482. */
  12483. var cachedSecret = {};
  12484. /**
  12485. * @api private
  12486. */
  12487. var cacheQueue = [];
  12488. /**
  12489. * @api private
  12490. */
  12491. var maxCacheEntries = 50;
  12492. /**
  12493. * @api private
  12494. */
  12495. var v4Identifier = 'aws4_request';
  12496. /**
  12497. * @api private
  12498. */
  12499. module.exports = {
  12500. /**
  12501. * @api private
  12502. *
  12503. * @param date [String]
  12504. * @param region [String]
  12505. * @param serviceName [String]
  12506. * @return [String]
  12507. */
  12508. createScope: function createScope(date, region, serviceName) {
  12509. return [
  12510. date.substr(0, 8),
  12511. region,
  12512. serviceName,
  12513. v4Identifier
  12514. ].join('/');
  12515. },
  12516. /**
  12517. * @api private
  12518. *
  12519. * @param credentials [Credentials]
  12520. * @param date [String]
  12521. * @param region [String]
  12522. * @param service [String]
  12523. * @param shouldCache [Boolean]
  12524. * @return [String]
  12525. */
  12526. getSigningKey: function getSigningKey(
  12527. credentials,
  12528. date,
  12529. region,
  12530. service,
  12531. shouldCache
  12532. ) {
  12533. var credsIdentifier = AWS.util.crypto
  12534. .hmac(credentials.secretAccessKey, credentials.accessKeyId, 'base64');
  12535. var cacheKey = [credsIdentifier, date, region, service].join('_');
  12536. shouldCache = shouldCache !== false;
  12537. if (shouldCache && (cacheKey in cachedSecret)) {
  12538. return cachedSecret[cacheKey];
  12539. }
  12540. var kDate = AWS.util.crypto.hmac(
  12541. 'AWS4' + credentials.secretAccessKey,
  12542. date,
  12543. 'buffer'
  12544. );
  12545. var kRegion = AWS.util.crypto.hmac(kDate, region, 'buffer');
  12546. var kService = AWS.util.crypto.hmac(kRegion, service, 'buffer');
  12547. var signingKey = AWS.util.crypto.hmac(kService, v4Identifier, 'buffer');
  12548. if (shouldCache) {
  12549. cachedSecret[cacheKey] = signingKey;
  12550. cacheQueue.push(cacheKey);
  12551. if (cacheQueue.length > maxCacheEntries) {
  12552. // remove the oldest entry (not the least recently used)
  12553. delete cachedSecret[cacheQueue.shift()];
  12554. }
  12555. }
  12556. return signingKey;
  12557. },
  12558. /**
  12559. * @api private
  12560. *
  12561. * Empties the derived signing key cache. Made available for testing purposes
  12562. * only.
  12563. */
  12564. emptyCache: function emptyCache() {
  12565. cachedSecret = {};
  12566. cacheQueue = [];
  12567. }
  12568. };
  12569. /***/ }),
  12570. /* 97 */
  12571. /***/ (function(module, exports, __webpack_require__) {
  12572. var AWS = __webpack_require__(1);
  12573. var inherit = AWS.util.inherit;
  12574. /**
  12575. * @api private
  12576. */
  12577. AWS.Signers.S3 = inherit(AWS.Signers.RequestSigner, {
  12578. /**
  12579. * When building the stringToSign, these sub resource params should be
  12580. * part of the canonical resource string with their NON-decoded values
  12581. */
  12582. subResources: {
  12583. 'acl': 1,
  12584. 'accelerate': 1,
  12585. 'analytics': 1,
  12586. 'cors': 1,
  12587. 'lifecycle': 1,
  12588. 'delete': 1,
  12589. 'inventory': 1,
  12590. 'location': 1,
  12591. 'logging': 1,
  12592. 'metrics': 1,
  12593. 'notification': 1,
  12594. 'partNumber': 1,
  12595. 'policy': 1,
  12596. 'requestPayment': 1,
  12597. 'replication': 1,
  12598. 'restore': 1,
  12599. 'tagging': 1,
  12600. 'torrent': 1,
  12601. 'uploadId': 1,
  12602. 'uploads': 1,
  12603. 'versionId': 1,
  12604. 'versioning': 1,
  12605. 'versions': 1,
  12606. 'website': 1
  12607. },
  12608. // when building the stringToSign, these querystring params should be
  12609. // part of the canonical resource string with their NON-encoded values
  12610. responseHeaders: {
  12611. 'response-content-type': 1,
  12612. 'response-content-language': 1,
  12613. 'response-expires': 1,
  12614. 'response-cache-control': 1,
  12615. 'response-content-disposition': 1,
  12616. 'response-content-encoding': 1
  12617. },
  12618. addAuthorization: function addAuthorization(credentials, date) {
  12619. if (!this.request.headers['presigned-expires']) {
  12620. this.request.headers['X-Amz-Date'] = AWS.util.date.rfc822(date);
  12621. }
  12622. if (credentials.sessionToken) {
  12623. // presigned URLs require this header to be lowercased
  12624. this.request.headers['x-amz-security-token'] = credentials.sessionToken;
  12625. }
  12626. var signature = this.sign(credentials.secretAccessKey, this.stringToSign());
  12627. var auth = 'AWS ' + credentials.accessKeyId + ':' + signature;
  12628. this.request.headers['Authorization'] = auth;
  12629. },
  12630. stringToSign: function stringToSign() {
  12631. var r = this.request;
  12632. var parts = [];
  12633. parts.push(r.method);
  12634. parts.push(r.headers['Content-MD5'] || '');
  12635. parts.push(r.headers['Content-Type'] || '');
  12636. // This is the "Date" header, but we use X-Amz-Date.
  12637. // The S3 signing mechanism requires us to pass an empty
  12638. // string for this Date header regardless.
  12639. parts.push(r.headers['presigned-expires'] || '');
  12640. var headers = this.canonicalizedAmzHeaders();
  12641. if (headers) parts.push(headers);
  12642. parts.push(this.canonicalizedResource());
  12643. return parts.join('\n');
  12644. },
  12645. canonicalizedAmzHeaders: function canonicalizedAmzHeaders() {
  12646. var amzHeaders = [];
  12647. AWS.util.each(this.request.headers, function (name) {
  12648. if (name.match(/^x-amz-/i))
  12649. amzHeaders.push(name);
  12650. });
  12651. amzHeaders.sort(function (a, b) {
  12652. return a.toLowerCase() < b.toLowerCase() ? -1 : 1;
  12653. });
  12654. var parts = [];
  12655. AWS.util.arrayEach.call(this, amzHeaders, function (name) {
  12656. parts.push(name.toLowerCase() + ':' + String(this.request.headers[name]));
  12657. });
  12658. return parts.join('\n');
  12659. },
  12660. canonicalizedResource: function canonicalizedResource() {
  12661. var r = this.request;
  12662. var parts = r.path.split('?');
  12663. var path = parts[0];
  12664. var querystring = parts[1];
  12665. var resource = '';
  12666. if (r.virtualHostedBucket)
  12667. resource += '/' + r.virtualHostedBucket;
  12668. resource += path;
  12669. if (querystring) {
  12670. // collect a list of sub resources and query params that need to be signed
  12671. var resources = [];
  12672. AWS.util.arrayEach.call(this, querystring.split('&'), function (param) {
  12673. var name = param.split('=')[0];
  12674. var value = param.split('=')[1];
  12675. if (this.subResources[name] || this.responseHeaders[name]) {
  12676. var subresource = { name: name };
  12677. if (value !== undefined) {
  12678. if (this.subResources[name]) {
  12679. subresource.value = value;
  12680. } else {
  12681. subresource.value = decodeURIComponent(value);
  12682. }
  12683. }
  12684. resources.push(subresource);
  12685. }
  12686. });
  12687. resources.sort(function (a, b) { return a.name < b.name ? -1 : 1; });
  12688. if (resources.length) {
  12689. querystring = [];
  12690. AWS.util.arrayEach(resources, function (res) {
  12691. if (res.value === undefined) {
  12692. querystring.push(res.name);
  12693. } else {
  12694. querystring.push(res.name + '=' + res.value);
  12695. }
  12696. });
  12697. resource += '?' + querystring.join('&');
  12698. }
  12699. }
  12700. return resource;
  12701. },
  12702. sign: function sign(secret, string) {
  12703. return AWS.util.crypto.hmac(secret, string, 'base64', 'sha1');
  12704. }
  12705. });
  12706. /**
  12707. * @api private
  12708. */
  12709. module.exports = AWS.Signers.S3;
  12710. /***/ }),
  12711. /* 98 */
  12712. /***/ (function(module, exports, __webpack_require__) {
  12713. var AWS = __webpack_require__(1);
  12714. var inherit = AWS.util.inherit;
  12715. /**
  12716. * @api private
  12717. */
  12718. var expiresHeader = 'presigned-expires';
  12719. /**
  12720. * @api private
  12721. */
  12722. function signedUrlBuilder(request) {
  12723. var expires = request.httpRequest.headers[expiresHeader];
  12724. var signerClass = request.service.getSignerClass(request);
  12725. delete request.httpRequest.headers['User-Agent'];
  12726. delete request.httpRequest.headers['X-Amz-User-Agent'];
  12727. if (signerClass === AWS.Signers.V4) {
  12728. if (expires > 604800) { // one week expiry is invalid
  12729. var message = 'Presigning does not support expiry time greater ' +
  12730. 'than a week with SigV4 signing.';
  12731. throw AWS.util.error(new Error(), {
  12732. code: 'InvalidExpiryTime', message: message, retryable: false
  12733. });
  12734. }
  12735. request.httpRequest.headers[expiresHeader] = expires;
  12736. } else if (signerClass === AWS.Signers.S3) {
  12737. var now = request.service ? request.service.getSkewCorrectedDate() : AWS.util.date.getDate();
  12738. request.httpRequest.headers[expiresHeader] = parseInt(
  12739. AWS.util.date.unixTimestamp(now) + expires, 10).toString();
  12740. } else {
  12741. throw AWS.util.error(new Error(), {
  12742. message: 'Presigning only supports S3 or SigV4 signing.',
  12743. code: 'UnsupportedSigner', retryable: false
  12744. });
  12745. }
  12746. }
  12747. /**
  12748. * @api private
  12749. */
  12750. function signedUrlSigner(request) {
  12751. var endpoint = request.httpRequest.endpoint;
  12752. var parsedUrl = AWS.util.urlParse(request.httpRequest.path);
  12753. var queryParams = {};
  12754. if (parsedUrl.search) {
  12755. queryParams = AWS.util.queryStringParse(parsedUrl.search.substr(1));
  12756. }
  12757. var auth = request.httpRequest.headers['Authorization'].split(' ');
  12758. if (auth[0] === 'AWS') {
  12759. auth = auth[1].split(':');
  12760. queryParams['Signature'] = auth.pop();
  12761. queryParams['AWSAccessKeyId'] = auth.join(':');
  12762. AWS.util.each(request.httpRequest.headers, function (key, value) {
  12763. if (key === expiresHeader) key = 'Expires';
  12764. if (key.indexOf('x-amz-meta-') === 0) {
  12765. // Delete existing, potentially not normalized key
  12766. delete queryParams[key];
  12767. key = key.toLowerCase();
  12768. }
  12769. queryParams[key] = value;
  12770. });
  12771. delete request.httpRequest.headers[expiresHeader];
  12772. delete queryParams['Authorization'];
  12773. delete queryParams['Host'];
  12774. } else if (auth[0] === 'AWS4-HMAC-SHA256') { // SigV4 signing
  12775. auth.shift();
  12776. var rest = auth.join(' ');
  12777. var signature = rest.match(/Signature=(.*?)(?:,|\s|\r?\n|$)/)[1];
  12778. queryParams['X-Amz-Signature'] = signature;
  12779. delete queryParams['Expires'];
  12780. }
  12781. // build URL
  12782. endpoint.pathname = parsedUrl.pathname;
  12783. endpoint.search = AWS.util.queryParamsToString(queryParams);
  12784. }
  12785. /**
  12786. * @api private
  12787. */
  12788. AWS.Signers.Presign = inherit({
  12789. /**
  12790. * @api private
  12791. */
  12792. sign: function sign(request, expireTime, callback) {
  12793. request.httpRequest.headers[expiresHeader] = expireTime || 3600;
  12794. request.on('build', signedUrlBuilder);
  12795. request.on('sign', signedUrlSigner);
  12796. request.removeListener('afterBuild',
  12797. AWS.EventListeners.Core.SET_CONTENT_LENGTH);
  12798. request.removeListener('afterBuild',
  12799. AWS.EventListeners.Core.COMPUTE_SHA256);
  12800. request.emit('beforePresign', [request]);
  12801. if (callback) {
  12802. request.build(function() {
  12803. if (this.response.error) callback(this.response.error);
  12804. else {
  12805. callback(null, AWS.util.urlFormat(request.httpRequest.endpoint));
  12806. }
  12807. });
  12808. } else {
  12809. request.build();
  12810. if (request.response.error) throw request.response.error;
  12811. return AWS.util.urlFormat(request.httpRequest.endpoint);
  12812. }
  12813. }
  12814. });
  12815. /**
  12816. * @api private
  12817. */
  12818. module.exports = AWS.Signers.Presign;
  12819. /***/ }),
  12820. /* 99 */
  12821. /***/ (function(module, exports, __webpack_require__) {
  12822. var AWS = __webpack_require__(1);
  12823. /**
  12824. * @api private
  12825. */
  12826. AWS.Signers.Bearer = AWS.util.inherit(AWS.Signers.RequestSigner, {
  12827. constructor: function Bearer(request) {
  12828. AWS.Signers.RequestSigner.call(this, request);
  12829. },
  12830. addAuthorization: function addAuthorization(token) {
  12831. this.request.headers['Authorization'] = 'Bearer ' + token.token;
  12832. }
  12833. });
  12834. /***/ }),
  12835. /* 100 */
  12836. /***/ (function(module, exports, __webpack_require__) {
  12837. var AWS = __webpack_require__(1);
  12838. /**
  12839. * @api private
  12840. */
  12841. AWS.ParamValidator = AWS.util.inherit({
  12842. /**
  12843. * Create a new validator object.
  12844. *
  12845. * @param validation [Boolean|map] whether input parameters should be
  12846. * validated against the operation description before sending the
  12847. * request. Pass a map to enable any of the following specific
  12848. * validation features:
  12849. *
  12850. * * **min** [Boolean] &mdash; Validates that a value meets the min
  12851. * constraint. This is enabled by default when paramValidation is set
  12852. * to `true`.
  12853. * * **max** [Boolean] &mdash; Validates that a value meets the max
  12854. * constraint.
  12855. * * **pattern** [Boolean] &mdash; Validates that a string value matches a
  12856. * regular expression.
  12857. * * **enum** [Boolean] &mdash; Validates that a string value matches one
  12858. * of the allowable enum values.
  12859. */
  12860. constructor: function ParamValidator(validation) {
  12861. if (validation === true || validation === undefined) {
  12862. validation = {'min': true};
  12863. }
  12864. this.validation = validation;
  12865. },
  12866. validate: function validate(shape, params, context) {
  12867. this.errors = [];
  12868. this.validateMember(shape, params || {}, context || 'params');
  12869. if (this.errors.length > 1) {
  12870. var msg = this.errors.join('\n* ');
  12871. msg = 'There were ' + this.errors.length +
  12872. ' validation errors:\n* ' + msg;
  12873. throw AWS.util.error(new Error(msg),
  12874. {code: 'MultipleValidationErrors', errors: this.errors});
  12875. } else if (this.errors.length === 1) {
  12876. throw this.errors[0];
  12877. } else {
  12878. return true;
  12879. }
  12880. },
  12881. fail: function fail(code, message) {
  12882. this.errors.push(AWS.util.error(new Error(message), {code: code}));
  12883. },
  12884. validateStructure: function validateStructure(shape, params, context) {
  12885. if (shape.isDocument) return true;
  12886. this.validateType(params, context, ['object'], 'structure');
  12887. var paramName;
  12888. for (var i = 0; shape.required && i < shape.required.length; i++) {
  12889. paramName = shape.required[i];
  12890. var value = params[paramName];
  12891. if (value === undefined || value === null) {
  12892. this.fail('MissingRequiredParameter',
  12893. 'Missing required key \'' + paramName + '\' in ' + context);
  12894. }
  12895. }
  12896. // validate hash members
  12897. for (paramName in params) {
  12898. if (!Object.prototype.hasOwnProperty.call(params, paramName)) continue;
  12899. var paramValue = params[paramName],
  12900. memberShape = shape.members[paramName];
  12901. if (memberShape !== undefined) {
  12902. var memberContext = [context, paramName].join('.');
  12903. this.validateMember(memberShape, paramValue, memberContext);
  12904. } else if (paramValue !== undefined && paramValue !== null) {
  12905. this.fail('UnexpectedParameter',
  12906. 'Unexpected key \'' + paramName + '\' found in ' + context);
  12907. }
  12908. }
  12909. return true;
  12910. },
  12911. validateMember: function validateMember(shape, param, context) {
  12912. switch (shape.type) {
  12913. case 'structure':
  12914. return this.validateStructure(shape, param, context);
  12915. case 'list':
  12916. return this.validateList(shape, param, context);
  12917. case 'map':
  12918. return this.validateMap(shape, param, context);
  12919. default:
  12920. return this.validateScalar(shape, param, context);
  12921. }
  12922. },
  12923. validateList: function validateList(shape, params, context) {
  12924. if (this.validateType(params, context, [Array])) {
  12925. this.validateRange(shape, params.length, context, 'list member count');
  12926. // validate array members
  12927. for (var i = 0; i < params.length; i++) {
  12928. this.validateMember(shape.member, params[i], context + '[' + i + ']');
  12929. }
  12930. }
  12931. },
  12932. validateMap: function validateMap(shape, params, context) {
  12933. if (this.validateType(params, context, ['object'], 'map')) {
  12934. // Build up a count of map members to validate range traits.
  12935. var mapCount = 0;
  12936. for (var param in params) {
  12937. if (!Object.prototype.hasOwnProperty.call(params, param)) continue;
  12938. // Validate any map key trait constraints
  12939. this.validateMember(shape.key, param,
  12940. context + '[key=\'' + param + '\']');
  12941. this.validateMember(shape.value, params[param],
  12942. context + '[\'' + param + '\']');
  12943. mapCount++;
  12944. }
  12945. this.validateRange(shape, mapCount, context, 'map member count');
  12946. }
  12947. },
  12948. validateScalar: function validateScalar(shape, value, context) {
  12949. switch (shape.type) {
  12950. case null:
  12951. case undefined:
  12952. case 'string':
  12953. return this.validateString(shape, value, context);
  12954. case 'base64':
  12955. case 'binary':
  12956. return this.validatePayload(value, context);
  12957. case 'integer':
  12958. case 'float':
  12959. return this.validateNumber(shape, value, context);
  12960. case 'boolean':
  12961. return this.validateType(value, context, ['boolean']);
  12962. case 'timestamp':
  12963. return this.validateType(value, context, [Date,
  12964. /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$/, 'number'],
  12965. 'Date object, ISO-8601 string, or a UNIX timestamp');
  12966. default:
  12967. return this.fail('UnkownType', 'Unhandled type ' +
  12968. shape.type + ' for ' + context);
  12969. }
  12970. },
  12971. validateString: function validateString(shape, value, context) {
  12972. var validTypes = ['string'];
  12973. if (shape.isJsonValue) {
  12974. validTypes = validTypes.concat(['number', 'object', 'boolean']);
  12975. }
  12976. if (value !== null && this.validateType(value, context, validTypes)) {
  12977. this.validateEnum(shape, value, context);
  12978. this.validateRange(shape, value.length, context, 'string length');
  12979. this.validatePattern(shape, value, context);
  12980. this.validateUri(shape, value, context);
  12981. }
  12982. },
  12983. validateUri: function validateUri(shape, value, context) {
  12984. if (shape['location'] === 'uri') {
  12985. if (value.length === 0) {
  12986. this.fail('UriParameterError', 'Expected uri parameter to have length >= 1,'
  12987. + ' but found "' + value +'" for ' + context);
  12988. }
  12989. }
  12990. },
  12991. validatePattern: function validatePattern(shape, value, context) {
  12992. if (this.validation['pattern'] && shape['pattern'] !== undefined) {
  12993. if (!(new RegExp(shape['pattern'])).test(value)) {
  12994. this.fail('PatternMatchError', 'Provided value "' + value + '" '
  12995. + 'does not match regex pattern /' + shape['pattern'] + '/ for '
  12996. + context);
  12997. }
  12998. }
  12999. },
  13000. validateRange: function validateRange(shape, value, context, descriptor) {
  13001. if (this.validation['min']) {
  13002. if (shape['min'] !== undefined && value < shape['min']) {
  13003. this.fail('MinRangeError', 'Expected ' + descriptor + ' >= '
  13004. + shape['min'] + ', but found ' + value + ' for ' + context);
  13005. }
  13006. }
  13007. if (this.validation['max']) {
  13008. if (shape['max'] !== undefined && value > shape['max']) {
  13009. this.fail('MaxRangeError', 'Expected ' + descriptor + ' <= '
  13010. + shape['max'] + ', but found ' + value + ' for ' + context);
  13011. }
  13012. }
  13013. },
  13014. validateEnum: function validateRange(shape, value, context) {
  13015. if (this.validation['enum'] && shape['enum'] !== undefined) {
  13016. // Fail if the string value is not present in the enum list
  13017. if (shape['enum'].indexOf(value) === -1) {
  13018. this.fail('EnumError', 'Found string value of ' + value + ', but '
  13019. + 'expected ' + shape['enum'].join('|') + ' for ' + context);
  13020. }
  13021. }
  13022. },
  13023. validateType: function validateType(value, context, acceptedTypes, type) {
  13024. // We will not log an error for null or undefined, but we will return
  13025. // false so that callers know that the expected type was not strictly met.
  13026. if (value === null || value === undefined) return false;
  13027. var foundInvalidType = false;
  13028. for (var i = 0; i < acceptedTypes.length; i++) {
  13029. if (typeof acceptedTypes[i] === 'string') {
  13030. if (typeof value === acceptedTypes[i]) return true;
  13031. } else if (acceptedTypes[i] instanceof RegExp) {
  13032. if ((value || '').toString().match(acceptedTypes[i])) return true;
  13033. } else {
  13034. if (value instanceof acceptedTypes[i]) return true;
  13035. if (AWS.util.isType(value, acceptedTypes[i])) return true;
  13036. if (!type && !foundInvalidType) acceptedTypes = acceptedTypes.slice();
  13037. acceptedTypes[i] = AWS.util.typeName(acceptedTypes[i]);
  13038. }
  13039. foundInvalidType = true;
  13040. }
  13041. var acceptedType = type;
  13042. if (!acceptedType) {
  13043. acceptedType = acceptedTypes.join(', ').replace(/,([^,]+)$/, ', or$1');
  13044. }
  13045. var vowel = acceptedType.match(/^[aeiou]/i) ? 'n' : '';
  13046. this.fail('InvalidParameterType', 'Expected ' + context + ' to be a' +
  13047. vowel + ' ' + acceptedType);
  13048. return false;
  13049. },
  13050. validateNumber: function validateNumber(shape, value, context) {
  13051. if (value === null || value === undefined) return;
  13052. if (typeof value === 'string') {
  13053. var castedValue = parseFloat(value);
  13054. if (castedValue.toString() === value) value = castedValue;
  13055. }
  13056. if (this.validateType(value, context, ['number'])) {
  13057. this.validateRange(shape, value, context, 'numeric value');
  13058. }
  13059. },
  13060. validatePayload: function validatePayload(value, context) {
  13061. if (value === null || value === undefined) return;
  13062. if (typeof value === 'string') return;
  13063. if (value && typeof value.byteLength === 'number') return; // typed arrays
  13064. if (AWS.util.isNode()) { // special check for buffer/stream in Node.js
  13065. var Stream = AWS.util.stream.Stream;
  13066. if (AWS.util.Buffer.isBuffer(value) || value instanceof Stream) return;
  13067. } else {
  13068. if (typeof Blob !== void 0 && value instanceof Blob) return;
  13069. }
  13070. var types = ['Buffer', 'Stream', 'File', 'Blob', 'ArrayBuffer', 'DataView'];
  13071. if (value) {
  13072. for (var i = 0; i < types.length; i++) {
  13073. if (AWS.util.isType(value, types[i])) return;
  13074. if (AWS.util.typeName(value.constructor) === types[i]) return;
  13075. }
  13076. }
  13077. this.fail('InvalidParameterType', 'Expected ' + context + ' to be a ' +
  13078. 'string, Buffer, Stream, Blob, or typed array object');
  13079. }
  13080. });
  13081. /***/ }),
  13082. /* 101 */
  13083. /***/ (function(module, exports, __webpack_require__) {
  13084. /* WEBPACK VAR INJECTION */(function(process) {var warning = [
  13085. 'The AWS SDK for JavaScript (v2) will enter maintenance mode',
  13086. 'on September 8, 2024 and reach end-of-support on September 8, 2025.\n',
  13087. 'Please migrate your code to use AWS SDK for JavaScript (v3).',
  13088. 'For more information, check blog post at https://a.co/cUPnyil'
  13089. ].join('\n');
  13090. module.exports = {
  13091. suppress: false
  13092. };
  13093. /**
  13094. * To suppress this message:
  13095. * @example
  13096. * require('aws-sdk/lib/maintenance_mode_message').suppress = true;
  13097. */
  13098. function emitWarning() {
  13099. if (typeof process === 'undefined')
  13100. return;
  13101. // Skip maintenance mode message in Lambda environments
  13102. if (
  13103. typeof process.env === 'object' &&
  13104. typeof process.env.AWS_EXECUTION_ENV !== 'undefined' &&
  13105. process.env.AWS_EXECUTION_ENV.indexOf('AWS_Lambda_') === 0
  13106. ) {
  13107. return;
  13108. }
  13109. if (
  13110. typeof process.env === 'object' &&
  13111. typeof process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE !== 'undefined'
  13112. ) {
  13113. return;
  13114. }
  13115. if (typeof process.emitWarning === 'function') {
  13116. process.emitWarning(warning, {
  13117. type: 'NOTE'
  13118. });
  13119. }
  13120. }
  13121. setTimeout(function () {
  13122. if (!module.exports.suppress) {
  13123. emitWarning();
  13124. }
  13125. }, 0);
  13126. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  13127. /***/ })
  13128. /******/ ])
  13129. });
  13130. ;