11import { defineStack } from '@objectstack/spec' ;
22
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' ;
14-
15- // ─── APIs ───────────────────────────────────────────────────────────
16- import { PipelineStatsApi } from './src/apis/pipeline-stats.api' ;
17- import { LeadConvertApi } from './src/apis/lead-convert.api' ;
18-
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' ;
25-
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' ;
30-
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' ;
38-
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' ;
45-
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' ;
52-
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' ;
58-
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' ;
3+ // ─── Barrel Imports (one per metadata type) ─────────────────────────
4+ import * as objects from './src/objects' ;
5+ import * as apis from './src/apis' ;
6+ import * as actions from './src/actions' ;
7+ import * as dashboards from './src/dashboards' ;
8+ import * as reports from './src/reports' ;
9+ import * as flows from './src/flows' ;
10+ import * as agents from './src/agents' ;
11+ import * as ragPipelines from './src/rag' ;
12+ import * as profiles from './src/profiles' ;
13+ import * as apps from './src/apps' ;
14+
15+ // ─── Sharing & Security (special: mixed single/array values) ───────
16+ import {
17+ OrganizationDefaults ,
18+ AccountTeamSharingRule , TerritorySharingRules ,
19+ OpportunitySalesSharingRule ,
20+ CaseEscalationSharingRule ,
21+ RoleHierarchy ,
22+ } from './src/sharing' ;
7523
7624export default defineStack ( {
7725 manifest : {
@@ -80,77 +28,21 @@ export default defineStack({
8028 type : 'app' ,
8129 name : 'Enterprise CRM' ,
8230 description : 'Comprehensive enterprise CRM demonstrating all ObjectStack Protocol features including AI, security, and automation' ,
83- author : 'ObjectStack Team' ,
84- repository : 'https://github.com/objectstack-ai/spec' ,
85- license : 'MIT' ,
8631 } ,
8732
88- objects : [
89- Account , Contact , Lead , Opportunity , Quote , Contract ,
90- Case , Task ,
91- Campaign ,
92- Product ,
93- ] ,
94-
95- apis : [
96- PipelineStatsApi ,
97- LeadConvertApi ,
98- ] ,
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-
33+ // Auto-collected from barrel index files via Object.values()
34+ objects : Object . values ( objects ) ,
35+ apis : Object . values ( apis ) ,
36+ actions : Object . values ( actions ) ,
37+ dashboards : Object . values ( dashboards ) ,
38+ reports : Object . values ( reports ) ,
39+ flows : Object . values ( flows ) as any ,
40+ agents : Object . values ( agents ) as any ,
41+ ragPipelines : Object . values ( ragPipelines ) ,
42+ profiles : Object . values ( profiles ) ,
43+ apps : Object . values ( apps ) ,
44+
45+ // Sharing & security (requires explicit wiring)
15446 sharingRules : [
15547 AccountTeamSharingRule ,
15648 OpportunitySalesSharingRule ,
@@ -159,6 +51,4 @@ export default defineStack({
15951 ] ,
16052 roleHierarchy : RoleHierarchy ,
16153 organizationDefaults : OrganizationDefaults ,
162-
163- apps : [ CrmApp ] ,
164- } ) ;
54+ } as any ) ;
0 commit comments