vona-module-a-user 5.0.29 → 5.0.31
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 +4 -0
- package/dist/index.js +4 -6
- package/package.json +1 -1
|
@@ -21,18 +21,21 @@ declare module 'vona-module-a-user' {
|
|
|
21
21
|
interface GuardPassport {
|
|
22
22
|
get $beanFullName(): 'a-user.guard.passport';
|
|
23
23
|
get $onionName(): 'a-user:passport';
|
|
24
|
+
get $onionOptions(): IGuardOptionsPassport;
|
|
24
25
|
}
|
|
25
26
|
interface GuardRoleName {
|
|
26
27
|
}
|
|
27
28
|
interface GuardRoleName {
|
|
28
29
|
get $beanFullName(): 'a-user.guard.roleName';
|
|
29
30
|
get $onionName(): 'a-user:roleName';
|
|
31
|
+
get $onionOptions(): IGuardOptionsRoleName;
|
|
30
32
|
}
|
|
31
33
|
interface GuardUserName {
|
|
32
34
|
}
|
|
33
35
|
interface GuardUserName {
|
|
34
36
|
get $beanFullName(): 'a-user.guard.userName';
|
|
35
37
|
get $onionName(): 'a-user:userName';
|
|
38
|
+
get $onionOptions(): IGuardOptionsUserName;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
/** guard: end */
|
|
@@ -121,6 +124,7 @@ declare module 'vona-module-a-user' {
|
|
|
121
124
|
interface CacheRedisAuthToken {
|
|
122
125
|
get $beanFullName(): 'a-user.cacheRedis.authToken';
|
|
123
126
|
get $onionName(): 'a-user:authToken';
|
|
127
|
+
get $onionOptions(): IDecoratorCacheRedisOptions;
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
/** cacheRedis: end */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BeanInfo, BeanBase, beanFullNameFromOnionName, createHash, uuidv4, BeanScopeBase } from 'vona';
|
|
2
|
-
import { catchError } from '@cabloy/utils';
|
|
2
|
+
import { catchError, isNil } from '@cabloy/utils';
|
|
3
3
|
import { Guard, Aspect } from 'vona-module-a-aspect';
|
|
4
4
|
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
5
5
|
import { CacheRedis, BeanCacheRedisBase } from 'vona-module-a-cache';
|
|
@@ -164,6 +164,7 @@ let BeanPassport = (_dec$c = Bean(), _dec2$c = BeanInfo({
|
|
|
164
164
|
return this.ctx.state.passport?.roles;
|
|
165
165
|
}
|
|
166
166
|
async signin(passport, options) {
|
|
167
|
+
if (isNil(this.ctx.instanceName)) throw new Error('should specify instance');
|
|
167
168
|
// current
|
|
168
169
|
await this.setCurrent(passport);
|
|
169
170
|
// event
|
|
@@ -188,6 +189,7 @@ let BeanPassport = (_dec$c = Bean(), _dec2$c = BeanInfo({
|
|
|
188
189
|
await this.setCurrent(undefined);
|
|
189
190
|
}
|
|
190
191
|
async signinSystem(authName, authId, name, options) {
|
|
192
|
+
if (isNil(this.ctx.instanceName)) throw new Error('should specify instance');
|
|
191
193
|
const user = await this.bean.user.findOneByName(name ?? 'admin');
|
|
192
194
|
if (!user) return this.app.throw(401);
|
|
193
195
|
const auth = {
|
|
@@ -539,11 +541,7 @@ let MetaPrintTip = (_dec$1 = Meta(), _dec2$1 = BeanInfo({
|
|
|
539
541
|
async execute() {
|
|
540
542
|
if (!this.app.meta.isDev) return;
|
|
541
543
|
// signin
|
|
542
|
-
const jwt = await this.
|
|
543
|
-
return await this.bean.passport.signinSystem('dev', '-1');
|
|
544
|
-
}, {
|
|
545
|
-
instanceName: ''
|
|
546
|
-
});
|
|
544
|
+
const jwt = await this.bean.passport.signinSystem('dev', '-1');
|
|
547
545
|
const accessToken = jwt.accessToken;
|
|
548
546
|
return {
|
|
549
547
|
title: 'access token [admin] [dev]',
|