mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 12:29:36 +01:00
feat(frontend): TypeScript-Monorepo mit Terminal-UI für Effigenix ERP
Monorepo-Setup (pnpm workspaces) mit vier shared Packages und einer TUI-App: Shared Packages: - @effigenix/types: TypeScript-DTOs (UserDTO, RoleDTO, AuthDTO, Enums) - @effigenix/config: API-Konfiguration und Shared Constants - @effigenix/validation: Zod-Schemas für Username, E-Mail und Passwort - @effigenix/api-client: axios-Client mit JWT-Handling (proaktiver + reaktiver Token-Refresh), AuthInterceptor, ErrorInterceptor, Resources für auth/users/roles TUI (apps/cli, Ink 5 / React): - Authentication: Login/Logout, Session-Restore beim Start, JWT-Refresh - User Management: Liste, Anlage (Zod-Inline-Validation), Detailansicht, Passwort ändern, Sperren/Entsperren mit ConfirmDialog - Role Management: Liste, Detailansicht, Zuweisen/Entfernen per RoleSelectList (↑↓) - UX: SuccessDisplay (Auto-Dismiss 3 s), ConfirmDialog (J/N), FormInput mit Inline-Fehlern, StatusBar mit API-URL - Layout: Fullscreen-Modus (alternate screen buffer), Header mit eingeloggtem User - Tests: vitest + ink-testing-library (15 Tests)
This commit is contained in:
parent
87123df2e4
commit
bbe9e87c33
65 changed files with 6955 additions and 1 deletions
69
frontend/packages/api-client/src/index.ts
Normal file
69
frontend/packages/api-client/src/index.ts
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* @effigenix/api-client
|
||||
*
|
||||
* Type-safe HTTP client for the Effigenix ERP API.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* ```ts
|
||||
* import { createEffigenixClient } from '@effigenix/api-client';
|
||||
*
|
||||
* const client = createEffigenixClient(tokenProvider);
|
||||
* const users = await client.users.list();
|
||||
* ```
|
||||
*/
|
||||
|
||||
export { createApiClient } from './client.js';
|
||||
export type { TokenProvider } from './token-provider.js';
|
||||
export { createAuthResource } from './resources/auth.js';
|
||||
export { createUsersResource } from './resources/users.js';
|
||||
export { createRolesResource } from './resources/roles.js';
|
||||
export {
|
||||
ApiError,
|
||||
AuthenticationError,
|
||||
NetworkError,
|
||||
RefreshTokenExpiredError,
|
||||
} from './errors.js';
|
||||
export type { ValidationErrorDetail } from './errors.js';
|
||||
export type {
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
RefreshTokenRequest,
|
||||
AuthResource,
|
||||
} from './resources/auth.js';
|
||||
export type {
|
||||
UserDTO,
|
||||
RoleDTO,
|
||||
CreateUserRequest,
|
||||
UpdateUserRequest,
|
||||
ChangePasswordRequest,
|
||||
AssignRoleRequest,
|
||||
UsersResource,
|
||||
} from './resources/users.js';
|
||||
export type { RolesResource } from './resources/roles.js';
|
||||
|
||||
import { createApiClient } from './client.js';
|
||||
import { createAuthResource } from './resources/auth.js';
|
||||
import { createUsersResource } from './resources/users.js';
|
||||
import { createRolesResource } from './resources/roles.js';
|
||||
import type { TokenProvider } from './token-provider.js';
|
||||
import type { ApiConfig } from '@effigenix/config';
|
||||
|
||||
/**
|
||||
* Convenience factory that creates a fully-configured Effigenix API client
|
||||
* with all resource modules attached.
|
||||
*/
|
||||
export function createEffigenixClient(
|
||||
tokenProvider: TokenProvider,
|
||||
config: Partial<ApiConfig> = {},
|
||||
) {
|
||||
const axiosClient = createApiClient(config, tokenProvider);
|
||||
|
||||
return {
|
||||
auth: createAuthResource(axiosClient),
|
||||
users: createUsersResource(axiosClient),
|
||||
roles: createRolesResource(axiosClient),
|
||||
};
|
||||
}
|
||||
|
||||
export type EffigenixClient = ReturnType<typeof createEffigenixClient>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue