From 3cf76f51558785c9fb3f08437f4f71d3f8171acd Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sat, 19 Jul 2025 07:15:51 +0100 Subject: [PATCH] Updates --- .../functions/backend/db/grab-parsed-value.js | 18 ++++------------ .../functions/backend/db/grab-parsed-value.ts | 21 ++++++------------- package.json | 2 +- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/dist/package-shared/functions/backend/db/grab-parsed-value.js b/dist/package-shared/functions/backend/db/grab-parsed-value.js index 79f57e6..dbc786c 100644 --- a/dist/package-shared/functions/backend/db/grab-parsed-value.js +++ b/dist/package-shared/functions/backend/db/grab-parsed-value.js @@ -23,7 +23,7 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da if (typeof newValue == "undefined") return; if (typeof newValue == "object" && !newValue) - newValue = ""; + newValue = null; const htmlRegex = /<[^>]+>/g; if ((targetFieldSchema === null || targetFieldSchema === void 0 ? void 0 : targetFieldSchema.richText) || String(newValue).match(htmlRegex)) { newValue = (0, sanitize_html_1.default)(newValue, sanitizeHtmlOptions_1.default); @@ -50,19 +50,9 @@ function grabParsedValue({ value, tableSchema, encryptionKey, encryptionSalt, da newValue = ""; } } - if (typeof newValue === "string" && newValue.match(/^null$/i)) { - newValue = { - toSqlString: function () { - return "NULL"; - }, - }; - } - if (typeof newValue === "string" && !newValue.match(/./i)) { - newValue = { - toSqlString: function () { - return "NULL"; - }, - }; + if (typeof newValue === "string" && + (newValue.match(/^null$/i) || !newValue.match(/./i))) { + newValue = null; } return newValue; } diff --git a/package-shared/functions/backend/db/grab-parsed-value.ts b/package-shared/functions/backend/db/grab-parsed-value.ts index 4be0fd3..0a25eba 100644 --- a/package-shared/functions/backend/db/grab-parsed-value.ts +++ b/package-shared/functions/backend/db/grab-parsed-value.ts @@ -34,7 +34,7 @@ export default function grabParsedValue({ : null; if (typeof newValue == "undefined") return; - if (typeof newValue == "object" && !newValue) newValue = ""; + if (typeof newValue == "object" && !newValue) newValue = null; const htmlRegex = /<[^>]+>/g; @@ -73,20 +73,11 @@ export default function grabParsedValue({ } } - if (typeof newValue === "string" && newValue.match(/^null$/i)) { - newValue = { - toSqlString: function () { - return "NULL"; - }, - }; - } - - if (typeof newValue === "string" && !newValue.match(/./i)) { - newValue = { - toSqlString: function () { - return "NULL"; - }, - }; + if ( + typeof newValue === "string" && + (newValue.match(/^null$/i) || !newValue.match(/./i)) + ) { + newValue = null; } return newValue; diff --git a/package.json b/package.json index b500b13..6c5e694 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "5.0.7", + "version": "5.0.8", "description": "Cloud-based SQL data management tool", "main": "dist/index.js", "bin": {