ce1ffa8550
## Refactor page layout widget types into shared package and expose from SDK ### Why Widget configuration types were defined only on the server, forcing SDK consumer apps to import from deep internal `twenty-shared/dist` paths — fragile and breaks on structural changes. Server DTOs also had no compile-time guarantee they matched the canonical types. ### What changed - **`twenty-shared`**: Migrated `ChartFilter`, `GridPosition`, `RatioAggregateConfig` and all 20 widget configuration variants into `twenty-shared/types`. `PageLayoutWidgetConfiguration` (base, with `SerializedRelation`) and `PageLayoutWidgetUniversalConfiguration` (derived via `FormatRecordSerializedRelationProperties`) are now the single source of truth. - **`twenty-sdk`**: Re-exported `AggregateOperations`, `ObjectRecordGroupByDateGranularity`, `PageLayoutTabLayoutMode`, and `PageLayoutWidgetUniversalConfiguration` so consumer apps import from `twenty-sdk` directly. - **`twenty-server`**: All widget DTOs now `implements` their shared type for compile-time enforcement. Added helpers to convert nested `fieldMetadataId` ↔ `fieldMetadataUniversalIdentifier` inside chart filters. Removed redundant local type re-exports.
32 lines
529 B
TypeScript
32 lines
529 B
TypeScript
import { Field, InputType } from '@nestjs/graphql';
|
|
|
|
import { IsInt, IsNotEmpty, Min } from 'class-validator';
|
|
import { type GridPosition } from 'twenty-shared/types';
|
|
|
|
@InputType('GridPositionInput')
|
|
export class GridPositionInput implements GridPosition {
|
|
@Field()
|
|
@IsInt()
|
|
@Min(0)
|
|
@IsNotEmpty()
|
|
row: number;
|
|
|
|
@Field()
|
|
@IsInt()
|
|
@Min(0)
|
|
@IsNotEmpty()
|
|
column: number;
|
|
|
|
@Field()
|
|
@IsInt()
|
|
@Min(1)
|
|
@IsNotEmpty()
|
|
rowSpan: number;
|
|
|
|
@Field()
|
|
@IsInt()
|
|
@Min(1)
|
|
@IsNotEmpty()
|
|
columnSpan: number;
|
|
}
|