@authup/client-web-nuxt 1.0.0-beta.26 → 1.0.0-beta.28
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.d.mts +5 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -10
- package/dist/runtime/constants.d.ts +3 -3
- package/dist/runtime/constants.js +3 -3
- package/dist/runtime/exports/index.d.ts +1 -0
- package/dist/runtime/exports/index.js +1 -0
- package/dist/runtime/helpers/routing-interceptor.js +10 -10
- package/dist/runtime/plugins/kit.js +3 -0
- package/dist/runtime/types.d.ts +27 -1
- package/package.json +12 -9
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.
|
|
4
|
+
"version": "1.0.0-beta.28",
|
|
5
5
|
"builder": {
|
|
6
|
-
"@nuxt/module-builder": "1.0.
|
|
7
|
-
"unbuild": "3.
|
|
6
|
+
"@nuxt/module-builder": "1.0.2",
|
|
7
|
+
"unbuild": "3.6.1"
|
|
8
8
|
}
|
|
9
9
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
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
|
-
const module = defineNuxtModule({
|
|
5
|
+
const module$1 = defineNuxtModule({
|
|
7
6
|
meta: {
|
|
8
7
|
name: "@authup/client-web-nuxt",
|
|
9
8
|
configKey: "authup"
|
|
@@ -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,14 +30,26 @@ const module = defineNuxtModule({
|
|
|
31
30
|
} else {
|
|
32
31
|
nuxt.options.runtimeConfig.public.authup = runtimeOptions;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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:
|
|
49
|
+
path: resolver.resolve("./runtime/middleware/00.root"),
|
|
39
50
|
global: true
|
|
40
51
|
});
|
|
41
52
|
}
|
|
42
53
|
});
|
|
43
54
|
|
|
44
|
-
export { module as default };
|
|
55
|
+
export { module$1 as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare enum RouteMetaKey {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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["
|
|
3
|
-
RouteMetaKey2["
|
|
4
|
-
RouteMetaKey2["
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
108
|
+
if (!match.meta || !hasOwnProperty(match.meta, RouteMetaKey.REQUIRE_PERMISSIONS)) {
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
111
|
let permissions = [];
|
|
112
|
-
if (match.meta[RouteMetaKey.
|
|
113
|
-
if (Array.isArray(match.meta[RouteMetaKey.
|
|
114
|
-
permissions = match.meta[RouteMetaKey.
|
|
115
|
-
} else if (typeof match.meta[RouteMetaKey.
|
|
116
|
-
permissions = [match.meta[RouteMetaKey.
|
|
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
|
-
|
|
125
|
+
input: {
|
|
126
126
|
identity
|
|
127
127
|
}
|
|
128
128
|
});
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -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/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.
|
|
4
|
+
"version": "1.0.0-beta.28",
|
|
5
5
|
"description": "Nuxt module for the authup ecosystem",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"import": "./dist/module.mjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"main": "./dist/module.mjs",
|
|
19
18
|
"module": "./dist/module.mjs",
|
|
20
19
|
"types": "./dist/types.d.mts",
|
|
21
20
|
"files": [
|
|
@@ -27,19 +26,23 @@
|
|
|
27
26
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
28
27
|
"lint": "eslint ."
|
|
29
28
|
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": "^20.19.0 || ^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
31
|
+
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@authup/kit": "^1.0.0-beta.
|
|
32
|
-
"@authup/client-web-kit": "^1.0.0-beta.
|
|
33
|
-
"@nuxt/kit": "^
|
|
33
|
+
"@authup/kit": "^1.0.0-beta.28",
|
|
34
|
+
"@authup/client-web-kit": "^1.0.0-beta.28",
|
|
35
|
+
"@nuxt/kit": "^4.0.0",
|
|
34
36
|
"pathtrace": "^1.1.0",
|
|
35
37
|
"smob": "^1.5.0"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"nuxt": "^
|
|
40
|
+
"@authup/access": "^1.0.0-beta.28",
|
|
41
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
42
|
+
"@pinia/nuxt": "^0.11.3",
|
|
43
|
+
"nuxt": "^4.2.2",
|
|
41
44
|
"pinia": "^3.0.0",
|
|
42
|
-
"vue-router": "^4.4
|
|
45
|
+
"vue-router": "^4.6.4"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
48
|
"@pinia/nuxt": "*",
|