mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-04-15 03:02:51 -05:00
chore: add package parameter to storage plugin interface (#5127)
This commit is contained in:
parent
00c142f480
commit
95ac1242dc
3 changed files with 10 additions and 4 deletions
6
.changeset/violet-bobcats-allow.md
Normal file
6
.changeset/violet-bobcats-allow.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
'@verdaccio/core': patch
|
||||||
|
'@verdaccio/store': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: add package parameter to storage plugin interface
|
|
@ -51,7 +51,7 @@ export class Plugin<PluginConfig> {
|
||||||
export interface StorageHandler {
|
export interface StorageHandler {
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
deletePackage(fileName: string): Promise<void>;
|
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)
|
// next packages migration (this list is meant to replace the callback parent functions)
|
||||||
updatePackage(
|
updatePackage(
|
||||||
packageName: string,
|
packageName: string,
|
||||||
|
@ -65,7 +65,7 @@ export interface StorageHandler {
|
||||||
// verify if tarball exist in the storage
|
// verify if tarball exist in the storage
|
||||||
hasTarball(fileName: string): Promise<boolean>;
|
hasTarball(fileName: string): Promise<boolean>;
|
||||||
// verify if package exist in the storage
|
// verify if package exist in the storage
|
||||||
hasPackage(): Promise<boolean>;
|
hasPackage(packageName: string): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -813,7 +813,7 @@ class Storage {
|
||||||
await storage.deletePackage(STORAGE.PACKAGE_FILE_NAME);
|
await storage.deletePackage(STORAGE.PACKAGE_FILE_NAME);
|
||||||
// remove folder
|
// remove folder
|
||||||
debug('remove package folder');
|
debug('remove package folder');
|
||||||
await storage.removePackage();
|
await storage.removePackage(pkgName);
|
||||||
this.logger.info({ pkgName }, 'package @{pkgName} removed');
|
this.logger.info({ pkgName }, 'package @{pkgName} removed');
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.error({ err }, 'removed package has failed: @{err.message}');
|
this.logger.error({ err }, 'removed package has failed: @{err.message}');
|
||||||
|
@ -1123,7 +1123,7 @@ class Storage {
|
||||||
if (typeof storage === 'undefined') {
|
if (typeof storage === 'undefined') {
|
||||||
throw errorUtils.getNotFound();
|
throw errorUtils.getNotFound();
|
||||||
}
|
}
|
||||||
const hasPackage = await storage.hasPackage();
|
const hasPackage = await storage.hasPackage(pkgName);
|
||||||
debug('has package %o for %o', pkgName, hasPackage);
|
debug('has package %o for %o', pkgName, hasPackage);
|
||||||
return hasPackage;
|
return hasPackage;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue