7258722754
## What Upgrades the NestJS GraphQL stack to clear the High **`ws`** alert (GHSA-3h5v-q93c-6h6q) and modernize off two heavily-patched majors. `@nestjs/graphql@13` pulls `ws@8.20.1` (was 8.16.0). This had to be a **coordinated** upgrade: `@ptc-org/nestjs-query@4.2.0` doesn't support `@nestjs/graphql@13`, so all three move together. | Package | From → To | |---|---| | `@nestjs/config` | 3.3.0 → ^4.0.4 | | `@nestjs/graphql` | 12.1.1 → ^13.4.2 | | `@ptc-org/nestjs-query-{core,graphql,typeorm}` | 4.x → ^9.4.0 | ## The tricky bits - **Re-ported the custom `@nestjs/graphql` patch onto v13.** v13 rewrote the schema builder and added its *own* native multi-schema support (`includeModules`, native `clear()`). Twenty's patch (`resolverSchemaScope` + `computeReachableTypes` — the core/metadata/admin split) is re-merged into v13's new `generate(options, includeModules, reachableTypes)` flow, with a link-preserving `storage.clear()` so cross-schema `resolveType` closures keep working. - **Re-ported the `@ptc-org` patch onto 9.4.0**: removes the `@shareable` federation directive from built-in connection/response types, **and** adds a `.js` extension to its extensionless deep import of `@nestjs/graphql` internals — which v13's new `"exports"` map otherwise rejects at runtime (this was the boot blocker). - **`AppTokenService`**: nestjs-query 9 requires custom services to inject their repo and `super(repo)` it (added an `@InjectRepository` constructor). - **`gridPosition` input fields**: dropped the `deprecationReason` (a *required* input field can't be `@deprecated` under the upgraded graphql) — fields keep their original nullability, so the **schema is unchanged**. - **Service specs**: nestjs-query 9's `TypeOrmQueryService` reads the repo's driver/metadata at construction, so the mocked repos now include `manager`/`metadata`. ## Verification - `nx typecheck twenty-server`: **0 errors**; lint clean - Server boots; **all 3 GraphQL schemas** (`/graphql`, `/metadata`, `/admin-panel`) generate and respond `200` - `graphql:generate` for all 3 schemas is **byte-identical** to before the upgrade (the reachable-types re-port is faithful) - **108 service unit tests pass** (incl. all 6 `TypeOrmQueryService` services) - `ws@8.16.0` gone (now 8.17.1 + 8.18.0); `yarn install --immutable` clean ## Note on lodash `lodash@4.17.21` still remains via `zapier-platform-core` (runtime) and `@stoplight/spectral`, so the lodash alert is **reduced but not fully cleared** by this PR — it needs those separate sources addressed (or a resolution).
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { Field, InputType } from '@nestjs/graphql';
|
|
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsEnum,
|
|
IsNotEmpty,
|
|
IsObject,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { GraphQLJSON } from 'graphql-type-json';
|
|
import { PageLayoutWidgetPosition } from 'twenty-shared/types';
|
|
|
|
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
import { GridPositionInput } from 'src/engine/metadata-modules/page-layout-widget/dtos/inputs/grid-position.input';
|
|
import { WidgetType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-type.enum';
|
|
import { AllPageLayoutWidgetConfiguration } from 'src/engine/metadata-modules/page-layout-widget/types/all-page-layout-widget-configuration.type';
|
|
|
|
@InputType()
|
|
export class CreatePageLayoutWidgetInput {
|
|
@Field(() => UUIDScalarType, { nullable: false })
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
pageLayoutTabId: string;
|
|
|
|
@Field({ nullable: false })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
title: string;
|
|
|
|
@Field(() => WidgetType, { nullable: false })
|
|
@IsEnum(WidgetType)
|
|
type: WidgetType;
|
|
|
|
@Field(() => UUIDScalarType, { nullable: true })
|
|
@IsUUID()
|
|
@IsOptional()
|
|
objectMetadataId?: string | null;
|
|
|
|
@Field(() => GridPositionInput, {
|
|
nullable: false,
|
|
})
|
|
@ValidateNested()
|
|
@Type(() => GridPositionInput)
|
|
gridPosition: GridPositionInput;
|
|
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
@IsObject()
|
|
@IsOptional()
|
|
position?: PageLayoutWidgetPosition;
|
|
|
|
@Field(() => GraphQLJSON, { nullable: false })
|
|
@IsObject()
|
|
@IsOptional()
|
|
configuration: AllPageLayoutWidgetConfiguration;
|
|
}
|