Shared Types
The @unipulse/shared package contains 29 type definition files that define the data contracts between the frontend and backend. These types are the single source of truth for all API request/response shapes.
Package Location
Pulse/packages/shared/src/types/
Import Pattern
import type { Post, CreatePostInput, Platform } from '@unipulse/shared';
Complete Type File Reference
Core Types
| File | Key Types Exported | Used By |
|---|---|---|
user.types.ts | User, UserProfile, UpdateProfileInput | Auth, account management |
workspace.types.ts | Workspace, WorkspaceMember, Role, CreateWorkspaceInput | Workspace management, RBAC |
platform.types.ts | Platform (enum: FACEBOOK, INSTAGRAM, TIKTOK), SocialAccount | All platform-related features |
plan.types.ts | Plan, Subscription, PlanFeatures, Feature | Billing, feature gating |
admin.types.ts | AdminDashboard, AdminMetrics, AdminUserList | Super admin panel |
Content Types
| File | Key Types Exported | Used By |
|---|---|---|
post.types.ts | Post, PostMedia, PostPublication, CreatePostInput, PostStatus | Composer, posts, publishing |
schedule.types.ts | Schedule, ScheduleInput, ScheduleStatus | Scheduler |
brand-voice.types.ts | BrandVoice, BrandVoiceConfig, CreateBrandVoiceInput | Brand voice feature |
calendar.types.ts | ContentCalendar, CalendarEntry, CalendarConfig | Content calendar |
repurpose.types.ts | RepurposeInput, RepurposeOutput, RepurposeFormat | Content repurposing |
trend.types.ts | TrendItem, TrendScan, TrendCategory | Trend scanner |
AI Types
| File | Key Types Exported | Used By |
|---|---|---|
ai.types.ts | AiGenerateInput, AiResponse, CaptionGenerateInput, HashtagGenerateInput, CTAGenerateInput, TranslateInput, ImageGenerateInput | AI tools, caption generation |
ice.types.ts | ConversationThread, ConversationMessage, BotConfig, EscalationRule, ThreadStatus, MessageDirection | Conversation engine (ICE) |
conversation.types.ts | Thread, Message, ConversationConfig, ReplyExperiment | Inbox, conversations |
Analytics Types
| File | Key Types Exported | Used By |
|---|---|---|
analytics.types.ts | MetricSnapshot, ChartData, TimeSeries, DashboardData | Analytics dashboard |
ab-test.types.ts | ABTest, ABTestVariant, ABTestResult | A/B testing |
prediction.types.ts | EngagementPrediction, RevenuePrediction, PredictionInput | Predictions |
benchmark.types.ts | Benchmark, NicheData, IndustryBenchmark | Benchmarking |
intelligence.types.ts | GapAnalysis, Insight, AlgorithmChange | Intelligence feature |
Integration Types
| File | Key Types Exported | Used By |
|---|---|---|
ecommerce.types.ts | EcommerceStore, EcommerceProduct, StoreProvider | E-Commerce |
commerce.types.ts | CommerceOrder, RevenueAttribution, RevenueDashboard | Commerce, revenue |
ads.types.ts | AdCampaign, AdMetric, AutoBoostRule, AdPlatform | Ad management |
competitor.types.ts | Competitor, CompetitorSnapshot, CompetitorReport | Competitor tracking |
integration.types.ts | Integration, WebhookConfig, IntegrationProvider | Third-party integrations |
Automation & Workflow Types
| File | Key Types Exported | Used By |
|---|---|---|
workflow.types.ts | Workflow, WorkflowNode, WorkflowEdge, WorkflowRun, NodeType, ActionType, ConditionOperator | Workflow builder and engine |
Audience & Agency Types
| File | Key Types Exported | Used By |
|---|---|---|
audience.types.ts | AudienceNode, AudienceSegment, AudienceTag, AudienceInteraction | Audience CRM |
approval.types.ts | ApprovalRequest, ApprovalStatus | Approval workflows |
report.types.ts | ClientReport, ReportConfig, ReportData | Client reports |
notification.types.ts | Notification, NotificationType | Notifications |
Key Enum Types
// Platform enum
enum Platform {
FACEBOOK = 'FACEBOOK',
INSTAGRAM = 'INSTAGRAM',
TIKTOK = 'TIKTOK',
}
// Role enum (RBAC)
enum Role {
OWNER = 'OWNER',
ADMIN = 'ADMIN',
EDITOR = 'EDITOR',
VIEWER = 'VIEWER',
CLIENT = 'CLIENT',
}
// Workflow node types
enum NodeType {
TRIGGER = 'trigger',
CONDITION = 'condition',
ACTION = 'action',
}
// Workflow condition operators
enum ConditionOperator {
EQ = 'eq', NEQ = 'neq',
GT = 'gt', GTE = 'gte',
LT = 'lt', LTE = 'lte',
CONTAINS = 'contains',
NOT_CONTAINS = 'not_contains',
}
// Workflow action types
enum ActionType {
SEND_NOTIFICATION = 'send_notification',
CREATE_DRAFT = 'create_draft',
PUBLISH_POST = 'publish_post',
SEND_REPLY = 'send_reply',
WAIT = 'wait',
BOOST_POST = 'boost_post',
AI_REPURPOSE_CONTENT = 'ai_repurpose_content',
}
Type-Validator Pairing
Each type file has a corresponding validator file in packages/shared/src/validators/. The types and validators share the same names and are exported together:
| Type File | Validator File |
|---|---|
post.types.ts | post.validators.ts |
ai.types.ts | ai.validators.ts |
workflow.types.ts | workflow.validators.ts |
| ... | ... (29 pairs total) |
Type Inference from Validators
You can infer types directly from Zod schemas, which guarantees type-validator consistency:
import { z } from 'zod';
export const createPostSchema = z.object({ ... });
export type CreatePostInput = z.infer<typeof createPostSchema>;
Cross-Reference
- Validators -- Zod schemas corresponding to these types
- Adding New Types -- how to add new shared types
- Schema Overview -- Prisma models these types map to
- API Reference -- routes that use these types