@driveflux/auth 4.0.48 → 4.0.50

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.
@@ -1 +1 @@
1
- {"version":3,"file":"next-auth.d.ts","sourceRoot":"","sources":["../../src/server/next-auth.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,IAAI,IAAI,WAAW,EAAmB,MAAM,WAAW,CAAA;AA4BrE,eAAO,MAAM,oBAAoB,GAChC,MAAM,WAAW,KACf,OAAO,CAAC,MAAM,CAehB,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAQlB,MAAM,CAAC,UAAU,GAAG,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3D,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAQ/B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;mCAmR8xG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADnxG,CAAA"}
1
+ {"version":3,"file":"next-auth.d.ts","sourceRoot":"","sources":["../../src/server/next-auth.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,IAAI,IAAI,WAAW,EAAmB,MAAM,WAAW,CAAA;AA4BrE,eAAO,MAAM,oBAAoB,GAChC,MAAM,WAAW,KACf,OAAO,CAAC,MAAM,CAehB,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAQlB,MAAM,CAAC,UAAU,GAAG,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3D,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAQ/B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;mCAyRijG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADtiG,CAAA"}
@@ -160,14 +160,20 @@ export const authOptions = {
160
160
  if (trigger === 'update' || !tokenRoles || !areArraysSimilar(tokenRoles, user.groups)) {
161
161
  const newSessionToken = await generateSessionToken(user);
162
162
  // We can't call the update session from the patch because it searches by sessionToken and not by ID
163
- await prisma.session.update({
164
- where: {
165
- sessionToken: session.sessionToken
166
- },
167
- data: {
168
- sessionToken: newSessionToken
169
- }
170
- });
163
+ try {
164
+ await prisma.session.update({
165
+ where: {
166
+ sessionToken: session.sessionToken
167
+ },
168
+ data: {
169
+ sessionToken: newSessionToken
170
+ }
171
+ });
172
+ } catch (_e) {
173
+ // Sometimes, concurrent requests can happen and one would update
174
+ // before the other, so prisma won't find it based on sessionToken and throw
175
+ // Nothing to do in this case
176
+ }
171
177
  // @ts-expect-error dirty property to be removed in the patch
172
178
  finalSession.newSessionToken = newSessionToken;
173
179
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/auth",
3
- "version": "4.0.48",
3
+ "version": "4.0.50",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -75,7 +75,7 @@
75
75
  "@casl/ability": "^6.7.3",
76
76
  "@casl/prisma": "^1.5.2",
77
77
  "@driveflux/config": "3.0.7",
78
- "@driveflux/db": "4.0.18",
78
+ "@driveflux/db": "4.0.22",
79
79
  "@driveflux/fetch": "8.0.0",
80
80
  "@driveflux/problem": "6.0.0",
81
81
  "@driveflux/reporter": "7.0.1",