Skip to content

Commit

Permalink
🤖 Merge PR #69385 [@types/dockerode] Improve AuthConfig and pull() ty…
Browse files Browse the repository at this point in the history
…pes by @nwalters512
  • Loading branch information
nwalters512 committed Apr 30, 2024
1 parent 778ad7a commit 19434c9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions types/dockerode/dockerode-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,17 @@ docker.listServices({ filters: { name: ["network-name"] } }).then(services => {
return services.map(service => docker.getService(service.ID));
});

(async () => {
// $ExpectType ReadableStream
const pullStream = await docker.pull("hello-world", { authconfig: { username: "username", password: "password" } });

// $ExpectType Image
const pushImage = docker.getImage("hello-world");

// $ExpectType ReadableStream
const pushStream = await pushImage.push({ authconfig: { username: "username", password: "password" } });
});

const image = docker.getImage("imageName");
image.remove({ force: true, noprune: false, abortSignal: new AbortController().signal }, (err, response) => {
// NOOP;
Expand Down
14 changes: 9 additions & 5 deletions types/dockerode/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -999,9 +999,13 @@ declare namespace Dockerode {
}

interface AuthConfig {
username: string;
password: string;
serveraddress: string;
username?: string;
password?: string;
auth?: string;
serveraddress?: string;
identitytoken?: string;
registrytoken?: string;
/** @deprecated */
email?: string | undefined;
}

Expand Down Expand Up @@ -2124,8 +2128,8 @@ declare class Dockerode {
getEvents(callback: Callback<NodeJS.ReadableStream>): void;
getEvents(options?: Dockerode.GetEventsOptions): Promise<NodeJS.ReadableStream>;

pull(repoTag: string, options: {}, callback: Callback<any>, auth?: {}): Dockerode.Image;
pull(repoTag: string, options?: {}): Promise<any>;
pull(repoTag: string, options: {}, callback: Callback<NodeJS.ReadableStream>, auth?: {}): Dockerode.Image;
pull(repoTag: string, options?: {}): Promise<NodeJS.ReadableStream>;

run(
image: string,
Expand Down

0 comments on commit 19434c9

Please sign in to comment.