@social-mail/social-mail-web-server 1.8.407 → 1.8.411

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.8.407",
3
+ "version": "1.8.411",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/WebServer.ts CHANGED
@@ -257,7 +257,7 @@ export default class WebServer {
257
257
  ServiceCollection.register("Scoped", ReadOnlySocialMailContext);
258
258
 
259
259
  ServiceCollection.registerMultiple("Scoped", [ AppDbContext, SocialMailContext], SocialMailContext);
260
- ServiceCollection.registerMultiple("Scoped", [UserInfoProvider, AuthorizationService], UserInfoProvider);
260
+ ServiceCollection.registerMultiple("Singleton", [UserInfoProvider, AuthorizationService], UserInfoProvider);
261
261
  ServiceCollection.registerMultiple("Singleton", [AppSocketService, SocketService], AppSocketService);
262
262
  ServiceCollection.registerMultiple("Singleton", [AppKeyProvider, KeyProvider], AppKeyProvider);
263
263
  ServiceCollection.registerMultiple("Singleton", [ ContextEvents ], SocialMailContextEvents);
@@ -3,7 +3,6 @@ import AuthorizationService, { ICookie } from "@entity-access/server-pages/dist/
3
3
  import SocialMailContext from "../model/SocialMailContext.js";
4
4
  import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
5
5
  import { SessionUser } from "@entity-access/server-pages/dist/core/SessionUser.js";
6
- import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
7
6
  import BaseDiskCache from "../../common/BaseDiskCache.js";
8
7
  import { join } from "path";
9
8
  import { globalEnv } from "../../common/globalEnv.js";
@@ -36,6 +35,11 @@ export default class UserAuthorizationService extends AuthorizationService {
36
35
  return await this.loadSessionFromDb(sessionID);
37
36
  });
38
37
  user.sessionID = info.sessionID;
38
+ if (!info.userID) {
39
+ // delete cache. cache is invalid...
40
+ await this.diskCache.deleteAt(keyPath);
41
+ return;
42
+ }
39
43
  user.userID = info.userID;
40
44
  user.roles = info.roles;
41
45
  user.expiry = info.expiry;
@@ -72,7 +76,7 @@ export default class UserAuthorizationService extends AuthorizationService {
72
76
  ])
73
77
  .first();
74
78
  if (!session?.user) {
75
- throw new EntityAccessError(`Session not found for session id ${sessionID}`);
79
+ return { sessionID };
76
80
  }
77
81
 
78
82
  // extend session...