1.0.1 • Published 5 months ago
@saas-platform/shared-types v1.0.1
@saas-platform/shared-types
Common TypeScript interfaces and types for the Multi-Tenant SaaS Platform.
Installation
npm install @saas-platform/shared-typesUsage
import { User, Tenant, ApiResponse, UserCreatedEvent } from '@saas-platform/shared-types';
// Use types in your service
const user: User = {
id: '123',
tenantId: 'tenant-456',
email: 'user@example.com',
status: UserStatus.ACTIVE,
// ... other properties
};
// API response formatting
const response: ApiResponse<User> = {
success: true,
data: user,
metadata: {
requestId: 'req-123',
timestamp: new Date().toISOString(),
version: '1.0.0',
service: 'user-service'
}
};Available Types
Core Types
UUID,TenantId,UserId,ApplicationIdStatus,Environment,ErrorCodePaginationParams,PaginationMeta
API Types
ApiRequest<T>,ApiResponse<T>PaginatedResponse<T>,ErrorResponseValidationError,RequestContext
Authentication Types
AccessTokenPayload,RefreshTokenPayloadUserSession,AuthContextDeviceType,LoginMethod,MFASetup
User Types
User,UserProfile,UserGroupUserDepartment,CreateUserRequestUserStatus,GroupMemberStatus
Tenant Types
Application,Tenant,PlanTenantProfile,Role,RoleMasterApplicationStatus,TenantStatus,PlanType
Billing Types
TenantBilling,Invoice,PaymentTransactionUsageBilling,InvoiceLineItemSubscriptionType,SubscriptionStatus
Branding Types
BrandingSettings,SEOSettingsThemeMode,LayoutStyle,ButtonStyleColorPalette,FontConfiguration
Event Types
BaseEvent<T>,EventHandler<T>- User events:
UserCreatedEvent,UserUpdatedEvent - Tenant events:
TenantCreatedEvent,TenantPlanChangedEvent - Billing events:
SubscriptionCreatedEvent,PaymentSucceededEvent
Database Types
DatabaseConfig,PoolConfigBaseRepository<T>,TenantAwareRepository<T>Migration,TransactionContext
Development
# Build the package
npm run build
# Watch for changes
npm run build:watch
# Lint code
npm run lint
# Format code
npm run formatLicense
MIT