This commit is contained in:
Dawid Dziurla 2020-03-26 15:37:35 +01:00
parent d9becc67b6
commit 9308795b8b
No known key found for this signature in database
GPG key ID: 7B6D8368172E9B0B
964 changed files with 104265 additions and 16 deletions

View file

@ -0,0 +1,272 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var axios = _interopDefault(require('axios'));
var camelcaseKeys = _interopDefault(require('camelcase-keys'));
var luxon = require('luxon');
var R = _interopDefault(require('ramda'));
var pino = _interopDefault(require('pino'));
/**
* Union type representing the architecture defined in part of an OCI image's
* manifest list.
*
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
* image architecture values, and vice versa:
* > The platform object describes the platform which the image in the manifest
* > runs on. A full list of valid operating system and architecture values are
* > listed in the Go language documentation for $GOOS and $GOARCH
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
*/
(function (Architecture) {
Architecture["i386"] = "386";
Architecture["amd64"] = "amd64";
Architecture["arm"] = "arm";
Architecture["arm64"] = "arm64";
Architecture["mips"] = "mips";
Architecture["mips64"] = "mips64";
Architecture["mips64le"] = "mips64le";
Architecture["mipsle"] = "mipsle";
Architecture["ppc64"] = "ppc64";
Architecture["ppc64le"] = "ppc64le";
Architecture["s390x"] = "s390x";
Architecture["wasm"] = "wasm";
})(exports.Architecture || (exports.Architecture = {}));
/**
* Union type representing the OS defined in part of an OCI image's
* manifest list.
* See the docs for the `Architecture` type above for more info.
*/
var OS;
(function (OS) {
OS["aix"] = "aix";
OS["android"] = "android";
OS["darwin"] = "darwin";
OS["dragonfly"] = "dragonfly";
OS["freebsd"] = "freebsd";
OS["illumos"] = "illumos";
OS["js"] = "js";
OS["linux"] = "linux";
OS["netbsd"] = "netbsd";
OS["openbsd"] = "openbsd";
OS["plan9"] = "plan9";
OS["solaris"] = "solaris";
OS["windows"] = "windows";
})(OS || (OS = {}));
(function (ManifestMediaType) {
ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json";
ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json";
})(exports.ManifestMediaType || (exports.ManifestMediaType = {}));
var log = /*#__PURE__*/
pino({
base: null,
useLevelLabels: true
});
var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/';
var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token';
/**
* Currently only supports fetching the manifest for the `latest` tag; in
* reality, we can pass any valid content digest[1] to retrieve the manifest(s)
* for that image.
*
* [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests
*/
var createManifestListURL = function createManifestListURL(_ref) {
var repo = _ref.repo;
return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest";
};
var createUserReposListURL = function createUserReposListURL(user) {
return DOCKER_HUB_API_ROOT + "repositories/" + user;
};
/**
* The OCI distribution spec requires a unique token for each repo manifest queried.
*/
var fetchDockerHubToken = function fetchDockerHubToken(repo) {
try {
var name = repo.name,
user = repo.user;
return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, {
params: {
scope: "repository:" + user + "/" + name + ":pull",
service: 'registry.docker.io'
}
})).then(function (tokenRequest) {
var token = R.path(['data', 'token'], tokenRequest);
if (!token) {
throw new Error('Unable to retrieve auth token from registry.');
}
return token;
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Pure function that massages the Docker Hub API response into the
* format we want to return. e.g., only extracting certain fields;
* converting snake_case to camelCase, etc.
*/
var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) {
if (!repos || R.isEmpty(repos)) {
return [];
}
var parsedRepos = camelcaseKeys(repos);
if (R.isNil(lastUpdatedSince)) {
return parsedRepos;
}
return parsedRepos.filter(function (repo) {
return luxon.DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince;
});
};
/**
* Query a single repository given a repo name and username.
*
* @param user The DockerHub username or org name to query for.
* @param name The DockerHub repo name -- restrict to this single repo.
*/
var queryRepo = function queryRepo(_ref2) {
var name = _ref2.name,
user = _ref2.user;
try {
return Promise.resolve(axios.request({
url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/"
})).then(function (repoResult) {
var repo = R.prop('data', repoResult);
if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {
return;
}
return camelcaseKeys(repo);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Top-level function for querying repositories.
*
* @TODO Rename to just `queryRepos`.
*
* @param user The DockerHub username or org name to query for.
* @param numRepos The number of repos to query (max 100).
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
*/
var queryTopRepos = function queryTopRepos(_ref3) {
var lastUpdatedSince = _ref3.lastUpdatedSince,
_ref3$numRepos = _ref3.numRepos,
numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos,
user = _ref3.user;
try {
if (numRepos > 100) {
throw new RangeError('Number of repos to query cannot exceed 100.');
}
var listReposURL = createUserReposListURL(user);
return Promise.resolve(axios.get(listReposURL, {
params: {
page: 1,
page_size: numRepos
}
})).then(function (repoResults) {
var repos = R.path(['data', 'results'], repoResults);
return extractRepositoryDetails(repos, lastUpdatedSince);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Query image tags.
*/
var queryTags = function queryTags(repo) {
try {
var repoUrl = createUserReposListURL(repo.user);
var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100";
return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) {
var tags = R.path(['data', 'results'], tagsResults);
if (!tags || R.isEmpty(tags)) {
return;
} // @ts-ignore
return camelcaseKeys(tags);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
* Read up on the Manifest v2, Schema 2 Spec in more detail:
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
* Or the shiny new OCI distribution spec which builds on it:
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
*/
var fetchManifestList = function fetchManifestList(repo) {
try {
// Docker Hub requires a unique token for each repo manifest queried.
return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) {
var manifestListURL = createManifestListURL({
repo: repo
});
return Promise.resolve(axios.get(manifestListURL, {
headers: {
Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',
Authorization: "Bearer " + token
}
})).then(function (manifestListResponse) {
// For now, just ignore legacy V1 schema manifests. They have an entirely
// different response shape and it's not worth mucking up the schema to
// support a legacy format.
if (manifestListResponse.data.schemaVersion === 1) {
log.info('Schema version 1 is unsupported.', repo.name);
return;
}
return R.path(['data'], manifestListResponse);
});
});
} catch (e) {
return Promise.reject(e);
}
};
exports.DOCKER_HUB_API_AUTH_URL = DOCKER_HUB_API_AUTH_URL;
exports.DOCKER_HUB_API_ROOT = DOCKER_HUB_API_ROOT;
exports.extractRepositoryDetails = extractRepositoryDetails;
exports.fetchDockerHubToken = fetchDockerHubToken;
exports.fetchManifestList = fetchManifestList;
exports.queryRepo = queryRepo;
exports.queryTags = queryTags;
exports.queryTopRepos = queryTopRepos;
//# sourceMappingURL=docker-hub-utils.cjs.development.js.map

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,2 @@
"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

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,262 @@
import axios from 'axios';
import camelcaseKeys from 'camelcase-keys';
import { DateTime } from 'luxon';
import R from 'ramda';
import pino from 'pino';
/**
* Union type representing the architecture defined in part of an OCI image's
* manifest list.
*
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
* image architecture values, and vice versa:
* > The platform object describes the platform which the image in the manifest
* > runs on. A full list of valid operating system and architecture values are
* > listed in the Go language documentation for $GOOS and $GOARCH
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
*/
var Architecture;
(function (Architecture) {
Architecture["i386"] = "386";
Architecture["amd64"] = "amd64";
Architecture["arm"] = "arm";
Architecture["arm64"] = "arm64";
Architecture["mips"] = "mips";
Architecture["mips64"] = "mips64";
Architecture["mips64le"] = "mips64le";
Architecture["mipsle"] = "mipsle";
Architecture["ppc64"] = "ppc64";
Architecture["ppc64le"] = "ppc64le";
Architecture["s390x"] = "s390x";
Architecture["wasm"] = "wasm";
})(Architecture || (Architecture = {}));
/**
* Union type representing the OS defined in part of an OCI image's
* manifest list.
* See the docs for the `Architecture` type above for more info.
*/
var OS;
(function (OS) {
OS["aix"] = "aix";
OS["android"] = "android";
OS["darwin"] = "darwin";
OS["dragonfly"] = "dragonfly";
OS["freebsd"] = "freebsd";
OS["illumos"] = "illumos";
OS["js"] = "js";
OS["linux"] = "linux";
OS["netbsd"] = "netbsd";
OS["openbsd"] = "openbsd";
OS["plan9"] = "plan9";
OS["solaris"] = "solaris";
OS["windows"] = "windows";
})(OS || (OS = {}));
var ManifestMediaType;
(function (ManifestMediaType) {
ManifestMediaType["Manifest"] = "application/vnd.docker.distribution.manifest.v2+json";
ManifestMediaType["ManifestList"] = "application/vnd.docker.distribution.manifest.list.v2+json";
})(ManifestMediaType || (ManifestMediaType = {}));
var log = /*#__PURE__*/
pino({
base: null,
useLevelLabels: true
});
var DOCKER_HUB_API_ROOT = 'https://hub.docker.com/v2/';
var DOCKER_HUB_API_AUTH_URL = 'https://auth.docker.io/token';
/**
* Currently only supports fetching the manifest for the `latest` tag; in
* reality, we can pass any valid content digest[1] to retrieve the manifest(s)
* for that image.
*
* [1]: https://github.com/opencontainers/distribution-spec/blob/master/spec.md#content-digests
*/
var createManifestListURL = function createManifestListURL(_ref) {
var repo = _ref.repo;
return "https://registry-1.docker.io/v2/" + repo.user + "/" + repo.name + "/manifests/latest";
};
var createUserReposListURL = function createUserReposListURL(user) {
return DOCKER_HUB_API_ROOT + "repositories/" + user;
};
/**
* The OCI distribution spec requires a unique token for each repo manifest queried.
*/
var fetchDockerHubToken = function fetchDockerHubToken(repo) {
try {
var name = repo.name,
user = repo.user;
return Promise.resolve(axios.get(DOCKER_HUB_API_AUTH_URL, {
params: {
scope: "repository:" + user + "/" + name + ":pull",
service: 'registry.docker.io'
}
})).then(function (tokenRequest) {
var token = R.path(['data', 'token'], tokenRequest);
if (!token) {
throw new Error('Unable to retrieve auth token from registry.');
}
return token;
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Pure function that massages the Docker Hub API response into the
* format we want to return. e.g., only extracting certain fields;
* converting snake_case to camelCase, etc.
*/
var extractRepositoryDetails = function extractRepositoryDetails(repos, lastUpdatedSince) {
if (!repos || R.isEmpty(repos)) {
return [];
}
var parsedRepos = camelcaseKeys(repos);
if (R.isNil(lastUpdatedSince)) {
return parsedRepos;
}
return parsedRepos.filter(function (repo) {
return DateTime.fromISO(repo.lastUpdated) < lastUpdatedSince;
});
};
/**
* Query a single repository given a repo name and username.
*
* @param user The DockerHub username or org name to query for.
* @param name The DockerHub repo name -- restrict to this single repo.
*/
var queryRepo = function queryRepo(_ref2) {
var name = _ref2.name,
user = _ref2.user;
try {
return Promise.resolve(axios.request({
url: DOCKER_HUB_API_ROOT + "repositories/" + user + "/" + name + "/"
})).then(function (repoResult) {
var repo = R.prop('data', repoResult);
if (repoResult.status !== 200 || !repo || R.isEmpty(repo)) {
return;
}
return camelcaseKeys(repo);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Top-level function for querying repositories.
*
* @TODO Rename to just `queryRepos`.
*
* @param user The DockerHub username or org name to query for.
* @param numRepos The number of repos to query (max 100).
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
*/
var queryTopRepos = function queryTopRepos(_ref3) {
var lastUpdatedSince = _ref3.lastUpdatedSince,
_ref3$numRepos = _ref3.numRepos,
numRepos = _ref3$numRepos === void 0 ? 100 : _ref3$numRepos,
user = _ref3.user;
try {
if (numRepos > 100) {
throw new RangeError('Number of repos to query cannot exceed 100.');
}
var listReposURL = createUserReposListURL(user);
return Promise.resolve(axios.get(listReposURL, {
params: {
page: 1,
page_size: numRepos
}
})).then(function (repoResults) {
var repos = R.path(['data', 'results'], repoResults);
return extractRepositoryDetails(repos, lastUpdatedSince);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Query image tags.
*/
var queryTags = function queryTags(repo) {
try {
var repoUrl = createUserReposListURL(repo.user);
var tagsUrl = repoUrl + "/" + repo.name + "/tags?page_size=100";
return Promise.resolve(axios.get(tagsUrl)).then(function (tagsResults) {
var tags = R.path(['data', 'results'], tagsResults);
if (!tags || R.isEmpty(tags)) {
return;
} // @ts-ignore
return camelcaseKeys(tags);
});
} catch (e) {
return Promise.reject(e);
}
};
/**
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
* Read up on the Manifest v2, Schema 2 Spec in more detail:
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
* Or the shiny new OCI distribution spec which builds on it:
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
*/
var fetchManifestList = function fetchManifestList(repo) {
try {
// Docker Hub requires a unique token for each repo manifest queried.
return Promise.resolve(fetchDockerHubToken(repo)).then(function (token) {
var manifestListURL = createManifestListURL({
repo: repo
});
return Promise.resolve(axios.get(manifestListURL, {
headers: {
Accept: 'application/vnd.docker.distribution.manifest.list.v2+json',
Authorization: "Bearer " + token
}
})).then(function (manifestListResponse) {
// For now, just ignore legacy V1 schema manifests. They have an entirely
// different response shape and it's not worth mucking up the schema to
// support a legacy format.
if (manifestListResponse.data.schemaVersion === 1) {
log.info('Schema version 1 is unsupported.', repo.name);
return;
}
return R.path(['data'], manifestListResponse);
});
});
} catch (e) {
return Promise.reject(e);
}
};
export { Architecture, DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT, ManifestMediaType, extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos };
//# sourceMappingURL=docker-hub-utils.esm.js.map

File diff suppressed because one or more lines are too long

6
node_modules/docker-hub-utils/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag } from './types/DockerHubRepo';
import { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos } from './services/DockerHubAPI';
import { DOCKER_HUB_API_AUTH_URL, DOCKER_HUB_API_ROOT } from './utils/constants';
export { Architecture, DockerHubAPIRepo, DockerHubRepo, DockerManifest, DockerManifestList, ManifestMediaType, Tag, };
export { extractRepositoryDetails, fetchDockerHubToken, fetchManifestList, queryRepo, queryTags, queryTopRepos, };
export { DOCKER_HUB_API_ROOT, DOCKER_HUB_API_AUTH_URL };

8
node_modules/docker-hub-utils/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,8 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./docker-hub-utils.cjs.production.min.js')
} else {
module.exports = require('./docker-hub-utils.cjs.development.js')
}

View file

@ -0,0 +1,49 @@
import { DateTime } from 'luxon';
import { DockerHubAPIRepo, DockerHubRepo, DockerManifestList, Tag } from '../types/DockerHubRepo';
/**
* The OCI distribution spec requires a unique token for each repo manifest queried.
*/
export declare const fetchDockerHubToken: (repo: DockerHubRepo) => Promise<string>;
/**
* Pure function that massages the Docker Hub API response into the
* format we want to return. e.g., only extracting certain fields;
* converting snake_case to camelCase, etc.
*/
export declare const extractRepositoryDetails: (repos: DockerHubAPIRepo[], lastUpdatedSince?: DateTime | undefined) => DockerHubRepo[];
/**
* Query a single repository given a repo name and username.
*
* @param user The DockerHub username or org name to query for.
* @param name The DockerHub repo name -- restrict to this single repo.
*/
export declare const queryRepo: ({ name, user, }: {
name: string;
user: string;
}) => Promise<DockerHubRepo | undefined>;
/**
* Top-level function for querying repositories.
*
* @TODO Rename to just `queryRepos`.
*
* @param user The DockerHub username or org name to query for.
* @param numRepos The number of repos to query (max 100).
* @param lastUpdatedSince Filter by the DateTime at which a repo was last updated.
*/
export declare const queryTopRepos: ({ lastUpdatedSince, numRepos, user, }: {
lastUpdatedSince?: DateTime | undefined;
numRepos?: number | undefined;
user: string;
}) => Promise<DockerHubRepo[]>;
/**
* Query image tags.
*/
export declare const queryTags: (repo: DockerHubRepo) => Promise<Tag[] | undefined>;
/**
* Queries the Docker Hub API to retrieve a "fat manifest", an object of
* `Content-Type` `application/vnd.docker.distribution.manifest.list.v2+json/`.
* Read up on the Manifest v2, Schema 2 Spec in more detail:
* @see https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md
* Or the shiny new OCI distribution spec which builds on it:
* @see https://github.com/opencontainers/distribution-spec/blob/f67bc11ba3a083a9c62f8fa53ad14c5bcf2116af/spec.md
*/
export declare const fetchManifestList: (repo: DockerHubRepo) => Promise<DockerManifestList | undefined>;

View file

@ -0,0 +1,123 @@
/**
* This is a direct representation of what we get back from the `/repositories`
* API call.
*/
export interface DockerHubAPIRepo {
readonly can_edit: boolean;
readonly description: string;
readonly is_automated: boolean;
readonly is_migrated: boolean;
readonly is_private: boolean;
readonly last_updated: string;
readonly name: string;
readonly namespace: string;
readonly pull_count: number;
readonly repository_type: string;
readonly star_count: number;
readonly status: number;
readonly user: string;
}
/**
* Union type representing the architecture defined in part of an OCI image's
* manifest list.
*
* As specified in the Docker Manifest spec, any valid GOARCH values are valid
* image architecture values, and vice versa:
* > The platform object describes the platform which the image in the manifest
* > runs on. A full list of valid operating system and architecture values are
* > listed in the Go language documentation for $GOOS and $GOARCH
* @see https://docs.docker.com/registry/spec/manifest-v2-2/#manifest-list-field-descriptions
*/
export declare enum Architecture {
i386 = "386",
amd64 = "amd64",
arm = "arm",
arm64 = "arm64",
mips = "mips",
mips64 = "mips64",
mips64le = "mips64le",
mipsle = "mipsle",
ppc64 = "ppc64",
ppc64le = "ppc64le",
s390x = "s390x",
wasm = "wasm"
}
/**
* Union type representing the OS defined in part of an OCI image's
* manifest list.
* See the docs for the `Architecture` type above for more info.
*/
export declare enum OS {
aix = "aix",
android = "android",
darwin = "darwin",
dragonfly = "dragonfly",
freebsd = "freebsd",
illumos = "illumos",
js = "js",
linux = "linux",
netbsd = "netbsd",
openbsd = "openbsd",
plan9 = "plan9",
solaris = "solaris",
windows = "windows"
}
export declare enum ManifestMediaType {
Manifest = "application/vnd.docker.distribution.manifest.v2+json",
ManifestList = "application/vnd.docker.distribution.manifest.list.v2+json"
}
/**
* Yes, there's *way* more information contained in the manifest / "fat"
* manifestList than just architectures, but I find this to be the most
* relevant section for my projects. PR's welcome.
*/
export interface DockerManifest {
readonly digest: string;
readonly mediaType: ManifestMediaType;
readonly platform: Array<{
architecture: Architecture;
os: OS;
}>;
readonly schemaVersion: 1 | 2 | number;
}
export interface DockerManifestList {
readonly manifests: DockerManifest[];
readonly mediaType: ManifestMediaType;
readonly schemaVersion: 1 | 2 | any;
}
export interface DockerHubRepo {
readonly description: string | null | undefined;
readonly lastUpdated: string;
readonly name: string;
readonly pullCount: number;
readonly starCount: number;
readonly user: string;
readonly manifestList?: DockerManifestList;
readonly tags?: Tag[];
readonly canEdit?: boolean;
readonly isAutomated?: boolean;
readonly isMigrated?: boolean;
readonly isPrivate?: boolean;
readonly namespace?: string;
readonly repositoryType?: string;
readonly status?: number;
}
export interface Tag {
creator: number;
fullSize: number;
id: number;
images: TagElement[];
lastUpdated: string;
lastUpdater: number;
lastUpdaterUsername: string;
name: string;
repository: number;
v2: boolean;
}
export interface TagElement {
architecture: Architecture;
digest: string;
features: string;
os: OS;
size: number;
}

View file

@ -0,0 +1,3 @@
export declare const DOCKER_CLOUD_URL = "https://cloud.docker.com/repository/docker/";
export declare const DOCKER_HUB_API_ROOT = "https://hub.docker.com/v2/";
export declare const DOCKER_HUB_API_AUTH_URL = "https://auth.docker.io/token";

3
node_modules/docker-hub-utils/dist/utils/log.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import pino from 'pino';
declare const _default: pino.Logger;
export default _default;