chore: updated tsconfig and fixed typecheck

Signed-off-by: Evzen Gasta <evzen.ml@seznam.cz>
This commit is contained in:
Evzen Gasta 2025-03-25 13:23:33 +01:00 committed by Evžen Gasta
parent 0e0726bf12
commit f2e4b74ab8
4 changed files with 30 additions and 6 deletions

View file

@ -62,6 +62,7 @@ async function download(tagVersion: string, repoPath: string, fileName: string):
});
let buffer;
if (!manifests.data.content) return;
if (manifests.data.encoding && manifests.data.encoding === 'base64') {
buffer = Buffer.from(manifests.data.content, 'base64');
} else {

View file

@ -7,10 +7,10 @@
"resolveJsonModule": true,
"lib": ["ES2017", "webworker"],
"sourceMap": true,
"rootDir": "src",
"rootDirs": ["src", "scripts"],
"outDir": "dist",
"skipLibCheck": true,
"types": ["node"]
},
"include": ["src", "types/*.d.ts", "../../types/**/*.d.ts"]
"include": ["src", "types/*.d.ts", "../../types/**/*.d.ts", "scripts"]
}

View file

@ -29,6 +29,28 @@ export enum DiskType {
Applehv = 'applehv',
}
type ResponseManifest = {
digest: string;
annotations: {
disktype: string;
};
platform: {
os: string;
architecture: string;
};
};
type ResponseLayers = {
digest: string;
size: number;
};
type ResponseJSON = {
layers: ResponseLayers[];
errors: unknown;
manifests: ResponseManifest[];
};
// to make this file a module
export class PodmanDownload {
#podmanVersion: string;
@ -288,9 +310,10 @@ export class Podman5DownloadMachineOS {
this.#version = version;
this.#shaCheck = shaCheck;
this.#assetsFolder = assetsFolder;
this.#ociRegistryProjectLink = '';
}
async getManifest(manifestUrl: string): Promise<any> {
async getManifest(manifestUrl: string): Promise<ResponseJSON> {
const response = await fetch(manifestUrl, {
method: 'GET',
headers: {
@ -298,7 +321,7 @@ export class Podman5DownloadMachineOS {
Accept: 'application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json',
},
});
return response.json();
return response.json() as unknown as ResponseJSON;
}
protected async pipe(

View file

@ -4,7 +4,7 @@
"lib": ["ES2017"],
"module": "esnext",
"sourceMap": true,
"rootDir": "src",
"rootDirs": ["src", "scripts"],
"outDir": "dist",
"target": "esnext",
"moduleResolution": "Node",
@ -13,5 +13,5 @@
"allowSyntheticDefaultImports": true,
"types": ["node"]
},
"include": ["src", "types/*.d.ts"]
"include": ["src", "types/*.d.ts", "scripts"]
}