Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"fumadocs-mdx": "^14.2.5",
"fumadocs-ui": "^16.4.7",
"lucide-react": "^0.562.0",
"next": "^16.1.3",
"next": "^16.1.5",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"server-only": "^0.0.1",
Expand Down
18 changes: 9 additions & 9 deletions examples/crm/src/ui/reports.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Report } from '@objectstack/spec/ui';
import type { ReportInput } from '@objectstack/spec/ui';

// Sales Report - Opportunities by Stage
export const OpportunitiesByStageReport: Report = {
export const OpportunitiesByStageReport: ReportInput = {
name: 'opportunities_by_stage',
label: 'Opportunities by Stage',
description: 'Summary of opportunities grouped by stage',
Expand Down Expand Up @@ -56,7 +56,7 @@ export const OpportunitiesByStageReport: Report = {
};

// Sales Report - Won Opportunities by Owner
export const WonOpportunitiesByOwnerReport: Report = {
export const WonOpportunitiesByOwnerReport: ReportInput = {
name: 'won_opportunities_by_owner',
label: 'Won Opportunities by Owner',
description: 'Closed won opportunities grouped by owner',
Expand Down Expand Up @@ -105,7 +105,7 @@ export const WonOpportunitiesByOwnerReport: Report = {
};

// Account Report - Accounts by Industry and Type (Matrix)
export const AccountsByIndustryTypeReport: Report = {
export const AccountsByIndustryTypeReport: ReportInput = {
name: 'accounts_by_industry_type',
label: 'Accounts by Industry and Type',
description: 'Matrix report showing accounts by industry and type',
Expand Down Expand Up @@ -144,7 +144,7 @@ export const AccountsByIndustryTypeReport: Report = {
};

// Support Report - Cases by Status and Priority
export const CasesByStatusPriorityReport: Report = {
export const CasesByStatusPriorityReport: ReportInput = {
name: 'cases_by_status_priority',
label: 'Cases by Status and Priority',
description: 'Summary of cases by status and priority',
Expand Down Expand Up @@ -197,7 +197,7 @@ export const CasesByStatusPriorityReport: Report = {
};

// Support Report - SLA Performance
export const SlaPerformanceReport: Report = {
export const SlaPerformanceReport: ReportInput = {
name: 'sla_performance',
label: 'SLA Performance Report',
description: 'Analysis of SLA compliance',
Expand Down Expand Up @@ -243,7 +243,7 @@ export const SlaPerformanceReport: Report = {
};

// Lead Report - Leads by Source and Status
export const LeadsBySourceReport: Report = {
export const LeadsBySourceReport: ReportInput = {
name: 'leads_by_source',
label: 'Leads by Source and Status',
description: 'Lead pipeline analysis',
Expand Down Expand Up @@ -291,7 +291,7 @@ export const LeadsBySourceReport: Report = {
};

// Contact Report - Contacts by Account
export const ContactsByAccountReport: Report = {
export const ContactsByAccountReport: ReportInput = {
name: 'contacts_by_account',
label: 'Contacts by Account',
description: 'List of contacts grouped by account',
Expand Down Expand Up @@ -331,7 +331,7 @@ export const ContactsByAccountReport: Report = {
};

// Activity Report - Tasks by Owner
export const TasksByOwnerReport: Report = {
export const TasksByOwnerReport: ReportInput = {
name: 'tasks_by_owner',
label: 'Tasks by Owner',
description: 'Task summary by owner',
Expand Down
17 changes: 16 additions & 1 deletion packages/spec/src/ui/report.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,29 @@ export const ReportSchema = z.object({
chart: ReportChartSchema.optional().describe('Embedded chart configuration'),
});

/**
* Report Types
*
* Note: For configuration/definition contexts, use the Input types (e.g., ReportInput)
* which allow optional fields with defaults to be omitted.
*/
export type Report = z.infer<typeof ReportSchema>;
export type ReportColumn = z.infer<typeof ReportColumnSchema>;
export type ReportGrouping = z.infer<typeof ReportGroupingSchema>;
export type ReportChart = z.infer<typeof ReportChartSchema>;

/**
* Input Types for Report Configuration
* Use these when defining reports in configuration files.
*/
export type ReportInput = z.input<typeof ReportSchema>;
export type ReportColumnInput = z.input<typeof ReportColumnSchema>;
export type ReportGroupingInput = z.input<typeof ReportGroupingSchema>;
export type ReportChartInput = z.input<typeof ReportChartSchema>;

/**
* Report Factory Helper
*/
export const Report = {
create: (config: z.input<typeof ReportSchema>): Report => ReportSchema.parse(config),
create: (config: ReportInput): Report => ReportSchema.parse(config),
} as const;
Loading
Loading