Skip to content

Commit

Permalink
Get rid of dustDocumentId (#9921)
Browse files Browse the repository at this point in the history
* removed occurences of dustDocumentId, fixed invisible button, display content for nodes with 'file' type

* Removed unsused function

* Forgotten dustDocumentId s
  • Loading branch information
overmode authored Jan 13, 2025
1 parent e1b9428 commit c14a709
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 122 deletions.
2 changes: 0 additions & 2 deletions connectors/src/connectors/confluence/lib/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export function createContentNodeFromSpace(
sourceUrl: `${baseUrl}/wiki${urlSuffix}`,
expandable: isExpandable,
permission,
dustDocumentId: null,
lastUpdatedAt: null,
};
}
Expand All @@ -75,7 +74,6 @@ export function createContentNodeFromPage(
sourceUrl: `${baseUrl}/wiki${page.externalUrl}`,
expandable: isExpandable,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
};
}
Expand Down
14 changes: 0 additions & 14 deletions connectors/src/connectors/github/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
}))
);
Expand Down Expand Up @@ -364,7 +363,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + "/issues",
expandable: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: latestIssue.updatedAt.getTime(),
});
}
Expand All @@ -378,7 +376,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + "/discussions",
expandable: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: latestDiscussion.updatedAt.getTime(),
});
}
Expand All @@ -392,7 +389,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: codeRepo.codeUpdatedAt.getTime(),
});
}
Expand Down Expand Up @@ -434,7 +430,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: directory.sourceUrl,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: directory.codeUpdatedAt.getTime(),
});
});
Expand All @@ -448,7 +443,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: file.sourceUrl,
expandable: false,
permission: "read",
dustDocumentId: file.documentId,
lastUpdatedAt: file.codeUpdatedAt.getTime(),
});
});
Expand Down Expand Up @@ -610,7 +604,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
});
});
Expand All @@ -629,7 +622,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + "/issues",
expandable: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
});
});
Expand All @@ -646,7 +638,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + "/discussions",
expandable: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
});
});
Expand All @@ -665,7 +656,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + `/issues/${issueNumber}`,
expandable: false,
permission: "read",
dustDocumentId: getIssueInternalId(repoId, issueNumber),
lastUpdatedAt: issue.updatedAt.getTime(),
});
});
Expand All @@ -684,7 +674,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: repo.url + `/discussions/${discussionNumber}`,
expandable: false,
permission: "read",
dustDocumentId: getDiscussionInternalId(repoId, discussionNumber),
lastUpdatedAt: discussion.updatedAt.getTime(),
});
});
Expand All @@ -699,7 +688,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: codeRepo.sourceUrl,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: codeRepo.codeUpdatedAt.getTime(),
});
});
Expand All @@ -714,7 +702,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: directory.sourceUrl,
expandable: true,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: directory.codeUpdatedAt.getTime(),
});
});
Expand All @@ -729,7 +716,6 @@ export class GithubConnectorManager extends BaseConnectorManager<null> {
sourceUrl: file.sourceUrl,
expandable: false,
permission: "read",
dustDocumentId: file.documentId,
lastUpdatedAt: file.codeUpdatedAt.getTime(),
});
});
Expand Down
13 changes: 1 addition & 12 deletions connectors/src/connectors/google_drive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import {
} from "@connectors/connectors/google_drive/lib";
import { GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID } from "@connectors/connectors/google_drive/lib/consts";
import { getGoogleDriveObject } from "@connectors/connectors/google_drive/lib/google_drive_api";
import {
getGoogleDriveEntityDocumentId,
getPermissionViewType,
} from "@connectors/connectors/google_drive/lib/permissions";
import { getPermissionViewType } from "@connectors/connectors/google_drive/lib/permissions";
import {
folderHasChildren,
getDrives,
Expand Down Expand Up @@ -324,7 +321,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
parentInternalId: null,
type,
title: f.name || "",
dustDocumentId: getGoogleDriveEntityDocumentId(f),
lastUpdatedAt: f.lastUpsertedTs?.getTime() || null,
sourceUrl: getSourceUrlForGoogleDriveFiles(f),
expandable: await isDriveObjectExpandable({
Expand All @@ -350,7 +346,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
parentInternalId: getInternalId(s.driveFileId),
type: "database" as const,
title: s.name || "",
dustDocumentId: null,
lastUpdatedAt: s.updatedAt.getTime() || null,
sourceUrl: null,
expandable: false,
Expand Down Expand Up @@ -394,7 +389,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
type: "folder" as const,
title: driveObject.name,
sourceUrl: driveObject.webViewLink || null,
dustDocumentId: null,
lastUpdatedAt: driveObject.updatedAtMs || null,
expandable: await folderHasChildren(
this.connectorId,
Expand All @@ -420,7 +414,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
preventSelection: true,
title: "Shared with me",
sourceUrl: null,
dustDocumentId: null,
lastUpdatedAt: null,
expandable: true,
permission: "none",
Expand Down Expand Up @@ -492,7 +485,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
this.connectorId,
driveObject.id
),
dustDocumentId: null,
lastUpdatedAt: driveObject.updatedAtMs || null,
permission: (await GoogleDriveFolders.findOne({
where: {
Expand Down Expand Up @@ -672,7 +664,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
parentInternalId: null,
type,
title: f.name || "",
dustDocumentId: getGoogleDriveEntityDocumentId(f),
lastUpdatedAt: f.lastUpsertedTs?.getTime() || null,
sourceUrl,
expandable: await isDriveObjectExpandable({
Expand Down Expand Up @@ -714,7 +705,6 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
parentInternalId: getInternalId(s.driveFileId),
type: "database",
title: s.name || "",
dustDocumentId: null,
lastUpdatedAt: s.updatedAt.getTime() || null,
sourceUrl: `https://docs.google.com/spreadsheets/d/${s.driveFileId}/edit#gid=${s.driveSheetId}`,
expandable: false,
Expand Down Expand Up @@ -972,7 +962,6 @@ async function getFoldersAsContentNodes({
type: "folder",
title: fd.name || "",
sourceUrl,
dustDocumentId: null,
lastUpdatedAt: fd.updatedAtMs || null,
expandable: await isDriveObjectExpandable({
objectId: f.folderId,
Expand Down
14 changes: 1 addition & 13 deletions connectors/src/connectors/google_drive/lib/permissions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
isGoogleDriveFolder,
isGoogleDriveSpreadSheetFile,
} from "@connectors/connectors/google_drive/temporal/mime_types";
import { getInternalId } from "@connectors/connectors/google_drive/temporal/utils";
import { isGoogleDriveFolder } from "@connectors/connectors/google_drive/temporal/mime_types";
import type { GoogleDriveFiles } from "@connectors/lib/models/google_drive";

export function getPermissionViewType(file: GoogleDriveFiles) {
Expand All @@ -12,11 +8,3 @@ export function getPermissionViewType(file: GoogleDriveFiles) {

return "file";
}

export function getGoogleDriveEntityDocumentId(file: GoogleDriveFiles) {
if (isGoogleDriveSpreadSheetFile(file) || isGoogleDriveFolder(file)) {
return null;
}

return getInternalId(file.driveFileId);
}
5 changes: 0 additions & 5 deletions connectors/src/connectors/intercom/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ export class IntercomConnectorManager extends BaseConnectorManager<null> {
sourceUrl: null,
expandable: true,
permission: helpCenter.permission,
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand All @@ -650,7 +649,6 @@ export class IntercomConnectorManager extends BaseConnectorManager<null> {
sourceUrl: collection.url,
expandable: true,
permission: collection.permission,
dustDocumentId: null,
lastUpdatedAt: collection.lastUpsertedTs?.getTime() || null,
});
}
Expand All @@ -671,7 +669,6 @@ export class IntercomConnectorManager extends BaseConnectorManager<null> {
sourceUrl: article.url,
expandable: false,
permission: article.permission,
dustDocumentId: null,
lastUpdatedAt: article.lastUpsertedTs?.getTime() || null,
});
}
Expand All @@ -687,7 +684,6 @@ export class IntercomConnectorManager extends BaseConnectorManager<null> {
intercomWorkspace.syncAllConversations === "activated"
? "read"
: "none",
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand All @@ -700,7 +696,6 @@ export class IntercomConnectorManager extends BaseConnectorManager<null> {
sourceUrl: null,
expandable: false,
permission: team.permission,
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ export async function retrieveIntercomConversationsPermissions({
expandable: false,
preventSelection: false,
permission: isAllConversationsSynced ? "read" : "none",
dustDocumentId: null,
lastUpdatedAt: null,
});
} else if (isRootLevel && hasTeamsWithReadPermission) {
Expand All @@ -155,7 +154,6 @@ export async function retrieveIntercomConversationsPermissions({
expandable: true,
preventSelection: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand All @@ -170,7 +168,6 @@ export async function retrieveIntercomConversationsPermissions({
sourceUrl: null,
expandable: false,
permission: team.permission,
dustDocumentId: null,
lastUpdatedAt: null,
});
});
Expand All @@ -188,7 +185,6 @@ export async function retrieveIntercomConversationsPermissions({
expandable: true,
preventSelection: false,
permission: isAllConversationsSynced ? "read" : "none",
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand All @@ -205,7 +201,6 @@ export async function retrieveIntercomConversationsPermissions({
sourceUrl: null,
expandable: false,
permission: isTeamInDb ? "read" : "none",
dustDocumentId: null,
lastUpdatedAt: null,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ export async function retrieveIntercomHelpCentersPermissions({
sourceUrl: null,
expandable: true,
permission: helpCenter.permission,
dustDocumentId: null,
lastUpdatedAt: helpCenter.updatedAt.getTime(),
}));
} else {
Expand All @@ -388,7 +387,6 @@ export async function retrieveIntercomHelpCentersPermissions({
expandable: true,
preventSelection: true,
permission: "none",
dustDocumentId: null,
lastUpdatedAt: null,
}));
}
Expand Down Expand Up @@ -435,7 +433,6 @@ export async function retrieveIntercomHelpCentersPermissions({
sourceUrl: collection.url,
expandable: true,
permission: collection.permission,
dustDocumentId: null,
lastUpdatedAt: collection.updatedAt.getTime() || null,
}));
} else {
Expand Down Expand Up @@ -464,7 +461,6 @@ export async function retrieveIntercomHelpCentersPermissions({
sourceUrl: collection.url,
expandable: false, // WE DO NOT LET EXPAND BELOW LEVEL 1 WHEN SELECTING NODES
permission: matchingCollectionInDb ? "read" : "none",
dustDocumentId: null,
lastUpdatedAt: matchingCollectionInDb?.updatedAt.getTime() || null,
};
});
Expand Down Expand Up @@ -504,7 +500,6 @@ export async function retrieveIntercomHelpCentersPermissions({
sourceUrl: collection.url,
expandable: true,
permission: collection.permission,
dustDocumentId: null,
lastUpdatedAt: collection.lastUpsertedTs?.getTime() || null,
})
);
Expand All @@ -529,7 +524,6 @@ export async function retrieveIntercomHelpCentersPermissions({
sourceUrl: article.url,
expandable: false,
permission: article.permission,
dustDocumentId: null,
lastUpdatedAt: article.updatedAt.getTime(),
}));

Expand Down
3 changes: 0 additions & 3 deletions connectors/src/connectors/intercom/lib/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export async function retrieveSelectedNodes({
sourceUrl: collection.url,
expandable,
permission: collection.permission,
dustDocumentId: null,
lastUpdatedAt: collection.updatedAt.getTime() || null,
});
});
Expand All @@ -85,7 +84,6 @@ export async function retrieveSelectedNodes({
sourceUrl: null,
expandable: false,
permission: "read",
dustDocumentId: null,
lastUpdatedAt: null,
});
}
Expand All @@ -105,7 +103,6 @@ export async function retrieveSelectedNodes({
sourceUrl: null,
expandable: false,
permission: team.permission,
dustDocumentId: null,
lastUpdatedAt: team.updatedAt.getTime() || null,
});
});
Expand Down
Loading

0 comments on commit c14a709

Please sign in to comment.