mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 22:49:40 +02:00
- Create @manacore/shared-auth-stores package with Svelte 5 factories: - createAuthStore<T>(): Generic factory with custom auth service adapter - createSupabaseAuthStore(): Direct Supabase integration for simpler setups - Add standardized auth error types to @manacore/shared-types: - AuthErrorCode enum for consistent error handling - mapSupabaseErrorToCode() helper function - createAuthError() factory function This enables apps to share auth state management while supporting both middleware-based auth (ManaCore/Manadeck) and direct Supabase auth (ManaCore-web simple mode). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
/**
|
|
* @manacore/shared-auth-stores
|
|
*
|
|
* Svelte 5 auth store factories for the ManaCore monorepo.
|
|
*
|
|
* Provides two approaches:
|
|
* 1. createAuthStore - Generic factory that works with any auth service adapter
|
|
* 2. createSupabaseAuthStore - Direct Supabase integration for simpler setups
|
|
*
|
|
* @example Generic auth store with custom adapter
|
|
* ```ts
|
|
* import { createAuthStore } from '@manacore/shared-auth-stores';
|
|
* import { authService } from '$lib/auth';
|
|
* import type { AppUser } from '$lib/types';
|
|
*
|
|
* export const authStore = createAuthStore<AppUser>(authService);
|
|
* ```
|
|
*
|
|
* @example Supabase auth store
|
|
* ```ts
|
|
* import { createSupabaseAuthStore } from '@manacore/shared-auth-stores';
|
|
* import { createBrowserClient } from '@supabase/ssr';
|
|
*
|
|
* const getClient = () => createBrowserClient(url, key);
|
|
* export const authStore = createSupabaseAuthStore(getClient);
|
|
* ```
|
|
*/
|
|
|
|
// Factory functions
|
|
export { createAuthStore } from './createAuthStore.svelte';
|
|
export { createSupabaseAuthStore } from './createSupabaseAuthStore.svelte';
|
|
export type { CreateSupabaseAuthStoreOptions, SupabaseUser } from './createSupabaseAuthStore.svelte';
|
|
|
|
// Types
|
|
export type {
|
|
BaseUser,
|
|
AuthResult,
|
|
AuthServiceAdapter,
|
|
AuthStoreState,
|
|
AuthStoreActions,
|
|
AuthStore
|
|
} from './types';
|