From 6ddab8e1fffcc52802b14d1b90f13eba8ea7aba2 Mon Sep 17 00:00:00 2001 From: Dariusz Filipiak Date: Sat, 23 Sep 2023 20:49:00 +0200 Subject: [PATCH] update --- package.json | 2 +- projects/container-v4/package.json | 2 ++ projects/container-v4/package.json_tnp.json5 | 2 ++ src/lib/helpers.ts | 6 +++--- src/lib/init-method/init-method-node.ts | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index be96b212..1ac8fd87 100644 --- a/package.json +++ b/package.json @@ -469,4 +469,4 @@ "vpn-split": "~16.0.3", "yup": "1.1.1" } -} \ No newline at end of file +} diff --git a/projects/container-v4/package.json b/projects/container-v4/package.json index 681feae1..8e099945 100644 --- a/projects/container-v4/package.json +++ b/projects/container-v4/package.json @@ -226,6 +226,7 @@ "json5": "2.2.1", "lodash": "4.17.20", "moment": "2.29.3", + "pretty-error": "~4.0.0", "copy-paste": "1.5.3" }, "linkedFolders": [], @@ -472,6 +473,7 @@ "pica": "9.0.1", "portfinder": "1.0.21", "prettier": "3.0.0", + "pretty-error": "4.0.0", "progress": "2.0.3", "prompts": "0.1.8", "ps-list": "6.1.0", diff --git a/projects/container-v4/package.json_tnp.json5 b/projects/container-v4/package.json_tnp.json5 index fc634932..81e981fb 100644 --- a/projects/container-v4/package.json_tnp.json5 +++ b/projects/container-v4/package.json_tnp.json5 @@ -509,6 +509,8 @@ lodash: '4.17.20', moment: '2.29.3', + "pretty-error": "~4.0.0", + // "minimist": "1.2.0", // ------------------------------------------------------------------ // ------ CHECK/EXPLORE --------------------------------------------- diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index ccd1a10b..144bb589 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -1,5 +1,5 @@ //#region imports -import { _, crossPlatformPath } from 'tnp-core'; +import { Helpers, _, crossPlatformPath } from 'tnp-core'; //#region @websql import { path } from 'tnp-core'; //#endregion @@ -171,8 +171,8 @@ export class MorphiHelpers extends HelpersNg2Rest { const result = await asyncResponse(req, res); resolve(result as any); } catch (e) { - console.error(e); console.error('[firedev] Bad async function call ') + Helpers.renderError(e); reject(e); } } else if (typeof response === 'object') { @@ -184,8 +184,8 @@ export class MorphiHelpers extends HelpersNg2Rest { resolve(response.send as any) } } catch (error) { - console.error(error); console.error('[firedev] Bad synchonus function call ') + Helpers.renderError(error); reject(error); } } else reject(`[firedev] Not recognized type of reposne ${response}`); diff --git a/src/lib/init-method/init-method-node.ts b/src/lib/init-method/init-method-node.ts index 354c5a4b..36cc1b2d 100644 --- a/src/lib/init-method/init-method-node.ts +++ b/src/lib/init-method/init-method-node.ts @@ -164,6 +164,7 @@ export function initMethodNodejs( let result = await MorphiHelpers.getResponseValue(response, req, res); if (result instanceof Blob && (methodConfig.responseType as ModelsNg2Rest.ResponseTypeAxios) === 'blob') { + console.log('INSTANCE OF BLOB') //#region processs blob result type const blob = result as Blob; const file = Buffer.from(await blob.arrayBuffer()); @@ -174,6 +175,7 @@ export function initMethodNodejs( res.end(file); //#endregion } else if (_.isString(result) && (methodConfig.responseType as ModelsNg2Rest.ResponseTypeAxios) === 'blob') { + console.log('BASE64') //#region process string buffer TODO refacetor const img_base64 = result; const m = /^data:(.+?);base64,(.+)$/.exec(img_base64)