1.0.1 • Published 5 months ago

@saas-platform/shared-types v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

@saas-platform/shared-types

Common TypeScript interfaces and types for the Multi-Tenant SaaS Platform.

Installation

npm install @saas-platform/shared-types

Usage

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, ApplicationId
  • Status, Environment, ErrorCode
  • PaginationParams, PaginationMeta

API Types

  • ApiRequest<T>, ApiResponse<T>
  • PaginatedResponse<T>, ErrorResponse
  • ValidationError, RequestContext

Authentication Types

  • AccessTokenPayload, RefreshTokenPayload
  • UserSession, AuthContext
  • DeviceType, LoginMethod, MFASetup

User Types

  • User, UserProfile, UserGroup
  • UserDepartment, CreateUserRequest
  • UserStatus, GroupMemberStatus

Tenant Types

  • Application, Tenant, Plan
  • TenantProfile, Role, RoleMaster
  • ApplicationStatus, TenantStatus, PlanType

Billing Types

  • TenantBilling, Invoice, PaymentTransaction
  • UsageBilling, InvoiceLineItem
  • SubscriptionType, SubscriptionStatus

Branding Types

  • BrandingSettings, SEOSettings
  • ThemeMode, LayoutStyle, ButtonStyle
  • ColorPalette, FontConfiguration

Event Types

  • BaseEvent<T>, EventHandler<T>
  • User events: UserCreatedEvent, UserUpdatedEvent
  • Tenant events: TenantCreatedEvent, TenantPlanChangedEvent
  • Billing events: SubscriptionCreatedEvent, PaymentSucceededEvent

Database Types

  • DatabaseConfig, PoolConfig
  • BaseRepository<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 format

License

MIT

saas-platform-shared-types

saas-platform-shared-types

saas-platform-shared-types