Skip to content

Commit

Permalink
fix: incorrect AuthAccessCallback and AuthCallback (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
frimuchkov authored Jul 17, 2020
1 parent 769fed7 commit 97538f8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions core/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,21 @@ declare module '@verdaccio/types' {
tag?: string;
}

type AuthAccessCallback = (error: string | null, access: boolean) => void;
type AuthCallback = (error: string | null, groups: string[] | false) => void;
// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` instead of AuthError
// but this type is on @verdaccio/commons-api and cannot be used here yet (I don't know why)
interface HttpError extends Error {
status: number;
statusCode: number;
expose: boolean;
headers?: {
[key: string]: string;
};
[key: string]: any;
}

type AuthError = HttpError & { code: number };
type AuthAccessCallback = (error: AuthError | null, access: boolean) => void;
type AuthCallback = (error: AuthError | null, groups: string[] | false) => void;

interface IPluginAuth<T> extends IPlugin<T> {
authenticate(user: string, password: string, cb: AuthCallback): void;
Expand Down

0 comments on commit 97538f8

Please sign in to comment.