mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 11:59:35 +01:00
chore(types): OpenAPI-Spec update
This commit is contained in:
parent
d27dbaa843
commit
d20fb4108a
11 changed files with 2468 additions and 45 deletions
1
frontend/openapi.json
Normal file
1
frontend/openapi.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -3,12 +3,22 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "HTTP client for the Effigenix ERP API",
|
"description": "HTTP client for the Effigenix ERP API",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./src/index.ts",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,22 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Shared configuration constants for Effigenix ERP",
|
"description": "Shared configuration constants for Effigenix ERP",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./src/index.ts",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,28 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "TypeScript types for Effigenix ERP (auto-generated from OpenAPI)",
|
"description": "TypeScript types for Effigenix ERP (auto-generated from OpenAPI)",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./src/index.ts",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate:types": "openapi-typescript http://localhost:8080/api-docs -o src/generated/api.ts",
|
"generate:types": "openapi-typescript ../../openapi.json -o src/generated/api.ts",
|
||||||
"build": "pnpm run generate:types && tsup",
|
"generate:spec": "curl -sf http://localhost:8080/api-docs -o ../../openapi.json",
|
||||||
|
"build": "tsup",
|
||||||
"dev": "tsup --watch",
|
"dev": "tsup --watch",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"clean": "rm -rf dist .turbo"
|
"clean": "rm -rf dist .turbo"
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ export type LoginResponse = components['schemas']['LoginResponse'];
|
||||||
// Token Refresh
|
// Token Refresh
|
||||||
export type RefreshTokenRequest = components['schemas']['RefreshTokenRequest'];
|
export type RefreshTokenRequest = components['schemas']['RefreshTokenRequest'];
|
||||||
|
|
||||||
// Session Token
|
|
||||||
export type SessionToken = components['schemas']['SessionToken'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom types not in OpenAPI spec
|
* Custom types not in OpenAPI spec
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,17 @@
|
||||||
* Re-exports types from the auto-generated OpenAPI schema
|
* Re-exports types from the auto-generated OpenAPI schema
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { components } from './generated/api';
|
|
||||||
|
|
||||||
// Error handling
|
|
||||||
export type ErrorResponse = components['schemas']['ErrorResponse'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom common types
|
* Custom common types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface ErrorResponse {
|
||||||
|
message: string;
|
||||||
|
status?: number;
|
||||||
|
timestamp?: string;
|
||||||
|
path?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ValidationError {
|
export interface ValidationError {
|
||||||
field: string;
|
field: string;
|
||||||
message: string;
|
message: string;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -7,8 +7,8 @@ import type { components } from './generated/api';
|
||||||
|
|
||||||
// Role DTOs
|
// Role DTOs
|
||||||
export type RoleDTO = components['schemas']['RoleDTO'];
|
export type RoleDTO = components['schemas']['RoleDTO'];
|
||||||
export type RoleName = components['schemas']['RoleName'];
|
export type RoleName = NonNullable<RoleDTO['name']>;
|
||||||
export type Permission = components['schemas']['Permission'];
|
export type Permission = NonNullable<RoleDTO['permissions']>[number];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom types for UI
|
* Custom types for UI
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,22 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Zod validation schemas for Effigenix ERP",
|
"description": "Zod validation schemas for Effigenix ERP",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./src/index.ts",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./src/index.ts",
|
||||||
"default": "./dist/index.js"
|
"default": "./src/index.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
7
makefile
Normal file
7
makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
backend/run:
|
||||||
|
cd backend && mvn spring-boot:run
|
||||||
|
|
||||||
|
generate/openapi:
|
||||||
|
./scripts/generate-openapi.sh
|
||||||
52
scripts/generate-openapi.sh
Executable file
52
scripts/generate-openapi.sh
Executable file
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
BACKEND_DIR="$(cd "$(dirname "$0")/../backend" && pwd)"
|
||||||
|
FRONTEND_DIR="$(cd "$(dirname "$0")/../frontend" && pwd)"
|
||||||
|
API_DOCS_URL="http://localhost:8080/api-docs"
|
||||||
|
TIMEOUT=60
|
||||||
|
BACKEND_PID=""
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [[ -n "$BACKEND_PID" ]]; then
|
||||||
|
echo "→ Backend wird gestoppt (PID $BACKEND_PID)..."
|
||||||
|
kill "$BACKEND_PID" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
wait_for_backend() {
|
||||||
|
echo "→ Warte auf Backend ($TIMEOUT s)..."
|
||||||
|
local elapsed=0
|
||||||
|
until curl -sf "$API_DOCS_URL" -o /dev/null; do
|
||||||
|
if (( elapsed >= TIMEOUT )); then
|
||||||
|
echo "✗ Backend nicht erreichbar nach ${TIMEOUT}s" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
(( elapsed += 2 ))
|
||||||
|
done
|
||||||
|
echo "✓ Backend bereit"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Backend starten falls nicht erreichbar
|
||||||
|
if curl -sf "$API_DOCS_URL" -o /dev/null 2>/dev/null; then
|
||||||
|
echo "✓ Backend läuft bereits"
|
||||||
|
else
|
||||||
|
echo "→ Backend wird gestartet..."
|
||||||
|
mvn -f "$BACKEND_DIR/pom.xml" spring-boot:run -q &
|
||||||
|
BACKEND_PID=$!
|
||||||
|
wait_for_backend
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "→ OpenAPI-Spec wird generiert..."
|
||||||
|
curl -sf "$API_DOCS_URL" -o "$FRONTEND_DIR/openapi.json"
|
||||||
|
echo "✓ openapi.json aktualisiert"
|
||||||
|
|
||||||
|
echo "→ TypeScript-Typen werden generiert..."
|
||||||
|
pnpm --filter @effigenix/types --prefix "$FRONTEND_DIR" generate:types
|
||||||
|
echo "✓ src/generated/api.ts aktualisiert"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Fertig. Bitte committen:"
|
||||||
|
echo " git add frontend/openapi.json frontend/packages/types/src/generated/api.ts"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue