Skip to content

Commit

Permalink
Ericbrehault/sc 9921/sync agent support path of identifiers (#60)
Browse files Browse the repository at this point in the history
* clean up useless attribute

* upgrade sdk

* expose displayPath when needed or possible
  • Loading branch information
ebrehault authored Apr 30, 2024
1 parent 044db69 commit 33c5186
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 27 deletions.
8 changes: 4 additions & 4 deletions electron-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"license": "MIT",
"dependencies": {
"@nuclia/core": "^1.14.5",
"@nuclia/core": "^1.14.9",
"cheerio": "^1.0.0-rc.12",
"commander": "^11.1.0",
"compression": "^1.7.4",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuclia-sync-agent-app",
"version": "1.4.1",
"version": "1.4.2",
"description": "This is a Nuclia Sync Agent App",
"main": "build/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.4.2 (2024-04-30)

- When loading folders, expose `displayPath` when needed and possible, according the connector types.

# 1.4.1 (2024-04-30)

- Fix titles in sitemap and RSS connectors
Expand Down
8 changes: 4 additions & 4 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"start-server": "npm run compile && node build/start-file-system-server.js"
},
"dependencies": {
"@nuclia/core": "^1.14.5",
"@nuclia/core": "^1.14.9",
"cheerio": "^1.0.0-rc.12",
"commander": "^11.1.0",
"compression": "^1.7.4",
Expand Down
1 change: 0 additions & 1 deletion server/src/logic/connector/domain/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const SyncItemValidator = z.object({
status: z.nativeEnum(FileStatus).optional(),
modifiedGMT: z.string().optional(),
mimeType: z.string().optional(),
isFolder: z.boolean().optional(),
parents: z.array(z.string()).optional(),
deleted: z.boolean().optional(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ export class ConfluenceImpl implements IConnector {
metadata: { type: raw.type || '', path: raw._links?.webui || '' },
status: FileStatus.PENDING,
uuid: `${raw.id}` || '',
isFolder: false,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ export class DropboxImpl extends OAuthBaseConnector implements IConnector {
status: FileStatus.PENDING,
uuid: (isFolder ? raw.path_lower : raw.id) || '',
modifiedGMT: raw.client_modified,
isFolder,
};
}

Expand All @@ -198,7 +197,6 @@ export class DropboxImpl extends OAuthBaseConnector implements IConnector {
},
status: FileStatus.PENDING,
uuid: raw.metadata?.metadata?.['uuid'] || '',
isFolder: raw.match_type?.['.tag'] === 'folder',
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,28 @@ export class GDriveImpl extends OAuthBaseConnector implements IConnector {
if (!folderId) {
return [];
}
let path: string[] = [];
let path: { id: string; title: string }[] = [];
let currentFolder = getFolder(folderId);
while (currentFolder) {
path = [currentFolder.title, ...path];
path = [{ id: currentFolder.originalId, title: currentFolder.title }, ...path];
if (!parents[currentFolder.originalId]) {
break;
}
currentFolder = getFolder(parents[currentFolder.originalId]);
}
return path;
};
const foldersWithPath = folders.map((folder) => ({
...folder,
metadata: {
...folder.metadata,
path: ['', ...getFolderPath(folder.parents?.[0]), folder.title].join('/'),
},
}));
const foldersWithPath = folders.map((folder) => {
const folderPathData = getFolderPath(folder.parents?.[0]);
return {
...folder,
metadata: {
...folder.metadata,
path: ['', ...folderPathData.map((f) => f.id), folder.originalId].join('/'),
displayPath: ['', ...folderPathData.map((f) => f.title), folder.title].join('/'),
},
};
});
return {
...results,
items: foldersWithPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ export class OneDriveImpl extends OAuthBaseConnector implements IConnector {
title: item.name,
originalId: item.id,
metadata: {
path: `${item.parentReference.path}/${item.name}`,
path: `${item.parentReference.path}/${item.id}`,
displayPath: `${item.parentReference.path}/${item.name}`,
},
status: FileStatus.PENDING,
isFolder: true,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ export class SharepointImpl extends OAuthBaseConnector implements IConnector {
originalId: item.id,
metadata: {},
status: FileStatus.PENDING,
isFolder: true,
};
}

Expand Down

0 comments on commit 33c5186

Please sign in to comment.