npm package: @lineai/service-data-types
Description: Shared TypeScript types for Line AI service data libraries and Firestore schemas
Latest version: 1.1.17

# @lineai/service-data-types

Shared TypeScript types for Line AI service data libraries and Firestore schemas.

## Installation

```bash
npm install @lineai/service-data-types
```

## Usage

### Core Platform Types

```typescript
import { OrganizationData, Project, ProjectType } from '@lineai/service-data-types';

// Organization data
const org: OrganizationData = {
  id: 'org123',
  name: 'My Organization',
  slug: 'my-org',
  emoji: '🚀',
  createdAt: Date.now(),
  features: ['projects', 'analytics'],
  businessDetails: {
    industry: 'Technology',
    size: '10-50'
  }
};

// Project data
const project: Project = {
  id: 'proj123',
  name: 'My Project',
  type: 'web_app',
  slug: 'my-project',
  createdAt: Date.now(),
  updatedAt: Date.now(),
  createdBy: 'firebase-user-id'
  // ... other required fields
};
```

### Service Types

```typescript
import { TeamMember, MemoryCard, ScheduleDocument } from '@lineai/service-data-types';

// Team service
const member: TeamMember = {
  email: 'user@example.com',
  role: 'admin',
  joinedAt: serverTimestamp(),
  invitedBy: 'firebase-user-id'
};

// Memory service
const card: MemoryCard = {
  id: 'card123',
  name: 'Research Notes',
  assetIds: ['asset1', 'asset2'],
  isInstalled: true,
  createdBy: 'clerk-user-id',
  firebaseUserId: 'firebase-user-id',
  // ... other required fields
};
```

### Firestore Utilities

```typescript
import { createServicePath, createCollectionPath, ServiceId } from '@lineai/service-data-types';

// Generate Firestore paths
const servicePath = createServicePath('my-org', 'proj123', 'team');
// Returns: "organizations/my-org/projects/proj123/services/team"

const collectionPath = createCollectionPath('my-org', 'proj123', 'team', 'members');
// Returns: "organizations/my-org/projects/proj123/services/team/members"
```

### Configuration Utilities

```typescript
import { ServiceDataConfig, ListOptions, QueryFilter, createServiceConfig } from '@lineai/service-data-types';

const config = createServiceConfig('my-org', 'my-project', 'team');
const options: ListOptions = {
  limit: 10,
  orderBy: 'createdAt',
  orderDirection: 'desc'
};
```

## Type Categories

### Platform Types
- **Organizations**: `OrganizationData`, `SubdomainData`
- **Projects**: `Project`, `ProjectProgress`, `ProjectType`, `ProjectActivity`

### Service Types

**Fully Implemented Services:**
- **Team**: `TeamMember`, `TeamInvitation`
- **Memory**: `MemoryCard`, `MemoryAsset`
- **Scheduler**: `ScheduleDocument`, `TriggerDocument`, `ScheduleExecution`
- **Integrations**: `IntegrationConnection`, `IntegrationLog`, `IntegrationToolkit`
- **Models**: `SelectedModel`, `ModelsServiceDocument`
- **Analytics**: `AnalyticsProvider`, `AnalyticsReport`

**Partially Implemented Services:**
- **Webpages**: `WebpageBrandAsset`, `WebpageInstructions`, `WebpageDeployedPage`
- **Phone**: `PhoneCallLog`, `PhoneMessage`, `PhoneServiceDocument`

### Utilities
- **Firestore**: Path generation utilities for service collections
- **Configuration**: Service data client configuration types

## Service Schema Paths

All service data follows the Firestore path pattern:
```
organizations/{subdomain}/projects/{projectId}/services/{serviceId}/
```

Each service has its own subcollections for different data types.

## License

MIT