@unchainedshop/api 4.8.2 → 4.8.3
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/lib/fastify/index.js +4 -0
- package/package.json +1 -1
package/lib/fastify/index.js
CHANGED
|
@@ -29,6 +29,7 @@ const middlewareHook = async function middlewareHook(req, reply) {
|
|
|
29
29
|
const { impersonator } = options;
|
|
30
30
|
req.session.userId = user._id;
|
|
31
31
|
req.session.impersonatorId = impersonator?._id;
|
|
32
|
+
await req.session.save();
|
|
32
33
|
const tokenObject = {
|
|
33
34
|
_id: req.session.sessionId,
|
|
34
35
|
userId: user._id,
|
|
@@ -45,6 +46,7 @@ const middlewareHook = async function middlewareHook(req, reply) {
|
|
|
45
46
|
};
|
|
46
47
|
req.session.userId = null;
|
|
47
48
|
req.session.impersonatorId = null;
|
|
49
|
+
await req.session.save();
|
|
48
50
|
await emit(API_EVENTS.API_LOGOUT, tokenObject);
|
|
49
51
|
return true;
|
|
50
52
|
};
|
|
@@ -109,6 +111,8 @@ export const connect = (fastify, { graphqlHandler, db, unchainedAPI, }, { allowR
|
|
|
109
111
|
fastify.register(fastifySession, {
|
|
110
112
|
secret: process.env.UNCHAINED_TOKEN_SECRET,
|
|
111
113
|
cookieName,
|
|
114
|
+
rolling: false,
|
|
115
|
+
saveUninitialized: false,
|
|
112
116
|
store: MongoStore.create({
|
|
113
117
|
client: db.client,
|
|
114
118
|
dbName: db.databaseName,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/api",
|
|
3
3
|
"description": "GraphQL API layer for the Unchained Engine with Express/Fastify adapters and MCP server",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.3",
|
|
5
5
|
"main": "lib/api-index.js",
|
|
6
6
|
"types": "lib/api-index.d.ts",
|
|
7
7
|
"type": "module",
|