@gftdcojp/auth
Version:
✅ Enterprise-grade Auth0 integration for GFTD platform - 90% Complete, High Quality Implementation
81 lines • 2.6 kB
TypeScript
/**
* Next.js 15 Server Actions実装
*
* 機能:
* - 認証が必要なServer Actionsの保護
* - 組織コンテキスト対応
* - セッション管理統合
* - エラーハンドリング
* - 型安全性確保
*
* ✅ Next.js 15完全対応 - App Router Server Actions
*/
import { UserPayload } from './types';
/**
* Server Action結果型
*/
export interface ServerActionResult<T = any> {
success: boolean;
data?: T;
error?: {
message: string;
code?: string;
details?: any;
};
redirect?: string;
}
/**
* 認証コンテキスト型
*/
export interface AuthContext {
user: UserPayload;
organizationId?: string;
session: any;
}
/**
* Server Action設定
*/
export interface ServerActionConfig {
requireAuth?: boolean;
requireOrganization?: boolean;
allowedRoles?: string[];
allowedPermissions?: string[];
redirectOnError?: string;
}
/**
* 認証が必要なServer Actionラッパー
*/
export declare function withServerAuth<T extends any[], R>(action: (authContext: AuthContext, ...args: T) => Promise<ServerActionResult<R>>, config?: ServerActionConfig): (...args: T) => Promise<ServerActionResult<R>>;
/**
* 組織が必要なServer Actionラッパー
*/
export declare function withOrganizationServerAuth<T extends any[], R>(organizationId: string, action: (authContext: AuthContext, ...args: T) => Promise<ServerActionResult<R>>, config?: Omit<ServerActionConfig, 'requireOrganization'>): (...args: T) => Promise<ServerActionResult<R>>;
/**
* 管理者専用Server Actionラッパー
*/
export declare function withAdminServerAuth<T extends any[], R>(action: (authContext: AuthContext, ...args: T) => Promise<ServerActionResult<R>>, config?: Omit<ServerActionConfig, 'allowedRoles'>): (...args: T) => Promise<ServerActionResult<R>>;
/**
* 認証済みユーザー情報を取得するServer Action
*/
export declare function getCurrentUser(): Promise<ServerActionResult<UserPayload | null>>;
/**
* 組織メンバー一覧取得のServer Action例
*/
export declare const getOrganizationMembers: (page?: number | undefined, limit?: number | undefined) => Promise<ServerActionResult<{
members: {
id: string;
email: string;
name: string;
role: string;
}[];
total: number;
page: number;
limit: number;
}>>;
/**
* ユーザープロフィール更新のServer Action例
*/
export declare const updateUserProfile: (formData: FormData) => Promise<ServerActionResult<{
message: string;
}>>;
//# sourceMappingURL=server-actions.d.ts.map