2248 zapier integration implement typeorm eventsubscribers (#3122)
* Add new queue to twenty-server * Add triggers to zapier * Rename webhook operation * Use find one or fail * Use logger * Fix typescript templating * Add dedicated call webhook job * Update logging * Fix error handling
This commit is contained in:
@ -1,25 +1,29 @@
|
||||
const handleQueryParams = (inputData: { [x: string]: any }): string => {
|
||||
const formattedInputData: {[x:string]: any} = {};
|
||||
const formattedInputData: { [x: string]: any } = {};
|
||||
Object.keys(inputData).forEach((key) => {
|
||||
if(key.includes('__')) {
|
||||
const [objectKey, nestedObjectKey] = key.split('__')
|
||||
if (key.includes('__')) {
|
||||
const [objectKey, nestedObjectKey] = key.split('__');
|
||||
if (formattedInputData[objectKey]) {
|
||||
formattedInputData[objectKey][nestedObjectKey] = inputData[key]
|
||||
formattedInputData[objectKey][nestedObjectKey] = inputData[key];
|
||||
} else {
|
||||
formattedInputData[objectKey] = {[nestedObjectKey]: inputData[key]}
|
||||
formattedInputData[objectKey] = { [nestedObjectKey]: inputData[key] };
|
||||
}
|
||||
} else {
|
||||
formattedInputData[key]=inputData[key]
|
||||
formattedInputData[key] = inputData[key];
|
||||
}
|
||||
})
|
||||
});
|
||||
let result = '';
|
||||
Object.keys(formattedInputData).forEach((key) => {
|
||||
let quote = '';
|
||||
if (typeof formattedInputData[key]==='object') {
|
||||
result=result.concat(`${key}: {${handleQueryParams(formattedInputData[key])}}, `)
|
||||
if (typeof formattedInputData[key] === 'object') {
|
||||
result = result.concat(
|
||||
`${key}: {${handleQueryParams(formattedInputData[key])}}, `,
|
||||
);
|
||||
} else {
|
||||
if (typeof formattedInputData[key] === 'string') quote = '"';
|
||||
result = result.concat(`${key}: ${quote}${formattedInputData[key]}${quote}, `);
|
||||
if (typeof formattedInputData[key] === 'string') quote = '"';
|
||||
result = result.concat(
|
||||
`${key}: ${quote}${formattedInputData[key]}${quote}, `,
|
||||
);
|
||||
}
|
||||
});
|
||||
if (result.length) result = result.slice(0, -2); // Remove the last ', '
|
||||
|
||||
Reference in New Issue
Block a user