vona-module-a-user 5.0.30 → 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.
Files changed (2) hide show
  1. package/dist/index.js +4 -6
  2. package/package.json +1 -1
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.app.bean.executor.newCtx(async () => {
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]',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-user",
3
3
  "type": "module",
4
- "version": "5.0.30",
4
+ "version": "5.0.31",
5
5
  "title": "a-user",
6
6
  "vonaModule": {
7
7
  "dependencies": {}