From 7f1125b0e78fef234904413c798465b1d1c22e6c Mon Sep 17 00:00:00 2001 From: gquadrati Date: Wed, 11 Aug 2021 16:49:40 +0200 Subject: [PATCH] [#IP-342] update HandleNHNotifyMessageCallActivity/handler.ts --- HandleNHNotifyMessageCallActivity/handler.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/HandleNHNotifyMessageCallActivity/handler.ts b/HandleNHNotifyMessageCallActivity/handler.ts index 6845ce7..2bfe681 100644 --- a/HandleNHNotifyMessageCallActivity/handler.ts +++ b/HandleNHNotifyMessageCallActivity/handler.ts @@ -1,4 +1,6 @@ -import { toString } from "fp-ts/lib/function"; +import { pipe } from "fp-ts/lib/function"; +import * as TE from "fp-ts/lib/TaskEither"; +import { toString } from "../utils/conversions"; import { taskEither } from "fp-ts/lib/TaskEither"; import * as t from "io-ts"; @@ -58,12 +60,13 @@ export const getActivityBody = ( ) : notify(nhService, input.message.installationId, input.message.payload); - return doNotify - .bimap( + return pipe( + doNotify, + TE.bimap( e => retryActivity(logger, toString(e)), ActivityResultSuccess.encode - ) - .map(e => { + ), + TE.map(e => { telemetryClient.trackEvent({ name: "api.messages.notification.push.sent", properties: { @@ -77,5 +80,6 @@ export const getActivityBody = ( }); return e; - }); + }) + ); };