Strictly type encryption rotation key site maps constants through entity type derivation (#21085)

# Introduction
Followup https://github.com/twentyhq/twenty/pull/21001

Now that the typeorm entities provide grains over their
`encryptedString` value, we can strictly type the sitemaps of the
encrypted string to rotate in case of encryption key rotation and also
the integration tests tests cases
This commit is contained in:
Paul Rastoin
2026-06-01 17:25:58 +02:00
committed by GitHub
parent d86e827563
commit 989b45db15
21 changed files with 422 additions and 187 deletions
@@ -1,8 +1,12 @@
import { type ApplicationRegistrationEntity } from 'src/engine/core-modules/application/application-registration/application-registration.entity';
import { type ApplicationRegistrationVariableEntity } from 'src/engine/core-modules/application/application-registration-variable/application-registration-variable.entity';
import { type ApplicationVariableEntity } from 'src/engine/core-modules/application/application-variable/application-variable.entity';
import { type BillingMeterEntity } from 'src/engine/core-modules/billing/entities/billing-meter.entity';
import { type BillingPriceEntity } from 'src/engine/core-modules/billing/entities/billing-price.entity';
import { type BillingProductEntity } from 'src/engine/core-modules/billing/entities/billing-product.entity';
import { type BillingSubscriptionItemEntity } from 'src/engine/core-modules/billing/entities/billing-subscription-item.entity';
import { type SigningKeyEntity } from 'src/engine/core-modules/jwt/entities/signing-key.entity';
import { type KeyValuePairEntity } from 'src/engine/core-modules/key-value-pair/key-value-pair.entity';
import { type TwoFactorAuthenticationMethodEntity } from 'src/engine/core-modules/two-factor-authentication/entities/two-factor-authentication-method.entity';
import { type UserEntity } from 'src/engine/core-modules/user/user.entity';
import { type WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
@@ -31,11 +35,15 @@ export type AllNonWorkspaceRelatedEntity =
| AgentTurnEntity
| AgentTurnEvaluationEntity
| IndexFieldMetadataEntity
| ApplicationRegistrationEntity
| ApplicationRegistrationVariableEntity
| ApplicationVariableEntity
| BillingMeterEntity
| BillingPriceEntity
| BillingProductEntity
| BillingSubscriptionItemEntity
| KeyValuePairEntity
| SigningKeyEntity
| TwoFactorAuthenticationMethodEntity
| UserEntity
| WorkspaceEntity;
@@ -1,11 +1,9 @@
import { type Equal, type Expect } from 'twenty-shared/testing';
import { type EmptyObject } from 'twenty-shared/types';
import { type ExtractJsonbProperties } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/extract-jsonb-properties.type';
import { type JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
// oxlint-disable-next-line @typescripttypescript/no-empty-object-type
type EmptyObject = {};
type TestedRecord = {
// Non-JsonbProperty fields
plainString: string;
@@ -1,13 +1,11 @@
import { type Equal, type Expect } from 'twenty-shared/testing';
import { type EmptyObject } from 'twenty-shared/types';
import {
type JSONB_PROPERTY_BRAND,
type JsonbProperty,
} from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
// oxlint-disable-next-line @typescripttypescript/no-empty-object-type
type EmptyObject = {};
type SimpleObject = { value: string };
type NestedObject = { nested: { deep: number } };