From eabfd6313527eef440477453539c92eaac662370 Mon Sep 17 00:00:00 2001 From: Sergei Samokhvalov Date: Tue, 29 Oct 2024 13:07:35 +0300 Subject: [PATCH] Add extra field to formatOperation (#195) * Add extra field to formatOperation * Fix type --- src/services/new/formatters/format-operation.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/new/formatters/format-operation.ts b/src/services/new/formatters/format-operation.ts index 91aab357..d52e425f 100644 --- a/src/services/new/formatters/format-operation.ts +++ b/src/services/new/formatters/format-operation.ts @@ -1,3 +1,9 @@ +interface OperationError { + code: number; + details: D; + message?: string; +} + type ResultError = { error?: { code: number; @@ -24,6 +30,8 @@ export type Operation = { metadata?: {}; done: boolean; result?: ResultError | ResultResponse; + response?: string; + error?: OperationError; }; export const formatOperation = (operation: Operation) => { @@ -36,5 +44,7 @@ export const formatOperation = (operation: Operation) => { metadata: {}, done: operation.done ?? true, ...(operation.result ? {result: operation.result} : {}), + ...(operation.response ? {response: operation.response} : {}), + ...(operation.error ? {error: operation.error} : {}), }; };