Improve types used by application-manager

This commit is contained in:
Pagan Gazzard 2020-03-26 23:40:16 +00:00
parent 968e2ba0fb
commit 2a50a4262d
4 changed files with 8 additions and 5 deletions

View File

@ -129,7 +129,7 @@ interface CompositionCallbacks {
fetchStart: () => void;
fetchEnd: () => void;
fetchTime: (time: number) => void;
stateReport: (state: Dictionary<unknown>) => Promise<void>;
stateReport: (state: Dictionary<unknown>) => boolean;
bestDeltaSource: (image: Image, available: Image[]) => string | null;
}

View File

@ -465,7 +465,10 @@ export class Images extends (EventEmitter as new () => ImageEventEmitter) {
}
}
public static isSameImage(image1: Image, image2: Image): boolean {
public static isSameImage(
image1: Pick<Image, 'name'>,
image2: Pick<Image, 'name'>,
): boolean {
return (
image1.name === image2.name ||
Images.hasSameDigest(image1.name, image2.name)

View File

@ -25,6 +25,6 @@ declare function serviceAction(
action: string,
serviceId: number,
current: Service,
target: Service,
options: any,
target?: Service,
options?: any,
): ServiceAction;

View File

@ -45,7 +45,7 @@ const DELTA_TOKEN_TIMEOUT = 10 * 60 * 1000;
export class DockerUtils extends DockerToolbelt {
public dockerProgress: DockerProgress;
public constructor(opts: Dockerode.DockerOptions) {
public constructor(opts?: Dockerode.DockerOptions) {
super(opts);
this.dockerProgress = new DockerProgress({ dockerToolbelt: this });
}