vona-module-a-user 5.0.34 → 5.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bean/bean.passport.d.ts +13 -13
- package/dist/bean/bean.role.d.ts +5 -5
- package/dist/bean/bean.user.d.ts +11 -11
- package/dist/bean/event.activate.d.ts +2 -2
- package/dist/bean/event.createAnonymous.d.ts +2 -2
- package/dist/bean/event.register.d.ts +3 -3
- package/dist/bean/event.signin.d.ts +2 -2
- package/dist/bean/event.signout.d.ts +2 -2
- package/dist/service/authTokenAdapter.d.ts +8 -8
- package/dist/service/redisToken.d.ts +8 -8
- package/dist/types/auth.d.ts +3 -3
- package/dist/types/authToken.d.ts +8 -8
- package/dist/types/passport.d.ts +13 -13
- package/dist/types/role.d.ts +4 -4
- package/dist/types/user.d.ts +8 -8
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { IJwtClientRecord, IJwtSignOptions, IJwtToken, IJwtVerifyOptions,
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
1
|
+
import type { IJwtClientRecord, IJwtSignOptions, IJwtToken, IJwtVerifyOptions, IPayloadData } from 'vona-module-a-jwt';
|
|
2
|
+
import type { IAuth, IAuthIdRecord, ISigninOptions } from '../types/auth.ts';
|
|
3
|
+
import type { IPassport } from '../types/passport.ts';
|
|
4
|
+
import type { IRole } from '../types/role.ts';
|
|
5
|
+
import type { IUser, IUserNameRecord } from '../types/user.ts';
|
|
6
6
|
import { BeanBase } from 'vona';
|
|
7
7
|
export declare class BeanPassport extends BeanBase {
|
|
8
8
|
private _authTokenAdapter;
|
|
@@ -13,18 +13,18 @@ export declare class BeanPassport extends BeanBase {
|
|
|
13
13
|
get isAuthenticated(): boolean;
|
|
14
14
|
get isActivated(): boolean;
|
|
15
15
|
isAdmin(): Promise<boolean>;
|
|
16
|
-
setCurrent(passport:
|
|
17
|
-
getCurrent():
|
|
18
|
-
getCurrentUser():
|
|
19
|
-
getCurrentAuth():
|
|
20
|
-
getCurrentRoles():
|
|
21
|
-
signin(passport:
|
|
16
|
+
setCurrent(passport: IPassport | undefined): Promise<void>;
|
|
17
|
+
getCurrent(): IPassport | undefined;
|
|
18
|
+
getCurrentUser(): IUser | undefined;
|
|
19
|
+
getCurrentAuth(): IAuth | undefined;
|
|
20
|
+
getCurrentRoles(): IRole[] | undefined;
|
|
21
|
+
signin(passport: IPassport, options?: ISigninOptions): Promise<IJwtToken>;
|
|
22
22
|
signout(): Promise<void>;
|
|
23
23
|
signinSystem<K extends keyof IAuthIdRecord>(authName: IAuthIdRecord[K], authId: K, name?: string, options?: ISigninOptions): Promise<IJwtToken>;
|
|
24
24
|
signinMock(name?: keyof IUserNameRecord, options?: ISigninOptions): Promise<IJwtToken>;
|
|
25
25
|
signinWithAnonymous(): Promise<void>;
|
|
26
|
-
kickOut(user?:
|
|
27
|
-
checkAuthToken(accessToken?: string, clientName?: keyof IJwtClientRecord, options?: IJwtVerifyOptions): Promise<
|
|
26
|
+
kickOut(user?: IUser): Promise<void>;
|
|
27
|
+
checkAuthToken(accessToken?: string, clientName?: keyof IJwtClientRecord, options?: IJwtVerifyOptions): Promise<IPayloadData | undefined>;
|
|
28
28
|
refreshAuthToken(refreshToken: string): Promise<IJwtToken>;
|
|
29
29
|
createTempAuthToken(options?: IJwtSignOptions): Promise<string>;
|
|
30
30
|
createOauthAuthToken(options?: IJwtSignOptions): Promise<string>;
|
package/dist/bean/bean.role.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IRole } from '../types/role.ts';
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
export declare class BeanRole extends BeanBase {
|
|
5
5
|
private _roleAdapter;
|
|
6
6
|
private get roleAdapter();
|
|
7
|
-
findOneByName(name: string): Promise<
|
|
8
|
-
findOneById(id: TableIdentity): Promise<
|
|
9
|
-
findOne(role: Partial<
|
|
10
|
-
findAllByUserId(userId: TableIdentity): Promise<
|
|
7
|
+
findOneByName(name: string): Promise<IRole | undefined>;
|
|
8
|
+
findOneById(id: TableIdentity): Promise<IRole | undefined>;
|
|
9
|
+
findOne(role: Partial<IRole>): Promise<IRole | undefined>;
|
|
10
|
+
findAllByUserId(userId: TableIdentity): Promise<IRole[] | undefined>;
|
|
11
11
|
}
|
package/dist/bean/bean.user.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { IAuthUserProfile } from '../types/authProfile.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IUser } from '../types/user.ts';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
5
|
export declare class BeanUser extends BeanBase {
|
|
6
6
|
private _userAdapter;
|
|
7
7
|
private get userAdapter();
|
|
8
|
-
activate(user:
|
|
9
|
-
register(user: Partial<
|
|
10
|
-
registerByProfile(profile: IAuthUserProfile): Promise<
|
|
11
|
-
createAnonymous(): Promise<
|
|
12
|
-
findOneByName(name: string): Promise<
|
|
13
|
-
findOneById(id: TableIdentity): Promise<
|
|
14
|
-
findOne(user: Partial<
|
|
15
|
-
updateById(id: TableIdentity, user: Partial<
|
|
16
|
-
update(user: Partial<
|
|
8
|
+
activate(user: IUser): Promise<void>;
|
|
9
|
+
register(user: Partial<IUser>, confirmed?: boolean): Promise<IUser>;
|
|
10
|
+
registerByProfile(profile: IAuthUserProfile): Promise<IUser>;
|
|
11
|
+
createAnonymous(): Promise<IUser>;
|
|
12
|
+
findOneByName(name: string): Promise<IUser | undefined>;
|
|
13
|
+
findOneById(id: TableIdentity): Promise<IUser | undefined>;
|
|
14
|
+
findOne(user: Partial<IUser>): Promise<IUser | undefined>;
|
|
15
|
+
updateById(id: TableIdentity, user: Partial<IUser>): Promise<void>;
|
|
16
|
+
update(user: Partial<IUser>): Promise<void>;
|
|
17
17
|
removeById(id: TableIdentity): Promise<void>;
|
|
18
|
-
remove(user: Partial<
|
|
18
|
+
remove(user: Partial<IUser>): Promise<void>;
|
|
19
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IUser } from '../types/user.ts';
|
|
2
2
|
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
|
-
export type TypeEventActivateData =
|
|
3
|
+
export type TypeEventActivateData = IUser;
|
|
4
4
|
export type TypeEventActivateResult = void;
|
|
5
5
|
export declare class EventActivate extends BeanEventBase<TypeEventActivateData, TypeEventActivateResult> {
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IUser } from '../types/user.ts';
|
|
2
2
|
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
3
|
export type TypeEventCreateAnonymousData = undefined;
|
|
4
|
-
export type TypeEventCreateAnonymousResult = Partial<
|
|
4
|
+
export type TypeEventCreateAnonymousResult = Partial<IUser>;
|
|
5
5
|
export declare class EventCreateAnonymous extends BeanEventBase<TypeEventCreateAnonymousData, TypeEventCreateAnonymousResult> {
|
|
6
6
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IUser } from '../types/user.ts';
|
|
2
2
|
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
3
|
export interface TypeEventRegisterData {
|
|
4
|
-
user: Partial<
|
|
4
|
+
user: Partial<IUser>;
|
|
5
5
|
confirmed?: boolean;
|
|
6
6
|
autoActivate?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export type TypeEventRegisterResult = Partial<
|
|
8
|
+
export type TypeEventRegisterResult = Partial<IUser>;
|
|
9
9
|
export declare class EventRegister extends BeanEventBase<TypeEventRegisterData, TypeEventRegisterResult> {
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPassport } from '../types/passport.ts';
|
|
2
2
|
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
|
-
export type TypeEventSigninData =
|
|
3
|
+
export type TypeEventSigninData = IPassport;
|
|
4
4
|
export type TypeEventSigninResult = void;
|
|
5
5
|
export declare class EventSignin extends BeanEventBase<TypeEventSigninData, TypeEventSigninResult> {
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPassport } from '../types/passport.ts';
|
|
2
2
|
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
|
-
export type TypeEventSignoutData =
|
|
3
|
+
export type TypeEventSignoutData = IPassport;
|
|
4
4
|
export type TypeEventSignoutResult = void;
|
|
5
5
|
export declare class EventSignout extends BeanEventBase<TypeEventSignoutData, TypeEventSignoutResult> {
|
|
6
6
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IPayloadData } from 'vona-module-a-jwt';
|
|
2
2
|
import type { IAuthTokenAdapter } from '../types/authToken.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IUser } from '../types/user.ts';
|
|
4
4
|
import { BeanBase } from 'vona';
|
|
5
5
|
export declare class ServiceAuthTokenAdapter extends BeanBase implements IAuthTokenAdapter {
|
|
6
|
-
create(payloadData:
|
|
7
|
-
retrieve(payloadData:
|
|
8
|
-
verify(payloadData:
|
|
9
|
-
refresh(payloadData:
|
|
10
|
-
remove(payloadData:
|
|
11
|
-
removeAll(user:
|
|
6
|
+
create(payloadData: IPayloadData): Promise<IPayloadData>;
|
|
7
|
+
retrieve(payloadData: IPayloadData): Promise<IPayloadData | undefined>;
|
|
8
|
+
verify(payloadData: IPayloadData): Promise<boolean>;
|
|
9
|
+
refresh(payloadData: IPayloadData): Promise<void>;
|
|
10
|
+
remove(payloadData: IPayloadData): Promise<void>;
|
|
11
|
+
removeAll(user: IUser): Promise<void>;
|
|
12
12
|
private _getAuthId;
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IPayloadData } from 'vona-module-a-jwt';
|
|
2
|
+
import type { IUser } from 'vona-module-a-user';
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
export declare class ServiceRedisToken extends BeanBase {
|
|
5
|
-
verify(payloadData:
|
|
6
|
-
retrieve(payloadData:
|
|
7
|
-
create(payloadData:
|
|
8
|
-
refresh(payloadData:
|
|
9
|
-
remove(payloadData:
|
|
10
|
-
removeAll(user:
|
|
5
|
+
verify(payloadData: IPayloadData): Promise<boolean>;
|
|
6
|
+
retrieve(payloadData: IPayloadData): Promise<IPayloadData | undefined>;
|
|
7
|
+
create(payloadData: IPayloadData): Promise<undefined>;
|
|
8
|
+
refresh(payloadData: IPayloadData): Promise<undefined>;
|
|
9
|
+
remove(payloadData: IPayloadData): Promise<void>;
|
|
10
|
+
removeAll(user: IUser): Promise<void>;
|
|
11
11
|
private _getAuthRedisKey;
|
|
12
12
|
private _getAuthRedisKeyPrefix;
|
|
13
13
|
private _getToken;
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -4,15 +4,15 @@ export interface IAuthIdRecord {
|
|
|
4
4
|
'-1': 'dev';
|
|
5
5
|
'-10000': 'mock';
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface IAuthProvider {
|
|
8
8
|
id: TableIdentity;
|
|
9
9
|
providerName: keyof IAuthProviderRecord;
|
|
10
10
|
clientName: string;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface IAuth {
|
|
13
13
|
id: TableIdentity;
|
|
14
14
|
profileId?: string;
|
|
15
|
-
authProvider?:
|
|
15
|
+
authProvider?: IAuthProvider;
|
|
16
16
|
}
|
|
17
17
|
export type TypeAuthToken = 'recreate' | 'refresh' | 'nochange';
|
|
18
18
|
export interface ISigninOptions {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IPayloadData } from 'vona-module-a-jwt';
|
|
2
|
+
import type { IUser } from './user.ts';
|
|
3
3
|
export interface IAuthTokenAdapter {
|
|
4
|
-
create(payloadData:
|
|
5
|
-
retrieve(payloadData:
|
|
6
|
-
verify(payloadData:
|
|
7
|
-
refresh(payloadData:
|
|
8
|
-
remove(payloadData:
|
|
9
|
-
removeAll(user:
|
|
4
|
+
create(payloadData: IPayloadData): Promise<IPayloadData>;
|
|
5
|
+
retrieve(payloadData: IPayloadData): Promise<IPayloadData | undefined>;
|
|
6
|
+
verify(payloadData: IPayloadData): Promise<boolean>;
|
|
7
|
+
refresh(payloadData: IPayloadData): Promise<void>;
|
|
8
|
+
remove(payloadData: IPayloadData): Promise<void>;
|
|
9
|
+
removeAll(user: IUser): Promise<void>;
|
|
10
10
|
}
|
package/dist/types/passport.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export interface
|
|
6
|
-
user?:
|
|
7
|
-
auth?:
|
|
8
|
-
roles?:
|
|
1
|
+
import type { IPayloadData } from 'vona-module-a-jwt';
|
|
2
|
+
import type { IAuth } from './auth.ts';
|
|
3
|
+
import type { IRole } from './role.ts';
|
|
4
|
+
import type { IUser } from './user.ts';
|
|
5
|
+
export interface IPassport {
|
|
6
|
+
user?: IUser;
|
|
7
|
+
auth?: IAuth;
|
|
8
|
+
roles?: IRole[];
|
|
9
9
|
}
|
|
10
10
|
export interface IPassportAdapter {
|
|
11
|
-
isAdmin(passport:
|
|
12
|
-
setCurrent(passport:
|
|
13
|
-
serialize(passport:
|
|
14
|
-
deserialize(payloadData:
|
|
11
|
+
isAdmin(passport: IPassport | undefined): Promise<boolean>;
|
|
12
|
+
setCurrent(passport: IPassport | undefined): Promise<IPassport | undefined>;
|
|
13
|
+
serialize(passport: IPassport): Promise<IPayloadData>;
|
|
14
|
+
deserialize(payloadData: IPayloadData): Promise<IPassport | undefined>;
|
|
15
15
|
}
|
|
16
16
|
declare module 'vona' {
|
|
17
17
|
interface ContextState {
|
|
18
|
-
passport?:
|
|
18
|
+
passport?: IPassport;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/dist/types/role.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ export interface IRoleNameRecord {
|
|
|
4
4
|
}
|
|
5
5
|
export interface IRoleIdRecord {
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface IRole {
|
|
8
8
|
id: TableIdentity;
|
|
9
9
|
name: string;
|
|
10
10
|
}
|
|
11
11
|
export interface IRoleAdapter {
|
|
12
|
-
findOneByName(name: string): Promise<
|
|
13
|
-
findOne(role: Partial<
|
|
14
|
-
findAllByUserId(userId: TableIdentity): Promise<
|
|
12
|
+
findOneByName(name: string): Promise<IRole | undefined>;
|
|
13
|
+
findOne(role: Partial<IRole>): Promise<IRole | undefined>;
|
|
14
|
+
findAllByUserId(userId: TableIdentity): Promise<IRole[] | undefined>;
|
|
15
15
|
}
|
package/dist/types/user.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface IUserNameRecord {
|
|
|
7
7
|
export interface IUserIdRecord {
|
|
8
8
|
'-1': 'anonymous';
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface IUser {
|
|
11
11
|
id: TableIdentity;
|
|
12
12
|
name: string;
|
|
13
13
|
avatar?: string;
|
|
@@ -18,12 +18,12 @@ export interface IUserBase {
|
|
|
18
18
|
anonymous?: boolean;
|
|
19
19
|
}
|
|
20
20
|
export interface IUserAdapter {
|
|
21
|
-
create(user: Partial<
|
|
22
|
-
userOfProfile(profile: IAuthUserProfile): Promise<Partial<
|
|
23
|
-
createAnonymous(): Promise<Partial<
|
|
24
|
-
findOneByName(name: string): Promise<
|
|
25
|
-
findOne(user: Partial<
|
|
26
|
-
update(user: Partial<
|
|
27
|
-
remove(user: Partial<
|
|
21
|
+
create(user: Partial<IUser>): Promise<IUser>;
|
|
22
|
+
userOfProfile(profile: IAuthUserProfile): Promise<Partial<IUser>>;
|
|
23
|
+
createAnonymous(): Promise<Partial<IUser>>;
|
|
24
|
+
findOneByName(name: string): Promise<IUser | undefined>;
|
|
25
|
+
findOne(user: Partial<IUser>): Promise<IUser | undefined>;
|
|
26
|
+
update(user: Partial<IUser>): Promise<void>;
|
|
27
|
+
remove(user: Partial<IUser>): Promise<void>;
|
|
28
28
|
setActivated(id: TableIdentity, activated: boolean): Promise<void>;
|
|
29
29
|
}
|