@verdaccio/types
Advanced tools
Comparing version 11.0.0-6-next.7 to 11.0.0-6-next.8
# Change Log | ||
## 11.0.0-6-next.8 | ||
### Major Changes | ||
- 459b6fa7: refactor: search v1 endpoint and local-database | ||
- refactor search `api v1` endpoint, improve performance | ||
- remove usage of `async` dependency https://github.com/verdaccio/verdaccio/issues/1225 | ||
- refactor method storage class | ||
- create new module `core` to reduce the ammount of modules with utilities | ||
- use `undici` instead `node-fetch` | ||
- use `fastify` instead `express` for functional test | ||
### Breaking changes | ||
- plugin storage API changes | ||
- remove old search endpoint (return 404) | ||
- filter local private packages at plugin level | ||
The storage api changes for methods `get`, `add`, `remove` as promise base. The `search` methods also changes and recieves a `query` object that contains all query params from the client. | ||
```ts | ||
export interface IPluginStorage<T> extends IPlugin { | ||
add(name: string): Promise<void>; | ||
remove(name: string): Promise<void>; | ||
get(): Promise<any>; | ||
init(): Promise<void>; | ||
getSecret(): Promise<string>; | ||
setSecret(secret: string): Promise<any>; | ||
getPackageStorage(packageInfo: string): IPackageStorage; | ||
search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>; | ||
saveToken(token: Token): Promise<any>; | ||
deleteToken(user: string, tokenKey: string): Promise<any>; | ||
readTokens(filter: TokenFilter): Promise<Token[]>; | ||
} | ||
``` | ||
## 11.0.0-6-next.7 | ||
@@ -4,0 +41,0 @@ |
/// <reference types="node" /> | ||
import { PassThrough } from 'stream'; | ||
declare module '@verdaccio/types' { | ||
@@ -13,2 +12,3 @@ type StringValue = string | void | null; | ||
interface Author { | ||
username?: string; | ||
name: string; | ||
@@ -186,3 +186,3 @@ email?: string; | ||
'dist-tags': GenericBody; | ||
time?: GenericBody; | ||
time: GenericBody; | ||
readme?: string; | ||
@@ -453,26 +453,10 @@ users?: PackageUsers; | ||
/** | ||
* This method expect return a Package object | ||
* eg: | ||
* { | ||
* name: string; | ||
* time: number; | ||
* ... and other props | ||
* } | ||
* | ||
* The `cb` callback object will be executed if: | ||
* - it might return object (truly) | ||
* - it might reutrn null | ||
* @deprecated use @verdaccio/core pluginUtils instead | ||
*/ | ||
type onSearchPackage = (item: Package, cb: CallbackAction) => void; | ||
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` | ||
// but this type is on @verdaccio/commons-api and cannot be used here yet | ||
type onEndSearchPackage = (error?: any) => void; | ||
type onValidatePackage = (name: string) => boolean; | ||
interface ILocalData<T> extends IPlugin<T>, ITokenActions { | ||
logger: Logger; | ||
config: T & Config; | ||
add(name: string, callback: Callback): void; | ||
remove(name: string, callback: Callback): void; | ||
get(callback: Callback): void; | ||
add(name: string): Promise<void>; | ||
remove(name: string): Promise<void>; | ||
get(): Promise<any>; | ||
init(): Promise<void>; | ||
@@ -482,7 +466,2 @@ getSecret(): Promise<string>; | ||
getPackageStorage(packageInfo: string): IPackageStorage; | ||
search( | ||
onPackage: onSearchPackage, | ||
onEnd: onEndSearchPackage, | ||
validateName: onValidatePackage | ||
): void; | ||
} | ||
@@ -502,4 +481,4 @@ | ||
createPackage(pkgName: string, value: Package, cb: CallbackAction): void; | ||
deletePackage(fileName: string, callback: CallbackAction): void; | ||
removePackage(callback: CallbackAction): void; | ||
deletePackage(fileName: string): Promise<void>; | ||
removePackage(): Promise<void>; | ||
updatePackage( | ||
@@ -510,3 +489,3 @@ pkgFileName: string, | ||
transformPackage: PackageTransformer, | ||
onEnd: CallbackAction | ||
onEnd: Callback | ||
): void; | ||
@@ -535,12 +514,2 @@ savePackage(fileName: string, json: Package, callback: CallbackAction): void; | ||
interface IStorageManager<T> extends StoragePackageActions { | ||
config: T & Config; | ||
logger: Logger; | ||
init(config: T & Config, filters: any): Promise<any>; | ||
addPackage(name: string, metadata: any, callback: Callback): Promise<any>; | ||
getPackage(options: any): void; | ||
search(startkey: string, options: any): IReadTarball; | ||
getLocalDatabase(callback: Callback): void; | ||
} | ||
// @deprecated use IBasicAuth from @verdaccio/auth | ||
@@ -611,3 +580,3 @@ interface IBasicAuth<T> { | ||
interface IPluginMiddleware<T> extends IPlugin<T> { | ||
register_middlewares(app: any, auth: IBasicAuth<T>, storage: IStorageManager<T>): void; | ||
register_middlewares(app: any, auth: IBasicAuth<T>, storage: any): void; | ||
} | ||
@@ -614,0 +583,0 @@ |
{ | ||
"name": "@verdaccio/types", | ||
"version": "11.0.0-6-next.7", | ||
"version": "11.0.0-6-next.8", | ||
"description": "verdaccio types definitions", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44606
2
512