mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-27 22:39:41 +00:00
Merge pull request #960 from balena-io/update-dockerode-types
types: Upgrade dockerode types, and remove fixes which are superceded
This commit is contained in:
commit
fe32d76f6e
6
package-lock.json
generated
6
package-lock.json
generated
@ -102,9 +102,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/dockerode": {
|
"@types/dockerode": {
|
||||||
"version": "2.5.10",
|
"version": "2.5.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-2.5.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/dockerode/-/dockerode-2.5.13.tgz",
|
||||||
"integrity": "sha512-Aiy0iYuWudPOHNc69LYHCfvjzvJ0KaRIkM9o6unMQSOh7rp7/KydUVb5KRGRSoRk9V7uWv9IssEi/ahF4yaOkA==",
|
"integrity": "sha512-TgSP2nhCZgKOYcuMyuUs1SvLWZCd20z6SczPadLL11iCEEMDiblE23cwIyc1BR7FPpntwT9Z+IcdFNAXUAKmKQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bluebird": "^3.5.25",
|
"@types/bluebird": "^3.5.25",
|
||||||
"@types/common-tags": "^1.8.0",
|
"@types/common-tags": "^1.8.0",
|
||||||
"@types/dockerode": "^2.5.10",
|
"@types/dockerode": "^2.5.13",
|
||||||
"@types/event-stream": "^3.3.34",
|
"@types/event-stream": "^3.3.34",
|
||||||
"@types/express": "^4.11.1",
|
"@types/express": "^4.11.1",
|
||||||
"@types/knex": "^0.14.14",
|
"@types/knex": "^0.14.14",
|
||||||
|
@ -203,20 +203,13 @@ export class Volumes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async listWithBothLabels(): Promise<Dockerode.VolumeInspectInfo[]> {
|
private async listWithBothLabels(): Promise<Dockerode.VolumeInspectInfo[]> {
|
||||||
// We have to cast the listVolumes call from any[] to any below, until the
|
const [legacyResponse, currentResponse] = await Promise.all([
|
||||||
// relevant PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32383
|
|
||||||
// is merged and released - we can also replace Dockerode here with the Docker
|
|
||||||
// DockerUtils class imported above
|
|
||||||
const [legacyResponse, currentResponse]: [
|
|
||||||
Dockerode.VolumeInfoList,
|
|
||||||
Dockerode.VolumeInfoList
|
|
||||||
] = await Promise.all([
|
|
||||||
this.docker.listVolumes({
|
this.docker.listVolumes({
|
||||||
filters: { label: ['io.resin.supervised'] },
|
filters: { label: ['io.resin.supervised'] },
|
||||||
}) as Promise<any>,
|
}),
|
||||||
this.docker.listVolumes({
|
this.docker.listVolumes({
|
||||||
filters: { label: ['io.balena.supervised'] },
|
filters: { label: ['io.balena.supervised'] },
|
||||||
}) as Promise<any>,
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const legacyVolumes = _.get(legacyResponse, 'Volumes', []);
|
const legacyVolumes = _.get(legacyResponse, 'Volumes', []);
|
||||||
|
23
typings/dockerode-ext.d.ts
vendored
23
typings/dockerode-ext.d.ts
vendored
@ -21,27 +21,4 @@ declare module 'dockerode' {
|
|||||||
Healthcheck?: DockerHealthcheck;
|
Healthcheck?: DockerHealthcheck;
|
||||||
StopTimeout?: number;
|
StopTimeout?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Once https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32383
|
|
||||||
// is merged and released, remove this and VolumeInfoList
|
|
||||||
export interface VolumeInspectInfo {
|
|
||||||
Name: string;
|
|
||||||
Driver: string;
|
|
||||||
Mountpoint: string;
|
|
||||||
Status?: { [key: string]: string };
|
|
||||||
Labels: { [key: string]: string };
|
|
||||||
Scope: 'local' | 'global';
|
|
||||||
// Field is always present, but sometimes is null
|
|
||||||
Options: { [key: string]: string } | null;
|
|
||||||
// Field is sometimes present, and sometimes null
|
|
||||||
UsageData?: {
|
|
||||||
Size: number;
|
|
||||||
RefCount: number;
|
|
||||||
} | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface VolumeInfoList {
|
|
||||||
Volumes: Dockerode.VolumeInspectInfo[];
|
|
||||||
Warnings: string[];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user