@zauru-sdk/services 2.0.189 → 2.0.191
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.
|
@@ -10,4 +10,24 @@ const sessionCookie = createCookie("_rj_session", {
|
|
|
10
10
|
secure: process.env.NODE_ENV === "production",
|
|
11
11
|
});
|
|
12
12
|
const { getSession, commitSession, destroySession } = createUpstashSessionStorage({ cookie: sessionCookie });
|
|
13
|
-
|
|
13
|
+
const getRefreshSession = async (request, session) => {
|
|
14
|
+
try {
|
|
15
|
+
const cookie = request.headers.get("Cookie");
|
|
16
|
+
const currentSession = await getSession(cookie);
|
|
17
|
+
if (!currentSession) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return await commitSession(session, {
|
|
21
|
+
maxAge: 60 * 60 * 24,
|
|
22
|
+
path: "/",
|
|
23
|
+
sameSite: process.env.NODE_ENV === "production" ? "none" : "lax",
|
|
24
|
+
httpOnly: true,
|
|
25
|
+
secure: process.env.NODE_ENV === "production",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error("Ocurrio un error al refrescar la session", error);
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export { getSession, commitSession, destroySession, getRefreshSession };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Session } from "@remix-run/node";
|
|
2
|
+
declare const getSession: (cookieHeader?: string | null, options?: import("cookie").CookieParseOptions) => Promise<Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>>, commitSession: (session: Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>, destroySession: (session: Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>;
|
|
3
|
+
declare const getRefreshSession: (request: Request, session: Session) => Promise<string | null>;
|
|
4
|
+
export { getSession, commitSession, destroySession, getRefreshSession };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.191",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"axios": "^1.6.7",
|
|
32
32
|
"chalk": "5.3.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "2a27efe6c76b8ceb79f307784df27a3abeed1882"
|
|
35
35
|
}
|