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:
martmull
2024-01-03 18:09:57 +01:00
committed by GitHub
parent 4ebaacc306
commit 65250839fb
36 changed files with 1040 additions and 209 deletions

View File

@ -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 ', '