Skip to main content

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

FileKey Types ExportedUsed By
user.types.tsUser, UserProfile, UpdateProfileInputAuth, account management
workspace.types.tsWorkspace, WorkspaceMember, Role, CreateWorkspaceInputWorkspace management, RBAC
platform.types.tsPlatform (enum: FACEBOOK, INSTAGRAM, TIKTOK), SocialAccountAll platform-related features
plan.types.tsPlan, Subscription, PlanFeatures, FeatureBilling, feature gating
admin.types.tsAdminDashboard, AdminMetrics, AdminUserListSuper admin panel

Content Types

FileKey Types ExportedUsed By
post.types.tsPost, PostMedia, PostPublication, CreatePostInput, PostStatusComposer, posts, publishing
schedule.types.tsSchedule, ScheduleInput, ScheduleStatusScheduler
brand-voice.types.tsBrandVoice, BrandVoiceConfig, CreateBrandVoiceInputBrand voice feature
calendar.types.tsContentCalendar, CalendarEntry, CalendarConfigContent calendar
repurpose.types.tsRepurposeInput, RepurposeOutput, RepurposeFormatContent repurposing
trend.types.tsTrendItem, TrendScan, TrendCategoryTrend scanner

AI Types

FileKey Types ExportedUsed By
ai.types.tsAiGenerateInput, AiResponse, CaptionGenerateInput, HashtagGenerateInput, CTAGenerateInput, TranslateInput, ImageGenerateInputAI tools, caption generation
ice.types.tsConversationThread, ConversationMessage, BotConfig, EscalationRule, ThreadStatus, MessageDirectionConversation engine (ICE)
conversation.types.tsThread, Message, ConversationConfig, ReplyExperimentInbox, conversations

Analytics Types

FileKey Types ExportedUsed By
analytics.types.tsMetricSnapshot, ChartData, TimeSeries, DashboardDataAnalytics dashboard
ab-test.types.tsABTest, ABTestVariant, ABTestResultA/B testing
prediction.types.tsEngagementPrediction, RevenuePrediction, PredictionInputPredictions
benchmark.types.tsBenchmark, NicheData, IndustryBenchmarkBenchmarking
intelligence.types.tsGapAnalysis, Insight, AlgorithmChangeIntelligence feature

Integration Types

FileKey Types ExportedUsed By
ecommerce.types.tsEcommerceStore, EcommerceProduct, StoreProviderE-Commerce
commerce.types.tsCommerceOrder, RevenueAttribution, RevenueDashboardCommerce, revenue
ads.types.tsAdCampaign, AdMetric, AutoBoostRule, AdPlatformAd management
competitor.types.tsCompetitor, CompetitorSnapshot, CompetitorReportCompetitor tracking
integration.types.tsIntegration, WebhookConfig, IntegrationProviderThird-party integrations

Automation & Workflow Types

FileKey Types ExportedUsed By
workflow.types.tsWorkflow, WorkflowNode, WorkflowEdge, WorkflowRun, NodeType, ActionType, ConditionOperatorWorkflow builder and engine

Audience & Agency Types

FileKey Types ExportedUsed By
audience.types.tsAudienceNode, AudienceSegment, AudienceTag, AudienceInteractionAudience CRM
approval.types.tsApprovalRequest, ApprovalStatusApproval workflows
report.types.tsClientReport, ReportConfig, ReportDataClient reports
notification.types.tsNotification, NotificationTypeNotifications

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 FileValidator File
post.types.tspost.validators.ts
ai.types.tsai.validators.ts
workflow.types.tsworkflow.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