@authup/client-web-nuxt 1.0.0-beta.25 → 1.0.0-beta.27

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/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2021-2025 Peter Placzek
189
+ Copyright 2021-2025 Peter Placzek <peter.placzek1996@gmail.com>
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/dist/module.d.mts CHANGED
@@ -9,6 +9,11 @@ declare module '#app' {
9
9
  'authup:middleware:end': (data: MiddlewareHookPayload) => HookResult;
10
10
  }
11
11
  }
12
+ declare module '@nuxt/schema' {
13
+ interface PublicRuntimeConfig {
14
+ authup: RuntimeOptions;
15
+ }
16
+ }
12
17
 
13
18
  declare const _default: _nuxt_schema.NuxtModule<RuntimeOptions, RuntimeOptions, false>;
14
19
 
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "configKey": "authup",
4
- "version": "1.0.0-beta.25",
4
+ "version": "1.0.0-beta.27",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.4",
7
- "unbuild": "2.0.0"
6
+ "@nuxt/module-builder": "1.0.1",
7
+ "unbuild": "3.5.0"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { defineNuxtModule, installModule, addPlugin, addRouteMiddleware } from '@nuxt/kit';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
1
+ import { defineNuxtModule, installModule, createResolver, addTemplate, addPlugin, addRouteMiddleware } from '@nuxt/kit';
4
2
  import { merge } from 'smob';
3
+ import { fileURLToPath } from 'node:url';
5
4
 
6
5
  const module = defineNuxtModule({
7
6
  meta: {
@@ -13,14 +12,14 @@ const module = defineNuxtModule({
13
12
  await installModule("@pinia/nuxt");
14
13
  const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
15
14
  nuxt.options.build.transpile.push(runtimeDir);
15
+ const resolver = createResolver(import.meta.url);
16
16
  const runtimeOptions = {
17
17
  apiURL: options.apiURL,
18
18
  apiURLRuntimeKey: options.apiURLRuntimeKey,
19
19
  cookieDomain: options.cookieDomain,
20
20
  cookieDomainRuntimeKey: options.cookieDomainRuntimeKey,
21
21
  homeRoute: options.homeRoute,
22
- loginRoute: options.loginRoute,
23
- logoutRoute: options.logoutRoute
22
+ loginRoute: options.loginRoute
24
23
  };
25
24
  nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};
26
25
  if (nuxt.options.runtimeConfig.public.authup) {
@@ -31,11 +30,23 @@ const module = defineNuxtModule({
31
30
  } else {
32
31
  nuxt.options.runtimeConfig.public.authup = runtimeOptions;
33
32
  }
34
- addPlugin(path.resolve(runtimeDir, "plugins/kit"));
35
- addPlugin(path.resolve(runtimeDir, "plugins/root"));
33
+ nuxt.options.alias["#authup/nuxt"] = resolver.resolve("./runtime/exports");
34
+ const template = addTemplate({
35
+ filename: "types/authup-nuxt.d.ts",
36
+ getContents: () => [
37
+ "declare module '#authup/nuxt' {",
38
+ ` const RouteMetaKey: typeof import('${resolver.resolve("./runtime/exports")}').RouteMetaKey`,
39
+ "}"
40
+ ].join("\n")
41
+ });
42
+ nuxt.hook("prepare:types", async (options2) => {
43
+ options2.references.push({ path: template.dst });
44
+ });
45
+ addPlugin(resolver.resolve("./runtime/plugins/kit"));
46
+ addPlugin(resolver.resolve("./runtime/plugins/root"));
36
47
  addRouteMiddleware({
37
48
  name: "authup",
38
- path: path.resolve(runtimeDir, "middleware/00.root"),
49
+ path: resolver.resolve("./runtime/middleware/00.root"),
39
50
  global: true
40
51
  });
41
52
  }
@@ -1,5 +1,5 @@
1
1
  export declare enum RouteMetaKey {
2
- REQUIRED_LOGGED_IN = "requireLoggedIn",
3
- REQUIRED_LOGGED_OUT = "requireLoggedOut",
4
- REQUIRED_PERMISSIONS = "requirePermissions"
2
+ REQUIRE_LOGGED_IN = "requireLoggedIn",
3
+ REQUIRE_LOGGED_OUT = "requireLoggedOut",
4
+ REQUIRE_PERMISSIONS = "requirePermissions"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  export var RouteMetaKey = /* @__PURE__ */ ((RouteMetaKey2) => {
2
- RouteMetaKey2["REQUIRED_LOGGED_IN"] = "requireLoggedIn";
3
- RouteMetaKey2["REQUIRED_LOGGED_OUT"] = "requireLoggedOut";
4
- RouteMetaKey2["REQUIRED_PERMISSIONS"] = "requirePermissions";
2
+ RouteMetaKey2["REQUIRE_LOGGED_IN"] = "requireLoggedIn";
3
+ RouteMetaKey2["REQUIRE_LOGGED_OUT"] = "requireLoggedOut";
4
+ RouteMetaKey2["REQUIRE_PERMISSIONS"] = "requirePermissions";
5
5
  return RouteMetaKey2;
6
6
  })(RouteMetaKey || {});
@@ -0,0 +1 @@
1
+ export * from '../constants.js';
@@ -0,0 +1 @@
1
+ export * from "../constants.js";
@@ -67,7 +67,7 @@ export class RoutingInterceptor {
67
67
  }
68
68
  hasLoggedInCondition(route) {
69
69
  return route.matched.some(
70
- (matched) => !!matched.meta[RouteMetaKey.REQUIRED_LOGGED_IN]
70
+ (matched) => !!matched.meta[RouteMetaKey.REQUIRE_LOGGED_IN]
71
71
  );
72
72
  }
73
73
  validateLoggedInCondition(route) {
@@ -78,7 +78,7 @@ export class RoutingInterceptor {
78
78
  }
79
79
  hasLoggedOutCondition(route) {
80
80
  return route.matched.some(
81
- (matched) => matched.meta[RouteMetaKey.REQUIRED_LOGGED_OUT]
81
+ (matched) => matched.meta[RouteMetaKey.REQUIRE_LOGGED_OUT]
82
82
  );
83
83
  }
84
84
  validateLoggedOutCondition(route) {
@@ -89,7 +89,7 @@ export class RoutingInterceptor {
89
89
  }
90
90
  hasPermissionCondition(route) {
91
91
  return route.matched.some(
92
- (matched) => !!matched.meta[RouteMetaKey.REQUIRED_PERMISSIONS]
92
+ (matched) => !!matched.meta[RouteMetaKey.REQUIRE_PERMISSIONS]
93
93
  );
94
94
  }
95
95
  async validatePermissionCondition(route) {
@@ -105,15 +105,15 @@ export class RoutingInterceptor {
105
105
  }
106
106
  for (let i = 0; i < route.matched.length; i++) {
107
107
  const match = route.matched[i];
108
- if (!match.meta || !hasOwnProperty(match.meta, RouteMetaKey.REQUIRED_PERMISSIONS)) {
108
+ if (!match.meta || !hasOwnProperty(match.meta, RouteMetaKey.REQUIRE_PERMISSIONS)) {
109
109
  continue;
110
110
  }
111
111
  let permissions = [];
112
- if (match.meta[RouteMetaKey.REQUIRED_PERMISSIONS]) {
113
- if (Array.isArray(match.meta[RouteMetaKey.REQUIRED_PERMISSIONS])) {
114
- permissions = match.meta[RouteMetaKey.REQUIRED_PERMISSIONS];
115
- } else if (typeof match.meta[RouteMetaKey.REQUIRED_PERMISSIONS] === "string") {
116
- permissions = [match.meta[RouteMetaKey.REQUIRED_PERMISSIONS]];
112
+ if (match.meta[RouteMetaKey.REQUIRE_PERMISSIONS]) {
113
+ if (Array.isArray(match.meta[RouteMetaKey.REQUIRE_PERMISSIONS])) {
114
+ permissions = match.meta[RouteMetaKey.REQUIRE_PERMISSIONS];
115
+ } else if (typeof match.meta[RouteMetaKey.REQUIRE_PERMISSIONS] === "string") {
116
+ permissions = [match.meta[RouteMetaKey.REQUIRE_PERMISSIONS]];
117
117
  }
118
118
  }
119
119
  if (permissions.length === 0) {
@@ -122,7 +122,7 @@ export class RoutingInterceptor {
122
122
  try {
123
123
  await this.store.permissionChecker.preCheckOneOf({
124
124
  name: permissions,
125
- data: {
125
+ input: {
126
126
  identity
127
127
  }
128
128
  });
@@ -37,6 +37,9 @@ function buildApiUrl(runtimeConfig) {
37
37
  url = pathValue;
38
38
  }
39
39
  }
40
+ if (options.serverApiURL) {
41
+ url = options.serverApiURL;
42
+ }
40
43
  }
41
44
  if (!url) {
42
45
  if (options.apiURL) {
@@ -1,11 +1,37 @@
1
1
  export type RuntimeOptions = {
2
+ /**
3
+ * Explicit URL of the Authup API (client-side)
4
+ */
2
5
  apiURL?: string;
6
+ /**
7
+ * Explicit URL of the Authup API (server-side)
8
+ */
9
+ serverApiURL?: string;
10
+ /**
11
+ * Runtime config key to retrieve the Authup API URL
12
+ * (client-side & server-side)
13
+ */
3
14
  apiURLRuntimeKey?: string;
15
+ /**
16
+ * Explicit cookie domain
17
+ * (client-side & server-side)
18
+ */
4
19
  cookieDomain?: string;
20
+ /**
21
+ * Runtime config key to retrieve the cookie domain
22
+ * (client-side & server-side)
23
+ */
5
24
  cookieDomainRuntimeKey?: string;
25
+ /**
26
+ * Path of the home route
27
+ * Default: /logout
28
+ */
6
29
  homeRoute?: string;
30
+ /**
31
+ * Path of the login route
32
+ * Default: /login
33
+ */
7
34
  loginRoute?: string;
8
- logoutRoute?: string;
9
35
  };
10
36
  export type MiddlewareHookPayload = {
11
37
  to: {
package/dist/types.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { NuxtModule } from '@nuxt/schema'
2
2
 
3
- import type { default as Module } from './module.js'
3
+ import type { default as Module } from './module.mjs'
4
4
 
5
5
  export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
6
 
7
- export { default } from './module.js'
7
+ export { default } from './module.mjs'
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.25",
4
+ "version": "1.0.0-beta.27",
5
5
  "description": "Nuxt module for the authup ecosystem",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -11,14 +11,13 @@
11
11
  },
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./dist/types.d.ts",
15
- "import": "./dist/module.mjs",
16
- "require": "./dist/module.cjs"
14
+ "types": "./dist/types.d.mts",
15
+ "import": "./dist/module.mjs"
17
16
  }
18
17
  },
19
- "main": "./dist/module.cjs",
18
+ "main": "./dist/module.mjs",
20
19
  "module": "./dist/module.mjs",
21
- "types": "./dist/types.d.ts",
20
+ "types": "./dist/types.d.mts",
22
21
  "files": [
23
22
  "dist"
24
23
  ],
@@ -29,16 +28,17 @@
29
28
  "lint": "eslint ."
30
29
  },
31
30
  "dependencies": {
32
- "@authup/kit": "^1.0.0-beta.25",
33
- "@authup/client-web-kit": "^1.0.0-beta.25",
34
- "@nuxt/kit": "^3.13.2",
31
+ "@authup/kit": "^1.0.0-beta.27",
32
+ "@authup/client-web-kit": "^1.0.0-beta.27",
33
+ "@nuxt/kit": "^4.0.0",
35
34
  "pathtrace": "^1.1.0",
36
35
  "smob": "^1.5.0"
37
36
  },
38
37
  "devDependencies": {
39
- "@nuxt/module-builder": "^0.8.4",
40
- "@pinia/nuxt": "^0.10.1",
41
- "nuxt": "^3.16.2",
38
+ "@authup/access": "^1.0.0-beta.27",
39
+ "@nuxt/module-builder": "^1.0.1",
40
+ "@pinia/nuxt": "^0.11.1",
41
+ "nuxt": "^4.0.0",
42
42
  "pinia": "^3.0.0",
43
43
  "vue-router": "^4.4.5"
44
44
  },
package/dist/module.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
package/dist/module.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { HookResult } from '@nuxt/schema';
3
- import { MiddlewareHookPayload, RuntimeOptions } from '../dist/runtime/types.js';
4
-
5
- declare module '#app' {
6
- interface RuntimeNuxtHooks {
7
- 'authup:middleware:start': (data: MiddlewareHookPayload) => HookResult;
8
- 'authup:middleware:redirect': (data: MiddlewareHookPayload) => HookResult;
9
- 'authup:middleware:end': (data: MiddlewareHookPayload) => HookResult;
10
- }
11
- }
12
-
13
- declare const _default: _nuxt_schema.NuxtModule<RuntimeOptions, RuntimeOptions, false>;
14
-
15
- export { _default as default };
package/dist/types.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import type { NuxtModule } from '@nuxt/schema'
2
-
3
- import type { default as Module } from './module'
4
-
5
- export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
-
7
- export { default } from './module'