proto.io 0.0.196 → 0.0.197
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/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1285,8 +1285,14 @@ const sessionId = (proto, request) => {
|
|
|
1285
1285
|
};
|
|
1286
1286
|
const userCacheMap = new WeakMap;
|
|
1287
1287
|
const fetchSessionInfo = async (proto, userId) => {
|
|
1288
|
-
if (!userId)
|
|
1289
|
-
|
|
1288
|
+
if (!userId) {
|
|
1289
|
+
const user = proto.req ? await proto[PVK].options.userResolver(proto, undefined) : undefined;
|
|
1290
|
+
const _roles = user instanceof TUser ? _.filter(await proto.userRoles(user), x => !_.isEmpty(x.name)) : [];
|
|
1291
|
+
return {
|
|
1292
|
+
user: user?.clone(),
|
|
1293
|
+
_roles: _.map(_roles, x => x.clone()),
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1290
1296
|
if (!userCacheMap.has(proto[PVK]))
|
|
1291
1297
|
userCacheMap.set(proto[PVK], {});
|
|
1292
1298
|
const cache = userCacheMap.get(proto[PVK]);
|