proto.io 0.0.150 → 0.0.151

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.
@@ -1,5 +1,5 @@
1
- import { T as TSchema, P as ProtoService } from '../../internals/index-013pxZ3P.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
1
+ import { T as TSchema, P as ProtoService } from '../../internals/index-DGI4rZSw.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-Wck9rIH6.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
- import { P as ProtoService } from '../../internals/index-013pxZ3P.js';
2
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
1
+ import { P as ProtoService } from '../../internals/index-DGI4rZSw.js';
2
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-Wck9rIH6.js';
3
3
  import '@o2ter/utils-js';
4
4
  import 'jsonwebtoken';
5
5
  import '@o2ter/server-js';
@@ -1,7 +1,7 @@
1
1
  import * as _google_cloud_storage from '@google-cloud/storage';
2
2
  import { Storage } from '@google-cloud/storage';
3
- import { P as ProtoService } from '../../internals/index-013pxZ3P.js';
4
- import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-CyX8Lu9K.js';
3
+ import { P as ProtoService } from '../../internals/index-DGI4rZSw.js';
4
+ import { F as FileStorageBase, a as FileStorageOptions } from '../../internals/index-Wck9rIH6.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'jsonwebtoken';
7
7
  import '@o2ter/server-js';
@@ -1,5 +1,5 @@
1
1
  import { Pool, PoolClient, PoolConfig } from 'pg';
2
- import { _ as _TValue, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-013pxZ3P.js';
2
+ import { _ as _TValue, n as EventData, T as TSchema, o as DecodedQuery, F as FindOptions, Q as QuerySelector, p as DecodedSortOption, I as InsertOptions, q as TValue, r as FindOneOptions, t as TUpdateOp, u as FieldSelectorExpression, v as QueryExpression, w as TStorage, x as TransactionOptions, h as TObject, y as TQueryRandomOptions, z as TPubSub } from '../../internals/index-DGI4rZSw.js';
3
3
  import * as _o2ter_utils_js from '@o2ter/utils-js';
4
4
  import { asyncStream } from '@o2ter/utils-js';
5
5
  import 'jsonwebtoken';
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { P as ProtoClient } from './internals/index-CsRN32Jf.js';
2
- export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CsRN32Jf.js';
1
+ import { P as ProtoClient } from './internals/index-DoamtgZq.js';
2
+ export { c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DoamtgZq.js';
3
3
  export { Decimal } from 'decimal.js';
4
- export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-013pxZ3P.js';
4
+ export { D as DeserializeOptions, S as SerializeOptions, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DGI4rZSw.js';
5
5
  import '@o2ter/utils-js';
6
6
  import 'socket.io-client';
7
7
  import '@socket.io/component-emitter';
package/dist/index.d.ts CHANGED
@@ -2,11 +2,11 @@ import * as socket_io from 'socket.io';
2
2
  import * as socket_io_dist_typed_events from 'socket.io/dist/typed-events';
3
3
  import * as express_serve_static_core from 'express-serve-static-core';
4
4
  import { Server, RequestHandler } from '@o2ter/server-js';
5
- import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-013pxZ3P.js';
6
- export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-013pxZ3P.js';
5
+ import { T as TSchema, _ as _TValue, P as ProtoService, a as ProtoServiceOptions, b as ProtoServiceKeyOptions } from './internals/index-DGI4rZSw.js';
6
+ export { D as DeserializeOptions, S as SerializeOptions, c as TFileStorage, d as TSerializable, e as deserialize, s as serialize } from './internals/index-DGI4rZSw.js';
7
7
  import Decimal from 'decimal.js';
8
8
  export { Decimal } from 'decimal.js';
9
- export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-CsRN32Jf.js';
9
+ export { P as ProtoClient, c as classExtends, e as isFile, a as isObject, i as isQuery, d as isRole, b as isUser } from './internals/index-DoamtgZq.js';
10
10
  import '@o2ter/utils-js';
11
11
  import 'jsonwebtoken';
12
12
  import 'lodash';
package/dist/index.js CHANGED
@@ -1147,9 +1147,9 @@ const sessionId = (proto, request) => {
1147
1147
  const sessionInfoMap = new WeakMap();
1148
1148
  const fetchSessionInfo = async (proto, userId) => {
1149
1149
  const user = _.isString(userId) ? await proto.Query('User').get(userId, { master: true }) : undefined;
1150
- const roles = user instanceof index.TUser ? _.compact(_.map(await proto.userRoles(user), x => x.name)) : [];
1150
+ const roles = user instanceof index.TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
1151
1151
  return {
1152
- roles: roles,
1152
+ _roles: roles,
1153
1153
  user: user instanceof index.TUser ? user : undefined,
1154
1154
  };
1155
1155
  };
@@ -1346,9 +1346,13 @@ class ProtoService extends index.ProtoType {
1346
1346
  const session = await this.sessionInfo();
1347
1347
  return session?.user;
1348
1348
  }
1349
- async currentRoles() {
1349
+ async _currentRoles() {
1350
1350
  const session = await this.sessionInfo();
1351
- return session?.roles ?? [];
1351
+ return session?._roles ?? [];
1352
+ }
1353
+ async currentRoles() {
1354
+ const roles = await this._currentRoles();
1355
+ return _.compact(_.map(roles, x => x.name));
1352
1356
  }
1353
1357
  get isMaster() {
1354
1358
  return this.req ? sessionIsMaster(this, this.req) === 'valid' : false;