vona-module-a-user 5.0.33 → 5.0.35
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 +9 -9
- package/dist/bean/bean.role.d.ts +5 -5
- package/dist/bean/bean.user.d.ts +12 -10
- 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/index.js +11 -0
- package/dist/service/authTokenAdapter.d.ts +2 -2
- package/dist/service/redisToken.d.ts +2 -2
- package/dist/types/authToken.d.ts +2 -2
- package/dist/types/passport.d.ts +10 -10
- 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
1
|
import type { IJwtClientRecord, IJwtSignOptions, IJwtToken, IJwtVerifyOptions, IPayloadDataBase } from 'vona-module-a-jwt';
|
|
2
2
|
import type { IAuthBase, IAuthIdRecord, ISigninOptions } from '../types/auth.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
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,17 +13,17 @@ 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():
|
|
16
|
+
setCurrent(passport: IPassport | undefined): Promise<void>;
|
|
17
|
+
getCurrent(): IPassport | undefined;
|
|
18
|
+
getCurrentUser(): IUser | undefined;
|
|
19
19
|
getCurrentAuth(): IAuthBase | undefined;
|
|
20
|
-
getCurrentRoles():
|
|
21
|
-
signin(passport:
|
|
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?:
|
|
26
|
+
kickOut(user?: IUser): Promise<void>;
|
|
27
27
|
checkAuthToken(accessToken?: string, clientName?: keyof IJwtClientRecord, options?: IJwtVerifyOptions): Promise<IPayloadDataBase | undefined>;
|
|
28
28
|
refreshAuthToken(refreshToken: string): Promise<IJwtToken>;
|
|
29
29
|
createTempAuthToken(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,17 +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
|
-
|
|
16
|
-
|
|
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
|
+
removeById(id: TableIdentity): Promise<void>;
|
|
18
|
+
remove(user: Partial<IUser>): Promise<void>;
|
|
17
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
|
}
|
package/dist/index.js
CHANGED
|
@@ -407,9 +407,20 @@ let BeanUser = (_dec$a = Bean(), _dec2$a = BeanInfo({
|
|
|
407
407
|
async findOne(user) {
|
|
408
408
|
return this.userAdapter.findOne(user);
|
|
409
409
|
}
|
|
410
|
+
async updateById(id, user) {
|
|
411
|
+
return this.userAdapter.update({
|
|
412
|
+
...user,
|
|
413
|
+
id
|
|
414
|
+
});
|
|
415
|
+
}
|
|
410
416
|
async update(user) {
|
|
411
417
|
return this.userAdapter.update(user);
|
|
412
418
|
}
|
|
419
|
+
async removeById(id) {
|
|
420
|
+
return this.userAdapter.remove({
|
|
421
|
+
id
|
|
422
|
+
});
|
|
423
|
+
}
|
|
413
424
|
async remove(user) {
|
|
414
425
|
return this.userAdapter.remove(user);
|
|
415
426
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IPayloadDataBase } 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
6
|
create(payloadData: IPayloadDataBase): Promise<IPayloadDataBase>;
|
|
@@ -8,6 +8,6 @@ export declare class ServiceAuthTokenAdapter extends BeanBase implements IAuthTo
|
|
|
8
8
|
verify(payloadData: IPayloadDataBase): Promise<boolean>;
|
|
9
9
|
refresh(payloadData: IPayloadDataBase): Promise<void>;
|
|
10
10
|
remove(payloadData: IPayloadDataBase): Promise<void>;
|
|
11
|
-
removeAll(user:
|
|
11
|
+
removeAll(user: IUser): Promise<void>;
|
|
12
12
|
private _getAuthId;
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IPayloadDataBase } from 'vona-module-a-jwt';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IUser } from 'vona-module-a-user';
|
|
3
3
|
import { BeanBase } from 'vona';
|
|
4
4
|
export declare class ServiceRedisToken extends BeanBase {
|
|
5
5
|
verify(payloadData: IPayloadDataBase): Promise<boolean>;
|
|
@@ -7,7 +7,7 @@ export declare class ServiceRedisToken extends BeanBase {
|
|
|
7
7
|
create(payloadData: IPayloadDataBase): Promise<undefined>;
|
|
8
8
|
refresh(payloadData: IPayloadDataBase): Promise<undefined>;
|
|
9
9
|
remove(payloadData: IPayloadDataBase): Promise<void>;
|
|
10
|
-
removeAll(user:
|
|
10
|
+
removeAll(user: IUser): Promise<void>;
|
|
11
11
|
private _getAuthRedisKey;
|
|
12
12
|
private _getAuthRedisKeyPrefix;
|
|
13
13
|
private _getToken;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IPayloadDataBase } from 'vona-module-a-jwt';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IUser } from './user.ts';
|
|
3
3
|
export interface IAuthTokenAdapter {
|
|
4
4
|
create(payloadData: IPayloadDataBase): Promise<IPayloadDataBase>;
|
|
5
5
|
retrieve(payloadData: IPayloadDataBase): Promise<IPayloadDataBase | undefined>;
|
|
6
6
|
verify(payloadData: IPayloadDataBase): Promise<boolean>;
|
|
7
7
|
refresh(payloadData: IPayloadDataBase): Promise<void>;
|
|
8
8
|
remove(payloadData: IPayloadDataBase): Promise<void>;
|
|
9
|
-
removeAll(user:
|
|
9
|
+
removeAll(user: IUser): Promise<void>;
|
|
10
10
|
}
|
package/dist/types/passport.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { IPayloadDataBase } from 'vona-module-a-jwt';
|
|
2
2
|
import type { IAuthBase } from './auth.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export interface
|
|
6
|
-
user?:
|
|
3
|
+
import type { IRole } from './role.ts';
|
|
4
|
+
import type { IUser } from './user.ts';
|
|
5
|
+
export interface IPassport {
|
|
6
|
+
user?: IUser;
|
|
7
7
|
auth?: IAuthBase;
|
|
8
|
-
roles?:
|
|
8
|
+
roles?: IRole[];
|
|
9
9
|
}
|
|
10
10
|
export interface IPassportAdapter {
|
|
11
|
-
isAdmin(passport:
|
|
12
|
-
setCurrent(passport:
|
|
13
|
-
serialize(passport:
|
|
14
|
-
deserialize(payloadData: IPayloadDataBase): Promise<
|
|
11
|
+
isAdmin(passport: IPassport | undefined): Promise<boolean>;
|
|
12
|
+
setCurrent(passport: IPassport | undefined): Promise<IPassport | undefined>;
|
|
13
|
+
serialize(passport: IPassport): Promise<IPayloadDataBase>;
|
|
14
|
+
deserialize(payloadData: IPayloadDataBase): 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
|
}
|