|
|
@ -242,7 +242,11 @@ export class DuplicateProcessor { |
|
|
|
|
|
|
|
|
|
|
|
let handledLinks = []; |
|
|
|
let handledLinks = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let error = null; |
|
|
|
|
|
|
|
|
|
|
|
for (const sourceModel of sourceModels) { |
|
|
|
for (const sourceModel of sourceModels) { |
|
|
|
|
|
|
|
if (error) break; |
|
|
|
|
|
|
|
|
|
|
|
const dataStream = new Readable({ |
|
|
|
const dataStream = new Readable({ |
|
|
|
read() {}, |
|
|
|
read() {}, |
|
|
|
}); |
|
|
|
}); |
|
|
@ -251,12 +255,19 @@ export class DuplicateProcessor { |
|
|
|
read() {}, |
|
|
|
read() {}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.exportService.streamModelDataAsCsv({ |
|
|
|
this.exportService |
|
|
|
|
|
|
|
.streamModelDataAsCsv({ |
|
|
|
dataStream, |
|
|
|
dataStream, |
|
|
|
linkStream, |
|
|
|
linkStream, |
|
|
|
projectId: sourceProject.id, |
|
|
|
projectId: sourceProject.id, |
|
|
|
modelId: sourceModel.id, |
|
|
|
modelId: sourceModel.id, |
|
|
|
handledMmList: handledLinks, |
|
|
|
handledMmList: handledLinks, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((e) => { |
|
|
|
|
|
|
|
this.logger.error(e); |
|
|
|
|
|
|
|
dataStream.push(null); |
|
|
|
|
|
|
|
linkStream.push(null); |
|
|
|
|
|
|
|
error = e; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const model = await Model.get(findWithIdentifier(idMap, sourceModel.id)); |
|
|
|
const model = await Model.get(findWithIdentifier(idMap, sourceModel.id)); |
|
|
@ -284,6 +295,8 @@ export class DuplicateProcessor { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (error) throw error; |
|
|
|
|
|
|
|
|
|
|
|
// update external models (has bt to this model)
|
|
|
|
// update external models (has bt to this model)
|
|
|
|
if (externalModels) { |
|
|
|
if (externalModels) { |
|
|
|
for (const sourceModel of externalModels) { |
|
|
|
for (const sourceModel of externalModels) { |
|
|
@ -299,13 +312,22 @@ export class DuplicateProcessor { |
|
|
|
read() {}, |
|
|
|
read() {}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.exportService.streamModelDataAsCsv({ |
|
|
|
let error = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.exportService |
|
|
|
|
|
|
|
.streamModelDataAsCsv({ |
|
|
|
dataStream, |
|
|
|
dataStream, |
|
|
|
linkStream, |
|
|
|
linkStream, |
|
|
|
projectId: sourceProject.id, |
|
|
|
projectId: sourceProject.id, |
|
|
|
modelId: sourceModel.id, |
|
|
|
modelId: sourceModel.id, |
|
|
|
handledMmList: handledLinks, |
|
|
|
handledMmList: handledLinks, |
|
|
|
_fieldIds: fields, |
|
|
|
_fieldIds: fields, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.catch((e) => { |
|
|
|
|
|
|
|
this.logger.error(e); |
|
|
|
|
|
|
|
dataStream.push(null); |
|
|
|
|
|
|
|
linkStream.push(null); |
|
|
|
|
|
|
|
error = e; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const headers: string[] = []; |
|
|
|
const headers: string[] = []; |
|
|
@ -401,6 +423,8 @@ export class DuplicateProcessor { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (error) throw error; |
|
|
|
|
|
|
|
|
|
|
|
elapsedTime( |
|
|
|
elapsedTime( |
|
|
|
hrTime, |
|
|
|
hrTime, |
|
|
|
`map existing links to ${model.title}`, |
|
|
|
`map existing links to ${model.title}`, |
|
|
|