mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 12:19:35 +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
33
frontend/packages/config/package.json
Normal file
33
frontend/packages/config/package.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "@effigenix/config",
|
||||
"version": "0.1.0",
|
||||
"description": "Shared configuration constants for Effigenix ERP",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"dev": "tsup --watch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"clean": "rm -rf dist .turbo"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.0",
|
||||
"tsup": "^8.0.1",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"tsup": {
|
||||
"entry": ["src/index.ts"],
|
||||
"format": ["esm"],
|
||||
"dts": true,
|
||||
"clean": true,
|
||||
"sourcemap": true,
|
||||
"splitting": false
|
||||
}
|
||||
}
|
||||
34
frontend/packages/config/src/api-config.ts
Normal file
34
frontend/packages/config/src/api-config.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* API client configuration
|
||||
*/
|
||||
|
||||
export interface ApiConfig {
|
||||
baseUrl: string;
|
||||
timeoutMs: number;
|
||||
retries: number;
|
||||
}
|
||||
|
||||
export const DEFAULT_API_CONFIG: ApiConfig = {
|
||||
baseUrl: 'http://localhost:8080',
|
||||
timeoutMs: 10_000,
|
||||
retries: 1,
|
||||
};
|
||||
|
||||
export const API_PATHS = {
|
||||
auth: {
|
||||
login: '/api/auth/login',
|
||||
logout: '/api/auth/logout',
|
||||
refresh: '/api/auth/refresh',
|
||||
},
|
||||
users: {
|
||||
base: '/api/users',
|
||||
byId: (id: string) => `/api/users/${id}`,
|
||||
lock: (id: string) => `/api/users/${id}/lock`,
|
||||
unlock: (id: string) => `/api/users/${id}/unlock`,
|
||||
roles: (id: string) => `/api/users/${id}/roles`,
|
||||
password: (id: string) => `/api/users/${id}/password`,
|
||||
},
|
||||
roles: {
|
||||
base: '/api/roles',
|
||||
},
|
||||
} as const;
|
||||
26
frontend/packages/config/src/constants.ts
Normal file
26
frontend/packages/config/src/constants.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Shared application constants
|
||||
*/
|
||||
|
||||
/** Milliseconds before token expiry at which a proactive refresh is triggered */
|
||||
export const TOKEN_REFRESH_THRESHOLD_MS = 5 * 60 * 1_000; // 5 minutes
|
||||
|
||||
/** Default access token lifetime (matches backend default: 15 min) */
|
||||
export const ACCESS_TOKEN_LIFETIME_MS = 15 * 60 * 1_000;
|
||||
|
||||
/** Default refresh token lifetime (matches backend default: 7 days) */
|
||||
export const REFRESH_TOKEN_LIFETIME_MS = 7 * 24 * 60 * 60 * 1_000;
|
||||
|
||||
/** Path to the CLI config file */
|
||||
export const CLI_CONFIG_PATH = '~/.effigenix/config.json';
|
||||
|
||||
/** File permission octal for the CLI config file (owner read/write only) */
|
||||
export const CLI_CONFIG_FILE_MODE = 0o600;
|
||||
|
||||
/** Pagination defaults */
|
||||
export const DEFAULT_PAGE_SIZE = 20;
|
||||
export const MAX_PAGE_SIZE = 100;
|
||||
|
||||
/** Password constraints (must match backend validation) */
|
||||
export const PASSWORD_MIN_LENGTH = 8;
|
||||
export const PASSWORD_MAX_LENGTH = 128;
|
||||
2
frontend/packages/config/src/index.ts
Normal file
2
frontend/packages/config/src/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export * from './api-config.js';
|
||||
export * from './constants.js';
|
||||
11
frontend/packages/config/tsconfig.json
Normal file
11
frontend/packages/config/tsconfig.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"composite": false,
|
||||
"incremental": false
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue