feat: rename RICH_TEXT_V2 → RICH_TEXT in codebase (keep DB value) (#18628)
## Summary - Renames the `FieldMetadataType` enum key from `RICH_TEXT_V2` to `RICH_TEXT` across the entire codebase, while keeping the underlying string value as `'RICH_TEXT_V2'` to maintain PostgreSQL database compatibility - Renames all related types, guards, hooks, components, and files from `*RichTextV2*` / `*rich-text-v2*` to `*RichText*` / `*rich-text*` (e.g. `FormRichTextV2FieldInput` → `FormRichTextFieldInput`, `isFieldRichTextV2` → `isFieldRichText`) - Updates generated files (GraphQL schema, SDK types) to use the new key while preserving the `RICH_TEXT_V2` string value for DB/API layer - Updates i18n locale files, test snapshots, and integration tests to reflect the rename ## Context The legacy `RICH_TEXT` (V1) field type was deprecated and migrated to `TEXT` in a previous PR (#18623). With V1 gone, the `RICH_TEXT_V2` naming is no longer necessary — `RICH_TEXT` is now the canonical name. The DB enum value stays `'RICH_TEXT_V2'` to avoid confusion with the just-deprecated V1 type and to prevent a database migration. ## Test plan - [x] `twenty-server` typecheck passes - [x] `twenty-front` typecheck passes (only pre-existing Apollo client errors remain) - [x] `twenty-server` lint passes - [x] `twenty-front` lint passes - [x] `twenty-shared` build passes - [ ] CI passes Made with [Cursor](https://cursor.com)
This commit is contained in:
+3
-3
@@ -30,7 +30,7 @@ type AnalysisResult = {
|
||||
commitments: Commitment[];
|
||||
};
|
||||
|
||||
type RichTextV2Data = {
|
||||
type RichTextData = {
|
||||
markdown: string;
|
||||
blocknote: null;
|
||||
};
|
||||
@@ -123,7 +123,7 @@ const createNoteInTwenty = async (
|
||||
bodyV2: {
|
||||
markdown: noteBodyMarkdown,
|
||||
blocknote: null,
|
||||
} satisfies RichTextV2Data,
|
||||
} satisfies RichTextData,
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -159,7 +159,7 @@ const createTaskInTwenty = async (
|
||||
|
||||
const taskData: {
|
||||
title: string;
|
||||
bodyV2: RichTextV2Data;
|
||||
bodyV2: RichTextData;
|
||||
dueAt?: string;
|
||||
} = {
|
||||
title: actionItem.title,
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@ type AnalysisResult = {
|
||||
commitments: Commitment[];
|
||||
};
|
||||
|
||||
type RichTextV2Data = {
|
||||
type RichTextData = {
|
||||
markdown: string;
|
||||
blocknote: null;
|
||||
};
|
||||
@@ -362,7 +362,7 @@ const createNoteInTwenty = async (
|
||||
bodyV2: {
|
||||
markdown: noteBodyMarkdown,
|
||||
blocknote: null,
|
||||
} satisfies RichTextV2Data,
|
||||
} satisfies RichTextData,
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -451,7 +451,7 @@ const createTaskInTwenty = async (
|
||||
|
||||
const taskData: {
|
||||
title: string;
|
||||
bodyV2: RichTextV2Data;
|
||||
bodyV2: RichTextData;
|
||||
dueAt?: string;
|
||||
assigneeId?: string;
|
||||
} = {
|
||||
|
||||
@@ -81,7 +81,7 @@ export default defineObject({
|
||||
},
|
||||
{
|
||||
universalIdentifier: TRANSCRIPT_FIELD_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RICH_TEXT_V2,
|
||||
type: FieldType.RICH_TEXT,
|
||||
name: 'transcript',
|
||||
label: 'Transcript',
|
||||
description: 'Human-readable transcript of the call',
|
||||
@@ -114,7 +114,7 @@ export default defineObject({
|
||||
},
|
||||
{
|
||||
universalIdentifier: SUMMARY_FIELD_UNIVERSAL_IDENTIFIER,
|
||||
type: FieldType.RICH_TEXT_V2,
|
||||
type: FieldType.RICH_TEXT,
|
||||
name: 'summary',
|
||||
label: 'Summary',
|
||||
description: 'AI-generated summary of the call',
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ Use this skill when a user asks you to summarize, analyze, or extract insights f
|
||||
|
||||
## How to Access the Data
|
||||
1. Use \`find_one_callRecording\` to fetch the call recording by its ID.
|
||||
2. Read the \`transcript\` field (RICH_TEXT_V2, markdown format) which contains the full conversation.
|
||||
2. Read the \`transcript\` field (RICH_TEXT, markdown format) which contains the full conversation.
|
||||
3. The transcript uses the format: **Speaker Name:** spoken text
|
||||
|
||||
## What to Produce
|
||||
|
||||
File diff suppressed because one or more lines are too long
+3
-3
@@ -96,12 +96,12 @@ describe('filterSortableFieldMetadataItems', () => {
|
||||
expect(filterSortableFieldMetadataItems(field)).toBe(false);
|
||||
});
|
||||
|
||||
it('should NOT allow unsortable field types like RICH_TEXT_V2', () => {
|
||||
it('should NOT allow unsortable field types like RICH_TEXT', () => {
|
||||
const field = {
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
isSystem: false,
|
||||
isActive: true,
|
||||
name: 'richTextV2',
|
||||
name: 'richText',
|
||||
};
|
||||
|
||||
expect(filterSortableFieldMetadataItems(field)).toBe(false);
|
||||
|
||||
+1
-1
@@ -310,7 +310,7 @@ ${mapObjectMetadataToGraphQLQuery({
|
||||
}`;
|
||||
}
|
||||
|
||||
if (fieldType === FieldMetadataType.RICH_TEXT_V2) {
|
||||
if (fieldType === FieldMetadataType.RICH_TEXT) {
|
||||
return `${gqlField}
|
||||
{
|
||||
blocknote
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ export const useFieldListFieldMetadataItems = ({
|
||||
)
|
||||
.filter(
|
||||
(fieldMetadataItem) =>
|
||||
fieldMetadataItem.type !== FieldMetadataType.RICH_TEXT_V2,
|
||||
fieldMetadataItem.type !== FieldMetadataType.RICH_TEXT,
|
||||
),
|
||||
(fieldMetadataItem) =>
|
||||
fieldMetadataItem.type === FieldMetadataType.RELATION ||
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ import { LinksFieldDisplay } from '@/object-record/record-field/ui/meta-types/di
|
||||
import { PhonesFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/PhonesFieldDisplay';
|
||||
import { RatingFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/RatingFieldDisplay';
|
||||
import { RelationFromManyFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/RelationFromManyFieldDisplay';
|
||||
import { RichTextV2FieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/RichTextV2FieldDisplay';
|
||||
import { RichTextFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/RichTextFieldDisplay';
|
||||
import { isFieldIdentifierDisplay } from '@/object-record/record-field/ui/meta-types/display/utils/isFieldIdentifierDisplay';
|
||||
import { isFieldActor } from '@/object-record/record-field/ui/types/guards/isFieldActor';
|
||||
import { isFieldArray } from '@/object-record/record-field/ui/types/guards/isFieldArray';
|
||||
@@ -20,7 +20,7 @@ import { isFieldFiles } from '@/object-record/record-field/ui/types/guards/isFie
|
||||
import { isFieldLinks } from '@/object-record/record-field/ui/types/guards/isFieldLinks';
|
||||
import { isFieldPhones } from '@/object-record/record-field/ui/types/guards/isFieldPhones';
|
||||
import { isFieldRating } from '@/object-record/record-field/ui/types/guards/isFieldRating';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
|
||||
import { MorphRelationManyToOneFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/MorphRelationManyToOneFieldDisplay';
|
||||
import { MorphRelationOneToManyFieldDisplay } from '@/object-record/record-field/ui/meta-types/display/components/MorphRelationOneToManyFieldDisplay';
|
||||
@@ -110,8 +110,8 @@ export const FieldDisplay = () => {
|
||||
<BooleanFieldDisplay />
|
||||
) : isFieldRating(fieldDefinition) ? (
|
||||
<RatingFieldDisplay readonly={isRecordFieldReadOnly} />
|
||||
) : isFieldRichTextV2(fieldDefinition) ? (
|
||||
<RichTextV2FieldDisplay />
|
||||
) : isFieldRichText(fieldDefinition) ? (
|
||||
<RichTextFieldDisplay />
|
||||
) : isFieldActor(fieldDefinition) ? (
|
||||
<ActorFieldDisplay />
|
||||
) : isFieldArray(fieldDefinition) ? (
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ import { isFieldRating } from '@/object-record/record-field/ui/types/guards/isFi
|
||||
import { isFieldRawJson } from '@/object-record/record-field/ui/types/guards/isFieldRawJson';
|
||||
import { isFieldRelationManyToOne } from '@/object-record/record-field/ui/types/guards/isFieldRelationManyToOne';
|
||||
import { isFieldRelationOneToMany } from '@/object-record/record-field/ui/types/guards/isFieldRelationOneToMany';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
import { isFieldSelect } from '@/object-record/record-field/ui/types/guards/isFieldSelect';
|
||||
import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';
|
||||
import { BooleanFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/BooleanFieldInput';
|
||||
@@ -94,7 +94,7 @@ export const FieldInput = () => {
|
||||
<RawJsonFieldInput />
|
||||
) : isFieldArray(fieldDefinition) ? (
|
||||
<ArrayFieldInput />
|
||||
) : isFieldRichTextV2(fieldDefinition) ? (
|
||||
) : isFieldRichText(fieldDefinition) ? (
|
||||
<RichTextFieldInput />
|
||||
) : (
|
||||
<></>
|
||||
|
||||
+6
-6
@@ -13,7 +13,7 @@ import { FormNumberFieldInput } from '@/object-record/record-field/ui/form-types
|
||||
import { FormPhoneFieldInput } from '@/object-record/record-field/ui/form-types/components/FormPhoneFieldInput';
|
||||
import { FormRawJsonFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRawJsonFieldInput';
|
||||
import { FormRelationToOneFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRelationToOneFieldInput';
|
||||
import { FormRichTextV2FieldInput } from '@/object-record/record-field/ui/form-types/components/FormRichTextV2FieldInput';
|
||||
import { FormRichTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRichTextFieldInput';
|
||||
import { FormSelectFieldInput } from '@/object-record/record-field/ui/form-types/components/FormSelectFieldInput';
|
||||
import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';
|
||||
import { FormUuidFieldInput } from '@/object-record/record-field/ui/form-types/components/FormUuidFieldInput';
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
type FieldPhonesValue,
|
||||
type FieldRelationToOneValue,
|
||||
type FieldRelationValue,
|
||||
type FieldRichTextV2Value,
|
||||
type FieldRichTextValue,
|
||||
type FormFieldCurrencyValue,
|
||||
} from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { isFieldAddress } from '@/object-record/record-field/ui/types/guards/isFieldAddress';
|
||||
@@ -48,7 +48,7 @@ import { isFieldNumber } from '@/object-record/record-field/ui/types/guards/isFi
|
||||
import { isFieldPhones } from '@/object-record/record-field/ui/types/guards/isFieldPhones';
|
||||
import { isFieldRawJson } from '@/object-record/record-field/ui/types/guards/isFieldRawJson';
|
||||
import { isFieldRelationManyToOne } from '@/object-record/record-field/ui/types/guards/isFieldRelationManyToOne';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
import { isFieldSelect } from '@/object-record/record-field/ui/types/guards/isFieldSelect';
|
||||
import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText';
|
||||
import { isFieldUuid } from '@/object-record/record-field/ui/types/guards/isFieldUuid';
|
||||
@@ -220,10 +220,10 @@ export const FormFieldInput = ({
|
||||
VariablePicker={VariablePicker}
|
||||
readonly={readonly}
|
||||
/>
|
||||
) : isFieldRichTextV2(field) ? (
|
||||
<FormRichTextV2FieldInput
|
||||
) : isFieldRichText(field) ? (
|
||||
<FormRichTextFieldInput
|
||||
label={field.label}
|
||||
defaultValue={defaultValue as FieldRichTextV2Value | undefined}
|
||||
defaultValue={defaultValue as FieldRichTextValue | undefined}
|
||||
onChange={onChange}
|
||||
VariablePicker={VariablePicker}
|
||||
readonly={readonly}
|
||||
|
||||
+10
-10
@@ -1,22 +1,22 @@
|
||||
import { FormAdvancedTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormAdvancedTextFieldInput';
|
||||
import { type VariablePickerComponent } from '@/object-record/record-field/ui/form-types/types/VariablePickerComponent';
|
||||
import { type FieldRichTextV2Value } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { type FieldRichTextValue } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
|
||||
type FormRichTextV2FieldInputProps = {
|
||||
type FormRichTextFieldInputProps = {
|
||||
label?: string;
|
||||
error?: string;
|
||||
hint?: string;
|
||||
defaultValue: FieldRichTextV2Value | undefined;
|
||||
onChange: (value: FieldRichTextV2Value) => void;
|
||||
defaultValue: FieldRichTextValue | undefined;
|
||||
onChange: (value: FieldRichTextValue) => void;
|
||||
onBlur?: () => void;
|
||||
readonly?: boolean;
|
||||
placeholder?: string;
|
||||
VariablePicker?: VariablePickerComponent;
|
||||
};
|
||||
|
||||
const RICH_TEXT_V2_EDITOR_MIN_HEIGHT = 340;
|
||||
const RICH_TEXT_EDITOR_MIN_HEIGHT = 340;
|
||||
|
||||
const RICH_TEXT_V2_EDITOR_MAX_WIDTH = 600;
|
||||
const RICH_TEXT_EDITOR_MAX_WIDTH = 600;
|
||||
|
||||
const mapTipTapToBlockNote = (tiptapJson: string): string => {
|
||||
try {
|
||||
@@ -30,7 +30,7 @@ const mapTipTapToBlockNote = (tiptapJson: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
export const FormRichTextV2FieldInput = ({
|
||||
export const FormRichTextFieldInput = ({
|
||||
label,
|
||||
error,
|
||||
hint,
|
||||
@@ -39,7 +39,7 @@ export const FormRichTextV2FieldInput = ({
|
||||
onChange,
|
||||
readonly,
|
||||
VariablePicker,
|
||||
}: FormRichTextV2FieldInputProps) => {
|
||||
}: FormRichTextFieldInputProps) => {
|
||||
const handleChange = (value: string) => {
|
||||
onChange({
|
||||
blocknote: mapTipTapToBlockNote(value),
|
||||
@@ -57,8 +57,8 @@ export const FormRichTextV2FieldInput = ({
|
||||
onChange={handleChange}
|
||||
readonly={readonly}
|
||||
VariablePicker={VariablePicker}
|
||||
minHeight={RICH_TEXT_V2_EDITOR_MIN_HEIGHT}
|
||||
maxWidth={RICH_TEXT_V2_EDITOR_MAX_WIDTH}
|
||||
minHeight={RICH_TEXT_EDITOR_MIN_HEIGHT}
|
||||
maxWidth={RICH_TEXT_EDITOR_MAX_WIDTH}
|
||||
/>
|
||||
);
|
||||
};
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
import { FormRichTextV2FieldInput } from '@/object-record/record-field/ui/form-types/components/FormRichTextV2FieldInput';
|
||||
import { FormRichTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRichTextFieldInput';
|
||||
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
||||
import {
|
||||
expect,
|
||||
@@ -12,9 +12,9 @@ import { getUserDevice } from 'twenty-ui/utilities';
|
||||
import { WorkflowStepDecorator } from '~/testing/decorators/WorkflowStepDecorator';
|
||||
import { MOCKED_STEP_ID } from '~/testing/mock-data/workflow';
|
||||
|
||||
const meta: Meta<typeof FormRichTextV2FieldInput> = {
|
||||
title: 'UI/Data/Field/Form/Input/FormRichTextV2FieldInput',
|
||||
component: FormRichTextV2FieldInput,
|
||||
const meta: Meta<typeof FormRichTextFieldInput> = {
|
||||
title: 'UI/Data/Field/Form/Input/FormRichTextFieldInput',
|
||||
component: FormRichTextFieldInput,
|
||||
args: {},
|
||||
argTypes: {},
|
||||
decorators: [WorkflowStepDecorator],
|
||||
@@ -22,7 +22,7 @@ const meta: Meta<typeof FormRichTextV2FieldInput> = {
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof FormRichTextV2FieldInput>;
|
||||
type Story = StoryObj<typeof FormRichTextFieldInput>;
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
+6
-6
@@ -49,8 +49,8 @@ import { isFieldRating } from '@/object-record/record-field/ui/types/guards/isFi
|
||||
import { isFieldRatingValue } from '@/object-record/record-field/ui/types/guards/isFieldRatingValue';
|
||||
import { isFieldRelationManyToOne } from '@/object-record/record-field/ui/types/guards/isFieldRelationManyToOne';
|
||||
import { isFieldRelationManyToOneValue } from '@/object-record/record-field/ui/types/guards/isFieldRelationManyToOneValue';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichTextV2Value } from '@/object-record/record-field/ui/types/guards/isFieldRichTextValueV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
import { isFieldRichTextValue } from '@/object-record/record-field/ui/types/guards/isFieldRichTextValue';
|
||||
import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText';
|
||||
import { isFieldTextValue } from '@/object-record/record-field/ui/types/guards/isFieldTextValue';
|
||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||
@@ -143,9 +143,9 @@ export const usePersistField = ({
|
||||
const fieldIsRawJson =
|
||||
isFieldRawJson(fieldDefinition) && isFieldRawJsonValue(valueToPersist);
|
||||
|
||||
const fieldIsRichTextV2 =
|
||||
isFieldRichTextV2(fieldDefinition) &&
|
||||
isFieldRichTextV2Value(valueToPersist);
|
||||
const fieldIsRichText =
|
||||
isFieldRichText(fieldDefinition) &&
|
||||
isFieldRichTextValue(valueToPersist);
|
||||
|
||||
const fieldIsArray =
|
||||
isFieldArray(fieldDefinition) && isFieldArrayValue(valueToPersist);
|
||||
@@ -179,7 +179,7 @@ export const usePersistField = ({
|
||||
fieldIsRawJson ||
|
||||
fieldIsArray ||
|
||||
fieldIsFiles ||
|
||||
fieldIsRichTextV2;
|
||||
fieldIsRichText;
|
||||
|
||||
if (isValuePersistable) {
|
||||
const fieldName = fieldDefinition.metadata.fieldName;
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
import { useRichTextV2FieldDisplay } from '@/object-record/record-field/ui/meta-types/hooks/useRichTextV2FieldDisplay';
|
||||
import { useRichTextFieldDisplay } from '@/object-record/record-field/ui/meta-types/hooks/useRichTextFieldDisplay';
|
||||
import { getFirstNonEmptyLineOfRichText } from '@/blocknote-editor/utils/getFirstNonEmptyLineOfRichText';
|
||||
import type { PartialBlock } from '@blocknote/core';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { isDefined, parseJson } from 'twenty-shared/utils';
|
||||
|
||||
export const RichTextV2FieldDisplay = () => {
|
||||
const { fieldValue } = useRichTextV2FieldDisplay();
|
||||
export const RichTextFieldDisplay = () => {
|
||||
const { fieldValue } = useRichTextFieldDisplay();
|
||||
|
||||
const blocks =
|
||||
isDefined(fieldValue) && isNonEmptyString(fieldValue.blocknote)
|
||||
+6
-6
@@ -1,24 +1,24 @@
|
||||
import { useContext } from 'react';
|
||||
|
||||
import { type FieldRichTextV2Value } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { type FieldRichTextValue } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';
|
||||
|
||||
export const useRichTextV2FieldDisplay = () => {
|
||||
export const useRichTextFieldDisplay = () => {
|
||||
const { recordId, fieldDefinition } = useContext(FieldContext);
|
||||
|
||||
assertFieldMetadata(
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
isFieldRichTextV2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
isFieldRichText,
|
||||
fieldDefinition,
|
||||
);
|
||||
|
||||
const fieldName = fieldDefinition.metadata.fieldName;
|
||||
|
||||
const fieldValue = useRecordFieldValue<FieldRichTextV2Value | undefined>(
|
||||
const fieldValue = useRecordFieldValue<FieldRichTextValue | undefined>(
|
||||
recordId,
|
||||
fieldName,
|
||||
fieldDefinition,
|
||||
+2
-2
@@ -7,7 +7,7 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel
|
||||
import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext';
|
||||
import { FieldInputEventContext } from '@/object-record/record-field/ui/contexts/FieldInputEventContext';
|
||||
|
||||
import { type FieldRichTextV2Metadata } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { type FieldRichTextMetadata } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';
|
||||
import { styled } from '@linaria/react';
|
||||
import { Suspense, lazy, useContext, useRef } from 'react';
|
||||
@@ -59,7 +59,7 @@ export const RichTextFieldInput = () => {
|
||||
id: recordId,
|
||||
targetObjectNameSingular: (
|
||||
fieldDefinition as {
|
||||
metadata: FieldRichTextV2Metadata;
|
||||
metadata: FieldRichTextMetadata;
|
||||
}
|
||||
).metadata.objectMetadataNameSingular as
|
||||
| CoreObjectNameSingular.Note
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ const RichTextFieldInputWithContext = () => {
|
||||
fieldDefinition: {
|
||||
fieldMetadataId: 'richText',
|
||||
label: 'Rich Text',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
iconName: 'IconRichText',
|
||||
metadata: {
|
||||
fieldName: 'richText',
|
||||
|
||||
+3
-3
@@ -131,7 +131,7 @@ export type FieldRawJsonMetadata = BaseFieldMetadata & {
|
||||
settings?: null;
|
||||
};
|
||||
|
||||
export type FieldRichTextV2Metadata = BaseFieldMetadata & {
|
||||
export type FieldRichTextMetadata = BaseFieldMetadata & {
|
||||
settings?: null;
|
||||
};
|
||||
|
||||
@@ -225,7 +225,7 @@ export type FieldMetadata =
|
||||
| FieldArrayMetadata
|
||||
| FieldTsVectorMetadata
|
||||
| FieldRawJsonMetadata
|
||||
| FieldRichTextV2Metadata;
|
||||
| FieldRichTextMetadata;
|
||||
|
||||
export type FieldTextValue = string;
|
||||
export type FieldUUidValue = string; // TODO: can we replace with a template literal type, or maybe overkill ?
|
||||
@@ -279,7 +279,7 @@ export type FieldRelationValue<
|
||||
export type Json = ZodHelperLiteral | { [key: string]: Json } | Json[];
|
||||
export type FieldJsonValue = Record<string, Json> | Json[] | null;
|
||||
|
||||
export type FieldRichTextV2Value = {
|
||||
export type FieldRichTextValue = {
|
||||
blocknote: string | null;
|
||||
markdown: string | null;
|
||||
};
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ import {
|
||||
type FieldRatingMetadata,
|
||||
type FieldRawJsonMetadata,
|
||||
type FieldRelationMetadata,
|
||||
type FieldRichTextV2Metadata,
|
||||
type FieldRichTextMetadata,
|
||||
type FieldSelectMetadata,
|
||||
type FieldTextMetadata,
|
||||
type FieldUuidMetadata,
|
||||
@@ -74,8 +74,8 @@ type AssertFieldMetadataFunction = <
|
||||
? FieldAddressMetadata
|
||||
: E extends 'RAW_JSON'
|
||||
? FieldRawJsonMetadata
|
||||
: E extends 'RICH_TEXT_V2'
|
||||
? FieldRichTextV2Metadata
|
||||
: E extends 'RICH_TEXT'
|
||||
? FieldRichTextMetadata
|
||||
: E extends 'ACTOR'
|
||||
? FieldActorMetadata
|
||||
: E extends 'ARRAY'
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition';
|
||||
import {
|
||||
type FieldMetadata,
|
||||
type FieldRichTextV2Metadata,
|
||||
type FieldRichTextMetadata,
|
||||
} from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
|
||||
export const isFieldRichTextV2 = (
|
||||
export const isFieldRichText = (
|
||||
field: Pick<FieldDefinition<FieldMetadata>, 'type'>,
|
||||
): field is FieldDefinition<FieldRichTextV2Metadata> =>
|
||||
field.type === FieldMetadataType.RICH_TEXT_V2;
|
||||
): field is FieldDefinition<FieldRichTextMetadata> =>
|
||||
field.type === FieldMetadataType.RICH_TEXT;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { type FieldRichTextValue } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const richTextSchema: z.ZodType<FieldRichTextValue> = z.object({
|
||||
blocknote: z.string().nullable(),
|
||||
markdown: z.string().nullable(),
|
||||
});
|
||||
|
||||
export const isFieldRichTextValue = (
|
||||
fieldValue: unknown,
|
||||
): fieldValue is FieldRichTextValue =>
|
||||
richTextSchema.safeParse(fieldValue).success;
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
import { type FieldRichTextV2Value } from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { z } from 'zod';
|
||||
|
||||
export const richTextV2Schema: z.ZodType<FieldRichTextV2Value> = z.object({
|
||||
blocknote: z.string().nullable(),
|
||||
markdown: z.string().nullable(),
|
||||
});
|
||||
|
||||
export const isFieldRichTextV2Value = (
|
||||
fieldValue: unknown,
|
||||
): fieldValue is FieldRichTextV2Value =>
|
||||
richTextV2Schema.safeParse(fieldValue).success;
|
||||
+4
-4
@@ -32,8 +32,8 @@ import { isFieldPosition } from '@/object-record/record-field/ui/types/guards/is
|
||||
import { isFieldRating } from '@/object-record/record-field/ui/types/guards/isFieldRating';
|
||||
import { isFieldRawJson } from '@/object-record/record-field/ui/types/guards/isFieldRawJson';
|
||||
import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation';
|
||||
import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2';
|
||||
import { isFieldRichTextV2Value } from '@/object-record/record-field/ui/types/guards/isFieldRichTextValueV2';
|
||||
import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText';
|
||||
import { isFieldRichTextValue } from '@/object-record/record-field/ui/types/guards/isFieldRichTextValue';
|
||||
import { isFieldSelect } from '@/object-record/record-field/ui/types/guards/isFieldSelect';
|
||||
import { isFieldSelectValue } from '@/object-record/record-field/ui/types/guards/isFieldSelectValue';
|
||||
import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText';
|
||||
@@ -177,9 +177,9 @@ export const isFieldValueEmpty = ({
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isFieldRichTextV2(fieldDefinition)) {
|
||||
if (isFieldRichText(fieldDefinition)) {
|
||||
return (
|
||||
!isFieldRichTextV2Value(fieldValue) || isValueEmpty(fieldValue?.markdown)
|
||||
!isFieldRichTextValue(fieldValue) || isValueEmpty(fieldValue?.markdown)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -22,7 +22,7 @@ import {
|
||||
type RatingFilter,
|
||||
type RawJsonFilter,
|
||||
type RecordGqlOperationFilter,
|
||||
type RichTextV2Filter,
|
||||
type RichTextFilter,
|
||||
type SelectFilter,
|
||||
type StringFilter,
|
||||
type TSVectorFilter,
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
isMatchingMultiSelectFilter,
|
||||
isMatchingRatingFilter,
|
||||
isMatchingRawJsonFilter,
|
||||
isMatchingRichTextV2Filter,
|
||||
isMatchingRichTextFilter,
|
||||
isMatchingSelectFilter,
|
||||
isMatchingStringFilter,
|
||||
isMatchingTSVectorFilter,
|
||||
@@ -235,9 +235,9 @@ export const isRecordMatchingFilter = ({
|
||||
value: record[filterKey],
|
||||
});
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
return isMatchingRichTextV2Filter({
|
||||
richTextV2Filter: filterValue as RichTextV2Filter,
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
return isMatchingRichTextFilter({
|
||||
richTextFilter: filterValue as RichTextFilter,
|
||||
value: record[filterKey],
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -375,7 +375,7 @@ const SUPPORTED_COMPOSITE_FIELD_TYPES: FieldMetadataType[] = [
|
||||
FieldMetadataType.EMAILS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.ACTOR,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
];
|
||||
|
||||
const computeValueFromSubFieldType = ({
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ export const useBuildSpreadsheetImportFields = () => {
|
||||
case FieldMetadataType.FULL_NAME:
|
||||
case FieldMetadataType.LINKS:
|
||||
case FieldMetadataType.PHONES:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return handleCompositeFields({
|
||||
fieldMetadataItem,
|
||||
fieldType: fieldMetadataItem.type,
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ describe('buildRecordFromImportedStructuredRow', () => {
|
||||
universalIdentifier: '16',
|
||||
name: 'richTextField',
|
||||
label: 'Rich Text Field',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
isNullable: true,
|
||||
isActive: true,
|
||||
isCustom: false,
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ export const buildRecordFromImportedStructuredRow = ({
|
||||
additionalPhones: phoneArrayJSONSchema.parse,
|
||||
},
|
||||
|
||||
[FieldMetadataType.RICH_TEXT_V2]: {
|
||||
[FieldMetadataType.RICH_TEXT]: {
|
||||
blocknote: castToString,
|
||||
markdown: castToString,
|
||||
},
|
||||
@@ -222,7 +222,7 @@ export const buildRecordFromImportedStructuredRow = ({
|
||||
case FieldMetadataType.CURRENCY:
|
||||
case FieldMetadataType.ADDRESS:
|
||||
case FieldMetadataType.LINKS:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
case FieldMetadataType.EMAILS:
|
||||
case FieldMetadataType.FULL_NAME: {
|
||||
const compositeData = buildCompositeFieldRecord(
|
||||
|
||||
@@ -95,7 +95,7 @@ export const generateEmptyFieldValue = ({
|
||||
case FieldMetadataType.RAW_JSON: {
|
||||
return null;
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
return {
|
||||
blocknote: null,
|
||||
markdown: null,
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import {
|
||||
type PageLayoutWidget,
|
||||
type RichTextV2Body,
|
||||
type RichTextBody,
|
||||
WidgetType,
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
@@ -48,7 +48,7 @@ export const useCreatePageLayoutStandaloneRichTextWidget = (
|
||||
);
|
||||
|
||||
const createPageLayoutStandaloneRichTextWidget = useCallback(
|
||||
(body: RichTextV2Body): PageLayoutWidget => {
|
||||
(body: RichTextBody): PageLayoutWidget => {
|
||||
const activeTabId = store.get(
|
||||
activeTabIdComponentState.atomFamily({
|
||||
instanceId: tabListInstanceId,
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import {
|
||||
type GridPosition,
|
||||
PageLayoutTabLayoutMode,
|
||||
type PageLayoutWidget,
|
||||
type RichTextV2Body,
|
||||
type RichTextBody,
|
||||
WidgetConfigurationType,
|
||||
WidgetType,
|
||||
} from '~/generated-metadata/graphql';
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
export const createDefaultStandaloneRichTextWidget = (
|
||||
id: string,
|
||||
pageLayoutTabId: string,
|
||||
body: RichTextV2Body,
|
||||
body: RichTextBody,
|
||||
gridPosition: GridPosition,
|
||||
objectMetadataId?: string | null,
|
||||
): PageLayoutWidget => {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ export const COMPOSITE_FIELD_SUB_FIELD_LABELS: {
|
||||
workspaceMemberId: 'Workspace Member',
|
||||
context: 'Context',
|
||||
},
|
||||
[FieldMetadataType.RICH_TEXT_V2]: {
|
||||
[FieldMetadataType.RICH_TEXT]: {
|
||||
blocknote: 'BlockNote',
|
||||
markdown: 'Markdown',
|
||||
},
|
||||
|
||||
+7
-7
@@ -6,7 +6,7 @@ import {
|
||||
type FieldFullNameValue,
|
||||
type FieldLinksValue,
|
||||
type FieldPhonesValue,
|
||||
type FieldRichTextV2Value,
|
||||
type FieldRichTextValue,
|
||||
} from '@/object-record/record-field/ui/types/FieldMetadata';
|
||||
import { COMPOSITE_FIELD_SUB_FIELD_LABELS } from '@/settings/data-model/constants/CompositeFieldSubFieldLabel';
|
||||
import { type SettingsFieldTypeConfig } from '@/settings/data-model/constants/SettingsNonCompositeFieldTypeConfigs';
|
||||
@@ -499,17 +499,17 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {
|
||||
},
|
||||
],
|
||||
} as const satisfies SettingsCompositeFieldTypeConfig<FieldActorValue>,
|
||||
[FieldMetadataType.RICH_TEXT_V2]: {
|
||||
[FieldMetadataType.RICH_TEXT]: {
|
||||
label: 'Rich Text',
|
||||
Icon: IllustrationIconText,
|
||||
category: 'Basic',
|
||||
subFields: [
|
||||
{
|
||||
subFieldName:
|
||||
COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT_V2]
|
||||
COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT]
|
||||
.blocknote,
|
||||
subFieldLabel:
|
||||
COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT_V2]
|
||||
COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT]
|
||||
.blocknote,
|
||||
isImportable: false,
|
||||
isFilterable: false,
|
||||
@@ -517,10 +517,10 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {
|
||||
},
|
||||
{
|
||||
subFieldName:
|
||||
COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT_V2]
|
||||
COMPOSITE_FIELD_TYPE_SUB_FIELDS_NAMES[FieldMetadataType.RICH_TEXT]
|
||||
.markdown,
|
||||
subFieldLabel:
|
||||
COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT_V2]
|
||||
COMPOSITE_FIELD_SUB_FIELD_LABELS[FieldMetadataType.RICH_TEXT]
|
||||
.markdown,
|
||||
isImportable: true,
|
||||
isFilterable: false,
|
||||
@@ -541,5 +541,5 @@ export const SETTINGS_COMPOSITE_FIELD_TYPE_CONFIGS = {
|
||||
markdown: '# Hello Again',
|
||||
},
|
||||
],
|
||||
} as const satisfies SettingsCompositeFieldTypeConfig<FieldRichTextV2Value>,
|
||||
} as const satisfies SettingsCompositeFieldTypeConfig<FieldRichTextValue>,
|
||||
} as const satisfies SettingsCompositeFieldTypeConfigArray;
|
||||
|
||||
@@ -10,7 +10,7 @@ export const COMPOSITE_FIELD_TYPES = [
|
||||
'PHONES',
|
||||
'FULL_NAME',
|
||||
'ACTOR',
|
||||
'RICH_TEXT_V2',
|
||||
'RICH_TEXT',
|
||||
] as const;
|
||||
|
||||
type CompositeFieldTypeBaseLiteral = (typeof COMPOSITE_FIELD_TYPES)[number];
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ import { type PickLiteral } from '~/types/PickLiteral';
|
||||
|
||||
export type SettingsExcludedFieldType = PickLiteral<
|
||||
FieldType,
|
||||
'POSITION' | 'TS_VECTOR' | 'RICH_TEXT_V2' | 'NUMERIC'
|
||||
'POSITION' | 'TS_VECTOR' | 'RICH_TEXT' | 'NUMERIC'
|
||||
>;
|
||||
|
||||
+2
-2
@@ -51,10 +51,10 @@ describe('getSortIconForFieldType', () => {
|
||||
).toBe(IconSortDescendingLetters);
|
||||
});
|
||||
|
||||
it('should return IconSortAscendingLetters for RICH_TEXT_V2 field ascending', () => {
|
||||
it('should return IconSortAscendingLetters for RICH_TEXT field ascending', () => {
|
||||
expect(
|
||||
getSortIconForFieldType({
|
||||
fieldType: FieldMetadataType.RICH_TEXT_V2,
|
||||
fieldType: FieldMetadataType.RICH_TEXT,
|
||||
orderBy: GraphOrderBy.FIELD_ASC,
|
||||
}),
|
||||
).toBe(IconSortAscendingLetters);
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ export const useDownloadFakeRecords = () => {
|
||||
|
||||
break;
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
case FieldMetadataType.ACTOR:
|
||||
case FieldMetadataType.EMAILS:
|
||||
case FieldMetadataType.CURRENCY:
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ type WorkflowStepFilterFieldSelectProps = {
|
||||
};
|
||||
|
||||
const NON_SELECTABLE_FIELD_TYPES = [
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.RATING,
|
||||
];
|
||||
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ const isFilterableFieldType = (
|
||||
FieldMetadataType.SELECT,
|
||||
FieldMetadataType.MULTI_SELECT,
|
||||
FieldMetadataType.RAW_JSON,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.ARRAY,
|
||||
FieldMetadataType.UUID,
|
||||
FieldMetadataType.RELATION,
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ const SUPPORTED_FORM_FIELD_TYPES = [
|
||||
FieldMetadataType.UUID,
|
||||
FieldMetadataType.ARRAY,
|
||||
FieldMetadataType.RELATION,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
];
|
||||
|
||||
export const shouldDisplayFormField = ({
|
||||
|
||||
+1
-1
@@ -24,6 +24,6 @@ export const DEFAULT_ICONS_BY_FIELD_TYPE: Record<FieldMetadataType, string> = {
|
||||
[FieldMetadataType.ACTOR]: 'IconUsers',
|
||||
[FieldMetadataType.NUMERIC]: 'IconUsers',
|
||||
[FieldMetadataType.POSITION]: 'IconUsers',
|
||||
[FieldMetadataType.RICH_TEXT_V2]: 'IconUsers',
|
||||
[FieldMetadataType.RICH_TEXT]: 'IconUsers',
|
||||
[FieldMetadataType.TS_VECTOR]: 'IconUsers',
|
||||
};
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ export const SettingsObjectNewFieldSelect = () => {
|
||||
const excludedFieldTypes: FieldType[] = (
|
||||
[
|
||||
FieldMetadataType.NUMERIC,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.ACTOR,
|
||||
FieldMetadataType.UUID,
|
||||
] as const
|
||||
|
||||
+10
-10
@@ -23,7 +23,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-1\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Great conversation today about potential collaboration opportunities. Next steps discussed include proposal review and timeline planning.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Great conversation today about potential collaboration opportunities. Next steps discussed include proposal review and timeline planning."
|
||||
},
|
||||
@@ -106,7 +106,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-2\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Reviewed current project status and identified key deliverables for the upcoming quarter. Timeline adjustments may be needed.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Reviewed current project status and identified key deliverables for the upcoming quarter. Timeline adjustments may be needed."
|
||||
},
|
||||
@@ -189,7 +189,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-3\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Impressive background in technology and leadership. Strong potential for senior roles in upcoming projects.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Impressive background in technology and leadership. Strong potential for senior roles in upcoming projects."
|
||||
},
|
||||
@@ -272,7 +272,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-4\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Made connection at industry conference. Shared interests in digital transformation and innovation strategies.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Made connection at industry conference. Shared interests in digital transformation and innovation strategies."
|
||||
},
|
||||
@@ -355,7 +355,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-5\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Strong candidate with relevant experience. Technical skills align well with team requirements. Positive cultural fit assessment.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Strong candidate with relevant experience. Technical skills align well with team requirements. Positive cultural fit assessment."
|
||||
},
|
||||
@@ -438,7 +438,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-6\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Quarterly review completed. Exceeded targets in key areas. Discussed career development opportunities and growth plans.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Quarterly review completed. Exceeded targets in key areas. Discussed career development opportunities and growth plans."
|
||||
},
|
||||
@@ -521,7 +521,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-7\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Completed certification program successfully. Ready to take on expanded responsibilities in the next phase.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Completed certification program successfully. Ready to take on expanded responsibilities in the next phase."
|
||||
},
|
||||
@@ -604,7 +604,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-8\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Long-standing professional relationship. Reliable partner for complex initiatives. High satisfaction ratings.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Long-standing professional relationship. Reliable partner for complex initiatives. High satisfaction ratings."
|
||||
},
|
||||
@@ -687,7 +687,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-9\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Great conversation today about potential collaboration opportunities. Next steps discussed include proposal review and timeline planning.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Great conversation today about potential collaboration opportunities. Next steps discussed include proposal review and timeline planning."
|
||||
},
|
||||
@@ -770,7 +770,7 @@ export const mockedNoteRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-10\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Reviewed current project status and identified key deliverables for the upcoming quarter. Timeline adjustments may be needed.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Reviewed current project status and identified key deliverables for the upcoming quarter. Timeline adjustments may be needed."
|
||||
},
|
||||
|
||||
+10
-10
@@ -33,7 +33,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-1\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Arrange a follow-up call to discuss project details and next steps.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Arrange a follow-up call to discuss project details and next steps."
|
||||
},
|
||||
@@ -128,7 +128,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-2\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Prepare and send the project proposal document with timeline and deliverables.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Prepare and send the project proposal document with timeline and deliverables."
|
||||
},
|
||||
@@ -223,7 +223,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-3\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Review the contract terms and conditions before final approval.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Review the contract terms and conditions before final approval."
|
||||
},
|
||||
@@ -318,7 +318,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-4\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Create detailed agenda for upcoming strategy meeting.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Create detailed agenda for upcoming strategy meeting."
|
||||
},
|
||||
@@ -413,7 +413,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-5\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Verify and update contact details in the system.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Verify and update contact details in the system."
|
||||
},
|
||||
@@ -508,7 +508,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-6\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Complete reference verification for background check process.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Complete reference verification for background check process."
|
||||
},
|
||||
@@ -603,7 +603,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-7\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Send portfolio examples and case studies for review.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Send portfolio examples and case studies for review."
|
||||
},
|
||||
@@ -698,7 +698,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-8\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Prepare onboarding materials and schedule orientation session.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Prepare onboarding materials and schedule orientation session."
|
||||
},
|
||||
@@ -793,7 +793,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-9\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Arrange a follow-up call to discuss project details and next steps.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Arrange a follow-up call to discuss project details and next steps."
|
||||
},
|
||||
@@ -888,7 +888,7 @@ export const mockedTaskRecords: ObjectRecord[] =
|
||||
]
|
||||
},
|
||||
"bodyV2": {
|
||||
"__typename": "RichTextV2",
|
||||
"__typename": "RichText",
|
||||
"blocknote": "[{\"id\":\"block-10\",\"type\":\"paragraph\",\"props\":{\"textColor\":\"default\",\"backgroundColor\":\"default\",\"textAlignment\":\"left\"},\"content\":[{\"type\":\"text\",\"text\":\"Prepare and send the project proposal document with timeline and deliverables.\",\"styles\":{}}],\"children\":[]}]",
|
||||
"markdown": "Prepare and send the project proposal document with timeline and deliverables."
|
||||
},
|
||||
|
||||
+2
-2
@@ -8638,7 +8638,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
"__typename": "Field",
|
||||
"id": "15cffcf2-ed38-4ee1-956a-d8bc9d2bef16",
|
||||
"universalIdentifier": "20202020-4aa0-4ae8-898d-7df0afd47ab1",
|
||||
"type": "RICH_TEXT_V2",
|
||||
"type": "RICH_TEXT",
|
||||
"name": "bodyV2",
|
||||
"label": "Body",
|
||||
"description": "Task body",
|
||||
@@ -23733,7 +23733,7 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
"__typename": "Field",
|
||||
"id": "71961f86-5386-4cc9-b23a-39fc5c1c7c5e",
|
||||
"universalIdentifier": "20202020-a7bb-4d94-be51-8f25181502c8",
|
||||
"type": "RICH_TEXT_V2",
|
||||
"type": "RICH_TEXT",
|
||||
"name": "bodyV2",
|
||||
"label": "Body",
|
||||
"description": "Note body",
|
||||
|
||||
@@ -374,7 +374,7 @@ enum FieldMetadataType {
|
||||
RATING
|
||||
RAW_JSON
|
||||
RELATION
|
||||
RICH_TEXT_V2
|
||||
RICH_TEXT
|
||||
SELECT
|
||||
TEXT
|
||||
TS_VECTOR
|
||||
@@ -873,7 +873,7 @@ type RatioAggregateConfig {
|
||||
optionValue: String!
|
||||
}
|
||||
|
||||
type RichTextV2Body {
|
||||
type RichTextBody {
|
||||
blocknote: String
|
||||
markdown: String
|
||||
}
|
||||
@@ -990,7 +990,7 @@ enum WidgetConfigurationType {
|
||||
|
||||
type StandaloneRichTextConfiguration {
|
||||
configurationType: WidgetConfigurationType!
|
||||
body: RichTextV2Body!
|
||||
body: RichTextBody!
|
||||
}
|
||||
|
||||
type PieChartConfiguration {
|
||||
@@ -1606,6 +1606,7 @@ enum FeatureFlagKey {
|
||||
IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED
|
||||
IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED
|
||||
IS_DRAFT_EMAIL_ENABLED
|
||||
IS_RICH_TEXT_V1_MIGRATED
|
||||
}
|
||||
|
||||
type SSOIdentityProvider {
|
||||
|
||||
@@ -309,7 +309,7 @@ export interface Field {
|
||||
|
||||
|
||||
/** Type of the field */
|
||||
export type FieldMetadataType = 'ACTOR' | 'ADDRESS' | 'ARRAY' | 'BOOLEAN' | 'CURRENCY' | 'DATE' | 'DATE_TIME' | 'EMAILS' | 'FILES' | 'FULL_NAME' | 'LINKS' | 'MORPH_RELATION' | 'MULTI_SELECT' | 'NUMBER' | 'NUMERIC' | 'PHONES' | 'POSITION' | 'RATING' | 'RAW_JSON' | 'RELATION' | 'RICH_TEXT_V2' | 'SELECT' | 'TEXT' | 'TS_VECTOR' | 'UUID'
|
||||
export type FieldMetadataType = 'ACTOR' | 'ADDRESS' | 'ARRAY' | 'BOOLEAN' | 'CURRENCY' | 'DATE' | 'DATE_TIME' | 'EMAILS' | 'FILES' | 'FULL_NAME' | 'LINKS' | 'MORPH_RELATION' | 'MULTI_SELECT' | 'NUMBER' | 'NUMERIC' | 'PHONES' | 'POSITION' | 'RATING' | 'RAW_JSON' | 'RELATION' | 'RICH_TEXT' | 'SELECT' | 'TEXT' | 'TS_VECTOR' | 'UUID'
|
||||
|
||||
export interface IndexField {
|
||||
id: Scalars['UUID']
|
||||
@@ -646,10 +646,10 @@ export interface RatioAggregateConfig {
|
||||
__typename: 'RatioAggregateConfig'
|
||||
}
|
||||
|
||||
export interface RichTextV2Body {
|
||||
export interface RichTextBody {
|
||||
blocknote?: Scalars['String']
|
||||
markdown?: Scalars['String']
|
||||
__typename: 'RichTextV2Body'
|
||||
__typename: 'RichTextBody'
|
||||
}
|
||||
|
||||
export interface GridPosition {
|
||||
@@ -726,7 +726,7 @@ export type WidgetConfigurationType = 'AGGREGATE_CHART' | 'GAUGE_CHART' | 'PIE_C
|
||||
|
||||
export interface StandaloneRichTextConfiguration {
|
||||
configurationType: WidgetConfigurationType
|
||||
body: RichTextV2Body
|
||||
body: RichTextBody
|
||||
__typename: 'StandaloneRichTextConfiguration'
|
||||
}
|
||||
|
||||
@@ -1310,7 +1310,7 @@ export interface FeatureFlag {
|
||||
__typename: 'FeatureFlag'
|
||||
}
|
||||
|
||||
export type FeatureFlagKey = 'IS_UNIQUE_INDEXES_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_AI_ENABLED' | 'IS_APPLICATION_ENABLED' | 'IS_MARKETPLACE_ENABLED' | 'IS_RECORD_PAGE_LAYOUT_EDITING_ENABLED' | 'IS_PUBLIC_DOMAIN_ENABLED' | 'IS_EMAILING_DOMAIN_ENABLED' | 'IS_DASHBOARD_V2_ENABLED' | 'IS_ATTACHMENT_MIGRATED' | 'IS_NOTE_TARGET_MIGRATED' | 'IS_TASK_TARGET_MIGRATED' | 'IS_ROW_LEVEL_PERMISSION_PREDICATES_ENABLED' | 'IS_JUNCTION_RELATIONS_ENABLED' | 'IS_COMMAND_MENU_ITEM_ENABLED' | 'IS_NAVIGATION_MENU_ITEM_ENABLED' | 'IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED' | 'IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED' | 'IS_DRAFT_EMAIL_ENABLED'
|
||||
export type FeatureFlagKey = 'IS_UNIQUE_INDEXES_ENABLED' | 'IS_JSON_FILTER_ENABLED' | 'IS_AI_ENABLED' | 'IS_APPLICATION_ENABLED' | 'IS_MARKETPLACE_ENABLED' | 'IS_RECORD_PAGE_LAYOUT_EDITING_ENABLED' | 'IS_PUBLIC_DOMAIN_ENABLED' | 'IS_EMAILING_DOMAIN_ENABLED' | 'IS_DASHBOARD_V2_ENABLED' | 'IS_ATTACHMENT_MIGRATED' | 'IS_NOTE_TARGET_MIGRATED' | 'IS_TASK_TARGET_MIGRATED' | 'IS_ROW_LEVEL_PERMISSION_PREDICATES_ENABLED' | 'IS_JUNCTION_RELATIONS_ENABLED' | 'IS_COMMAND_MENU_ITEM_ENABLED' | 'IS_NAVIGATION_MENU_ITEM_ENABLED' | 'IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED' | 'IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED' | 'IS_DRAFT_EMAIL_ENABLED' | 'IS_RICH_TEXT_V1_MIGRATED'
|
||||
|
||||
export interface SSOIdentityProvider {
|
||||
id: Scalars['UUID']
|
||||
@@ -3512,7 +3512,7 @@ export interface RatioAggregateConfigGenqlSelection{
|
||||
__scalar?: boolean | number
|
||||
}
|
||||
|
||||
export interface RichTextV2BodyGenqlSelection{
|
||||
export interface RichTextBodyGenqlSelection{
|
||||
blocknote?: boolean | number
|
||||
markdown?: boolean | number
|
||||
__typename?: boolean | number
|
||||
@@ -3621,7 +3621,7 @@ export interface AggregateChartConfigurationGenqlSelection{
|
||||
|
||||
export interface StandaloneRichTextConfigurationGenqlSelection{
|
||||
configurationType?: boolean | number
|
||||
body?: RichTextV2BodyGenqlSelection
|
||||
body?: RichTextBodyGenqlSelection
|
||||
__typename?: boolean | number
|
||||
__scalar?: boolean | number
|
||||
}
|
||||
@@ -6495,10 +6495,10 @@ export interface LogicFunctionLogsInput {applicationId?: (Scalars['UUID'] | null
|
||||
|
||||
|
||||
|
||||
const RichTextV2Body_possibleTypes: string[] = ['RichTextV2Body']
|
||||
export const isRichTextV2Body = (obj?: { __typename?: any } | null): obj is RichTextV2Body => {
|
||||
if (!obj?.__typename) throw new Error('__typename is missing in "isRichTextV2Body"')
|
||||
return RichTextV2Body_possibleTypes.includes(obj.__typename)
|
||||
const RichTextBody_possibleTypes: string[] = ['RichTextBody']
|
||||
export const isRichTextBody = (obj?: { __typename?: any } | null): obj is RichTextBody => {
|
||||
if (!obj?.__typename) throw new Error('__typename is missing in "isRichTextBody"')
|
||||
return RichTextBody_possibleTypes.includes(obj.__typename)
|
||||
}
|
||||
|
||||
|
||||
@@ -8290,7 +8290,7 @@ export const enumFieldMetadataType = {
|
||||
RATING: 'RATING' as const,
|
||||
RAW_JSON: 'RAW_JSON' as const,
|
||||
RELATION: 'RELATION' as const,
|
||||
RICH_TEXT_V2: 'RICH_TEXT_V2' as const,
|
||||
RICH_TEXT: 'RICH_TEXT' as const,
|
||||
SELECT: 'SELECT' as const,
|
||||
TEXT: 'TEXT' as const,
|
||||
TS_VECTOR: 'TS_VECTOR' as const,
|
||||
@@ -8570,7 +8570,8 @@ export const enumFeatureFlagKey = {
|
||||
IS_NAVIGATION_MENU_ITEM_ENABLED: 'IS_NAVIGATION_MENU_ITEM_ENABLED' as const,
|
||||
IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED: 'IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED' as const,
|
||||
IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED: 'IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED' as const,
|
||||
IS_DRAFT_EMAIL_ENABLED: 'IS_DRAFT_EMAIL_ENABLED' as const
|
||||
IS_DRAFT_EMAIL_ENABLED: 'IS_DRAFT_EMAIL_ENABLED' as const,
|
||||
IS_RICH_TEXT_V1_MIGRATED: 'IS_RICH_TEXT_V1_MIGRATED' as const
|
||||
}
|
||||
|
||||
export const enumRelationType = {
|
||||
|
||||
@@ -1822,7 +1822,7 @@ export default {
|
||||
1
|
||||
]
|
||||
},
|
||||
"RichTextV2Body": {
|
||||
"RichTextBody": {
|
||||
"blocknote": [
|
||||
1
|
||||
],
|
||||
|
||||
@@ -6,5 +6,5 @@ export type {
|
||||
FullNameMetadata as FullNameField,
|
||||
LinksMetadata as LinksField,
|
||||
PhonesMetadata as PhonesField,
|
||||
RichTextV2Metadata as RichTextField,
|
||||
RichTextMetadata as RichTextField,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
+58
-12
@@ -1,10 +1,12 @@
|
||||
import { InjectDataSource, InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Command } from 'nest-commander';
|
||||
import { FeatureFlagKey } 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 { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
|
||||
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';
|
||||
@@ -18,7 +20,7 @@ import { type WorkspaceCacheKeyName } from 'src/engine/workspace-cache/types/wor
|
||||
@Command({
|
||||
name: 'upgrade:1-20:migrate-rich-text-to-text',
|
||||
description:
|
||||
'Migrate deprecated RICH_TEXT field metadata type to TEXT. The underlying column type is already text, so only the metadata needs updating.',
|
||||
'Migrate deprecated RICH_TEXT (V1) to TEXT and rename RICH_TEXT_V2 to RICH_TEXT. The underlying column type is already text, so only the metadata needs updating.',
|
||||
})
|
||||
export class MigrateRichTextToTextCommand extends ActiveOrSuspendedWorkspacesMigrationCommandRunner {
|
||||
constructor(
|
||||
@@ -28,6 +30,7 @@ export class MigrateRichTextToTextCommand extends ActiveOrSuspendedWorkspacesMig
|
||||
private readonly coreDataSource: DataSource,
|
||||
protected readonly twentyORMGlobalManager: GlobalWorkspaceOrmManager,
|
||||
protected readonly dataSourceService: DataSourceService,
|
||||
private readonly featureFlagService: FeatureFlagService,
|
||||
private readonly workspaceCacheService: WorkspaceCacheService,
|
||||
private readonly workspaceCacheStorageService: WorkspaceCacheStorageService,
|
||||
private readonly workspaceMetadataVersionService: WorkspaceMetadataVersionService,
|
||||
@@ -39,26 +42,38 @@ export class MigrateRichTextToTextCommand extends ActiveOrSuspendedWorkspacesMig
|
||||
workspaceId,
|
||||
options,
|
||||
}: RunOnWorkspaceArgs): Promise<void> {
|
||||
const dryRun = options?.dryRun ?? false;
|
||||
|
||||
this.logger.log(
|
||||
`${dryRun ? '[DRY RUN] ' : ''}Migrating RICH_TEXT fields to TEXT in workspace ${workspaceId}`,
|
||||
const isMigrated = await this.featureFlagService.isFeatureEnabled(
|
||||
FeatureFlagKey.IS_RICH_TEXT_V1_MIGRATED,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (dryRun) {
|
||||
if (isMigrated) {
|
||||
this.logger.log(
|
||||
`[DRY RUN] Would update RICH_TEXT -> TEXT in core.fieldMetadata for workspace ${workspaceId}. Skipping.`,
|
||||
`Rich text migration already completed for workspace ${workspaceId}. Skipping.`,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const dryRun = options?.dryRun ?? false;
|
||||
|
||||
if (dryRun) {
|
||||
this.logger.log(
|
||||
`[DRY RUN] Would update RICH_TEXT -> TEXT and RICH_TEXT_V2 -> RICH_TEXT in core.fieldMetadata for workspace ${workspaceId}. Skipping.`,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(`Migrating RICH_TEXT fields in workspace ${workspaceId}`);
|
||||
|
||||
const queryRunner = this.coreDataSource.createQueryRunner();
|
||||
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
try {
|
||||
const result = await queryRunner.query(
|
||||
const v1Result = await queryRunner.query(
|
||||
`UPDATE core."fieldMetadata"
|
||||
SET "type" = 'TEXT'
|
||||
WHERE "workspaceId" = $1
|
||||
@@ -67,18 +82,48 @@ export class MigrateRichTextToTextCommand extends ActiveOrSuspendedWorkspacesMig
|
||||
[workspaceId],
|
||||
);
|
||||
|
||||
const updatedCount = result.length;
|
||||
const v1Count = v1Result.length;
|
||||
|
||||
if (updatedCount > 0) {
|
||||
const renameResult = await queryRunner.query(
|
||||
`UPDATE core."fieldMetadata"
|
||||
SET "type" = 'RICH_TEXT'
|
||||
WHERE "workspaceId" = $1
|
||||
AND "type" = 'RICH_TEXT_V2'
|
||||
RETURNING "id"`,
|
||||
[workspaceId],
|
||||
);
|
||||
|
||||
const renameCount = renameResult.length;
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
|
||||
if (v1Count > 0) {
|
||||
this.logger.log(
|
||||
`Migrated ${updatedCount} RICH_TEXT field(s) to TEXT in workspace ${workspaceId}`,
|
||||
`Migrated ${v1Count} RICH_TEXT (V1) field(s) to TEXT in workspace ${workspaceId}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (renameCount > 0) {
|
||||
this.logger.log(
|
||||
`Renamed ${renameCount} RICH_TEXT_V2 field(s) to RICH_TEXT in workspace ${workspaceId}`,
|
||||
);
|
||||
}
|
||||
|
||||
await this.featureFlagService.enableFeatureFlags(
|
||||
[FeatureFlagKey.IS_RICH_TEXT_V1_MIGRATED],
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (v1Count > 0 || renameCount > 0) {
|
||||
await this.invalidateCaches(workspaceId);
|
||||
} else {
|
||||
this.logger.log(
|
||||
`No RICH_TEXT fields found in workspace ${workspaceId}`,
|
||||
`No RICH_TEXT or RICH_TEXT_V2 fields found in workspace ${workspaceId}`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
await queryRunner.rollbackTransaction();
|
||||
throw error;
|
||||
} finally {
|
||||
await queryRunner.release();
|
||||
}
|
||||
@@ -94,6 +139,7 @@ export class MigrateRichTextToTextCommand extends ActiveOrSuspendedWorkspacesMig
|
||||
.map(getMetadataFlatEntityMapsKey),
|
||||
),
|
||||
'ORMEntityMetadatas',
|
||||
'featureFlagsMap',
|
||||
];
|
||||
|
||||
await this.workspaceCacheService.invalidateAndRecompute(
|
||||
|
||||
+3
-3
@@ -172,11 +172,11 @@ exports[`DataArgProcessorService failing inputs validation RELATION should throw
|
||||
|
||||
exports[`DataArgProcessorService failing inputs validation RELATION should throw for invalid input #5: "non-uuid" 1`] = `"Invalid UUID value 'non-uuid' for field "manyToOneRelationFieldId""`;
|
||||
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT_V2 should throw for invalid input #1: "not-a-rich-text" 1`] = `"Invalid rich text v2 value 'not-a-rich-text' for field "richTextV2Field" - Should be an object"`;
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT should throw for invalid input #1: "not-a-rich-text" 1`] = `"Invalid rich text v2 value 'not-a-rich-text' for field "richTextField" - Should be an object"`;
|
||||
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT_V2 should throw for invalid input #2: 1 1`] = `"Invalid rich text v2 value 1 for field "richTextV2Field" - Should be an object"`;
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT should throw for invalid input #2: 1 1`] = `"Invalid rich text v2 value 1 for field "richTextField" - Should be an object"`;
|
||||
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT_V2 should throw for invalid input #3: true 1`] = `"Invalid rich text v2 value true for field "richTextV2Field" - Should be an object"`;
|
||||
exports[`DataArgProcessorService failing inputs validation RICH_TEXT should throw for invalid input #3: true 1`] = `"Invalid rich text v2 value true for field "richTextField" - Should be an object"`;
|
||||
|
||||
exports[`DataArgProcessorService failing inputs validation SELECT should throw for invalid input #1: "not-a-select-option" 1`] = `"Invalid value 'not-a-select-option' for field "selectField""`;
|
||||
|
||||
|
||||
+4
-4
@@ -150,10 +150,10 @@ export const failingInputsByFieldMetadataType: {
|
||||
{ input: { linksField: 1 } },
|
||||
{ input: { linksField: true } },
|
||||
],
|
||||
[FieldMetadataType.RICH_TEXT_V2]: [
|
||||
{ input: { richTextV2Field: 'not-a-rich-text' } },
|
||||
{ input: { richTextV2Field: 1 } },
|
||||
{ input: { richTextV2Field: true } },
|
||||
[FieldMetadataType.RICH_TEXT]: [
|
||||
{ input: { richTextField: 'not-a-rich-text' } },
|
||||
{ input: { richTextField: 1 } },
|
||||
{ input: { richTextField: true } },
|
||||
],
|
||||
[FieldMetadataType.POSITION]: [
|
||||
{ input: { position: 'not-a-position' } },
|
||||
|
||||
+3
-3
@@ -134,9 +134,9 @@ export const fieldMetadataConfigByFieldName: Record<
|
||||
type: FieldMetadataType.LINKS,
|
||||
isNullable: true,
|
||||
},
|
||||
richTextV2Field: {
|
||||
name: 'richTextV2Field',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
richTextField: {
|
||||
name: 'richTextField',
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
isNullable: true,
|
||||
},
|
||||
position: {
|
||||
|
||||
+5
-5
@@ -383,16 +383,16 @@ export const successfulInputsByFieldMetadataType: {
|
||||
},
|
||||
{ input: { linksField: null }, expectedOutput: { linksField: null } },
|
||||
],
|
||||
[FieldMetadataType.RICH_TEXT_V2]: [
|
||||
[FieldMetadataType.RICH_TEXT]: [
|
||||
{
|
||||
input: { richTextV2Field: { blocknote: 'test', markdown: 'test' } },
|
||||
input: { richTextField: { blocknote: 'test', markdown: 'test' } },
|
||||
expectedOutput: {
|
||||
richTextV2Field: { blocknote: 'test', markdown: 'test' },
|
||||
richTextField: { blocknote: 'test', markdown: 'test' },
|
||||
},
|
||||
},
|
||||
{
|
||||
input: { richTextV2Field: null },
|
||||
expectedOutput: { richTextV2Field: null },
|
||||
input: { richTextField: null },
|
||||
expectedOutput: { richTextField: null },
|
||||
},
|
||||
],
|
||||
[FieldMetadataType.POSITION]: [
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@ import { successfulInputsByFieldMetadataType } from './constants/successful-inpu
|
||||
|
||||
// Mock the rich text v2 transformation to avoid BlockNote module issues
|
||||
jest.mock(
|
||||
'src/engine/core-modules/record-transformer/utils/transform-rich-text-v2.util',
|
||||
'src/engine/core-modules/record-transformer/utils/transform-rich-text.util',
|
||||
() => ({
|
||||
transformRichTextV2Value: jest.fn().mockImplementation((value) => value),
|
||||
transformRichTextValue: jest.fn().mockImplementation((value) => value),
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
+2
-3
@@ -44,7 +44,7 @@ const DEFAULT_ACTOR_FIELD_NULL_EQUIVALENT_VALUE = {
|
||||
name: DEFAULT_TEXT_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
};
|
||||
|
||||
const DEFAULT_RICH_TEXT_V2_FIELD_NULL_EQUIVALENT_VALUE = {
|
||||
const DEFAULT_RICH_TEXT_FIELD_NULL_EQUIVALENT_VALUE = {
|
||||
markdown: DEFAULT_TEXT_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
};
|
||||
|
||||
@@ -57,6 +57,5 @@ export const DEFAULT_COMPOSITE_FIELDS_NULL_EQUIVALENT_VALUE: Partial<
|
||||
[FieldMetadataType.PHONES]: DEFAULT_PHONES_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
[FieldMetadataType.FULL_NAME]: DEFAULT_FULL_NAME_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
[FieldMetadataType.ACTOR]: DEFAULT_ACTOR_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
[FieldMetadataType.RICH_TEXT_V2]:
|
||||
DEFAULT_RICH_TEXT_V2_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
[FieldMetadataType.RICH_TEXT]: DEFAULT_RICH_TEXT_FIELD_NULL_EQUIVALENT_VALUE,
|
||||
};
|
||||
|
||||
+5
-5
@@ -41,7 +41,7 @@ import { validateOverriddenPositionFieldOrThrow } from 'src/engine/api/common/co
|
||||
import { validatePhonesFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-phones-field-or-throw.util';
|
||||
import { validateRatingAndSelectFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-rating-and-select-field-or-throw.util';
|
||||
import { validateRawJsonFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-raw-json-field-or-throw.util';
|
||||
import { validateRichTextV2FieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-rich-text-v2-field-or-throw.util';
|
||||
import { validateRichTextFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-rich-text-field-or-throw.util';
|
||||
import { validateTextFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-text-field-or-throw.util';
|
||||
import { validateUUIDFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-uuid-field-or-throw.util';
|
||||
import {
|
||||
@@ -54,7 +54,7 @@ import { RecordPositionService } from 'src/engine/core-modules/record-position/s
|
||||
import { transformEmailsValue } from 'src/engine/core-modules/record-transformer/utils/transform-emails-value.util';
|
||||
import { transformLinksValue } from 'src/engine/core-modules/record-transformer/utils/transform-links-value.util';
|
||||
import { transformPhonesValue } from 'src/engine/core-modules/record-transformer/utils/transform-phones-value.util';
|
||||
import { transformRichTextV2Value } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text-v2.util';
|
||||
import { transformRichTextValue } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text.util';
|
||||
import { WorkspaceNotFoundDefaultError } from 'src/engine/core-modules/workspace/workspace.exception';
|
||||
import { FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
|
||||
@@ -302,10 +302,10 @@ export class DataArgProcessorService {
|
||||
|
||||
return transformActorField(validatedValue);
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
const validatedValue = validateRichTextV2FieldOrThrow(value, key);
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
const validatedValue = validateRichTextFieldOrThrow(value, key);
|
||||
|
||||
return await transformRichTextV2Value(validatedValue);
|
||||
return await transformRichTextValue(validatedValue);
|
||||
}
|
||||
case FieldMetadataType.LINKS: {
|
||||
const validatedValue = validateLinksFieldOrThrow(value, key);
|
||||
|
||||
+3
-3
@@ -171,12 +171,12 @@ describe('findPostgresDefaultNullEquivalentValue', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('RICH_TEXT_V2', () => {
|
||||
describe('RICH_TEXT', () => {
|
||||
it('should return json default for blocknote', () => {
|
||||
expect(
|
||||
findPostgresDefaultNullEquivalentValue(
|
||||
{},
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
'blocknote',
|
||||
),
|
||||
).toBe(undefined);
|
||||
@@ -186,7 +186,7 @@ describe('findPostgresDefaultNullEquivalentValue', () => {
|
||||
expect(
|
||||
findPostgresDefaultNullEquivalentValue(
|
||||
'',
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
'markdown',
|
||||
),
|
||||
).toBe(POSTGRES_DEFAULT_TEXT_FIELD_NULL_EQUIVALENT_VALUE);
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ export const findPostgresDefaultNullEquivalentValue = (
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
switch (key) {
|
||||
case 'markdown':
|
||||
return isNullEquivalentTextFieldValue(value) || value === 'NULL'
|
||||
|
||||
+9
-9
@@ -1,16 +1,16 @@
|
||||
import { validateRichTextV2FieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-rich-text-v2-field-or-throw.util';
|
||||
import { validateRichTextFieldOrThrow } from 'src/engine/api/common/common-args-processors/data-arg-processor/validator-utils/validate-rich-text-field-or-throw.util';
|
||||
import { CommonQueryRunnerException } from 'src/engine/api/common/common-query-runners/errors/common-query-runner.exception';
|
||||
|
||||
describe('validateRichTextV2FieldOrThrow', () => {
|
||||
describe('validateRichTextFieldOrThrow', () => {
|
||||
describe('valid inputs', () => {
|
||||
it('should return null when value is null', () => {
|
||||
const result = validateRichTextV2FieldOrThrow(null, 'testField');
|
||||
const result = validateRichTextFieldOrThrow(null, 'testField');
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null when value is an empty object', () => {
|
||||
const result = validateRichTextV2FieldOrThrow({}, 'testField');
|
||||
const result = validateRichTextFieldOrThrow({}, 'testField');
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
@@ -20,7 +20,7 @@ describe('validateRichTextV2FieldOrThrow', () => {
|
||||
blocknote: 'some blocknote content',
|
||||
markdown: '# Heading\nContent',
|
||||
};
|
||||
const result = validateRichTextV2FieldOrThrow(value, 'testField');
|
||||
const result = validateRichTextFieldOrThrow(value, 'testField');
|
||||
|
||||
expect(result).toEqual(value);
|
||||
});
|
||||
@@ -29,23 +29,23 @@ describe('validateRichTextV2FieldOrThrow', () => {
|
||||
describe('invalid inputs', () => {
|
||||
it('should throw when value is undefined', () => {
|
||||
expect(() =>
|
||||
validateRichTextV2FieldOrThrow(undefined, 'testField'),
|
||||
validateRichTextFieldOrThrow(undefined, 'testField'),
|
||||
).toThrow(CommonQueryRunnerException);
|
||||
});
|
||||
|
||||
it('should throw when value is a string', () => {
|
||||
expect(() =>
|
||||
validateRichTextV2FieldOrThrow('not an object', 'testField'),
|
||||
validateRichTextFieldOrThrow('not an object', 'testField'),
|
||||
).toThrow(CommonQueryRunnerException);
|
||||
});
|
||||
|
||||
it('should throw when value has invalid subfields', () => {
|
||||
const value = { invalidField: 'value' };
|
||||
|
||||
expect(() => validateRichTextV2FieldOrThrow(value, 'testField')).toThrow(
|
||||
expect(() => validateRichTextFieldOrThrow(value, 'testField')).toThrow(
|
||||
CommonQueryRunnerException,
|
||||
);
|
||||
expect(() => validateRichTextV2FieldOrThrow(value, 'testField')).toThrow(
|
||||
expect(() => validateRichTextFieldOrThrow(value, 'testField')).toThrow(
|
||||
/Should have only blocknote, markdown subfields/,
|
||||
);
|
||||
});
|
||||
+5
-5
@@ -12,7 +12,7 @@ import {
|
||||
CommonQueryRunnerExceptionCode,
|
||||
} from 'src/engine/api/common/common-query-runners/errors/common-query-runner.exception';
|
||||
|
||||
export const validateRichTextV2FieldOrThrow = (
|
||||
export const validateRichTextFieldOrThrow = (
|
||||
value: unknown,
|
||||
fieldName: string,
|
||||
): {
|
||||
@@ -29,16 +29,16 @@ export const validateRichTextV2FieldOrThrow = (
|
||||
if (Object.keys(parsedValue).length === 0) return null;
|
||||
|
||||
const subfields = Object.keys(parsedValue);
|
||||
const richTextV2Subfields = compositeTypeDefinitions
|
||||
.get(FieldMetadataType.RICH_TEXT_V2)
|
||||
const richTextSubfields = compositeTypeDefinitions
|
||||
.get(FieldMetadataType.RICH_TEXT)
|
||||
?.properties.filter(
|
||||
(prop) => prop.hidden !== true && prop.hidden !== 'input',
|
||||
)
|
||||
.map((prop) => prop.name);
|
||||
|
||||
if (!subfields.every((subfield) => richTextV2Subfields?.includes(subfield)))
|
||||
if (!subfields.every((subfield) => richTextSubfields?.includes(subfield)))
|
||||
throw new Error(
|
||||
`Should have only ${richTextV2Subfields?.join(', ')} subfields`,
|
||||
`Should have only ${richTextSubfields?.join(', ')} subfields`,
|
||||
);
|
||||
|
||||
return value as {
|
||||
+2
-2
@@ -140,9 +140,9 @@ exports[`FilterArgProcessorService failing filter inputs validation RELATION sho
|
||||
|
||||
exports[`FilterArgProcessorService failing filter inputs validation RELATION should throw for invalid filter #3: {"manyToOneRelationFieldId":{}} 1`] = `"Filter for field "manyToOneRelationFieldId" must have exactly one operator"`;
|
||||
|
||||
exports[`FilterArgProcessorService failing filter inputs validation RICH_TEXT_V2 should throw for invalid filter #1: {"richTextV2Field":{"invalidOperator":"test"}} 1`] = `"Sub field "invalidOperator" not found for composite type: RICH_TEXT_V2"`;
|
||||
exports[`FilterArgProcessorService failing filter inputs validation RICH_TEXT should throw for invalid filter #1: {"richTextField":{"invalidOperator":"test"}} 1`] = `"Sub field "invalidOperator" not found for composite type: RICH_TEXT"`;
|
||||
|
||||
exports[`FilterArgProcessorService failing filter inputs validation RICH_TEXT_V2 should throw for invalid filter #2: {"richTextV2Field":{"markdown":{"invalidOperator":"test"}}} 1`] = `"Operator "invalidOperator" is not valid for field "richTextV2Field.markdown" of type TEXT - Allowed operators: eq, neq, gt, gte, lt, lte, in, is, like, ilike, startsWith, endsWith"`;
|
||||
exports[`FilterArgProcessorService failing filter inputs validation RICH_TEXT should throw for invalid filter #2: {"richTextField":{"markdown":{"invalidOperator":"test"}}} 1`] = `"Operator "invalidOperator" is not valid for field "richTextField.markdown" of type TEXT - Allowed operators: eq, neq, gt, gte, lt, lte, in, is, like, ilike, startsWith, endsWith"`;
|
||||
|
||||
exports[`FilterArgProcessorService failing filter inputs validation SELECT should throw for invalid filter #1: {"selectField":{"invalidOperator":"OPTION_1"}} 1`] = `"Operator "invalidOperator" is not valid for field "selectField" of type SELECT - Allowed operators: eq, neq, in, containsAny, is, isEmptyArray"`;
|
||||
|
||||
|
||||
+3
-3
@@ -116,9 +116,9 @@ export const failingFilterInputsByFieldMetadataType: {
|
||||
{ filter: { filesField: { invalidOperator: 'test' } } },
|
||||
{ filter: { filesField: {} } },
|
||||
],
|
||||
[FieldMetadataType.RICH_TEXT_V2]: [
|
||||
{ filter: { richTextV2Field: { invalidOperator: 'test' } } },
|
||||
{ filter: { richTextV2Field: { markdown: { invalidOperator: 'test' } } } },
|
||||
[FieldMetadataType.RICH_TEXT]: [
|
||||
{ filter: { richTextField: { invalidOperator: 'test' } } },
|
||||
{ filter: { richTextField: { markdown: { invalidOperator: 'test' } } } },
|
||||
],
|
||||
[FieldMetadataType.ADDRESS]: [
|
||||
{ filter: { addressField: { invalidSubField: { eq: 'test' } } } },
|
||||
|
||||
+2
-2
@@ -190,8 +190,8 @@ export const successfulFilterInputsByFieldMetadataType: {
|
||||
{ filter: { filesField: { is: 'NOT_NULL' } } },
|
||||
{ filter: { filesField: { like: '%test%' } } },
|
||||
],
|
||||
[FieldMetadataType.RICH_TEXT_V2]: [
|
||||
{ filter: { richTextV2Field: { markdown: { ilike: '%test%' } } } },
|
||||
[FieldMetadataType.RICH_TEXT]: [
|
||||
{ filter: { richTextField: { markdown: { ilike: '%test%' } } } },
|
||||
],
|
||||
[FieldMetadataType.ADDRESS]: [
|
||||
{ filter: { addressField: { addressCity: { eq: 'Paris' } } } },
|
||||
|
||||
+1
-1
@@ -73,4 +73,4 @@ export const ENUM_FILTER_OPERATORS: FilterOperator[] = [
|
||||
|
||||
export const RAW_JSON_FILTER_OPERATORS: FilterOperator[] = ['is', 'like'];
|
||||
|
||||
export const RICH_TEXT_V2_FILTER_OPERATORS: FilterOperator[] = ['ilike'];
|
||||
export const RICH_TEXT_FILTER_OPERATORS: FilterOperator[] = ['ilike'];
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import {
|
||||
MULTI_SELECT_FILTER_OPERATORS,
|
||||
NUMBER_FILTER_OPERATORS,
|
||||
RAW_JSON_FILTER_OPERATORS,
|
||||
RICH_TEXT_V2_FILTER_OPERATORS,
|
||||
RICH_TEXT_FILTER_OPERATORS,
|
||||
STRING_FILTER_OPERATORS,
|
||||
UUID_FILTER_OPERATORS,
|
||||
} from 'src/engine/api/common/common-args-processors/filter-arg-processor/constants/filter-operators.constant';
|
||||
@@ -53,8 +53,8 @@ export const getOperatorsForFieldType = (
|
||||
case FieldMetadataType.FILES:
|
||||
return RAW_JSON_FILTER_OPERATORS;
|
||||
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
return RICH_TEXT_V2_FILTER_OPERATORS;
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return RICH_TEXT_FILTER_OPERATORS;
|
||||
|
||||
case FieldMetadataType.TS_VECTOR:
|
||||
case FieldMetadataType.ACTOR:
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ import { type QueryResultFieldValue } from 'src/engine/api/graphql/workspace-que
|
||||
import { type QueryResultGetterHandlerInterface } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface';
|
||||
|
||||
import { FilesFieldQueryResultGetterHandler } from 'src/engine/api/common/common-result-getters/handlers/field-handlers/files-field-query-result-getter.handler';
|
||||
import { RichTextV2FieldQueryResultGetterHandler } from 'src/engine/api/common/common-result-getters/handlers/field-handlers/rich-text-v2-field-query-result-getter.handler';
|
||||
import { RichTextFieldQueryResultGetterHandler } from 'src/engine/api/common/common-result-getters/handlers/field-handlers/rich-text-field-query-result-getter.handler';
|
||||
import { AttachmentQueryResultGetterHandler } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/handlers/attachment-query-result-getter.handler';
|
||||
import { PersonQueryResultGetterHandler } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/handlers/person-query-result-getter.handler';
|
||||
import { WorkspaceMemberQueryResultGetterHandler } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/handlers/workspace-member-query-result-getter.handler';
|
||||
@@ -68,8 +68,8 @@ export class CommonResultGettersService {
|
||||
new FilesFieldQueryResultGetterHandler(this.fileUrlService),
|
||||
],
|
||||
[
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
new RichTextV2FieldQueryResultGetterHandler(this.fileUrlService),
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
new RichTextFieldQueryResultGetterHandler(this.fileUrlService),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
import { FieldMetadataType, type ObjectRecord } from 'twenty-shared/types';
|
||||
|
||||
import { RichTextV2FieldQueryResultGetterHandler } from 'src/engine/api/common/common-result-getters/handlers/field-handlers/rich-text-v2-field-query-result-getter.handler';
|
||||
import { RichTextFieldQueryResultGetterHandler } from 'src/engine/api/common/common-result-getters/handlers/field-handlers/rich-text-field-query-result-getter.handler';
|
||||
import { type FileUrlService } from 'src/engine/core-modules/file/file-url/file-url.service';
|
||||
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
|
||||
@@ -13,7 +13,7 @@ const baseRecord: ObjectRecord = {
|
||||
|
||||
const richTextFieldMetadata = [
|
||||
{
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
name: 'bodyV2',
|
||||
},
|
||||
] as FlatFieldMetadata[];
|
||||
@@ -23,12 +23,12 @@ const mockFileUrlService = {
|
||||
signFileByIdUrl: jest.fn().mockReturnValue('signed-path'),
|
||||
} as unknown as FileUrlService;
|
||||
|
||||
describe('RichTextV2FieldQueryResultGetterHandler', () => {
|
||||
let handler: RichTextV2FieldQueryResultGetterHandler;
|
||||
describe('RichTextFieldQueryResultGetterHandler', () => {
|
||||
let handler: RichTextFieldQueryResultGetterHandler;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.SERVER_URL = 'https://my-domain.twenty.com';
|
||||
handler = new RichTextV2FieldQueryResultGetterHandler(mockFileUrlService);
|
||||
handler = new RichTextFieldQueryResultGetterHandler(mockFileUrlService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -37,7 +37,7 @@ describe('RichTextV2FieldQueryResultGetterHandler', () => {
|
||||
});
|
||||
|
||||
describe('should return record unchanged', () => {
|
||||
it('when no RICH_TEXT_V2 field metadata is present', async () => {
|
||||
it('when no RICH_TEXT field metadata is present', async () => {
|
||||
const record = {
|
||||
...baseRecord,
|
||||
bodyV2: { blocknote: '[]', markdown: null },
|
||||
@@ -156,11 +156,11 @@ describe('RichTextV2FieldQueryResultGetterHandler', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('should handle multiple RICH_TEXT_V2 fields', () => {
|
||||
describe('should handle multiple RICH_TEXT fields', () => {
|
||||
it('when record has multiple rich text fields', async () => {
|
||||
const multiFieldMetadata = [
|
||||
{ type: FieldMetadataType.RICH_TEXT_V2, name: 'bodyV2' },
|
||||
{ type: FieldMetadataType.RICH_TEXT_V2, name: 'description' },
|
||||
{ type: FieldMetadataType.RICH_TEXT, name: 'bodyV2' },
|
||||
{ type: FieldMetadataType.RICH_TEXT, name: 'description' },
|
||||
] as FlatFieldMetadata[];
|
||||
|
||||
const record = {
|
||||
+5
-5
@@ -30,7 +30,7 @@ const parseBlocknoteJsonSafely = (
|
||||
}
|
||||
};
|
||||
|
||||
export class RichTextV2FieldQueryResultGetterHandler
|
||||
export class RichTextFieldQueryResultGetterHandler
|
||||
implements QueryResultGetterHandlerInterface
|
||||
{
|
||||
constructor(private readonly fileUrlService: FileUrlService) {}
|
||||
@@ -40,15 +40,15 @@ export class RichTextV2FieldQueryResultGetterHandler
|
||||
workspaceId: string,
|
||||
flatFieldMetadata: FlatFieldMetadata[],
|
||||
): Promise<ObjectRecord> {
|
||||
const richTextV2Fields = flatFieldMetadata.filter(
|
||||
(field) => field.type === FieldMetadataType.RICH_TEXT_V2,
|
||||
const richTextFields = flatFieldMetadata.filter(
|
||||
(field) => field.type === FieldMetadataType.RICH_TEXT,
|
||||
);
|
||||
|
||||
if (richTextV2Fields.length === 0) {
|
||||
if (richTextFields.length === 0) {
|
||||
return record;
|
||||
}
|
||||
|
||||
for (const field of richTextV2Fields) {
|
||||
for (const field of richTextFields) {
|
||||
const fieldValue = record[field.name];
|
||||
const blocknoteJson = fieldValue?.blocknote;
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { GraphQLInputObjectType, GraphQLString } from 'graphql';
|
||||
|
||||
const richTextV2LeafFilter = new GraphQLInputObjectType({
|
||||
name: 'RichTextV2LeafFilter',
|
||||
const richTextLeafFilter = new GraphQLInputObjectType({
|
||||
name: 'RichTextLeafFilter',
|
||||
fields: {
|
||||
ilike: {
|
||||
type: GraphQLString,
|
||||
@@ -10,10 +10,10 @@ const richTextV2LeafFilter = new GraphQLInputObjectType({
|
||||
},
|
||||
});
|
||||
|
||||
export const RichTextV2FilterType = new GraphQLInputObjectType({
|
||||
name: 'RichTextV2Filter',
|
||||
export const RichTextFilterType = new GraphQLInputObjectType({
|
||||
name: 'RichTextFilter',
|
||||
fields: {
|
||||
blocknote: { type: richTextV2LeafFilter },
|
||||
markdown: { type: richTextV2LeafFilter },
|
||||
blocknote: { type: richTextLeafFilter },
|
||||
markdown: { type: richTextLeafFilter },
|
||||
},
|
||||
});
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import {
|
||||
} from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input';
|
||||
import { FilesInputType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/files.input-type';
|
||||
import { MultiSelectFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/multi-select-filter.input-type';
|
||||
import { RichTextV2FilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type';
|
||||
import { RichTextFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/rich-text.input-type';
|
||||
import { SelectFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/select-filter.input-type';
|
||||
import { TSVectorFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/ts-vector-filter.input-type';
|
||||
import { UUIDFilterType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/uuid-filter.input-type';
|
||||
@@ -178,7 +178,7 @@ export class TypeMapperService {
|
||||
[FieldMetadataType.POSITION, FloatFilterType],
|
||||
[FieldMetadataType.FILES, RawJsonFilterType],
|
||||
[FieldMetadataType.RAW_JSON, RawJsonFilterType],
|
||||
[FieldMetadataType.RICH_TEXT_V2, RichTextV2FilterType],
|
||||
[FieldMetadataType.RICH_TEXT, RichTextFilterType],
|
||||
[FieldMetadataType.ARRAY, ArrayFilterType],
|
||||
[FieldMetadataType.MULTI_SELECT, MultiSelectFilterType],
|
||||
[FieldMetadataType.SELECT, SelectFilterType],
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ export const generateRandomFieldValue = ({
|
||||
return {};
|
||||
}
|
||||
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export const generateFieldFilterZodSchema = (
|
||||
.describe(`Filter by ${field.name} (UUID field)`);
|
||||
|
||||
case FieldMetadataType.TEXT:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return z
|
||||
.object({
|
||||
eq: z.string().optional().describe('Equals'),
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ export const generateRecordPropertiesZodSchema = (
|
||||
});
|
||||
break;
|
||||
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
fieldSchema = z.object({
|
||||
markdown: z.string().optional(),
|
||||
blocknote: z.string().optional(),
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import { transformEmailsValue } from 'src/engine/core-modules/record-transformer/utils/transform-emails-value.util';
|
||||
import { transformLinksValue } from 'src/engine/core-modules/record-transformer/utils/transform-links-value.util';
|
||||
import { transformPhonesValue } from 'src/engine/core-modules/record-transformer/utils/transform-phones-value.util';
|
||||
import { transformRichTextV2Value } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text-v2.util';
|
||||
import { transformRichTextValue } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text.util';
|
||||
import { FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
|
||||
import { FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
@@ -78,8 +78,8 @@ export class RecordInputTransformerService {
|
||||
return value || null;
|
||||
case FieldMetadataType.NUMBER:
|
||||
return value === null ? null : Number(value);
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
return await transformRichTextV2Value(value);
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return await transformRichTextValue(value);
|
||||
case FieldMetadataType.LINKS:
|
||||
return transformLinksValue(value);
|
||||
case FieldMetadataType.EMAILS:
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import {
|
||||
type RichTextV2Metadata,
|
||||
richTextV2ValueSchema,
|
||||
type RichTextMetadata,
|
||||
richTextValueSchema,
|
||||
} from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
@@ -29,12 +29,12 @@ const getServerBlockNoteEditor = async (): Promise<ServerBlockNoteEditor> => {
|
||||
return editor;
|
||||
};
|
||||
|
||||
export const transformRichTextV2Value = async (
|
||||
export const transformRichTextValue = async (
|
||||
// oxlint-disable-next-line @typescripttypescript/no-explicit-any
|
||||
richTextValue: any,
|
||||
): Promise<RichTextV2Metadata> => {
|
||||
): Promise<RichTextMetadata> => {
|
||||
const parsedValue = isNonEmptyString(richTextValue)
|
||||
? richTextV2ValueSchema.parse(richTextValue)
|
||||
? richTextValueSchema.parse(richTextValue)
|
||||
: richTextValue;
|
||||
|
||||
const serverBlockNoteEditor = await getServerBlockNoteEditor();
|
||||
+1
-1
@@ -7,7 +7,7 @@ const compositeFieldTypes = [
|
||||
FieldMetadataType.LINKS,
|
||||
FieldMetadataType.EMAILS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.ACTOR,
|
||||
] as const;
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ describe('computeCompositeColumnName', () => {
|
||||
it('should compute composite column name for rich text v2 field', () => {
|
||||
const fieldMetadata = {
|
||||
name: 'bodyV2',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
};
|
||||
|
||||
const property = {
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ export const isCompositeFieldMetadataType = (
|
||||
| FieldMetadataType.ACTOR
|
||||
| FieldMetadataType.EMAILS
|
||||
| FieldMetadataType.PHONES
|
||||
| FieldMetadataType.RICH_TEXT_V2 => {
|
||||
| FieldMetadataType.RICH_TEXT => {
|
||||
return [
|
||||
FieldMetadataType.CURRENCY,
|
||||
FieldMetadataType.FULL_NAME,
|
||||
@@ -18,6 +18,6 @@ export const isCompositeFieldMetadataType = (
|
||||
FieldMetadataType.ACTOR,
|
||||
FieldMetadataType.EMAILS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
].includes(type);
|
||||
};
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ export const NOTE_FLAT_FIELDS_MOCK = {
|
||||
bodyV2: getFlatFieldMetadataMock({
|
||||
id: 'acb2973c-7e46-4296-ac79-8b8d163b6d85',
|
||||
objectMetadataId: '1253e3e5-5b00-4a34-93b8-02f3dc6e2b7c',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
name: 'bodyV2',
|
||||
label: 'Body',
|
||||
defaultValue: null,
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ export const TASK_FLAT_FIELDS_MOCK = {
|
||||
bodyV2: getFlatFieldMetadataMock({
|
||||
id: '161570ed-7fcd-4172-a5d1-c773cd9afe76',
|
||||
objectMetadataId: '3186920d-2a15-4b5f-96c7-2bf6567024b0',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
name: 'bodyV2',
|
||||
label: 'Body',
|
||||
defaultValue: null,
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ export class FlatFieldMetadataTypeValidatorService {
|
||||
PHONES: DEFAULT_NO_VALIDATION,
|
||||
POSITION: validatePositionFlatFieldMetadata,
|
||||
RAW_JSON: DEFAULT_NO_VALIDATION,
|
||||
RICH_TEXT_V2: DEFAULT_NO_VALIDATION,
|
||||
RICH_TEXT: DEFAULT_NO_VALIDATION,
|
||||
TEXT: DEFAULT_NO_VALIDATION,
|
||||
TS_VECTOR: validateTsVectorFlatFieldMetadata,
|
||||
UUID: DEFAULT_NO_VALIDATION,
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ const _assertion: Record<string, AbstractFlatFieldMetadata> = {
|
||||
// JSON/Array types
|
||||
rawJson: {} as FlatFieldMetadata<FieldMetadataType.RAW_JSON>,
|
||||
array: {} as FlatFieldMetadata<FieldMetadataType.ARRAY>,
|
||||
richTextV2: {} as FlatFieldMetadata<FieldMetadataType.RICH_TEXT_V2>,
|
||||
richText: {} as FlatFieldMetadata<FieldMetadataType.RICH_TEXT>,
|
||||
|
||||
// Relation types
|
||||
relation: {} as FlatFieldMetadata<FieldMetadataType.RELATION>,
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ export const fromCreateFieldInputToFlatFieldMetadatasToCreate = async ({
|
||||
case FieldMetadataType.POSITION:
|
||||
case FieldMetadataType.ADDRESS:
|
||||
case FieldMetadataType.RAW_JSON:
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
case FieldMetadataType.ACTOR:
|
||||
case FieldMetadataType.ARRAY: {
|
||||
const indexMetadatas: UniversalFlatIndexMetadata[] = [];
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IsOptional, IsString } from 'class-validator';
|
||||
import { type RichTextV2Metadata } from 'twenty-shared/types';
|
||||
import { type RichTextMetadata } from 'twenty-shared/types';
|
||||
|
||||
@ObjectType('RichTextV2Body')
|
||||
export class RichTextV2BodyDTO implements RichTextV2Metadata {
|
||||
@ObjectType('RichTextBody')
|
||||
export class RichTextBodyDTO implements RichTextMetadata {
|
||||
@Field(() => String, { nullable: true })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
+4
-4
@@ -4,7 +4,7 @@ import { Type } from 'class-transformer';
|
||||
import { IsIn, IsNotEmpty, ValidateNested } from 'class-validator';
|
||||
import { type StandaloneRichTextConfiguration } from 'twenty-shared/types';
|
||||
|
||||
import { RichTextV2BodyDTO } from 'src/engine/metadata-modules/page-layout-widget/dtos/rich-text-v2-body.dto';
|
||||
import { RichTextBodyDTO } from 'src/engine/metadata-modules/page-layout-widget/dtos/rich-text-body.dto';
|
||||
import { WidgetConfigurationType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-configuration-type.type';
|
||||
|
||||
@ObjectType('StandaloneRichTextConfiguration')
|
||||
@@ -16,9 +16,9 @@ export class StandaloneRichTextConfigurationDTO
|
||||
@IsNotEmpty()
|
||||
configurationType: WidgetConfigurationType.STANDALONE_RICH_TEXT;
|
||||
|
||||
@Field(() => RichTextV2BodyDTO)
|
||||
@Field(() => RichTextBodyDTO)
|
||||
@ValidateNested()
|
||||
@Type(() => RichTextV2BodyDTO)
|
||||
@Type(() => RichTextBodyDTO)
|
||||
@IsNotEmpty()
|
||||
body: RichTextV2BodyDTO;
|
||||
body: RichTextBodyDTO;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { ApplicationService } from 'src/engine/core-modules/application/application.service';
|
||||
import { transformRichTextV2Value } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text-v2.util';
|
||||
import { transformRichTextValue } from 'src/engine/core-modules/record-transformer/utils/transform-rich-text.util';
|
||||
import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/metadata-modules/flat-entity/services/workspace-many-or-all-flat-entity-maps-cache.service';
|
||||
import { findFlatEntityByIdInFlatEntityMapsOrThrow } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps-or-throw.util';
|
||||
import { findFlatEntityByIdInFlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-id-in-flat-entity-maps.util';
|
||||
@@ -115,7 +115,7 @@ export class PageLayoutWidgetService {
|
||||
try {
|
||||
return {
|
||||
...configuration,
|
||||
body: await transformRichTextV2Value(configuration.body),
|
||||
body: await transformRichTextValue(configuration.body),
|
||||
};
|
||||
} catch {
|
||||
return configuration;
|
||||
|
||||
+1
@@ -245,6 +245,7 @@ describe('WorkspaceEntityManager', () => {
|
||||
IS_MARKETPLACE_ENABLED: false,
|
||||
IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED: false,
|
||||
IS_DRAFT_EMAIL_ENABLED: false,
|
||||
IS_RICH_TEXT_V1_MIGRATED: false,
|
||||
},
|
||||
userWorkspaceRoleMap: {},
|
||||
eventEmitterService: {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export const getSubfieldsForAggregateOperation = (
|
||||
'primaryPhoneCountryCode',
|
||||
'primaryPhoneCallingCode',
|
||||
];
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return ['blocknote', 'markdown'];
|
||||
default:
|
||||
throw new Error(`Unsupported composite field type: ${fieldType}`);
|
||||
|
||||
+5
-5
@@ -23,7 +23,7 @@ import {
|
||||
type RatingFilter,
|
||||
type RawJsonFilter,
|
||||
type RecordGqlOperationFilter,
|
||||
type RichTextV2Filter,
|
||||
type RichTextFilter,
|
||||
type SelectFilter,
|
||||
type StringFilter,
|
||||
type TSVectorFilter,
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
isMatchingMultiSelectFilter,
|
||||
isMatchingRatingFilter,
|
||||
isMatchingRawJsonFilter,
|
||||
isMatchingRichTextV2Filter,
|
||||
isMatchingRichTextFilter,
|
||||
isMatchingSelectFilter,
|
||||
isMatchingStringFilter,
|
||||
isMatchingTSVectorFilter,
|
||||
@@ -243,9 +243,9 @@ export const isRecordMatchingRLSRowLevelPermissionPredicate = ({
|
||||
value: recordFieldValue,
|
||||
});
|
||||
}
|
||||
case FieldMetadataType.RICH_TEXT_V2: {
|
||||
return isMatchingRichTextV2Filter({
|
||||
richTextV2Filter: filterValue as RichTextV2Filter,
|
||||
case FieldMetadataType.RICH_TEXT: {
|
||||
return isMatchingRichTextFilter({
|
||||
richTextFilter: filterValue as RichTextFilter,
|
||||
value: recordFieldValue,
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -324,7 +324,7 @@ export const convertObjectMetadataToSchemaProperties = ({
|
||||
type: 'object',
|
||||
};
|
||||
break;
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
itemProperty = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ export const buildNoteStandardFlatFieldMetadatas = ({
|
||||
workspaceId,
|
||||
context: {
|
||||
fieldName: 'bodyV2',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
label: 'Body',
|
||||
description: 'Note body',
|
||||
icon: 'IconFilePencil',
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ export const buildTaskStandardFlatFieldMetadatas = ({
|
||||
workspaceId,
|
||||
context: {
|
||||
fieldName: 'bodyV2',
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
type: FieldMetadataType.RICH_TEXT,
|
||||
label: 'Body',
|
||||
description: 'Task body',
|
||||
icon: 'IconFilePencil',
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ You help users manage their workspace data model by creating, updating, and orga
|
||||
- **CURRENCY**: Monetary values
|
||||
- **RATING**: Star ratings
|
||||
- **RELATION**: Links to other objects
|
||||
- **RICH_TEXT_V2**: Formatted rich text content
|
||||
- **RICH_TEXT**: Formatted rich text content
|
||||
|
||||
## Best Practices
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ describe('getTsVectorColumnExpressionFromFields', () => {
|
||||
|
||||
it('should handle rich text v2 fields', () => {
|
||||
const fields = [
|
||||
{ name: 'bodyV2', type: FieldMetadataType.RICH_TEXT_V2 },
|
||||
{ name: 'bodyV2', type: FieldMetadataType.RICH_TEXT },
|
||||
] as FieldTypeAndNameMetadata[];
|
||||
const result = getTsVectorColumnExpressionFromFields(fields);
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ const SEARCHABLE_FIELD_TYPES = [
|
||||
FieldMetadataType.ADDRESS,
|
||||
FieldMetadataType.LINKS,
|
||||
FieldMetadataType.PHONES,
|
||||
FieldMetadataType.RICH_TEXT_V2,
|
||||
FieldMetadataType.RICH_TEXT,
|
||||
FieldMetadataType.UUID,
|
||||
] as const;
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ export const isSearchableSubfield = (
|
||||
}
|
||||
|
||||
switch (compositeFieldMetadataType) {
|
||||
case FieldMetadataType.RICH_TEXT_V2:
|
||||
case FieldMetadataType.RICH_TEXT:
|
||||
return ['markdown'].includes(subFieldName);
|
||||
case FieldMetadataType.PHONES:
|
||||
return ['primaryPhoneNumber', 'primaryPhoneCallingCode'].includes(
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
// 'RICH_TEXT' kept as a raw string for pre-upgrade workspaces that haven't
|
||||
// yet run the 1.20 migrate-rich-text-to-text command.
|
||||
// Raw strings kept for pre-upgrade workspaces that haven't yet run
|
||||
// the 1.20 migrate-rich-text-to-text / rename-rich-text-v2 commands.
|
||||
export const isTextColumnType = (type: FieldMetadataType) => {
|
||||
return (
|
||||
type === FieldMetadataType.TEXT ||
|
||||
type === FieldMetadataType.ARRAY ||
|
||||
(type as string) === 'RICH_TEXT_V2' ||
|
||||
(type as string) === 'RICH_TEXT'
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
type ActorMetadata,
|
||||
FieldMetadataType,
|
||||
type RichTextV2Metadata,
|
||||
type RichTextMetadata,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
@@ -17,13 +17,13 @@ const BODY_V2_FIELD_NAME = 'bodyV2';
|
||||
|
||||
export const SEARCH_FIELDS_FOR_NOTES: FieldTypeAndNameMetadata[] = [
|
||||
{ name: TITLE_FIELD_NAME, type: FieldMetadataType.TEXT },
|
||||
{ name: BODY_V2_FIELD_NAME, type: FieldMetadataType.RICH_TEXT_V2 },
|
||||
{ name: BODY_V2_FIELD_NAME, type: FieldMetadataType.RICH_TEXT },
|
||||
];
|
||||
|
||||
export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
position: number;
|
||||
title: string;
|
||||
bodyV2: RichTextV2Metadata | null;
|
||||
bodyV2: RichTextMetadata | null;
|
||||
createdBy: ActorMetadata;
|
||||
updatedBy: ActorMetadata;
|
||||
noteTargets: EntityRelation<NoteTargetWorkspaceEntity[]>;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user