* feat: wip refactor schema builder * feat: wip store types and first queries generation * feat: refactor schema-builder and resolver-builder * fix: clean & small type fix * fix: avoid breaking change * fix: remove util from pg-graphql classes * fix: required default fields * Refactor frontend accordingly --------- Co-authored-by: Charles Bochet <charles@twenty.com>
31 lines
887 B
TypeScript
31 lines
887 B
TypeScript
import { stringifyWithoutKeyQuote } from './stringify-without-key-quote.util';
|
|
|
|
export const generateArgsInput = (args: any) => {
|
|
let argsString = '';
|
|
|
|
for (const key in args) {
|
|
// Check if the value is not undefined
|
|
if (args[key] === undefined) {
|
|
continue;
|
|
}
|
|
|
|
if (typeof args[key] === 'string') {
|
|
// If it's a string, add quotes
|
|
argsString += `${key}: "${args[key]}", `;
|
|
} else if (typeof args[key] === 'object' && args[key] !== null) {
|
|
// If it's an object (and not null), stringify it
|
|
argsString += `${key}: ${stringifyWithoutKeyQuote(args[key])}, `;
|
|
} else {
|
|
// For other types (number, boolean), add as is
|
|
argsString += `${key}: ${args[key]}, `;
|
|
}
|
|
}
|
|
|
|
// Remove trailing comma and space, if present
|
|
if (argsString.endsWith(', ')) {
|
|
argsString = argsString.slice(0, -2);
|
|
}
|
|
|
|
return argsString;
|
|
};
|