UNPKG

packagecloud

Version:
2 lines (1 loc) 22.4 kB
!function(){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var r=0;r<e.length;r++){var s=e[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}var f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){function r(t){if(t)return function(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}(t)}(t.exports=r).prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,s=this._callbacks["$"+t];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<s.length;o++)if((r=s[o])===e||r.fn===e){s.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r)for(var s=0,o=(r=r.slice(0)).length;s<o;++s)r[s].apply(this,e);return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),r=Object.freeze({default:e,__moduleExports:e});var n=function(t){return null!==t&&"object"==typeof t},i=Object.freeze({default:n,__moduleExports:n}),d=i&&n||i,a=u;function u(t){if(t)return function(t){for(var e in u.prototype)t[e]=u.prototype[e];return t}(t)}u.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},u.prototype.parse=function(t){return this._parser=t,this},u.prototype.responseType=function(t){return this._responseType=t,this},u.prototype.serialize=function(t){return this._serializer=t,this},u.prototype.timeout=function(t){if(!t||"object"!=typeof t)return this._timeout=t,this._responseTimeout=0,this;for(var e in t)switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;default:console.warn("Unknown timeout option",e)}return this},u.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var p=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];u.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(t){console.error(t)}if(e&&e.status&&500<=e.status&&501!=e.status)return!0;if(t){if(t.code&&~p.indexOf(t.code))return!0;if(t.timeout&&"ECONNABORTED"==t.code)return!0;if(t.crossDomain)return!0}return!1},u.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},u.prototype.then=function(t,e){if(!this._fullfilledPromise){var o=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(r,s){o.end(function(t,e){t?s(t):r(e)})})}return this._fullfilledPromise.then(t,e)},u.prototype.catch=function(t){return this.then(void 0,t)},u.prototype.use=function(t){return t(this),this},u.prototype.ok=function(t){if("function"!=typeof t)throw Error("Callback required");return this._okCallback=t,this},u.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):200<=t.status&&t.status<300)},u.prototype.getHeader=u.prototype.get=function(t){return this._header[t.toLowerCase()]},u.prototype.set=function(t,e){if(d(t)){for(var r in t)this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},u.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},u.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),d(t)){for(var r in t)this.field(r,t[r]);return this}if(Array.isArray(e)){for(var s in e)this.field(t,e[s]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},u.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},u.prototype._auth=function(t,e,r,s){switch(r.type){case"basic":this.set("Authorization","Basic "+s(t+":"+e));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer "+t)}return this},u.prototype.withCredentials=function(t){return null==t&&(t=!0),this._withCredentials=t,this},u.prototype.redirects=function(t){return this._maxRedirects=t,this},u.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw TypeError("Invalid argument");return this._maxResponseSize=t,this},u.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},u.prototype.send=function(t){var e=d(t),r=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&d(this._data))for(var s in t)this._data[s]=t[s];else this._data="string"==typeof t?(r||this.type("form"),"application/x-www-form-urlencoded"==(r=this._header["content-type"])?this._data?this._data+"&"+t:t:(this._data||"")+t):t;return!e||this._isHost(t)||r||this.type("json"),this},u.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},u.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(0<=this.url.indexOf("?")?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(0<=e){var r=this.url.substring(e+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.substring(0,e)+"?"+r.join("&")}}},u.prototype._appendQueryString=function(){console.trace("Unsupported")},u.prototype._timeoutError=function(t,e,r){if(!this._aborted){var s=new Error(t+e+"ms exceeded");s.timeout=e,s.code="ECONNABORTED",s.errno=r,this.timedout=!0,this.abort(),this.callback(s)}},u.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var h=Object.freeze({default:a,__moduleExports:a}),c=function(t){return t.split(/ *; */).shift()},l=function(t){return t.split(/ *; */).reduce(function(t,e){var r=e.split(/ *= */),s=r.shift(),o=r.shift();return s&&o&&(t[s]=o),t},{})},y=function(t){return t.split(/ *, */).reduce(function(t,e){var r=e.split(/ *; */),s=r[0].slice(1,-1);return t[r[1].split(/ *= */)[1].slice(1,-1)]=s,t},{})},m=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&(delete t.authorization,delete t.cookie),t},_={type:c,params:l,parseLinks:y,cleanHeader:m},b=Object.freeze({default:_,__moduleExports:_,type:c,params:l,parseLinks:y,cleanHeader:m}),v=b&&_||b,g=w;function w(t){if(t)return function(t){for(var e in w.prototype)t[e]=w.prototype[e];return t}(t)}w.prototype.get=function(t){return this.header[t.toLowerCase()]},w.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=v.type(e);var r=v.params(e);for(var s in r)this[s]=r[s];this.links={};try{t.link&&(this.links=v.parseLinks(t.link))}catch(t){}},w.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.created=201==t,this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t,this.unprocessableEntity=422==t};var k=Object.freeze({default:g,__moduleExports:g});function T(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach(function(t){T.prototype[t]=function(){return this._defaults.push({fn:t,arguments:arguments}),this}}),T.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,t.arguments)})};var E=T,x=Object.freeze({default:E,__moduleExports:E}),j=r&&e||r,O=h&&a||h,q=k&&g||k,P=x&&E||x,R=t(function(t,r){var e;function s(){}e="undefined"!=typeof window?window:"undefined"!=typeof self?self:(console.warn("Using browser-only version of superagent in non-browser environment"),f);var a=r=t.exports=function(t,e){return"function"==typeof e?new r.Request("GET",t).end(e):1==arguments.length?new r.Request("GET",t):new r.Request(t,e)};r.Request=c,a.getXHR=function(){if(!(!e.XMLHttpRequest||e.location&&"file:"==e.location.protocol&&e.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only version of superagent could not find XHR")};var p="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function o(t){if(!d(t))return t;var e=[];for(var r in t)n(e,r,t[r]);return e.join("&")}function n(e,r,t){if(null!=t)if(Array.isArray(t))t.forEach(function(t){n(e,r,t)});else if(d(t))for(var s in t)n(e,r+"["+s+"]",t[s]);else e.push(encodeURIComponent(r)+"="+encodeURIComponent(t));else null===t&&e.push(encodeURIComponent(r))}function i(t){for(var e,r,s={},o=t.split("&"),n=0,i=o.length;n<i;++n)-1==(r=(e=o[n]).indexOf("="))?s[decodeURIComponent(e)]="":s[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return s}function u(t){return/[\/+]json($|[^-\w])/.test(t)}function h(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.header=this.headers=function(t){for(var e,r,s,o,n=t.split(/\r?\n/),i={},a=0,u=n.length;a<u;++a)-1!==(e=(r=n[a]).indexOf(":"))&&(s=r.slice(0,e).toLowerCase(),o=p(r.slice(e+1)),i[s]=o);return i}(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function c(t,e){var s=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var e,r=null,t=null;try{t=new h(s)}catch(t){return(r=new Error("Parser is unable to parse the response")).parse=!0,r.original=t,s.xhr?(r.rawResponse=void 0===s.xhr.responseType?s.xhr.responseText:s.xhr.response,r.status=s.xhr.status?s.xhr.status:null,r.statusCode=r.status):(r.rawResponse=null,r.status=null),s.callback(r)}s.emit("response",t);try{s._isResponseOK(t)||(e=new Error(t.statusText||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=r,e.response=t,e.status=t.status,s.callback(e,t)):s.callback(null,t)})}function l(t,e,r){var s=a("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&s.send(e),r&&s.end(r),s}a.serializeObject=o,a.parseString=i,a.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},a.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},a.parse={"application/x-www-form-urlencoded":i,"application/json":JSON.parse},q(h.prototype),h.prototype._parseBody=function(t){var e=a.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&u(this.type)&&(e=a.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null)},h.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,s="cannot "+e+" "+r+" ("+this.status+")",o=new Error(s);return o.status=this.status,o.method=e,o.url=r,o},a.Response=h,j(c.prototype),O(c.prototype),c.prototype.type=function(t){return this.set("Content-Type",a.types[t]||t),this},c.prototype.accept=function(t){return this.set("Accept",a.types[t]||t),this},c.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"==typeof e&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});return this._auth(t,e,r,function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")})},c.prototype.query=function(t){return"string"!=typeof t&&(t=o(t)),t&&this._query.push(t),this},c.prototype.attach=function(t,e,r){if(e){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},c.prototype._getFormData=function(){return this._formData||(this._formData=new e.FormData),this._formData},c.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},c.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},c.prototype.buffer=c.prototype.ca=c.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},c.prototype.pipe=c.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},c.prototype._isHost=function(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},c.prototype.end=function(t){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||s,this._finalizeQueryString(),this._end()},c.prototype._end=function(){var r=this,s=this.xhr=a.getXHR(),t=this._formData||this._data;this._setTimeouts(),s.onreadystatechange=function(){var t=s.readyState;if(2<=t&&r._responseTimeoutTimer&&clearTimeout(r._responseTimeoutTimer),4==t){var e;try{e=s.status}catch(t){e=0}if(!e){if(r.timedout||r._aborted)return;return r.crossDomainError()}r.emit("end")}};var e=function(t,e){0<e.total&&(e.percent=e.loaded/e.total*100),e.direction=t,r.emit("progress",e)};if(this.hasListeners("progress"))try{s.onprogress=e.bind(null,"download"),s.upload&&(s.upload.onprogress=e.bind(null,"upload"))}catch(t){}try{this.username&&this.password?s.open(this.method,this.url,!0,this.username,this.password):s.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(s.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof t&&!this._isHost(t)){var o=this._header["content-type"],n=this._serializer||a.serialize[o?o.split(";")[0]:""];!n&&u(o)&&(n=a.serialize["application/json"]),n&&(t=n(t))}for(var i in this.header)null!=this.header[i]&&this.header.hasOwnProperty(i)&&s.setRequestHeader(i,this.header[i]);return this._responseType&&(s.responseType=this._responseType),this.emit("request",this),s.send(void 0!==t?t:null),this},a.agent=function(){return new P},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(s){P.prototype[s.toLowerCase()]=function(t,e){var r=new a.Request(s,t);return this._setDefaults(r),e&&r.end(e),r}}),P.prototype.del=P.prototype.delete,a.get=function(t,e,r){var s=a("GET",t);return"function"==typeof e&&(r=e,e=null),e&&s.query(e),r&&s.end(r),s},a.head=function(t,e,r){var s=a("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&s.query(e),r&&s.end(r),s},a.options=function(t,e,r){var s=a("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&s.send(e),r&&s.end(r),s},a.del=l,a.delete=l,a.patch=function(t,e,r){var s=a("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&s.send(e),r&&s.end(r),s},a.post=function(t,e,r){var s=a("POST",t);return"function"==typeof e&&(r=e,e=null),e&&s.send(e),r&&s.end(r),s},a.put=function(t,e,r){var s=a("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&s.send(e),r&&s.end(r),s}}),C=(R.Request,function(t,e){var r=t||{};if("object"!==s(r))throw new Error("The packagecloud client expects an object with a token field: {token: api_token}");e.forEach(function(t){if(!(t in r))throw"token"===t?new Error("packagecloud API token is required: {token: packagecloud_api_token}"):new Error("missing field: ".concat(t));if(!r[t])throw new Error("".concat(t," cannot be null or undefined"));switch(t){case"repo":if(r.repo.split("/").length<2)throw new Error("The repo field must be in the format: username/reponame")}})}),H={upload:function(t,e,r){var s={filename:r.filename};return r.dist&&(s["package[distro_version_id]"]=r.dist),e.post(t).field(s).attach("package[package_file]",r.file)}},A={versionedPackageString:function(t){switch(t){case"java":return"java/maven2";case"gem":case"python":return t}}},D=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),C(t,["token"]),this.token=t.token,this.baseUrl=(t.baseUrl||"https://packagecloud.io").replace(/\/+$/,""),this.requestOptions={baseUrl:"".concat(this.baseUrl,"/").concat("api/v1","/")}}var t,r,s;return t=e,(r=[{key:"_setHeaders",value:function(t){return t.auth(this.token,"").set({"X-packagecloud-JS-Client":"0.2.2"})}},{key:"createRepository",value:function(t){var e=Object.assign({},this.requestOptions,t);return this._setHeaders(function(t,e){C(e,["name"]);var r=[!!e.privacy,e.name],s={repository:{name:r[1],private:r[0]}};return t.post(e.baseUrl+"repos.json").send(s)}(R,e))}},{key:"showRepository",value:function(t){var e,r,s=Object.assign({},this.requestOptions,t);return this._setHeaders((e=R,C(r=s,["repo"]),e.get([r.baseUrl+"repos",r.repo+".json"].join("/"))))}},{key:"getRepositories",value:function(){return this._setHeaders((t=R,e=this.requestOptions,t.get(e.baseUrl+"repos.json")));var t,e}},{key:"getDistributions",value:function(){return this._setHeaders((t=R,e=this.requestOptions,t.get(e.baseUrl+"distributions.json")));var t,e}},{key:"listPackages",value:function(t){var e,r,s=Object.assign({},this.requestOptions,t);return this._setHeaders((e=R,C(r=s,["repo"]),e.get([r.baseUrl+"repos",r.repo,"packages.json"].join("/"))))}},{key:"searchPackages",value:function(t){var e=Object.assign({},this.requestOptions,t);return this._setHeaders(function(t,e){C(e,["repo"]);var r={q:e.filename||"",filter:e.type,dist:e.dist,perPage:e.perPage};return t.get([e.baseUrl+"repos",e.repo,"search.json"].join("/")).query(r)}(R,e))}},{key:"deletePackage",value:function(t){var e,r,s,o=Object.assign({},this.requestOptions,t);return this._setHeaders((e=R,s=[(r=o).baseUrl+"repos",r.repository,r.distroFqname,r.group,r.filename].filter(Boolean).join("/"),e.delete(s).send({scope:r.scope})))}},{key:"uploadPackage",value:function(t){var e=Object.assign({},this.requestOptions,t);return this._setHeaders(function(t,e){if(!e||!e.repo||e.repo.split("/").length<2)throw new Error("Repository path must be in the fully-qualified format - user/repo");if(!e.file)throw new Error("Expects an object with string file path (node) or File (browser) as a value");if(!e.filename)throw new Error("Expects a filename");var r=[e.baseUrl+"repos",e.repo,"packages.json"].join("/");return H.upload(r,t,e)}(R,e))}},{key:"promotePackage",value:function(t){var e,r,s,o=Object.assign({},this.requestOptions,t);return this._setHeaders((e=R,s=[(r=o).baseUrl+"repos",r.sourceRepo,r.distroFqname,r.group,r.filename,"promote.json"].filter(Boolean).join("/"),e.post(s).send({destination:r.destination,group:r.group,scope:r.scope})))}},{key:"showPackage",value:function(t){var e=Object.assign({},this.requestOptions,t);return this._setHeaders(function(t,e){C(e,["repo","type","distro","distroVersion","packageName","arch","version"]);var r=[e.version,e.release],s=r[0],o=r[1];return e.release?o=e.release+".json":s=e.version+".json",t.get([e.baseUrl+"repos",e.repo,"package",e.type,e.distro,e.distroVersion,e.packageName,e.arch,s,o].join("/").replace(/\/+$/,""))}(R,e))}},{key:"showVersionedPackage",value:function(t){var e=Object.assign({},this.requestOptions,t);return this._setHeaders(function(t,e){C(e,["repo","type","packageName","version"]);var r=e.repo,s=e.packageName,o=e.version,n=A.versionedPackageString(e.type);return t.get([e.baseUrl+"repos",r,"package",n,s,o+".json"].join("/"))}(R,e))}},{key:"showGemPackage",value:function(t){return t.type="gem",this.showVersionedPackage(t)}},{key:"showPythonPackage",value:function(t){return t.type="python",this.showVersionedPackage(t)}},{key:"showJavaPackage",value:function(t){return t.type="java",this.showVersionedPackage(t)}}])&&o(t.prototype,r),s&&o(t,s),e}();window.packagecloud=D}();