action-debian-package/node_modules/docker-hub-utils/dist/docker-hub-utils.cjs.production.min.js
Dawid Dziurla 9308795b8b
update
2020-03-26 15:37:35 +01:00

3 lines
3.1 KiB
JavaScript

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,s,i=e(require("axios")),o=e(require("camelcase-keys")),n=require("luxon"),a=e(require("ramda")),u=e(require("pino"));(r=exports.Architecture||(exports.Architecture={})).i386="386",r.amd64="amd64",r.arm="arm",r.arm64="arm64",r.mips="mips",r.mips64="mips64",r.mips64le="mips64le",r.mipsle="mipsle",r.ppc64="ppc64",r.ppc64le="ppc64le",r.s390x="s390x",r.wasm="wasm",function(e){e.aix="aix",e.android="android",e.darwin="darwin",e.dragonfly="dragonfly",e.freebsd="freebsd",e.illumos="illumos",e.js="js",e.linux="linux",e.netbsd="netbsd",e.openbsd="openbsd",e.plan9="plan9",e.solaris="solaris",e.windows="windows"}(t||(t={})),(s=exports.ManifestMediaType||(exports.ManifestMediaType={})).Manifest="application/vnd.docker.distribution.manifest.v2+json",s.ManifestList="application/vnd.docker.distribution.manifest.list.v2+json";var p=u({base:null,useLevelLabels:!0}),c=function(e){return"https://hub.docker.com/v2/repositories/"+e},d=function(e){try{return Promise.resolve(i.get("https://auth.docker.io/token",{params:{scope:"repository:"+e.user+"/"+e.name+":pull",service:"registry.docker.io"}})).then((function(e){var r=a.path(["data","token"],e);if(!r)throw new Error("Unable to retrieve auth token from registry.");return r}))}catch(e){return Promise.reject(e)}},m=function(e,r){if(!e||a.isEmpty(e))return[];var t=o(e);return a.isNil(r)?t:t.filter((function(e){return n.DateTime.fromISO(e.lastUpdated)<r}))};exports.DOCKER_HUB_API_AUTH_URL="https://auth.docker.io/token",exports.DOCKER_HUB_API_ROOT="https://hub.docker.com/v2/",exports.extractRepositoryDetails=m,exports.fetchDockerHubToken=d,exports.fetchManifestList=function(e){try{return Promise.resolve(d(e)).then((function(r){var t=function(e){var r=e.repo;return"https://registry-1.docker.io/v2/"+r.user+"/"+r.name+"/manifests/latest"}({repo:e});return Promise.resolve(i.get(t,{headers:{Accept:"application/vnd.docker.distribution.manifest.list.v2+json",Authorization:"Bearer "+r}})).then((function(r){if(1!==r.data.schemaVersion)return a.path(["data"],r);p.info("Schema version 1 is unsupported.",e.name)}))}))}catch(e){return Promise.reject(e)}},exports.queryRepo=function(e){var r=e.name,t=e.user;try{return Promise.resolve(i.request({url:"https://hub.docker.com/v2/repositories/"+t+"/"+r+"/"})).then((function(e){var r=a.prop("data",e);if(200===e.status&&r&&!a.isEmpty(r))return o(r)}))}catch(e){return Promise.reject(e)}},exports.queryTags=function(e){try{var r=c(e.user);return Promise.resolve(i.get(r+"/"+e.name+"/tags?page_size=100")).then((function(e){var r=a.path(["data","results"],e);if(r&&!a.isEmpty(r))return o(r)}))}catch(e){return Promise.reject(e)}},exports.queryTopRepos=function(e){var r=e.lastUpdatedSince,t=e.numRepos,s=void 0===t?100:t,o=e.user;try{if(s>100)throw new RangeError("Number of repos to query cannot exceed 100.");var n=c(o);return Promise.resolve(i.get(n,{params:{page:1,page_size:s}})).then((function(e){var t=a.path(["data","results"],e);return m(t,r)}))}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=docker-hub-utils.cjs.production.min.js.map