vona-module-a-user 5.0.32 → 5.0.33
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/.metadata/index.d.ts +9 -9
- package/dist/bean/bean.passport.d.ts +0 -1
- package/dist/bean/bean.role.d.ts +1 -0
- package/dist/bean/bean.user.d.ts +2 -0
- package/dist/bean/event.createAnonymous.d.ts +6 -0
- package/dist/index.js +17 -12
- package/package.json +1 -1
- package/dist/bean/event.createUserAnonymous.d.ts +0 -6
|
@@ -136,7 +136,7 @@ export interface IModuleCacheRedis {
|
|
|
136
136
|
/** cacheRedis: end */
|
|
137
137
|
/** event: begin */
|
|
138
138
|
export * from '../bean/event.activate.ts';
|
|
139
|
-
export * from '../bean/event.
|
|
139
|
+
export * from '../bean/event.createAnonymous.ts';
|
|
140
140
|
export * from '../bean/event.register.ts';
|
|
141
141
|
export * from '../bean/event.signin.ts';
|
|
142
142
|
export * from '../bean/event.signout.ts';
|
|
@@ -150,11 +150,11 @@ declare module 'vona-module-a-user' {
|
|
|
150
150
|
get $beanFullName(): 'a-user.event.activate';
|
|
151
151
|
get $onionName(): 'a-user:activate';
|
|
152
152
|
}
|
|
153
|
-
interface
|
|
153
|
+
interface EventCreateAnonymous {
|
|
154
154
|
}
|
|
155
|
-
interface
|
|
156
|
-
get $beanFullName(): 'a-user.event.
|
|
157
|
-
get $onionName(): 'a-user:
|
|
155
|
+
interface EventCreateAnonymous {
|
|
156
|
+
get $beanFullName(): 'a-user.event.createAnonymous';
|
|
157
|
+
get $onionName(): 'a-user:createAnonymous';
|
|
158
158
|
}
|
|
159
159
|
interface EventRegister {
|
|
160
160
|
}
|
|
@@ -178,13 +178,13 @@ declare module 'vona-module-a-user' {
|
|
|
178
178
|
/** event: end */
|
|
179
179
|
/** event: begin */
|
|
180
180
|
import type { EventActivate } from '../bean/event.activate.ts';
|
|
181
|
-
import type {
|
|
181
|
+
import type { EventCreateAnonymous } from '../bean/event.createAnonymous.ts';
|
|
182
182
|
import type { EventRegister } from '../bean/event.register.ts';
|
|
183
183
|
import type { EventSignin } from '../bean/event.signin.ts';
|
|
184
184
|
import type { EventSignout } from '../bean/event.signout.ts';
|
|
185
185
|
export interface IModuleEvent {
|
|
186
186
|
'activate': EventActivate;
|
|
187
|
-
'
|
|
187
|
+
'createAnonymous': EventCreateAnonymous;
|
|
188
188
|
'register': EventRegister;
|
|
189
189
|
'signin': EventSignin;
|
|
190
190
|
'signout': EventSignout;
|
|
@@ -192,7 +192,7 @@ export interface IModuleEvent {
|
|
|
192
192
|
/** event: end */
|
|
193
193
|
/** event: begin */
|
|
194
194
|
import type { TypeEventActivateData, TypeEventActivateResult } from '../bean/event.activate.ts';
|
|
195
|
-
import type {
|
|
195
|
+
import type { TypeEventCreateAnonymousData, TypeEventCreateAnonymousResult } from '../bean/event.createAnonymous.ts';
|
|
196
196
|
import type { TypeEventRegisterData, TypeEventRegisterResult } from '../bean/event.register.ts';
|
|
197
197
|
import type { TypeEventSigninData, TypeEventSigninResult } from '../bean/event.signin.ts';
|
|
198
198
|
import type { TypeEventSignoutData, TypeEventSignoutResult } from '../bean/event.signout.ts';
|
|
@@ -200,7 +200,7 @@ import type { EventOn } from 'vona-module-a-event';
|
|
|
200
200
|
declare module 'vona-module-a-event' {
|
|
201
201
|
interface IEventRecord {
|
|
202
202
|
'a-user:activate': EventOn<TypeEventActivateData, TypeEventActivateResult>;
|
|
203
|
-
'a-user:
|
|
203
|
+
'a-user:createAnonymous': EventOn<TypeEventCreateAnonymousData, TypeEventCreateAnonymousResult>;
|
|
204
204
|
'a-user:register': EventOn<TypeEventRegisterData, TypeEventRegisterResult>;
|
|
205
205
|
'a-user:signin': EventOn<TypeEventSigninData, TypeEventSigninResult>;
|
|
206
206
|
'a-user:signout': EventOn<TypeEventSignoutData, TypeEventSignoutResult>;
|
|
@@ -23,7 +23,6 @@ export declare class BeanPassport extends BeanBase {
|
|
|
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
|
-
createUserAnonymous(): Promise<IUserBase>;
|
|
27
26
|
kickOut(user?: IUserBase): Promise<void>;
|
|
28
27
|
checkAuthToken(accessToken?: string, clientName?: keyof IJwtClientRecord, options?: IJwtVerifyOptions): Promise<IPayloadDataBase | undefined>;
|
|
29
28
|
refreshAuthToken(refreshToken: string): Promise<IJwtToken>;
|
package/dist/bean/bean.role.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class BeanRole extends BeanBase {
|
|
|
5
5
|
private _roleAdapter;
|
|
6
6
|
private get roleAdapter();
|
|
7
7
|
findOneByName(name: string): Promise<IRoleBase | undefined>;
|
|
8
|
+
findOneById(id: TableIdentity): Promise<IRoleBase | undefined>;
|
|
8
9
|
findOne(role: Partial<IRoleBase>): Promise<IRoleBase | undefined>;
|
|
9
10
|
findAllByUserId(userId: TableIdentity): Promise<IRoleBase[] | undefined>;
|
|
10
11
|
}
|
package/dist/bean/bean.user.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
1
2
|
import type { IAuthUserProfile } from '../types/authProfile.ts';
|
|
2
3
|
import type { IUserBase } from '../types/user.ts';
|
|
3
4
|
import { BeanBase } from 'vona';
|
|
@@ -9,6 +10,7 @@ export declare class BeanUser extends BeanBase {
|
|
|
9
10
|
registerByProfile(profile: IAuthUserProfile): Promise<IUserBase>;
|
|
10
11
|
createAnonymous(): Promise<IUserBase>;
|
|
11
12
|
findOneByName(name: string): Promise<IUserBase | undefined>;
|
|
13
|
+
findOneById(id: TableIdentity): Promise<IUserBase | undefined>;
|
|
12
14
|
findOne(user: Partial<IUserBase>): Promise<IUserBase | undefined>;
|
|
13
15
|
update(user: Partial<IUserBase>): Promise<void>;
|
|
14
16
|
remove(user: Partial<IUserBase>): Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IUserBase } from '../types/user.ts';
|
|
2
|
+
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
|
+
export type TypeEventCreateAnonymousData = undefined;
|
|
4
|
+
export type TypeEventCreateAnonymousResult = Partial<IUserBase>;
|
|
5
|
+
export declare class EventCreateAnonymous extends BeanEventBase<TypeEventCreateAnonymousData, TypeEventCreateAnonymousResult> {
|
|
6
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -205,20 +205,13 @@ let BeanPassport = (_dec$c = Bean(), _dec2$c = BeanInfo({
|
|
|
205
205
|
return await this.signinSystem('mock', -1e4 - ++this._mockCounter, name, options);
|
|
206
206
|
}
|
|
207
207
|
async signinWithAnonymous() {
|
|
208
|
-
const userAnonymous = await this.
|
|
208
|
+
const userAnonymous = await this.bean.user.createAnonymous();
|
|
209
209
|
const passport = {
|
|
210
210
|
user: userAnonymous,
|
|
211
211
|
auth: undefined
|
|
212
212
|
};
|
|
213
213
|
await this.setCurrent(passport);
|
|
214
214
|
}
|
|
215
|
-
async createUserAnonymous() {
|
|
216
|
-
const userAnonymous = await this.bean.user.createAnonymous();
|
|
217
|
-
// event
|
|
218
|
-
await this.scope.event.createUserAnonymous.emit(userAnonymous);
|
|
219
|
-
// ok
|
|
220
|
-
return userAnonymous;
|
|
221
|
-
}
|
|
222
215
|
async kickOut(user) {
|
|
223
216
|
if (!user) return;
|
|
224
217
|
await this.authTokenAdapter.removeAll(user);
|
|
@@ -344,6 +337,11 @@ let BeanRole = (_dec$b = Bean(), _dec2$b = BeanInfo({
|
|
|
344
337
|
findOneByName(name) {
|
|
345
338
|
return this.roleAdapter.findOneByName(name);
|
|
346
339
|
}
|
|
340
|
+
findOneById(id) {
|
|
341
|
+
return this.roleAdapter.findOne({
|
|
342
|
+
id
|
|
343
|
+
});
|
|
344
|
+
}
|
|
347
345
|
findOne(role) {
|
|
348
346
|
return this.roleAdapter.findOne(role);
|
|
349
347
|
}
|
|
@@ -394,11 +392,18 @@ let BeanUser = (_dec$a = Bean(), _dec2$a = BeanInfo({
|
|
|
394
392
|
return await this.register(user, profile.confirmed);
|
|
395
393
|
}
|
|
396
394
|
async createAnonymous() {
|
|
397
|
-
return this.
|
|
395
|
+
return await this.scope.event.createAnonymous.emit(undefined, async () => {
|
|
396
|
+
return await this.userAdapter.createAnonymous();
|
|
397
|
+
});
|
|
398
398
|
}
|
|
399
399
|
async findOneByName(name) {
|
|
400
400
|
return this.userAdapter.findOneByName(name);
|
|
401
401
|
}
|
|
402
|
+
async findOneById(id) {
|
|
403
|
+
return this.userAdapter.findOne({
|
|
404
|
+
id
|
|
405
|
+
});
|
|
406
|
+
}
|
|
402
407
|
async findOne(user) {
|
|
403
408
|
return this.userAdapter.findOne(user);
|
|
404
409
|
}
|
|
@@ -515,9 +520,9 @@ let EventActivate = (_dec$6 = Event(), _dec2$6 = BeanInfo({
|
|
|
515
520
|
}), _dec$6(_class$6 = _dec2$6(_class$6 = class EventActivate extends BeanEventBase {}) || _class$6) || _class$6);
|
|
516
521
|
|
|
517
522
|
var _dec$5, _dec2$5, _class$5;
|
|
518
|
-
let
|
|
523
|
+
let EventCreateAnonymous = (_dec$5 = Event(), _dec2$5 = BeanInfo({
|
|
519
524
|
module: "a-user"
|
|
520
|
-
}), _dec$5(_class$5 = _dec2$5(_class$5 = class
|
|
525
|
+
}), _dec$5(_class$5 = _dec2$5(_class$5 = class EventCreateAnonymous extends BeanEventBase {}) || _class$5) || _class$5);
|
|
521
526
|
|
|
522
527
|
var _dec$4, _dec2$4, _class$4;
|
|
523
528
|
let EventRegister = (_dec$4 = Event(), _dec2$4 = BeanInfo({
|
|
@@ -616,4 +621,4 @@ function $getUserIdSystem(_userName, userId) {
|
|
|
616
621
|
return userId;
|
|
617
622
|
}
|
|
618
623
|
|
|
619
|
-
export { $getAuthIdSystem, $getUserIdSystem, BeanPassport, BeanRole, BeanUser, CacheRedisAuthToken, EventActivate,
|
|
624
|
+
export { $getAuthIdSystem, $getUserIdSystem, BeanPassport, BeanRole, BeanUser, CacheRedisAuthToken, EventActivate, EventCreateAnonymous, EventRegister, EventSignin, EventSignout, GuardPassport, GuardRoleName, GuardUserName, MetaPrintTip, Passport, ScopeModuleAUser, ServiceAuthTokenAdapter, ServiceRedisToken, config };
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IUserBase } from '../types/user.ts';
|
|
2
|
-
import { BeanEventBase } from 'vona-module-a-event';
|
|
3
|
-
export type TypeEventCreateUserAnonymousData = IUserBase;
|
|
4
|
-
export type TypeEventCreateUserAnonymousResult = void;
|
|
5
|
-
export declare class EventCreateUserAnonymous extends BeanEventBase<TypeEventCreateUserAnonymousData, TypeEventCreateUserAnonymousResult> {
|
|
6
|
-
}
|