tarasol-common
TypeScript Library
The tarasol-common package is the shared library consumed by all NestJS microservices. It provides common DTOs, utility functions, RabbitMQ queue definitions, and shared middleware.
Contents
- DTOs — Shared data transfer objects for inter-service communication
- Queue Definitions — RabbitMQ exchange, queue, and routing key constants
- Utilities — Common helper functions used across services
- Middleware — Shared NestJS middleware (auth, logging, tenant resolution)
- Decorators — Custom NestJS decorators for common patterns
- Interfaces — Shared TypeScript interfaces and types
- Constants — System-wide constants and configuration values
Usage
import {
CreateCorrespondenceDto,
RABBITMQ_EXCHANGES,
TenantMiddleware,
AuthGuard
} from '@tarasol/common';
Key Exports
| Category | Examples |
|---|---|
| DTOs | CreateCorrespondenceDto, UpdateTaskDto, NotificationPayload |
| Queue Defs | EXCHANGES, QUEUES, ROUTING_KEYS |
| Guards | AuthGuard, TenantGuard, RolesGuard |
| Middleware | TenantMiddleware, LoggingMiddleware |
| Decorators | @CurrentUser(), @TenantId(), @Roles() |
| Interfaces | IUser, ITenant, ICorrespondence |
✓Tip
When adding new shared functionality, add it to tarasol-common rather than duplicating across services. Run npm run build in the common package and update the version in consuming services.