@thunderid/nextjs 1.1.0 → 1.2.1

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.
Files changed (57) hide show
  1. package/dist/ThunderIDNextClient.js +1 -1
  2. package/dist/ThunderIDNextClient.js.map +1 -1
  3. package/dist/cjs/ThunderIDNextClient.cjs +1 -1
  4. package/dist/cjs/ThunderIDNextClient.cjs.map +1 -1
  5. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs +1 -2
  6. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  7. package/dist/cjs/index.cjs +2 -0
  8. package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs +2 -4
  9. package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs.map +1 -1
  10. package/dist/cjs/server/actions/signInAction.cjs +1 -1
  11. package/dist/cjs/server/actions/signInAction.cjs.map +1 -1
  12. package/dist/cjs/server/backchannelLogout.cjs +92 -0
  13. package/dist/cjs/server/backchannelLogout.cjs.map +1 -0
  14. package/dist/cjs/server/index.cjs +2 -0
  15. package/dist/cjs/server/proxy/thunderIDProxy.cjs +4 -1
  16. package/dist/cjs/server/proxy/thunderIDProxy.cjs.map +1 -1
  17. package/dist/cjs/utils/SessionManager.cjs +17 -1
  18. package/dist/cjs/utils/SessionManager.cjs.map +1 -1
  19. package/dist/cjs/utils/handleRefreshToken.cjs +5 -2
  20. package/dist/cjs/utils/handleRefreshToken.cjs.map +1 -1
  21. package/dist/cjs/utils/loggedOutSessions.cjs +32 -0
  22. package/dist/cjs/utils/loggedOutSessions.cjs.map +1 -0
  23. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts +1 -1
  24. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  25. package/dist/client/contexts/ThunderID/ThunderIDProvider.js +1 -2
  26. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  27. package/dist/index.js +2 -1
  28. package/dist/server/actions/handleOAuthCallbackAction.d.ts +1 -2
  29. package/dist/server/actions/handleOAuthCallbackAction.d.ts.map +1 -1
  30. package/dist/server/actions/handleOAuthCallbackAction.js +2 -4
  31. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -1
  32. package/dist/server/actions/signInAction.d.ts.map +1 -1
  33. package/dist/server/actions/signInAction.js +1 -1
  34. package/dist/server/actions/signInAction.js.map +1 -1
  35. package/dist/server/backchannelLogout.d.ts +40 -0
  36. package/dist/server/backchannelLogout.d.ts.map +1 -0
  37. package/dist/server/backchannelLogout.js +90 -0
  38. package/dist/server/backchannelLogout.js.map +1 -0
  39. package/dist/server/index.d.ts +2 -0
  40. package/dist/server/index.d.ts.map +1 -1
  41. package/dist/server/index.js +2 -1
  42. package/dist/server/proxy/thunderIDProxy.d.ts +12 -1
  43. package/dist/server/proxy/thunderIDProxy.d.ts.map +1 -1
  44. package/dist/server/proxy/thunderIDProxy.js +4 -1
  45. package/dist/server/proxy/thunderIDProxy.js.map +1 -1
  46. package/dist/utils/SessionManager.d.ts +13 -1
  47. package/dist/utils/SessionManager.d.ts.map +1 -1
  48. package/dist/utils/SessionManager.js +17 -1
  49. package/dist/utils/SessionManager.js.map +1 -1
  50. package/dist/utils/handleRefreshToken.d.ts.map +1 -1
  51. package/dist/utils/handleRefreshToken.js +5 -2
  52. package/dist/utils/handleRefreshToken.js.map +1 -1
  53. package/dist/utils/loggedOutSessions.d.ts +12 -0
  54. package/dist/utils/loggedOutSessions.d.ts.map +1 -0
  55. package/dist/utils/loggedOutSessions.js +29 -0
  56. package/dist/utils/loggedOutSessions.js.map +1 -0
  57. package/package.json +4 -4
@@ -0,0 +1,12 @@
1
+ import { LoggedOutSessions, LogoutRecordStore } from '@thunderid/node';
2
+ /**
3
+ * Returns the list of sessions that back-channel logout has ended, shared by everything that runs
4
+ * in this process.
5
+ */
6
+ export declare const getLoggedOutSessions: () => LoggedOutSessions;
7
+ /**
8
+ * Makes the list use the given store, so several instances of an application can share it.
9
+ * Without one, records stay in the memory of this process.
10
+ */
11
+ export declare const setLogoutRecordStore: (store?: LogoutRecordStore) => void;
12
+ //# sourceMappingURL=loggedOutSessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggedOutSessions.d.ts","sourceRoot":"","sources":["../../src/utils/loggedOutSessions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAqBrE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAO,iBAAsC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,iBAAiB,KAAG,IAOhE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { LoggedOutSessions } from "@thunderid/node";
2
+
3
+ //#region src/utils/loggedOutSessions.ts
4
+ const SHARED_KEY = Symbol.for("thunderid.nextjs.loggedOutSessions");
5
+ const shared = () => {
6
+ const scope = globalThis;
7
+ scope[SHARED_KEY] ??= { sessions: new LoggedOutSessions() };
8
+ return scope[SHARED_KEY];
9
+ };
10
+ /**
11
+ * Returns the list of sessions that back-channel logout has ended, shared by everything that runs
12
+ * in this process.
13
+ */
14
+ const getLoggedOutSessions = () => shared().sessions;
15
+ /**
16
+ * Makes the list use the given store, so several instances of an application can share it.
17
+ * Without one, records stay in the memory of this process.
18
+ */
19
+ const setLogoutRecordStore = (store) => {
20
+ const current = shared();
21
+ if (store && current.store !== store) {
22
+ current.store = store;
23
+ current.sessions = new LoggedOutSessions(store);
24
+ }
25
+ };
26
+
27
+ //#endregion
28
+ export { getLoggedOutSessions, setLogoutRecordStore };
29
+ //# sourceMappingURL=loggedOutSessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loggedOutSessions.js","names":["SHARED_KEY: unique symbol","scope: GlobalWithShared","current: Shared"],"sources":["../../src/utils/loggedOutSessions.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {LoggedOutSessions, LogoutRecordStore} from '@thunderid/node';\n\n// Next.js bundles the proxy, route handlers and server components separately, so a module-level\n// variable would give each its own list. The global object is the one thing they share in a process.\nconst SHARED_KEY: unique symbol = Symbol.for('thunderid.nextjs.loggedOutSessions');\n\ninterface Shared {\n sessions: LoggedOutSessions;\n store?: LogoutRecordStore;\n}\n\ntype GlobalWithShared = typeof globalThis & {[SHARED_KEY]?: Shared};\n\nconst shared = (): Shared => {\n const scope: GlobalWithShared = globalThis as GlobalWithShared;\n\n scope[SHARED_KEY] ??= {sessions: new LoggedOutSessions()};\n\n return scope[SHARED_KEY];\n};\n\n/**\n * Returns the list of sessions that back-channel logout has ended, shared by everything that runs\n * in this process.\n */\nexport const getLoggedOutSessions = (): LoggedOutSessions => shared().sessions;\n\n/**\n * Makes the list use the given store, so several instances of an application can share it.\n * Without one, records stay in the memory of this process.\n */\nexport const setLogoutRecordStore = (store?: LogoutRecordStore): void => {\n const current: Shared = shared();\n\n if (store && current.store !== store) {\n current.store = store;\n current.sessions = new LoggedOutSessions(store);\n }\n};\n"],"mappings":";;;AAOA,MAAMA,aAA4B,OAAO,IAAI,qCAAqC;AASlF,MAAM,eAAuB;CAC3B,MAAMC,QAA0B;AAEhC,OAAM,gBAAgB,EAAC,UAAU,IAAI,mBAAmB,EAAC;AAEzD,QAAO,MAAM;;;;;;AAOf,MAAa,6BAAgD,QAAQ,CAAC;;;;;AAMtE,MAAa,wBAAwB,UAAoC;CACvE,MAAMC,UAAkB,QAAQ;AAEhC,KAAI,SAAS,QAAQ,UAAU,OAAO;AACpC,UAAQ,QAAQ;AAChB,UAAQ,WAAW,IAAI,kBAAkB,MAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thunderid/nextjs",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Next.js SDK for ThunderID",
5
5
  "keywords": [
6
6
  "thunderid",
@@ -37,8 +37,8 @@
37
37
  "directory": "packages/nextjs"
38
38
  },
39
39
  "dependencies": {
40
- "@thunderid/node": "^1.1.0",
41
- "@thunderid/react": "^1.1.0",
40
+ "@thunderid/node": "^1.2.1",
41
+ "@thunderid/react": "^1.3.1",
42
42
  "@types/react": "19.2.14",
43
43
  "jose": "6.2.3",
44
44
  "tslib": "2.8.1"
@@ -54,7 +54,7 @@
54
54
  "rimraf": "6.1.3",
55
55
  "rolldown": "1.0.0-beta.45",
56
56
  "typescript": "5.9.3",
57
- "vitest": "4.1.10"
57
+ "vitest": "4.1.11"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "next": ">=15.5.18",