From 8c6846d17dae171a6ab87cdc724fd1d3e3c10f08 Mon Sep 17 00:00:00 2001 From: Steve Cassidy Date: Sun, 9 Jun 2024 19:26:56 +1000 Subject: [PATCH 1/2] update faims3-datamodel to fix iterator bug Signed-off-by: Steve Cassidy --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 72577578..eedc922d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "express-handlebars": "7.1.2", "express-rate-limit": "^7.1.5", "express-validator": "7.0.1", - "faims3-datamodel": "github:FAIMS/faims3-data-model#v1.1.1", + "faims3-datamodel": "github:FAIMS/faims3-data-model#v1.1.5", "fast-check": "2.25.0", "gts": "3.1.1", "handlebars": "4.7.7.", @@ -4776,8 +4776,8 @@ } }, "node_modules/faims3-datamodel": { - "version": "1.1.1", - "resolved": "git+ssh://git@github.com/FAIMS/faims3-data-model.git#b5bbfaef216a6bdaa194f77fc6ebcea1b820da9a", + "version": "1.1.5", + "resolved": "git+ssh://git@github.com/FAIMS/faims3-data-model.git#377428607669ffe66520cbd6954e837c278271e4", "license": "Apache", "dependencies": { "@demvsystems/yup-ast": "^1.2.2", @@ -14989,8 +14989,8 @@ } }, "faims3-datamodel": { - "version": "git+ssh://git@github.com/FAIMS/faims3-data-model.git#b5bbfaef216a6bdaa194f77fc6ebcea1b820da9a", - "from": "faims3-datamodel@github:FAIMS/faims3-data-model#v1.1.1", + "version": "git+ssh://git@github.com/FAIMS/faims3-data-model.git#377428607669ffe66520cbd6954e837c278271e4", + "from": "faims3-datamodel@github:FAIMS/faims3-data-model#v1.1.5", "requires": { "@demvsystems/yup-ast": "^1.2.2", "@types/pouchdb": "^6.4.0", diff --git a/package.json b/package.json index 7980eaa8..9186a5b9 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "express-handlebars": "7.1.2", "express-rate-limit": "^7.1.5", "express-validator": "7.0.1", - "faims3-datamodel": "github:FAIMS/faims3-data-model#v1.1.1", + "faims3-datamodel": "github:FAIMS/faims3-data-model#v1.1.5", "fast-check": "2.25.0", "gts": "3.1.1", "handlebars": "4.7.7.", From d8fe71ccfcca327f35bf974e62b745402c82245a Mon Sep 17 00:00:00 2001 From: Steve Cassidy Date: Sun, 9 Jun 2024 19:27:13 +1000 Subject: [PATCH 2/2] don't fall over when relation name is missing Signed-off-by: Steve Cassidy --- src/couchdb/notebooks.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/couchdb/notebooks.ts b/src/couchdb/notebooks.ts index c4ba08e8..93e0e699 100644 --- a/src/couchdb/notebooks.ts +++ b/src/couchdb/notebooks.ts @@ -637,7 +637,10 @@ const csvFormatValue = ( if (value instanceof Array) { result[fieldName] = value .map((v: any) => { - return `${v.relation_type_vocabPair[0]}/${v.record_id}`; + const relation_name = v.relation_type_vocabPair + ? v.relation_type_vocabPair[0] + : 'unknown relation'; + return `${relation_name}/${v.record_id}`; }) .join(';'); } else { @@ -809,8 +812,12 @@ export const streamNotebookFilesAsZip = async ( allFilesAdded && ev.entries.total === ev.entries.processed ) { - archive.finalize(); - doneFinalize = true; + try { + archive.finalize(); + doneFinalize = true; + } catch { + // ignore ArchiveError + } } }); @@ -862,7 +869,8 @@ export const streamNotebookFilesAsZip = async ( } // if we didn't write any data then finalise because that won't happen elsewhere if (!dataWritten) { - archive.finalize(); + console.log('no data written'); + archive.abort(); } allFilesAdded = true; // fire a progress event here because short/empty zip files don't