The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { type AllStandardObjectFieldName } from 'src/engine/workspace-manager/twenty-standard-application/types/all-standard-object-field-name.type';
import { msg } from '@lingui/core/macro';
import {
FieldMetadataType,
RelationOnDeleteAction,
RelationType,
} from 'twenty-shared/types';
import { STANDARD_RELATION_FIELD_PROPERTIES_BY_RELATION_OBJECT } from 'src/engine/metadata-modules/object-metadata/constants/standard-relation-field-properties.constant';
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
import {
type CreateStandardFieldArgs,
createStandardFieldFlatMetadata,
} from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-field-flat-metadata.util';
import { createStandardRelationFieldFlatMetadata } from 'src/engine/workspace-manager/twenty-standard-application/utils/field-metadata/create-standard-relation-field-flat-metadata.util';
import { PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS } from 'src/engine/workspace-manager/twenty-standard-application/constants/standard-disabled-field-permission-actions.constant';
import { i18nLabel } from 'src/engine/workspace-manager/twenty-standard-application/utils/i18n-label.util';
export const buildAgentChatThreadStandardFlatFieldMetadatas = (
args: Omit<
CreateStandardFieldArgs<'agentChatThread', FieldMetadataType>,
'context'
>,
): Record<
AllStandardObjectFieldName<'agentChatThread'>,
FlatFieldMetadata
> => ({
id: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'id',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({ message: 'ID', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'ID', context: 'fieldMetadata.description' }),
),
icon: 'IconId',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 'uuid',
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
title: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'title',
type: FieldMetadataType.TEXT,
label: i18nLabel(
msg({ message: 'Title', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Title', context: 'fieldMetadata.description' }),
),
icon: 'IconText',
isSystem: true,
isUIEditable: true,
isNullable: true,
},
}),
isAuditLogged: false,
},
conversationType: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'conversationType',
type: FieldMetadataType.SELECT,
label: i18nLabel(
msg({ message: 'Conversation type', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message:
'Whether this is a regular chat or a canonical direct message',
context: 'fieldMetadata.description',
}),
),
icon: 'IconMessages',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: "'STANDARD'",
options: [
{
id: '3236f63d-b8f8-4339-9562-1f45814338fd',
value: 'STANDARD',
label: i18nLabel(
msg({ message: 'Regular chat', context: 'fieldMetadata.label' }),
),
position: 0,
color: 'gray',
},
{
id: '293035d8-eaa1-4f12-8a78-e9eec497ef10',
value: 'DIRECT_MESSAGE',
label: i18nLabel(
msg({
message: 'Direct message',
context: 'fieldMetadata.label',
}),
),
position: 1,
color: 'blue',
},
],
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
directMessageFirstWorkspaceMemberId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'directMessageFirstWorkspaceMemberId',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({
message: 'First direct message member ID',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'The first member in the fixed direct message pair',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUser',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
directMessageSecondWorkspaceMemberId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'directMessageSecondWorkspaceMemberId',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({
message: 'Second direct message member ID',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'The second member in the fixed direct message pair',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUser',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
isAssistantParticipant: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'isAssistantParticipant',
type: FieldMetadataType.BOOLEAN,
label: i18nLabel(
msg({
message: 'Assistant participant',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Whether the assistant participates in this conversation',
context: 'fieldMetadata.description',
}),
),
icon: 'IconSparkles',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalInputTokens: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalInputTokens',
type: FieldMetadataType.NUMBER,
label: i18nLabel(
msg({
message: 'Total Input Tokens',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Input Tokens',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 0,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalOutputTokens: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalOutputTokens',
type: FieldMetadataType.NUMBER,
label: i18nLabel(
msg({
message: 'Total Output Tokens',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Output Tokens',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 0,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
contextWindowTokens: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'contextWindowTokens',
type: FieldMetadataType.NUMBER,
label: i18nLabel(
msg({
message: 'Context Window Tokens',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Context Window Tokens',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
conversationSize: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'conversationSize',
type: FieldMetadataType.NUMBER,
label: i18nLabel(
msg({ message: 'Conversation Size', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Conversation Size',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 0,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalInputCredits: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalInputCredits',
type: FieldMetadataType.NUMERIC,
label: i18nLabel(
msg({
message: 'Total Input Credits',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Input Credits',
context: 'fieldMetadata.description',
}),
),
icon: 'IconCoin',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: "'0'",
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalOutputCredits: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalOutputCredits',
type: FieldMetadataType.NUMERIC,
label: i18nLabel(
msg({
message: 'Total Output Credits',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Output Credits',
context: 'fieldMetadata.description',
}),
),
icon: 'IconCoin',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: "'0'",
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalCacheReadTokens: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalCacheReadTokens',
type: FieldMetadataType.NUMERIC,
label: i18nLabel(
msg({
message: 'Total Cache Read Tokens',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Cache Read Tokens',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: "'0'",
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
totalCacheCreationTokens: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'totalCacheCreationTokens',
type: FieldMetadataType.NUMERIC,
label: i18nLabel(
msg({
message: 'Total Cache Creation Tokens',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Total Cache Creation Tokens',
context: 'fieldMetadata.description',
}),
),
icon: 'IconNumber',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: "'0'",
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
activeStreamId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'activeStreamId',
type: FieldMetadataType.TEXT,
label: i18nLabel(
msg({ message: 'Active Stream ID', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Active Stream ID',
context: 'fieldMetadata.description',
}),
),
icon: 'IconText',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
pendingQuestionMessageId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'pendingQuestionMessageId',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({
message: 'Pending Question Message ID',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'Pending Question Message ID',
context: 'fieldMetadata.description',
}),
),
icon: 'IconId',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
deletedAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'deletedAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({ message: 'Deleted At', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Deleted At', context: 'fieldMetadata.description' }),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
archivedAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'archivedAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({ message: 'Archived At', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Archived At', context: 'fieldMetadata.description' }),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
lastActivityAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'lastActivityAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({ message: 'Last activity', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'When the thread was created or last received a message',
context: 'fieldMetadata.description',
}),
),
icon: 'IconCalendarClock',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
lastMessageText: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'lastMessageText',
type: FieldMetadataType.TEXT,
label: i18nLabel(
msg({ message: 'Last message', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'The start of the last message in the thread',
context: 'fieldMetadata.description',
}),
),
icon: 'IconMessage',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
lastMessageSenderWorkspaceMemberId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'lastMessageSenderWorkspaceMemberId',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({
message: 'Last message sender',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message:
'The member who wrote the last message, empty when the agent or an application did',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUser',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
writerWorkspaceMemberIds: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'writerWorkspaceMemberIds',
type: FieldMetadataType.ARRAY,
label: i18nLabel(
msg({ message: 'Writers', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'The members who wrote in the thread',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUsers',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
createdAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'createdAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({ message: 'Created At', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Created At', context: 'fieldMetadata.description' }),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 'now',
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
updatedAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'updatedAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({ message: 'Updated At', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Updated At', context: 'fieldMetadata.description' }),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: false,
defaultValue: 'now',
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
turns: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'turns',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Turns', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Turns', context: 'fieldMetadata.description' }),
),
icon: 'IconRelationOneToMany',
isUIEditable: false,
isNullable: true,
targetObjectName: 'agentTurn',
targetFieldName: 'thread',
morphId: null,
settings: {
relationType: RelationType.ONE_TO_MANY,
joinColumnName: null,
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
workspaceMember: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'workspaceMember',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Workspace Member', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Workspace member who owns the thread',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUsers',
isUIEditable: false,
// Stays nullable for workflow run conversations, read through the run; other threads get an owner with the owner contract step (twentyhq/core-team-issues#2925)
isNullable: true,
targetObjectName: 'workspaceMember',
targetFieldName: 'agentChatThreads',
morphId: null,
settings: {
relationType: RelationType.MANY_TO_ONE,
onDelete: RelationOnDeleteAction.CASCADE,
joinColumnName: 'workspaceMemberId',
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
// Set through the move mutation, which also rewrites the grants the
// channel gives on the chat
channelId: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'channelId',
type: FieldMetadataType.UUID,
label: i18nLabel(
msg({ message: 'Channel', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Channel the thread is triaged in',
context: 'fieldMetadata.description',
}),
),
icon: 'IconHash',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
channelArchivedAt: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'channelArchivedAt',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({
message: 'Channel archived at',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message:
'When the thread was marked as done or snoozed in its channel',
context: 'fieldMetadata.description',
}),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
channelSnoozedUntil: {
...createStandardFieldFlatMetadata({
...args,
context: {
fieldName: 'channelSnoozedUntil',
type: FieldMetadataType.DATE_TIME,
label: i18nLabel(
msg({
message: 'Channel snoozed until',
context: 'fieldMetadata.label',
}),
),
description: i18nLabel(
msg({
message: 'When a thread snoozed in its channel comes back to it',
context: 'fieldMetadata.description',
}),
),
icon: 'IconCalendar',
isSystem: true,
isUIEditable: false,
isNullable: true,
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
// Set through the assign mutation, which also lets the assignee reply and
// brings the chat to their inbox
assignee: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'assignee',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Assignee', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Workspace member responsible for the thread',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUsers',
isUIEditable: false,
isNullable: true,
targetObjectName: 'workspaceMember',
targetFieldName: 'assignedAgentChatThreads',
morphId: null,
settings: {
relationType: RelationType.MANY_TO_ONE,
onDelete: RelationOnDeleteAction.SET_NULL,
joinColumnName: 'assigneeId',
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
messages: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'messages',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Messages', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({ message: 'Messages', context: 'fieldMetadata.description' }),
),
icon: 'IconRelationOneToMany',
isUIEditable: false,
isNullable: true,
targetObjectName: 'agentMessage',
targetFieldName: 'thread',
morphId: null,
settings: {
relationType: RelationType.ONE_TO_MANY,
joinColumnName: null,
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
attachments: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'attachments',
type: FieldMetadataType.RELATION,
label: i18nLabel(
STANDARD_RELATION_FIELD_PROPERTIES_BY_RELATION_OBJECT.attachment
.label,
),
description: i18nLabel(
msg({
message: 'Attachments linked to the chat thread',
context: 'fieldMetadata.description',
}),
),
icon: STANDARD_RELATION_FIELD_PROPERTIES_BY_RELATION_OBJECT.attachment
.icon,
isUIEditable: false,
isNullable: true,
isSystemSideEffect: true,
targetObjectName: 'attachment',
targetFieldName: 'targetAgentChatThread',
morphId: null,
settings: {
relationType: RelationType.ONE_TO_MANY,
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
recordTargets: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'recordTargets',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Record Targets', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Records this thread is attached to',
context: 'fieldMetadata.description',
}),
),
icon: 'IconRelationOneToMany',
isUIEditable: false,
isNullable: true,
targetObjectName: 'agentChatThreadTarget',
targetFieldName: 'thread',
morphId: null,
settings: {
relationType: RelationType.ONE_TO_MANY,
joinColumnName: null,
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
participants: {
...createStandardRelationFieldFlatMetadata({
...args,
context: {
fieldName: 'participants',
type: FieldMetadataType.RELATION,
label: i18nLabel(
msg({ message: 'Participants', context: 'fieldMetadata.label' }),
),
description: i18nLabel(
msg({
message: 'Read and inbox state of each member in this thread',
context: 'fieldMetadata.description',
}),
),
icon: 'IconUsers',
isUIEditable: false,
isNullable: true,
targetObjectName: 'agentChatThreadParticipant',
targetFieldName: 'thread',
morphId: null,
settings: {
relationType: RelationType.ONE_TO_MANY,
joinColumnName: null,
},
},
}),
disabledFieldPermissionActions:
PLATFORM_WRITTEN_DISABLED_FIELD_PERMISSION_ACTIONS,
isAuditLogged: false,
},
});