mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
web: update @notesnook-importer/core to 2.2.1
This commit is contained in:
8
apps/web/package-lock.json
generated
8
apps/web/package-lock.json
generated
@@ -21,7 +21,7 @@
|
||||
"@lingui/react": "5.1.2",
|
||||
"@mdi/js": "7.4.47",
|
||||
"@mdi/react": "1.6.1",
|
||||
"@notesnook-importer/core": "^2.2.0",
|
||||
"@notesnook-importer/core": "^2.2.1",
|
||||
"@notesnook/common": "file:../../packages/common",
|
||||
"@notesnook/core": "file:../../packages/core",
|
||||
"@notesnook/crypto": "file:../../packages/crypto",
|
||||
@@ -2949,9 +2949,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@notesnook-importer/core": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@notesnook-importer/core/-/core-2.2.0.tgz",
|
||||
"integrity": "sha512-gh9wG8KT3vXAp+VTkUpz2n2j8UGj5AqmTX/Gnol0Ct5/hyDXdwVyeXzTFYySdsp8iQbrfXb7I4Y2iGzT5hHdjw==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@notesnook-importer/core/-/core-2.2.1.tgz",
|
||||
"integrity": "sha512-a9L4Z8POhoXp8spfD/tRJVIqO9nVmapq5LEPsBE2QFkIf0Ziu1SbqzGwOJeiEWUxpdBCPCgp32v5djvI2lh4sg==",
|
||||
"hasInstallScript": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"@lingui/react": "5.1.2",
|
||||
"@mdi/js": "7.4.47",
|
||||
"@mdi/react": "1.6.1",
|
||||
"@notesnook-importer/core": "^2.2.0",
|
||||
"@notesnook-importer/core": "^2.2.1",
|
||||
"@notesnook/common": "file:../../packages/common",
|
||||
"@notesnook/core": "file:../../packages/core",
|
||||
"@notesnook/crypto": "file:../../packages/crypto",
|
||||
|
||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import {
|
||||
ContentType,
|
||||
LegacyNotebook,
|
||||
Note,
|
||||
Notebook
|
||||
} from "@notesnook-importer/core/dist/src/models";
|
||||
@@ -92,8 +91,7 @@ async function processNote(
|
||||
hash: attachment.hash,
|
||||
hashType: attachment.hashType,
|
||||
filename: attachment.filename,
|
||||
// todo: figure out typescript error
|
||||
type: attachment.mime
|
||||
mimeType: attachment.mime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,34 +157,13 @@ async function processNote(
|
||||
}
|
||||
|
||||
for (const nb of notebooks) {
|
||||
if ("notebook" in nb) {
|
||||
const notebookId = await importLegacyNotebook(nb).catch(() => undefined);
|
||||
if (!notebookId) continue;
|
||||
const notebookIds = await importNotebook(nb).catch(() => undefined);
|
||||
if (!notebookIds) continue;
|
||||
for (const notebookId of notebookIds)
|
||||
await db.notes.addToNotebook(notebookId, noteId);
|
||||
} else {
|
||||
const notebookIds = await importNotebook(nb).catch(() => undefined);
|
||||
if (!notebookIds) continue;
|
||||
for (const notebookId of notebookIds)
|
||||
await db.notes.addToNotebook(notebookId, noteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
async function importLegacyNotebook(
|
||||
notebook: LegacyNotebook | undefined
|
||||
): Promise<string | undefined> {
|
||||
if (!notebook) return;
|
||||
const nb = await db.notebooks.find(notebook.notebook);
|
||||
return nb
|
||||
? nb.id
|
||||
: await db.notebooks.add({
|
||||
title: notebook.notebook
|
||||
});
|
||||
}
|
||||
|
||||
async function importNotebook(
|
||||
notebook: Notebook,
|
||||
parent?: NotebookType
|
||||
|
||||
Reference in New Issue
Block a user