use metadatas and schemas

This commit is contained in:
Ben Irvin 2022-11-28 13:24:34 +01:00
parent c62758ebfc
commit ef980513bf
2 changed files with 5 additions and 6 deletions

View File

@ -173,7 +173,7 @@ class TransferEngine<
if (!isEmpty(diffs)) {
throw new Error(
`Import process failed because the project doesn't have a matching data structure
${JSON.stringify(diffs, null, 2)}
${JSON.stringify(diffs, null, 2)}
`
);
}
@ -246,6 +246,7 @@ class TransferEngine<
const isValidTransfer = await this.integrityCheck();
if (!isValidTransfer) {
// TODO: provide the log from the integrity check
throw new Error(
`Unable to transfer the data between ${this.sourceProvider.name} and ${this.destinationProvider.name}.\nPlease refer to the log above for more information.`
);

View File

@ -82,15 +82,13 @@ class LocalFileSourceProvider implements ISourceProvider {
// TODO: need to read the file & extract the metadata json file
// => we might also need to read the schema.jsonl files & implements a custom stream-check
const backupStream = this.#getBackupStream();
return {};
// return this.#parseJSONFile<IMetadata>(backupStream, METADATA_FILE_PATH);
return this.#parseJSONFile<IMetadata>(backupStream, METADATA_FILE_PATH);
}
async getSchemas() {
// const schemas = await collect(this.streamSchemas() as Readable);
const schemas = await collect(this.streamSchemas() as Readable);
// return keyBy('uid', schemas);
return null;
return keyBy('uid', schemas);
}
streamEntities(): NodeJS.ReadableStream {