Files
postgres/src/utils/featureConfig.ts
copilot-swe-agent[bot] 42f58b94d7 docs: Update documentation for constraint management feature
- Update ROADMAP.md with constraint management progress
- Update README.md with constraint manager feature
- Update TESTING.md with constraint test coverage (93 total tests)
- Fix linting issues in constraints API and featureConfig
- All 40 unit tests passing

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2026-01-08 03:44:45 +00:00

71 lines
1.5 KiB
TypeScript

import featuresConfig from '@/config/features.json';
export type Feature = {
id: string;
name: string;
description: string;
enabled: boolean;
priority: string;
endpoints: Array<{
path: string;
methods: string[];
description: string;
}>;
ui: {
showInNav: boolean;
icon: string;
actions: string[];
};
};
export type DataType = {
name: string;
category: string;
requiresLength: boolean;
defaultLength?: number;
autoIncrement?: boolean;
};
export type NavItem = {
id: string;
label: string;
icon: string;
featureId: string;
};
export type ConstraintType = {
name: string;
description: string;
requiresColumn: boolean;
requiresExpression: boolean;
};
export function getFeatures(): Feature[] {
return featuresConfig.features.filter(f => f.enabled);
}
export function getFeatureById(id: string): Feature | undefined {
return featuresConfig.features.find(f => f.id === id && f.enabled);
}
export function getDataTypes(): DataType[] {
return featuresConfig.dataTypes;
}
export function getConstraintTypes(): ConstraintType[] {
return (featuresConfig as any).constraintTypes || [];
}
export function getNavItems(): NavItem[] {
return featuresConfig.navItems.filter((item) => {
const feature = getFeatureById(item.featureId);
return feature && feature.enabled;
});
}
export function getEnabledFeaturesByPriority(priority: string): Feature[] {
return featuresConfig.features.filter(
f => f.enabled && f.priority === priority,
);
}