diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index abd61dbccd6d..b6b257a4463a 100644 --- a/connectors/src/connectors/confluence/temporal/activities.ts +++ b/connectors/src/connectors/confluence/temporal/activities.ts @@ -44,6 +44,12 @@ import mainLogger from "@connectors/logger/logger"; import { ConnectorResource } from "@connectors/resources/connector_resource"; import type { DataSourceConfig } from "@connectors/types/data_source_config"; +/** + * This type represents the ID that should be passed as parentId to a content node to hide it from the UI. + * This behavior is typically used to hide content nodes whose position in the ContentNodeTree cannot be resolved at time of upsertion. + */ +export const HiddenContentNodeParentId = "__internal_synchronizing__"; + const logger = mainLogger.child({ provider: "confluence", }); @@ -381,8 +387,8 @@ export async function confluenceCheckAndUpsertPageActivity({ documentUrl, loggerArgs, // Parent Ids will be computed after all page imports within the space have been completed. - parents: [documentId], - hideContentNode: true, + parents: [documentId, HiddenContentNodeParentId], + parentId: HiddenContentNodeParentId, tags, timestampMs: lastPageVersionCreatedAt.getTime(), upsertContext: { diff --git a/connectors/src/lib/data_sources.ts b/connectors/src/lib/data_sources.ts index b1038d5ca4a0..945af7430ccd 100644 --- a/connectors/src/lib/data_sources.ts +++ b/connectors/src/lib/data_sources.ts @@ -9,7 +9,6 @@ import type { PostDataSourceDocumentRequestBody, } from "@dust-tt/types"; import { - HiddenContentNodeParentId, isValidDate, MAX_CHUNK_SIZE, safeSubstring, @@ -70,15 +69,13 @@ type UpsertToDataSourceParams = { timestampMs?: number; tags?: string[]; parents: string[]; + parentId?: string | null; loggerArgs?: Record; upsertContext: UpsertContext; title: string; mimeType: string; async: boolean; -} & ( - | { parentId?: string | null; hideContentNode?: never } // TODO(2024-12-13) - parentId should not be nullable here, to change after changing the connectors - | { parentId?: never; hideContentNode: true } -); +}; function getDustAPI(dataSourceConfig: DataSourceConfig) { return new DustAPI( @@ -108,7 +105,6 @@ async function _upsertToDatasource({ mimeType, async, parentId = null, - hideContentNode, }: UpsertToDataSourceParams) { return tracer.trace( `connectors`, @@ -154,15 +150,6 @@ async function _upsertToDatasource({ ? (Math.floor(timestampMs) as Branded) : null; - // setting the magic values to hide the content node - if (hideContentNode) { - parentId = HiddenContentNodeParentId; // types enforce that we don't already have a parentId there - parents = [ - ...parents.filter((p) => p !== HiddenContentNodeParentId), - HiddenContentNodeParentId, - ]; - } - const dustRequestPayload: PostDataSourceDocumentRequestBody = { text: null, section: documentContent, diff --git a/types/src/front/lib/connectors_api.ts b/types/src/front/lib/connectors_api.ts index 5e8c17345bcc..69caa27ac5b6 100644 --- a/types/src/front/lib/connectors_api.ts +++ b/types/src/front/lib/connectors_api.ts @@ -121,16 +121,6 @@ export type ContentNodeWithParentIds = ContentNode & { parentInternalIds: string[] | null; }; -/** - * This type represents the ID that should be passed as parentId to a content node to hide it from the UI. - * This behavior is typically used to hide content nodes whose position in the ContentNodeTree cannot be resolved at time of upsertion. - */ -export const HiddenContentNodeParentId = "__dust_synchronizing__"; - -export function isContentNodeHidden(contentNode: BaseContentNode): boolean { - return contentNode.parentInternalId === HiddenContentNodeParentId; -} - type GetContentNodesReturnType< IncludeParents extends boolean, Key extends string