Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
], buffer);
while (true) {
const action: PublicationImportAction = yield take(chan);
const publicationDb: PublicationDb = container.get(
"publication-db") as PublicationDb;
const publicationStorage: PublicationStorage = container.get(
"publication-storage") as PublicationStorage;
const store: Store = container.get("store") as Store;
const db: PublicationDb = container.get("publication-db") as PublicationDb;
switch (action.type) {
case PUBLICATION_IMPORT_ADD:
for (const path of action.paths) {
// Parse epub and extract its metadata
Promise.resolve(
EpubParsePromise(path)
.then((pub: any) => {
let authors: Contributor[] = [];
if (pub.Metadata && pub.Metadata.Author) {
for (let author of pub.Metadata.Author) {
let contributor: Contributor = {
name: author.Name,
};
authors.push(contributor);
}
}
let newPub: Publication = {
title: pub.Metadata.Title,
description: pub.Metadata.Description,