From af10193ecc6110843e3d5b121602d97aff885e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Sun, 14 Dec 2025 19:02:35 -0500 Subject: [PATCH] creation snake_case to camelCase convertor for create and update --- frontend-web-free/src/api/krowSDK.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend-web-free/src/api/krowSDK.js b/frontend-web-free/src/api/krowSDK.js index 4f9c2f0b..93a31ed3 100644 --- a/frontend-web-free/src/api/krowSDK.js +++ b/frontend-web-free/src/api/krowSDK.js @@ -358,6 +358,21 @@ const normalizeResultToArray = (res) => { // --- Entities Module ( Data Connect, without REST Base44) --- const entitiesModule = {}; +// --- Helper to convert snake_case to camelCase recursively --- +const toCamel = (value) => { + if (Array.isArray(value)) { + return value.map(toCamel); + } + if (value && typeof value === "object") { + return Object.entries(value).reduce((acc, [key, val]) => { + const camelKey = key.replace(/_([a-z])/g, (_, c) => c.toUpperCase()); + acc[camelKey] = toCamel(val); + return acc; + }, {}); + } + return value; +}; + Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { entitiesModule[entityName] = { @@ -510,6 +525,9 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { payload = params; } + //converting to camelCase for data connect + payload = toCamel(payload); + return fn(dataConnect, payload); }, }), @@ -560,6 +578,9 @@ Object.entries(dataconnectEntityConfig).forEach(([entityName, ops]) => { ); } + if (data && typeof data === "object") { + data = toCamel(data); + } const vars = { id, ...data }; return fn(dataConnect, vars);