Spaces:
Build error
Build error
twenty / packages /twenty-server /src /engine /metadata-modules /command-menu-item /entities /command-menu-item.entity.ts
| import { | |
| Check, | |
| Column, | |
| CreateDateColumn, | |
| Entity, | |
| Index, | |
| JoinColumn, | |
| ManyToOne, | |
| PrimaryGeneratedColumn, | |
| type Relation, | |
| UpdateDateColumn, | |
| } from 'typeorm'; | |
| import { type SerializedRelation } from 'twenty-shared/types'; | |
| import { WasIntroducedInUpgrade } from 'src/engine/core-modules/upgrade/decorators/was-introduced-in-upgrade.decorator'; | |
| import { type CommandMenuItemPayload } from 'src/engine/metadata-modules/command-menu-item/dtos/command-menu-item-payload.union'; | |
| import { ADD_IS_SYSTEM_SIDE_EFFECT_UPGRADE_COMMAND_NAME } from 'src/database/commands/upgrade-version-command/2-15/is-system-side-effect-upgrade-command-name.constant'; | |
| import { CommandMenuItemAvailabilityType } from 'src/engine/metadata-modules/command-menu-item/enums/command-menu-item-availability-type.enum'; | |
| import { EngineComponentKey } from 'src/engine/metadata-modules/command-menu-item/enums/engine-component-key.enum'; | |
| import { FrontComponentEntity } from 'src/engine/metadata-modules/front-component/entities/front-component.entity'; | |
| import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; | |
| import { PageLayoutEntity } from 'src/engine/metadata-modules/page-layout/entities/page-layout.entity'; | |
| import { OverridableEntity } from 'src/engine/workspace-manager/types/overridable-entity'; | |
| export type CommandMenuItemOverrides = { | |
| label?: string; | |
| icon?: string | null; | |
| shortLabel?: string | null; | |
| position?: number; | |
| isPinned?: boolean; | |
| hotKeys?: string[] | null; | |
| availabilityType?: CommandMenuItemAvailabilityType; | |
| availabilityObjectMetadataId?: SerializedRelation | null; | |
| engineComponentKey?: EngineComponentKey; | |
| pageLayoutId?: SerializedRelation | null; | |
| }; | |
| ({ name: 'commandMenuItem', schema: 'core' }) | |
| ('IDX_COMMAND_MENU_ITEM_WORKFLOW_VERSION_ID_WORKSPACE_ID', [ | |
| 'workflowVersionId', | |
| 'workspaceId', | |
| ]) | |
| ('IDX_COMMAND_MENU_ITEM_FRONT_COMPONENT_ID_WORKSPACE_ID', [ | |
| 'frontComponentId', | |
| 'workspaceId', | |
| ]) | |
| ('IDX_COMMAND_MENU_ITEM_AVAILABILITY_OBJECT_METADATA_ID', [ | |
| 'availabilityObjectMetadataId', | |
| ]) | |
| ('IDX_COMMAND_MENU_ITEM_PAGE_LAYOUT_ID_WORKSPACE_ID', [ | |
| 'pageLayoutId', | |
| 'workspaceId', | |
| ]) | |
| ( | |
| 'CHK_CMD_MENU_ITEM_ENGINE_KEY_COHERENCE', | |
| `("engineComponentKey" = 'TRIGGER_WORKFLOW_VERSION' AND "workflowVersionId" IS NOT NULL AND "frontComponentId" IS NULL AND "payload" IS NULL) OR ("engineComponentKey" = 'FRONT_COMPONENT_RENDERER' AND "frontComponentId" IS NOT NULL AND "workflowVersionId" IS NULL AND "payload" IS NULL) OR ("engineComponentKey" = 'NAVIGATION' AND "payload" IS NOT NULL AND "workflowVersionId" IS NULL AND "frontComponentId" IS NULL) OR ("engineComponentKey" NOT IN ('TRIGGER_WORKFLOW_VERSION', 'FRONT_COMPONENT_RENDERER', 'NAVIGATION') AND "workflowVersionId" IS NULL AND "frontComponentId" IS NULL AND "payload" IS NULL)`, | |
| ) | |
| export class CommandMenuItemEntity | |
| extends OverridableEntity<CommandMenuItemOverrides> | |
| implements Required<CommandMenuItemEntity> | |
| { | |
| ('uuid') | |
| id: string; | |
| ({ nullable: true, type: 'uuid' }) | |
| workflowVersionId: string | null; | |
| ({ nullable: true, type: 'uuid' }) | |
| frontComponentId: string | null; | |
| (() => FrontComponentEntity, { | |
| onDelete: 'CASCADE', | |
| nullable: true, | |
| }) | |
| ({ name: 'frontComponentId' }) | |
| frontComponent: Relation<FrontComponentEntity> | null; | |
| ({ type: 'varchar', nullable: false }) | |
| engineComponentKey: EngineComponentKey; | |
| ({ nullable: false }) | |
| label: string; | |
| ({ nullable: true, type: 'varchar' }) | |
| icon: string | null; | |
| ({ nullable: true, type: 'varchar' }) | |
| shortLabel: string | null; | |
| ({ nullable: false, type: 'double precision', default: 0 }) | |
| position: number; | |
| ({ default: false }) | |
| isPinned: boolean; | |
| ({ | |
| type: 'enum', | |
| enum: Object.values(CommandMenuItemAvailabilityType), | |
| nullable: false, | |
| default: CommandMenuItemAvailabilityType.GLOBAL, | |
| }) | |
| availabilityType: CommandMenuItemAvailabilityType; | |
| ({ type: 'jsonb', nullable: true }) | |
| payload: CommandMenuItemPayload | null; | |
| ({ type: 'text', array: true, nullable: true }) | |
| hotKeys: string[] | null; | |
| ({ nullable: true, type: 'varchar' }) | |
| conditionalAvailabilityExpression: string | null; | |
| ({ nullable: true, type: 'uuid' }) | |
| availabilityObjectMetadataId: string | null; | |
| (() => ObjectMetadataEntity, { | |
| onDelete: 'CASCADE', | |
| nullable: true, | |
| }) | |
| ({ name: 'availabilityObjectMetadataId' }) | |
| availabilityObjectMetadata: Relation<ObjectMetadataEntity> | null; | |
| ({ nullable: true, type: 'uuid' }) | |
| pageLayoutId: string | null; | |
| (() => PageLayoutEntity, { | |
| onDelete: 'CASCADE', | |
| nullable: true, | |
| }) | |
| ({ name: 'pageLayoutId' }) | |
| pageLayout: Relation<PageLayoutEntity> | null; | |
| ({ | |
| upgradeCommandName: ADD_IS_SYSTEM_SIDE_EFFECT_UPGRADE_COMMAND_NAME, | |
| }) | |
| ({ nullable: false, default: false, type: 'boolean' }) | |
| isSystemSideEffect: boolean; | |
| ({ type: 'timestamptz' }) | |
| createdAt: Date; | |
| ({ type: 'timestamptz' }) | |
| updatedAt: Date; | |
| } | |
| const COMMAND_MENU_ITEM_OVERRIDABLE_COLUMNS_UPGRADE_COMMAND_NAME = | |
| '2.13.0_CommandMenuItemOverridableEntityFastInstanceCommand_1781253016028'; | |
| WasIntroducedInUpgrade({ | |
| upgradeCommandName: | |
| COMMAND_MENU_ITEM_OVERRIDABLE_COLUMNS_UPGRADE_COMMAND_NAME, | |
| })(CommandMenuItemEntity.prototype, 'overrides'); | |
| WasIntroducedInUpgrade({ | |
| upgradeCommandName: | |
| COMMAND_MENU_ITEM_OVERRIDABLE_COLUMNS_UPGRADE_COMMAND_NAME, | |
| })(CommandMenuItemEntity.prototype, 'isActive'); | |