diff --git a/connectors/src/connectors/confluence/lib/internal_ids.ts b/connectors/src/connectors/confluence/lib/internal_ids.ts index fff9866b3a8c..05a01be2ec81 100644 --- a/connectors/src/connectors/confluence/lib/internal_ids.ts +++ b/connectors/src/connectors/confluence/lib/internal_ids.ts @@ -7,7 +7,7 @@ Internal IDs are Confluence IDs with a prefix `confluence-space-` or `confluence enum ConfluenceInternalIdPrefix { Space = "confluence-space-", - Page = "confluence-page", + Page = "confluence-page-", } export function makeSpaceInternalId(confluenceSpaceId: string) { diff --git a/connectors/src/connectors/confluence/temporal/activities.ts b/connectors/src/connectors/confluence/temporal/activities.ts index d8903215f6cf..eed69a283be9 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 = "__hidden_syncing_content__"; + const logger = mainLogger.child({ provider: "confluence", }); @@ -381,7 +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], + parents: [documentId, HiddenContentNodeParentId], + parentId: HiddenContentNodeParentId, tags, timestampMs: lastPageVersionCreatedAt.getTime(), upsertContext: { @@ -570,6 +577,7 @@ export async function confluenceUpdatePagesParentIdsActivity( dataSourceConfig: dataSourceConfigFromConnector(connector), documentId: makePageInternalId(page.pageId), parents: parentIds, + parentId: parentIds[1], }); }, { concurrency: 10 } diff --git a/connectors/src/lib/data_sources.ts b/connectors/src/lib/data_sources.ts index 6acd7481fb2a..387be695dccc 100644 --- a/connectors/src/lib/data_sources.ts +++ b/connectors/src/lib/data_sources.ts @@ -329,6 +329,7 @@ async function _updateDocumentParentsField({ dataSourceConfig: DataSourceConfig; documentId: string; parents: string[]; + parentId?: string | null; loggerArgs?: Record; }) { return _updateDocumentOrTableParentsField({ @@ -360,12 +361,14 @@ async function _updateDocumentOrTableParentsField({ dataSourceConfig, id, parents, + parentId = null, loggerArgs = {}, tableOrDocument, }: { dataSourceConfig: DataSourceConfig; id: string; parents: string[]; + parentId?: string | null; loggerArgs?: Record; tableOrDocument: "document" | "table"; }) { @@ -388,6 +391,7 @@ async function _updateDocumentOrTableParentsField({ endpoint, { parents: parents, + parent_id: parentId, }, dustRequestConfig );