@onmax/nuxt-better-auth 0.0.2-alpha.6 → 0.0.2-alpha.8

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.0.2-alpha.6",
7
+ "version": "0.0.2-alpha.8",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,20 +1,22 @@
1
- import type { AuthUser } from '#nuxt-better-auth';
1
+ import type { AppAuthClient, AuthSession, AuthUser } from '#nuxt-better-auth';
2
+ import type { ComputedRef, Ref } from 'vue';
2
3
  export interface SignOutOptions {
3
4
  onSuccess?: () => void | Promise<void>;
4
5
  }
5
- export declare function useUserSession(): {
6
- client: any;
7
- session: any;
8
- user: any;
9
- loggedIn: any;
10
- ready: any;
11
- signIn: any;
12
- signUp: any;
13
- signOut: (options?: SignOutOptions) => Promise<any>;
6
+ export interface UseUserSessionReturn {
7
+ client: AppAuthClient | null;
8
+ session: Ref<AuthSession | null>;
9
+ user: Ref<AuthUser | null>;
10
+ loggedIn: ComputedRef<boolean>;
11
+ ready: ComputedRef<boolean>;
12
+ signIn: NonNullable<AppAuthClient>['signIn'];
13
+ signUp: NonNullable<AppAuthClient>['signUp'];
14
+ signOut: (options?: SignOutOptions) => Promise<void>;
14
15
  waitForSession: () => Promise<void>;
15
16
  fetchSession: (options?: {
16
17
  headers?: HeadersInit;
17
18
  force?: boolean;
18
19
  }) => Promise<void>;
19
20
  updateUser: (updates: Partial<AuthUser>) => void;
20
- };
21
+ }
22
+ export declare function useUserSession(): UseUserSessionReturn;
@@ -138,11 +138,10 @@ export function useUserSession() {
138
138
  async function signOut(options) {
139
139
  if (!client)
140
140
  throw new Error("signOut can only be called on client-side");
141
- const response = await client.signOut();
141
+ await client.signOut();
142
142
  clearSession();
143
143
  if (options?.onSuccess)
144
144
  await options.onSuccess();
145
- return response;
146
145
  }
147
146
  return {
148
147
  client,
@@ -1,5 +1,6 @@
1
1
  import { createError } from "h3";
2
2
  import { matchesUser } from "../../utils/match-user.js";
3
+ import { serverAuth } from "./auth.js";
3
4
  export async function getUserSession(event) {
4
5
  const auth = await serverAuth(event);
5
6
  const session = await auth.api.getSession({ headers: event.headers });
@@ -37,6 +37,6 @@ export interface UserSessionComposable {
37
37
  waitForSession: () => Promise<void>;
38
38
  signOut: (options?: {
39
39
  onSuccess?: () => void | Promise<void>;
40
- }) => Promise<unknown>;
40
+ }) => Promise<void>;
41
41
  updateUser: (updates: Partial<AuthUser>) => void;
42
42
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onmax/nuxt-better-auth",
3
3
  "type": "module",
4
- "version": "0.0.2-alpha.6",
4
+ "version": "0.0.2-alpha.8",
5
5
  "packageManager": "pnpm@10.15.1",
6
6
  "description": "Nuxt module for Better Auth integration with NuxtHub, route protection, session management, and role-based access",
7
7
  "author": "onmax",