Store source metadata for imported documents (#6136)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import path from "path";
|
||||
import truncate from "lodash/truncate";
|
||||
import {
|
||||
AttachmentPreset,
|
||||
@@ -49,7 +50,7 @@ export type StructuredImportData = {
|
||||
*/
|
||||
description?: string | Record<string, any> | null;
|
||||
/** Optional id from import source, useful for mapping */
|
||||
sourceId?: string;
|
||||
externalId?: string;
|
||||
}[];
|
||||
documents: {
|
||||
id: string;
|
||||
@@ -75,8 +76,9 @@ export type StructuredImportData = {
|
||||
createdById?: string;
|
||||
createdByEmail?: string | null;
|
||||
path: string;
|
||||
mimeType: string;
|
||||
/** Optional id from import source, useful for mapping */
|
||||
sourceId?: string;
|
||||
externalId?: string;
|
||||
}[];
|
||||
attachments: {
|
||||
id: string;
|
||||
@@ -85,7 +87,7 @@ export type StructuredImportData = {
|
||||
mimeType: string;
|
||||
buffer: () => Promise<Buffer>;
|
||||
/** Optional id from import source, useful for mapping */
|
||||
sourceId?: string;
|
||||
externalId?: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
@@ -428,7 +430,11 @@ export default abstract class ImportTask extends BaseTask<Props> {
|
||||
|
||||
const document = await documentCreator({
|
||||
...options,
|
||||
source: "import",
|
||||
sourceMetadata: {
|
||||
fileName: path.basename(item.path),
|
||||
mimeType: item.mimeType,
|
||||
externalId: item.externalId,
|
||||
},
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
text,
|
||||
|
||||
Reference in New Issue
Block a user