From 7ef650cdba3b652ef9c027071102ee076f65a3f2 Mon Sep 17 00:00:00 2001 From: Eric BREHAULT Date: Thu, 18 Apr 2024 14:05:32 +0200 Subject: [PATCH] preserve titles on existing resources (#53) --- package.json | 2 +- server/CHANGELOG.md | 4 ++++ server/src/logic/sync/domain/nuclia-cloud.ts | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 992f8d2..5c910a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia-sync-agent-app", - "version": "1.2.20", + "version": "1.2.21", "description": "This is a Nuclia Sync Agent App", "main": "build/index.js", "scripts": { diff --git a/server/CHANGELOG.md b/server/CHANGELOG.md index bfe27b3..d6d11aa 100644 --- a/server/CHANGELOG.md +++ b/server/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.2.21 (2024-04-18) + +- Do not override title on existing resource + # 1.2.20 (2024-04-16) - Fix metadata for links diff --git a/server/src/logic/sync/domain/nuclia-cloud.ts b/server/src/logic/sync/domain/nuclia-cloud.ts index eb2a52e..a38f9b7 100644 --- a/server/src/logic/sync/domain/nuclia-cloud.ts +++ b/server/src/logic/sync/domain/nuclia-cloud.ts @@ -185,7 +185,13 @@ export class NucliaCloud { return this.getKb().pipe( switchMap((kb) => - kb.createOrUpdateResource(payload).pipe( + kb.hasResource(slug).pipe( + switchMap((exists) => { + if (exists) { + delete payload.title; + } + return kb.createOrUpdateResource(payload); + }), retry(RETRY_CONFIG), delay(500), // do not overload the server catchError((error) => {