Reduce leak between gql schema (#17878)
## Reduce type leakage between GraphQL schemas ### Why Twenty runs two separate GraphQL schemas: **core** and **metadata**. NestJS's `@nestjs/graphql` uses a global `TypeMetadataStorage` that accumulates all decorated types across all modules. When each schema is built, every registered type leaks into both schemas regardless of which module it belongs to. This means the core schema's generated TypeScript (`generated/graphql.ts`) contained ~2,700 lines of types that only belong to the metadata schema (and vice versa). This creates confusion about type ownership, inflates generated code, and makes it harder to reason about which API surface each schema actually exposes. ### How **1. Patch `@nestjs/graphql` to support schema-scoped type resolution** - **(Already done)** Added a `resolverSchemaScope` option to `GqlModuleOptions`, allowing each schema to declare a scope (e.g. `'metadata'`) - `ResolversExplorerService` now filters resolvers by a `RESOLVER_SCHEMA_SCOPE` metadata key, so each schema only sees its own resolvers - `GraphQLSchemaFactory` now performs a **reachability walk** (`computeReachableTypes`) starting from scoped resolver return types and arguments, only including types that are transitively referenced — handling unions, interfaces, and prototype chains - Type definition storage and orphaned reference registry are cleared between schema builds to prevent cross-contamination **2. Register `ClientConfig` as orphaned type in metadata schema** Since `ClientConfig` is needed in the metadata schema but not directly returned by a resolver, it's explicitly declared via `buildSchemaOptions.orphanedTypes`. **3. Regenerate frontend types and fix imports** - `generated/graphql.ts` shrank by ~2,700 lines (types moved to where they belong) - `generated-metadata/graphql.ts` gained types like `ClientConfig` that were previously missing - ~500 frontend files updated to import from the correct generated file
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ import { useRecoilValue } from 'recoil';
|
||||
import { IconEdit, IconSparkles } from 'twenty-ui/display';
|
||||
import { IconButton } from 'twenty-ui/input';
|
||||
import { useIsMobile } from 'twenty-ui/utilities';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
import { useCreateNewAIChatThread } from '@/ai/hooks/useCreateNewAIChatThread';
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useCommandMenuHotKeys = () => {
|
||||
const { toggleCommandMenu } = useCommandMenu();
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||
import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { PageLayoutType } from '~/generated/graphql';
|
||||
import { PageLayoutType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const CommandMenuCalendarEventPage = () => {
|
||||
const { upsertRecordsInStore } = useUpsertRecordsInStore();
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { getChartLimitMessage } from '@/command-menu/pages/page-layout/utils/getChartLimitMessage';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { SidePanelInformationBanner } from 'twenty-ui/display';
|
||||
import { type WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { type WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
type ChartLimitInfoBannerProps = {
|
||||
widgetConfigurationType: WidgetConfigurationType;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { t } from '@lingui/core/macro';
|
||||
import { isNonEmptyString, isString } from '@sniptt/guards';
|
||||
import { useState } from 'react';
|
||||
import { isDefined, isValidUrl } from 'twenty-shared/utils';
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledOuterContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import {
|
||||
FeatureFlagKey,
|
||||
type FrontComponent,
|
||||
WidgetType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const CommandMenuPageLayoutWidgetTypeSelect = () => {
|
||||
const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord();
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { MenuItemSelect } from 'twenty-ui/navigation';
|
||||
import { AxisNameDisplay } from '~/generated/graphql';
|
||||
import { AxisNameDisplay } from '~/generated-metadata/graphql';
|
||||
|
||||
export const ChartAxisNameSelectionDropdownContent = () => {
|
||||
const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord();
|
||||
|
||||
+10
-10
@@ -91,17 +91,17 @@ export const ChartDataSourceDropdownContent = () => {
|
||||
updateCurrentWidgetConfig({
|
||||
objectMetadataId: newObjectMetadataItemId,
|
||||
configToUpdate: {
|
||||
aggregateFieldMetadataId: null,
|
||||
primaryAxisGroupByFieldMetadataId: null,
|
||||
primaryAxisGroupBySubFieldName: null,
|
||||
secondaryAxisGroupByFieldMetadataId: null,
|
||||
secondaryAxisGroupBySubFieldName: null,
|
||||
primaryAxisOrderBy: null,
|
||||
secondaryAxisOrderBy: null,
|
||||
groupByFieldMetadataId: null,
|
||||
groupBySubFieldName: null,
|
||||
aggregateFieldMetadataId: undefined,
|
||||
primaryAxisGroupByFieldMetadataId: undefined,
|
||||
primaryAxisGroupBySubFieldName: undefined,
|
||||
secondaryAxisGroupByFieldMetadataId: undefined,
|
||||
secondaryAxisGroupBySubFieldName: undefined,
|
||||
primaryAxisOrderBy: undefined,
|
||||
secondaryAxisOrderBy: undefined,
|
||||
groupByFieldMetadataId: undefined,
|
||||
groupBySubFieldName: undefined,
|
||||
filter: {},
|
||||
ratioAggregateConfig: null,
|
||||
ratioAggregateConfig: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/ho
|
||||
import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { MenuItemSelect } from 'twenty-ui/navigation';
|
||||
import { type WidgetConfiguration } from '~/generated/graphql';
|
||||
import { type WidgetConfiguration } from '~/generated-metadata/graphql';
|
||||
|
||||
type ChartDateGranularitySelectionDropdownContentProps = {
|
||||
axis?: 'primary' | 'secondary';
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ import { useMemo, useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useIcons } from 'twenty-ui/display';
|
||||
import { MenuItemSelect } from 'twenty-ui/navigation';
|
||||
import { RelationType } from '~/generated/graphql';
|
||||
import { RelationType } from '~/generated-metadata/graphql';
|
||||
import { filterBySearchQuery } from '~/utils/filterBySearchQuery';
|
||||
|
||||
type ChartGroupByFieldSelectionDropdownContentBaseProps<
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import { Tag } from 'twenty-ui/components';
|
||||
import { IconChevronLeft } from 'twenty-ui/display';
|
||||
import { MenuItemDraggable } from 'twenty-ui/navigation';
|
||||
import { type WidgetConfiguration } from '~/generated/graphql';
|
||||
import { type WidgetConfiguration } from '~/generated-metadata/graphql';
|
||||
import { moveArrayItem } from '~/utils/array/moveArrayItem';
|
||||
|
||||
type ChartManualSortSubMenuContentProps = {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { IconCheck, IconX } from 'twenty-ui/display';
|
||||
import { MenuItemSelect } from 'twenty-ui/navigation';
|
||||
import { AggregateOperations } from '~/generated/graphql';
|
||||
import { AggregateOperations } from '~/generated-metadata/graphql';
|
||||
|
||||
export const ChartRatioOptionBooleanSelectableListItem = ({
|
||||
optionValue,
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { MenuItemSelectTag } from 'twenty-ui/navigation';
|
||||
import { type ThemeColor } from 'twenty-ui/theme';
|
||||
import { AggregateOperations } from '~/generated/graphql';
|
||||
import { AggregateOperations } from '~/generated-metadata/graphql';
|
||||
|
||||
export const ChartRatioOptionSelectSelectableListItem = ({
|
||||
optionValue,
|
||||
|
||||
+8
-9
@@ -22,9 +22,9 @@ import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/ho
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { MenuItemSelect } from 'twenty-ui/navigation';
|
||||
import {
|
||||
GraphOrderBy,
|
||||
type GraphOrderBy as GraphOrderByType,
|
||||
} from '~/generated/graphql';
|
||||
type GraphOrderBy,
|
||||
GraphOrderBy as GraphOrderByEnum,
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const ChartSortByGroupByFieldDropdownContent = () => {
|
||||
const [isSubMenuOpen, setIsSubMenuOpen] = useState(false);
|
||||
@@ -74,12 +74,12 @@ export const ChartSortByGroupByFieldDropdownContent = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleSelectSortOption = (orderBy: GraphOrderByType) => {
|
||||
const handleSelectSortOption = (orderBy: GraphOrderBy) => {
|
||||
const configToUpdate: Record<string, unknown> = {
|
||||
secondaryAxisOrderBy: orderBy,
|
||||
};
|
||||
|
||||
if (orderBy === GraphOrderBy.MANUAL) {
|
||||
if (orderBy === GraphOrderByEnum.MANUAL) {
|
||||
const existingManualSortOrder =
|
||||
configuration.secondaryAxisManualSortOrder;
|
||||
|
||||
@@ -94,7 +94,7 @@ export const ChartSortByGroupByFieldDropdownContent = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (configuration.secondaryAxisOrderBy === GraphOrderBy.MANUAL) {
|
||||
if (configuration.secondaryAxisOrderBy === GraphOrderByEnum.MANUAL) {
|
||||
configToUpdate.secondaryAxisManualSortOrder = null;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ export const ChartSortByGroupByFieldDropdownContent = () => {
|
||||
selectableItemIdArray={availableOptions.map((option) => option.value)}
|
||||
>
|
||||
{availableOptions.map((sortOption) => {
|
||||
const isManualOption = sortOption.value === GraphOrderBy.MANUAL;
|
||||
const isManualOption = sortOption.value === GraphOrderByEnum.MANUAL;
|
||||
|
||||
return (
|
||||
<SelectableListItem
|
||||
@@ -138,8 +138,7 @@ export const ChartSortByGroupByFieldDropdownContent = () => {
|
||||
<MenuItemSelect
|
||||
text={getGroupBySortOptionLabel({
|
||||
graphOrderBy: sortOption.value,
|
||||
groupByFieldMetadataId:
|
||||
configuration.secondaryAxisGroupByFieldMetadataId,
|
||||
groupByFieldMetadataId: secondaryAxisField.id,
|
||||
})}
|
||||
selected={
|
||||
configuration.secondaryAxisOrderBy === sortOption.value
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import {
|
||||
type BarChartConfiguration,
|
||||
GraphOrderBy,
|
||||
type LineChartConfiguration,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const ChartSortBySelectionDropdownContent = () => {
|
||||
const [isSubMenuOpen, setIsSubMenuOpen] = useState(false);
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import {
|
||||
IconSortAscending,
|
||||
IconSortDescending,
|
||||
} from 'twenty-ui/display';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const AGGREGATE_SORT_BY_OPTIONS = [
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const GRAPH_CONFIGURATION_TYPE_TO_CONFIG_TYPENAME: Partial<
|
||||
Record<WidgetConfigurationType, string>
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import {
|
||||
IconGauge,
|
||||
IconSum,
|
||||
} from 'twenty-ui/display';
|
||||
import { BarChartLayout } from '~/generated/graphql';
|
||||
import { BarChartLayout } from '~/generated-metadata/graphql';
|
||||
|
||||
export const GRAPH_TYPE_INFORMATION: Record<
|
||||
GraphType,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
IconTrendingDown,
|
||||
IconTrendingUp,
|
||||
} from 'twenty-ui/display';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
type XSortByOption = {
|
||||
value: GraphOrderBy;
|
||||
|
||||
+4
-2
@@ -61,8 +61,10 @@ export const useChartSettingsValues = ({
|
||||
let groupByOrderBy: GraphOrderBy | undefined | null;
|
||||
|
||||
if (isBarOrLineChart) {
|
||||
groupByFieldXId = configuration.primaryAxisGroupByFieldMetadataId;
|
||||
groupByFieldYId = configuration.secondaryAxisGroupByFieldMetadataId;
|
||||
groupByFieldXId =
|
||||
configuration.primaryAxisGroupByFieldMetadataId ?? undefined;
|
||||
groupByFieldYId =
|
||||
configuration.secondaryAxisGroupByFieldMetadataId ?? undefined;
|
||||
groupBySubFieldNameX = configuration.primaryAxisGroupBySubFieldName as
|
||||
| CompositeFieldSubFieldName
|
||||
| undefined;
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { t } from '@lingui/core/macro';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { type CompositeFieldSubFieldName } from 'twenty-shared/types';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useGraphGroupBySortOptionLabels = ({
|
||||
objectMetadataId,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { t } from '@lingui/core/macro';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { type CompositeFieldSubFieldName } from 'twenty-shared/types';
|
||||
import { assertUnreachable, isDefined } from 'twenty-shared/utils';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useGraphXSortOptionLabels = ({
|
||||
objectMetadataId,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration';
|
||||
import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds';
|
||||
import { getConfigKeyFromSettingId } from '@/command-menu/pages/page-layout/utils/getConfigKeyFromSettingId';
|
||||
import { BarChartGroupMode } from '~/generated/graphql';
|
||||
import { BarChartGroupMode } from '~/generated-metadata/graphql';
|
||||
import { useChartSettingsValues } from './useChartSettingsValues';
|
||||
import { useUpdateCurrentWidgetConfig } from './useUpdateCurrentWidgetConfig';
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTab
|
||||
import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { BarChartLayout } from '~/generated/graphql';
|
||||
import { BarChartLayout } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useGetConfigToUpdateAfterGraphTypeChange = ({
|
||||
pageLayoutId,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type GraphOrderBy,
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type BarLineChartConvertibleFields = {
|
||||
primaryAxisGroupByFieldMetadataId?: string;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { type ChartWidgetConfiguration } from '@/command-menu/pages/page-layout/types/ChartWidgetConfiguration';
|
||||
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
||||
import { type ModifiedProperties } from 'twenty-shared/types';
|
||||
import { type WidgetType } from '~/generated/graphql';
|
||||
import { type WidgetType } from '~/generated-metadata/graphql';
|
||||
|
||||
export type ChartWidget = ModifiedProperties<
|
||||
PageLayoutWidget,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type GraphOrderBy,
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type PieChartConvertibleFields = {
|
||||
groupByFieldMetadataId?: string;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type AggregateChartConfiguration,
|
||||
type WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type TypedAggregateChartConfiguration = AggregateChartConfiguration & {
|
||||
configurationType: WidgetConfigurationType.AGGREGATE_CHART;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type BarChartConfiguration,
|
||||
type WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type TypedBarChartConfiguration = BarChartConfiguration & {
|
||||
configurationType: WidgetConfigurationType.BAR_CHART;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type GaugeChartConfiguration,
|
||||
type WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type TypedGaugeChartConfiguration = GaugeChartConfiguration & {
|
||||
configurationType: WidgetConfigurationType.GAUGE_CHART;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type LineChartConfiguration,
|
||||
type WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type TypedLineChartConfiguration = LineChartConfiguration & {
|
||||
configurationType: WidgetConfigurationType.LINE_CHART;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type PieChartConfiguration,
|
||||
type WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export type TypedPieChartConfiguration = PieChartConfiguration & {
|
||||
configurationType: WidgetConfigurationType.PIE_CHART;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
BarChartGroupMode,
|
||||
GraphOrderBy,
|
||||
WidgetConfigurationType,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
describe('buildChartGroupByFieldConfigUpdate', () => {
|
||||
it('sets default orderBy and dateGranularity for primary axis', () => {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { convertBarOrLineChartConfigToPieChart } from '@/command-menu/pages/page-layout/utils/convertBarOrLineChartConfigToPieChart';
|
||||
import { type BarChartConfiguration } from '~/generated/graphql';
|
||||
import { type BarChartConfiguration } from '~/generated-metadata/graphql';
|
||||
import {
|
||||
TEST_BAR_CHART_CONFIGURATION,
|
||||
TEST_LINE_CHART_CONFIGURATION,
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { convertPieChartConfigToBarOrLineChart } from '@/command-menu/pages/page-layout/utils/convertPieChartConfigToBarOrLineChart';
|
||||
import { type PieChartConfiguration } from '~/generated/graphql';
|
||||
import { type PieChartConfiguration } from '~/generated-metadata/graphql';
|
||||
import {
|
||||
TEST_BAR_CHART_CONFIGURATION,
|
||||
TEST_PIE_CHART_CONFIGURATION,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
import { filterSortOptionsByFieldType } from '@/command-menu/pages/page-layout/utils/filterSortOptionsByFieldType';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('filterSortOptionsByFieldType', () => {
|
||||
const allOptions = [
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/command-menu/pages/page-layout
|
||||
import { STACKED_BARS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/StackedBarsSetting';
|
||||
import { getBarChartSettings } from '@/command-menu/pages/page-layout/utils/getBarChartSettings';
|
||||
import { IconAxisX, IconAxisY } from 'twenty-ui/display';
|
||||
import { BarChartLayout } from '~/generated/graphql';
|
||||
import { BarChartLayout } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getBarChartSettings', () => {
|
||||
describe('Vertical bar chart', () => {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
import { getChartDefaultOrderByForFieldType } from '@/command-menu/pages/page-layout/utils/getChartDefaultOrderByForFieldType';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getChartDefaultOrderByForFieldType', () => {
|
||||
it('should return FIELD_POSITION_ASC for SELECT field type', () => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { getChartLimitMessage } from '@/command-menu/pages/page-layout/utils/getChartLimitMessage';
|
||||
import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getChartLimitMessage', () => {
|
||||
it('returns date-based message for bar chart with date axis', () => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType';
|
||||
import { getConfigurationTypeFromGraphType } from '@/command-menu/pages/page-layout/utils/getConfigurationTypeFromGraphType';
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getConfigurationTypeFromGraphType', () => {
|
||||
it('returns BAR_CHART for VERTICAL_BAR', () => {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import {
|
||||
type BarChartConfiguration,
|
||||
type LineChartConfiguration,
|
||||
type PieChartConfiguration,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getManualSortOrderFromConfig', () => {
|
||||
describe('pie chart configuration', () => {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {
|
||||
} from 'twenty-ui/display';
|
||||
|
||||
import { getSortIconForFieldType } from '@/command-menu/pages/page-layout/utils/getSortIconForFieldType';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getSortIconForFieldType', () => {
|
||||
describe('position sort', () => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { getSortLabelSuffixForFieldType } from '@/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
describe('getSortLabelSuffixForFieldType', () => {
|
||||
it('returns alphabetical for TEXT field with FIELD_ASC', () => {
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ChartConfiguration';
|
||||
import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layout/types/ChartConfigurationSettingIds';
|
||||
import { isMinMaxRangeValid } from '@/command-menu/pages/page-layout/utils/isMinMaxRangeValid';
|
||||
import { BarChartLayout, WidgetConfigurationType } from '~/generated/graphql';
|
||||
import {
|
||||
BarChartLayout,
|
||||
WidgetConfigurationType,
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
describe('isMinMaxRangeValid', () => {
|
||||
const mockConfiguration = {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/ut
|
||||
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
|
||||
import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { BarChartGroupMode, GraphOrderBy } from '~/generated/graphql';
|
||||
import { BarChartGroupMode, GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
type BuildChartGroupByFieldConfigUpdateArgs<T extends ChartConfiguration> = {
|
||||
configuration: T;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { type PieChartConvertibleFields } from '@/command-menu/pages/page-layout
|
||||
import {
|
||||
type BarChartConfiguration,
|
||||
type LineChartConfiguration,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const convertBarOrLineChartConfigToPieChart = (
|
||||
configuration: BarChartConfiguration | LineChartConfiguration,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { type BarLineChartConvertibleFields } from '@/command-menu/pages/page-layout/types/BarLineChartConvertibleFields';
|
||||
import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType';
|
||||
import { type PieChartConfiguration } from '~/generated/graphql';
|
||||
import { type PieChartConfiguration } from '~/generated-metadata/graphql';
|
||||
|
||||
export const convertPieChartConfigToBarOrLineChart = (
|
||||
configuration: PieChartConfiguration,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import {
|
||||
isFieldMetadataSelectKind,
|
||||
} from 'twenty-shared/utils';
|
||||
import { type IconComponent } from 'twenty-ui/display';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export type SortOption = {
|
||||
value: GraphOrderBy;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import { SORT_BY_GROUP_BY_FIELD_SETTING } from '@/command-menu/pages/page-layout
|
||||
import { STACKED_BARS_SETTING } from '@/command-menu/pages/page-layout/constants/settings/StackedBarsSetting';
|
||||
import { type ChartSettingsGroup } from '@/command-menu/pages/page-layout/types/ChartSettingsGroup';
|
||||
import { IconAxisX, IconAxisY } from 'twenty-ui/display';
|
||||
import { BarChartLayout } from '~/generated/graphql';
|
||||
import { BarChartLayout } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getBarChartSettings = (
|
||||
layout: BarChartLayout,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
import { AxisNameDisplay } from '~/generated/graphql';
|
||||
import { AxisNameDisplay } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getChartAxisNameDisplayOptions = (option: AxisNameDisplay) => {
|
||||
switch (option) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getChartDefaultOrderByForFieldType = (
|
||||
fieldType: FieldMetadataType,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { PIE_CHART_MAXIMUM_NUMBER_OF_SLICES } from '@/page-layout/widgets/graph/
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
type GetChartLimitMessageParams = {
|
||||
widgetConfigurationType: WidgetConfigurationType;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType';
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
import { WidgetConfigurationType } from '~/generated/graphql';
|
||||
import { WidgetConfigurationType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getConfigurationTypeFromGraphType = (
|
||||
graphType: GraphType,
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/
|
||||
import { GraphType } from '@/command-menu/pages/page-layout/types/GraphType';
|
||||
import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { BarChartLayout } from '~/generated/graphql';
|
||||
import { BarChartLayout } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getCurrentGraphTypeFromConfig = (
|
||||
configuration: ChartConfiguration,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { type WidgetConfiguration } from '~/generated/graphql';
|
||||
import { type WidgetConfiguration } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getManualSortOrderFromConfig = (
|
||||
configuration: WidgetConfiguration,
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import {
|
||||
IconSortDescendingLetters,
|
||||
IconSortDescendingNumbers,
|
||||
} from 'twenty-ui/display';
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getSortIconForFieldType = ({
|
||||
fieldType,
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import {
|
||||
isFieldMetadataTextKind,
|
||||
} from 'twenty-shared/utils';
|
||||
|
||||
import { GraphOrderBy } from '~/generated/graphql';
|
||||
import { GraphOrderBy } from '~/generated-metadata/graphql';
|
||||
|
||||
export const getSortLabelSuffixForFieldType = ({
|
||||
fieldType,
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { type ChartWidget } from '@/command-menu/pages/page-layout/types/ChartWidget';
|
||||
import { isWidgetConfigurationOfTypeGraph } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfTypeGraph';
|
||||
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
||||
import { type WidgetConfiguration } from '~/generated/graphql';
|
||||
import { type WidgetConfiguration } from '~/generated-metadata/graphql';
|
||||
|
||||
export const isChartWidget = (
|
||||
pageLayoutWidget: PageLayoutWidget,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { type WidgetType } from '~/generated/graphql';
|
||||
import { type WidgetType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const isExistingWidgetMissingOrDifferentType = (
|
||||
existingWidgetType: WidgetType | undefined,
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import {
|
||||
type WorkflowConfiguration,
|
||||
type WorkflowRunConfiguration,
|
||||
type WorkflowVersionConfiguration,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
type WidgetConfigurationTypenameMap = {
|
||||
AggregateChartConfiguration: Omit<
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/
|
||||
import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType';
|
||||
import { type FieldConfiguration } from '@/page-layout/types/FieldConfiguration';
|
||||
import { type FieldsConfiguration } from '@/page-layout/types/FieldsConfiguration';
|
||||
import { type WidgetConfiguration } from '~/generated/graphql';
|
||||
import { type WidgetConfiguration } from '~/generated-metadata/graphql';
|
||||
|
||||
export const isWidgetConfigurationOfTypeGraph = (
|
||||
configuration:
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { IconFunction } from 'twenty-ui/display';
|
||||
import { MenuItem } from 'twenty-ui/navigation';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export type WorkflowActionSelection = {
|
||||
type: WorkflowActionType;
|
||||
|
||||
Reference in New Issue
Block a user