cnpmcore
Version:
Private NPM Registry for Enterprise
66 lines (65 loc) • 1.99 kB
TypeScript
import { Type, type Static } from '@eggjs/typebox-validate/typebox';
import { Context } from 'egg';
import { AbstractController } from './AbstractController.ts';
declare const UserRule: Type.TObject<{
type: Type.TLiteral<"user">;
name: Type.TString;
password: Type.TString;
email: Type.TOptional<Type.TString>;
}>;
type User = Static<typeof UserRule>;
export declare class UserController extends AbstractController {
loginOrCreateUser(ctx: Context, username: string, user: User): Promise<{
ok: boolean;
id: string;
rev: string | undefined;
token: string | undefined;
}>;
logout(ctx: Context, token: string): Promise<{
ok: boolean;
}>;
showUser(ctx: Context, username: string): Promise<{
_id: string;
name: string;
email: string | undefined;
}>;
whoami(ctx: Context): Promise<{
username: string;
name: string;
description: string | undefined;
allowedPackages: string[] | undefined;
allowedScopes: string[] | undefined;
lastUsedAt: Date;
expiredAt: Date;
key: string;
cidr_whitelist: string[];
readonly: boolean;
created: Date;
updated: Date;
type: import("../../core/entity/Token.ts").TokenType | undefined;
} | {
username: string;
name?: undefined;
description?: undefined;
allowedPackages?: undefined;
allowedScopes?: undefined;
lastUsedAt?: undefined;
expiredAt?: undefined;
key?: undefined;
cidr_whitelist?: undefined;
readonly?: undefined;
created?: undefined;
updated?: undefined;
type?: undefined;
}>;
starredByUser(): Promise<void>;
showProfile(ctx: Context): Promise<{
name: string;
email: string;
email_verified: boolean;
created: Date;
updated: Date;
}>;
saveProfile(): Promise<void>;
}
export {};