0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-04-08 02:54:13 -05:00

chore: add package parameter to storage plugin interface (#5127)

This commit is contained in:
Marc Bernard 2025-03-09 12:37:24 +01:00 committed by GitHub
parent 00c142f480
commit 95ac1242dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -0,0 +1,6 @@
---
'@verdaccio/core': patch
'@verdaccio/store': patch
---
chore: add package parameter to storage plugin interface

View file

@ -51,7 +51,7 @@ export class Plugin<PluginConfig> {
export interface StorageHandler {
logger: Logger;
deletePackage(fileName: string): Promise<void>;
removePackage(): Promise<void>;
removePackage(packageName: string): Promise<void>;
// next packages migration (this list is meant to replace the callback parent functions)
updatePackage(
packageName: string,
@ -65,7 +65,7 @@ export interface StorageHandler {
// verify if tarball exist in the storage
hasTarball(fileName: string): Promise<boolean>;
// verify if package exist in the storage
hasPackage(): Promise<boolean>;
hasPackage(packageName: string): Promise<boolean>;
}
/**

View file

@ -813,7 +813,7 @@ class Storage {
await storage.deletePackage(STORAGE.PACKAGE_FILE_NAME);
// remove folder
debug('remove package folder');
await storage.removePackage();
await storage.removePackage(pkgName);
this.logger.info({ pkgName }, 'package @{pkgName} removed');
} catch (err: any) {
this.logger.error({ err }, 'removed package has failed: @{err.message}');
@ -1123,7 +1123,7 @@ class Storage {
if (typeof storage === 'undefined') {
throw errorUtils.getNotFound();
}
const hasPackage = await storage.hasPackage();
const hasPackage = await storage.hasPackage(pkgName);
debug('has package %o for %o', pkgName, hasPackage);
return hasPackage;
}