From 5eef9904453ebe003584d034951d5ee7be3ce46a Mon Sep 17 00:00:00 2001 From: Onitoxan Date: Wed, 4 Dec 2024 11:05:03 +0100 Subject: [PATCH] Make importInformation nullable --- apps/hpc-ftsadmin/src/app/utils/parse-flow-form.ts | 4 ++-- libs/hpc-data/src/lib/flows.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/hpc-ftsadmin/src/app/utils/parse-flow-form.ts b/apps/hpc-ftsadmin/src/app/utils/parse-flow-form.ts index e512f001a..d1312671d 100644 --- a/apps/hpc-ftsadmin/src/app/utils/parse-flow-form.ts +++ b/apps/hpc-ftsadmin/src/app/utils/parse-flow-form.ts @@ -387,7 +387,7 @@ const isInferred = ( } const inferredList = flow.externalReferences.map((eR) => { - if (!eR.importInformation.inferred) { + if (!eR.importInformation?.inferred) { return false; } return eR.importInformation.inferred.some( @@ -411,7 +411,7 @@ const isTransferred = ( } const transferredList = flow.externalReferences.map((eR) => { - if (!eR.importInformation.transferred) { + if (!eR.importInformation?.transferred) { return false; } return eR.importInformation.transferred.some( diff --git a/libs/hpc-data/src/lib/flows.ts b/libs/hpc-data/src/lib/flows.ts index f4cc0bf48..239318fcc 100644 --- a/libs/hpc-data/src/lib/flows.ts +++ b/libs/hpc-data/src/lib/flows.ts @@ -224,10 +224,13 @@ const FLOW_REST_EXTERNAL_REFERENCE = t.type({ versionID: t.number, createdAt: t.string, updatedAt: t.string, - importInformation: t.partial({ - inferred: t.array(FLOW_IMPORT_INFORMATION), - transferred: t.array(FLOW_IMPORT_INFORMATION), - }), + importInformation: t.union([ + t.partial({ + inferred: t.array(FLOW_IMPORT_INFORMATION), + transferred: t.array(FLOW_IMPORT_INFORMATION), + }), + t.null, + ]), }); const FLOW_REST_EXTERNAL_DATA = t.type({