diff --git a/.changeset/violet-bobcats-allow.md b/.changeset/violet-bobcats-allow.md new file mode 100644 index 000000000..dbdb87910 --- /dev/null +++ b/.changeset/violet-bobcats-allow.md @@ -0,0 +1,6 @@ +--- +'@verdaccio/core': patch +'@verdaccio/store': patch +--- + +chore: add package parameter to storage plugin interface diff --git a/packages/core/core/src/plugin-utils.ts b/packages/core/core/src/plugin-utils.ts index adf7c3060..6aeaece8f 100644 --- a/packages/core/core/src/plugin-utils.ts +++ b/packages/core/core/src/plugin-utils.ts @@ -51,7 +51,7 @@ export class Plugin { export interface StorageHandler { logger: Logger; deletePackage(fileName: string): Promise; - removePackage(): Promise; + removePackage(packageName: string): Promise; // 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; // verify if package exist in the storage - hasPackage(): Promise; + hasPackage(packageName: string): Promise; } /** diff --git a/packages/store/src/storage.ts b/packages/store/src/storage.ts index ab5f78be1..1d4683413 100644 --- a/packages/store/src/storage.ts +++ b/packages/store/src/storage.ts @@ -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; }