mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 08:29:36 +01:00
TUI-Anbindung für Reservierung bestätigen (US-4.3), Produktionsauftrag
umterminieren und filtern (US-P17). Status-Werte CREATED→PLANNED und
IN_PRODUCTION→IN_PROGRESS korrigiert. Fehlenden GET /{id} Endpoint für
Produktionsaufträge im Backend ergänzt.
201 lines
7.5 KiB
TypeScript
201 lines
7.5 KiB
TypeScript
/**
|
|
* @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 { createCategoriesResource } from './resources/categories.js';
|
|
export { createSuppliersResource } from './resources/suppliers.js';
|
|
export { createArticlesResource } from './resources/articles.js';
|
|
export { createCustomersResource } from './resources/customers.js';
|
|
export { createStorageLocationsResource } from './resources/storage-locations.js';
|
|
export { createRecipesResource } from './resources/recipes.js';
|
|
export { createBatchesResource } from './resources/batches.js';
|
|
export { createProductionOrdersResource } from './resources/production-orders.js';
|
|
export { createStocksResource } from './resources/stocks.js';
|
|
export { createStockMovementsResource } from './resources/stock-movements.js';
|
|
export { createCountriesResource } from './resources/countries.js';
|
|
export {
|
|
ApiError,
|
|
AuthenticationError,
|
|
NetworkError,
|
|
RefreshTokenExpiredError,
|
|
} from './errors.js';
|
|
export type { ValidationErrorDetail } from './errors.js';
|
|
// Auth types (no generated alias, stay in resource)
|
|
export type {
|
|
LoginRequest,
|
|
LoginResponse,
|
|
RefreshTokenRequest,
|
|
AuthResource,
|
|
} from './resources/auth.js';
|
|
|
|
// Types from @effigenix/types (generated OpenAPI aliases)
|
|
export type {
|
|
UserDTO,
|
|
RoleDTO,
|
|
CreateUserRequest,
|
|
UpdateUserRequest,
|
|
ChangePasswordRequest,
|
|
AssignRoleRequest,
|
|
SupplierDTO,
|
|
AddressDTO,
|
|
ContactInfoDTO,
|
|
PaymentTermsDTO,
|
|
QualityCertificateDTO,
|
|
SupplierRatingDTO,
|
|
CreateSupplierRequest,
|
|
UpdateSupplierRequest,
|
|
RateSupplierRequest,
|
|
AddCertificateRequest,
|
|
RemoveCertificateRequest,
|
|
ProductCategoryDTO,
|
|
CreateCategoryRequest,
|
|
UpdateCategoryRequest,
|
|
ArticleDTO,
|
|
SalesUnitDTO,
|
|
CreateArticleRequest,
|
|
UpdateArticleRequest,
|
|
AddSalesUnitRequest,
|
|
UpdateSalesUnitPriceRequest,
|
|
CustomerDTO,
|
|
DeliveryAddressDTO,
|
|
FrameContractDTO,
|
|
ContractLineItemDTO,
|
|
CreateCustomerRequest,
|
|
UpdateCustomerRequest,
|
|
AddDeliveryAddressRequest,
|
|
SetFrameContractLineItem,
|
|
SetFrameContractRequest,
|
|
StorageLocationDTO,
|
|
TemperatureRangeDTO,
|
|
CreateStorageLocationRequest,
|
|
UpdateStorageLocationRequest,
|
|
RecipeDTO,
|
|
RecipeSummaryDTO,
|
|
IngredientDTO,
|
|
ProductionStepDTO,
|
|
CreateRecipeRequest,
|
|
AddRecipeIngredientRequest,
|
|
AddProductionStepRequest,
|
|
StockBatchDTO,
|
|
AddStockBatchRequest,
|
|
BatchDTO,
|
|
BatchSummaryDTO,
|
|
ConsumptionDTO,
|
|
PlanBatchRequest,
|
|
CompleteBatchRequest,
|
|
RecordConsumptionRequest,
|
|
CancelBatchRequest,
|
|
ProductionOrderDTO,
|
|
CreateProductionOrderRequest,
|
|
StockDTO,
|
|
CreateStockRequest,
|
|
CreateStockResponse,
|
|
UpdateStockRequest,
|
|
RemoveStockBatchRequest,
|
|
BlockStockBatchRequest,
|
|
MinimumLevelDTO,
|
|
ReservationDTO,
|
|
StockBatchAllocationDTO,
|
|
ReserveStockRequest,
|
|
StockMovementDTO,
|
|
RecordStockMovementRequest,
|
|
StartProductionOrderRequest,
|
|
CountryDTO,
|
|
} from '@effigenix/types';
|
|
|
|
// Resource types (runtime, stay in resource files)
|
|
export type { UsersResource } from './resources/users.js';
|
|
export type { RolesResource } from './resources/roles.js';
|
|
export type { CategoriesResource } from './resources/categories.js';
|
|
export type { SuppliersResource, SupplierStatus } from './resources/suppliers.js';
|
|
export type { ArticlesResource, ArticleStatus, Unit, PriceModel } from './resources/articles.js';
|
|
export { UNIT_LABELS, PRICE_MODEL_LABELS } from './resources/articles.js';
|
|
export type {
|
|
CustomersResource,
|
|
CustomerType,
|
|
CustomerStatus,
|
|
CustomerPreference,
|
|
DeliveryRhythm,
|
|
} from './resources/customers.js';
|
|
export { CUSTOMER_PREFERENCE_LABELS, DELIVERY_RHYTHM_LABELS } from './resources/customers.js';
|
|
export type {
|
|
StorageLocationsResource,
|
|
StorageType,
|
|
StorageLocationFilter,
|
|
} from './resources/storage-locations.js';
|
|
export { STORAGE_TYPE_LABELS } from './resources/storage-locations.js';
|
|
export type { RecipesResource, RecipeType, RecipeStatus, UoM } from './resources/recipes.js';
|
|
export { RECIPE_TYPE_LABELS, UOM_VALUES, UOM_LABELS } from './resources/recipes.js';
|
|
export type { BatchesResource, BatchStatus } from './resources/batches.js';
|
|
export { BATCH_STATUS_LABELS } from './resources/batches.js';
|
|
export type { ProductionOrdersResource, Priority, ProductionOrderStatus, ProductionOrderFilter, RescheduleProductionOrderRequest } from './resources/production-orders.js';
|
|
export { PRIORITY_LABELS, PRODUCTION_ORDER_STATUS_LABELS } from './resources/production-orders.js';
|
|
export type { StocksResource, BatchType, StockBatchStatus, StockFilter, ReferenceType, ReservationPriority } from './resources/stocks.js';
|
|
export type { StockMovementsResource, MovementType, MovementDirection, StockMovementFilter } from './resources/stock-movements.js';
|
|
export { MOVEMENT_TYPE_LABELS, MOVEMENT_DIRECTION_LABELS } from './resources/stock-movements.js';
|
|
export type { CountriesResource } from './resources/countries.js';
|
|
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS, REFERENCE_TYPE_LABELS, RESERVATION_PRIORITY_LABELS } from './resources/stocks.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 { createCategoriesResource } from './resources/categories.js';
|
|
import { createSuppliersResource } from './resources/suppliers.js';
|
|
import { createArticlesResource } from './resources/articles.js';
|
|
import { createCustomersResource } from './resources/customers.js';
|
|
import { createStorageLocationsResource } from './resources/storage-locations.js';
|
|
import { createRecipesResource } from './resources/recipes.js';
|
|
import { createBatchesResource } from './resources/batches.js';
|
|
import { createProductionOrdersResource } from './resources/production-orders.js';
|
|
import { createStocksResource } from './resources/stocks.js';
|
|
import { createStockMovementsResource } from './resources/stock-movements.js';
|
|
import { createCountriesResource } from './resources/countries.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),
|
|
categories: createCategoriesResource(axiosClient),
|
|
suppliers: createSuppliersResource(axiosClient),
|
|
articles: createArticlesResource(axiosClient),
|
|
customers: createCustomersResource(axiosClient),
|
|
storageLocations: createStorageLocationsResource(axiosClient),
|
|
recipes: createRecipesResource(axiosClient),
|
|
batches: createBatchesResource(axiosClient),
|
|
productionOrders: createProductionOrdersResource(axiosClient),
|
|
stocks: createStocksResource(axiosClient),
|
|
stockMovements: createStockMovementsResource(axiosClient),
|
|
countries: createCountriesResource(axiosClient),
|
|
};
|
|
}
|
|
|
|
export type EffigenixClient = ReturnType<typeof createEffigenixClient>;
|