@zauru-sdk/services 2.0.144 → 2.0.146
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.
|
@@ -5,8 +5,7 @@ const sessionCookie = createCookie("_rj_session", {
|
|
|
5
5
|
path: "/",
|
|
6
6
|
sameSite: process.env.NODE_ENV === "production" ? "none" : "lax",
|
|
7
7
|
httpOnly: true,
|
|
8
|
-
maxAge: 60 * 60 *
|
|
9
|
-
//expires,
|
|
8
|
+
maxAge: 60 * 60 * 8,
|
|
10
9
|
secure: process.env.NODE_ENV === "production",
|
|
11
10
|
});
|
|
12
11
|
const { getSession, commitSession, destroySession } = createUpstashSessionStorage({ cookie: sessionCookie });
|
|
@@ -7,6 +7,9 @@ const headers = {
|
|
|
7
7
|
Accept: "application/json",
|
|
8
8
|
"Content-Type": "application/json",
|
|
9
9
|
};
|
|
10
|
+
const expiresToSeconds = (expires) => {
|
|
11
|
+
return Math.floor((expires.getTime() - new Date().getTime()) / 1000);
|
|
12
|
+
};
|
|
10
13
|
//Le quité la expiración porque era muy corta para recepciones,
|
|
11
14
|
//antes se definía algo así: await fetch(`${redisBaseURL}/set/${id}?EX=${expiresToSeconds(expires)}`
|
|
12
15
|
//Estaba en el createData y en el updateData
|
|
@@ -16,7 +19,7 @@ export function createUpstashSessionStorage({ cookie }) {
|
|
|
16
19
|
cookie,
|
|
17
20
|
async createData(data, expires) {
|
|
18
21
|
const id = crypto.randomUUID();
|
|
19
|
-
await fetch(`${redisBaseURL}/set/${id}?EX=${
|
|
22
|
+
await fetch(`${redisBaseURL}/set/${id}?EX=${expires ? expiresToSeconds(expires) : 60 * 60 * 8}`, {
|
|
20
23
|
method: "post",
|
|
21
24
|
body: JSON.stringify({ data }),
|
|
22
25
|
headers,
|
|
@@ -36,7 +39,7 @@ export function createUpstashSessionStorage({ cookie }) {
|
|
|
36
39
|
}
|
|
37
40
|
},
|
|
38
41
|
async updateData(id, data, expires) {
|
|
39
|
-
await fetch(`${redisBaseURL}/set/${id}?EX=${
|
|
42
|
+
await fetch(`${redisBaseURL}/set/${id}?EX=${expires ? expiresToSeconds(expires) : 60 * 60 * 8}`, {
|
|
40
43
|
method: "post",
|
|
41
44
|
body: JSON.stringify({ data }),
|
|
42
45
|
headers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.146",
|
|
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": "1c5bd079b50eecb99c9f29029fa7f9376c082d0b"
|
|
35
35
|
}
|