11import { defineStack } from '@objectstack/spec' ;
2- import { App } from '@objectstack/spec/ui' ;
32
4- // Sales Domain Objects
5- import { Account } from './src/domains/sales/account.object' ;
6- import { Contact } from './src/domains/sales/contact.object' ;
7- import { Opportunity } from './src/domains/sales/opportunity.object' ;
8- import { Lead } from './src/domains/sales/lead.object' ;
9- import { Quote } from './src/domains/sales/quote.object' ;
10- import { Contract } from './src/domains/sales/contract.object' ;
3+ // ─── Objects ────────────────────────────────────────────────────────
4+ import { Account } from './src/objects/account.object' ;
5+ import { Contact } from './src/objects/contact.object' ;
6+ import { Opportunity } from './src/objects/opportunity.object' ;
7+ import { Lead } from './src/objects/lead.object' ;
8+ import { Quote } from './src/objects/quote.object' ;
9+ import { Contract } from './src/objects/contract.object' ;
10+ import { Case } from './src/objects/case.object' ;
11+ import { Task } from './src/objects/task.object' ;
12+ import { Campaign } from './src/objects/campaign.object' ;
13+ import { Product } from './src/objects/product.object' ;
1114
12- // Service Domain Objects
13- import { Case } from './src/domains/service/case.object ' ;
14- import { Task } from './src/domains/service/task.object ' ;
15+ // ─── APIs ───────────────────────────────────────────────────────────
16+ import { PipelineStatsApi } from './src/apis/pipeline-stats.api ' ;
17+ import { LeadConvertApi } from './src/apis/lead-convert.api ' ;
1518
16- // Marketing Domain Objects
17- import { Campaign } from './src/domains/marketing/campaign.object' ;
19+ // ─── Actions ────────────────────────────────────────────────────────
20+ import { ConvertLeadAction , CreateCampaignAction } from './src/actions/lead.actions' ;
21+ import { MarkPrimaryContactAction , SendEmailAction } from './src/actions/contact.actions' ;
22+ import { CloneOpportunityAction , MassUpdateStageAction } from './src/actions/opportunity.actions' ;
23+ import { EscalateCaseAction , CloseCaseAction } from './src/actions/case.actions' ;
24+ import { LogCallAction , ExportToCsvAction } from './src/actions/global.actions' ;
1825
19- // Product Domain Objects
20- import { Product } from './src/domains/products/product.object' ;
26+ // ─── Dashboards ─────────────────────────────────────────────────────
27+ import { SalesDashboard } from './src/dashboards/sales.dashboard' ;
28+ import { ServiceDashboard } from './src/dashboards/service.dashboard' ;
29+ import { ExecutiveDashboard } from './src/dashboards/executive.dashboard' ;
2130
22- // APIs
23- import { PipelineStatsApi , LeadConvertApi } from './src/server' ;
31+ // ─── Reports ────────────────────────────────────────────────────────
32+ import { OpportunitiesByStageReport , WonOpportunitiesByOwnerReport } from './src/reports/opportunity.report' ;
33+ import { AccountsByIndustryTypeReport } from './src/reports/account.report' ;
34+ import { CasesByStatusPriorityReport , SlaPerformanceReport } from './src/reports/case.report' ;
35+ import { LeadsBySourceReport } from './src/reports/lead.report' ;
36+ import { ContactsByAccountReport } from './src/reports/contact.report' ;
37+ import { TasksByOwnerReport } from './src/reports/task.report' ;
2438
25- // UI Configuration
26- import { CrmActions } from './src/ui/actions' ;
27- import { CrmDashboards } from './src/ui/dashboards' ;
28- import { CrmReports } from './src/ui/reports' ;
39+ // ─── Flows ──────────────────────────────────────────────────────────
40+ import { LeadConversionFlow } from './src/flows/lead-conversion.flow' ;
41+ import { OpportunityApprovalFlow } from './src/flows/opportunity-approval.flow' ;
42+ import { CaseEscalationFlow } from './src/flows/case-escalation.flow' ;
43+ import { QuoteGenerationFlow } from './src/flows/quote-generation.flow' ;
44+ import { CampaignEnrollmentFlow } from './src/flows/campaign-enrollment.flow' ;
2945
30- // Security Configuration
31- import { CrmProfiles } from './src/security/profiles' ;
32- import { CrmSharingRules } from './src/security/sharing-rules' ;
46+ // ─── Agents ─────────────────────────────────────────────────────────
47+ import { SalesAssistantAgent } from './src/agents/sales.agent' ;
48+ import { ServiceAgent } from './src/agents/service.agent' ;
49+ import { LeadEnrichmentAgent } from './src/agents/lead-enrichment.agent' ;
50+ import { RevenueIntelligenceAgent } from './src/agents/revenue-intelligence.agent' ;
51+ import { EmailCampaignAgent } from './src/agents/email-campaign.agent' ;
3352
34- // AI Configuration
35- import { CrmAgents } from './src/ai/agents' ;
36- import { CrmRagPipelines } from './src/ai/rag-pipelines' ;
53+ // ─── RAG Pipelines ─────────────────────────────────────────────────
54+ import { SalesKnowledgeRAG } from './src/rag/sales-knowledge.rag' ;
55+ import { SupportKnowledgeRAG } from './src/rag/support-knowledge.rag' ;
56+ import { ProductInfoRAG } from './src/rag/product-info.rag' ;
57+ import { CompetitiveIntelRAG } from './src/rag/competitive-intel.rag' ;
3758
38- // Automation
39- import { CrmFlows } from './src/automation/flows' ;
59+ // ─── Profiles ───────────────────────────────────────────────────────
60+ import { SalesRepProfile } from './src/profiles/sales-rep.profile' ;
61+ import { SalesManagerProfile } from './src/profiles/sales-manager.profile' ;
62+ import { ServiceAgentProfile } from './src/profiles/service-agent.profile' ;
63+ import { MarketingUserProfile } from './src/profiles/marketing-user.profile' ;
64+ import { SystemAdminProfile } from './src/profiles/system-admin.profile' ;
65+
66+ // ─── Sharing & Security ────────────────────────────────────────────
67+ import { OrganizationDefaults } from './src/sharing/defaults.sharing' ;
68+ import { AccountTeamSharingRule , TerritorySharingRules } from './src/sharing/account.sharing' ;
69+ import { OpportunitySalesSharingRule } from './src/sharing/opportunity.sharing' ;
70+ import { CaseEscalationSharingRule } from './src/sharing/case.sharing' ;
71+ import { RoleHierarchy } from './src/sharing/role-hierarchy' ;
72+
73+ // ─── App ────────────────────────────────────────────────────────────
74+ import { CrmApp } from './src/apps/crm.app' ;
4075
4176export default defineStack ( {
4277 manifest : {
@@ -49,127 +84,81 @@ export default defineStack({
4984 repository : 'https://github.com/objectstack-ai/spec' ,
5085 license : 'MIT' ,
5186 } ,
52-
53- // Data Model - Organized by Domain
87+
5488 objects : [
55- // Sales Domain (6 objects)
56- Account ,
57- Contact ,
58- Lead ,
59- Opportunity ,
60- Quote ,
61- Contract ,
62-
63- // Service Domain (2 objects)
64- Case ,
65- Task ,
66-
67- // Marketing Domain (1 object)
89+ Account , Contact , Lead , Opportunity , Quote , Contract ,
90+ Case , Task ,
6891 Campaign ,
69-
70- // Product Domain (1 object)
7192 Product ,
7293 ] ,
73-
74- // Custom APIs
94+
7595 apis : [
7696 PipelineStatsApi ,
7797 LeadConvertApi ,
7898 ] ,
79-
80- // User Interface
81- actions : Object . values ( CrmActions ) ,
82- dashboards : Object . values ( CrmDashboards ) ,
83- reports : Object . values ( CrmReports ) ,
84-
85- // Security Configuration
86- profiles : Object . values ( CrmProfiles ) ,
99+
100+ actions : [
101+ ConvertLeadAction , CreateCampaignAction ,
102+ MarkPrimaryContactAction , SendEmailAction ,
103+ CloneOpportunityAction , MassUpdateStageAction ,
104+ EscalateCaseAction , CloseCaseAction ,
105+ LogCallAction , ExportToCsvAction ,
106+ ] ,
107+
108+ dashboards : [
109+ SalesDashboard ,
110+ ServiceDashboard ,
111+ ExecutiveDashboard ,
112+ ] ,
113+
114+ reports : [
115+ OpportunitiesByStageReport , WonOpportunitiesByOwnerReport ,
116+ AccountsByIndustryTypeReport ,
117+ CasesByStatusPriorityReport , SlaPerformanceReport ,
118+ LeadsBySourceReport ,
119+ ContactsByAccountReport ,
120+ TasksByOwnerReport ,
121+ ] ,
122+
123+ flows : [
124+ LeadConversionFlow ,
125+ OpportunityApprovalFlow ,
126+ CaseEscalationFlow ,
127+ QuoteGenerationFlow ,
128+ CampaignEnrollmentFlow ,
129+ ] ,
130+
131+ agents : [
132+ SalesAssistantAgent ,
133+ ServiceAgent ,
134+ LeadEnrichmentAgent ,
135+ RevenueIntelligenceAgent ,
136+ EmailCampaignAgent ,
137+ ] ,
138+
139+ ragPipelines : [
140+ SalesKnowledgeRAG ,
141+ SupportKnowledgeRAG ,
142+ ProductInfoRAG ,
143+ CompetitiveIntelRAG ,
144+ ] ,
145+
146+ profiles : [
147+ SalesRepProfile ,
148+ SalesManagerProfile ,
149+ ServiceAgentProfile ,
150+ MarketingUserProfile ,
151+ SystemAdminProfile ,
152+ ] ,
153+
87154 sharingRules : [
88- CrmSharingRules . AccountTeamSharingRule ,
89- CrmSharingRules . OpportunitySalesSharingRule ,
90- CrmSharingRules . CaseEscalationSharingRule ,
91- ...CrmSharingRules . TerritorySharingRules ,
155+ AccountTeamSharingRule ,
156+ OpportunitySalesSharingRule ,
157+ CaseEscalationSharingRule ,
158+ ...TerritorySharingRules ,
92159 ] ,
93- roleHierarchy : CrmSharingRules . RoleHierarchy ,
94- organizationDefaults : CrmSharingRules . OrganizationDefaults ,
95-
96- // AI & Automation
97- agents : Object . values ( CrmAgents ) ,
98- ragPipelines : Object . values ( CrmRagPipelines ) ,
99- flows : Object . values ( CrmFlows ) ,
100-
101- // Application Definition
102- apps : [
103- App . create ( {
104- name : 'crm_enterprise' ,
105- label : 'Enterprise CRM' ,
106- icon : 'briefcase' ,
107- branding : {
108- primaryColor : '#4169E1' ,
109- secondaryColor : '#00AA00' ,
110- logo : '/assets/crm-logo.png' ,
111- favicon : '/assets/crm-favicon.ico' ,
112- } ,
113-
114- // Enhanced Navigation Menu Structure
115- navigation : [
116- {
117- id : 'group_sales' ,
118- type : 'group' ,
119- label : 'Sales' ,
120- icon : 'chart-line' ,
121- children : [
122- { id : 'nav_lead' , type : 'object' , objectName : 'lead' , label : 'Leads' , icon : 'user-plus' } ,
123- { id : 'nav_account' , type : 'object' , objectName : 'account' , label : 'Accounts' , icon : 'building' } ,
124- { id : 'nav_contact' , type : 'object' , objectName : 'contact' , label : 'Contacts' , icon : 'user' } ,
125- { id : 'nav_opportunity' , type : 'object' , objectName : 'opportunity' , label : 'Opportunities' , icon : 'bullseye' } ,
126- { id : 'nav_quote' , type : 'object' , objectName : 'quote' , label : 'Quotes' , icon : 'file-invoice' } ,
127- { id : 'nav_contract' , type : 'object' , objectName : 'contract' , label : 'Contracts' , icon : 'file-signature' } ,
128- { id : 'nav_sales_dashboard' , type : 'dashboard' , dashboardName : 'sales_dashboard' , label : 'Sales Dashboard' , icon : 'chart-bar' } ,
129- ]
130- } ,
131- {
132- id : 'group_service' ,
133- type : 'group' ,
134- label : 'Service' ,
135- icon : 'headset' ,
136- children : [
137- { id : 'nav_case' , type : 'object' , objectName : 'case' , label : 'Cases' , icon : 'life-ring' } ,
138- { id : 'nav_task' , type : 'object' , objectName : 'task' , label : 'Tasks' , icon : 'tasks' } ,
139- { id : 'nav_service_dashboard' , type : 'dashboard' , dashboardName : 'service_dashboard' , label : 'Service Dashboard' , icon : 'chart-pie' } ,
140- ]
141- } ,
142- {
143- id : 'group_marketing' ,
144- type : 'group' ,
145- label : 'Marketing' ,
146- icon : 'megaphone' ,
147- children : [
148- { id : 'nav_campaign' , type : 'object' , objectName : 'campaign' , label : 'Campaigns' , icon : 'bullhorn' } ,
149- { id : 'nav_lead_marketing' , type : 'object' , objectName : 'lead' , label : 'Leads' , icon : 'user-plus' } ,
150- ]
151- } ,
152- {
153- id : 'group_products' ,
154- type : 'group' ,
155- label : 'Products' ,
156- icon : 'box' ,
157- children : [
158- { id : 'nav_product' , type : 'object' , objectName : 'product' , label : 'Products' , icon : 'box-open' } ,
159- ]
160- } ,
161- {
162- id : 'group_analytics' ,
163- type : 'group' ,
164- label : 'Analytics' ,
165- icon : 'chart-area' ,
166- children : [
167- { id : 'nav_exec_dashboard' , type : 'dashboard' , dashboardName : 'executive_dashboard' , label : 'Executive Dashboard' , icon : 'tachometer-alt' } ,
168- { id : 'nav_analytics_sales_db' , type : 'dashboard' , dashboardName : 'sales_dashboard' , label : 'Sales Analytics' , icon : 'chart-line' } ,
169- { id : 'nav_analytics_service_db' , type : 'dashboard' , dashboardName : 'service_dashboard' , label : 'Service Analytics' , icon : 'chart-pie' } ,
170- ]
171- }
172- ]
173- } )
174- ]
160+ roleHierarchy : RoleHierarchy ,
161+ organizationDefaults : OrganizationDefaults ,
162+
163+ apps : [ CrmApp ] ,
175164} ) ;
0 commit comments