From 88424611eca0afc18dcb36445191b97da8f7d717 Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Thu, 19 Feb 2026 11:13:50 +0100 Subject: [PATCH] Refactor and standardize `isSystem` field and object (#17992) # Introduction ## Centralize system field definitions - Extract a single `PARTIAL_SYSTEM_FLAT_FIELD_METADATAS` constant as the source of truth for all 8 system fields (`id`, `createdAt`, `updatedAt`, `deletedAt`, `createdBy`, `updatedBy`, `position`, `searchVector`), eliminating duplication across custom object and standard app field builders - Refactor `buildDefaultFlatFieldMetadatasForCustomObject` to use the shared constant via a new `buildObjectSystemFlatFieldMetadatas` helper ## Mark system fields as `isSystem: true` - Fields `id`, `createdAt`, `updatedAt`, `deletedAt`, `createdBy`, `updatedBy`, `position`, `searchVector` are now properly flagged as system fields across all standard objects and custom object creation - Standard app field builders for all ~30 standard objects updated to set `isSystem: true` on `createdAt`, `updatedAt`, `deletedAt`, `createdBy`, `updatedBy` - System-only standard objects (blocklist, calendar channels, message threads, etc.) now also include `createdBy`, `updatedBy`, `position`, `searchVector` field definitions that were previously missing ## Validate system fields on object creation - New transversal validation (`crossEntityTransversalValidation`) runs after all atomic entity validations in the build orchestrator, ensuring all 8 system fields are present with correct `type` and `isSystem: true` when an object is created - New `buildUniversalFlatObjectFieldByNameAndJoinColumnMaps` utility to resolve field names to universal identifiers for a given object - New exception codes: `MISSING_SYSTEM_FIELD` and `INVALID_SYSTEM_FIELD` on `ObjectMetadataExceptionCode` ## Protect system fields and objects from mutation - Field validators now block update/delete of `isSystem` fields by non-system callers (`FIELD_MUTATION_NOT_ALLOWED`) - Object validators now block update/delete of `isSystem` objects by non-system callers - `POSITION` and `TS_VECTOR` field type validators replaced: instead of rejecting creation outright, they now validate that the field is named correctly (`position` / `searchVector`) and has `isSystem: true` ## Distinguish `isSystemBuild` from `isCallerTwentyStandardApp` - New `isCallerTwentyStandardApp` utility checks whether the caller's `applicationUniversalIdentifier` matches the twenty standard app - Name-sync logic (`isFlatFieldMetadataNameSyncedWithLabel`, `areFlatObjectMetadataNamesSyncedWithLabels`) refactored to use `isCallerTwentyStandardApp` for custom suffix decisions, keeping `isSystemBuild` for mutation permission checks - `WorkspaceMigrationBuilderOptions` type updated to include `applicationUniversalIdentifier` ## Adapt frontend filtering - New `HIDDEN_SYSTEM_FIELD_NAMES` constant (`id`, `position`, `searchVector`) and `isHiddenSystemField` utility to only hide truly internal fields while keeping user-facing system fields (`createdAt`, `updatedAt`, `deletedAt`, `createdBy`, `updatedBy`) visible in the UI - ~20 frontend files updated to replace `!field.isSystem` checks with `!isHiddenSystemField(field)` across record index, settings, data model, charts, workflows, spreadsheet import, aggregations, and role permissions ## Add 1.19 upgrade commands - **`backfill-system-fields-is-system`**: Raw SQL command to set `isSystem = true` on existing workspace fields matching system field names, and fix `position` field type from `NUMBER` to `POSITION` for `favorite`/`favoriteFolder` objects. Includes proper cache invalidation. - **`add-missing-system-fields-to-standard-objects`**: Codegen'd workspace migration to create missing `position`, `searchVector`, `createdBy`, `updatedBy` fields on standard objects that didn't previously have them. Runs via `WorkspaceMigrationRunnerService` in a single transaction with idempotency check. **Known limitation**: assumes all standard objects exist and are valid in the target workspace. ## Add `universalIdentifier` for system fields in standard object constants - `standard-object.constant.ts` updated to include `universalIdentifier` for `createdBy`, `updatedBy`, `position`, and `searchVector` across all standard objects - `fieldManifestType.ts` updated to support the new field manifest shape ## System relation Completely removed and backfilled all `isSystem` relation to be false false As we won't require an object to have any relation system fields ## Add integration tests - New test suite `failing-sync-application-object-system-fields` covering: missing system fields, wrong field types (`id` as TEXT, `createdAt` as TEXT, `position` as TEXT), system field deletion attempts, and system field update attempts - New test utilities: `buildDefaultObjectManifest` (builds an object manifest with all 8 system fields) and `setupApplicationForSync` (centralizes application setup) - Existing successful sync test updated to verify system fields are created with correct properties ## Next step Make the builder scope the compared entity to be the currently built app + nor twenty standard app --- .../useRelatedRecordActions.test.tsx | 3 +- .../hooks/useRelatedRecordActions.ts | 3 +- ...onForAggregateOperationDropdownContent.tsx | 3 +- ...oupByFieldSelectionDropdownContentBase.tsx | 3 +- ...GroupByFieldSelectionRelationFieldView.tsx | 3 +- .../constants/HiddenSystemFieldNames.ts | 8 + ...olumnDefinitionsFromObjectMetadata.test.ts | 2 +- .../hooks/useAvailableFieldMetadataItems.ts | 3 +- .../useColumnDefinitionsFromObjectMetadata.ts | 10 +- .../filterSortableFieldMetadataItems.test.ts | 9 + .../isActiveFieldMetadataItem.test.ts | 12 +- .../utils/filterSortableFieldMetadataItems.ts | 5 +- .../filterUserFacingFieldMetadataItems.ts | 3 +- .../utils/getActiveFieldMetadataItems.ts | 3 +- .../getFilterFilterableFieldMetadataItems.ts | 4 +- .../utils/isActiveFieldMetadataItem.ts | 3 +- .../utils/isHiddenSystemField.ts | 6 + .../useFilterVisibleAndReadableRecordField.ts | 3 +- .../hooks/useLoadRecordIndexStates.ts | 3 +- ...ImportFilterAvailableFieldMetadataItems.ts | 4 +- ...etAvailableAggregationsFromObjectFields.ts | 3 +- .../utils/isFieldCellSupported.ts | 5 +- .../SettingsDataModelOverviewObject.tsx | 3 +- .../components/SettingsObjectItemTableRow.tsx | 7 +- .../SettingsObjectRelationsTable.tsx | 3 +- .../components/tabs/ObjectFields.tsx | 3 +- ...ionsObjectLevelSeeFieldsValueForObject.tsx | 3 +- .../WorkflowFormFieldSettingsSelect.tsx | 3 +- .../__tests__/shouldDisplayFormField.test.ts | 15 +- .../utils/shouldDisplayFormField.ts | 7 +- .../SettingsApplicationDetailContentTab.tsx | 3 +- .../data-model/SettingsObjectFieldTable.tsx | 3 +- .../data-model/SettingsObjectTable.tsx | 3 +- ...stem-fields-to-standard-objects.command.ts | 89 + ...sage-association-message-folder.command.ts | 5 +- ...ackfill-system-fields-is-system.command.ts | 176 ++ .../1-19-upgrade-version-command.module.ts | 20 +- .../upgrade.command.ts | 6 + ...ssing-system-fields-to-standard-objects.ts | 2581 +++++++++++++++++ .../application-manifest-migration.service.ts | 6 +- .../services/application-sync.service.ts | 2 +- ...t-to-universal-flat-field-metadata.util.ts | 3 +- ...fier-in-universal-flat-entity-maps.util.ts | 27 + ...relation-properties-to-compare.constant.ts | 2 +- ...t-field-metadata-type-validator.service.ts | 14 +- ...-field-names-and-join-column-names.util.ts | 4 +- ...ld-metadata-name-synced-with-label.util.ts | 8 +- ...t-field-metadata-name-availability.util.ts | 7 +- .../validate-flat-field-metadata-name.util.ts | 3 +- ...idate-position-flat-field-metadata.util.ts | 32 + ...date-ts-vector-flat-field-metadata.util.ts | 32 + ...-metadata-names-synced-with-labels.util.ts | 8 +- ...and-flat-field-metadatas-to-create.util.ts | 2 +- ...at-object-metadata-name-and-labels.util.ts | 2 +- ...object-metadata-system-fields-integrity.ts | 123 + .../utils/reject-widget-type.util.ts | 4 +- .../navigation-menu-item-deletion.service.ts | 2 +- ...al-system-flat-field-metadatas.constant.ts | 243 ++ .../object-metadata.exception.ts | 6 + .../object-metadata.service.ts | 28 - ...-field-metadatas-for-custom-object.util.ts | 387 +-- ...ld-default-index-for-custom-object.util.ts | 2 +- ...-field-metadatas-for-custom-object.util.ts | 2 +- ...data-graphql-api-exception-handler.util.ts | 3 + .../is-caller-twenty-standard-app.util.ts | 8 + .../dev-seeder-permissions.service.ts | 8 +- .../dev-seeder/services/dev-seeder.service.ts | 1 + .../twenty-standard-application.service.ts | 4 +- ...adata-related-entity-ids.util.spec.ts.snap | 2034 +++++++------ ...hment-standard-flat-field-metadata.util.ts | 48 + ...klist-standard-flat-field-metadata.util.ts | 92 + ...ation-standard-flat-field-metadata.util.ts | 92 + ...annel-standard-flat-field-metadata.util.ts | 92 + ...ipant-standard-flat-field-metadata.util.ts | 92 + ...event-standard-flat-field-metadata.util.ts | 92 + ...mpany-standard-flat-field-metadata.util.ts | 8 +- ...count-standard-flat-field-metadata.util.ts | 92 + ...board-standard-flat-field-metadata.util.ts | 8 +- ...older-standard-flat-field-metadata.util.ts | 78 +- ...orite-standard-flat-field-metadata.util.ts | 70 +- ...older-standard-flat-field-metadata.util.ts | 93 + ...ation-standard-flat-field-metadata.util.ts | 92 + ...annel-standard-flat-field-metadata.util.ts | 96 +- ...older-standard-flat-field-metadata.util.ts | 92 + ...ipant-standard-flat-field-metadata.util.ts | 92 + ...ssage-standard-flat-field-metadata.util.ts | 92 + ...hread-standard-flat-field-metadata.util.ts | 84 + ...-note-standard-flat-field-metadata.util.ts | 9 +- ...arget-standard-flat-field-metadata.util.ts | 84 + ...unity-standard-flat-field-metadata.util.ts | 8 +- ...erson-standard-flat-field-metadata.util.ts | 10 +- ...-task-standard-flat-field-metadata.util.ts | 9 +- ...arget-standard-flat-field-metadata.util.ts | 84 + ...ivity-standard-flat-field-metadata.util.ts | 95 +- ...igger-standard-flat-field-metadata.util.ts | 85 + ...w-run-standard-flat-field-metadata.util.ts | 7 +- ...kflow-standard-flat-field-metadata.util.ts | 9 +- ...rsion-standard-flat-field-metadata.util.ts | 51 +- ...ember-standard-flat-field-metadata.util.ts | 56 +- ...ndard-relation-field-flat-metadata.util.ts | 4 +- ...ce-migration-build-orchestrator.service.ts | 12 +- ...igration-validate-build-and-run-service.ts | 2 +- .../workspace-migration-orchestrator.type.ts | 1 - ...ted-updated-matrix-dispatcher.util.spec.ts | 5 + .../compare-two-universal-flat-entity.util.ts | 1 + ...iversal-flat-entity-for-comparison.util.ts | 14 + ...ross-entity-transversal-validation.util.ts | 21 + ...orkspace-migration-builder-options.type.ts | 1 + ...field-by-name-and-join-column-maps.util.ts | 40 + .../services/flat-agent-validator.service.ts | 5 +- .../flat-field-metadata-validator.service.ts | 77 +- .../flat-object-metadata-validator.service.ts | 19 +- .../services/flat-skill-validator.service.ts | 5 +- .../attachment.workspace-entity.ts | 9 +- .../blocklist.workspace-entity.ts | 9 + ...nnel-event-association.workspace-entity.ts | 8 + .../calendar-channel.workspace-entity.ts | 9 + ...ndar-event-participant.workspace-entity.ts | 8 + .../calendar-event.workspace-entity.ts | 9 +- .../connected-account.workspace-entity.ts | 12 +- .../favorite-folder.workspace-entity.ts | 9 + ...ciation-message-folder.workspace-entity.ts | 4 + ...el-message-association.workspace-entity.ts | 8 + .../message-channel.workspace-entity.ts | 9 + .../message-folder.workspace-entity.ts | 9 + .../message-participant.workspace-entity.ts | 11 +- .../message.workspace-entity.ts | 9 + .../timeline-activity.workspace-entity.ts | 9 + ...ect-system-fields.integration-spec.ts.snap | 391 +++ ...rkspace-migration.integration-spec.ts.snap | 216 ++ ...n-object-system-fields.integration-spec.ts | 310 ++ ...on-workspace-migration.integration-spec.ts | 63 +- .../build-default-object-manifest.util.ts | 85 + .../utils/setup-application-for-sync.util.ts | 42 + ...ne-field-metadata.integration-spec.ts.snap | 12 +- ...bject-metadata-v2.integration-spec.ts.snap | 1258 ++++---- .../src/metadata/standard-object.constant.ts | 240 ++ 137 files changed, 8850 insertions(+), 2056 deletions(-) create mode 100644 packages/twenty-front/src/modules/object-metadata/constants/HiddenSystemFieldNames.ts create mode 100644 packages/twenty-front/src/modules/object-metadata/utils/isHiddenSystemField.ts create mode 100644 packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command.ts create mode 100644 packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command.ts create mode 100644 packages/twenty-server/src/database/commands/upgrade-version-command/workspace-migrations/1771420702241-add-missing-system-fields-to-standard-objects.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-ts-vector-flat-field-metadata.util.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant.ts create mode 100644 packages/twenty-server/src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util.ts create mode 100644 packages/twenty-server/src/engine/workspace-manager/workspace-migration/utils/cross-entity-transversal-validation.util.ts create mode 100644 packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/utils/build-universal-flat-object-field-by-name-and-join-column-maps.util.ts create mode 100644 packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/failing-sync-application-object-system-fields.integration-spec.ts.snap create mode 100644 packages/twenty-server/test/integration/metadata/suites/application/failing-sync-application-object-system-fields.integration-spec.ts create mode 100644 packages/twenty-server/test/integration/metadata/suites/application/utils/build-default-object-manifest.util.ts create mode 100644 packages/twenty-server/test/integration/metadata/suites/application/utils/setup-application-for-sync.util.ts diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/__tests__/useRelatedRecordActions.test.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/__tests__/useRelatedRecordActions.test.tsx index 4d5ce84dfd..ca6a277fd7 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/__tests__/useRelatedRecordActions.test.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/__tests__/useRelatedRecordActions.test.tsx @@ -218,10 +218,11 @@ describe('useRelatedRecordActions', () => { expect(result.current['create-related-company'].position).toBe(19); }); - it('should filter out system fields', () => { + it('should filter out hidden system fields', () => { const fields = [ { type: 'RELATION', + name: 'position', relation: { type: 'ONE_TO_MANY', targetObjectMetadata: { diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/useRelatedRecordActions.ts b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/useRelatedRecordActions.ts index 03454c1768..eb4b2ce00d 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/useRelatedRecordActions.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/hooks/useRelatedRecordActions.ts @@ -6,6 +6,7 @@ import { ActionViewType } from '@/action-menu/actions/types/ActionViewType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isRecordReadOnly } from '@/object-record/read-only/utils/isRecordReadOnly'; import { msg } from '@lingui/core/macro'; import React from 'react'; @@ -35,7 +36,7 @@ export const useRelatedRecordActions = ({ (field) => field.type === 'RELATION' && field.relation?.type === 'ONE_TO_MANY' && - !field.isSystem, + !isHiddenSystemField(field), ); let currentPosition = startPosition; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx index 1abd6564c6..c10ae40712 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx @@ -3,6 +3,7 @@ import { usePageLayoutIdFromContextStoreTargetedRecord } from '@/command-menu/pa import { useWidgetInEditMode } from '@/command-menu/pages/page-layout/hooks/useWidgetInEditMode'; import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; @@ -69,7 +70,7 @@ export const ChartFieldSelectionForAggregateOperationDropdownContent = () => { searchQuery, getSearchableValues: (item) => [item.label, item.name], // TODO: remove the relation filter once group by is supported for relation fields - }).filter((field) => !isFieldRelation(field) && !field.isSystem); + }).filter((field) => !isFieldRelation(field) && !isHiddenSystemField(field)); const { getIcon } = useIcons(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx index 29a838eea3..7bf79444ad 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx @@ -7,6 +7,7 @@ import { type ChartConfiguration } from '@/command-menu/pages/page-layout/types/ import { buildChartGroupByFieldConfigUpdate } from '@/command-menu/pages/page-layout/utils/buildChartGroupByFieldConfigUpdate'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; @@ -83,7 +84,7 @@ export const ChartGroupByFieldSelectionDropdownContentBase = < searchQuery, getSearchableValues: (item) => [item.label, item.name], }).filter((field) => { - if (field.isSystem === true) { + if (isHiddenSystemField(field)) { return false; } if (isFieldRelation(field)) { diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx index 78d3290a28..584c4d2e1e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx @@ -1,6 +1,7 @@ import { ChartGroupByFieldSelectionCompositeFieldView } from '@/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; @@ -70,7 +71,7 @@ export const ChartGroupByFieldSelectionRelationFieldView = ({ return filterBySearchQuery({ items: targetObjectMetadataItem.fields.filter( - (field) => !field.isSystem && !isFieldRelation(field), + (field) => !isHiddenSystemField(field) && !isFieldRelation(field), ), searchQuery, getSearchableValues: (field) => [field.label, field.name], diff --git a/packages/twenty-front/src/modules/object-metadata/constants/HiddenSystemFieldNames.ts b/packages/twenty-front/src/modules/object-metadata/constants/HiddenSystemFieldNames.ts new file mode 100644 index 0000000000..de4fc93f46 --- /dev/null +++ b/packages/twenty-front/src/modules/object-metadata/constants/HiddenSystemFieldNames.ts @@ -0,0 +1,8 @@ +// System fields that should be hidden from the UI by default. +// Other system fields (createdAt, updatedAt, deletedAt, createdBy, updatedBy) +// are isSystem: true but remain user-visible. +export const HIDDEN_SYSTEM_FIELD_NAMES = new Set([ + 'id', + 'searchVector', + 'position', +]); diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts index 87dc30a2a1..d9406a8572 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromObjectMetadata.test.ts @@ -86,6 +86,6 @@ describe('useColumnDefinitionsFromObjectMetadata', () => { const { columnDefinitions } = result.current; - expect(columnDefinitions.length).toBe(21); + expect(columnDefinitions.length).toBe(22); }); }); diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useAvailableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useAvailableFieldMetadataItems.ts index a8b88949c0..fd23ad354b 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useAvailableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useAvailableFieldMetadataItems.ts @@ -1,4 +1,5 @@ import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { TABLE_COLUMNS_DENY_LIST } from '@/object-record/constants/TableColumnsDenyList'; import { useMemo } from 'react'; @@ -16,7 +17,7 @@ export const useAvailableFieldMetadataItems = ({ objectMetadataItem.readableFields.filter((fieldMetadataItemToFilter) => { return ( fieldMetadataItemToFilter.isActive && - !fieldMetadataItemToFilter.isSystem && + !isHiddenSystemField(fieldMetadataItemToFilter) && !TABLE_COLUMNS_DENY_LIST.includes(fieldMetadataItemToFilter.name) ); }), diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts index 684251fc04..b329559731 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts @@ -1,4 +1,5 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition'; import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailableTableColumns'; @@ -12,10 +13,11 @@ export const useColumnDefinitionsFromObjectMetadata = ( objectMetadataItem: ObjectMetadataItem, ) => { const activeFieldMetadataItems = objectMetadataItem.readableFields.filter( - ({ id, isActive, isSystem }) => - isActive && - // Allow label identifier field (e.g. id for junction tables) even if it's a system field - (!isSystem || id === objectMetadataItem.labelIdentifierFieldMetadataId), + (field) => + field.isActive && + // Allow label identifier field (e.g. id for junction tables) even if it's a hidden system field + (!isHiddenSystemField(field) || + field.id === objectMetadataItem.labelIdentifierFieldMetadataId), ); const filterableFieldMetadataItems = useRecoilValue( diff --git a/packages/twenty-front/src/modules/object-metadata/utils/__tests__/filterSortableFieldMetadataItems.test.ts b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/filterSortableFieldMetadataItems.test.ts index 563d5b5436..4e8686db66 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/__tests__/filterSortableFieldMetadataItems.test.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/filterSortableFieldMetadataItems.test.ts @@ -7,6 +7,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.TEXT, isSystem: false, isActive: true, + name: 'text', }; expect(filterSortableFieldMetadataItems(field)).toBe(true); @@ -17,6 +18,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.NUMBER, isSystem: false, isActive: true, + name: 'number', }; expect(filterSortableFieldMetadataItems(field)).toBe(true); @@ -27,6 +29,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.DATE_TIME, isSystem: false, isActive: true, + name: 'dateTime', }; expect(filterSortableFieldMetadataItems(field)).toBe(true); @@ -37,6 +40,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.RELATION, isSystem: false, isActive: true, + name: 'relation', relation: { type: RelationType.MANY_TO_ONE, }, @@ -50,6 +54,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.RELATION, isSystem: false, isActive: true, + name: 'relation', relation: { type: RelationType.ONE_TO_MANY, }, @@ -63,6 +68,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.RELATION, isSystem: false, isActive: true, + name: 'relation', }; expect(filterSortableFieldMetadataItems(field)).toBe(false); @@ -73,6 +79,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.TEXT, isSystem: true, isActive: true, + name: 'id', }; expect(filterSortableFieldMetadataItems(field)).toBe(false); @@ -83,6 +90,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.TEXT, isSystem: false, isActive: false, + name: 'text', }; expect(filterSortableFieldMetadataItems(field)).toBe(false); @@ -93,6 +101,7 @@ describe('filterSortableFieldMetadataItems', () => { type: FieldMetadataType.RICH_TEXT, isSystem: false, isActive: true, + name: 'richText', }; expect(filterSortableFieldMetadataItems(field)).toBe(false); diff --git a/packages/twenty-front/src/modules/object-metadata/utils/__tests__/isActiveFieldMetadataItem.test.ts b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/isActiveFieldMetadataItem.test.ts index 824d60e8f8..db6e1c4202 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/__tests__/isActiveFieldMetadataItem.test.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/isActiveFieldMetadataItem.test.ts @@ -17,12 +17,20 @@ describe('isActiveFieldMetadataItem', () => { expect(res).toBe(true); }); - it('should return false for system fields', () => { + it('should return false for hidden system fields', () => { + const res = isActiveFieldMetadataItem({ + fieldMetadata: { isActive: true, isSystem: true, name: 'position' }, + objectNameSingular: 'objectNameSingular', + }); + expect(res).toBe(false); + }); + + it('should return false for non hidden system fields', () => { const res = isActiveFieldMetadataItem({ fieldMetadata: { isActive: true, isSystem: true, name: 'fieldName' }, objectNameSingular: 'objectNameSingular', }); - expect(res).toBe(false); + expect(res).toBe(true); }); it('should return true for note targets', () => { diff --git a/packages/twenty-front/src/modules/object-metadata/utils/filterSortableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/utils/filterSortableFieldMetadataItems.ts index 8561382326..1db89c508e 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/filterSortableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/filterSortableFieldMetadataItems.ts @@ -1,15 +1,16 @@ import { SORTABLE_FIELD_METADATA_TYPES } from '@/object-metadata/constants/SortableFieldMetadataTypes'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql'; type SortableFieldInput = { isSystem?: boolean | null; isActive?: boolean | null; + name: string; type: FieldMetadataType; relation?: { type: RelationType } | null; }; export const filterSortableFieldMetadataItems = (field: SortableFieldInput) => { - const isSystemField = field.isSystem; const isFieldActive = field.isActive; const isFieldTypeSortable = SORTABLE_FIELD_METADATA_TYPES.includes( @@ -21,7 +22,7 @@ export const filterSortableFieldMetadataItems = (field: SortableFieldInput) => { field.relation?.type === RelationType.MANY_TO_ONE; return ( - !isSystemField && + !isHiddenSystemField(field) && isFieldActive && (isFieldTypeSortable || isRelationFieldSortable) ); diff --git a/packages/twenty-front/src/modules/object-metadata/utils/filterUserFacingFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/utils/filterUserFacingFieldMetadataItems.ts index 6561453f6e..477e385fde 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/filterUserFacingFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/filterUserFacingFieldMetadataItems.ts @@ -1,7 +1,8 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; export const filterUserFacingFieldMetadataItems = ( field: FieldMetadataItem, ) => { - return !field.isSystem; + return !isHiddenSystemField(field); }; diff --git a/packages/twenty-front/src/modules/object-metadata/utils/getActiveFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/utils/getActiveFieldMetadataItems.ts index b84ba8c7ab..49ca01ebc6 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/getActiveFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/getActiveFieldMetadataItems.ts @@ -1,9 +1,10 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; export const getActiveFieldMetadataItems = ( objectMetadataItem: Pick, ) => objectMetadataItem.readableFields.filter( (fieldMetadataItem) => - fieldMetadataItem.isActive && !fieldMetadataItem.isSystem, + fieldMetadataItem.isActive && !isHiddenSystemField(fieldMetadataItem), ); diff --git a/packages/twenty-front/src/modules/object-metadata/utils/getFilterFilterableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/utils/getFilterFilterableFieldMetadataItems.ts index f75e5cb933..00d998bbb3 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/getFilterFilterableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/getFilterFilterableFieldMetadataItems.ts @@ -1,4 +1,5 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql'; export const getFilterFilterableFieldMetadataItems = ({ @@ -7,7 +8,6 @@ export const getFilterFilterableFieldMetadataItems = ({ isJsonFilterEnabled: boolean; }) => { return (field: FieldMetadataItem) => { - const isSystemField = field.isSystem; const isFieldActive = field.isActive; const isIdField = field.name === 'id'; @@ -44,7 +44,7 @@ export const getFilterFilterableFieldMetadataItems = ({ ].includes(field.type); const isFieldFilterable = - (!isSystemField || isIdField || isWorkflowRelationField) && + (!isHiddenSystemField(field) || isIdField || isWorkflowRelationField) && isFieldActive && isRelationFieldHandled && isFieldTypeFilterable; diff --git a/packages/twenty-front/src/modules/object-metadata/utils/isActiveFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/utils/isActiveFieldMetadataItem.ts index eb18c862f3..e7fa2de150 100644 --- a/packages/twenty-front/src/modules/object-metadata/utils/isActiveFieldMetadataItem.ts +++ b/packages/twenty-front/src/modules/object-metadata/utils/isActiveFieldMetadataItem.ts @@ -1,5 +1,6 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; type IsFieldMetadataAvailableForViewFieldArgs = { objectNameSingular: string; @@ -23,7 +24,7 @@ export const isActiveFieldMetadataItem = ({ return true; } - if (fieldMetadata.isSystem === true) { + if (isHiddenSystemField(fieldMetadata)) { return false; } diff --git a/packages/twenty-front/src/modules/object-metadata/utils/isHiddenSystemField.ts b/packages/twenty-front/src/modules/object-metadata/utils/isHiddenSystemField.ts new file mode 100644 index 0000000000..82cd62d3a4 --- /dev/null +++ b/packages/twenty-front/src/modules/object-metadata/utils/isHiddenSystemField.ts @@ -0,0 +1,6 @@ +import { HIDDEN_SYSTEM_FIELD_NAMES } from '@/object-metadata/constants/HiddenSystemFieldNames'; + +export const isHiddenSystemField = (field: { + isSystem?: boolean | null; + name: string; +}) => field.isSystem === true && HIDDEN_SYSTEM_FIELD_NAMES.has(field.name); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts index 0bccb3b9a4..6096fbe9cc 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts @@ -1,4 +1,5 @@ import { flattenedReadableFieldMetadataItemsSelector } from '@/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { useRecoilValue } from 'recoil'; @@ -17,7 +18,7 @@ export const useFilterVisibleAndReadableRecordField = () => { fieldMetadataItemToFilter.id === recordFieldToFilter.fieldMetadataItemId && fieldMetadataItemToFilter.isActive === true && - fieldMetadataItemToFilter.isSystem !== true, + !isHiddenSystemField(fieldMetadataItemToFilter), ) ); }; diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts index d5b71f14b9..a8717f4b39 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts @@ -4,6 +4,7 @@ import { availableFieldMetadataItemsForFilterFamilySelector } from '@/object-met import { availableFieldMetadataItemsForSortFamilySelector } from '@/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { useSetRecordGroups } from '@/object-record/record-group/hooks/useSetRecordGroups'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; @@ -69,7 +70,7 @@ export const useLoadRecordIndexStates = () => { ({ set, snapshot }) => (viewFields: ViewField[], objectMetadataItem: ObjectMetadataItem) => { const activeFieldMetadataItems = objectMetadataItem.fields.filter( - ({ isActive, isSystem }) => isActive && !isSystem, + (field) => field.isActive && !isHiddenSystemField(field), ); const filterableFieldMetadataItems = snapshot diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportFilterAvailableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportFilterAvailableFieldMetadataItems.ts index d83e4af5dc..a767276c60 100644 --- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportFilterAvailableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/utils/spreadsheetImportFilterAvailableFieldMetadataItems.ts @@ -1,4 +1,5 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { FieldMetadataType } from 'twenty-shared/types'; import { RelationType } from '~/generated-metadata/graphql'; @@ -9,7 +10,8 @@ export const spreadsheetImportFilterAvailableFieldMetadataItems = ( .filter( (fieldMetadataItem) => fieldMetadataItem.isActive && - (!fieldMetadataItem.isSystem || fieldMetadataItem.name === 'id') && + (!isHiddenSystemField(fieldMetadataItem) || + fieldMetadataItem.name === 'id') && fieldMetadataItem.name !== 'deletedAt' && (![ FieldMetadataType.RELATION, diff --git a/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts b/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts index 2f016c5044..bb6ef8dd20 100644 --- a/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts +++ b/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts @@ -1,4 +1,5 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; @@ -19,7 +20,7 @@ export const getAvailableAggregationsFromObjectFields = ( ): Aggregations => { return fields.reduce>( (acc, field) => { - if (field.isSystem === true) { + if (isHiddenSystemField(field)) { return acc; } diff --git a/packages/twenty-front/src/modules/object-record/utils/isFieldCellSupported.ts b/packages/twenty-front/src/modules/object-record/utils/isFieldCellSupported.ts index e6996be403..9246dcbabe 100644 --- a/packages/twenty-front/src/modules/object-record/utils/isFieldCellSupported.ts +++ b/packages/twenty-front/src/modules/object-record/utils/isFieldCellSupported.ts @@ -1,6 +1,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isObjectMetadataAvailableForRelation } from '@/object-metadata/utils/isObjectMetadataAvailableForRelation'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -52,5 +53,7 @@ export const isFieldCellSupported = ( } } - return !fieldMetadataItem.isSystem && !!fieldMetadataItem.isActive; + return ( + !isHiddenSystemField(fieldMetadataItem) && !!fieldMetadataItem.isActive + ); }; diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx index 6886f65ff7..26f122f0b8 100644 --- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewObject.tsx @@ -4,6 +4,7 @@ import { type Node, type NodeProps } from '@xyflow/react'; import { Link } from 'react-router-dom'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { ObjectFieldRow } from '@/settings/data-model/graph-overview/components/SettingsDataModelOverviewField'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -110,7 +111,7 @@ export const SettingsDataModelOverviewObject = ({ }); const fields = objectMetadataItem.fields.filter( - (x) => !x.isSystem && x.isActive, + (x) => !isHiddenSystemField(x) && x.isActive, ); const countNonRelation = fields.filter( diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx index 59d7c41d97..c2bc2bbb9c 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectItemTableRow.tsx @@ -4,6 +4,7 @@ import { useLingui } from '@lingui/react/macro'; import { type ReactNode } from 'react'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { SettingsItemTypeTag } from '@/settings/components/SettingsItemTypeTag'; import { StyledActionTableCell, @@ -84,7 +85,11 @@ export const SettingsObjectMetadataItemTableRow = ({ - {objectMetadataItem.fields.filter((field) => !field.isSystem).length} + { + objectMetadataItem.fields.filter( + (field) => !isHiddenSystemField(field), + ).length + } {totalObjectCount} {action} diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx index a2ed2f915c..dc0b4a421f 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx @@ -1,5 +1,6 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; @@ -89,7 +90,7 @@ export const SettingsObjectRelationsTable = ({ const relationFields = useMemo(() => { return objectMetadataItem.fields.filter( (field) => - (showSystemRelations || !field.isSystem) && + (showSystemRelations || !isHiddenSystemField(field)) && (field.type === FieldMetadataType.RELATION || field.type === FieldMetadataType.MORPH_RELATION), ); diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectFields.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectFields.tsx index aec0ef2a0e..f7bae6224a 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectFields.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectFields.tsx @@ -1,4 +1,5 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly'; import { SettingsObjectRelationsTable } from '@/settings/data-model/object-details/components/SettingsObjectRelationsTable'; import styled from '@emotion/styled'; @@ -31,7 +32,7 @@ export const ObjectFields = ({ objectMetadataItem }: ObjectFieldsProps) => { const hasRelations = objectMetadataItem.fields.some( (field) => - !field.isSystem && + !isHiddenSystemField(field) && (field.type === FieldMetadataType.RELATION || field.type === FieldMetadataType.MORPH_RELATION), ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx index 509b183112..0b4d7a4c1a 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx @@ -1,4 +1,5 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { useObjectPermissionDerivedStates } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useObjectPermissionDerivedStates'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { useLingui } from '@lingui/react/macro'; @@ -22,7 +23,7 @@ export const SettingsRolePermissionsObjectLevelSeeFieldsValueForObject = ({ const objectMetadataItemId = objectMetadataItem.id; const restrictableFieldMetadataItems = objectMetadataItem.fields.filter( - (fieldMetadataItem) => !fieldMetadataItem.isSystem, + (fieldMetadataItem) => !isHiddenSystemField(fieldMetadataItem), ); const numberOfRestrictableFieldMetadataItemsOnRead = diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx index b658199670..c5b1fd1e75 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowFormFieldSettingsSelect.tsx @@ -1,4 +1,5 @@ import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { FormFieldInputContainer } from '@/object-record/record-field/ui/form-types/components/FormFieldInputContainer'; import { FormSelectFieldInput } from '@/object-record/record-field/ui/form-types/components/FormSelectFieldInput'; import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput'; @@ -50,7 +51,7 @@ export const WorkflowFormFieldSettingsSelect = ({ .filter( (field) => field.isActive && - !field.isSystem && + !isHiddenSystemField(field) && field.type === FieldMetadataType.SELECT, ) .map((field) => ({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/__tests__/shouldDisplayFormField.test.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/__tests__/shouldDisplayFormField.test.ts index 1a8bf4ce6d..98a13a32c6 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/__tests__/shouldDisplayFormField.test.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/__tests__/shouldDisplayFormField.test.ts @@ -1,5 +1,5 @@ -import { shouldDisplayFormField } from '@/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { shouldDisplayFormField } from '@/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField'; import { FieldMetadataType } from 'twenty-shared/types'; const baseField = { @@ -80,8 +80,8 @@ describe('shouldDisplayFormField', () => { expect(result).toBe(true); }); - it('returns false for system field', () => { - const field = { ...baseField, isSystem: true }; + it('returns false for hidden system field', () => { + const field = { ...baseField, isSystem: true, name: 'position' }; const result = shouldDisplayFormField({ fieldMetadataItem: field, actionType: 'UPDATE_RECORD', @@ -89,6 +89,15 @@ describe('shouldDisplayFormField', () => { expect(result).toBe(false); }); + it('returns true for non hidden system field', () => { + const field = { ...baseField, isSystem: true }; + const result = shouldDisplayFormField({ + fieldMetadataItem: field, + actionType: 'UPDATE_RECORD', + }); + expect(result).toBe(true); + }); + it('throws error on unsupported action', () => { expect(() => shouldDisplayFormField({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField.ts index 4afc7397e7..605bb1aaca 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/utils/shouldDisplayFormField.ts @@ -1,4 +1,5 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { type WorkflowActionType } from '@/workflow/types/Workflow'; import { CustomError } from 'twenty-shared/utils'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -46,21 +47,21 @@ export const shouldDisplayFormField = ({ return ( !isNotSupportedRelation && !fieldMetadataItem.isUIReadOnly && - !fieldMetadataItem.isSystem && + !isHiddenSystemField(fieldMetadataItem) && fieldMetadataItem.isActive ); case 'UPSERT_RECORD': return ( (!isNotSupportedRelation && !fieldMetadataItem.isUIReadOnly && - !fieldMetadataItem.isSystem && + !isHiddenSystemField(fieldMetadataItem) && fieldMetadataItem.isActive) || isIdField ); case 'FIND_RECORDS': return ( !isNotSupportedRelation && - (!fieldMetadataItem.isSystem || isIdField) && + (!isHiddenSystemField(fieldMetadataItem) || isIdField) && fieldMetadataItem.isActive ); default: diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx index bbec419b3e..038b865cb3 100644 --- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx +++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx @@ -1,4 +1,5 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { SettingsLogicFunctionsTable } from '@/settings/logic-functions/components/SettingsLogicFunctionsTable'; import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; @@ -40,7 +41,7 @@ export const SettingsApplicationDetailContentTab = ({ ) .map((objectMetadataItem) => { const nonSystemFields = objectMetadataItem.fields.filter( - (field) => !field.isSystem, + (field) => !isHiddenSystemField(field), ); const fields: ApplicationDataTableFieldItem[] = nonSystemFields.map( diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx index b30ef05ffd..5f3bde0fee 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx @@ -1,4 +1,5 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { SettingsObjectFieldItemTableRow, StyledObjectFieldTableRow, @@ -110,7 +111,7 @@ export const SettingsObjectFieldTable = ({ const filteredBySystem = showSystemFields ? settingsObjectFields : settingsObjectFields?.filter( - (fieldMetadataItem) => !fieldMetadataItem.isSystem, + (fieldMetadataItem) => !isHiddenSystemField(fieldMetadataItem), ); const fieldsToDisplay = excludeRelations diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx index b04e0f2e46..07d6df9cf8 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx @@ -2,6 +2,7 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useDeleteOneObjectMetadataItem } from '@/object-metadata/hooks/useDeleteOneObjectMetadataItem'; import { useUpdateOneObjectMetadataItem } from '@/object-metadata/hooks/useUpdateOneObjectMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; +import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { useCombinedGetTotalCount } from '@/object-record/multiple-objects/hooks/useCombinedGetTotalCount'; import { SettingsObjectMetadataItemTableRow } from '@/settings/data-model/object-details/components/SettingsObjectItemTableRow'; import { StyledObjectTableRow } from '@/settings/data-model/object-details/components/SettingsObjectItemTableRowStyledComponents'; @@ -76,7 +77,7 @@ export const SettingsObjectTable = ({ currentWorkspace?.workspaceCustomApplication?.id, }).labelText, fieldsCount: objectMetadataItem.fields.filter( - (field) => !field.isSystem, + (field) => !isHiddenSystemField(field), ).length, totalObjectCount: totalCountByObjectMetadataItemNamePlural[ diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command.ts new file mode 100644 index 0000000000..1a57a39300 --- /dev/null +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command.ts @@ -0,0 +1,89 @@ +import { InjectRepository } from '@nestjs/typeorm'; + +import { Command } from 'nest-commander'; +import { isDefined } from 'twenty-shared/utils'; +import { Repository } from 'typeorm'; + +import { ActiveOrSuspendedWorkspacesMigrationCommandRunner } from 'src/database/commands/command-runners/active-or-suspended-workspaces-migration.command-runner'; +import { RunOnWorkspaceArgs } from 'src/database/commands/command-runners/workspaces-migration.command-runner'; +import { ADD_MISSING_SYSTEM_FIELDS_TO_STANDARD_OBJECTS_1771420702241 } from 'src/database/commands/upgrade-version-command/workspace-migrations/1771420702241-add-missing-system-fields-to-standard-objects'; +import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; +import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; +import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager'; +import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service'; +import { WorkspaceMigrationRunnerService } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-runner/services/workspace-migration-runner.service'; + +const FIRST_FIELD_UNIVERSAL_IDENTIFIER = + ADD_MISSING_SYSTEM_FIELDS_TO_STANDARD_OBJECTS_1771420702241.actions[0] + .flatEntity.universalIdentifier; + +@Command({ + name: 'upgrade:1-19:add-missing-system-fields-to-standard-objects', + description: + 'Add missing system fields (position, searchVector, createdBy, updatedBy) to standard objects', +}) +export class AddMissingSystemFieldsToStandardObjectsCommand extends ActiveOrSuspendedWorkspacesMigrationCommandRunner { + constructor( + @InjectRepository(WorkspaceEntity) + protected readonly workspaceRepository: Repository, + protected readonly twentyORMGlobalManager: GlobalWorkspaceOrmManager, + protected readonly dataSourceService: DataSourceService, + private readonly workspaceCacheService: WorkspaceCacheService, + private readonly workspaceMigrationRunnerService: WorkspaceMigrationRunnerService, + ) { + super(workspaceRepository, twentyORMGlobalManager, dataSourceService); + } + + // The entire migration runs in a single transaction, so checking the first + // field is enough to know whether the migration has already been applied. + // In the future we will maintain a list of passed migrations + private async hasAlreadyRun(workspaceId: string): Promise { + const { flatFieldMetadataMaps } = + await this.workspaceCacheService.getOrRecompute(workspaceId, [ + 'flatFieldMetadataMaps', + ]); + + return isDefined( + flatFieldMetadataMaps.byUniversalIdentifier[ + FIRST_FIELD_UNIVERSAL_IDENTIFIER + ], + ); + } + + override async runOnWorkspace({ + workspaceId, + options, + }: RunOnWorkspaceArgs): Promise { + const dryRun = options?.dryRun ?? false; + + this.logger.log( + `${dryRun ? '[DRY RUN] ' : ''}Adding missing system fields to standard objects in workspace ${workspaceId}`, + ); + + if (dryRun) { + this.logger.log( + `[DRY RUN] Would add ${ADD_MISSING_SYSTEM_FIELDS_TO_STANDARD_OBJECTS_1771420702241.actions.length} missing system fields to standard objects in workspace ${workspaceId}. Skipping.`, + ); + + return; + } + + if (await this.hasAlreadyRun(workspaceId)) { + this.logger.log( + `Migration already applied for workspace ${workspaceId}, skipping.`, + ); + + return; + } + + await this.workspaceMigrationRunnerService.run({ + workspaceId, + workspaceMigration: + ADD_MISSING_SYSTEM_FIELDS_TO_STANDARD_OBJECTS_1771420702241, + }); + + this.logger.log( + `Successfully added missing system fields to standard objects in workspace ${workspaceId}`, + ); + } +} diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command.ts index 79aebabb5d..8d70154ab4 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command.ts @@ -151,6 +151,8 @@ export class BackfillMessageChannelMessageAssociationMessageFolderCommand extend { buildOptions: { isSystemBuild: true, + applicationUniversalIdentifier: + twentyStandardFlatApplication.universalIdentifier, }, fromToAllFlatEntityMaps: { flatObjectMetadataMaps: { @@ -166,8 +168,7 @@ export class BackfillMessageChannelMessageAssociationMessageFolderCommand extend additionalCacheDataMaps: { featureFlagsMap, }, - applicationUniversalIdentifier: - twentyStandardFlatApplication.universalIdentifier, + idByUniversalIdentifierByMetadataName, }, ); diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command.ts new file mode 100644 index 0000000000..9ceb9acf89 --- /dev/null +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command.ts @@ -0,0 +1,176 @@ +import { InjectDataSource, InjectRepository } from '@nestjs/typeorm'; + +import { Command } from 'nest-commander'; +import { STANDARD_OBJECTS } from 'twenty-shared/metadata'; +import { FieldMetadataType } from 'twenty-shared/types'; +import { DataSource, Repository } from 'typeorm'; + +import { ActiveOrSuspendedWorkspacesMigrationCommandRunner } from 'src/database/commands/command-runners/active-or-suspended-workspaces-migration.command-runner'; +import { RunOnWorkspaceArgs } from 'src/database/commands/command-runners/workspaces-migration.command-runner'; +import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; +import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; +import { getMetadataFlatEntityMapsKey } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-flat-entity-maps-key.util'; +import { getMetadataRelatedMetadataNames } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-related-metadata-names.util'; +import { PARTIAL_SYSTEM_FLAT_FIELD_METADATAS } from 'src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant'; +import { WorkspaceMetadataVersionService } from 'src/engine/metadata-modules/workspace-metadata-version/services/workspace-metadata-version.service'; +import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager'; +import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service'; +import { WorkspaceCacheService } from 'src/engine/workspace-cache/services/workspace-cache.service'; +import { type WorkspaceCacheKeyName } from 'src/engine/workspace-cache/types/workspace-cache-key.type'; + +const SYSTEM_FIELD_NAMES = Object.keys(PARTIAL_SYSTEM_FLAT_FIELD_METADATAS); + +const POSITION_FIELDS_TO_FIX_TYPE = [ + STANDARD_OBJECTS.favorite.fields.position.universalIdentifier, + STANDARD_OBJECTS.favoriteFolder.fields.position.universalIdentifier, +]; + +const RELATION_FIELD_TYPES = [ + FieldMetadataType.RELATION, + FieldMetadataType.MORPH_RELATION, +]; + +@Command({ + name: 'upgrade:1-19:backfill-system-fields-is-system', + description: + 'Set isSystem to true for system field names, set isSystem to false for relation/morph_relation fields, and fix position field type for favorite/favoriteFolder', +}) +export class BackfillSystemFieldsIsSystemCommand extends ActiveOrSuspendedWorkspacesMigrationCommandRunner { + constructor( + @InjectRepository(WorkspaceEntity) + protected readonly workspaceRepository: Repository, + @InjectDataSource() + private readonly coreDataSource: DataSource, + protected readonly twentyORMGlobalManager: GlobalWorkspaceOrmManager, + protected readonly dataSourceService: DataSourceService, + private readonly workspaceCacheService: WorkspaceCacheService, + private readonly workspaceCacheStorageService: WorkspaceCacheStorageService, + private readonly workspaceMetadataVersionService: WorkspaceMetadataVersionService, + ) { + super(workspaceRepository, twentyORMGlobalManager, dataSourceService); + } + + override async runOnWorkspace({ + workspaceId, + options, + }: RunOnWorkspaceArgs): Promise { + const dryRun = options?.dryRun ?? false; + + this.logger.log( + `${dryRun ? '[DRY RUN] ' : ''}Backfilling isSystem for system fields in workspace ${workspaceId}`, + ); + + if (dryRun) { + this.logger.log( + `[DRY RUN] Would set isSystem=true for fields named [${SYSTEM_FIELD_NAMES.join(', ')}], set isSystem=false for relation fields, and fix position field types in workspace ${workspaceId}. Skipping.`, + ); + + return; + } + + const queryRunner = this.coreDataSource.createQueryRunner(); + + await queryRunner.connect(); + + try { + let needsCacheInvalidation = false; + + const isSystemResult = await queryRunner.query( + `UPDATE core."fieldMetadata" + SET "isSystem" = true + WHERE "workspaceId" = $1 + AND "name" = ANY($2) + AND "isSystem" = false`, + [workspaceId, SYSTEM_FIELD_NAMES], + ); + + const isSystemUpdatedCount = isSystemResult?.[1] ?? 0; + + if (isSystemUpdatedCount > 0) { + this.logger.log( + `Set isSystem=true for ${isSystemUpdatedCount} field(s) in workspace ${workspaceId}`, + ); + needsCacheInvalidation = true; + } + + const relationIsSystemResult = await queryRunner.query( + `UPDATE core."fieldMetadata" + SET "isSystem" = false + WHERE "workspaceId" = $1 + AND "type" = ANY($2) + AND "isSystem" = true`, + [workspaceId, RELATION_FIELD_TYPES], + ); + + const relationIsSystemUpdatedCount = relationIsSystemResult?.[1] ?? 0; + + if (relationIsSystemUpdatedCount > 0) { + this.logger.log( + `Set isSystem=false for ${relationIsSystemUpdatedCount} relation field(s) in workspace ${workspaceId}`, + ); + needsCacheInvalidation = true; + } + + const positionTypeResult = await queryRunner.query( + `UPDATE core."fieldMetadata" + SET "type" = $1 + WHERE "workspaceId" = $2 + AND "universalIdentifier" = ANY($3) + AND "type" = $4`, + [ + FieldMetadataType.POSITION, + workspaceId, + POSITION_FIELDS_TO_FIX_TYPE, + FieldMetadataType.NUMBER, + ], + ); + + const positionTypeUpdatedCount = positionTypeResult?.[1] ?? 0; + + if (positionTypeUpdatedCount > 0) { + this.logger.log( + `Fixed type from NUMBER to POSITION for ${positionTypeUpdatedCount} field(s) in workspace ${workspaceId}`, + ); + needsCacheInvalidation = true; + } + + if (needsCacheInvalidation) { + await this.invalidateCaches(workspaceId); + } else { + this.logger.log( + `No fields needed updating in workspace ${workspaceId}`, + ); + } + } finally { + await queryRunner.release(); + } + } + + private async invalidateCaches(workspaceId: string): Promise { + const modifiedMetadataNames = ['fieldMetadata'] as const; + + const cacheKeysToInvalidate: WorkspaceCacheKeyName[] = [ + ...new Set( + modifiedMetadataNames + .flatMap((name) => [name, ...getMetadataRelatedMetadataNames(name)]) + .map(getMetadataFlatEntityMapsKey), + ), + 'ORMEntityMetadatas', + ]; + + await this.workspaceCacheService.invalidateAndRecompute( + workspaceId, + cacheKeysToInvalidate, + ); + + await this.workspaceMetadataVersionService.incrementMetadataVersion( + workspaceId, + ); + + await this.workspaceCacheStorageService.flush(workspaceId); + + this.logger.log( + `Cache invalidated and metadata version incremented for workspace ${workspaceId}`, + ); + } +} diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-upgrade-version-command.module.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-upgrade-version-command.module.ts index 8fa48b35b1..28136d2645 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-upgrade-version-command.module.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/1-19/1-19-upgrade-version-command.module.ts @@ -1,11 +1,16 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; +import { AddMissingSystemFieldsToStandardObjectsCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command'; import { BackfillMessageChannelMessageAssociationMessageFolderCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command'; +import { BackfillSystemFieldsIsSystemCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command'; import { ApplicationModule } from 'src/engine/core-modules/application/application.module'; import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; import { DataSourceModule } from 'src/engine/metadata-modules/data-source/data-source.module'; +import { WorkspaceMetadataVersionModule } from 'src/engine/metadata-modules/workspace-metadata-version/workspace-metadata-version.module'; +import { WorkspaceCacheStorageModule } from 'src/engine/workspace-cache-storage/workspace-cache-storage.module'; import { WorkspaceCacheModule } from 'src/engine/workspace-cache/workspace-cache.module'; +import { WorkspaceMigrationRunnerModule } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-runner/workspace-migration-runner.module'; import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace-migration/workspace-migration.module'; @Module({ @@ -13,10 +18,21 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace TypeOrmModule.forFeature([WorkspaceEntity]), DataSourceModule, WorkspaceCacheModule, + WorkspaceCacheStorageModule, + WorkspaceMetadataVersionModule, + WorkspaceMigrationRunnerModule, ApplicationModule, WorkspaceMigrationModule, ], - providers: [BackfillMessageChannelMessageAssociationMessageFolderCommand], - exports: [BackfillMessageChannelMessageAssociationMessageFolderCommand], + providers: [ + BackfillSystemFieldsIsSystemCommand, + AddMissingSystemFieldsToStandardObjectsCommand, + BackfillMessageChannelMessageAssociationMessageFolderCommand, + ], + exports: [ + BackfillSystemFieldsIsSystemCommand, + AddMissingSystemFieldsToStandardObjectsCommand, + BackfillMessageChannelMessageAssociationMessageFolderCommand, + ], }) export class V1_19_UpgradeVersionCommandModule {} diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/upgrade.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/upgrade.command.ts index 5d5af01bd0..c1abb02a3b 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/upgrade.command.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/upgrade.command.ts @@ -27,7 +27,9 @@ import { MigrateFavoritesToNavigationMenuItemsCommand } from 'src/database/comma import { MigratePersonAvatarFilesCommand } from 'src/database/commands/upgrade-version-command/1-18/1-18-migrate-person-avatar-files.command'; import { MigrateWorkflowSendEmailAttachmentsCommand } from 'src/database/commands/upgrade-version-command/1-18/1-18-migrate-workflow-send-email-attachments.command'; import { MigrateWorkspacePicturesCommand } from 'src/database/commands/upgrade-version-command/1-18/1-18-migrate-workspace-pictures.command'; +import { AddMissingSystemFieldsToStandardObjectsCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-add-missing-system-fields-to-standard-objects.command'; import { BackfillMessageChannelMessageAssociationMessageFolderCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-message-channel-message-association-message-folder.command'; +import { BackfillSystemFieldsIsSystemCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command'; import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service'; import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity'; import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service'; @@ -70,6 +72,8 @@ export class UpgradeCommand extends UpgradeCommandRunner { protected readonly migrateWorkflowSendEmailAttachmentsCommand: MigrateWorkflowSendEmailAttachmentsCommand, // 1.19 Commands + protected readonly backfillSystemFieldsIsSystemCommand: BackfillSystemFieldsIsSystemCommand, + protected readonly addMissingSystemFieldsToStandardObjectsCommand: AddMissingSystemFieldsToStandardObjectsCommand, protected readonly backfillMessageChannelMessageAssociationMessageFolderCommand: BackfillMessageChannelMessageAssociationMessageFolderCommand, ) { super( @@ -108,6 +112,8 @@ export class UpgradeCommand extends UpgradeCommandRunner { ]; const commands_1190: VersionCommands = [ + this.backfillSystemFieldsIsSystemCommand, + this.addMissingSystemFieldsToStandardObjectsCommand, this.backfillMessageChannelMessageAssociationMessageFolderCommand, ]; diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/workspace-migrations/1771420702241-add-missing-system-fields-to-standard-objects.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/workspace-migrations/1771420702241-add-missing-system-fields-to-standard-objects.ts new file mode 100644 index 0000000000..88c8a6486b --- /dev/null +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/workspace-migrations/1771420702241-add-missing-system-fields-to-standard-objects.ts @@ -0,0 +1,2581 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { type WorkspaceMigration } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration.type'; + +export const ADD_MISSING_SYSTEM_FIELDS_TO_STANDARD_OBJECTS_1771420702241 = { + applicationUniversalIdentifier: '20202020-64aa-4b6f-b003-9c74b97cee20', + actions: [ + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'cef8f62c-cd46-4444-8cbb-17d463b7464a', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Attachment record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-bd3d-4c60-8dca-571c71d4447a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'e7b42835-cb2e-4456-8558-9225362aa52d', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-bd3d-4c60-8dca-571c71d4447a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"name\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'b80db15d-8dc2-4f47-a072-15030941a9d1', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-0408-4f38-b8a8-4d5e3e26e24d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '11aaa404-f04b-421d-a451-c453bf77cc78', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-0408-4f38-b8a8-4d5e3e26e24d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '72a27e60-3542-46dc-90db-684d79bd7f11', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Blocklist record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-0408-4f38-b8a8-4d5e3e26e24d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '5fa758da-30b4-412e-8a4f-975f2848ce60', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-0408-4f38-b8a8-4d5e3e26e24d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '8daa2bc8-bce2-4309-8a48-b929f3ee2c34', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-491b-4aaa-9825-afd1bae6ae00', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '55d810d2-fe47-44b4-b1de-b9c32113b695', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-491b-4aaa-9825-afd1bae6ae00', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '4fa18346-bb2b-49b0-ab35-23df86eed1c8', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Calendar channel event association record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-491b-4aaa-9825-afd1bae6ae00', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '1844a9cf-6d35-46d7-99ba-011626a6d71b', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-491b-4aaa-9825-afd1bae6ae00', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"eventExternalId\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '664db1a0-76f4-4429-8452-f8e250ab7545', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-e8f2-40e1-a39c-c0e0039c5034', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6a397eab-3700-4b08-9eb9-d16b61876193', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-e8f2-40e1-a39c-c0e0039c5034', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '566609c9-1c8b-4899-91bb-0af140a89004', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Calendar channel record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-e8f2-40e1-a39c-c0e0039c5034', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'bc9a982c-c314-49d6-818a-2661ce7e918f', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-e8f2-40e1-a39c-c0e0039c5034', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '9e9ec14d-b889-448e-afe5-40e407be11d1', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a1c3-47a6-9732-27e5b1e8436d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'a2c6efda-06bf-418e-808a-dac9fd64ab58', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a1c3-47a6-9732-27e5b1e8436d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'fcfa672c-ce6d-4fc1-b978-db58a4cc14f4', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Calendar event participant record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a1c3-47a6-9732-27e5b1e8436d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'c9dccf32-64ea-433e-a9a7-09993343bae0', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a1c3-47a6-9732-27e5b1e8436d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '664a9500-2641-4caa-8d95-069807bb2eb4', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-8f1d-4eef-9f85-0d1965e27221', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '1081c196-d675-4801-b9e1-7d8637b48eab', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-8f1d-4eef-9f85-0d1965e27221', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'e9488e9a-0abe-4500-8c1d-bfbd6b8cffad', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Calendar event record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-8f1d-4eef-9f85-0d1965e27221', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'b9e7825c-d491-4414-b904-910c00b5b93b', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-8f1d-4eef-9f85-0d1965e27221', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"title\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'e09c2463-9ca6-4004-97ce-6039e3161a5d', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-977e-46b2-890b-c3002ddfd5c5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '0a84c0e1-f9fc-47d5-8ac9-58538e50a9f9', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-977e-46b2-890b-c3002ddfd5c5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '66b7bc3e-c99e-42b6-82e6-6f43142c0f2f', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Connected account record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-977e-46b2-890b-c3002ddfd5c5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '140767fe-0aa4-4573-a0bd-67cb657c9452', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-977e-46b2-890b-c3002ddfd5c5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6440dc3d-fa50-49cc-abd3-98eeccd79288', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ab56-4e05-92a3-e2414a499860', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6c117b1a-0470-499b-8fcb-d9059eafbd43', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ab56-4e05-92a3-e2414a499860', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'cbb27ea1-5cf8-4fed-9e0a-e4152815bd6e', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ab56-4e05-92a3-e2414a499860', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '1ec58922-7789-4832-a583-ec97f766f433', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-7cf8-401f-8211-a9587d27fd2d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6a53edc6-0ef2-4c35-9065-f91c4ddf7f01', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-7cf8-401f-8211-a9587d27fd2d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'c5bb12e1-0cc3-428f-89f0-4c8747239ac3', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-7cf8-401f-8211-a9587d27fd2d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"name\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6e52bde4-ed41-4462-aa70-121e496270b4', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3f6b-4425-80ab-e468899ab4b2', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '7822dcc0-ee40-4af0-a6fe-f10a14e72b24', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3f6b-4425-80ab-e468899ab4b2', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '06c5052d-3369-4d6d-8eaa-f9780eddb1fd', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3f6b-4425-80ab-e468899ab4b2', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '529b6008-4a12-4d48-bbc3-26a3f199bafd', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3f6b-4425-80ab-e468899ab4b2', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"subject\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'b7de8fcc-a7c6-4122-b3fa-1fcf8f30931c', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fe8c-40bc-a681-b80b771449b7', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '88bb6ff1-b8a1-4313-95d4-7879acca0b93', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fe8c-40bc-a681-b80b771449b7', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'bc8a36af-8b9c-4548-a0da-c90e899e7243', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message Channel record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fe8c-40bc-a681-b80b771449b7', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '5e84794c-6f14-4bdf-81a6-76ee11cda51f', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fe8c-40bc-a681-b80b771449b7', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'ce7dc96f-dd33-4bce-9505-cbd381440cec', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ad1e-4127-bccb-d83ae04d2ccb', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '334d2ad6-4bc4-4b51-9c92-8ad57652475e', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ad1e-4127-bccb-d83ae04d2ccb', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '45d1e083-90d6-4507-b68a-454a9dc3a540', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message channel message association record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ad1e-4127-bccb-d83ae04d2ccb', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'edddd409-d9f0-4b93-8e3f-37faef6a3387', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-ad1e-4127-bccb-d83ae04d2ccb', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"messageExternalId\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'bfe19f84-b640-4ce3-b771-4e7bf18bad14', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-4955-4fd9-8e59-2dbd373f2a46', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '7ec7eea8-8715-4656-a602-3cb4256aaca1', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-4955-4fd9-8e59-2dbd373f2a46', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '5317d4f4-12c5-469d-8e47-0f3b2ffc95b4', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message Folder record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-4955-4fd9-8e59-2dbd373f2a46', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '5f2d3937-bafd-4d71-b4cb-b34037efd2e1', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-4955-4fd9-8e59-2dbd373f2a46', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"name\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'e0e6aa04-6ad5-4d12-8799-6febf00452c1', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a433-4456-aa2d-fd9cb26b774a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '6c90fd49-22b8-4f91-b4eb-4b9af630e988', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a433-4456-aa2d-fd9cb26b774a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'f49ca74e-dcdf-445d-a707-3c22869b4e6c', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message Participant record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a433-4456-aa2d-fd9cb26b774a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '80fec74f-cda7-46bd-ae37-8998bd4f992b', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-a433-4456-aa2d-fd9cb26b774a', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"handle\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'b50ce369-9905-46d9-b95b-5e4034d252aa', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-849a-4c3e-84f5-a25a7d802271', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '20fbafd0-0a16-4785-b5a6-f1ef45ef304c', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-849a-4c3e-84f5-a25a7d802271', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '7490a440-7a62-466e-ba93-75a2f2edfb1e', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Message Thread record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-849a-4c3e-84f5-a25a7d802271', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'c63e091f-6528-4657-ad2a-b0a158f9e483', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-849a-4c3e-84f5-a25a7d802271', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '820a3163-bb7d-41bc-93d9-81a464559c48', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fff0-4b44-be82-bda313884400', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'a48c2bae-fe78-4d9d-bc37-f56d1a462121', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fff0-4b44-be82-bda313884400', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '082f7c9e-5ccd-4056-8748-a428f65fa6f6', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'NoteTarget record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fff0-4b44-be82-bda313884400', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '0cc32d0f-99ab-4fee-bf66-9e84bc8bce00', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-fff0-4b44-be82-bda313884400', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '65fe2a53-45e4-4225-9711-b827f55e51cc', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-5a9a-44e8-95df-771cd06d0fb1', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'bea3734f-aff2-49ed-9dc9-d4666a2e2178', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-5a9a-44e8-95df-771cd06d0fb1', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '4216c06a-498b-4111-9577-d9bcbccdda39', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'TaskTarget record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-5a9a-44e8-95df-771cd06d0fb1', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '8768a9c0-37c0-4465-b86d-c4c7f466ec23', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-5a9a-44e8-95df-771cd06d0fb1', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '8f66191f-927d-4a6d-a15f-d0ff8cfc5a6d', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-6736-4337-b5c4-8b39fae325a5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '81dc29fc-c872-4efd-bf31-d07872cd260e', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-6736-4337-b5c4-8b39fae325a5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'e245d799-3e4b-4c69-ab9a-6b7c91d71195', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'Timeline activity record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-6736-4337-b5c4-8b39fae325a5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'bc1d1b67-903a-4354-8272-4a6efc4cbe63', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-6736-4337-b5c4-8b39fae325a5', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: { + generatedType: 'STORED', + asExpression: + "to_tsvector('simple', COALESCE(public.unaccent_immutable(\"name\"), ''))", + }, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '5cea2f46-3779-4782-9fce-3062652e2dfd', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-7f3b9d2e4d1f', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '017d3587-98bd-43ad-b5a6-cb8125105641', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-7f3b9d2e4d1f', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'f4c5eb0a-8a86-49a2-a775-941eaad98fc9', + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + description: 'WorkflowAutomatedTrigger record position', + icon: 'IconHierarchy2', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: 0, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-7f3b9d2e4d1f', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: 'dae934ca-bfca-4101-8211-8eae6e2b5513', + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: true, + isUnique: false, + isUIReadOnly: false, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: null, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-7f3b9d2e4d1f', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '34f592a7-5c13-4c8b-8473-7bef00848b4e', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-d65d-4ab9-9344-d77bfb376a3d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '4f8777e6-c5eb-40c6-bb4c-ed9dcf0d81e9', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-d65d-4ab9-9344-d77bfb376a3d', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '4a3f26d1-033e-4d84-b23a-9adc2fd0c2a8', + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-82d5c0e881a6', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + { + type: 'create', + metadataName: 'fieldMetadata', + flatEntity: { + universalIdentifier: '29f84ad0-509f-4aef-9f9c-2691dd60cd87', + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isCustom: false, + isActive: true, + isSystem: true, + isNullable: false, + isUnique: false, + isUIReadOnly: true, + isLabelSyncedWithName: false, + standardOverrides: null, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + options: null, + morphId: null, + createdAt: '2026-02-18T13:18:21.997Z', + updatedAt: '2026-02-18T13:18:21.997Z', + applicationUniversalIdentifier: '89590676-196d-4bc4-a3f5-1f068192068e', + objectMetadataUniversalIdentifier: + '20202020-3319-4234-a34c-82d5c0e881a6', + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + universalSettings: null, + }, + }, + ], +} as const satisfies WorkspaceMigration; diff --git a/packages/twenty-server/src/engine/core-modules/application/services/application-manifest-migration.service.ts b/packages/twenty-server/src/engine/core-modules/application/services/application-manifest-migration.service.ts index c3fd22d0dd..e2840e69b8 100644 --- a/packages/twenty-server/src/engine/core-modules/application/services/application-manifest-migration.service.ts +++ b/packages/twenty-server/src/engine/core-modules/application/services/application-manifest-migration.service.ts @@ -78,14 +78,14 @@ export class ApplicationManifestMigrationService { await this.workspaceMigrationValidateBuildAndRunService.validateBuildAndRunWorkspaceMigrationFromTo( { buildOptions: { - isSystemBuild: true, + isSystemBuild: false, inferDeletionFromMissingEntities: true, + applicationUniversalIdentifier: + ownerFlatApplication.universalIdentifier, }, fromToAllFlatEntityMaps, workspaceId, additionalCacheDataMaps: { featureFlagsMap }, - applicationUniversalIdentifier: - ownerFlatApplication.universalIdentifier, }, ); diff --git a/packages/twenty-server/src/engine/core-modules/application/services/application-sync.service.ts b/packages/twenty-server/src/engine/core-modules/application/services/application-sync.service.ts index de20034a5f..1eec8ecf89 100644 --- a/packages/twenty-server/src/engine/core-modules/application/services/application-sync.service.ts +++ b/packages/twenty-server/src/engine/core-modules/application/services/application-sync.service.ts @@ -176,11 +176,11 @@ export class ApplicationSyncService { buildOptions: { isSystemBuild: true, inferDeletionFromMissingEntities: true, + applicationUniversalIdentifier, }, fromToAllFlatEntityMaps, workspaceId, additionalCacheDataMaps: { featureFlagsMap }, - applicationUniversalIdentifier, }, ); diff --git a/packages/twenty-server/src/engine/core-modules/application/utils/from-field-manifest-to-universal-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/core-modules/application/utils/from-field-manifest-to-universal-flat-field-metadata.util.ts index 6342e5f3eb..9fc6ad9f14 100644 --- a/packages/twenty-server/src/engine/core-modules/application/utils/from-field-manifest-to-universal-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/core-modules/application/utils/from-field-manifest-to-universal-flat-field-metadata.util.ts @@ -9,6 +9,7 @@ import { ApplicationExceptionCode, } from 'src/engine/core-modules/application/application.exception'; import { generateDefaultValue } from 'src/engine/metadata-modules/field-metadata/utils/generate-default-value'; +import { PARTIAL_SYSTEM_FLAT_FIELD_METADATAS } from 'src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant'; import { isMorphOrRelationFieldMetadataType } from 'src/engine/utils/is-morph-or-relation-field-metadata-type.util'; import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; @@ -79,7 +80,7 @@ export const fromFieldManifestToUniversalFlatFieldMetadata = ({ universalSettings: fieldManifest.universalSettings ?? null, isCustom: true, isActive: true, - isSystem: false, + isSystem: fieldManifest.name in PARTIAL_SYSTEM_FLAT_FIELD_METADATAS, isUIReadOnly: false, isNullable: fieldManifest.isNullable ?? true, isUnique: false, diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util.ts new file mode 100644 index 0000000000..ba14a87e2a --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util.ts @@ -0,0 +1,27 @@ +import { isDefined } from 'twenty-shared/utils'; + +import { type SyncableFlatEntity } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-from.type'; +import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util'; +import { type UniversalSyncableFlatEntity } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-entity-from.type'; +import { type UniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-entity-maps.type'; + +export type FindManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsArgs< + T extends SyncableFlatEntity | UniversalSyncableFlatEntity, +> = { + flatEntityMaps: UniversalFlatEntityMaps; + universalIdentifiers: string[]; +}; + +export const findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMaps = + ({ + flatEntityMaps, + universalIdentifiers, + }: FindManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsArgs): T[] => + universalIdentifiers + .map((universalIdentifier) => + findFlatEntityByUniversalIdentifier({ + flatEntityMaps, + universalIdentifier, + }), + ) + .filter(isDefined); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/constants/flat-field-metadata-relation-properties-to-compare.constant.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/constants/flat-field-metadata-relation-properties-to-compare.constant.ts index 5ce354f7bc..e68ca9d714 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/constants/flat-field-metadata-relation-properties-to-compare.constant.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/constants/flat-field-metadata-relation-properties-to-compare.constant.ts @@ -7,5 +7,5 @@ export const FLAT_FIELD_METADATA_RELATION_PROPERTIES_TO_COMPARE = [ 'standardOverrides', 'icon', 'name', - 'universalSettings', // TODO prastoin VERY IMPORTANT + 'universalSettings', ] as const satisfies (typeof ALL_UNIVERSAL_FLAT_ENTITY_PROPERTIES_TO_COMPARE_AND_STRINGIFY.fieldMetadata.propertiesToCompare)[number][]; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts index 46f05d4b25..0680ca9f12 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service.ts @@ -14,6 +14,8 @@ import { validateEnumSelectFlatFieldMetadata } from 'src/engine/metadata-modules import { validateFilesFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-files-flat-field-metadata.util'; import { validateMorphOrRelationFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-morph-or-relation-flat-field-metadata.util'; import { validateMorphRelationFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-morph-relation-flat-field-metadata.util'; +import { validatePositionFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util'; +import { validateTsVectorFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-ts-vector-flat-field-metadata.util'; const DEFAULT_NO_VALIDATION = (): FlatFieldMetadataValidationError[] => []; @@ -67,20 +69,12 @@ export class FlatFieldMetadataTypeValidatorService { msg`Field type NUMERIC is not supported. Use Number instead.`, ), PHONES: DEFAULT_NO_VALIDATION, - POSITION: rejectUserCreation( - FieldMetadataType.POSITION, - 'Field type POSITION is a system type and cannot be created manually.', - msg`Field type POSITION is a system type and cannot be created manually.`, - ), + POSITION: validatePositionFlatFieldMetadata, RAW_JSON: DEFAULT_NO_VALIDATION, RICH_TEXT: DEFAULT_NO_VALIDATION, RICH_TEXT_V2: DEFAULT_NO_VALIDATION, TEXT: DEFAULT_NO_VALIDATION, - TS_VECTOR: rejectUserCreation( - FieldMetadataType.TS_VECTOR, - 'Field type TS_VECTOR is a system type and cannot be created manually.', - msg`Field type TS_VECTOR is a system type and cannot be created manually.`, - ), + TS_VECTOR: validateTsVectorFlatFieldMetadata, UUID: DEFAULT_NO_VALIDATION, MORPH_RELATION: validateMorphRelationFlatFieldMetadata, MULTI_SELECT: validateEnumSelectFlatFieldMetadata, diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/get-object-field-names-and-join-column-names.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/get-object-field-names-and-join-column-names.util.ts index d4277fa2bc..5f43026db8 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/get-object-field-names-and-join-column-names.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/get-object-field-names-and-join-column-names.util.ts @@ -1,7 +1,7 @@ import { RelationType } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; -import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps-or-throw.util'; +import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util'; import { isMorphOrRelationUniversalFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/utils/is-morph-or-relation-flat-field-metadata.util'; import { type UniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-entity-maps.type'; import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; @@ -21,7 +21,7 @@ export const getObjectFieldNamesAndJoinColumnNames = ({ objectFieldNamesAndJoinColumnNames: ObjectFieldNamesAndJoinColumnNames; } => { const objectUniversalFlatFieldMetadatas = - findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow({ + findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMaps({ flatEntityMaps: universalFlatFieldMetadataMaps, universalIdentifiers: universalFlatObjectMetadata.fieldUniversalIdentifiers, diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/is-flat-field-metadata-name-synced-with-label.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/is-flat-field-metadata-name-synced-with-label.util.ts index 4279f0855b..ba4ba96f35 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/is-flat-field-metadata-name-synced-with-label.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/utils/is-flat-field-metadata-name-synced-with-label.util.ts @@ -1,20 +1,22 @@ import { computeMetadataNameFromLabel } from 'twenty-shared/metadata'; import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; +import { type WorkspaceMigrationBuilderOptions } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type'; export const isFlatFieldMetadataNameSyncedWithLabel = ({ flatFieldMetadata, - isSystemBuild, + buildOptions, }: { flatFieldMetadata: Pick< FlatFieldMetadata, 'name' | 'isLabelSyncedWithName' | 'label' >; - isSystemBuild: boolean; + buildOptions: WorkspaceMigrationBuilderOptions; }) => { const computedName = computeMetadataNameFromLabel({ label: flatFieldMetadata.label, - applyCustomSuffix: !isSystemBuild, + applyCustomSuffix: !isCallerTwentyStandardApp(buildOptions), }); return flatFieldMetadata.name === computedName; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name-availability.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name-availability.util.ts index 77f4e08ded..164762e2fd 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name-availability.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name-availability.util.ts @@ -5,9 +5,10 @@ import { isDefined } from 'twenty-shared/utils'; import { FieldMetadataExceptionCode } from 'src/engine/metadata-modules/field-metadata/field-metadata.exception'; import { computeCompositeColumnName } from 'src/engine/metadata-modules/field-metadata/utils/compute-column-name.util'; import { isCompositeFieldMetadataType } from 'src/engine/metadata-modules/field-metadata/utils/is-composite-field-metadata-type.util'; -import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps-or-throw.util'; +import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps.util'; import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type'; import { getObjectFieldNamesAndJoinColumnNames } from 'src/engine/metadata-modules/flat-field-metadata/utils/get-object-field-names-and-join-column-names.util'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { type UniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-entity-maps.type'; import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; import { type UniversalFlatObjectMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-object-metadata.type'; @@ -51,7 +52,7 @@ export const validateFlatFieldMetadataNameAvailability = ({ }): FlatFieldMetadataValidationError[] => { const errors: FlatFieldMetadataValidationError[] = []; const objectUniversalFlatFieldMetadatas = - findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow({ + findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMaps({ flatEntityMaps: universalFlatFieldMetadataMaps, universalIdentifiers: universalFlatObjectMetadata.fieldUniversalIdentifiers, @@ -61,7 +62,7 @@ export const validateFlatFieldMetadataNameAvailability = ({ ); if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && reservedCompositeFieldsNames.includes(name) ) { errors.push({ diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name.util.ts index 877f98c309..005f3cef0b 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name.util.ts @@ -5,6 +5,7 @@ import { FieldMetadataExceptionCode } from 'src/engine/metadata-modules/field-me import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type'; import { IDENTIFIER_MAX_CHAR_LENGTH } from 'src/engine/metadata-modules/utils/constants/identifier-max-char-length.constants'; import { IDENTIFIER_MIN_CHAR_LENGTH } from 'src/engine/metadata-modules/utils/constants/identifier-min-char-length.constants'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { type WorkspaceMigrationBuilderOptions } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type'; const STARTS_WITH_LOWER_CASE_AND_CONTAINS_ONLY_CAPS_AND_LOWER_LETTERS_AND_NUMBER_STRING_REGEX = @@ -51,7 +52,7 @@ export const validateFlatFieldMetadataName = ({ } if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && RESERVED_METADATA_NAME_KEYWORDS.includes(name) ) { errors.push({ diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util.ts new file mode 100644 index 0000000000..2679b50ea7 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-position-flat-field-metadata.util.ts @@ -0,0 +1,32 @@ +import { msg } from '@lingui/core/macro'; +import { type FieldMetadataType } from 'twenty-shared/types'; + +import { FieldMetadataExceptionCode } from 'src/engine/metadata-modules/field-metadata/field-metadata.exception'; +import { type FlatFieldMetadataTypeValidationArgs } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-type-validator.type'; +import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type'; + +export const validatePositionFlatFieldMetadata = ({ + flatEntityToValidate, +}: FlatFieldMetadataTypeValidationArgs): FlatFieldMetadataValidationError[] => { + const errors: FlatFieldMetadataValidationError[] = []; + + if (flatEntityToValidate.name !== 'position') { + errors.push({ + code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT, + message: `Field type POSITION must be named "position", got "${flatEntityToValidate.name}"`, + value: flatEntityToValidate.name, + userFriendlyMessage: msg`Field type POSITION must be named "position"`, + }); + } + + if (!flatEntityToValidate.isSystem) { + errors.push({ + code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT, + message: 'Field type POSITION must be a system field', + value: flatEntityToValidate.isSystem, + userFriendlyMessage: msg`Field type POSITION must be a system field`, + }); + } + + return errors; +}; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-ts-vector-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-ts-vector-flat-field-metadata.util.ts new file mode 100644 index 0000000000..cd8e14a623 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-ts-vector-flat-field-metadata.util.ts @@ -0,0 +1,32 @@ +import { msg } from '@lingui/core/macro'; +import { type FieldMetadataType } from 'twenty-shared/types'; + +import { FieldMetadataExceptionCode } from 'src/engine/metadata-modules/field-metadata/field-metadata.exception'; +import { type FlatFieldMetadataTypeValidationArgs } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-type-validator.type'; +import { type FlatFieldMetadataValidationError } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata-validation-error.type'; + +export const validateTsVectorFlatFieldMetadata = ({ + flatEntityToValidate, +}: FlatFieldMetadataTypeValidationArgs): FlatFieldMetadataValidationError[] => { + const errors: FlatFieldMetadataValidationError[] = []; + + if (flatEntityToValidate.name !== 'searchVector') { + errors.push({ + code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT, + message: `Field type TS_VECTOR must be named "searchVector", got "${flatEntityToValidate.name}"`, + value: flatEntityToValidate.name, + userFriendlyMessage: msg`Field type TS_VECTOR must be named "searchVector"`, + }); + } + + if (!flatEntityToValidate.isSystem) { + errors.push({ + code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT, + message: 'Field type TS_VECTOR must be a system field', + value: flatEntityToValidate.isSystem, + userFriendlyMessage: msg`Field type TS_VECTOR must be a system field`, + }); + } + + return errors; +}; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/are-flat-object-metadata-names-synced-with-labels.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/are-flat-object-metadata-names-synced-with-labels.util.ts index a6b2513f84..a7a9538f08 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/are-flat-object-metadata-names-synced-with-labels.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/are-flat-object-metadata-names-synced-with-labels.util.ts @@ -1,12 +1,14 @@ import { computeMetadataNameFromLabel } from 'twenty-shared/metadata'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { type UniversalFlatObjectMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-object-metadata.type'; +import { type WorkspaceMigrationBuilderOptions } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type'; export const areFlatObjectMetadataNamesSyncedWithLabels = ({ flatObjectdMetadata, - isSystemBuild, + buildOptions, }: { - isSystemBuild: boolean; + buildOptions: WorkspaceMigrationBuilderOptions; flatObjectdMetadata: Pick< UniversalFlatObjectMetadata, 'namePlural' | 'nameSingular' | 'labelPlural' | 'labelSingular' @@ -18,7 +20,7 @@ export const areFlatObjectMetadataNamesSyncedWithLabels = ({ ].map((label) => computeMetadataNameFromLabel({ label, - applyCustomSuffix: !isSystemBuild, + applyCustomSuffix: !isCallerTwentyStandardApp(buildOptions), }), ); diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-create-object-input-to-flat-object-metadata-and-flat-field-metadatas-to-create.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-create-object-input-to-flat-object-metadata-and-flat-field-metadatas-to-create.util.ts index f6ce5120dd..d561ecf672 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-create-object-input-to-flat-object-metadata-and-flat-field-metadatas-to-create.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-create-object-input-to-flat-object-metadata-and-flat-field-metadatas-to-create.util.ts @@ -64,7 +64,7 @@ export const fromCreateObjectInputToFlatObjectMetadataAndFlatFieldMetadatasToCre const nameField = defaultFlatFieldForCustomObjectMaps.fields.nameField; const labelIdentifierFieldMetadataUniversalIdentifier = nameField?.universalIdentifier ?? - defaultFlatFieldForCustomObjectMaps.fields.idField.universalIdentifier; + defaultFlatFieldForCustomObjectMaps.fields.id.universalIdentifier; const universalFlatObjectMetadataToCreate: UniversalFlatObjectMetadata & { id: string; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-flat-object-metadata-name-and-labels.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-flat-object-metadata-name-and-labels.util.ts index e69b9f493a..a85db844c2 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-flat-object-metadata-name-and-labels.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-flat-object-metadata-name-and-labels.util.ts @@ -67,7 +67,7 @@ export const validateFlatObjectMetadataNameAndLabels = ({ universalFlatObjectMetadataToValidate.isLabelSyncedWithName && !areFlatObjectMetadataNamesSyncedWithLabels({ flatObjectdMetadata: universalFlatObjectMetadataToValidate, - isSystemBuild: buildOptions.isSystemBuild, + buildOptions, }) ) { errors.push({ diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity.ts b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity.ts new file mode 100644 index 0000000000..d86510b2f1 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity.ts @@ -0,0 +1,123 @@ +import { msg } from '@lingui/core/macro'; +import { isDefined } from 'twenty-shared/utils'; + +import { findFlatEntityByUniversalIdentifierOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier-or-throw.util'; +import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps-or-throw.util'; +import { PARTIAL_SYSTEM_FLAT_FIELD_METADATAS } from 'src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant'; +import { ObjectMetadataExceptionCode } from 'src/engine/metadata-modules/object-metadata/object-metadata.exception'; +import { + type OrchestratorActionsReport, + type OrchestratorFailureReport, +} from 'src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type'; +import { type AllUniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/all-universal-flat-entity-maps.type'; +import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; +import { type FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/types/failed-flat-entity-validation.type'; +import { getEmptyFlatEntityValidationError } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/utils/get-flat-entity-validation-error.util'; +import { buildUniversalFlatObjectFieldByNameAndJoinColumnMaps } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/utils/build-universal-flat-object-field-by-name-and-join-column-maps.util'; + +type ValidateObjectMetadataSystemFieldsIntegrityArgs = { + orchestratorActionsReport: Pick< + OrchestratorActionsReport, + 'fieldMetadata' | 'objectMetadata' + >; + optimisticUniversalFlatMaps: Pick< + AllUniversalFlatEntityMaps, + 'flatFieldMetadataMaps' | 'flatObjectMetadataMaps' + >; +}; +export const validateObjectMetadataSystemFieldsIntegrity = ({ + optimisticUniversalFlatMaps, + orchestratorActionsReport, +}: ValidateObjectMetadataSystemFieldsIntegrityArgs): Pick< + OrchestratorFailureReport, + 'objectMetadata' +> => { + const metadataValidationErrors: Pick< + OrchestratorFailureReport, + 'objectMetadata' + > = { + objectMetadata: [], + }; + + const createdObjectMetadatas = + findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow({ + universalIdentifiers: orchestratorActionsReport.objectMetadata.create.map( + (createObjectAction) => + createObjectAction.flatEntity.universalIdentifier, + ), + flatEntityMaps: optimisticUniversalFlatMaps.flatObjectMetadataMaps, + }); + + for (const createdObjectMetadata of createdObjectMetadatas) { + const createdFailedFlatEntityValidations: FailedFlatEntityValidation< + 'objectMetadata', + 'create' + > = getEmptyFlatEntityValidationError({ + flatEntityMinimalInformation: { + universalIdentifier: createdObjectMetadata.universalIdentifier, + namePlural: createdObjectMetadata.namePlural, + nameSingular: createdObjectMetadata.nameSingular, + }, + metadataName: 'objectMetadata', + type: 'create', + }); + + const { fieldUniversalIdentifierByName } = + buildUniversalFlatObjectFieldByNameAndJoinColumnMaps({ + flatFieldMetadataMaps: + optimisticUniversalFlatMaps.flatFieldMetadataMaps, + flatObjectMetadata: createdObjectMetadata, + }); + + for (const expectedSystemField of Object.values( + PARTIAL_SYSTEM_FLAT_FIELD_METADATAS, + )) { + const matchingFieldUniversalIdentifier = + fieldUniversalIdentifierByName[expectedSystemField.name]; + + const expectedFieldName = expectedSystemField.name; + + if (!isDefined(matchingFieldUniversalIdentifier)) { + createdFailedFlatEntityValidations.errors.push({ + code: ObjectMetadataExceptionCode.MISSING_SYSTEM_FIELD, + message: `System field ${expectedFieldName} is missing`, + userFriendlyMessage: msg`System field ${expectedFieldName} is missing`, + value: expectedFieldName, + }); + } else { + const universalFlatFieldMetadata = + findFlatEntityByUniversalIdentifierOrThrow({ + flatEntityMaps: optimisticUniversalFlatMaps.flatFieldMetadataMaps, + universalIdentifier: matchingFieldUniversalIdentifier, + }); + + const propertiesToValidate = [ + 'type', + 'isSystem', + ] as const satisfies (keyof UniversalFlatFieldMetadata)[]; + + for (const property of propertiesToValidate) { + const expectedValue = expectedSystemField[property]; + const actualValue = universalFlatFieldMetadata[property]; + + if (actualValue !== expectedValue) { + createdFailedFlatEntityValidations.errors.push({ + code: ObjectMetadataExceptionCode.INVALID_SYSTEM_FIELD, + message: `System field ${expectedFieldName} has invalid ${property}: expected ${String(expectedValue)}, got ${String(actualValue)}`, + userFriendlyMessage: msg`System field ${expectedFieldName} has invalid ${property}`, + value: actualValue, + }); + } + } + } + } + + if (createdFailedFlatEntityValidations.errors.length > 0) { + metadataValidationErrors.objectMetadata.push( + createdFailedFlatEntityValidations, + ); + } + } + + return metadataValidationErrors; +}; diff --git a/packages/twenty-server/src/engine/metadata-modules/flat-page-layout-widget/validators/utils/reject-widget-type.util.ts b/packages/twenty-server/src/engine/metadata-modules/flat-page-layout-widget/validators/utils/reject-widget-type.util.ts index 4aa3ec4042..69edfbcc33 100644 --- a/packages/twenty-server/src/engine/metadata-modules/flat-page-layout-widget/validators/utils/reject-widget-type.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/flat-page-layout-widget/validators/utils/reject-widget-type.util.ts @@ -4,6 +4,7 @@ import { type GenericValidateFlatPageLayoutWidgetTypeSpecificitiesArgs } from 's import { type FlatPageLayoutWidgetValidationError } from 'src/engine/metadata-modules/flat-page-layout-widget/types/flat-page-layout-widget-validation-error.type'; import { type WidgetType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-type.enum'; import { PageLayoutWidgetExceptionCode } from 'src/engine/metadata-modules/page-layout-widget/exceptions/page-layout-widget.exception'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; export const rejectWidgetType = ( widgetType: WidgetType, @@ -13,8 +14,7 @@ export const rejectWidgetType = ( return ( args: GenericValidateFlatPageLayoutWidgetTypeSpecificitiesArgs, ): FlatPageLayoutWidgetValidationError[] => { - // Allow standard widgets to use widget types that are not yet supported for user creation - if (args.buildOptions.isSystemBuild) { + if (isCallerTwentyStandardApp(args.buildOptions)) { return []; } diff --git a/packages/twenty-server/src/engine/metadata-modules/navigation-menu-item/services/navigation-menu-item-deletion.service.ts b/packages/twenty-server/src/engine/metadata-modules/navigation-menu-item/services/navigation-menu-item-deletion.service.ts index a78bd1ffcf..8021f2460e 100644 --- a/packages/twenty-server/src/engine/metadata-modules/navigation-menu-item/services/navigation-menu-item-deletion.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/navigation-menu-item/services/navigation-menu-item-deletion.service.ts @@ -68,7 +68,7 @@ export class NavigationMenuItemDeletionService { }, }, workspaceId, - isSystemBuild: true, + isSystemBuild: false, applicationUniversalIdentifier: workspaceCustomFlatApplication.universalIdentifier, }, diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant.ts new file mode 100644 index 0000000000..5194e944bd --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant.ts @@ -0,0 +1,243 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + +import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; + +type PartialSystemFlatFieldMetadata< + T extends FieldMetadataType = FieldMetadataType, +> = Omit< + UniversalFlatFieldMetadata, + | 'applicationUniversalIdentifier' + | 'universalIdentifier' + | 'objectMetadataUniversalIdentifier' + | 'createdAt' + | 'updatedAt' +>; + +const PARTIAL_ID_FIELD = { + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + icon: 'Icon123', + description: 'Id', + isNullable: false, + isUnique: true, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: 'uuid', + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_CREATED_AT_FIELD = { + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + icon: 'IconCalendar', + description: 'Creation date', + isNullable: false, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: 'now', + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_UPDATED_AT_FIELD = { + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + icon: 'IconCalendarClock', + description: 'Last time the record was changed', + isNullable: false, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: 'now', + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_DELETED_AT_FIELD = { + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + icon: 'IconCalendarClock', + description: 'Deletion date', + isNullable: true, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: null, + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_CREATED_BY_FIELD = { + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + icon: 'IconCreativeCommonsSa', + description: 'The creator of the record', + isNullable: false, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: { name: "''", source: "'MANUAL'" }, + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_UPDATED_BY_FIELD = { + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + icon: 'IconUserCircle', + description: 'The workspace member who last updated the record', + isNullable: false, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: { name: "''", source: "'MANUAL'" }, + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_POSITION_FIELD = { + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + icon: 'IconHierarchy2', + description: 'Position', + isNullable: false, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: 0, + options: null, + standardOverrides: null, + morphId: null, + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +const PARTIAL_SEARCH_VECTOR_FIELD = { + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + icon: 'IconSearch', + description: 'Search vector', + isNullable: true, + isUnique: false, + isActive: true, + isCustom: false, + isSystem: true, + isUIReadOnly: true, + isLabelSyncedWithName: false, + defaultValue: null, + options: null, + standardOverrides: null, + morphId: null, + // universalSettings for searchVector is computed at runtime + // based on the name field (getTsVectorColumnExpressionFromFields) + universalSettings: null, + relationTargetObjectMetadataUniversalIdentifier: null, + relationTargetFieldMetadataUniversalIdentifier: null, + viewFilterUniversalIdentifiers: [], + viewFieldUniversalIdentifiers: [], + kanbanAggregateOperationViewUniversalIdentifiers: [], + calendarViewUniversalIdentifiers: [], + mainGroupByFieldMetadataViewUniversalIdentifiers: [], +} as const satisfies PartialSystemFlatFieldMetadata; + +export const PARTIAL_SYSTEM_FLAT_FIELD_METADATAS = { + id: PARTIAL_ID_FIELD, + createdAt: PARTIAL_CREATED_AT_FIELD, + updatedAt: PARTIAL_UPDATED_AT_FIELD, + deletedAt: PARTIAL_DELETED_AT_FIELD, + createdBy: PARTIAL_CREATED_BY_FIELD, + updatedBy: PARTIAL_UPDATED_BY_FIELD, + position: PARTIAL_POSITION_FIELD, + searchVector: PARTIAL_SEARCH_VECTOR_FIELD, +} as const satisfies Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.exception.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.exception.ts index 2dff44ddb5..243fe799a9 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.exception.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.exception.ts @@ -15,6 +15,8 @@ export enum ObjectMetadataExceptionCode { INVALID_ORM_OUTPUT = 'INVALID_ORM_OUTPUT', INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR', NAME_CONFLICT = 'NAME_CONFLICT', + MISSING_SYSTEM_FIELD = 'MISSING_SYSTEM_FIELD', + INVALID_SYSTEM_FIELD = 'INVALID_SYSTEM_FIELD', } const getObjectMetadataExceptionUserFriendlyMessage = ( @@ -39,6 +41,10 @@ const getObjectMetadataExceptionUserFriendlyMessage = ( return STANDARD_ERROR_MESSAGE; case ObjectMetadataExceptionCode.NAME_CONFLICT: return msg`A name conflict occurred.`; + case ObjectMetadataExceptionCode.MISSING_SYSTEM_FIELD: + return msg`A system field is missing.`; + case ObjectMetadataExceptionCode.INVALID_SYSTEM_FIELD: + return msg`A system field has invalid properties.`; default: assertUnreachable(code); } diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts index a2e9cde2a7..a10ee65927 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/object-metadata.service.ts @@ -931,34 +931,6 @@ export class ObjectMetadataService extends TypeOrmQueryService((id) => ({ - id, - })); - - await this.deleteManyObjectMetadatas({ - deleteObjectInputs, - workspaceId, - isSystemBuild: true, - }); - } - public async findOneWithinWorkspace( workspaceId: string, options: FindOneOptions, diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-flat-field-metadatas-for-custom-object.util.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-flat-field-metadatas-for-custom-object.util.ts index b42911fb53..07cf238d3b 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-flat-field-metadatas-for-custom-object.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-flat-field-metadatas-for-custom-object.util.ts @@ -1,9 +1,7 @@ -import { - type FieldMetadataSettingsMapping, - FieldMetadataType, -} from 'twenty-shared/types'; +import { FieldMetadataType } from 'twenty-shared/types'; import { v4 } from 'uuid'; +import { PARTIAL_SYSTEM_FLAT_FIELD_METADATAS } from 'src/engine/metadata-modules/object-metadata/constants/partial-system-flat-field-metadatas.constant'; import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; import { type UniversalFlatObjectMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-object-metadata.type'; @@ -19,6 +17,98 @@ type BuildDefaultFlatFieldMetadataForCustomObjectArgs = { export type DefaultFlatFieldForCustomObjectMaps = ReturnType< typeof buildDefaultFlatFieldMetadatasForCustomObject >; + +const buildObjectSystemFlatFieldMetadatas = ({ + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + now, + searchVectorUniversalSettings, +}: { + applicationUniversalIdentifier: string; + objectMetadataUniversalIdentifier: string; + now: string; + searchVectorUniversalSettings: UniversalFlatFieldMetadata['universalSettings']; +}) => { + const { + createdAt, + createdBy, + deletedAt, + id, + position, + searchVector, + updatedAt, + updatedBy, + } = PARTIAL_SYSTEM_FLAT_FIELD_METADATAS; + + return { + id: { + ...id, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + createdAt: { + ...createdAt, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + createdBy: { + ...createdBy, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + deletedAt: { + ...deletedAt, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + position: { + ...position, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + searchVector: { + ...searchVector, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + universalSettings: searchVectorUniversalSettings, + }, + updatedAt: { + ...updatedAt, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + updatedBy: { + ...updatedBy, + universalIdentifier: v4(), + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + createdAt: now, + updatedAt: now, + }, + } as const satisfies Record; +}; + // This could be replaced totally by an import schema + its transpilation when it's ready export const buildDefaultFlatFieldMetadatasForCustomObject = ({ flatObjectMetadata: { @@ -27,39 +117,7 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({ }, skipNameField = false, }: BuildDefaultFlatFieldMetadataForCustomObjectArgs) => { - const createdAt = new Date().toISOString(); - - const idField: UniversalFlatFieldMetadata = { - type: FieldMetadataType.UUID, - isLabelSyncedWithName: false, - isUnique: true, - universalIdentifier: v4(), - name: 'id', - label: 'Id', - icon: 'Icon123', - description: 'Id', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: true, - isUIReadOnly: true, - defaultValue: 'uuid', - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; + const now = new Date().toISOString(); const nameField: UniversalFlatFieldMetadata | null = skipNameField @@ -79,8 +137,8 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({ isSystem: false, isUIReadOnly: false, defaultValue: null, - createdAt, - updatedAt: createdAt, + createdAt: now, + updatedAt: now, options: null, standardOverrides: null, morphId: null, @@ -96,252 +154,23 @@ export const buildDefaultFlatFieldMetadatasForCustomObject = ({ universalSettings: null, }; - const createdAtField: UniversalFlatFieldMetadata = + const searchVectorUniversalSettings: UniversalFlatFieldMetadata['universalSettings'] = { - type: FieldMetadataType.DATE_TIME, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'createdAt', - label: 'Creation date', - icon: 'IconCalendar', - description: 'Creation date', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: false, - isUIReadOnly: true, - defaultValue: 'now', - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const updatedAtField: UniversalFlatFieldMetadata = - { - type: FieldMetadataType.DATE_TIME, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'updatedAt', - label: 'Last update', - icon: 'IconCalendarClock', - description: 'Last time the record was changed', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: false, - isUIReadOnly: true, - defaultValue: 'now', - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const deletedAtField: UniversalFlatFieldMetadata = - { - type: FieldMetadataType.DATE_TIME, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'deletedAt', - label: 'Deleted at', - icon: 'IconCalendarClock', - description: 'Deletion date', - isNullable: true, - isActive: true, - isCustom: false, - isSystem: false, - isUIReadOnly: true, - defaultValue: null, - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const createdByField: UniversalFlatFieldMetadata = { - type: FieldMetadataType.ACTOR, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'createdBy', - label: 'Created by', - icon: 'IconCreativeCommonsSa', - description: 'The creator of the record', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: false, - isUIReadOnly: true, - defaultValue: { name: "''", source: "'MANUAL'" }, - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const updatedByField: UniversalFlatFieldMetadata = { - type: FieldMetadataType.ACTOR, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'updatedBy', - label: 'Updated by', - icon: 'IconUserCircle', - description: 'The workspace member who last updated the record', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: false, - isUIReadOnly: true, - defaultValue: { name: "''", source: "'MANUAL'" }, - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const positionField: UniversalFlatFieldMetadata = - { - type: FieldMetadataType.POSITION, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'position', - label: 'Position', - icon: 'IconHierarchy2', - description: 'Position', - isNullable: false, - isActive: true, - isCustom: false, - isSystem: true, - isUIReadOnly: true, - defaultValue: 0, - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: null, - }; - - const searchVectorSettings: FieldMetadataSettingsMapping['TS_VECTOR'] = { - asExpression: getTsVectorColumnExpressionFromFields( - nameField ? [nameField] : [], - ), - generatedType: 'STORED', - }; - const searchVectorField: UniversalFlatFieldMetadata = - { - type: FieldMetadataType.TS_VECTOR, - isLabelSyncedWithName: false, - isUnique: false, - universalIdentifier: v4(), - name: 'searchVector', - label: 'Search vector', - icon: 'IconSearch', - description: 'Search vector', - isNullable: true, - isActive: true, - isCustom: false, - isSystem: true, - isUIReadOnly: true, - defaultValue: null, - createdAt, - updatedAt: createdAt, - options: null, - standardOverrides: null, - morphId: null, - applicationUniversalIdentifier, - objectMetadataUniversalIdentifier, - relationTargetObjectMetadataUniversalIdentifier: null, - relationTargetFieldMetadataUniversalIdentifier: null, - viewFilterUniversalIdentifiers: [], - viewFieldUniversalIdentifiers: [], - kanbanAggregateOperationViewUniversalIdentifiers: [], - calendarViewUniversalIdentifiers: [], - mainGroupByFieldMetadataViewUniversalIdentifiers: [], - universalSettings: searchVectorSettings, + asExpression: getTsVectorColumnExpressionFromFields( + nameField ? [nameField] : [], + ), + generatedType: 'STORED', }; return { fields: { - idField, ...(nameField && { nameField }), - createdAtField, - updatedAtField, - updatedByField, - deletedAtField, - createdByField, - positionField, - searchVectorField, + ...buildObjectSystemFlatFieldMetadatas({ + applicationUniversalIdentifier, + objectMetadataUniversalIdentifier, + now, + searchVectorUniversalSettings, + }), }, } as const satisfies { fields: Record; diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-index-for-custom-object.util.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-index-for-custom-object.util.ts index a6dedb1b61..eaec00ec16 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-index-for-custom-object.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-index-for-custom-object.util.ts @@ -26,7 +26,7 @@ export const buildDefaultIndexesForCustomObject = ({ { createdAt: createdAt.toISOString(), fieldMetadataUniversalIdentifier: - defaultFlatFieldForCustomObjectMaps.fields.searchVectorField + defaultFlatFieldForCustomObjectMaps.fields.searchVector .universalIdentifier, indexMetadataUniversalIdentifier: tsFlatVectorIndexUniversalIdentifier, diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-relation-flat-field-metadatas-for-custom-object.util.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-relation-flat-field-metadatas-for-custom-object.util.ts index b567f912ed..106fafa44c 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-relation-flat-field-metadatas-for-custom-object.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/build-default-relation-flat-field-metadatas-for-custom-object.util.ts @@ -149,7 +149,7 @@ export const buildDefaultRelationFlatFieldMetadatasForCustomObject = ({ type: FieldMetadataType.RELATION, name: targetFlatObjectMetadata.namePlural, label: capitalize(targetFlatObjectMetadata.labelPlural), - isSystem: true, + isSystem: false, relationCreationPayload: { type: RelationType.ONE_TO_MANY, targetObjectMetadataId: targetFlatObjectMetadata.id, diff --git a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/object-metadata-graphql-api-exception-handler.util.ts b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/object-metadata-graphql-api-exception-handler.util.ts index b86a09af70..94ae1236dc 100644 --- a/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/object-metadata-graphql-api-exception-handler.util.ts +++ b/packages/twenty-server/src/engine/metadata-modules/object-metadata/utils/object-metadata-graphql-api-exception-handler.util.ts @@ -45,6 +45,9 @@ export const objectMetadataGraphqlApiExceptionHandler = ( case ObjectMetadataExceptionCode.MISSING_CUSTOM_OBJECT_DEFAULT_LABEL_IDENTIFIER_FIELD: case ObjectMetadataExceptionCode.APPLICATION_NOT_FOUND: throw error; + case ObjectMetadataExceptionCode.MISSING_SYSTEM_FIELD: + case ObjectMetadataExceptionCode.INVALID_SYSTEM_FIELD: + throw new UserInputError(error); default: { return assertUnreachable(error.code); } diff --git a/packages/twenty-server/src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util.ts b/packages/twenty-server/src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util.ts new file mode 100644 index 0000000000..675b391472 --- /dev/null +++ b/packages/twenty-server/src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util.ts @@ -0,0 +1,8 @@ +import { TWENTY_STANDARD_APPLICATION } from 'src/engine/workspace-manager/twenty-standard-application/constants/twenty-standard-applications'; +import { type WorkspaceMigrationBuilderOptions } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type'; + +export const isCallerTwentyStandardApp = ( + buildOptions: WorkspaceMigrationBuilderOptions, +) => + buildOptions.applicationUniversalIdentifier === + TWENTY_STANDARD_APPLICATION.universalIdentifier; diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service.ts index 0630800707..5d4a0e3c21 100644 --- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/core/services/dev-seeder-permissions.service.ts @@ -44,10 +44,12 @@ export class DevSeederPermissionsService { public async initPermissions({ twentyStandardFlatApplication, + workspaceCustomFlatApplication, workspaceId, }: { workspaceId: string; twentyStandardFlatApplication: FlatApplication; + workspaceCustomFlatApplication: FlatApplication; }) { const adminRole = await this.roleRepository.findOne({ where: { @@ -88,7 +90,7 @@ export class DevSeederPermissionsService { const guestRole = await this.roleService.createGuestRole({ workspaceId, - ownerFlatApplication: twentyStandardFlatApplication, + ownerFlatApplication: workspaceCustomFlatApplication, }); await this.userRoleService.assignRoleToManyUserWorkspace({ @@ -99,7 +101,7 @@ export class DevSeederPermissionsService { const limitedRole = await this.createLimitedRoleForSeedWorkspace({ workspaceId, - ownerFlatApplication: twentyStandardFlatApplication, + ownerFlatApplication: workspaceCustomFlatApplication, }); await this.userRoleService.assignRoleToManyUserWorkspace({ @@ -130,7 +132,7 @@ export class DevSeederPermissionsService { const memberRole = await this.roleService.createMemberRole({ workspaceId, - ownerFlatApplication: twentyStandardFlatApplication, + ownerFlatApplication: workspaceCustomFlatApplication, }); await this.coreDataSource diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/services/dev-seeder.service.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/services/dev-seeder.service.ts index c0666219df..8d6e5f5141 100644 --- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/services/dev-seeder.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/services/dev-seeder.service.ts @@ -95,6 +95,7 @@ export class DevSeederService { await this.devSeederPermissionsService.initPermissions({ workspaceId, twentyStandardFlatApplication, + workspaceCustomFlatApplication, }); await seedPageLayouts( diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/services/twenty-standard-application.service.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/services/twenty-standard-application.service.ts index b1cdad517d..fc9bffccfa 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/services/twenty-standard-application.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/services/twenty-standard-application.service.ts @@ -113,14 +113,14 @@ export class TwentyStandardApplicationService { buildOptions: { isSystemBuild: true, inferDeletionFromMissingEntities: true, + applicationUniversalIdentifier: + twentyStandardFlatApplication.universalIdentifier, }, fromToAllFlatEntityMaps, workspaceId, additionalCacheDataMaps: { featureFlagsMap, }, - applicationUniversalIdentifier: - twentyStandardFlatApplication.universalIdentifier, idByUniversalIdentifierByMetadataName, }, ); diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap index 8bc85f4d4c..130f02a409 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/__tests__/__snapshots__/get-standard-object-metadata-related-entity-ids.util.spec.ts.snap @@ -28,6 +28,12 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "name": { "id": "00000000-0000-0000-0000-000000000005", }, + "position": { + "id": "00000000-0000-0000-0000-000000000018", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000019", + }, "targetCompany": { "id": "00000000-0000-0000-0000-000000000014", }, @@ -56,45 +62,45 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "id": "00000000-0000-0000-0000-000000000010", }, }, - "id": "00000000-0000-0000-0000-000000000030", + "id": "00000000-0000-0000-0000-000000000032", "views": { "allAttachments": { - "id": "00000000-0000-0000-0000-000000000029", + "id": "00000000-0000-0000-0000-000000000031", "viewFieldGroups": {}, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000021", - }, - "createdBy": { - "id": "00000000-0000-0000-0000-000000000020", - }, - "file": { - "id": "00000000-0000-0000-0000-000000000019", - }, - "name": { - "id": "00000000-0000-0000-0000-000000000018", - }, - "targetCompany": { "id": "00000000-0000-0000-0000-000000000023", }, - "targetDashboard": { - "id": "00000000-0000-0000-0000-000000000027", - }, - "targetNote": { - "id": "00000000-0000-0000-0000-000000000026", - }, - "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000024", - }, - "targetPerson": { + "createdBy": { "id": "00000000-0000-0000-0000-000000000022", }, - "targetTask": { + "file": { + "id": "00000000-0000-0000-0000-000000000021", + }, + "name": { + "id": "00000000-0000-0000-0000-000000000020", + }, + "targetCompany": { "id": "00000000-0000-0000-0000-000000000025", }, - "targetWorkflow": { + "targetDashboard": { + "id": "00000000-0000-0000-0000-000000000029", + }, + "targetNote": { "id": "00000000-0000-0000-0000-000000000028", }, + "targetOpportunity": { + "id": "00000000-0000-0000-0000-000000000026", + }, + "targetPerson": { + "id": "00000000-0000-0000-0000-000000000024", + }, + "targetTask": { + "id": "00000000-0000-0000-0000-000000000027", + }, + "targetWorkflow": { + "id": "00000000-0000-0000-0000-000000000030", + }, }, "viewGroups": {}, }, @@ -103,200 +109,248 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "blocklist": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000032", - }, - "deletedAt": { "id": "00000000-0000-0000-0000-000000000034", }, - "handle": { - "id": "00000000-0000-0000-0000-000000000035", + "createdBy": { + "id": "00000000-0000-0000-0000-000000000039", }, - "id": { - "id": "00000000-0000-0000-0000-000000000031", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000033", - }, - "workspaceMember": { + "deletedAt": { "id": "00000000-0000-0000-0000-000000000036", }, + "handle": { + "id": "00000000-0000-0000-0000-000000000037", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000033", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000041", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000042", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000035", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000040", + }, + "workspaceMember": { + "id": "00000000-0000-0000-0000-000000000038", + }, }, - "id": "00000000-0000-0000-0000-000000000037", + "id": "00000000-0000-0000-0000-000000000043", "views": undefined, }, "calendarChannel": { "fields": { "calendarChannelEventAssociations": { - "id": "00000000-0000-0000-0000-000000000058", + "id": "00000000-0000-0000-0000-000000000068", }, "connectedAccount": { - "id": "00000000-0000-0000-0000-000000000051", - }, - "contactAutoCreationPolicy": { - "id": "00000000-0000-0000-0000-000000000055", - }, - "createdAt": { - "id": "00000000-0000-0000-0000-000000000048", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000050", - }, - "handle": { - "id": "00000000-0000-0000-0000-000000000052", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000047", - }, - "isContactAutoCreationEnabled": { - "id": "00000000-0000-0000-0000-000000000054", - }, - "isSyncEnabled": { - "id": "00000000-0000-0000-0000-000000000056", - }, - "syncCursor": { - "id": "00000000-0000-0000-0000-000000000057", - }, - "syncStage": { "id": "00000000-0000-0000-0000-000000000061", }, - "syncStageStartedAt": { - "id": "00000000-0000-0000-0000-000000000062", + "contactAutoCreationPolicy": { + "id": "00000000-0000-0000-0000-000000000065", }, - "syncStatus": { + "createdAt": { + "id": "00000000-0000-0000-0000-000000000058", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000074", + }, + "deletedAt": { "id": "00000000-0000-0000-0000-000000000060", }, + "handle": { + "id": "00000000-0000-0000-0000-000000000062", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000057", + }, + "isContactAutoCreationEnabled": { + "id": "00000000-0000-0000-0000-000000000064", + }, + "isSyncEnabled": { + "id": "00000000-0000-0000-0000-000000000066", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000076", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000077", + }, + "syncCursor": { + "id": "00000000-0000-0000-0000-000000000067", + }, + "syncStage": { + "id": "00000000-0000-0000-0000-000000000071", + }, + "syncStageStartedAt": { + "id": "00000000-0000-0000-0000-000000000072", + }, + "syncStatus": { + "id": "00000000-0000-0000-0000-000000000070", + }, "syncedAt": { - "id": "00000000-0000-0000-0000-000000000063", + "id": "00000000-0000-0000-0000-000000000073", }, "throttleFailureCount": { - "id": "00000000-0000-0000-0000-000000000059", + "id": "00000000-0000-0000-0000-000000000069", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000049", + "id": "00000000-0000-0000-0000-000000000059", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000075", }, "visibility": { - "id": "00000000-0000-0000-0000-000000000053", + "id": "00000000-0000-0000-0000-000000000063", }, }, - "id": "00000000-0000-0000-0000-000000000064", + "id": "00000000-0000-0000-0000-000000000078", "views": undefined, }, "calendarChannelEventAssociation": { "fields": { "calendarChannel": { - "id": "00000000-0000-0000-0000-000000000042", + "id": "00000000-0000-0000-0000-000000000048", }, "calendarEvent": { - "id": "00000000-0000-0000-0000-000000000043", + "id": "00000000-0000-0000-0000-000000000049", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000039", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000041", - }, - "eventExternalId": { - "id": "00000000-0000-0000-0000-000000000044", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000038", - }, - "recurringEventExternalId": { "id": "00000000-0000-0000-0000-000000000045", }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000052", + }, + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000047", + }, + "eventExternalId": { + "id": "00000000-0000-0000-0000-000000000050", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000044", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000054", + }, + "recurringEventExternalId": { + "id": "00000000-0000-0000-0000-000000000051", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000055", + }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000040", + "id": "00000000-0000-0000-0000-000000000046", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000053", }, }, - "id": "00000000-0000-0000-0000-000000000046", + "id": "00000000-0000-0000-0000-000000000056", "views": undefined, }, "calendarEvent": { "fields": { "calendarChannelEventAssociations": { - "id": "00000000-0000-0000-0000-000000000093", + "id": "00000000-0000-0000-0000-000000000111", }, "calendarEventParticipants": { - "id": "00000000-0000-0000-0000-000000000094", + "id": "00000000-0000-0000-0000-000000000112", }, "conferenceLink": { - "id": "00000000-0000-0000-0000-000000000092", + "id": "00000000-0000-0000-0000-000000000110", }, "conferenceSolution": { - "id": "00000000-0000-0000-0000-000000000091", + "id": "00000000-0000-0000-0000-000000000109", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000078", + "id": "00000000-0000-0000-0000-000000000096", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000113", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000080", + "id": "00000000-0000-0000-0000-000000000098", }, "description": { - "id": "00000000-0000-0000-0000-000000000088", + "id": "00000000-0000-0000-0000-000000000106", }, "endsAt": { - "id": "00000000-0000-0000-0000-000000000085", + "id": "00000000-0000-0000-0000-000000000103", }, "externalCreatedAt": { - "id": "00000000-0000-0000-0000-000000000086", + "id": "00000000-0000-0000-0000-000000000104", }, "externalUpdatedAt": { - "id": "00000000-0000-0000-0000-000000000087", + "id": "00000000-0000-0000-0000-000000000105", }, "iCalUid": { - "id": "00000000-0000-0000-0000-000000000090", + "id": "00000000-0000-0000-0000-000000000108", }, "id": { - "id": "00000000-0000-0000-0000-000000000077", + "id": "00000000-0000-0000-0000-000000000095", }, "isCanceled": { - "id": "00000000-0000-0000-0000-000000000082", + "id": "00000000-0000-0000-0000-000000000100", }, "isFullDay": { - "id": "00000000-0000-0000-0000-000000000083", + "id": "00000000-0000-0000-0000-000000000101", }, "location": { - "id": "00000000-0000-0000-0000-000000000089", + "id": "00000000-0000-0000-0000-000000000107", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000115", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000116", }, "startsAt": { - "id": "00000000-0000-0000-0000-000000000084", + "id": "00000000-0000-0000-0000-000000000102", }, "title": { - "id": "00000000-0000-0000-0000-000000000081", + "id": "00000000-0000-0000-0000-000000000099", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000079", + "id": "00000000-0000-0000-0000-000000000097", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000114", }, }, - "id": "00000000-0000-0000-0000-000000000104", + "id": "00000000-0000-0000-0000-000000000126", "views": { "allCalendarEvents": { - "id": "00000000-0000-0000-0000-000000000103", + "id": "00000000-0000-0000-0000-000000000125", "viewFieldGroups": {}, "viewFields": { "conferenceLink": { - "id": "00000000-0000-0000-0000-000000000100", + "id": "00000000-0000-0000-0000-000000000122", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000102", + "id": "00000000-0000-0000-0000-000000000124", }, "endsAt": { - "id": "00000000-0000-0000-0000-000000000097", + "id": "00000000-0000-0000-0000-000000000119", }, "isCanceled": { - "id": "00000000-0000-0000-0000-000000000101", + "id": "00000000-0000-0000-0000-000000000123", }, "isFullDay": { - "id": "00000000-0000-0000-0000-000000000098", + "id": "00000000-0000-0000-0000-000000000120", }, "location": { - "id": "00000000-0000-0000-0000-000000000099", + "id": "00000000-0000-0000-0000-000000000121", }, "startsAt": { - "id": "00000000-0000-0000-0000-000000000096", + "id": "00000000-0000-0000-0000-000000000118", }, "title": { - "id": "00000000-0000-0000-0000-000000000095", + "id": "00000000-0000-0000-0000-000000000117", }, }, "viewGroups": {}, @@ -306,193 +360,205 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "calendarEventParticipant": { "fields": { "calendarEvent": { - "id": "00000000-0000-0000-0000-000000000069", + "id": "00000000-0000-0000-0000-000000000083", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000066", + "id": "00000000-0000-0000-0000-000000000080", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000090", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000068", + "id": "00000000-0000-0000-0000-000000000082", }, "displayName": { - "id": "00000000-0000-0000-0000-000000000071", + "id": "00000000-0000-0000-0000-000000000085", }, "handle": { - "id": "00000000-0000-0000-0000-000000000070", + "id": "00000000-0000-0000-0000-000000000084", }, "id": { - "id": "00000000-0000-0000-0000-000000000065", + "id": "00000000-0000-0000-0000-000000000079", }, "isOrganizer": { - "id": "00000000-0000-0000-0000-000000000072", + "id": "00000000-0000-0000-0000-000000000086", }, "person": { - "id": "00000000-0000-0000-0000-000000000074", + "id": "00000000-0000-0000-0000-000000000088", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000092", }, "responseStatus": { - "id": "00000000-0000-0000-0000-000000000073", + "id": "00000000-0000-0000-0000-000000000087", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000093", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000067", + "id": "00000000-0000-0000-0000-000000000081", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000091", }, "workspaceMember": { - "id": "00000000-0000-0000-0000-000000000075", + "id": "00000000-0000-0000-0000-000000000089", }, }, - "id": "00000000-0000-0000-0000-000000000076", + "id": "00000000-0000-0000-0000-000000000094", "views": undefined, }, "company": { "fields": { "accountOwner": { - "id": "00000000-0000-0000-0000-000000000121", + "id": "00000000-0000-0000-0000-000000000143", }, "address": { - "id": "00000000-0000-0000-0000-000000000111", + "id": "00000000-0000-0000-0000-000000000133", }, "annualRecurringRevenue": { - "id": "00000000-0000-0000-0000-000000000115", + "id": "00000000-0000-0000-0000-000000000137", }, "attachments": { - "id": "00000000-0000-0000-0000-000000000126", + "id": "00000000-0000-0000-0000-000000000148", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000106", - }, - "createdBy": { - "id": "00000000-0000-0000-0000-000000000118", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000108", - }, - "domainName": { - "id": "00000000-0000-0000-0000-000000000110", - }, - "employees": { - "id": "00000000-0000-0000-0000-000000000112", - }, - "favorites": { - "id": "00000000-0000-0000-0000-000000000125", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000105", - }, - "idealCustomerProfile": { - "id": "00000000-0000-0000-0000-000000000116", - }, - "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000113", - }, - "name": { - "id": "00000000-0000-0000-0000-000000000109", - }, - "noteTargets": { - "id": "00000000-0000-0000-0000-000000000123", - }, - "opportunities": { - "id": "00000000-0000-0000-0000-000000000124", - }, - "people": { - "id": "00000000-0000-0000-0000-000000000120", - }, - "position": { - "id": "00000000-0000-0000-0000-000000000117", - }, - "searchVector": { "id": "00000000-0000-0000-0000-000000000128", }, - "taskTargets": { - "id": "00000000-0000-0000-0000-000000000122", + "createdBy": { + "id": "00000000-0000-0000-0000-000000000140", }, - "timelineActivities": { + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000130", + }, + "domainName": { + "id": "00000000-0000-0000-0000-000000000132", + }, + "employees": { + "id": "00000000-0000-0000-0000-000000000134", + }, + "favorites": { + "id": "00000000-0000-0000-0000-000000000147", + }, + "id": { "id": "00000000-0000-0000-0000-000000000127", }, + "idealCustomerProfile": { + "id": "00000000-0000-0000-0000-000000000138", + }, + "linkedinLink": { + "id": "00000000-0000-0000-0000-000000000135", + }, + "name": { + "id": "00000000-0000-0000-0000-000000000131", + }, + "noteTargets": { + "id": "00000000-0000-0000-0000-000000000145", + }, + "opportunities": { + "id": "00000000-0000-0000-0000-000000000146", + }, + "people": { + "id": "00000000-0000-0000-0000-000000000142", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000139", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000150", + }, + "taskTargets": { + "id": "00000000-0000-0000-0000-000000000144", + }, + "timelineActivities": { + "id": "00000000-0000-0000-0000-000000000149", + }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000107", + "id": "00000000-0000-0000-0000-000000000129", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000119", + "id": "00000000-0000-0000-0000-000000000141", }, "xLink": { - "id": "00000000-0000-0000-0000-000000000114", + "id": "00000000-0000-0000-0000-000000000136", }, }, - "id": "00000000-0000-0000-0000-000000000152", + "id": "00000000-0000-0000-0000-000000000174", "views": { "allCompanies": { - "id": "00000000-0000-0000-0000-000000000137", + "id": "00000000-0000-0000-0000-000000000159", "viewFieldGroups": {}, "viewFields": { "accountOwner": { - "id": "00000000-0000-0000-0000-000000000132", + "id": "00000000-0000-0000-0000-000000000154", }, "address": { - "id": "00000000-0000-0000-0000-000000000136", + "id": "00000000-0000-0000-0000-000000000158", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000133", + "id": "00000000-0000-0000-0000-000000000155", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000131", + "id": "00000000-0000-0000-0000-000000000153", }, "domainName": { - "id": "00000000-0000-0000-0000-000000000130", + "id": "00000000-0000-0000-0000-000000000152", }, "employees": { - "id": "00000000-0000-0000-0000-000000000134", + "id": "00000000-0000-0000-0000-000000000156", }, "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000135", + "id": "00000000-0000-0000-0000-000000000157", }, "name": { - "id": "00000000-0000-0000-0000-000000000129", + "id": "00000000-0000-0000-0000-000000000151", }, }, "viewGroups": {}, }, "companyRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000151", + "id": "00000000-0000-0000-0000-000000000173", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000149", + "id": "00000000-0000-0000-0000-000000000171", }, "general": { - "id": "00000000-0000-0000-0000-000000000148", + "id": "00000000-0000-0000-0000-000000000170", }, "other": { - "id": "00000000-0000-0000-0000-000000000150", + "id": "00000000-0000-0000-0000-000000000172", }, }, "viewFields": { "accountOwner": { - "id": "00000000-0000-0000-0000-000000000139", + "id": "00000000-0000-0000-0000-000000000161", }, "address": { - "id": "00000000-0000-0000-0000-000000000145", + "id": "00000000-0000-0000-0000-000000000167", }, "annualRecurringRevenue": { - "id": "00000000-0000-0000-0000-000000000140", + "id": "00000000-0000-0000-0000-000000000162", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000146", + "id": "00000000-0000-0000-0000-000000000168", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000147", + "id": "00000000-0000-0000-0000-000000000169", }, "domainName": { - "id": "00000000-0000-0000-0000-000000000138", + "id": "00000000-0000-0000-0000-000000000160", }, "employees": { - "id": "00000000-0000-0000-0000-000000000142", + "id": "00000000-0000-0000-0000-000000000164", }, "idealCustomerProfile": { - "id": "00000000-0000-0000-0000-000000000141", + "id": "00000000-0000-0000-0000-000000000163", }, "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000143", + "id": "00000000-0000-0000-0000-000000000165", }, "xLink": { - "id": "00000000-0000-0000-0000-000000000144", + "id": "00000000-0000-0000-0000-000000000166", }, }, "viewGroups": {}, @@ -502,119 +568,131 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "connectedAccount": { "fields": { "accessToken": { - "id": "00000000-0000-0000-0000-000000000159", + "id": "00000000-0000-0000-0000-000000000181", }, "accountOwner": { - "id": "00000000-0000-0000-0000-000000000161", + "id": "00000000-0000-0000-0000-000000000183", }, "authFailedAt": { - "id": "00000000-0000-0000-0000-000000000163", + "id": "00000000-0000-0000-0000-000000000185", }, "calendarChannels": { - "id": "00000000-0000-0000-0000-000000000166", + "id": "00000000-0000-0000-0000-000000000188", }, "connectionParameters": { - "id": "00000000-0000-0000-0000-000000000169", + "id": "00000000-0000-0000-0000-000000000191", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000154", + "id": "00000000-0000-0000-0000-000000000176", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000192", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000156", + "id": "00000000-0000-0000-0000-000000000178", }, "handle": { - "id": "00000000-0000-0000-0000-000000000157", + "id": "00000000-0000-0000-0000-000000000179", }, "handleAliases": { - "id": "00000000-0000-0000-0000-000000000167", + "id": "00000000-0000-0000-0000-000000000189", }, "id": { - "id": "00000000-0000-0000-0000-000000000153", + "id": "00000000-0000-0000-0000-000000000175", }, "lastCredentialsRefreshedAt": { - "id": "00000000-0000-0000-0000-000000000164", + "id": "00000000-0000-0000-0000-000000000186", }, "lastSyncHistoryId": { - "id": "00000000-0000-0000-0000-000000000162", + "id": "00000000-0000-0000-0000-000000000184", }, "messageChannels": { - "id": "00000000-0000-0000-0000-000000000165", + "id": "00000000-0000-0000-0000-000000000187", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000194", }, "provider": { - "id": "00000000-0000-0000-0000-000000000158", + "id": "00000000-0000-0000-0000-000000000180", }, "refreshToken": { - "id": "00000000-0000-0000-0000-000000000160", + "id": "00000000-0000-0000-0000-000000000182", }, "scopes": { - "id": "00000000-0000-0000-0000-000000000168", + "id": "00000000-0000-0000-0000-000000000190", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000195", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000155", + "id": "00000000-0000-0000-0000-000000000177", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000193", }, }, - "id": "00000000-0000-0000-0000-000000000170", + "id": "00000000-0000-0000-0000-000000000196", "views": undefined, }, "dashboard": { "fields": { "attachments": { - "id": "00000000-0000-0000-0000-000000000182", + "id": "00000000-0000-0000-0000-000000000208", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000172", + "id": "00000000-0000-0000-0000-000000000198", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000178", + "id": "00000000-0000-0000-0000-000000000204", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000174", + "id": "00000000-0000-0000-0000-000000000200", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000181", + "id": "00000000-0000-0000-0000-000000000207", }, "id": { - "id": "00000000-0000-0000-0000-000000000171", + "id": "00000000-0000-0000-0000-000000000197", }, "pageLayoutId": { - "id": "00000000-0000-0000-0000-000000000177", + "id": "00000000-0000-0000-0000-000000000203", }, "position": { - "id": "00000000-0000-0000-0000-000000000176", + "id": "00000000-0000-0000-0000-000000000202", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000183", + "id": "00000000-0000-0000-0000-000000000209", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000180", + "id": "00000000-0000-0000-0000-000000000206", }, "title": { - "id": "00000000-0000-0000-0000-000000000175", + "id": "00000000-0000-0000-0000-000000000201", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000173", + "id": "00000000-0000-0000-0000-000000000199", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000179", + "id": "00000000-0000-0000-0000-000000000205", }, }, - "id": "00000000-0000-0000-0000-000000000189", + "id": "00000000-0000-0000-0000-000000000215", "views": { "allDashboards": { - "id": "00000000-0000-0000-0000-000000000188", + "id": "00000000-0000-0000-0000-000000000214", "viewFieldGroups": {}, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000186", + "id": "00000000-0000-0000-0000-000000000212", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000185", + "id": "00000000-0000-0000-0000-000000000211", }, "title": { - "id": "00000000-0000-0000-0000-000000000184", + "id": "00000000-0000-0000-0000-000000000210", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000187", + "id": "00000000-0000-0000-0000-000000000213", }, }, "viewGroups": {}, @@ -624,152 +702,182 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "favorite": { "fields": { "company": { - "id": "00000000-0000-0000-0000-000000000197", + "id": "00000000-0000-0000-0000-000000000223", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000191", + "id": "00000000-0000-0000-0000-000000000217", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000233", }, "dashboard": { - "id": "00000000-0000-0000-0000-000000000206", + "id": "00000000-0000-0000-0000-000000000232", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000193", + "id": "00000000-0000-0000-0000-000000000219", }, "favoriteFolder": { - "id": "00000000-0000-0000-0000-000000000205", + "id": "00000000-0000-0000-0000-000000000231", }, "forWorkspaceMember": { - "id": "00000000-0000-0000-0000-000000000195", + "id": "00000000-0000-0000-0000-000000000221", }, "id": { - "id": "00000000-0000-0000-0000-000000000190", + "id": "00000000-0000-0000-0000-000000000216", }, "note": { - "id": "00000000-0000-0000-0000-000000000203", + "id": "00000000-0000-0000-0000-000000000229", }, "opportunity": { - "id": "00000000-0000-0000-0000-000000000198", + "id": "00000000-0000-0000-0000-000000000224", }, "person": { - "id": "00000000-0000-0000-0000-000000000196", + "id": "00000000-0000-0000-0000-000000000222", }, "position": { - "id": "00000000-0000-0000-0000-000000000194", + "id": "00000000-0000-0000-0000-000000000220", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000235", }, "task": { - "id": "00000000-0000-0000-0000-000000000202", + "id": "00000000-0000-0000-0000-000000000228", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000192", + "id": "00000000-0000-0000-0000-000000000218", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000234", }, "viewId": { - "id": "00000000-0000-0000-0000-000000000204", + "id": "00000000-0000-0000-0000-000000000230", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000199", + "id": "00000000-0000-0000-0000-000000000225", }, "workflowRun": { - "id": "00000000-0000-0000-0000-000000000201", + "id": "00000000-0000-0000-0000-000000000227", }, "workflowVersion": { - "id": "00000000-0000-0000-0000-000000000200", + "id": "00000000-0000-0000-0000-000000000226", }, }, - "id": "00000000-0000-0000-0000-000000000207", + "id": "00000000-0000-0000-0000-000000000236", "views": undefined, }, "favoriteFolder": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000209", + "id": "00000000-0000-0000-0000-000000000238", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000244", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000211", + "id": "00000000-0000-0000-0000-000000000240", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000214", + "id": "00000000-0000-0000-0000-000000000243", }, "id": { - "id": "00000000-0000-0000-0000-000000000208", + "id": "00000000-0000-0000-0000-000000000237", }, "name": { - "id": "00000000-0000-0000-0000-000000000213", + "id": "00000000-0000-0000-0000-000000000242", }, "position": { - "id": "00000000-0000-0000-0000-000000000212", + "id": "00000000-0000-0000-0000-000000000241", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000246", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000210", + "id": "00000000-0000-0000-0000-000000000239", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000245", }, }, - "id": "00000000-0000-0000-0000-000000000215", + "id": "00000000-0000-0000-0000-000000000247", "views": undefined, }, "message": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000296", + "id": "00000000-0000-0000-0000-000000000352", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000363", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000298", + "id": "00000000-0000-0000-0000-000000000354", }, "direction": { - "id": "00000000-0000-0000-0000-000000000301", + "id": "00000000-0000-0000-0000-000000000357", }, "headerMessageId": { - "id": "00000000-0000-0000-0000-000000000299", + "id": "00000000-0000-0000-0000-000000000355", }, "id": { - "id": "00000000-0000-0000-0000-000000000295", + "id": "00000000-0000-0000-0000-000000000351", }, "messageChannelMessageAssociations": { - "id": "00000000-0000-0000-0000-000000000306", + "id": "00000000-0000-0000-0000-000000000362", }, "messageParticipants": { - "id": "00000000-0000-0000-0000-000000000305", + "id": "00000000-0000-0000-0000-000000000361", }, "messageThread": { - "id": "00000000-0000-0000-0000-000000000300", + "id": "00000000-0000-0000-0000-000000000356", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000365", }, "receivedAt": { - "id": "00000000-0000-0000-0000-000000000304", + "id": "00000000-0000-0000-0000-000000000360", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000366", }, "subject": { - "id": "00000000-0000-0000-0000-000000000302", + "id": "00000000-0000-0000-0000-000000000358", }, "text": { - "id": "00000000-0000-0000-0000-000000000303", + "id": "00000000-0000-0000-0000-000000000359", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000297", + "id": "00000000-0000-0000-0000-000000000353", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000364", }, }, - "id": "00000000-0000-0000-0000-000000000315", + "id": "00000000-0000-0000-0000-000000000375", "views": { "allMessages": { - "id": "00000000-0000-0000-0000-000000000314", + "id": "00000000-0000-0000-0000-000000000374", "viewFieldGroups": {}, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000313", + "id": "00000000-0000-0000-0000-000000000373", }, "headerMessageId": { - "id": "00000000-0000-0000-0000-000000000311", + "id": "00000000-0000-0000-0000-000000000371", }, "messageParticipants": { - "id": "00000000-0000-0000-0000-000000000309", + "id": "00000000-0000-0000-0000-000000000369", }, "messageThread": { - "id": "00000000-0000-0000-0000-000000000308", + "id": "00000000-0000-0000-0000-000000000368", }, "receivedAt": { - "id": "00000000-0000-0000-0000-000000000310", + "id": "00000000-0000-0000-0000-000000000370", }, "subject": { - "id": "00000000-0000-0000-0000-000000000307", + "id": "00000000-0000-0000-0000-000000000367", }, "text": { - "id": "00000000-0000-0000-0000-000000000312", + "id": "00000000-0000-0000-0000-000000000372", }, }, "viewGroups": {}, @@ -779,257 +887,329 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "messageChannel": { "fields": { "connectedAccount": { - "id": "00000000-0000-0000-0000-000000000241", + "id": "00000000-0000-0000-0000-000000000281", }, "contactAutoCreationPolicy": { - "id": "00000000-0000-0000-0000-000000000244", + "id": "00000000-0000-0000-0000-000000000284", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000236", + "id": "00000000-0000-0000-0000-000000000276", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000299", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000238", + "id": "00000000-0000-0000-0000-000000000278", }, "excludeGroupEmails": { - "id": "00000000-0000-0000-0000-000000000246", + "id": "00000000-0000-0000-0000-000000000286", }, "excludeNonProfessionalEmails": { - "id": "00000000-0000-0000-0000-000000000245", - }, - "handle": { - "id": "00000000-0000-0000-0000-000000000240", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000235", - }, - "isContactAutoCreationEnabled": { - "id": "00000000-0000-0000-0000-000000000243", - }, - "isSyncEnabled": { - "id": "00000000-0000-0000-0000-000000000251", - }, - "messageChannelMessageAssociations": { - "id": "00000000-0000-0000-0000-000000000247", - }, - "messageFolderImportPolicy": { - "id": "00000000-0000-0000-0000-000000000249", - }, - "messageFolders": { - "id": "00000000-0000-0000-0000-000000000248", - }, - "pendingGroupEmailsAction": { - "id": "00000000-0000-0000-0000-000000000250", - }, - "syncCursor": { - "id": "00000000-0000-0000-0000-000000000252", - }, - "syncStage": { - "id": "00000000-0000-0000-0000-000000000255", - }, - "syncStageStartedAt": { - "id": "00000000-0000-0000-0000-000000000256", - }, - "syncStatus": { - "id": "00000000-0000-0000-0000-000000000254", - }, - "syncedAt": { - "id": "00000000-0000-0000-0000-000000000253", - }, - "throttleFailureCount": { - "id": "00000000-0000-0000-0000-000000000257", - }, - "throttleRetryAfter": { - "id": "00000000-0000-0000-0000-000000000258", - }, - "type": { - "id": "00000000-0000-0000-0000-000000000242", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000237", - }, - "visibility": { - "id": "00000000-0000-0000-0000-000000000239", - }, - }, - "id": "00000000-0000-0000-0000-000000000259", - "views": undefined, - }, - "messageChannelMessageAssociation": { - "fields": { - "createdAt": { - "id": "00000000-0000-0000-0000-000000000217", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000219", - }, - "direction": { - "id": "00000000-0000-0000-0000-000000000225", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000216", - }, - "message": { - "id": "00000000-0000-0000-0000-000000000221", - }, - "messageChannel": { - "id": "00000000-0000-0000-0000-000000000220", - }, - "messageExternalId": { - "id": "00000000-0000-0000-0000-000000000222", - }, - "messageFolders": { - "id": "00000000-0000-0000-0000-000000000226", - }, - "messageThread": { - "id": "00000000-0000-0000-0000-000000000223", - }, - "messageThreadExternalId": { - "id": "00000000-0000-0000-0000-000000000224", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000218", - }, - }, - "id": "00000000-0000-0000-0000-000000000227", - "views": undefined, - }, - "messageChannelMessageAssociationMessageFolder": { - "fields": { - "createdAt": { - "id": "00000000-0000-0000-0000-000000000229", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000231", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000228", - }, - "messageChannelMessageAssociation": { - "id": "00000000-0000-0000-0000-000000000232", - }, - "messageFolder": { - "id": "00000000-0000-0000-0000-000000000233", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000230", - }, - }, - "id": "00000000-0000-0000-0000-000000000234", - "views": undefined, - }, - "messageFolder": { - "fields": { - "createdAt": { - "id": "00000000-0000-0000-0000-000000000261", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000263", - }, - "externalId": { - "id": "00000000-0000-0000-0000-000000000270", - }, - "id": { - "id": "00000000-0000-0000-0000-000000000260", - }, - "isSentFolder": { - "id": "00000000-0000-0000-0000-000000000268", - }, - "isSynced": { - "id": "00000000-0000-0000-0000-000000000269", - }, - "messageChannel": { - "id": "00000000-0000-0000-0000-000000000266", - }, - "messageChannelMessageAssociationMessageFolders": { - "id": "00000000-0000-0000-0000-000000000272", - }, - "name": { - "id": "00000000-0000-0000-0000-000000000264", - }, - "parentFolderId": { - "id": "00000000-0000-0000-0000-000000000265", - }, - "pendingSyncAction": { - "id": "00000000-0000-0000-0000-000000000271", - }, - "syncCursor": { - "id": "00000000-0000-0000-0000-000000000267", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000262", - }, - }, - "id": "00000000-0000-0000-0000-000000000273", - "views": undefined, - }, - "messageParticipant": { - "fields": { - "createdAt": { - "id": "00000000-0000-0000-0000-000000000275", - }, - "deletedAt": { - "id": "00000000-0000-0000-0000-000000000277", - }, - "displayName": { - "id": "00000000-0000-0000-0000-000000000281", + "id": "00000000-0000-0000-0000-000000000285", }, "handle": { "id": "00000000-0000-0000-0000-000000000280", }, "id": { - "id": "00000000-0000-0000-0000-000000000274", + "id": "00000000-0000-0000-0000-000000000275", }, - "message": { - "id": "00000000-0000-0000-0000-000000000278", - }, - "person": { - "id": "00000000-0000-0000-0000-000000000282", - }, - "role": { - "id": "00000000-0000-0000-0000-000000000279", - }, - "updatedAt": { - "id": "00000000-0000-0000-0000-000000000276", - }, - "workspaceMember": { + "isContactAutoCreationEnabled": { "id": "00000000-0000-0000-0000-000000000283", }, + "isSyncEnabled": { + "id": "00000000-0000-0000-0000-000000000291", + }, + "messageChannelMessageAssociations": { + "id": "00000000-0000-0000-0000-000000000287", + }, + "messageFolderImportPolicy": { + "id": "00000000-0000-0000-0000-000000000289", + }, + "messageFolders": { + "id": "00000000-0000-0000-0000-000000000288", + }, + "pendingGroupEmailsAction": { + "id": "00000000-0000-0000-0000-000000000290", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000301", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000302", + }, + "syncCursor": { + "id": "00000000-0000-0000-0000-000000000292", + }, + "syncStage": { + "id": "00000000-0000-0000-0000-000000000295", + }, + "syncStageStartedAt": { + "id": "00000000-0000-0000-0000-000000000296", + }, + "syncStatus": { + "id": "00000000-0000-0000-0000-000000000294", + }, + "syncedAt": { + "id": "00000000-0000-0000-0000-000000000293", + }, + "throttleFailureCount": { + "id": "00000000-0000-0000-0000-000000000297", + }, + "throttleRetryAfter": { + "id": "00000000-0000-0000-0000-000000000298", + }, + "type": { + "id": "00000000-0000-0000-0000-000000000282", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000277", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000300", + }, + "visibility": { + "id": "00000000-0000-0000-0000-000000000279", + }, }, - "id": "00000000-0000-0000-0000-000000000284", + "id": "00000000-0000-0000-0000-000000000303", + "views": undefined, + }, + "messageChannelMessageAssociation": { + "fields": { + "createdAt": { + "id": "00000000-0000-0000-0000-000000000249", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000258", + }, + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000251", + }, + "direction": { + "id": "00000000-0000-0000-0000-000000000257", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000248", + }, + "message": { + "id": "00000000-0000-0000-0000-000000000253", + }, + "messageChannel": { + "id": "00000000-0000-0000-0000-000000000252", + }, + "messageExternalId": { + "id": "00000000-0000-0000-0000-000000000254", + }, + "messageFolders": { + "id": "00000000-0000-0000-0000-000000000262", + }, + "messageThread": { + "id": "00000000-0000-0000-0000-000000000255", + }, + "messageThreadExternalId": { + "id": "00000000-0000-0000-0000-000000000256", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000260", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000261", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000250", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000259", + }, + }, + "id": "00000000-0000-0000-0000-000000000263", + "views": undefined, + }, + "messageChannelMessageAssociationMessageFolder": { + "fields": { + "createdAt": { + "id": "00000000-0000-0000-0000-000000000265", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000268", + }, + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000267", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000264", + }, + "messageChannelMessageAssociation": { + "id": "00000000-0000-0000-0000-000000000272", + }, + "messageFolder": { + "id": "00000000-0000-0000-0000-000000000273", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000270", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000271", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000266", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000269", + }, + }, + "id": "00000000-0000-0000-0000-000000000274", + "views": undefined, + }, + "messageFolder": { + "fields": { + "createdAt": { + "id": "00000000-0000-0000-0000-000000000305", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000316", + }, + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000307", + }, + "externalId": { + "id": "00000000-0000-0000-0000-000000000314", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000304", + }, + "isSentFolder": { + "id": "00000000-0000-0000-0000-000000000312", + }, + "isSynced": { + "id": "00000000-0000-0000-0000-000000000313", + }, + "messageChannel": { + "id": "00000000-0000-0000-0000-000000000310", + }, + "messageChannelMessageAssociationMessageFolders": { + "id": "00000000-0000-0000-0000-000000000320", + }, + "name": { + "id": "00000000-0000-0000-0000-000000000308", + }, + "parentFolderId": { + "id": "00000000-0000-0000-0000-000000000309", + }, + "pendingSyncAction": { + "id": "00000000-0000-0000-0000-000000000315", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000318", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000319", + }, + "syncCursor": { + "id": "00000000-0000-0000-0000-000000000311", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000306", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000317", + }, + }, + "id": "00000000-0000-0000-0000-000000000321", + "views": undefined, + }, + "messageParticipant": { + "fields": { + "createdAt": { + "id": "00000000-0000-0000-0000-000000000323", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000332", + }, + "deletedAt": { + "id": "00000000-0000-0000-0000-000000000325", + }, + "displayName": { + "id": "00000000-0000-0000-0000-000000000329", + }, + "handle": { + "id": "00000000-0000-0000-0000-000000000328", + }, + "id": { + "id": "00000000-0000-0000-0000-000000000322", + }, + "message": { + "id": "00000000-0000-0000-0000-000000000326", + }, + "person": { + "id": "00000000-0000-0000-0000-000000000330", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000334", + }, + "role": { + "id": "00000000-0000-0000-0000-000000000327", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000335", + }, + "updatedAt": { + "id": "00000000-0000-0000-0000-000000000324", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000333", + }, + "workspaceMember": { + "id": "00000000-0000-0000-0000-000000000331", + }, + }, + "id": "00000000-0000-0000-0000-000000000336", "views": undefined, }, "messageThread": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000286", + "id": "00000000-0000-0000-0000-000000000338", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000343", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000288", + "id": "00000000-0000-0000-0000-000000000340", }, "id": { - "id": "00000000-0000-0000-0000-000000000285", + "id": "00000000-0000-0000-0000-000000000337", }, "messageChannelMessageAssociations": { - "id": "00000000-0000-0000-0000-000000000290", + "id": "00000000-0000-0000-0000-000000000342", }, "messages": { - "id": "00000000-0000-0000-0000-000000000289", + "id": "00000000-0000-0000-0000-000000000341", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000345", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000346", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000287", + "id": "00000000-0000-0000-0000-000000000339", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000344", }, }, - "id": "00000000-0000-0000-0000-000000000294", + "id": "00000000-0000-0000-0000-000000000350", "views": { "allMessageThreads": { - "id": "00000000-0000-0000-0000-000000000293", + "id": "00000000-0000-0000-0000-000000000349", "viewFieldGroups": {}, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000292", + "id": "00000000-0000-0000-0000-000000000348", }, "messages": { - "id": "00000000-0000-0000-0000-000000000291", + "id": "00000000-0000-0000-0000-000000000347", }, }, "viewGroups": {}, @@ -1039,94 +1219,94 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "note": { "fields": { "attachments": { - "id": "00000000-0000-0000-0000-000000000326", + "id": "00000000-0000-0000-0000-000000000386", }, "bodyV2": { - "id": "00000000-0000-0000-0000-000000000322", + "id": "00000000-0000-0000-0000-000000000382", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000317", + "id": "00000000-0000-0000-0000-000000000377", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000323", + "id": "00000000-0000-0000-0000-000000000383", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000319", + "id": "00000000-0000-0000-0000-000000000379", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000328", + "id": "00000000-0000-0000-0000-000000000388", }, "id": { - "id": "00000000-0000-0000-0000-000000000316", + "id": "00000000-0000-0000-0000-000000000376", }, "noteTargets": { - "id": "00000000-0000-0000-0000-000000000325", + "id": "00000000-0000-0000-0000-000000000385", }, "position": { - "id": "00000000-0000-0000-0000-000000000320", + "id": "00000000-0000-0000-0000-000000000380", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000329", + "id": "00000000-0000-0000-0000-000000000389", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000327", + "id": "00000000-0000-0000-0000-000000000387", }, "title": { - "id": "00000000-0000-0000-0000-000000000321", + "id": "00000000-0000-0000-0000-000000000381", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000318", + "id": "00000000-0000-0000-0000-000000000378", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000324", + "id": "00000000-0000-0000-0000-000000000384", }, }, - "id": "00000000-0000-0000-0000-000000000343", + "id": "00000000-0000-0000-0000-000000000403", "views": { "allNotes": { - "id": "00000000-0000-0000-0000-000000000335", + "id": "00000000-0000-0000-0000-000000000395", "viewFieldGroups": {}, "viewFields": { "bodyV2": { - "id": "00000000-0000-0000-0000-000000000332", + "id": "00000000-0000-0000-0000-000000000392", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000334", + "id": "00000000-0000-0000-0000-000000000394", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000333", + "id": "00000000-0000-0000-0000-000000000393", }, "noteTargets": { - "id": "00000000-0000-0000-0000-000000000331", + "id": "00000000-0000-0000-0000-000000000391", }, "title": { - "id": "00000000-0000-0000-0000-000000000330", + "id": "00000000-0000-0000-0000-000000000390", }, }, "viewGroups": {}, }, "noteRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000342", + "id": "00000000-0000-0000-0000-000000000402", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000340", + "id": "00000000-0000-0000-0000-000000000400", }, "general": { - "id": "00000000-0000-0000-0000-000000000339", + "id": "00000000-0000-0000-0000-000000000399", }, "other": { - "id": "00000000-0000-0000-0000-000000000341", + "id": "00000000-0000-0000-0000-000000000401", }, }, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000337", + "id": "00000000-0000-0000-0000-000000000397", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000338", + "id": "00000000-0000-0000-0000-000000000398", }, "title": { - "id": "00000000-0000-0000-0000-000000000336", + "id": "00000000-0000-0000-0000-000000000396", }, }, "viewGroups": {}, @@ -1136,50 +1316,62 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "noteTarget": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000345", + "id": "00000000-0000-0000-0000-000000000405", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000412", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000347", + "id": "00000000-0000-0000-0000-000000000407", }, "id": { - "id": "00000000-0000-0000-0000-000000000344", + "id": "00000000-0000-0000-0000-000000000404", }, "note": { - "id": "00000000-0000-0000-0000-000000000348", + "id": "00000000-0000-0000-0000-000000000408", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000414", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000415", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000350", + "id": "00000000-0000-0000-0000-000000000410", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000351", + "id": "00000000-0000-0000-0000-000000000411", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000349", + "id": "00000000-0000-0000-0000-000000000409", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000346", + "id": "00000000-0000-0000-0000-000000000406", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000413", }, }, - "id": "00000000-0000-0000-0000-000000000358", + "id": "00000000-0000-0000-0000-000000000422", "views": { "allNoteTargets": { - "id": "00000000-0000-0000-0000-000000000357", + "id": "00000000-0000-0000-0000-000000000421", "viewFieldGroups": {}, "viewFields": { "id": { - "id": "00000000-0000-0000-0000-000000000352", + "id": "00000000-0000-0000-0000-000000000416", }, "note": { - "id": "00000000-0000-0000-0000-000000000353", + "id": "00000000-0000-0000-0000-000000000417", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000355", + "id": "00000000-0000-0000-0000-000000000419", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000356", + "id": "00000000-0000-0000-0000-000000000420", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000354", + "id": "00000000-0000-0000-0000-000000000418", }, }, "viewGroups": {}, @@ -1189,171 +1381,171 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "opportunity": { "fields": { "amount": { - "id": "00000000-0000-0000-0000-000000000364", + "id": "00000000-0000-0000-0000-000000000428", }, "attachments": { - "id": "00000000-0000-0000-0000-000000000376", + "id": "00000000-0000-0000-0000-000000000440", }, "closeDate": { - "id": "00000000-0000-0000-0000-000000000365", + "id": "00000000-0000-0000-0000-000000000429", }, "company": { - "id": "00000000-0000-0000-0000-000000000371", + "id": "00000000-0000-0000-0000-000000000435", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000360", + "id": "00000000-0000-0000-0000-000000000424", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000368", + "id": "00000000-0000-0000-0000-000000000432", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000362", + "id": "00000000-0000-0000-0000-000000000426", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000373", + "id": "00000000-0000-0000-0000-000000000437", }, "id": { - "id": "00000000-0000-0000-0000-000000000359", + "id": "00000000-0000-0000-0000-000000000423", }, "name": { - "id": "00000000-0000-0000-0000-000000000363", + "id": "00000000-0000-0000-0000-000000000427", }, "noteTargets": { - "id": "00000000-0000-0000-0000-000000000375", + "id": "00000000-0000-0000-0000-000000000439", }, "owner": { - "id": "00000000-0000-0000-0000-000000000372", + "id": "00000000-0000-0000-0000-000000000436", }, "pointOfContact": { - "id": "00000000-0000-0000-0000-000000000370", + "id": "00000000-0000-0000-0000-000000000434", }, "position": { - "id": "00000000-0000-0000-0000-000000000367", + "id": "00000000-0000-0000-0000-000000000431", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000378", + "id": "00000000-0000-0000-0000-000000000442", }, "stage": { - "id": "00000000-0000-0000-0000-000000000366", + "id": "00000000-0000-0000-0000-000000000430", }, "taskTargets": { - "id": "00000000-0000-0000-0000-000000000374", + "id": "00000000-0000-0000-0000-000000000438", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000377", + "id": "00000000-0000-0000-0000-000000000441", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000361", + "id": "00000000-0000-0000-0000-000000000425", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000369", + "id": "00000000-0000-0000-0000-000000000433", }, }, - "id": "00000000-0000-0000-0000-000000000410", + "id": "00000000-0000-0000-0000-000000000474", "views": { "allOpportunities": { - "id": "00000000-0000-0000-0000-000000000385", + "id": "00000000-0000-0000-0000-000000000449", "viewFieldGroups": {}, "viewFields": { "amount": { - "id": "00000000-0000-0000-0000-000000000380", + "id": "00000000-0000-0000-0000-000000000444", }, "closeDate": { - "id": "00000000-0000-0000-0000-000000000382", + "id": "00000000-0000-0000-0000-000000000446", }, "company": { - "id": "00000000-0000-0000-0000-000000000383", + "id": "00000000-0000-0000-0000-000000000447", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000381", + "id": "00000000-0000-0000-0000-000000000445", }, "name": { - "id": "00000000-0000-0000-0000-000000000379", + "id": "00000000-0000-0000-0000-000000000443", }, "pointOfContact": { - "id": "00000000-0000-0000-0000-000000000384", + "id": "00000000-0000-0000-0000-000000000448", }, }, "viewGroups": {}, }, "byStage": { - "id": "00000000-0000-0000-0000-000000000397", + "id": "00000000-0000-0000-0000-000000000461", "viewFieldGroups": {}, "viewFields": { "amount": { - "id": "00000000-0000-0000-0000-000000000387", + "id": "00000000-0000-0000-0000-000000000451", }, "closeDate": { - "id": "00000000-0000-0000-0000-000000000389", + "id": "00000000-0000-0000-0000-000000000453", }, "company": { - "id": "00000000-0000-0000-0000-000000000390", + "id": "00000000-0000-0000-0000-000000000454", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000388", + "id": "00000000-0000-0000-0000-000000000452", }, "name": { - "id": "00000000-0000-0000-0000-000000000386", + "id": "00000000-0000-0000-0000-000000000450", }, "pointOfContact": { - "id": "00000000-0000-0000-0000-000000000391", + "id": "00000000-0000-0000-0000-000000000455", }, }, "viewGroups": { "customer": { - "id": "00000000-0000-0000-0000-000000000396", + "id": "00000000-0000-0000-0000-000000000460", }, "meeting": { - "id": "00000000-0000-0000-0000-000000000394", + "id": "00000000-0000-0000-0000-000000000458", }, "new": { - "id": "00000000-0000-0000-0000-000000000392", + "id": "00000000-0000-0000-0000-000000000456", }, "proposal": { - "id": "00000000-0000-0000-0000-000000000395", + "id": "00000000-0000-0000-0000-000000000459", }, "screening": { - "id": "00000000-0000-0000-0000-000000000393", + "id": "00000000-0000-0000-0000-000000000457", }, }, }, "opportunityRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000409", + "id": "00000000-0000-0000-0000-000000000473", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000407", + "id": "00000000-0000-0000-0000-000000000471", }, "general": { - "id": "00000000-0000-0000-0000-000000000406", + "id": "00000000-0000-0000-0000-000000000470", }, "other": { - "id": "00000000-0000-0000-0000-000000000408", + "id": "00000000-0000-0000-0000-000000000472", }, }, "viewFields": { "amount": { - "id": "00000000-0000-0000-0000-000000000398", + "id": "00000000-0000-0000-0000-000000000462", }, "closeDate": { - "id": "00000000-0000-0000-0000-000000000399", + "id": "00000000-0000-0000-0000-000000000463", }, "company": { - "id": "00000000-0000-0000-0000-000000000401", + "id": "00000000-0000-0000-0000-000000000465", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000404", + "id": "00000000-0000-0000-0000-000000000468", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000405", + "id": "00000000-0000-0000-0000-000000000469", }, "owner": { - "id": "00000000-0000-0000-0000-000000000403", + "id": "00000000-0000-0000-0000-000000000467", }, "pointOfContact": { - "id": "00000000-0000-0000-0000-000000000402", + "id": "00000000-0000-0000-0000-000000000466", }, "stage": { - "id": "00000000-0000-0000-0000-000000000400", + "id": "00000000-0000-0000-0000-000000000464", }, }, "viewGroups": {}, @@ -1363,166 +1555,166 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "person": { "fields": { "attachments": { - "id": "00000000-0000-0000-0000-000000000432", + "id": "00000000-0000-0000-0000-000000000496", }, "avatarFile": { - "id": "00000000-0000-0000-0000-000000000423", + "id": "00000000-0000-0000-0000-000000000487", }, "avatarUrl": { - "id": "00000000-0000-0000-0000-000000000422", + "id": "00000000-0000-0000-0000-000000000486", }, "calendarEventParticipants": { - "id": "00000000-0000-0000-0000-000000000434", + "id": "00000000-0000-0000-0000-000000000498", }, "city": { - "id": "00000000-0000-0000-0000-000000000421", + "id": "00000000-0000-0000-0000-000000000485", }, "company": { - "id": "00000000-0000-0000-0000-000000000427", + "id": "00000000-0000-0000-0000-000000000491", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000412", + "id": "00000000-0000-0000-0000-000000000476", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000425", + "id": "00000000-0000-0000-0000-000000000489", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000414", + "id": "00000000-0000-0000-0000-000000000478", }, "emails": { - "id": "00000000-0000-0000-0000-000000000416", + "id": "00000000-0000-0000-0000-000000000480", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000431", + "id": "00000000-0000-0000-0000-000000000495", }, "id": { - "id": "00000000-0000-0000-0000-000000000411", + "id": "00000000-0000-0000-0000-000000000475", }, "jobTitle": { - "id": "00000000-0000-0000-0000-000000000419", + "id": "00000000-0000-0000-0000-000000000483", }, "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000417", + "id": "00000000-0000-0000-0000-000000000481", }, "messageParticipants": { - "id": "00000000-0000-0000-0000-000000000433", + "id": "00000000-0000-0000-0000-000000000497", }, "name": { - "id": "00000000-0000-0000-0000-000000000415", + "id": "00000000-0000-0000-0000-000000000479", }, "noteTargets": { - "id": "00000000-0000-0000-0000-000000000430", + "id": "00000000-0000-0000-0000-000000000494", }, "phones": { - "id": "00000000-0000-0000-0000-000000000420", + "id": "00000000-0000-0000-0000-000000000484", }, "pointOfContactForOpportunities": { - "id": "00000000-0000-0000-0000-000000000428", + "id": "00000000-0000-0000-0000-000000000492", }, "position": { - "id": "00000000-0000-0000-0000-000000000424", + "id": "00000000-0000-0000-0000-000000000488", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000436", + "id": "00000000-0000-0000-0000-000000000500", }, "taskTargets": { - "id": "00000000-0000-0000-0000-000000000429", + "id": "00000000-0000-0000-0000-000000000493", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000435", + "id": "00000000-0000-0000-0000-000000000499", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000413", + "id": "00000000-0000-0000-0000-000000000477", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000426", + "id": "00000000-0000-0000-0000-000000000490", }, "xLink": { - "id": "00000000-0000-0000-0000-000000000418", + "id": "00000000-0000-0000-0000-000000000482", }, }, - "id": "00000000-0000-0000-0000-000000000462", + "id": "00000000-0000-0000-0000-000000000526", "views": { "allPeople": { - "id": "00000000-0000-0000-0000-000000000447", + "id": "00000000-0000-0000-0000-000000000511", "viewFieldGroups": {}, "viewFields": { "city": { - "id": "00000000-0000-0000-0000-000000000443", + "id": "00000000-0000-0000-0000-000000000507", }, "company": { - "id": "00000000-0000-0000-0000-000000000440", + "id": "00000000-0000-0000-0000-000000000504", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000442", + "id": "00000000-0000-0000-0000-000000000506", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000439", + "id": "00000000-0000-0000-0000-000000000503", }, "emails": { - "id": "00000000-0000-0000-0000-000000000438", + "id": "00000000-0000-0000-0000-000000000502", }, "jobTitle": { - "id": "00000000-0000-0000-0000-000000000444", + "id": "00000000-0000-0000-0000-000000000508", }, "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000445", + "id": "00000000-0000-0000-0000-000000000509", }, "name": { - "id": "00000000-0000-0000-0000-000000000437", + "id": "00000000-0000-0000-0000-000000000501", }, "phones": { - "id": "00000000-0000-0000-0000-000000000441", + "id": "00000000-0000-0000-0000-000000000505", }, "xLink": { - "id": "00000000-0000-0000-0000-000000000446", + "id": "00000000-0000-0000-0000-000000000510", }, }, "viewGroups": {}, }, "personRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000461", + "id": "00000000-0000-0000-0000-000000000525", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000459", + "id": "00000000-0000-0000-0000-000000000523", }, "general": { - "id": "00000000-0000-0000-0000-000000000458", + "id": "00000000-0000-0000-0000-000000000522", }, "other": { - "id": "00000000-0000-0000-0000-000000000460", + "id": "00000000-0000-0000-0000-000000000524", }, }, "viewFields": { "avatarUrl": { - "id": "00000000-0000-0000-0000-000000000455", + "id": "00000000-0000-0000-0000-000000000519", }, "city": { - "id": "00000000-0000-0000-0000-000000000454", + "id": "00000000-0000-0000-0000-000000000518", }, "company": { - "id": "00000000-0000-0000-0000-000000000450", + "id": "00000000-0000-0000-0000-000000000514", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000456", + "id": "00000000-0000-0000-0000-000000000520", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000457", + "id": "00000000-0000-0000-0000-000000000521", }, "emails": { - "id": "00000000-0000-0000-0000-000000000448", + "id": "00000000-0000-0000-0000-000000000512", }, "jobTitle": { - "id": "00000000-0000-0000-0000-000000000451", + "id": "00000000-0000-0000-0000-000000000515", }, "linkedinLink": { - "id": "00000000-0000-0000-0000-000000000452", + "id": "00000000-0000-0000-0000-000000000516", }, "phones": { - "id": "00000000-0000-0000-0000-000000000449", + "id": "00000000-0000-0000-0000-000000000513", }, "xLink": { - "id": "00000000-0000-0000-0000-000000000453", + "id": "00000000-0000-0000-0000-000000000517", }, }, "viewGroups": {}, @@ -1532,194 +1724,194 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "task": { "fields": { "assignee": { - "id": "00000000-0000-0000-0000-000000000476", + "id": "00000000-0000-0000-0000-000000000540", }, "attachments": { - "id": "00000000-0000-0000-0000-000000000475", + "id": "00000000-0000-0000-0000-000000000539", }, "bodyV2": { - "id": "00000000-0000-0000-0000-000000000469", + "id": "00000000-0000-0000-0000-000000000533", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000464", + "id": "00000000-0000-0000-0000-000000000528", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000472", + "id": "00000000-0000-0000-0000-000000000536", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000466", + "id": "00000000-0000-0000-0000-000000000530", }, "dueAt": { - "id": "00000000-0000-0000-0000-000000000470", + "id": "00000000-0000-0000-0000-000000000534", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000478", + "id": "00000000-0000-0000-0000-000000000542", }, "id": { - "id": "00000000-0000-0000-0000-000000000463", + "id": "00000000-0000-0000-0000-000000000527", }, "position": { - "id": "00000000-0000-0000-0000-000000000467", + "id": "00000000-0000-0000-0000-000000000531", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000479", + "id": "00000000-0000-0000-0000-000000000543", }, "status": { - "id": "00000000-0000-0000-0000-000000000471", + "id": "00000000-0000-0000-0000-000000000535", }, "taskTargets": { - "id": "00000000-0000-0000-0000-000000000474", + "id": "00000000-0000-0000-0000-000000000538", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000477", + "id": "00000000-0000-0000-0000-000000000541", }, "title": { - "id": "00000000-0000-0000-0000-000000000468", + "id": "00000000-0000-0000-0000-000000000532", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000465", + "id": "00000000-0000-0000-0000-000000000529", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000473", + "id": "00000000-0000-0000-0000-000000000537", }, }, - "id": "00000000-0000-0000-0000-000000000520", + "id": "00000000-0000-0000-0000-000000000584", "views": { "allTasks": { - "id": "00000000-0000-0000-0000-000000000488", + "id": "00000000-0000-0000-0000-000000000552", "viewFieldGroups": {}, "viewFields": { "assignee": { - "id": "00000000-0000-0000-0000-000000000485", + "id": "00000000-0000-0000-0000-000000000549", }, "bodyV2": { - "id": "00000000-0000-0000-0000-000000000486", + "id": "00000000-0000-0000-0000-000000000550", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000487", + "id": "00000000-0000-0000-0000-000000000551", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000483", + "id": "00000000-0000-0000-0000-000000000547", }, "dueAt": { - "id": "00000000-0000-0000-0000-000000000484", + "id": "00000000-0000-0000-0000-000000000548", }, "status": { - "id": "00000000-0000-0000-0000-000000000481", + "id": "00000000-0000-0000-0000-000000000545", }, "taskTargets": { - "id": "00000000-0000-0000-0000-000000000482", + "id": "00000000-0000-0000-0000-000000000546", }, "title": { - "id": "00000000-0000-0000-0000-000000000480", + "id": "00000000-0000-0000-0000-000000000544", }, }, "viewGroups": {}, }, "assignedToMe": { - "id": "00000000-0000-0000-0000-000000000500", + "id": "00000000-0000-0000-0000-000000000564", "viewFieldGroups": {}, "viewFields": { "assignee": { - "id": "00000000-0000-0000-0000-000000000493", + "id": "00000000-0000-0000-0000-000000000557", }, "bodyV2": { - "id": "00000000-0000-0000-0000-000000000494", + "id": "00000000-0000-0000-0000-000000000558", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000495", + "id": "00000000-0000-0000-0000-000000000559", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000491", + "id": "00000000-0000-0000-0000-000000000555", }, "dueAt": { - "id": "00000000-0000-0000-0000-000000000492", + "id": "00000000-0000-0000-0000-000000000556", }, "taskTargets": { - "id": "00000000-0000-0000-0000-000000000490", + "id": "00000000-0000-0000-0000-000000000554", }, "title": { - "id": "00000000-0000-0000-0000-000000000489", + "id": "00000000-0000-0000-0000-000000000553", }, }, "viewGroups": { "done": { - "id": "00000000-0000-0000-0000-000000000498", + "id": "00000000-0000-0000-0000-000000000562", }, "empty": { - "id": "00000000-0000-0000-0000-000000000499", + "id": "00000000-0000-0000-0000-000000000563", }, "inProgress": { - "id": "00000000-0000-0000-0000-000000000497", + "id": "00000000-0000-0000-0000-000000000561", }, "todo": { - "id": "00000000-0000-0000-0000-000000000496", + "id": "00000000-0000-0000-0000-000000000560", }, }, }, "byStatus": { - "id": "00000000-0000-0000-0000-000000000509", + "id": "00000000-0000-0000-0000-000000000573", "viewFieldGroups": {}, "viewFields": { "assignee": { - "id": "00000000-0000-0000-0000-000000000504", + "id": "00000000-0000-0000-0000-000000000568", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000505", + "id": "00000000-0000-0000-0000-000000000569", }, "dueAt": { - "id": "00000000-0000-0000-0000-000000000503", + "id": "00000000-0000-0000-0000-000000000567", }, "status": { - "id": "00000000-0000-0000-0000-000000000502", + "id": "00000000-0000-0000-0000-000000000566", }, "title": { - "id": "00000000-0000-0000-0000-000000000501", + "id": "00000000-0000-0000-0000-000000000565", }, }, "viewGroups": { "done": { - "id": "00000000-0000-0000-0000-000000000508", + "id": "00000000-0000-0000-0000-000000000572", }, "inProgress": { - "id": "00000000-0000-0000-0000-000000000507", + "id": "00000000-0000-0000-0000-000000000571", }, "todo": { - "id": "00000000-0000-0000-0000-000000000506", + "id": "00000000-0000-0000-0000-000000000570", }, }, }, "taskRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000519", + "id": "00000000-0000-0000-0000-000000000583", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000517", + "id": "00000000-0000-0000-0000-000000000581", }, "general": { - "id": "00000000-0000-0000-0000-000000000516", + "id": "00000000-0000-0000-0000-000000000580", }, "other": { - "id": "00000000-0000-0000-0000-000000000518", + "id": "00000000-0000-0000-0000-000000000582", }, }, "viewFields": { "assignee": { - "id": "00000000-0000-0000-0000-000000000513", + "id": "00000000-0000-0000-0000-000000000577", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000514", + "id": "00000000-0000-0000-0000-000000000578", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000515", + "id": "00000000-0000-0000-0000-000000000579", }, "dueAt": { - "id": "00000000-0000-0000-0000-000000000511", + "id": "00000000-0000-0000-0000-000000000575", }, "status": { - "id": "00000000-0000-0000-0000-000000000512", + "id": "00000000-0000-0000-0000-000000000576", }, "title": { - "id": "00000000-0000-0000-0000-000000000510", + "id": "00000000-0000-0000-0000-000000000574", }, }, "viewGroups": {}, @@ -1729,50 +1921,62 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "taskTarget": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000522", + "id": "00000000-0000-0000-0000-000000000586", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000593", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000524", + "id": "00000000-0000-0000-0000-000000000588", }, "id": { - "id": "00000000-0000-0000-0000-000000000521", + "id": "00000000-0000-0000-0000-000000000585", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000595", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000596", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000527", + "id": "00000000-0000-0000-0000-000000000591", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000528", + "id": "00000000-0000-0000-0000-000000000592", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000526", + "id": "00000000-0000-0000-0000-000000000590", }, "task": { - "id": "00000000-0000-0000-0000-000000000525", + "id": "00000000-0000-0000-0000-000000000589", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000523", + "id": "00000000-0000-0000-0000-000000000587", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000594", }, }, - "id": "00000000-0000-0000-0000-000000000535", + "id": "00000000-0000-0000-0000-000000000603", "views": { "allTaskTargets": { - "id": "00000000-0000-0000-0000-000000000534", + "id": "00000000-0000-0000-0000-000000000602", "viewFieldGroups": {}, "viewFields": { "id": { - "id": "00000000-0000-0000-0000-000000000529", + "id": "00000000-0000-0000-0000-000000000597", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000532", + "id": "00000000-0000-0000-0000-000000000600", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000533", + "id": "00000000-0000-0000-0000-000000000601", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000531", + "id": "00000000-0000-0000-0000-000000000599", }, "task": { - "id": "00000000-0000-0000-0000-000000000530", + "id": "00000000-0000-0000-0000-000000000598", }, }, "viewGroups": {}, @@ -1782,113 +1986,125 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "timelineActivity": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000537", + "id": "00000000-0000-0000-0000-000000000605", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000624", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000539", + "id": "00000000-0000-0000-0000-000000000607", }, "happensAt": { - "id": "00000000-0000-0000-0000-000000000540", + "id": "00000000-0000-0000-0000-000000000608", }, "id": { - "id": "00000000-0000-0000-0000-000000000536", + "id": "00000000-0000-0000-0000-000000000604", }, "linkedObjectMetadataId": { - "id": "00000000-0000-0000-0000-000000000555", + "id": "00000000-0000-0000-0000-000000000623", }, "linkedRecordCachedName": { - "id": "00000000-0000-0000-0000-000000000553", + "id": "00000000-0000-0000-0000-000000000621", }, "linkedRecordId": { - "id": "00000000-0000-0000-0000-000000000554", + "id": "00000000-0000-0000-0000-000000000622", }, "name": { - "id": "00000000-0000-0000-0000-000000000541", + "id": "00000000-0000-0000-0000-000000000609", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000626", }, "properties": { - "id": "00000000-0000-0000-0000-000000000542", + "id": "00000000-0000-0000-0000-000000000610", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000627", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000545", + "id": "00000000-0000-0000-0000-000000000613", }, "targetDashboard": { - "id": "00000000-0000-0000-0000-000000000552", + "id": "00000000-0000-0000-0000-000000000620", }, "targetNote": { - "id": "00000000-0000-0000-0000-000000000548", + "id": "00000000-0000-0000-0000-000000000616", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000546", + "id": "00000000-0000-0000-0000-000000000614", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000544", + "id": "00000000-0000-0000-0000-000000000612", }, "targetTask": { - "id": "00000000-0000-0000-0000-000000000547", + "id": "00000000-0000-0000-0000-000000000615", }, "targetWorkflow": { - "id": "00000000-0000-0000-0000-000000000549", + "id": "00000000-0000-0000-0000-000000000617", }, "targetWorkflowRun": { - "id": "00000000-0000-0000-0000-000000000551", + "id": "00000000-0000-0000-0000-000000000619", }, "targetWorkflowVersion": { - "id": "00000000-0000-0000-0000-000000000550", + "id": "00000000-0000-0000-0000-000000000618", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000538", + "id": "00000000-0000-0000-0000-000000000606", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000625", }, "workspaceMember": { - "id": "00000000-0000-0000-0000-000000000543", + "id": "00000000-0000-0000-0000-000000000611", }, }, - "id": "00000000-0000-0000-0000-000000000571", + "id": "00000000-0000-0000-0000-000000000643", "views": { "allTimelineActivities": { - "id": "00000000-0000-0000-0000-000000000570", + "id": "00000000-0000-0000-0000-000000000642", "viewFieldGroups": {}, "viewFields": { "happensAt": { - "id": "00000000-0000-0000-0000-000000000557", + "id": "00000000-0000-0000-0000-000000000629", }, "linkedRecordCachedName": { - "id": "00000000-0000-0000-0000-000000000560", + "id": "00000000-0000-0000-0000-000000000632", }, "name": { - "id": "00000000-0000-0000-0000-000000000556", + "id": "00000000-0000-0000-0000-000000000628", }, "properties": { - "id": "00000000-0000-0000-0000-000000000558", + "id": "00000000-0000-0000-0000-000000000630", }, "targetCompany": { - "id": "00000000-0000-0000-0000-000000000562", + "id": "00000000-0000-0000-0000-000000000634", }, "targetDashboard": { - "id": "00000000-0000-0000-0000-000000000569", + "id": "00000000-0000-0000-0000-000000000641", }, "targetNote": { - "id": "00000000-0000-0000-0000-000000000565", + "id": "00000000-0000-0000-0000-000000000637", }, "targetOpportunity": { - "id": "00000000-0000-0000-0000-000000000563", + "id": "00000000-0000-0000-0000-000000000635", }, "targetPerson": { - "id": "00000000-0000-0000-0000-000000000561", + "id": "00000000-0000-0000-0000-000000000633", }, "targetTask": { - "id": "00000000-0000-0000-0000-000000000564", + "id": "00000000-0000-0000-0000-000000000636", }, "targetWorkflow": { - "id": "00000000-0000-0000-0000-000000000566", + "id": "00000000-0000-0000-0000-000000000638", }, "targetWorkflowRun": { - "id": "00000000-0000-0000-0000-000000000568", + "id": "00000000-0000-0000-0000-000000000640", }, "targetWorkflowVersion": { - "id": "00000000-0000-0000-0000-000000000567", + "id": "00000000-0000-0000-0000-000000000639", }, "workspaceMember": { - "id": "00000000-0000-0000-0000-000000000559", + "id": "00000000-0000-0000-0000-000000000631", }, }, "viewGroups": {}, @@ -1898,80 +2114,80 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "workflow": { "fields": { "attachments": { - "id": "00000000-0000-0000-0000-000000000585", + "id": "00000000-0000-0000-0000-000000000657", }, "automatedTriggers": { - "id": "00000000-0000-0000-0000-000000000582", + "id": "00000000-0000-0000-0000-000000000654", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000573", + "id": "00000000-0000-0000-0000-000000000645", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000586", + "id": "00000000-0000-0000-0000-000000000658", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000575", + "id": "00000000-0000-0000-0000-000000000647", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000583", + "id": "00000000-0000-0000-0000-000000000655", }, "id": { - "id": "00000000-0000-0000-0000-000000000572", + "id": "00000000-0000-0000-0000-000000000644", }, "lastPublishedVersionId": { - "id": "00000000-0000-0000-0000-000000000577", + "id": "00000000-0000-0000-0000-000000000649", }, "name": { - "id": "00000000-0000-0000-0000-000000000576", + "id": "00000000-0000-0000-0000-000000000648", }, "position": { - "id": "00000000-0000-0000-0000-000000000579", + "id": "00000000-0000-0000-0000-000000000651", }, "runs": { - "id": "00000000-0000-0000-0000-000000000581", + "id": "00000000-0000-0000-0000-000000000653", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000588", + "id": "00000000-0000-0000-0000-000000000660", }, "statuses": { - "id": "00000000-0000-0000-0000-000000000578", + "id": "00000000-0000-0000-0000-000000000650", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000584", + "id": "00000000-0000-0000-0000-000000000656", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000574", + "id": "00000000-0000-0000-0000-000000000646", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000587", + "id": "00000000-0000-0000-0000-000000000659", }, "versions": { - "id": "00000000-0000-0000-0000-000000000580", + "id": "00000000-0000-0000-0000-000000000652", }, }, - "id": "00000000-0000-0000-0000-000000000596", + "id": "00000000-0000-0000-0000-000000000668", "views": { "allWorkflows": { - "id": "00000000-0000-0000-0000-000000000595", + "id": "00000000-0000-0000-0000-000000000667", "viewFieldGroups": {}, "viewFields": { "createdBy": { - "id": "00000000-0000-0000-0000-000000000592", + "id": "00000000-0000-0000-0000-000000000664", }, "name": { - "id": "00000000-0000-0000-0000-000000000589", + "id": "00000000-0000-0000-0000-000000000661", }, "runs": { - "id": "00000000-0000-0000-0000-000000000594", + "id": "00000000-0000-0000-0000-000000000666", }, "statuses": { - "id": "00000000-0000-0000-0000-000000000590", + "id": "00000000-0000-0000-0000-000000000662", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000591", + "id": "00000000-0000-0000-0000-000000000663", }, "versions": { - "id": "00000000-0000-0000-0000-000000000593", + "id": "00000000-0000-0000-0000-000000000665", }, }, "viewGroups": {}, @@ -1981,157 +2197,169 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "workflowAutomatedTrigger": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000598", + "id": "00000000-0000-0000-0000-000000000670", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000676", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000600", + "id": "00000000-0000-0000-0000-000000000672", }, "id": { - "id": "00000000-0000-0000-0000-000000000597", + "id": "00000000-0000-0000-0000-000000000669", + }, + "position": { + "id": "00000000-0000-0000-0000-000000000678", + }, + "searchVector": { + "id": "00000000-0000-0000-0000-000000000679", }, "settings": { - "id": "00000000-0000-0000-0000-000000000602", + "id": "00000000-0000-0000-0000-000000000674", }, "type": { - "id": "00000000-0000-0000-0000-000000000601", + "id": "00000000-0000-0000-0000-000000000673", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000599", + "id": "00000000-0000-0000-0000-000000000671", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000677", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000603", + "id": "00000000-0000-0000-0000-000000000675", }, }, - "id": "00000000-0000-0000-0000-000000000604", + "id": "00000000-0000-0000-0000-000000000680", "views": undefined, }, "workflowRun": { "fields": { "context": { - "id": "00000000-0000-0000-0000-000000000620", + "id": "00000000-0000-0000-0000-000000000696", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000606", + "id": "00000000-0000-0000-0000-000000000682", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000617", + "id": "00000000-0000-0000-0000-000000000693", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000608", + "id": "00000000-0000-0000-0000-000000000684", }, "endedAt": { - "id": "00000000-0000-0000-0000-000000000614", + "id": "00000000-0000-0000-0000-000000000690", }, "enqueuedAt": { - "id": "00000000-0000-0000-0000-000000000612", + "id": "00000000-0000-0000-0000-000000000688", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000622", + "id": "00000000-0000-0000-0000-000000000698", }, "id": { - "id": "00000000-0000-0000-0000-000000000605", + "id": "00000000-0000-0000-0000-000000000681", }, "name": { - "id": "00000000-0000-0000-0000-000000000609", + "id": "00000000-0000-0000-0000-000000000685", }, "output": { - "id": "00000000-0000-0000-0000-000000000619", + "id": "00000000-0000-0000-0000-000000000695", }, "position": { - "id": "00000000-0000-0000-0000-000000000616", + "id": "00000000-0000-0000-0000-000000000692", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000624", + "id": "00000000-0000-0000-0000-000000000700", }, "startedAt": { - "id": "00000000-0000-0000-0000-000000000613", + "id": "00000000-0000-0000-0000-000000000689", }, "state": { - "id": "00000000-0000-0000-0000-000000000621", + "id": "00000000-0000-0000-0000-000000000697", }, "status": { - "id": "00000000-0000-0000-0000-000000000615", + "id": "00000000-0000-0000-0000-000000000691", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000623", + "id": "00000000-0000-0000-0000-000000000699", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000607", + "id": "00000000-0000-0000-0000-000000000683", }, "updatedBy": { - "id": "00000000-0000-0000-0000-000000000618", + "id": "00000000-0000-0000-0000-000000000694", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000611", + "id": "00000000-0000-0000-0000-000000000687", }, "workflowVersion": { - "id": "00000000-0000-0000-0000-000000000610", + "id": "00000000-0000-0000-0000-000000000686", }, }, - "id": "00000000-0000-0000-0000-000000000644", + "id": "00000000-0000-0000-0000-000000000720", "views": { "allWorkflowRuns": { - "id": "00000000-0000-0000-0000-000000000631", + "id": "00000000-0000-0000-0000-000000000707", "viewFieldGroups": {}, "viewFields": { "createdBy": { - "id": "00000000-0000-0000-0000-000000000629", + "id": "00000000-0000-0000-0000-000000000705", }, "name": { - "id": "00000000-0000-0000-0000-000000000625", + "id": "00000000-0000-0000-0000-000000000701", }, "startedAt": { - "id": "00000000-0000-0000-0000-000000000628", + "id": "00000000-0000-0000-0000-000000000704", }, "status": { - "id": "00000000-0000-0000-0000-000000000627", + "id": "00000000-0000-0000-0000-000000000703", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000626", + "id": "00000000-0000-0000-0000-000000000702", }, "workflowVersion": { - "id": "00000000-0000-0000-0000-000000000630", + "id": "00000000-0000-0000-0000-000000000706", }, }, "viewGroups": {}, }, "workflowRunRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000643", + "id": "00000000-0000-0000-0000-000000000719", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000641", + "id": "00000000-0000-0000-0000-000000000717", }, "general": { - "id": "00000000-0000-0000-0000-000000000640", + "id": "00000000-0000-0000-0000-000000000716", }, "other": { - "id": "00000000-0000-0000-0000-000000000642", + "id": "00000000-0000-0000-0000-000000000718", }, }, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000638", + "id": "00000000-0000-0000-0000-000000000714", }, "createdBy": { - "id": "00000000-0000-0000-0000-000000000639", + "id": "00000000-0000-0000-0000-000000000715", }, "endedAt": { - "id": "00000000-0000-0000-0000-000000000637", + "id": "00000000-0000-0000-0000-000000000713", }, "name": { - "id": "00000000-0000-0000-0000-000000000632", + "id": "00000000-0000-0000-0000-000000000708", }, "startedAt": { - "id": "00000000-0000-0000-0000-000000000636", + "id": "00000000-0000-0000-0000-000000000712", }, "status": { - "id": "00000000-0000-0000-0000-000000000633", + "id": "00000000-0000-0000-0000-000000000709", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000634", + "id": "00000000-0000-0000-0000-000000000710", }, "workflowVersion": { - "id": "00000000-0000-0000-0000-000000000635", + "id": "00000000-0000-0000-0000-000000000711", }, }, "viewGroups": {}, @@ -2141,100 +2369,106 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "workflowVersion": { "fields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000646", + "id": "00000000-0000-0000-0000-000000000722", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000735", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000648", + "id": "00000000-0000-0000-0000-000000000724", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000656", + "id": "00000000-0000-0000-0000-000000000732", }, "id": { - "id": "00000000-0000-0000-0000-000000000645", + "id": "00000000-0000-0000-0000-000000000721", }, "name": { - "id": "00000000-0000-0000-0000-000000000649", + "id": "00000000-0000-0000-0000-000000000725", }, "position": { - "id": "00000000-0000-0000-0000-000000000653", + "id": "00000000-0000-0000-0000-000000000729", }, "runs": { - "id": "00000000-0000-0000-0000-000000000654", + "id": "00000000-0000-0000-0000-000000000730", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000658", + "id": "00000000-0000-0000-0000-000000000734", }, "status": { - "id": "00000000-0000-0000-0000-000000000652", + "id": "00000000-0000-0000-0000-000000000728", }, "steps": { - "id": "00000000-0000-0000-0000-000000000655", + "id": "00000000-0000-0000-0000-000000000731", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000657", + "id": "00000000-0000-0000-0000-000000000733", }, "trigger": { - "id": "00000000-0000-0000-0000-000000000651", + "id": "00000000-0000-0000-0000-000000000727", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000647", + "id": "00000000-0000-0000-0000-000000000723", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000736", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000650", + "id": "00000000-0000-0000-0000-000000000726", }, }, - "id": "00000000-0000-0000-0000-000000000674", + "id": "00000000-0000-0000-0000-000000000752", "views": { "allWorkflowVersions": { - "id": "00000000-0000-0000-0000-000000000664", + "id": "00000000-0000-0000-0000-000000000742", "viewFieldGroups": {}, "viewFields": { "name": { - "id": "00000000-0000-0000-0000-000000000659", + "id": "00000000-0000-0000-0000-000000000737", }, "runs": { - "id": "00000000-0000-0000-0000-000000000663", + "id": "00000000-0000-0000-0000-000000000741", }, "status": { - "id": "00000000-0000-0000-0000-000000000661", + "id": "00000000-0000-0000-0000-000000000739", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000662", + "id": "00000000-0000-0000-0000-000000000740", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000660", + "id": "00000000-0000-0000-0000-000000000738", }, }, "viewGroups": {}, }, "workflowVersionRecordPageFields": { - "id": "00000000-0000-0000-0000-000000000673", + "id": "00000000-0000-0000-0000-000000000751", "viewFieldGroups": { "additional": { - "id": "00000000-0000-0000-0000-000000000671", + "id": "00000000-0000-0000-0000-000000000749", }, "general": { - "id": "00000000-0000-0000-0000-000000000670", + "id": "00000000-0000-0000-0000-000000000748", }, "other": { - "id": "00000000-0000-0000-0000-000000000672", + "id": "00000000-0000-0000-0000-000000000750", }, }, "viewFields": { "createdAt": { - "id": "00000000-0000-0000-0000-000000000669", + "id": "00000000-0000-0000-0000-000000000747", }, "name": { - "id": "00000000-0000-0000-0000-000000000665", + "id": "00000000-0000-0000-0000-000000000743", }, "status": { - "id": "00000000-0000-0000-0000-000000000666", + "id": "00000000-0000-0000-0000-000000000744", }, "trigger": { - "id": "00000000-0000-0000-0000-000000000668", + "id": "00000000-0000-0000-0000-000000000746", }, "workflow": { - "id": "00000000-0000-0000-0000-000000000667", + "id": "00000000-0000-0000-0000-000000000745", }, }, "viewGroups": {}, @@ -2244,122 +2478,128 @@ exports[`getStandardObjectMetadataRelatedEntityIds should return standard object "workspaceMember": { "fields": { "accountOwnerForCompanies": { - "id": "00000000-0000-0000-0000-000000000689", + "id": "00000000-0000-0000-0000-000000000767", }, "assignedTasks": { - "id": "00000000-0000-0000-0000-000000000686", + "id": "00000000-0000-0000-0000-000000000764", }, "avatarUrl": { - "id": "00000000-0000-0000-0000-000000000683", + "id": "00000000-0000-0000-0000-000000000761", }, "blocklist": { - "id": "00000000-0000-0000-0000-000000000692", + "id": "00000000-0000-0000-0000-000000000770", }, "calendarEventParticipants": { - "id": "00000000-0000-0000-0000-000000000693", + "id": "00000000-0000-0000-0000-000000000771", }, "calendarStartDay": { - "id": "00000000-0000-0000-0000-000000000699", + "id": "00000000-0000-0000-0000-000000000777", }, "colorScheme": { - "id": "00000000-0000-0000-0000-000000000681", + "id": "00000000-0000-0000-0000-000000000759", }, "connectedAccounts": { - "id": "00000000-0000-0000-0000-000000000690", + "id": "00000000-0000-0000-0000-000000000768", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000676", + "id": "00000000-0000-0000-0000-000000000754", + }, + "createdBy": { + "id": "00000000-0000-0000-0000-000000000779", }, "dateFormat": { - "id": "00000000-0000-0000-0000-000000000696", + "id": "00000000-0000-0000-0000-000000000774", }, "deletedAt": { - "id": "00000000-0000-0000-0000-000000000678", + "id": "00000000-0000-0000-0000-000000000756", }, "favorites": { - "id": "00000000-0000-0000-0000-000000000688", + "id": "00000000-0000-0000-0000-000000000766", }, "id": { - "id": "00000000-0000-0000-0000-000000000675", + "id": "00000000-0000-0000-0000-000000000753", }, "locale": { - "id": "00000000-0000-0000-0000-000000000682", + "id": "00000000-0000-0000-0000-000000000760", }, "messageParticipants": { - "id": "00000000-0000-0000-0000-000000000691", + "id": "00000000-0000-0000-0000-000000000769", }, "name": { - "id": "00000000-0000-0000-0000-000000000680", + "id": "00000000-0000-0000-0000-000000000758", }, "numberFormat": { - "id": "00000000-0000-0000-0000-000000000700", + "id": "00000000-0000-0000-0000-000000000778", }, "ownedOpportunities": { - "id": "00000000-0000-0000-0000-000000000687", + "id": "00000000-0000-0000-0000-000000000765", }, "position": { - "id": "00000000-0000-0000-0000-000000000679", + "id": "00000000-0000-0000-0000-000000000757", }, "searchVector": { - "id": "00000000-0000-0000-0000-000000000698", + "id": "00000000-0000-0000-0000-000000000776", }, "timeFormat": { - "id": "00000000-0000-0000-0000-000000000697", + "id": "00000000-0000-0000-0000-000000000775", }, "timeZone": { - "id": "00000000-0000-0000-0000-000000000695", + "id": "00000000-0000-0000-0000-000000000773", }, "timelineActivities": { - "id": "00000000-0000-0000-0000-000000000694", + "id": "00000000-0000-0000-0000-000000000772", }, "updatedAt": { - "id": "00000000-0000-0000-0000-000000000677", + "id": "00000000-0000-0000-0000-000000000755", + }, + "updatedBy": { + "id": "00000000-0000-0000-0000-000000000780", }, "userEmail": { - "id": "00000000-0000-0000-0000-000000000684", + "id": "00000000-0000-0000-0000-000000000762", }, "userId": { - "id": "00000000-0000-0000-0000-000000000685", + "id": "00000000-0000-0000-0000-000000000763", }, }, - "id": "00000000-0000-0000-0000-000000000713", + "id": "00000000-0000-0000-0000-000000000793", "views": { "allWorkspaceMembers": { - "id": "00000000-0000-0000-0000-000000000712", + "id": "00000000-0000-0000-0000-000000000792", "viewFieldGroups": {}, "viewFields": { "assignedTasks": { - "id": "00000000-0000-0000-0000-000000000711", + "id": "00000000-0000-0000-0000-000000000791", }, "avatarUrl": { - "id": "00000000-0000-0000-0000-000000000703", + "id": "00000000-0000-0000-0000-000000000783", }, "colorScheme": { - "id": "00000000-0000-0000-0000-000000000704", + "id": "00000000-0000-0000-0000-000000000784", }, "createdAt": { - "id": "00000000-0000-0000-0000-000000000709", + "id": "00000000-0000-0000-0000-000000000789", }, "dateFormat": { - "id": "00000000-0000-0000-0000-000000000707", + "id": "00000000-0000-0000-0000-000000000787", }, "locale": { - "id": "00000000-0000-0000-0000-000000000705", + "id": "00000000-0000-0000-0000-000000000785", }, "name": { - "id": "00000000-0000-0000-0000-000000000701", + "id": "00000000-0000-0000-0000-000000000781", }, "ownedOpportunities": { - "id": "00000000-0000-0000-0000-000000000710", + "id": "00000000-0000-0000-0000-000000000790", }, "timeFormat": { - "id": "00000000-0000-0000-0000-000000000708", + "id": "00000000-0000-0000-0000-000000000788", }, "timeZone": { - "id": "00000000-0000-0000-0000-000000000706", + "id": "00000000-0000-0000-0000-000000000786", }, "userEmail": { - "id": "00000000-0000-0000-0000-000000000702", + "id": "00000000-0000-0000-0000-000000000782", }, }, "viewGroups": {}, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-attachment-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-attachment-standard-flat-field-metadata.util.ts index d9bc2ffc67..128e4cc9c7 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-attachment-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-attachment-standard-flat-field-metadata.util.ts @@ -13,6 +13,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_ATTACHMENT } from 'src/modules/attachment/standard-objects/attachment.workspace-entity'; export const buildAttachmentStandardFlatFieldMetadatas = ({ now, @@ -54,6 +56,7 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +78,7 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -96,6 +100,7 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -219,6 +224,7 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -241,6 +247,7 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -254,6 +261,47 @@ export const buildAttachmentStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Attachment record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_ATTACHMENT, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // Relation fields targetTask: createStandardRelationFieldFlatMetadata({ diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-blocklist-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-blocklist-standard-flat-field-metadata.util.ts index 6adefa6925..b8e352e0f5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-blocklist-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-blocklist-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_BLOCKLIST } from 'src/modules/blocklist/standard-objects/blocklist.workspace-entity'; export const buildBlocklistStandardFlatFieldMetadatas = ({ now, @@ -53,6 +55,7 @@ export const buildBlocklistStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildBlocklistStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -95,6 +99,7 @@ export const buildBlocklistStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -106,6 +111,93 @@ export const buildBlocklistStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Blocklist record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_BLOCKLIST, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // Blocklist-specific fields handle: createStandardFieldFlatMetadata({ diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-event-association-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-event-association-standard-flat-field-metadata.util.ts index fc34652a94..116c887d7f 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-event-association-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-event-association-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_CALENDAR_CHANNEL_EVENT_ASSOCIATION } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity'; export const buildCalendarChannelEventAssociationStandardFlatFieldMetadatas = ({ now, @@ -55,6 +57,7 @@ export const buildCalendarChannelEventAssociationStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildCalendarChannelEventAssociationStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +97,7 @@ export const buildCalendarChannelEventAssociationStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +107,93 @@ export const buildCalendarChannelEventAssociationStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Calendar channel event association record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_CALENDAR_CHANNEL_EVENT_ASSOCIATION, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), eventExternalId: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-standard-flat-field-metadata.util.ts index 8bb969f06a..584e84d0e4 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-channel-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_CALENDAR_CHANNEL } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; export const buildCalendarChannelStandardFlatFieldMetadatas = ({ now, @@ -55,6 +57,7 @@ export const buildCalendarChannelStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildCalendarChannelStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +97,7 @@ export const buildCalendarChannelStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +107,93 @@ export const buildCalendarChannelStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Calendar channel record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_CALENDAR_CHANNEL, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), handle: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-participant-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-participant-standard-flat-field-metadata.util.ts index eb02310426..46c6179502 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-participant-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-participant-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_CALENDAR_EVENT_PARTICIPANT } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity'; export const buildCalendarEventParticipantStandardFlatFieldMetadatas = ({ now, @@ -55,6 +57,7 @@ export const buildCalendarEventParticipantStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildCalendarEventParticipantStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +97,7 @@ export const buildCalendarEventParticipantStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +107,93 @@ export const buildCalendarEventParticipantStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Calendar event participant record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_CALENDAR_EVENT_PARTICIPANT, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), handle: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-standard-flat-field-metadata.util.ts index d98e56c13f..068b9f29c0 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-calendar-event-standard-flat-field-metadata.util.ts @@ -11,6 +11,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_CALENDAR_EVENT } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity'; export const buildCalendarEventStandardFlatFieldMetadatas = ({ now, @@ -51,6 +53,7 @@ export const buildCalendarEventStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -70,6 +73,7 @@ export const buildCalendarEventStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -89,6 +93,7 @@ export const buildCalendarEventStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -98,6 +103,93 @@ export const buildCalendarEventStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Calendar event record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_CALENDAR_EVENT, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), title: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts index d1c9891d2d..d6efc82962 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-company-standard-flat-field-metadata.util.ts @@ -55,6 +55,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +77,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -97,6 +99,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -273,6 +276,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -295,6 +299,7 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -458,7 +463,6 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the company', icon: 'IconHeart', - isSystem: true, isNullable: true, targetObjectName: 'favorite', targetFieldName: 'company', @@ -481,7 +485,6 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Attachments linked to the company', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetCompany', @@ -504,7 +507,6 @@ export const buildCompanyStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline Activities linked to the company', icon: 'IconIconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetCompany', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-connected-account-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-connected-account-standard-flat-field-metadata.util.ts index d7154e8124..559013a182 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-connected-account-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-connected-account-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_CONNECTED_ACCOUNT } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; export const buildConnectedAccountStandardFlatFieldMetadatas = ({ now, @@ -55,6 +57,7 @@ export const buildConnectedAccountStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildConnectedAccountStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +97,7 @@ export const buildConnectedAccountStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +107,93 @@ export const buildConnectedAccountStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Connected account record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_CONNECTED_ACCOUNT, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), handle: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-dashboard-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-dashboard-standard-flat-field-metadata.util.ts index 62f7311dd0..8bea6482b7 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-dashboard-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-dashboard-standard-flat-field-metadata.util.ts @@ -54,6 +54,7 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -73,6 +74,7 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -92,6 +94,7 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -163,6 +166,7 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -185,6 +189,7 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -233,7 +238,6 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline activities linked to the dashboard', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetDashboard', @@ -256,7 +260,6 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the dashboard', icon: 'IconHeart', - isSystem: true, isNullable: false, targetObjectName: 'favorite', targetFieldName: 'dashboard', @@ -279,7 +282,6 @@ export const buildDashboardStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Attachments linked to the dashboard', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetDashboard', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-folder-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-folder-standard-flat-field-metadata.util.ts index 40aa84514f..d794c7c646 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-folder-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-folder-standard-flat-field-metadata.util.ts @@ -11,6 +11,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_FAVORITE_FOLDER } from 'src/modules/favorite-folder/standard-objects/favorite-folder.workspace-entity'; export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ now, @@ -55,6 +57,7 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +77,7 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +97,7 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +107,52 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // FavoriteFolder-specific fields position: createStandardFieldFlatMetadata({ @@ -109,10 +160,10 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ workspaceId, context: { fieldName: 'position', - type: FieldMetadataType.NUMBER, + type: FieldMetadataType.POSITION, label: 'Position', description: 'Favorite folder position', - icon: 'IconList', + icon: 'IconHierarchy2', isSystem: true, isNullable: false, isUIReadOnly: true, @@ -123,6 +174,29 @@ export const buildFavoriteFolderStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_FAVORITE_FOLDER, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), name: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-standard-flat-field-metadata.util.ts index 1df919182b..c8a91d6ed5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-favorite-standard-flat-field-metadata.util.ts @@ -53,6 +53,7 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -72,6 +73,7 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -91,6 +93,7 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -100,6 +103,52 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // Favorite-specific fields position: createStandardFieldFlatMetadata({ @@ -107,10 +156,10 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ workspaceId, context: { fieldName: 'position', - type: FieldMetadataType.NUMBER, + type: FieldMetadataType.POSITION, label: 'Position', description: 'Favorite position', - icon: 'IconList', + icon: 'IconHierarchy2', isSystem: true, isNullable: false, isUIReadOnly: true, @@ -121,6 +170,23 @@ export const buildFavoriteStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), viewId: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-message-folder-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-message-folder-standard-flat-field-metadata.util.ts index dee3729b61..8cb9d56901 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-message-folder-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-message-folder-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_MESSAGE_FOLDER } from 'src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity'; export const buildMessageChannelMessageAssociationMessageFolderStandardFlatFieldMetadatas = ({ @@ -59,6 +61,7 @@ export const buildMessageChannelMessageAssociationMessageFolderStandardFlatField label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -78,6 +81,7 @@ export const buildMessageChannelMessageAssociationMessageFolderStandardFlatField label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -97,6 +101,7 @@ export const buildMessageChannelMessageAssociationMessageFolderStandardFlatField label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -106,6 +111,94 @@ export const buildMessageChannelMessageAssociationMessageFolderStandardFlatField twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: + 'Message channel message association message folder record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_MESSAGE_FOLDER, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), messageChannelMessageAssociation: createStandardRelationFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-standard-flat-field-metadata.util.ts index add44e26cd..6970b58494 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-message-association-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION } from 'src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity'; import { MessageDirection } from 'src/modules/messaging/common/enums/message-direction.enum'; export const buildMessageChannelMessageAssociationStandardFlatFieldMetadatas = @@ -60,6 +62,7 @@ export const buildMessageChannelMessageAssociationStandardFlatFieldMetadatas = label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -79,6 +82,7 @@ export const buildMessageChannelMessageAssociationStandardFlatFieldMetadatas = label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -98,6 +102,7 @@ export const buildMessageChannelMessageAssociationStandardFlatFieldMetadatas = label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -107,6 +112,93 @@ export const buildMessageChannelMessageAssociationStandardFlatFieldMetadatas = twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message channel message association record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), messageExternalId: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-standard-flat-field-metadata.util.ts index 41a6db43de..c632b0f393 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-channel-standard-flat-field-metadata.util.ts @@ -12,7 +12,11 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; -import { MessageChannelType } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { + MessageChannelType, + SEARCH_FIELDS_FOR_MESSAGE_CHANNEL, +} from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; export const buildMessageChannelStandardFlatFieldMetadatas = ({ now, @@ -56,6 +60,7 @@ export const buildMessageChannelStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +80,7 @@ export const buildMessageChannelStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -94,6 +100,7 @@ export const buildMessageChannelStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -103,6 +110,93 @@ export const buildMessageChannelStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message Channel record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE_CHANNEL, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), visibility: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-folder-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-folder-standard-flat-field-metadata.util.ts index fe3a748a86..d7c7de5457 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-folder-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-folder-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_MESSAGE_FOLDER } from 'src/modules/messaging/common/standard-objects/message-folder.workspace-entity'; export const buildMessageFolderStandardFlatFieldMetadatas = ({ now, @@ -52,6 +54,7 @@ export const buildMessageFolderStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -71,6 +74,7 @@ export const buildMessageFolderStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -90,6 +94,7 @@ export const buildMessageFolderStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -99,6 +104,93 @@ export const buildMessageFolderStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message Folder record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE_FOLDER, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), name: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-participant-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-participant-standard-flat-field-metadata.util.ts index ffba0fc095..da91aad8b4 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-participant-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-participant-standard-flat-field-metadata.util.ts @@ -13,6 +13,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_MESSAGE_PARTICIPANT } from 'src/modules/messaging/common/standard-objects/message-participant.workspace-entity'; export const buildMessageParticipantStandardFlatFieldMetadatas = ({ now, @@ -56,6 +58,7 @@ export const buildMessageParticipantStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +78,7 @@ export const buildMessageParticipantStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -94,6 +98,7 @@ export const buildMessageParticipantStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -103,6 +108,93 @@ export const buildMessageParticipantStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message Participant record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE_PARTICIPANT, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), role: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-standard-flat-field-metadata.util.ts index 59f95f2857..b822a8c33a 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-standard-flat-field-metadata.util.ts @@ -12,6 +12,8 @@ import { createStandardFieldFlatMetadata, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_MESSAGE } from 'src/modules/messaging/common/standard-objects/message.workspace-entity'; export const buildMessageStandardFlatFieldMetadatas = ({ now, @@ -52,6 +54,7 @@ export const buildMessageStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -71,6 +74,7 @@ export const buildMessageStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -90,6 +94,7 @@ export const buildMessageStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -99,6 +104,93 @@ export const buildMessageStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_MESSAGE, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), headerMessageId: createStandardFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-thread-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-thread-standard-flat-field-metadata.util.ts index bc15e555f8..7306040209 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-thread-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-message-thread-standard-flat-field-metadata.util.ts @@ -51,6 +51,7 @@ export const buildMessageThreadStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -70,6 +71,7 @@ export const buildMessageThreadStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -89,6 +91,7 @@ export const buildMessageThreadStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -98,6 +101,87 @@ export const buildMessageThreadStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Message Thread record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), messages: createStandardRelationFieldFlatMetadata({ objectName, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-standard-flat-field-metadata.util.ts index a0b56e6632..e80242c5c9 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-standard-flat-field-metadata.util.ts @@ -54,6 +54,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +76,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -96,6 +98,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -168,6 +171,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -190,6 +194,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -238,7 +243,6 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Relations', description: 'Note targets', icon: 'IconArrowUpRight', - isSystem: true, isNullable: true, targetObjectName: 'noteTarget', targetFieldName: 'note', @@ -261,7 +265,6 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Note attachments', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetNote', @@ -284,7 +287,6 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline Activities linked to the note.', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetNote', @@ -307,7 +309,6 @@ export const buildNoteStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the note', icon: 'IconHeart', - isSystem: true, isNullable: false, targetObjectName: 'favorite', targetFieldName: 'note', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-target-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-target-standard-flat-field-metadata.util.ts index 6b80da08f5..621e891e39 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-target-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-note-target-standard-flat-field-metadata.util.ts @@ -54,6 +54,7 @@ export const buildNoteTargetStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +76,7 @@ export const buildNoteTargetStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -96,6 +98,7 @@ export const buildNoteTargetStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -107,6 +110,87 @@ export const buildNoteTargetStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'NoteTarget record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // Relation fields note: createStandardRelationFieldFlatMetadata({ diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-opportunity-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-opportunity-standard-flat-field-metadata.util.ts index fbbb501925..256ce3d871 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-opportunity-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-opportunity-standard-flat-field-metadata.util.ts @@ -55,6 +55,7 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +77,7 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -97,6 +99,7 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -219,6 +222,7 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -241,6 +245,7 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -337,7 +342,6 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the opportunity', icon: 'IconHeart', - isSystem: true, isNullable: true, targetObjectName: 'favorite', targetFieldName: 'opportunity', @@ -406,7 +410,6 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Attachments linked to the opportunity', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetOpportunity', @@ -429,7 +432,6 @@ export const buildOpportunityStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline Activities linked to the opportunity.', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetOpportunity', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-person-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-person-standard-flat-field-metadata.util.ts index d53ce0340b..bcb8d4f2ac 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-person-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-person-standard-flat-field-metadata.util.ts @@ -55,6 +55,7 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +77,7 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -97,6 +99,7 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -294,6 +297,7 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -316,6 +320,7 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -434,7 +439,6 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the contact', icon: 'IconHeart', - isSystem: true, isNullable: true, targetObjectName: 'favorite', targetFieldName: 'person', @@ -457,7 +461,6 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Attachments linked to the contact.', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetPerson', @@ -480,7 +483,6 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Message Participants', description: 'Message Participants', icon: 'IconUserCircle', - isSystem: true, isNullable: true, targetObjectName: 'messageParticipant', targetFieldName: 'person', @@ -503,7 +505,6 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Calendar Event Participants', description: 'Calendar Event Participants', icon: 'IconCalendar', - isSystem: true, isNullable: true, targetObjectName: 'calendarEventParticipant', targetFieldName: 'person', @@ -526,7 +527,6 @@ export const buildPersonStandardFlatFieldMetadatas = ({ label: 'Events', description: 'Events linked to the person', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetPerson', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-standard-flat-field-metadata.util.ts index 97f78602e9..c24038d116 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-standard-flat-field-metadata.util.ts @@ -55,6 +55,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +77,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -97,6 +99,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -212,6 +215,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -234,6 +238,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -282,7 +287,6 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Relations', description: 'Task targets', icon: 'IconArrowUpRight', - isSystem: true, isNullable: true, targetObjectName: 'taskTarget', targetFieldName: 'task', @@ -305,7 +309,6 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Task attachments', icon: 'IconFileImport', - isSystem: true, isNullable: true, targetObjectName: 'attachment', targetFieldName: 'targetTask', @@ -352,7 +355,6 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline Activities linked to the task.', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, targetObjectName: 'timelineActivity', targetFieldName: 'targetTask', @@ -375,7 +377,6 @@ export const buildTaskStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the task', icon: 'IconHeart', - isSystem: true, isNullable: false, targetObjectName: 'favorite', targetFieldName: 'task', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-target-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-target-standard-flat-field-metadata.util.ts index 270e670aef..5a195522e5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-target-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-task-target-standard-flat-field-metadata.util.ts @@ -54,6 +54,7 @@ export const buildTaskTargetStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -75,6 +76,7 @@ export const buildTaskTargetStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -96,6 +98,7 @@ export const buildTaskTargetStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { @@ -107,6 +110,87 @@ export const buildTaskTargetStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'TaskTarget record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // Relation fields task: createStandardRelationFieldFlatMetadata({ diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-timeline-activity-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-timeline-activity-standard-flat-field-metadata.util.ts index f9d58d6ae0..d8d2a4d8bb 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-timeline-activity-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-timeline-activity-standard-flat-field-metadata.util.ts @@ -1,10 +1,10 @@ +import { STANDARD_OBJECTS } from 'twenty-shared/metadata'; import { DateDisplayFormat, FieldMetadataType, RelationOnDeleteAction, RelationType, } from 'twenty-shared/types'; -import { STANDARD_OBJECTS } from 'twenty-shared/metadata'; import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type'; import { type AllStandardObjectFieldName } from 'src/engine/workspace-manager/twenty-standard-application/types/all-standard-object-field-name.type'; @@ -13,6 +13,8 @@ import { type CreateStandardFieldArgs, } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util'; import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util'; +import { getTsVectorColumnExpressionFromFields } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; +import { SEARCH_FIELDS_FOR_TIMELINE_ACTIVITY } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity'; export const buildTimelineActivityStandardFlatFieldMetadatas = ({ now, @@ -57,6 +59,7 @@ export const buildTimelineActivityStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +79,7 @@ export const buildTimelineActivityStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -95,6 +99,7 @@ export const buildTimelineActivityStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -104,7 +109,70 @@ export const buildTimelineActivityStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), - + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'Timeline activity record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), // TimelineActivity-specific fields happensAt: createStandardFieldFlatMetadata({ objectName, @@ -464,4 +532,27 @@ export const buildTimelineActivityStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + settings: { + generatedType: 'STORED', + asExpression: getTsVectorColumnExpressionFromFields( + SEARCH_FIELDS_FOR_TIMELINE_ACTIVITY, + ), + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), }); diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-automated-trigger-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-automated-trigger-standard-flat-field-metadata.util.ts index 705639b44d..ab0f142785 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-automated-trigger-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-automated-trigger-standard-flat-field-metadata.util.ts @@ -55,6 +55,7 @@ export const buildWorkflowAutomatedTriggerStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -74,6 +75,7 @@ export const buildWorkflowAutomatedTriggerStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -93,6 +95,7 @@ export const buildWorkflowAutomatedTriggerStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -102,6 +105,87 @@ export const buildWorkflowAutomatedTriggerStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + position: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'position', + type: FieldMetadataType.POSITION, + label: 'Position', + description: 'WorkflowAutomatedTrigger record position', + icon: 'IconHierarchy2', + isSystem: true, + isNullable: false, + defaultValue: 0, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + searchVector: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'searchVector', + type: FieldMetadataType.TS_VECTOR, + label: 'Search vector', + description: 'Field used for full-text search', + icon: 'IconUser', + isSystem: true, + isNullable: true, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), type: createStandardFieldFlatMetadata({ objectName, workspaceId, @@ -113,6 +197,7 @@ export const buildWorkflowAutomatedTriggerStandardFlatFieldMetadatas = ({ icon: 'IconSettingsAutomation', isNullable: false, isUIReadOnly: true, + defaultValue: "'DATABASE_EVENT'", options: [ { value: 'DATABASE_EVENT', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-run-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-run-standard-flat-field-metadata.util.ts index c81f72373b..16d1f46df0 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-run-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-run-standard-flat-field-metadata.util.ts @@ -54,6 +54,7 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -73,6 +74,7 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -92,6 +94,7 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -210,6 +213,7 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Executed by', description: 'The executor of the workflow', icon: 'IconCreativeCommonsSa', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: { @@ -232,6 +236,7 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -399,7 +404,6 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the workflow run', icon: 'IconHeart', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'favorite', @@ -423,7 +427,6 @@ export const buildWorkflowRunStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline activities linked to the run', icon: 'IconTimelineEvent', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'timelineActivity', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-standard-flat-field-metadata.util.ts index 9bdcd6e116..8c26c49e56 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-standard-flat-field-metadata.util.ts @@ -53,6 +53,7 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -72,6 +73,7 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -91,6 +93,7 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -187,6 +190,7 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Created by', description: 'The creator of the record', icon: 'IconCreativeCommonsSa', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -209,6 +213,7 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Updated by', description: 'The workspace member who last updated the record', icon: 'IconUserCircle', + isSystem: true, isUIReadOnly: true, isNullable: false, defaultValue: { @@ -301,7 +306,6 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Automated Triggers', description: 'Workflow automated triggers linked to the workflow.', icon: 'IconSettingsAutomation', - isSystem: true, isUIReadOnly: true, isNullable: false, targetObjectName: 'workflowAutomatedTrigger', @@ -325,7 +329,6 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the workflow', icon: 'IconHeart', - isSystem: true, isNullable: false, targetObjectName: 'favorite', targetFieldName: 'workflow', @@ -348,7 +351,6 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline activities linked to the workflow', icon: 'IconTimelineEvent', - isSystem: true, isNullable: false, targetObjectName: 'timelineActivity', targetFieldName: 'targetWorkflow', @@ -371,7 +373,6 @@ export const buildWorkflowStandardFlatFieldMetadatas = ({ label: 'Attachments', description: 'Attachments linked to the workflow', icon: 'IconFileUpload', - isSystem: true, isNullable: false, targetObjectName: 'attachment', targetFieldName: 'targetWorkflow', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-version-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-version-standard-flat-field-metadata.util.ts index c651558220..3165a8da13 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-version-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workflow-version-standard-flat-field-metadata.util.ts @@ -57,6 +57,7 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -76,6 +77,7 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -95,6 +97,7 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -104,6 +107,52 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), name: createStandardFieldFlatMetadata({ objectName, workspaceId, @@ -285,7 +334,6 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the workflow version', icon: 'IconHeart', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'favorite', @@ -309,7 +357,6 @@ export const buildWorkflowVersionStandardFlatFieldMetadatas = ({ label: 'Timeline Activities', description: 'Timeline activities linked to the version', icon: 'IconTimelineEvent', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'timelineActivity', diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workspace-member-standard-flat-field-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workspace-member-standard-flat-field-metadata.util.ts index 54c70b92cc..1e96b0a84d 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workspace-member-standard-flat-field-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/compute-workspace-member-standard-flat-field-metadata.util.ts @@ -60,6 +60,7 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Creation date', description: 'Creation date', icon: 'IconCalendar', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -79,6 +80,7 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Last update', description: 'Last time the record was changed', icon: 'IconCalendarClock', + isSystem: true, isNullable: false, isUIReadOnly: true, defaultValue: 'now', @@ -98,6 +100,7 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Deleted at', description: 'Date when the record was deleted', icon: 'IconCalendarMinus', + isSystem: true, isNullable: true, isUIReadOnly: true, settings: { displayFormat: DateDisplayFormat.RELATIVE }, @@ -444,7 +447,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Favorites', description: 'Favorites linked to the workspace member', icon: 'IconHeart', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'favorite', @@ -468,7 +470,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Account Owner For Companies', description: 'Account owner for companies', icon: 'IconBriefcase', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'company', @@ -492,7 +493,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Connected accounts', description: 'Connected accounts', icon: 'IconAt', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'connectedAccount', @@ -516,7 +516,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Message Participants', description: 'Message Participants', icon: 'IconUserCircle', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'messageParticipant', @@ -540,7 +539,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Blocklist', description: 'Blocklisted handles', icon: 'IconForbid2', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'blocklist', @@ -564,7 +562,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Calendar Event Participants', description: 'Calendar Event Participants', icon: 'IconCalendar', - isSystem: true, isNullable: false, isUIReadOnly: true, targetObjectName: 'calendarEventParticipant', @@ -588,7 +585,6 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ label: 'Events', description: 'Events linked to the workspace member', icon: 'IconTimelineEvent', - isSystem: true, isNullable: true, isUIReadOnly: true, targetObjectName: 'timelineActivity', @@ -625,4 +621,50 @@ export const buildWorkspaceMemberStandardFlatFieldMetadatas = ({ twentyStandardApplicationId, now, }), + createdBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'createdBy', + type: FieldMetadataType.ACTOR, + label: 'Created by', + description: 'The creator of the record', + icon: 'IconCreativeCommonsSa', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), + updatedBy: createStandardFieldFlatMetadata({ + objectName, + workspaceId, + context: { + fieldName: 'updatedBy', + type: FieldMetadataType.ACTOR, + label: 'Updated by', + description: 'The workspace member who last updated the record', + icon: 'IconUserCircle', + isSystem: true, + isUIReadOnly: true, + isNullable: false, + defaultValue: { + source: "'MANUAL'", + name: "'System'", + workspaceMemberId: null, + }, + }, + standardObjectMetadataRelatedEntityIds, + dependencyFlatEntityMaps, + twentyStandardApplicationId, + now, + }), }); diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util.ts index 9d487c8368..32f52bc973 100644 --- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util.ts @@ -33,7 +33,6 @@ export type CreateStandardMorphOrRelationFieldContext< icon: string; targetObjectName: T; targetFieldName: AllStandardObjectFieldName; - isSystem?: boolean; isNullable?: boolean; isUIReadOnly?: boolean; defaultValue?: FieldMetadataDefaultValueForAnyType; @@ -63,7 +62,6 @@ export const createStandardRelationFieldFlatMetadata = < icon, targetObjectName, targetFieldName, - isSystem = false, isNullable = true, isUIReadOnly = false, defaultValue = null, @@ -100,7 +98,7 @@ export const createStandardRelationFieldFlatMetadata = < icon, isCustom: false, isActive: true, - isSystem, + isSystem: false, isNullable, isUnique: false, isUIReadOnly, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-build-orchestrator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-build-orchestrator.service.ts index aa3f953e79..169a7403e5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-build-orchestrator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-build-orchestrator.service.ts @@ -14,6 +14,7 @@ import { } from 'src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type'; import { AllUniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/all-universal-flat-entity-maps.type'; import { aggregateOrchestratorActionsReport } from 'src/engine/workspace-manager/workspace-migration/utils/aggregate-orchestrator-actions-report.util'; +import { crossEntityTransversalValidation } from 'src/engine/workspace-manager/workspace-migration/utils/cross-entity-transversal-validation.util'; import { WorkspaceMigrationAgentActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/agent/workspace-migration-agent-actions-builder.service'; import { WorkspaceMigrationCommandMenuItemActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/command-menu-item/workspace-migration-command-menu-item-actions-builder.service'; import { WorkspaceMigrationFieldActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/field/workspace-migration-field-actions-builder.service'; @@ -126,7 +127,6 @@ export class WorkspaceMigrationBuildOrchestratorService { fromToAllFlatEntityMaps, dependencyAllFlatEntityMaps, additionalCacheDataMaps, - applicationUniversalIdentifier, }: WorkspaceMigrationOrchestratorBuildArgs): Promise< | WorkspaceMigrationOrchestratorFailedResult | WorkspaceMigrationOrchestratorSuccessfulResult @@ -994,6 +994,13 @@ export class WorkspaceMigrationBuildOrchestratorService { } } + const { objectMetadata } = crossEntityTransversalValidation({ + optimisticUniversalFlatMaps: optimisticAllFlatEntityMaps, + orchestratorActionsReport, + }); + + orchestratorFailureReport.objectMetadata.push(...objectMetadata); + const allErrors = Object.values(orchestratorFailureReport); if (allErrors.some((report) => report.length > 0)) { @@ -1013,7 +1020,8 @@ export class WorkspaceMigrationBuildOrchestratorService { return { status: 'success', workspaceMigration: { - applicationUniversalIdentifier, + applicationUniversalIdentifier: + buildOptions.applicationUniversalIdentifier, actions: [ // Object and fields and indexes ...aggregatedOrchestratorActionsReport.index.delete, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service.ts index 85c8c94369..8d640f06d3 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/services/workspace-migration-validate-build-and-run-service.ts @@ -292,10 +292,10 @@ export class WorkspaceMigrationValidateBuildAndRunService { }); return await this.validateBuildAndRunWorkspaceMigrationFromTo({ - applicationUniversalIdentifier, buildOptions: { isSystemBuild, inferDeletionFromMissingEntities, + applicationUniversalIdentifier, }, fromToAllFlatEntityMaps, workspaceId, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type.ts index 6118c68295..1ef352e6a5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type.ts @@ -23,7 +23,6 @@ export type WorkspaceMigrationOrchestratorBuildArgs = { fromToAllFlatEntityMaps: FromToAllUniversalFlatEntityMaps; dependencyAllFlatEntityMaps?: Partial; additionalCacheDataMaps: WorkspaceMigrationBuilderAdditionalCacheDataMaps; - applicationUniversalIdentifier: string; }; export type OrchestratorFailureReport = { diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/__tests__/universal-flat-entity-deleted-created-updated-matrix-dispatcher.util.spec.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/__tests__/universal-flat-entity-deleted-created-updated-matrix-dispatcher.util.spec.ts index aa036e4ef9..2216b13411 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/__tests__/universal-flat-entity-deleted-created-updated-matrix-dispatcher.util.spec.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/__tests__/universal-flat-entity-deleted-created-updated-matrix-dispatcher.util.spec.ts @@ -40,6 +40,7 @@ describe('flatEntityDeletedCreatedUpdatedMatrixDispatcher', () => { buildOptions: { inferDeletionFromMissingEntities: { fieldMetadata: false }, isSystemBuild: false, + applicationUniversalIdentifier: 'application-universal-identifier-1', }, }, }, @@ -67,6 +68,7 @@ describe('flatEntityDeletedCreatedUpdatedMatrixDispatcher', () => { buildOptions: { inferDeletionFromMissingEntities: { fieldMetadata: true }, isSystemBuild: false, + applicationUniversalIdentifier: 'application-universal-identifier-1', }, }, }, @@ -111,6 +113,7 @@ describe('flatEntityDeletedCreatedUpdatedMatrixDispatcher', () => { buildOptions: { inferDeletionFromMissingEntities: { fieldMetadata: false }, isSystemBuild: false, + applicationUniversalIdentifier: 'application-universal-identifier-1', }, }, }, @@ -183,6 +186,7 @@ describe('flatEntityDeletedCreatedUpdatedMatrixDispatcher', () => { buildOptions: { inferDeletionFromMissingEntities: { fieldMetadata: true }, isSystemBuild: false, + applicationUniversalIdentifier: 'application-universal-identifier-1', }, }, }, @@ -211,6 +215,7 @@ describe('flatEntityDeletedCreatedUpdatedMatrixDispatcher', () => { buildOptions: { inferDeletionFromMissingEntities: { fieldMetadata: false }, isSystemBuild: false, + applicationUniversalIdentifier: 'application-universal-identifier-1', }, }, }, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/compare-two-universal-flat-entity.util.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/compare-two-universal-flat-entity.util.ts index 558e0e01d3..b2ed47fbb5 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/compare-two-universal-flat-entity.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/compare-two-universal-flat-entity.util.ts @@ -28,6 +28,7 @@ export const compareTwoFlatEntity = ({ [fromUniversalFlatEntity, toUniversalFlatEntity].map( (universalFlatEntity) => transformUniversalFlatEntityForComparison({ + metadataName, universalFlatEntity, propertiesToCompare, propertiesToStringify, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/transform-universal-flat-entity-for-comparison.util.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/transform-universal-flat-entity-for-comparison.util.ts index 1f4aa23b15..a081907d5f 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/transform-universal-flat-entity-for-comparison.util.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/universal-flat-entity/utils/transform-universal-flat-entity-for-comparison.util.ts @@ -8,10 +8,12 @@ import { type MetadataUniversalFlatEntityPropertiesToStringify } from 'src/engin export function transformUniversalFlatEntityForComparison< T extends AllMetadataName, >({ + metadataName, universalFlatEntity, propertiesToCompare, propertiesToStringify, }: { + metadataName: T; universalFlatEntity: MetadataUniversalFlatEntity; propertiesToCompare: MetadataUniversalFlatEntityPropertiesToCompare[]; propertiesToStringify: MetadataUniversalFlatEntityPropertiesToStringify[]; @@ -20,6 +22,18 @@ export function transformUniversalFlatEntityForComparison< (flatEntityAccumulator, propertyToCompare) => { const currentValue = universalFlatEntity[propertyToCompare]; + // TODO remove once https://github.com/twentyhq/core-team-issues/issues/2227 has been resolved + if ( + metadataName === 'index' && + propertyToCompare === 'universalFlatIndexFieldMetadatas' && + Array.isArray(currentValue) + ) { + for (const item of currentValue) { + delete item['createdAt']; + delete item['updatedAt']; + } + } + if ( propertiesToStringify.includes( propertyToCompare as string as MetadataUniversalFlatEntityPropertiesToStringify, diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/utils/cross-entity-transversal-validation.util.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/utils/cross-entity-transversal-validation.util.ts new file mode 100644 index 0000000000..f7232ed62e --- /dev/null +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/utils/cross-entity-transversal-validation.util.ts @@ -0,0 +1,21 @@ +import { validateObjectMetadataSystemFieldsIntegrity } from 'src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-object-metadata-system-fields-integrity'; +import { + type OrchestratorActionsReport, + type OrchestratorFailureReport, +} from 'src/engine/workspace-manager/workspace-migration/types/workspace-migration-orchestrator.type'; +import { type AllUniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/all-universal-flat-entity-maps.type'; + +export const crossEntityTransversalValidation = ({ + optimisticUniversalFlatMaps, + orchestratorActionsReport, +}: { + optimisticUniversalFlatMaps: AllUniversalFlatEntityMaps; + orchestratorActionsReport: OrchestratorActionsReport; +}): Pick => { + const { objectMetadata } = validateObjectMetadataSystemFieldsIntegrity({ + optimisticUniversalFlatMaps, + orchestratorActionsReport, + }); + + return { objectMetadata }; +}; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type.ts index 80b076e89e..491edfdadc 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/workspace-migration-builder-options.type.ts @@ -3,4 +3,5 @@ import { type InferDeletionFromMissingEntities } from 'src/engine/workspace-mana export type WorkspaceMigrationBuilderOptions = { inferDeletionFromMissingEntities?: InferDeletionFromMissingEntities; isSystemBuild: boolean; + applicationUniversalIdentifier: string; }; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/utils/build-universal-flat-object-field-by-name-and-join-column-maps.util.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/utils/build-universal-flat-object-field-by-name-and-join-column-maps.util.ts new file mode 100644 index 0000000000..ee2ea45751 --- /dev/null +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/utils/build-universal-flat-object-field-by-name-and-join-column-maps.util.ts @@ -0,0 +1,40 @@ +import { isDefined } from 'twenty-shared/utils'; + +import { findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-many-flat-entity-by-universal-identifier-in-universal-flat-entity-maps-or-throw.util'; +import { isMorphOrRelationUniversalFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/utils/is-morph-or-relation-flat-field-metadata.util'; +import { type AllUniversalFlatEntityMaps } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/all-universal-flat-entity-maps.type'; +import { type UniversalFlatObjectMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-object-metadata.type'; + +export const buildUniversalFlatObjectFieldByNameAndJoinColumnMaps = ({ + flatFieldMetadataMaps, + flatObjectMetadata, +}: { + flatFieldMetadataMaps: AllUniversalFlatEntityMaps['flatFieldMetadataMaps']; + flatObjectMetadata: UniversalFlatObjectMetadata; +}) => { + const fieldUniversalIdentifierByName: Record = {}; + const fieldUniversalIdentifierByJoinColumnName: Record = {}; + + const objectFields = + findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow({ + universalIdentifiers: flatObjectMetadata.fieldUniversalIdentifiers, + flatEntityMaps: flatFieldMetadataMaps, + }); + + for (const field of objectFields) { + fieldUniversalIdentifierByName[field.name] = field.universalIdentifier; + + if (isMorphOrRelationUniversalFlatFieldMetadata(field)) { + if (isDefined(field.universalSettings.joinColumnName)) { + fieldUniversalIdentifierByJoinColumnName[ + field.universalSettings.joinColumnName + ] = field.universalIdentifier; + } + } + } + + return { + fieldUniversalIdentifierByName, + fieldUniversalIdentifierByJoinColumnName, + }; +}; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-agent-validator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-agent-validator.service.ts index fc496e8ee5..2500f8d9a4 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-agent-validator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-agent-validator.service.ts @@ -8,6 +8,7 @@ import { AgentExceptionCode } from 'src/engine/metadata-modules/ai/ai-agent/agen import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util'; import { type UniversalFlatAgent } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-agent.type'; import { belongsToTwentyStandardApp } from 'src/engine/metadata-modules/utils/belongs-to-twenty-standard-app.util'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { type FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/types/failed-flat-entity-validation.type'; import { getEmptyFlatEntityValidationError } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/utils/get-flat-entity-validation-error.util'; import { type FlatEntityUpdateValidationArgs } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/universal-flat-entity-update-validation-args.type'; @@ -97,7 +98,7 @@ export class FlatAgentValidatorService { } if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && belongsToTwentyStandardApp({ universalIdentifier: existingAgent.universalIdentifier, applicationUniversalIdentifier: @@ -148,7 +149,7 @@ export class FlatAgentValidatorService { } if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && belongsToTwentyStandardApp({ universalIdentifier: fromFlatAgent.universalIdentifier, applicationUniversalIdentifier: diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-field-metadata-validator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-field-metadata-validator.service.ts index 0b034b751e..d952d1a3d8 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-field-metadata-validator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-field-metadata-validator.service.ts @@ -14,7 +14,7 @@ import { isFlatFieldMetadataNameSyncedWithLabel } from 'src/engine/metadata-modu import { isMorphOrRelationUniversalFlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/utils/is-morph-or-relation-flat-field-metadata.util'; import { validateFlatFieldMetadataNameAvailability } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name-availability.util'; import { validateFlatFieldMetadataName } from 'src/engine/metadata-modules/flat-field-metadata/validators/utils/validate-flat-field-metadata-name.util'; -import { belongsToTwentyStandardApp } from 'src/engine/metadata-modules/utils/belongs-to-twenty-standard-app.util'; +import { UniversalFlatFieldMetadata } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-field-metadata.type'; import { FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/types/failed-flat-entity-validation.type'; import { getEmptyFlatEntityValidationError } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/utils/get-flat-entity-validation-error.util'; import { FlatEntityUpdateValidationArgs } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/universal-flat-entity-update-validation-args.type'; @@ -75,6 +75,31 @@ export class FlatFieldMetadataValidatorService { flatFieldMetadataToValidate.objectMetadataUniversalIdentifier, }; + const SYSTEM_FIELD_ALLOWED_UPDATE_PROPERTIES = [ + 'universalSettings', + 'isActive', + ] as const satisfies (keyof UniversalFlatFieldMetadata)[]; + + if ( + !buildOptions.isSystemBuild && + existingFlatFieldMetadataToUpdate.isSystem + ) { + const disallowedProperties = Object.keys(flatEntityUpdate).filter( + (property) => + !SYSTEM_FIELD_ALLOWED_UPDATE_PROPERTIES.includes( + property as (typeof SYSTEM_FIELD_ALLOWED_UPDATE_PROPERTIES)[number], + ), + ); + + if (disallowedProperties.length > 0) { + validationResult.errors.push({ + code: FieldMetadataExceptionCode.FIELD_MUTATION_NOT_ALLOWED, + message: `System fields only allow updating: ${SYSTEM_FIELD_ALLOWED_UPDATE_PROPERTIES.join(', ')}. Forbidden properties: ${disallowedProperties.join(', ')}`, + userFriendlyMessage: msg`System fields cannot be updated`, + }); + } + } + const flatObjectMetadata = findFlatEntityByUniversalIdentifier({ universalIdentifier: flatFieldMetadataToValidate.objectMetadataUniversalIdentifier, @@ -155,7 +180,7 @@ export class FlatFieldMetadataValidatorService { flatFieldMetadataToValidate.isLabelSyncedWithName && !isFlatFieldMetadataNameSyncedWithLabel({ flatFieldMetadata: flatFieldMetadataToValidate, - isSystemBuild: buildOptions.isSystemBuild, + buildOptions, }) ) { validationResult.errors.push({ @@ -205,6 +230,7 @@ export class FlatFieldMetadataValidatorService { flatFieldMetadataMaps: optimisticFlatFieldMetadataMaps, flatObjectMetadataMaps, }, + buildOptions, }: UniversalFlatEntityValidationArgs< typeof ALL_METADATA_NAME.fieldMetadata >): FailedFlatEntityValidation<'fieldMetadata', 'delete'> { @@ -244,6 +270,22 @@ export class FlatFieldMetadataValidatorService { flatEntityMaps: flatObjectMetadataMaps, }); + const parentObjectMetadataHasBeenDeleted = !isDefined( + relatedFlatObjectMetadata, + ); + + if ( + !buildOptions.isSystemBuild && + flatFieldMetadataToDelete.isSystem && + !parentObjectMetadataHasBeenDeleted + ) { + validationResult.errors.push({ + code: FieldMetadataExceptionCode.FIELD_MUTATION_NOT_ALLOWED, + message: 'System fields cannot be deleted', + userFriendlyMessage: msg`System fields cannot be deleted`, + }); + } + if ( isDefined(relatedFlatObjectMetadata) && relatedFlatObjectMetadata.labelIdentifierFieldMetadataUniversalIdentifier === @@ -257,35 +299,6 @@ export class FlatFieldMetadataValidatorService { }); } - const relationTargetObjectMetadataHasBeenDeleted = - isMorphOrRelationUniversalFlatFieldMetadata(flatFieldMetadataToDelete) && - !isDefined( - findFlatEntityByUniversalIdentifier({ - universalIdentifier: - flatFieldMetadataToDelete.relationTargetObjectMetadataUniversalIdentifier, - flatEntityMaps: flatObjectMetadataMaps, - }), - ); - const parentObjectMetadataHasBeenDeleted = !isDefined( - findFlatEntityByUniversalIdentifier({ - universalIdentifier: - flatFieldMetadataToDelete.objectMetadataUniversalIdentifier, - flatEntityMaps: flatObjectMetadataMaps, - }), - ); - - if ( - belongsToTwentyStandardApp(flatFieldMetadataToDelete) && - !relationTargetObjectMetadataHasBeenDeleted && - !parentObjectMetadataHasBeenDeleted - ) { - validationResult.errors.push({ - code: FieldMetadataExceptionCode.INVALID_FIELD_INPUT, - message: "Standard Fields can't be deleted", - userFriendlyMessage: msg`Standard fields cannot be deleted`, - }); - } - return validationResult; } @@ -365,7 +378,7 @@ export class FlatFieldMetadataValidatorService { flatFieldMetadataToValidate.isLabelSyncedWithName && !isFlatFieldMetadataNameSyncedWithLabel({ flatFieldMetadata: flatFieldMetadataToValidate, - isSystemBuild: buildOptions.isSystemBuild, + buildOptions, }) ) { validationResult.errors.push({ diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-object-metadata-validator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-object-metadata-validator.service.ts index 93343405c8..3e598e7ee2 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-object-metadata-validator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-object-metadata-validator.service.ts @@ -9,6 +9,7 @@ import { validateFlatObjectMetadataIdentifiers } from 'src/engine/metadata-modul import { validateFlatObjectMetadataNameAndLabels } from 'src/engine/metadata-modules/flat-object-metadata/validators/utils/validate-flat-object-metadata-name-and-labels.util'; import { ObjectMetadataExceptionCode } from 'src/engine/metadata-modules/object-metadata/object-metadata.exception'; import { belongsToTwentyStandardApp } from 'src/engine/metadata-modules/utils/belongs-to-twenty-standard-app.util'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/types/failed-flat-entity-validation.type'; import { getEmptyFlatEntityValidationError } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/utils/get-flat-entity-validation-error.util'; import { FlatEntityUpdateValidationArgs } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/universal-flat-entity-update-validation-args.type'; @@ -61,6 +62,14 @@ export class FlatObjectMetadataValidatorService { nameSingular: existingFlatObjectMetadata.nameSingular, }; + if (!buildOptions.isSystemBuild && existingFlatObjectMetadata.isSystem) { + validationResult.errors.push({ + code: ObjectMetadataExceptionCode.INVALID_OBJECT_INPUT, + message: t`System objects cannot be updated`, + userFriendlyMessage: msg`System objects cannot be updated`, + }); + } + validationResult.errors.push( ...validateFlatObjectMetadataNameAndLabels({ optimisticUniversalFlatObjectMetadataMaps: @@ -139,8 +148,16 @@ export class FlatObjectMetadataValidatorService { }); } + if (!buildOptions.isSystemBuild && flatObjectMetadataToDelete.isSystem) { + validationResult.errors.push({ + code: ObjectMetadataExceptionCode.INVALID_OBJECT_INPUT, + message: t`System objects cannot be deleted`, + userFriendlyMessage: msg`System objects cannot be deleted`, + }); + } + if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && belongsToTwentyStandardApp(flatObjectMetadataToDelete) ) { validationResult.errors.push({ diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-skill-validator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-skill-validator.service.ts index a53ab74f2b..d51a913d22 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-skill-validator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/services/flat-skill-validator.service.ts @@ -8,6 +8,7 @@ import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules import { SkillExceptionCode } from 'src/engine/metadata-modules/skill/skill.exception'; import { type UniversalFlatSkill } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/universal-flat-skill.type'; import { belongsToTwentyStandardApp } from 'src/engine/metadata-modules/utils/belongs-to-twenty-standard-app.util'; +import { isCallerTwentyStandardApp } from 'src/engine/metadata-modules/utils/is-caller-twenty-standard-app.util'; import { type FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/types/failed-flat-entity-validation.type'; import { getEmptyFlatEntityValidationError } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/builders/utils/get-flat-entity-validation-error.util'; import { type FlatEntityUpdateValidationArgs } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-builder/types/universal-flat-entity-update-validation-args.type'; @@ -90,7 +91,7 @@ export class FlatSkillValidatorService { } if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && belongsToTwentyStandardApp({ universalIdentifier: existingSkill.universalIdentifier, applicationUniversalIdentifier: @@ -153,7 +154,7 @@ export class FlatSkillValidatorService { }); if ( - !buildOptions.isSystemBuild && + !isCallerTwentyStandardApp(buildOptions) && isTwentyStandardSkill && hasNonIsActiveUpdates ) { diff --git a/packages/twenty-server/src/modules/attachment/standard-objects/attachment.workspace-entity.ts b/packages/twenty-server/src/modules/attachment/standard-objects/attachment.workspace-entity.ts index 94017b7c64..d0a0ed9f05 100644 --- a/packages/twenty-server/src/modules/attachment/standard-objects/attachment.workspace-entity.ts +++ b/packages/twenty-server/src/modules/attachment/standard-objects/attachment.workspace-entity.ts @@ -1,8 +1,9 @@ -import { type ActorMetadata } from 'twenty-shared/types'; +import { type ActorMetadata, FieldMetadataType } from 'twenty-shared/types'; import { type FileOutput } from 'src/engine/api/common/common-args-processors/data-arg-processor/types/file-item.type'; import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; import { type CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity'; import { type DashboardWorkspaceEntity } from 'src/modules/dashboard/standard-objects/dashboard.workspace-entity'; @@ -13,6 +14,12 @@ import { type TaskWorkspaceEntity } from 'src/modules/task/standard-objects/task import { type WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const NAME_FIELD_NAME = 'name'; + +export const SEARCH_FIELDS_FOR_ATTACHMENT: FieldTypeAndNameMetadata[] = [ + { name: NAME_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class AttachmentWorkspaceEntity extends BaseWorkspaceEntity { /** @deprecated Use `file[0].label` field instead */ name: string | null; diff --git a/packages/twenty-server/src/modules/blocklist/standard-objects/blocklist.workspace-entity.ts b/packages/twenty-server/src/modules/blocklist/standard-objects/blocklist.workspace-entity.ts index 76c9557910..c24591d743 100644 --- a/packages/twenty-server/src/modules/blocklist/standard-objects/blocklist.workspace-entity.ts +++ b/packages/twenty-server/src/modules/blocklist/standard-objects/blocklist.workspace-entity.ts @@ -1,7 +1,16 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_BLOCKLIST: FieldTypeAndNameMetadata[] = [ + { name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class BlocklistWorkspaceEntity extends BaseWorkspaceEntity { handle: string | null; workspaceMember: EntityRelation; diff --git a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity.ts index 01133110f9..1b50854b0e 100644 --- a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity.ts @@ -1,8 +1,16 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; import { type CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity'; +const EVENT_EXTERNAL_ID_FIELD_NAME = 'eventExternalId'; + +export const SEARCH_FIELDS_FOR_CALENDAR_CHANNEL_EVENT_ASSOCIATION: FieldTypeAndNameMetadata[] = + [{ name: EVENT_EXTERNAL_ID_FIELD_NAME, type: FieldMetadataType.TEXT }]; + export class CalendarChannelEventAssociationWorkspaceEntity extends BaseWorkspaceEntity { eventExternalId: string | null; recurringEventExternalId: string | null; diff --git a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts index b565da983d..387e8ff9e7 100644 --- a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity.ts @@ -1,6 +1,9 @@ import { registerEnumType } from '@nestjs/graphql'; +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity'; import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; @@ -52,6 +55,12 @@ registerEnumType(CalendarChannelContactAutoCreationPolicy, { name: 'CalendarChannelContactAutoCreationPolicy', }); +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_CALENDAR_CHANNEL: FieldTypeAndNameMetadata[] = [ + { name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class CalendarChannelWorkspaceEntity extends BaseWorkspaceEntity { handle: string | null; syncStatus: CalendarChannelSyncStatus | null; diff --git a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity.ts index ca6beb24af..e33874dd34 100644 --- a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity.ts @@ -1,9 +1,17 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event.workspace-entity'; import { type PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_CALENDAR_EVENT_PARTICIPANT: FieldTypeAndNameMetadata[] = + [{ name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }]; + export enum CalendarEventParticipantResponseStatus { NEEDS_ACTION = 'NEEDS_ACTION', DECLINED = 'DECLINED', diff --git a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event.workspace-entity.ts b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event.workspace-entity.ts index a8ed9efccb..a8beb70bfa 100644 --- a/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event.workspace-entity.ts +++ b/packages/twenty-server/src/modules/calendar/common/standard-objects/calendar-event.workspace-entity.ts @@ -1,10 +1,17 @@ -import { type LinksMetadata } from 'twenty-shared/types'; +import { FieldMetadataType, type LinksMetadata } from 'twenty-shared/types'; import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CalendarChannelEventAssociationWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel-event-association.workspace-entity'; import { type CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-event-participant.workspace-entity'; +const TITLE_FIELD_NAME = 'title'; + +export const SEARCH_FIELDS_FOR_CALENDAR_EVENT: FieldTypeAndNameMetadata[] = [ + { name: TITLE_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class CalendarEventWorkspaceEntity extends BaseWorkspaceEntity { title: string | null; isCanceled: boolean; diff --git a/packages/twenty-server/src/modules/connected-account/standard-objects/connected-account.workspace-entity.ts b/packages/twenty-server/src/modules/connected-account/standard-objects/connected-account.workspace-entity.ts index b868502efd..811b8f9714 100644 --- a/packages/twenty-server/src/modules/connected-account/standard-objects/connected-account.workspace-entity.ts +++ b/packages/twenty-server/src/modules/connected-account/standard-objects/connected-account.workspace-entity.ts @@ -1,12 +1,22 @@ -import { type ConnectedAccountProvider } from 'twenty-shared/types'; +import { + type ConnectedAccountProvider, + FieldMetadataType, +} from 'twenty-shared/types'; import { type ImapSmtpCaldavParams } from 'src/engine/core-modules/imap-smtp-caldav-connection/types/imap-smtp-caldav-connection.type'; import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity'; import { type MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_CONNECTED_ACCOUNT: FieldTypeAndNameMetadata[] = [ + { name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class ConnectedAccountWorkspaceEntity extends BaseWorkspaceEntity { handle: string | null; provider: ConnectedAccountProvider; diff --git a/packages/twenty-server/src/modules/favorite-folder/standard-objects/favorite-folder.workspace-entity.ts b/packages/twenty-server/src/modules/favorite-folder/standard-objects/favorite-folder.workspace-entity.ts index 4676afb2dd..59dfa75a31 100644 --- a/packages/twenty-server/src/modules/favorite-folder/standard-objects/favorite-folder.workspace-entity.ts +++ b/packages/twenty-server/src/modules/favorite-folder/standard-objects/favorite-folder.workspace-entity.ts @@ -1,7 +1,16 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/favorite.workspace-entity'; +const NAME_FIELD_NAME = 'name'; + +export const SEARCH_FIELDS_FOR_FAVORITE_FOLDER: FieldTypeAndNameMetadata[] = [ + { name: NAME_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class FavoriteFolderWorkspaceEntity extends BaseWorkspaceEntity { position: number; name: string | null; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity.ts index 74de2bd52b..785daaf48d 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity.ts @@ -1,8 +1,12 @@ +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type MessageChannelMessageAssociationWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity'; import { type MessageFolderWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-folder.workspace-entity'; +export const SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_MESSAGE_FOLDER: FieldTypeAndNameMetadata[] = + []; + export class MessageChannelMessageAssociationMessageFolderWorkspaceEntity extends BaseWorkspaceEntity { messageChannelMessageAssociation: EntityRelation; messageChannelMessageAssociationId: string; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity.ts index 2f1608ec63..4fa19313fb 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity.ts @@ -1,10 +1,18 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type MessageDirection } from 'src/modules/messaging/common/enums/message-direction.enum'; import { type MessageChannelMessageAssociationMessageFolderWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity'; import { type MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; import { type MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message.workspace-entity'; +const MESSAGE_EXTERNAL_ID_FIELD_NAME = 'messageExternalId'; + +export const SEARCH_FIELDS_FOR_MESSAGE_CHANNEL_MESSAGE_ASSOCIATION: FieldTypeAndNameMetadata[] = + [{ name: MESSAGE_EXTERNAL_ID_FIELD_NAME, type: FieldMetadataType.TEXT }]; + export class MessageChannelMessageAssociationWorkspaceEntity extends BaseWorkspaceEntity { messageExternalId: string | null; messageThreadExternalId: string | null; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts index 01fc0e30a5..3c1ab9babb 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-channel.workspace-entity.ts @@ -1,6 +1,9 @@ import { registerEnumType } from '@nestjs/graphql'; +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity'; import { type MessageChannelMessageAssociationWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity'; @@ -81,6 +84,12 @@ registerEnumType(MessageChannelPendingGroupEmailsAction, { name: 'MessageChannelPendingGroupEmailsAction', }); +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_MESSAGE_CHANNEL: FieldTypeAndNameMetadata[] = [ + { name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity { visibility: string; handle: string | null; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-folder.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-folder.workspace-entity.ts index 306f41d570..e00e21e3f2 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-folder.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-folder.workspace-entity.ts @@ -1,6 +1,9 @@ import { registerEnumType } from '@nestjs/graphql'; +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type MessageChannelMessageAssociationMessageFolderWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association-message-folder.workspace-entity'; import { type MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity'; @@ -14,6 +17,12 @@ registerEnumType(MessageFolderPendingSyncAction, { name: 'MessageFolderPendingSyncAction', }); +const NAME_FIELD_NAME = 'name'; + +export const SEARCH_FIELDS_FOR_MESSAGE_FOLDER: FieldTypeAndNameMetadata[] = [ + { name: NAME_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class MessageFolderWorkspaceEntity extends BaseWorkspaceEntity { name: string | null; messageChannel: EntityRelation; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-participant.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-participant.workspace-entity.ts index 4103cdd73b..32612bf06c 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message-participant.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message-participant.workspace-entity.ts @@ -1,11 +1,20 @@ -import { type MessageParticipantRole } from 'twenty-shared/types'; +import { + FieldMetadataType, + type MessageParticipantRole, +} from 'twenty-shared/types'; import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message.workspace-entity'; import { type PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const HANDLE_FIELD_NAME = 'handle'; + +export const SEARCH_FIELDS_FOR_MESSAGE_PARTICIPANT: FieldTypeAndNameMetadata[] = + [{ name: HANDLE_FIELD_NAME, type: FieldMetadataType.TEXT }]; + export class MessageParticipantWorkspaceEntity extends BaseWorkspaceEntity { role: MessageParticipantRole; handle: string | null; diff --git a/packages/twenty-server/src/modules/messaging/common/standard-objects/message.workspace-entity.ts b/packages/twenty-server/src/modules/messaging/common/standard-objects/message.workspace-entity.ts index 36c1c88f00..6ced964511 100644 --- a/packages/twenty-server/src/modules/messaging/common/standard-objects/message.workspace-entity.ts +++ b/packages/twenty-server/src/modules/messaging/common/standard-objects/message.workspace-entity.ts @@ -1,9 +1,18 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type MessageChannelMessageAssociationWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity'; import { type MessageParticipantWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-participant.workspace-entity'; import { type MessageThreadWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-thread.workspace-entity'; +const SUBJECT_FIELD_NAME = 'subject'; + +export const SEARCH_FIELDS_FOR_MESSAGE: FieldTypeAndNameMetadata[] = [ + { name: SUBJECT_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class MessageWorkspaceEntity extends BaseWorkspaceEntity { headerMessageId: string | null; subject: string | null; diff --git a/packages/twenty-server/src/modules/timeline/standard-objects/timeline-activity.workspace-entity.ts b/packages/twenty-server/src/modules/timeline/standard-objects/timeline-activity.workspace-entity.ts index cd31ca4f83..4aa900e7cd 100644 --- a/packages/twenty-server/src/modules/timeline/standard-objects/timeline-activity.workspace-entity.ts +++ b/packages/twenty-server/src/modules/timeline/standard-objects/timeline-activity.workspace-entity.ts @@ -1,5 +1,8 @@ +import { FieldMetadataType } from 'twenty-shared/types'; + import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity'; import { type CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity'; +import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util'; import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface'; import { type CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity'; import { type DashboardWorkspaceEntity } from 'src/modules/dashboard/standard-objects/dashboard.workspace-entity'; @@ -12,6 +15,12 @@ import { type WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common import { type WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity'; import { type WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity'; +const NAME_FIELD_NAME = 'name'; + +export const SEARCH_FIELDS_FOR_TIMELINE_ACTIVITY: FieldTypeAndNameMetadata[] = [ + { name: NAME_FIELD_NAME, type: FieldMetadataType.TEXT }, +]; + export class TimelineActivityWorkspaceEntity extends BaseWorkspaceEntity { happensAt: Date; name: string | null; diff --git a/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/failing-sync-application-object-system-fields.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/failing-sync-application-object-system-fields.integration-spec.ts.snap new file mode 100644 index 0000000000..27073c8853 --- /dev/null +++ b/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/failing-sync-application-object-system-fields.integration-spec.ts.snap @@ -0,0 +1,391 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`Sync application should fail due to object system fields integrity should fail when trying to delete a system field after a successful sync 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "fieldMetadata": [ + { + "errors": [ + { + "code": "FIELD_MUTATION_NOT_ALLOWED", + "message": "System fields cannot be deleted", + "userFriendlyMessage": "System fields cannot be deleted", + }, + { + "code": "FIELD_MUTATION_NOT_ALLOWED", + "message": "Cannot delete, please update the label identifier field first", + "userFriendlyMessage": "Cannot delete, please update the label identifier field first", + }, + ], + "flatEntityMinimalInformation": { + "name": "id", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "delete", + }, + ], + }, + "message": "Validation failed for 1 fieldMetadata", + "summary": { + "fieldMetadata": 1, + "totalErrors": 1, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; + +exports[`Sync application should fail due to object system fields integrity should fail when trying to update a system field after a successful sync 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "fieldMetadata": [ + { + "errors": [ + { + "code": "FIELD_MUTATION_NOT_ALLOWED", + "message": "System fields only allow updating: universalSettings, isActive. Forbidden properties: label", + "userFriendlyMessage": "System fields cannot be updated", + }, + ], + "flatEntityMinimalInformation": { + "name": "id", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "update", + }, + ], + }, + "message": "Validation failed for 1 fieldMetadata", + "summary": { + "fieldMetadata": 1, + "totalErrors": 1, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; + +exports[`Sync application should fail due to object system fields integrity when object has createdAt field with wrong type (TEXT instead of DATE_TIME) 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "fieldMetadata": [ + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "title", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "createdAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + ], + "objectMetadata": [ + { + "errors": [ + { + "code": "INVALID_OBJECT_INPUT", + "message": "Names are not synced with labels", + "userFriendlyMessage": "Names are not synced with labels", + }, + ], + "flatEntityMinimalInformation": { + "namePlural": "wrongCreatedAtObjects", + "nameSingular": "wrongCreatedAtObject", + "universalIdentifier": Any, + }, + "metadataName": "objectMetadata", + "status": "fail", + "type": "create", + }, + ], + }, + "message": "Validation failed for 2 fieldMetadatas, 1 objectMetadata", + "summary": { + "fieldMetadata": 2, + "objectMetadata": 1, + "totalErrors": 3, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; + +exports[`Sync application should fail due to object system fields integrity when object has id field with wrong type (TEXT instead of UUID) 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "objectMetadata": [ + { + "errors": [ + { + "code": "INVALID_SYSTEM_FIELD", + "message": "System field id has invalid type: expected UUID, got TEXT", + "userFriendlyMessage": "System field id has invalid type", + "value": "TEXT", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdAt is missing", + "userFriendlyMessage": "System field createdAt is missing", + "value": "createdAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedAt is missing", + "userFriendlyMessage": "System field updatedAt is missing", + "value": "updatedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field deletedAt is missing", + "userFriendlyMessage": "System field deletedAt is missing", + "value": "deletedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdBy is missing", + "userFriendlyMessage": "System field createdBy is missing", + "value": "createdBy", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedBy is missing", + "userFriendlyMessage": "System field updatedBy is missing", + "value": "updatedBy", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field position is missing", + "userFriendlyMessage": "System field position is missing", + "value": "position", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field searchVector is missing", + "userFriendlyMessage": "System field searchVector is missing", + "value": "searchVector", + }, + ], + "flatEntityMinimalInformation": { + "namePlural": "wrongIdTypeObjects", + "nameSingular": "wrongIdTypeObject", + "universalIdentifier": Any, + }, + "metadataName": "objectMetadata", + "type": "create", + }, + ], + }, + "message": "Validation failed for 1 objectMetadata", + "summary": { + "objectMetadata": 1, + "totalErrors": 1, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; + +exports[`Sync application should fail due to object system fields integrity when object has position field with wrong type (TEXT instead of POSITION) 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "objectMetadata": [ + { + "errors": [ + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field id is missing", + "userFriendlyMessage": "System field id is missing", + "value": "id", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdAt is missing", + "userFriendlyMessage": "System field createdAt is missing", + "value": "createdAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedAt is missing", + "userFriendlyMessage": "System field updatedAt is missing", + "value": "updatedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field deletedAt is missing", + "userFriendlyMessage": "System field deletedAt is missing", + "value": "deletedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdBy is missing", + "userFriendlyMessage": "System field createdBy is missing", + "value": "createdBy", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedBy is missing", + "userFriendlyMessage": "System field updatedBy is missing", + "value": "updatedBy", + }, + { + "code": "INVALID_SYSTEM_FIELD", + "message": "System field position has invalid type: expected POSITION, got TEXT", + "userFriendlyMessage": "System field position has invalid type", + "value": "TEXT", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field searchVector is missing", + "userFriendlyMessage": "System field searchVector is missing", + "value": "searchVector", + }, + ], + "flatEntityMinimalInformation": { + "namePlural": "wrongPositionObjects", + "nameSingular": "wrongPositionObject", + "universalIdentifier": Any, + }, + "metadataName": "objectMetadata", + "type": "create", + }, + ], + }, + "message": "Validation failed for 1 objectMetadata", + "summary": { + "objectMetadata": 1, + "totalErrors": 1, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; + +exports[`Sync application should fail due to object system fields integrity when object is created without any system fields (missing all 8 system fields) 1`] = ` +{ + "extensions": { + "code": "METADATA_VALIDATION_FAILED", + "errors": { + "objectMetadata": [ + { + "errors": [ + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field id is missing", + "userFriendlyMessage": "System field id is missing", + "value": "id", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdAt is missing", + "userFriendlyMessage": "System field createdAt is missing", + "value": "createdAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedAt is missing", + "userFriendlyMessage": "System field updatedAt is missing", + "value": "updatedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field deletedAt is missing", + "userFriendlyMessage": "System field deletedAt is missing", + "value": "deletedAt", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field createdBy is missing", + "userFriendlyMessage": "System field createdBy is missing", + "value": "createdBy", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field updatedBy is missing", + "userFriendlyMessage": "System field updatedBy is missing", + "value": "updatedBy", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field position is missing", + "userFriendlyMessage": "System field position is missing", + "value": "position", + }, + { + "code": "MISSING_SYSTEM_FIELD", + "message": "System field searchVector is missing", + "userFriendlyMessage": "System field searchVector is missing", + "value": "searchVector", + }, + ], + "flatEntityMinimalInformation": { + "namePlural": "noSystemFieldsObjects", + "nameSingular": "noSystemFieldsObject", + "universalIdentifier": Any, + }, + "metadataName": "objectMetadata", + "type": "create", + }, + ], + }, + "message": "Validation failed for 1 objectMetadata", + "summary": { + "objectMetadata": 1, + "totalErrors": 1, + }, + "userFriendlyMessage": "Metadata validation failed", + }, + "message": "Validation errors occurred while syncing application manifest metadata", + "name": "GraphQLError", +} +`; diff --git a/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/successful-sync-application-workspace-migration.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/successful-sync-application-workspace-migration.integration-spec.ts.snap index bb72264e09..b42d4e2918 100644 --- a/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/successful-sync-application-workspace-migration.integration-spec.ts.snap +++ b/packages/twenty-server/test/integration/metadata/suites/application/__snapshots__/successful-sync-application-workspace-migration.integration-spec.ts.snap @@ -34,6 +34,222 @@ exports[`syncApplication should return workspace migration actions on initial sy "metadataName": "objectMetadata", "type": "create", "universalFlatFieldMetadatas": [ + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Id", + "morphId": null, + "name": "id", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "UUID", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Creation date", + "morphId": null, + "name": "createdAt", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Last update", + "morphId": null, + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Deleted at", + "morphId": null, + "name": "deletedAt", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": { + "name": "'System'", + "source": "'MANUAL'", + "workspaceMemberId": null, + }, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Created by", + "morphId": null, + "name": "createdBy", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "ACTOR", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": { + "name": "'System'", + "source": "'MANUAL'", + "workspaceMemberId": null, + }, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Updated by", + "morphId": null, + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "ACTOR", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Position", + "morphId": null, + "name": "position", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "POSITION", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, + { + "applicationUniversalIdentifier": Any, + "createdAt": Any, + "defaultValue": null, + "description": null, + "icon": null, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Search vector", + "morphId": null, + "name": "searchVector", + "objectMetadataUniversalIdentifier": Any, + "options": null, + "relationTargetFieldMetadataUniversalIdentifier": null, + "relationTargetObjectMetadataUniversalIdentifier": null, + "standardOverrides": null, + "type": "TS_VECTOR", + "universalIdentifier": Any, + "universalSettings": null, + "updatedAt": Any, + }, { "applicationUniversalIdentifier": Any, "createdAt": Any, diff --git a/packages/twenty-server/test/integration/metadata/suites/application/failing-sync-application-object-system-fields.integration-spec.ts b/packages/twenty-server/test/integration/metadata/suites/application/failing-sync-application-object-system-fields.integration-spec.ts new file mode 100644 index 0000000000..094bc96aa1 --- /dev/null +++ b/packages/twenty-server/test/integration/metadata/suites/application/failing-sync-application-object-system-fields.integration-spec.ts @@ -0,0 +1,310 @@ +import { expectOneNotInternalServerErrorSnapshot } from 'test/integration/graphql/utils/expect-one-not-internal-server-error-snapshot.util'; +import { buildDefaultObjectManifest } from 'test/integration/metadata/suites/application/utils/build-default-object-manifest.util'; +import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util'; +import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util'; +import { uninstallApplication } from 'test/integration/metadata/suites/application/utils/uninstall-application.util'; +import { type Manifest, type ObjectManifest } from 'twenty-shared/application'; +import { + type EachTestingContext, + eachTestingContextFilter, +} from 'twenty-shared/testing'; +import { FieldMetadataType } from 'twenty-shared/types'; +import { v4 as uuidv4 } from 'uuid'; + +const TEST_APP_ID = uuidv4(); +const TEST_ROLE_ID = uuidv4(); + +type TestContext = { + manifest: Manifest; +}; + +type SyncApplicationTestingContext = EachTestingContext[]; + +const buildBaseManifest = ( + overrides: Pick, +): Manifest => ({ + application: { + apiClientChecksum: '', + marketplaceData: undefined, + universalIdentifier: TEST_APP_ID, + defaultRoleUniversalIdentifier: TEST_ROLE_ID, + displayName: 'Test System Fields App', + description: 'App for testing system field validation', + icon: 'IconTestPipe', + applicationVariables: {}, + packageJsonChecksum: null, + yarnLockChecksum: null, + }, + roles: [ + { + universalIdentifier: TEST_ROLE_ID, + label: 'Test Role', + description: 'A test role', + }, + ], + logicFunctions: [], + frontComponents: [], + publicAssets: [], + views: [], + navigationMenuItems: [], + pageLayouts: [], + ...overrides, +}); + +const buildObjectWithLabelField = ({ + nameSingular, + namePlural, + labelSingular, + labelPlural, + description, + additionalFields = [], +}: { + nameSingular: string; + namePlural: string; + labelSingular: string; + labelPlural: string; + description: string; + additionalFields?: ObjectManifest['fields']; +}): Pick => { + const objectId = uuidv4(); + const labelFieldId = uuidv4(); + + return { + objects: [ + { + universalIdentifier: objectId, + labelIdentifierFieldMetadataUniversalIdentifier: labelFieldId, + nameSingular, + namePlural, + labelSingular, + labelPlural, + description, + icon: 'IconTicket', + fields: [ + { + universalIdentifier: labelFieldId, + type: FieldMetadataType.TEXT, + name: 'title', + label: 'Title', + description: 'Label identifier field', + icon: 'IconTextCaption', + }, + ...additionalFields, + ], + }, + ], + fields: [], + }; +}; + +const failingSyncApplicationSystemFieldsTestCases: SyncApplicationTestingContext = + [ + { + title: + 'when object is created without any system fields (missing all 8 system fields)', + context: { + manifest: buildBaseManifest( + buildObjectWithLabelField({ + nameSingular: 'noSystemFieldsObject', + namePlural: 'noSystemFieldsObjects', + labelSingular: 'No System Fields Object', + labelPlural: 'No System Fields Objects', + description: 'Object with no system fields', + }), + ), + }, + }, + { + title: 'when object has id field with wrong type (TEXT instead of UUID)', + context: { + manifest: buildBaseManifest( + buildObjectWithLabelField({ + nameSingular: 'wrongIdTypeObject', + namePlural: 'wrongIdTypeObjects', + labelSingular: 'Wrong Id Type Object', + labelPlural: 'Wrong Id Type Objects', + description: 'Object with wrong id field type', + additionalFields: [ + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.TEXT, + name: 'id', + label: 'Id', + description: 'Id field with wrong type', + icon: 'IconKey', + }, + ], + }), + ), + }, + }, + { + title: + 'when object has createdAt field with wrong type (TEXT instead of DATE_TIME)', + context: { + manifest: buildBaseManifest( + buildObjectWithLabelField({ + nameSingular: 'wrongCreatedAtObject', + namePlural: 'wrongCreatedAtObjects', + labelSingular: 'Wrong CreatedAt Object', + labelPlural: 'Wrong CreatedAt Objects', + description: 'Object with wrong createdAt field type', + additionalFields: [ + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.TEXT, + name: 'createdAt', + label: 'Created At', + description: 'Created at field with wrong type', + icon: 'IconCalendar', + }, + ], + }), + ), + }, + }, + { + title: + 'when object has position field with wrong type (TEXT instead of POSITION)', + context: { + manifest: buildBaseManifest( + buildObjectWithLabelField({ + nameSingular: 'wrongPositionObject', + namePlural: 'wrongPositionObjects', + labelSingular: 'Wrong Position Object', + labelPlural: 'Wrong Position Objects', + description: 'Object with wrong position field type', + additionalFields: [ + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.TEXT, + name: 'position', + label: 'Position', + description: 'Position field with wrong type', + icon: 'IconArrowsSort', + }, + ], + }), + ), + }, + }, + ]; + +describe('Sync application should fail due to object system fields integrity', () => { + let appCreated = false; + + beforeAll(async () => { + await setupApplicationForSync({ + applicationUniversalIdentifier: TEST_APP_ID, + name: 'Test System Fields App', + description: 'App for testing system field validation', + sourcePath: 'test-system-fields', + }); + + appCreated = true; + }, 60000); + + afterEach(async () => { + if (!appCreated) { + return; + } + + await uninstallApplication({ + universalIdentifier: TEST_APP_ID, + expectToFail: false, + }); + }); + + it.each( + eachTestingContextFilter(failingSyncApplicationSystemFieldsTestCases), + )( + '$title', + async ({ context }) => { + const { errors } = await syncApplication({ + manifest: context.manifest, + expectToFail: true, + }); + + expectOneNotInternalServerErrorSnapshot({ errors }); + }, + 60000, + ); + + it('should fail when trying to delete a system field after a successful sync', async () => { + const testObject = buildDefaultObjectManifest({ + nameSingular: 'deleteSystemFieldObject', + namePlural: 'deleteSystemFieldObjects', + labelSingular: 'Delete System Field Object', + labelPlural: 'Delete System Field Objects', + description: 'Object for testing system field deletion', + }); + + const validManifest = buildBaseManifest({ + objects: [testObject], + fields: [], + }); + + await syncApplication({ + manifest: validManifest, + expectToFail: false, + }); + + const manifestWithDeletedIdField = buildBaseManifest({ + objects: [ + { + ...testObject, + fields: testObject.fields.filter((field) => field.name !== 'id'), + }, + ], + fields: [], + }); + + const { errors } = await syncApplication({ + manifest: manifestWithDeletedIdField, + expectToFail: true, + }); + + expectOneNotInternalServerErrorSnapshot({ errors }); + }, 60000); + + it('should fail when trying to update a system field after a successful sync', async () => { + const testObject = buildDefaultObjectManifest({ + nameSingular: 'updateSystemFieldObject', + namePlural: 'updateSystemFieldObjects', + labelSingular: 'Update System Field Object', + labelPlural: 'Update System Field Objects', + description: 'Object for testing system field update', + }); + + const validManifest = buildBaseManifest({ + objects: [testObject], + fields: [], + }); + + await syncApplication({ + manifest: validManifest, + expectToFail: false, + }); + + const manifestWithUpdatedIdField = buildBaseManifest({ + objects: [ + { + ...testObject, + fields: testObject.fields.map((field) => + field.name === 'id' + ? { ...field, label: 'Modified Id Label' } + : field, + ), + }, + ], + fields: [], + }); + + const { errors } = await syncApplication({ + manifest: manifestWithUpdatedIdField, + expectToFail: true, + }); + + expectOneNotInternalServerErrorSnapshot({ errors }); + }, 60000); +}); diff --git a/packages/twenty-server/test/integration/metadata/suites/application/successful-sync-application-workspace-migration.integration-spec.ts b/packages/twenty-server/test/integration/metadata/suites/application/successful-sync-application-workspace-migration.integration-spec.ts index e43add8930..ea4a01df36 100644 --- a/packages/twenty-server/test/integration/metadata/suites/application/successful-sync-application-workspace-migration.integration-spec.ts +++ b/packages/twenty-server/test/integration/metadata/suites/application/successful-sync-application-workspace-migration.integration-spec.ts @@ -1,51 +1,38 @@ +import { buildDefaultObjectManifest } from 'test/integration/metadata/suites/application/utils/build-default-object-manifest.util'; +import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util'; +import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util'; +import { uninstallApplication } from 'test/integration/metadata/suites/application/utils/uninstall-application.util'; +import { extractRecordIdsAndDatesAsExpectAny } from 'test/utils/extract-record-ids-and-dates-as-expect-any'; import { type Manifest } from 'twenty-shared/application'; import { FieldMetadataType } from 'twenty-shared/types'; import { v4 as uuidv4 } from 'uuid'; -import { createOneApplication } from 'test/integration/metadata/suites/application/utils/create-one-application.util'; -import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util'; -import { uninstallApplication } from 'test/integration/metadata/suites/application/utils/uninstall-application.util'; -import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util'; -import { extractRecordIdsAndDatesAsExpectAny } from 'test/utils/extract-record-ids-and-dates-as-expect-any'; const TEST_APP_ID = uuidv4(); const TEST_ROLE_ID = uuidv4(); const TEST_SECOND_ROLE_ID = uuidv4(); -const TEST_OBJECT_ID = uuidv4(); const TEST_FIELD_ID = uuidv4(); +const TEST_OBJECT = buildDefaultObjectManifest({ + nameSingular: 'ticket', + namePlural: 'tickets', + labelSingular: 'Ticket', + labelPlural: 'Tickets', + description: 'A support ticket', + icon: 'IconTicket', +}); + describe('syncApplication', () => { let appCreated = false; beforeAll(async () => { - await createOneApplication({ - universalIdentifier: TEST_APP_ID, + await setupApplicationForSync({ + applicationUniversalIdentifier: TEST_APP_ID, name: 'Test Application', description: 'A test application', - version: '1.0.0', sourcePath: 'test-sync', - expectToFail: false, }); appCreated = true; - - // File upload uses multipart which requires real timers - jest.useRealTimers(); - - const packageJson = JSON.stringify({ - name: 'test-application', - version: '1.0.0', - }); - - await uploadApplicationFile({ - applicationUniversalIdentifier: TEST_APP_ID, - fileFolder: 'Dependencies', - filePath: 'package.json', - fileBuffer: Buffer.from(packageJson), - filename: 'package.json', - expectToFail: false, - }); - - jest.useFakeTimers(); }, 60000); afterAll(async () => { @@ -79,19 +66,7 @@ describe('syncApplication', () => { description: 'A test role', }, ], - objects: [ - { - labelIdentifierFieldMetadataUniversalIdentifier: TEST_FIELD_ID, - universalIdentifier: TEST_OBJECT_ID, - nameSingular: 'ticket', - namePlural: 'tickets', - labelSingular: 'Ticket', - labelPlural: 'Tickets', - description: 'A support ticket', - icon: 'IconTicket', - fields: [], - }, - ], + objects: [TEST_OBJECT], fields: [ { universalIdentifier: TEST_FIELD_ID, @@ -100,7 +75,7 @@ describe('syncApplication', () => { label: 'Description', description: 'Ticket description', icon: 'IconFileDescription', - objectUniversalIdentifier: TEST_OBJECT_ID, + objectUniversalIdentifier: TEST_OBJECT.universalIdentifier, }, ], logicFunctions: [], @@ -142,7 +117,7 @@ describe('syncApplication', () => { label: 'Body', description: 'Ticket description', icon: 'IconFileDescription', - objectUniversalIdentifier: TEST_OBJECT_ID, + objectUniversalIdentifier: TEST_OBJECT.universalIdentifier, }, ], }; diff --git a/packages/twenty-server/test/integration/metadata/suites/application/utils/build-default-object-manifest.util.ts b/packages/twenty-server/test/integration/metadata/suites/application/utils/build-default-object-manifest.util.ts new file mode 100644 index 0000000000..6f928bf40d --- /dev/null +++ b/packages/twenty-server/test/integration/metadata/suites/application/utils/build-default-object-manifest.util.ts @@ -0,0 +1,85 @@ +import { type ObjectManifest } from 'twenty-shared/application'; +import { FieldMetadataType } from 'twenty-shared/types'; +import { v4 as uuidv4 } from 'uuid'; + +export const buildDefaultObjectManifest = ({ + nameSingular, + namePlural, + labelSingular, + labelPlural, + description, + icon = 'IconTicket', + additionalFields = [], +}: { + nameSingular: string; + namePlural: string; + labelSingular: string; + labelPlural: string; + description?: string; + icon?: string; + additionalFields?: ObjectManifest['fields']; +}): ObjectManifest => { + const idFieldUniversalIdentifier = uuidv4(); + + return { + universalIdentifier: uuidv4(), + labelIdentifierFieldMetadataUniversalIdentifier: idFieldUniversalIdentifier, + nameSingular, + namePlural, + labelSingular, + labelPlural, + description, + icon, + fields: [ + { + universalIdentifier: idFieldUniversalIdentifier, + type: FieldMetadataType.UUID, + name: 'id', + label: 'Id', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.DATE_TIME, + name: 'createdAt', + label: 'Creation date', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.DATE_TIME, + name: 'updatedAt', + label: 'Last update', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.DATE_TIME, + name: 'deletedAt', + label: 'Deleted at', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.ACTOR, + name: 'createdBy', + label: 'Created by', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.ACTOR, + name: 'updatedBy', + label: 'Updated by', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.POSITION, + name: 'position', + label: 'Position', + }, + { + universalIdentifier: uuidv4(), + type: FieldMetadataType.TS_VECTOR, + name: 'searchVector', + label: 'Search vector', + }, + ...additionalFields, + ], + }; +}; diff --git a/packages/twenty-server/test/integration/metadata/suites/application/utils/setup-application-for-sync.util.ts b/packages/twenty-server/test/integration/metadata/suites/application/utils/setup-application-for-sync.util.ts new file mode 100644 index 0000000000..67e0744f7c --- /dev/null +++ b/packages/twenty-server/test/integration/metadata/suites/application/utils/setup-application-for-sync.util.ts @@ -0,0 +1,42 @@ +import { createOneApplication } from 'test/integration/metadata/suites/application/utils/create-one-application.util'; +import { uploadApplicationFile } from 'test/integration/metadata/suites/application/utils/upload-application-file.util'; + +export const setupApplicationForSync = async ({ + applicationUniversalIdentifier, + name, + description, + sourcePath, +}: { + applicationUniversalIdentifier: string; + name: string; + description: string; + sourcePath: string; +}) => { + await createOneApplication({ + universalIdentifier: applicationUniversalIdentifier, + name, + description, + version: '1.0.0', + sourcePath, + expectToFail: false, + }); + + // File upload uses multipart which requires real timers + jest.useRealTimers(); + + const packageJson = JSON.stringify({ + name: sourcePath, + version: '1.0.0', + }); + + await uploadApplicationFile({ + applicationUniversalIdentifier, + fileFolder: 'Dependencies', + filePath: 'package.json', + fileBuffer: Buffer.from(packageJson), + filename: 'package.json', + expectToFail: false, + }); + + jest.useFakeTimers(); +}; diff --git a/packages/twenty-server/test/integration/metadata/suites/field-metadata/__snapshots__/failing-create-one-field-metadata.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/field-metadata/__snapshots__/failing-create-one-field-metadata.integration-spec.ts.snap index deb65328bd..98ef9f0ebd 100644 --- a/packages/twenty-server/test/integration/metadata/suites/field-metadata/__snapshots__/failing-create-one-field-metadata.integration-spec.ts.snap +++ b/packages/twenty-server/test/integration/metadata/suites/field-metadata/__snapshots__/failing-create-one-field-metadata.integration-spec.ts.snap @@ -51,9 +51,15 @@ exports[`Failing create field metadata tests suite should fail to create POSITIO "errors": [ { "code": "INVALID_FIELD_INPUT", - "message": "Field type POSITION is a system type and cannot be created manually.", - "userFriendlyMessage": "Field type POSITION is a system type and cannot be created manually.", - "value": "POSITION", + "message": "Field type POSITION must be named "position", got "positionField"", + "userFriendlyMessage": "Field type POSITION must be named "position"", + "value": "positionField", + }, + { + "code": "INVALID_FIELD_INPUT", + "message": "Field type POSITION must be a system field", + "userFriendlyMessage": "Field type POSITION must be a system field", + "value": false, }, ], "flatEntityMinimalInformation": { diff --git a/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-create-one-object-metadata-v2.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-create-one-object-metadata-v2.integration-spec.ts.snap index 21239efa9f..2efe46d87d 100644 --- a/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-create-one-object-metadata-v2.integration-spec.ts.snap +++ b/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-create-one-object-metadata-v2.integration-spec.ts.snap @@ -15,7 +15,7 @@ exports[`Object metadata creation should fail v2 when labelPlural contains only }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -32,7 +32,7 @@ exports[`Object metadata creation should fail v2 when labelPlural contains only }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -66,24 +66,7 @@ exports[`Object metadata creation should fail v2 when labelPlural contains only }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -108,23 +91,6 @@ exports[`Object metadata creation should fail v2 when labelPlural contains only "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -159,6 +125,40 @@ exports[`Object metadata creation should fail v2 when labelPlural contains only "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -967,7 +967,7 @@ exports[`Object metadata creation should fail v2 when labelPlural exceeds maximu }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -984,7 +984,7 @@ exports[`Object metadata creation should fail v2 when labelPlural exceeds maximu }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -1018,24 +1018,7 @@ exports[`Object metadata creation should fail v2 when labelPlural exceeds maximu }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -1060,23 +1043,6 @@ exports[`Object metadata creation should fail v2 when labelPlural exceeds maximu "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -1111,6 +1077,40 @@ exports[`Object metadata creation should fail v2 when labelPlural exceeds maximu "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -1930,7 +1930,7 @@ exports[`Object metadata creation should fail v2 when labelSingular contains onl }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -1947,7 +1947,7 @@ exports[`Object metadata creation should fail v2 when labelSingular contains onl }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -1981,24 +1981,7 @@ exports[`Object metadata creation should fail v2 when labelSingular contains onl }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -2023,23 +2006,6 @@ exports[`Object metadata creation should fail v2 when labelSingular contains onl "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -2074,6 +2040,40 @@ exports[`Object metadata creation should fail v2 when labelSingular contains onl "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -2882,7 +2882,7 @@ exports[`Object metadata creation should fail v2 when labelSingular exceeds maxi }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -2899,7 +2899,7 @@ exports[`Object metadata creation should fail v2 when labelSingular exceeds maxi }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -2933,24 +2933,7 @@ exports[`Object metadata creation should fail v2 when labelSingular exceeds maxi }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -2975,23 +2958,6 @@ exports[`Object metadata creation should fail v2 when labelSingular exceeds maxi "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -3026,6 +2992,40 @@ exports[`Object metadata creation should fail v2 when labelSingular exceeds maxi "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -3845,7 +3845,7 @@ exports[`Object metadata creation should fail v2 when labels are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -3862,7 +3862,7 @@ exports[`Object metadata creation should fail v2 when labels are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -3896,24 +3896,7 @@ exports[`Object metadata creation should fail v2 when labels are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -3938,23 +3921,6 @@ exports[`Object metadata creation should fail v2 when labels are identical 1`] = "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -3989,6 +3955,40 @@ exports[`Object metadata creation should fail v2 when labels are identical 1`] = "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -4797,7 +4797,7 @@ exports[`Object metadata creation should fail v2 when labels with whitespaces re }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -4814,7 +4814,7 @@ exports[`Object metadata creation should fail v2 when labels with whitespaces re }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -4848,24 +4848,7 @@ exports[`Object metadata creation should fail v2 when labels with whitespaces re }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -4890,23 +4873,6 @@ exports[`Object metadata creation should fail v2 when labels with whitespaces re "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -4941,6 +4907,40 @@ exports[`Object metadata creation should fail v2 when labels with whitespaces re "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -5749,7 +5749,7 @@ exports[`Object metadata creation should fail v2 when name exceeds maximum lengt }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -5766,7 +5766,7 @@ exports[`Object metadata creation should fail v2 when name exceeds maximum lengt }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -5800,24 +5800,7 @@ exports[`Object metadata creation should fail v2 when name exceeds maximum lengt }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -5842,23 +5825,6 @@ exports[`Object metadata creation should fail v2 when name exceeds maximum lengt "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -5893,6 +5859,40 @@ exports[`Object metadata creation should fail v2 when name exceeds maximum lengt "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -6731,7 +6731,7 @@ exports[`Object metadata creation should fail v2 when namePlural has invalid cha }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -6748,7 +6748,7 @@ exports[`Object metadata creation should fail v2 when namePlural has invalid cha }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -6782,24 +6782,7 @@ exports[`Object metadata creation should fail v2 when namePlural has invalid cha }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -6824,23 +6807,6 @@ exports[`Object metadata creation should fail v2 when namePlural has invalid cha "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -6875,6 +6841,40 @@ exports[`Object metadata creation should fail v2 when namePlural has invalid cha "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -7683,7 +7683,7 @@ exports[`Object metadata creation should fail v2 when namePlural is a reserved k }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -7700,7 +7700,7 @@ exports[`Object metadata creation should fail v2 when namePlural is a reserved k }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -7734,24 +7734,7 @@ exports[`Object metadata creation should fail v2 when namePlural is a reserved k }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -7776,23 +7759,6 @@ exports[`Object metadata creation should fail v2 when namePlural is a reserved k "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -7827,6 +7793,40 @@ exports[`Object metadata creation should fail v2 when namePlural is a reserved k "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -8646,7 +8646,7 @@ exports[`Object metadata creation should fail v2 when namePlural is not camelCas }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -8663,7 +8663,7 @@ exports[`Object metadata creation should fail v2 when namePlural is not camelCas }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -8697,24 +8697,7 @@ exports[`Object metadata creation should fail v2 when namePlural is not camelCas }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -8739,23 +8722,6 @@ exports[`Object metadata creation should fail v2 when namePlural is not camelCas "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -8790,6 +8756,40 @@ exports[`Object metadata creation should fail v2 when namePlural is not camelCas "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -9598,7 +9598,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -9615,7 +9615,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -9649,24 +9649,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -9691,23 +9674,6 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -9742,6 +9708,40 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -10580,7 +10580,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -10597,7 +10597,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -10631,24 +10631,7 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -10673,23 +10656,6 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -10724,6 +10690,40 @@ exports[`Object metadata creation should fail v2 when nameSingular contains only "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -11550,7 +11550,7 @@ exports[`Object metadata creation should fail v2 when nameSingular has invalid c }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -11567,7 +11567,7 @@ exports[`Object metadata creation should fail v2 when nameSingular has invalid c }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -11601,24 +11601,7 @@ exports[`Object metadata creation should fail v2 when nameSingular has invalid c }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -11643,23 +11626,6 @@ exports[`Object metadata creation should fail v2 when nameSingular has invalid c "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -11694,6 +11660,40 @@ exports[`Object metadata creation should fail v2 when nameSingular has invalid c "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -12532,7 +12532,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is a reserved }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -12549,7 +12549,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is a reserved }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -12583,24 +12583,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is a reserved }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -12625,23 +12608,6 @@ exports[`Object metadata creation should fail v2 when nameSingular is a reserved "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -12676,6 +12642,40 @@ exports[`Object metadata creation should fail v2 when nameSingular is a reserved "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -13501,7 +13501,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is not camelC }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -13518,7 +13518,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is not camelC }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -13552,24 +13552,7 @@ exports[`Object metadata creation should fail v2 when nameSingular is not camelC }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -13594,23 +13577,6 @@ exports[`Object metadata creation should fail v2 when nameSingular is not camelC "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -13645,6 +13611,40 @@ exports[`Object metadata creation should fail v2 when nameSingular is not camelC "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -14483,7 +14483,7 @@ exports[`Object metadata creation should fail v2 when names are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -14500,7 +14500,7 @@ exports[`Object metadata creation should fail v2 when names are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -14534,24 +14534,7 @@ exports[`Object metadata creation should fail v2 when names are identical 1`] = }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -14576,23 +14559,6 @@ exports[`Object metadata creation should fail v2 when names are identical 1`] = "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -14627,6 +14593,40 @@ exports[`Object metadata creation should fail v2 when names are identical 1`] = "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { @@ -15435,7 +15435,7 @@ exports[`Object metadata creation should fail v2 when names with whitespaces res }, ], "flatEntityMinimalInformation": { - "name": "id", + "name": "name", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -15452,7 +15452,7 @@ exports[`Object metadata creation should fail v2 when names with whitespaces res }, ], "flatEntityMinimalInformation": { - "name": "name", + "name": "id", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -15486,24 +15486,7 @@ exports[`Object metadata creation should fail v2 when names with whitespaces res }, ], "flatEntityMinimalInformation": { - "name": "updatedAt", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "updatedBy", + "name": "createdBy", "objectMetadataUniversalIdentifier": Any, "universalIdentifier": Any, }, @@ -15528,23 +15511,6 @@ exports[`Object metadata creation should fail v2 when names with whitespaces res "status": "fail", "type": "create", }, - { - "errors": [ - { - "code": "OBJECT_METADATA_NOT_FOUND", - "message": "Object metadata not found", - "userFriendlyMessage": "Field to create related object not found", - }, - ], - "flatEntityMinimalInformation": { - "name": "createdBy", - "objectMetadataUniversalIdentifier": Any, - "universalIdentifier": Any, - }, - "metadataName": "fieldMetadata", - "status": "fail", - "type": "create", - }, { "errors": [ { @@ -15579,6 +15545,40 @@ exports[`Object metadata creation should fail v2 when names with whitespaces res "status": "fail", "type": "create", }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedAt", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, + { + "errors": [ + { + "code": "OBJECT_METADATA_NOT_FOUND", + "message": "Object metadata not found", + "userFriendlyMessage": "Field to create related object not found", + }, + ], + "flatEntityMinimalInformation": { + "name": "updatedBy", + "objectMetadataUniversalIdentifier": Any, + "universalIdentifier": Any, + }, + "metadataName": "fieldMetadata", + "status": "fail", + "type": "create", + }, { "errors": [ { diff --git a/packages/twenty-shared/src/metadata/standard-object.constant.ts b/packages/twenty-shared/src/metadata/standard-object.constant.ts index f21fe0cca9..03f58b85fd 100644 --- a/packages/twenty-shared/src/metadata/standard-object.constant.ts +++ b/packages/twenty-shared/src/metadata/standard-object.constant.ts @@ -53,6 +53,12 @@ export const STANDARD_OBJECTS = { targetWorkflow: { universalIdentifier: '20202020-f1e8-4c9d-8a7b-3f5e1d2c9a8b', }, + position: { + universalIdentifier: 'cef8f62c-cd46-4444-8cbb-17d463b7464a', + }, + searchVector: { + universalIdentifier: 'e7b42835-cb2e-4456-8558-9225362aa52d', + }, }, morphIds: { targetMorphId: { morphId: '20202020-f634-435d-ab8d-e1168b375c69' }, @@ -138,6 +144,18 @@ export const STANDARD_OBJECTS = { workspaceMember: { universalIdentifier: '20202020-548d-4084-a947-fa20a39f7c06', }, + createdBy: { + universalIdentifier: 'b80db15d-8dc2-4f47-a072-15030941a9d1', + }, + updatedBy: { + universalIdentifier: '11aaa404-f04b-421d-a451-c453bf77cc78', + }, + position: { + universalIdentifier: '72a27e60-3542-46dc-90db-684d79bd7f11', + }, + searchVector: { + universalIdentifier: '5fa758da-30b4-412e-8a4f-975f2848ce60', + }, }, indexes: { workspaceMemberIdIndex: { @@ -172,6 +190,18 @@ export const STANDARD_OBJECTS = { recurringEventExternalId: { universalIdentifier: '20202020-c58f-4c69-9bf8-9518fa31aa50', }, + createdBy: { + universalIdentifier: '8daa2bc8-bce2-4309-8a48-b929f3ee2c34', + }, + updatedBy: { + universalIdentifier: '55d810d2-fe47-44b4-b1de-b9c32113b695', + }, + position: { + universalIdentifier: '4fa18346-bb2b-49b0-ab35-23df86eed1c8', + }, + searchVector: { + universalIdentifier: '1844a9cf-6d35-46d7-99ba-011626a6d71b', + }, }, indexes: { calendarChannelIdIndex: { @@ -234,6 +264,18 @@ export const STANDARD_OBJECTS = { syncedAt: { universalIdentifier: '20202020-2ff5-4f70-953a-3d0d36357576', }, + createdBy: { + universalIdentifier: '664db1a0-76f4-4429-8452-f8e250ab7545', + }, + updatedBy: { + universalIdentifier: '6a397eab-3700-4b08-9eb9-d16b61876193', + }, + position: { + universalIdentifier: '566609c9-1c8b-4899-91bb-0af140a89004', + }, + searchVector: { + universalIdentifier: 'bc9a982c-c314-49d6-818a-2661ce7e918f', + }, }, indexes: { connectedAccountIdIndex: { @@ -277,6 +319,18 @@ export const STANDARD_OBJECTS = { workspaceMember: { universalIdentifier: '20202020-20e4-4591-93ed-aeb17a4dcbd2', }, + createdBy: { + universalIdentifier: '9e9ec14d-b889-448e-afe5-40e407be11d1', + }, + updatedBy: { + universalIdentifier: 'a2c6efda-06bf-418e-808a-dac9fd64ab58', + }, + position: { + universalIdentifier: 'fcfa672c-ce6d-4fc1-b978-db58a4cc14f4', + }, + searchVector: { + universalIdentifier: 'c9dccf32-64ea-433e-a9a7-09993343bae0', + }, }, indexes: { calendarEventIdIndex: { @@ -341,6 +395,18 @@ export const STANDARD_OBJECTS = { calendarEventParticipants: { universalIdentifier: '20202020-e07e-4ccb-88f5-6f3d00458eec', }, + createdBy: { + universalIdentifier: '664a9500-2641-4caa-8d95-069807bb2eb4', + }, + updatedBy: { + universalIdentifier: '1081c196-d675-4801-b9e1-7d8637b48eab', + }, + position: { + universalIdentifier: 'e9488e9a-0abe-4500-8c1d-bfbd6b8cffad', + }, + searchVector: { + universalIdentifier: 'b9e7825c-d491-4414-b904-910c00b5b93b', + }, }, indexes: {}, views: { @@ -580,6 +646,18 @@ export const STANDARD_OBJECTS = { connectionParameters: { universalIdentifier: '20202020-a1b2-46be-814f-6228af16c481', }, + createdBy: { + universalIdentifier: 'e09c2463-9ca6-4004-97ce-6039e3161a5d', + }, + updatedBy: { + universalIdentifier: '0a84c0e1-f9fc-47d5-8ac9-58538e50a9f9', + }, + position: { + universalIdentifier: '66b7bc3e-c99e-42b6-82e6-6f43142c0f2f', + }, + searchVector: { + universalIdentifier: '140767fe-0aa4-4573-a0bd-67cb657c9452', + }, }, indexes: { accountOwnerIdIndex: { @@ -687,6 +765,15 @@ export const STANDARD_OBJECTS = { dashboard: { universalIdentifier: '20202020-6ef9-45e4-b440-cc986f687c91', }, + createdBy: { + universalIdentifier: '6440dc3d-fa50-49cc-abd3-98eeccd79288', + }, + updatedBy: { + universalIdentifier: '6c117b1a-0470-499b-8fcb-d9059eafbd43', + }, + searchVector: { + universalIdentifier: 'cbb27ea1-5cf8-4fed-9e0a-e4152815bd6e', + }, }, indexes: { forWorkspaceMemberIdIndex: { @@ -744,6 +831,15 @@ export const STANDARD_OBJECTS = { favorites: { universalIdentifier: '20202020-b5e3-4b42-8af2-03cd4fd2e4d2', }, + createdBy: { + universalIdentifier: '1ec58922-7789-4832-a583-ec97f766f433', + }, + updatedBy: { + universalIdentifier: '6a53edc6-0ef2-4c35-9065-f91c4ddf7f01', + }, + searchVector: { + universalIdentifier: 'c5bb12e1-0cc3-428f-89f0-4c8747239ac3', + }, }, indexes: {}, }, @@ -780,6 +876,18 @@ export const STANDARD_OBJECTS = { direction: { universalIdentifier: '75c9b0f7-9e76-44d4-a2f9-47051e61eec7', }, + createdBy: { + universalIdentifier: 'ce7dc96f-dd33-4bce-9505-cbd381440cec', + }, + updatedBy: { + universalIdentifier: '334d2ad6-4bc4-4b51-9c92-8ad57652475e', + }, + position: { + universalIdentifier: '45d1e083-90d6-4507-b68a-454a9dc3a540', + }, + searchVector: { + universalIdentifier: 'edddd409-d9f0-4b93-8e3f-37faef6a3387', + }, messageFolders: { universalIdentifier: '20202020-c3d4-e5f6-a7b8-901234567890', }, @@ -811,6 +919,18 @@ export const STANDARD_OBJECTS = { deletedAt: { universalIdentifier: '20202020-a1b5-40b4-9db4-9e0f1a2b3c4d', }, + createdBy: { + universalIdentifier: 'f882a070-3393-4197-8140-b5858c6f7284', + }, + updatedBy: { + universalIdentifier: '107d13dc-a8ff-493c-8d04-72688c68f8c1', + }, + position: { + universalIdentifier: '76fcf020-482a-4d6c-b7b1-ccd6410299fc', + }, + searchVector: { + universalIdentifier: '38633a97-0e88-44de-9903-b8c9e0f59a36', + }, messageChannelMessageAssociation: { universalIdentifier: '20202020-d4e5-f6a7-b8c9-012345678901', }, @@ -901,6 +1021,18 @@ export const STANDARD_OBJECTS = { throttleRetryAfter: { universalIdentifier: '20202020-a1e3-4d7f-b5c2-9f8e6d4c3b2a', }, + createdBy: { + universalIdentifier: 'b7de8fcc-a7c6-4122-b3fa-1fcf8f30931c', + }, + updatedBy: { + universalIdentifier: '88bb6ff1-b8a1-4313-95d4-7879acca0b93', + }, + position: { + universalIdentifier: 'bc8a36af-8b9c-4548-a0da-c90e899e7243', + }, + searchVector: { + universalIdentifier: '5e84794c-6f14-4bdf-81a6-76ee11cda51f', + }, }, indexes: { connectedAccountIdIndex: { @@ -943,6 +1075,18 @@ export const STANDARD_OBJECTS = { pendingSyncAction: { universalIdentifier: '20202020-4f97-4c79-9517-16387fe237f7', }, + createdBy: { + universalIdentifier: 'bfe19f84-b640-4ce3-b771-4e7bf18bad14', + }, + updatedBy: { + universalIdentifier: '7ec7eea8-8715-4656-a602-3cb4256aaca1', + }, + position: { + universalIdentifier: '5317d4f4-12c5-469d-8e47-0f3b2ffc95b4', + }, + searchVector: { + universalIdentifier: '5f2d3937-bafd-4d71-b4cb-b34037efd2e1', + }, messageChannelMessageAssociationMessageFolders: { universalIdentifier: '20202020-f6a7-b8c9-d0e1-234567890123', }, @@ -984,6 +1128,18 @@ export const STANDARD_OBJECTS = { workspaceMember: { universalIdentifier: '20202020-77a7-4845-99ed-1bcbb478be6f', }, + createdBy: { + universalIdentifier: 'e0e6aa04-6ad5-4d12-8799-6febf00452c1', + }, + updatedBy: { + universalIdentifier: '6c90fd49-22b8-4f91-b4eb-4b9af630e988', + }, + position: { + universalIdentifier: 'f49ca74e-dcdf-445d-a707-3c22869b4e6c', + }, + searchVector: { + universalIdentifier: '80fec74f-cda7-46bd-ae37-8998bd4f992b', + }, }, indexes: { messageIdIndex: { @@ -1016,6 +1172,18 @@ export const STANDARD_OBJECTS = { messageChannelMessageAssociations: { universalIdentifier: '20202020-314e-40a4-906d-a5d5d6c285f6', }, + createdBy: { + universalIdentifier: 'b50ce369-9905-46d9-b95b-5e4034d252aa', + }, + updatedBy: { + universalIdentifier: '20fbafd0-0a16-4785-b5a6-f1ef45ef304c', + }, + position: { + universalIdentifier: '7490a440-7a62-466e-ba93-75a2f2edfb1e', + }, + searchVector: { + universalIdentifier: 'c63e091f-6528-4657-ad2a-b0a158f9e483', + }, }, indexes: {}, views: { @@ -1065,6 +1233,18 @@ export const STANDARD_OBJECTS = { messageChannelMessageAssociations: { universalIdentifier: '20202020-3cef-43a3-82c6-50e7cfbc9ae4', }, + createdBy: { + universalIdentifier: '6e52bde4-ed41-4462-aa70-121e496270b4', + }, + updatedBy: { + universalIdentifier: '7822dcc0-ee40-4af0-a6fe-f10a14e72b24', + }, + position: { + universalIdentifier: '06c5052d-3369-4d6d-8eaa-f9780eddb1fd', + }, + searchVector: { + universalIdentifier: '529b6008-4a12-4d48-bbc3-26a3f199bafd', + }, }, indexes: { messageThreadIdIndex: { @@ -1214,6 +1394,18 @@ export const STANDARD_OBJECTS = { targetOpportunity: { universalIdentifier: '20202020-4e42-417a-a705-76581c9ade79', }, + createdBy: { + universalIdentifier: '820a3163-bb7d-41bc-93d9-81a464559c48', + }, + updatedBy: { + universalIdentifier: 'a48c2bae-fe78-4d9d-bc37-f56d1a462121', + }, + position: { + universalIdentifier: '082f7c9e-5ccd-4056-8748-a428f65fa6f6', + }, + searchVector: { + universalIdentifier: '0cc32d0f-99ab-4fee-bf66-9e84bc8bce00', + }, }, morphIds: { targetMorphId: { morphId: '20202020-f635-435d-ab8d-e1168b375c70' }, @@ -1800,6 +1992,18 @@ export const STANDARD_OBJECTS = { targetOpportunity: { universalIdentifier: '20202020-6cb2-4c01-a9a5-aca3dbc11d41', }, + createdBy: { + universalIdentifier: '65fe2a53-45e4-4225-9711-b827f55e51cc', + }, + updatedBy: { + universalIdentifier: 'bea3734f-aff2-49ed-9dc9-d4666a2e2178', + }, + position: { + universalIdentifier: '4216c06a-498b-4111-9577-d9bcbccdda39', + }, + searchVector: { + universalIdentifier: '8768a9c0-37c0-4465-b86d-c4c7f466ec23', + }, }, morphIds: { targetMorphId: { morphId: '20202020-f636-435d-ab8d-e1168b375c71' }, @@ -1900,6 +2104,18 @@ export const STANDARD_OBJECTS = { linkedObjectMetadataId: { universalIdentifier: '20202020-c595-449d-9f89-562758c9ee69', }, + createdBy: { + universalIdentifier: '8f66191f-927d-4a6d-a15f-d0ff8cfc5a6d', + }, + updatedBy: { + universalIdentifier: '81dc29fc-c872-4efd-bf31-d07872cd260e', + }, + position: { + universalIdentifier: 'e245d799-3e4b-4c69-ab9a-6b7c91d71195', + }, + searchVector: { + universalIdentifier: 'bc1d1b67-903a-4354-8272-4a6efc4cbe63', + }, }, morphIds: { targetMorphId: { morphId: '20202020-9a2b-4c3d-a4e5-f6a7b8c9d0e1' }, @@ -2084,6 +2300,18 @@ export const STANDARD_OBJECTS = { workflow: { universalIdentifier: '20202020-3319-4234-a34c-8e1a4d2f7c03', }, + createdBy: { + universalIdentifier: '5cea2f46-3779-4782-9fce-3062652e2dfd', + }, + updatedBy: { + universalIdentifier: '017d3587-98bd-43ad-b5a6-cb8125105641', + }, + position: { + universalIdentifier: 'f4c5eb0a-8a86-49a2-a775-941eaad98fc9', + }, + searchVector: { + universalIdentifier: 'dae934ca-bfca-4101-8211-8eae6e2b5513', + }, }, indexes: { workflowIdIndex: { @@ -2255,6 +2483,12 @@ export const STANDARD_OBJECTS = { searchVector: { universalIdentifier: '20202020-3f17-44ef-b8c1-b282ae8469b2', }, + createdBy: { + universalIdentifier: '34f592a7-5c13-4c8b-8473-7bef00848b4e', + }, + updatedBy: { + universalIdentifier: '4f8777e6-c5eb-40c6-bb4c-ed9dcf0d81e9', + }, }, indexes: { workflowIdIndex: { @@ -2395,6 +2629,12 @@ export const STANDARD_OBJECTS = { numberFormat: { universalIdentifier: '20202020-7f40-4e7f-b126-11c0eda6b141', }, + createdBy: { + universalIdentifier: '4a3f26d1-033e-4d84-b23a-9adc2fd0c2a8', + }, + updatedBy: { + universalIdentifier: '29f84ad0-509f-4aef-9f9c-2691dd60cd87', + }, }, indexes: { userEmailUniqueIndex: {