@authup/client-web-nuxt 1.0.0-beta.50 → 1.0.0-beta.52

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "configKey": "authup",
4
- "version": "1.0.0-beta.50",
4
+ "version": "1.0.0-beta.52",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -43,6 +43,7 @@ const module$1 = defineNuxtModule({
43
43
  options2.references.push({ path: template.dst });
44
44
  });
45
45
  addPlugin(resolver.resolve("./runtime/plugins/kit"));
46
+ addPlugin(resolver.resolve("./runtime/plugins/session-expiry"));
46
47
  addPlugin(resolver.resolve("./runtime/plugins/root"));
47
48
  addRouteMiddleware({
48
49
  name: "authup",
@@ -5,7 +5,7 @@ import {
5
5
  storeToRefs
6
6
  } from "@authup/client-web-kit";
7
7
  import { hasOwnProperty, omitRecord } from "@authup/kit";
8
- import { BuiltInPolicyType, PolicyData } from "@authup/access";
8
+ import { BuiltInPolicyType, definePolicyData } from "@authup/access";
9
9
  import { RouteMetaKey } from "../constants.js";
10
10
  export class RoutingInterceptor {
11
11
  store;
@@ -163,7 +163,7 @@ export class RoutingInterceptor {
163
163
  try {
164
164
  await this.store.permissionEvaluator.preEvaluateOneOf({
165
165
  name: permissions,
166
- input: new PolicyData({ [BuiltInPolicyType.IDENTITY]: identity })
166
+ data: definePolicyData({ [BuiltInPolicyType.IDENTITY]: identity })
167
167
  });
168
168
  } catch {
169
169
  return false;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Redirect an idle user to the login route when a background token refresh
3
+ * fails (SESSION_EXPIRED). The route middleware already handles this on the
4
+ * next navigation; this covers the case where the session dies while the user
5
+ * sits on an authenticated page with no navigation to trigger the interceptor.
6
+ */
7
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
8
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import { StoreDispatcherEventName, injectStoreDispatcher } from "@authup/client-web-kit";
2
+ import { defineNuxtPlugin, useRouter, useRuntimeConfig } from "#imports";
3
+ import { RouteMetaKey } from "../constants.js";
4
+ export default defineNuxtPlugin({
5
+ name: "authup:session-expiry",
6
+ dependsOn: ["authup:kit"],
7
+ setup(ctx) {
8
+ if (import.meta.server) {
9
+ return;
10
+ }
11
+ const router = useRouter();
12
+ const runtimeOptions = useRuntimeConfig().public.authup;
13
+ const loginRoute = runtimeOptions.loginRoute || "/login";
14
+ const dispatcher = injectStoreDispatcher(ctx.vueApp);
15
+ dispatcher.on(StoreDispatcherEventName.SESSION_EXPIRED, () => {
16
+ const route = router.currentRoute.value;
17
+ if (route.path === loginRoute) {
18
+ return;
19
+ }
20
+ const requiresLogin = route.matched.some(
21
+ (matched) => !!matched.meta[RouteMetaKey.REQUIRE_LOGGED_IN]
22
+ );
23
+ if (!requiresLogin) {
24
+ return;
25
+ }
26
+ router.push({
27
+ path: loginRoute,
28
+ query: { redirect: route.fullPath }
29
+ }).catch(() => {
30
+ });
31
+ });
32
+ }
33
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.50",
4
+ "version": "1.0.0-beta.52",
5
5
  "description": "Nuxt module for the authup ecosystem",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -30,15 +30,16 @@
30
30
  "node": "^22.13.0 || ^23.5.0 || >=24.0.0"
31
31
  },
32
32
  "dependencies": {
33
- "@authup/access": "^1.0.0-beta.50",
34
- "@authup/client-web-kit": "^1.0.0-beta.50",
35
- "@authup/kit": "^1.0.0-beta.50",
33
+ "@authup/access": "^1.0.0-beta.52",
34
+ "@authup/client-web-kit": "^1.0.0-beta.52",
35
+ "@authup/kit": "^1.0.0-beta.52",
36
36
  "@nuxt/kit": "^4.0.0",
37
37
  "pathtrace": "^2.2.0",
38
38
  "smob": "^1.6.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@nuxt/module-builder": "^1.0.2",
42
+ "@nuxt/schema": "^4.0.0",
42
43
  "@pinia/nuxt": "^0.11.3",
43
44
  "fix-dts-default-cjs-exports": "^1.0.1",
44
45
  "mkdist": "^2.3.0",
@@ -50,7 +51,7 @@
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@pinia/nuxt": "*",
53
- "pinia": "^2.x || ^3.x"
54
+ "pinia": "^3.0.0"
54
55
  },
55
56
  "keywords": [
56
57
  "auth",