forked from waja/action-debian-package
50 lines
2.2 KiB
TypeScript
50 lines
2.2 KiB
TypeScript
|
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>;
|