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,19 +1,19 @@
import { labelling } from "../utils/labelling";
import { labelling } from '../utils/labelling';
type Infos = {
properties: {
[field: string]: {
type: string;
properties?: { [field: string]: { type: string } }
items?: { [$ref: string]: string }
}
},
example: object,
required: string[]
}
properties?: { [field: string]: { type: string } };
items?: { [$ref: string]: string };
};
};
example: object;
required: string[];
};
export const computeInputFields = (infos: Infos): object[] => {
const result = []
const result = [];
for (const fieldName of Object.keys(infos.properties)) {
switch (infos.properties[fieldName].type) {
@ -23,17 +23,19 @@ export const computeInputFields = (infos: Infos): object[] => {
if (!infos.properties[fieldName].properties) {
break;
}
for (const subFieldName of Object.keys(infos.properties[fieldName].properties || {})) {
for (const subFieldName of Object.keys(
infos.properties[fieldName].properties || {},
)) {
const field = {
key: `${fieldName}__${subFieldName}`,
label: `${labelling(fieldName)}: ${labelling(subFieldName)}`,
type: infos.properties[fieldName].properties?.[subFieldName].type,
required: false,
}
};
if (infos.required?.includes(fieldName)) {
field.required = true
field.required = true;
}
result.push(field)
result.push(field);
}
break;
default:
@ -42,13 +44,13 @@ export const computeInputFields = (infos: Infos): object[] => {
label: labelling(fieldName),
type: infos.properties[fieldName].type,
required: false,
}
};
if (infos.required?.includes(fieldName)) {
field.required = true
field.required = true;
}
result.push(field)
result.push(field);
}
}
return result
}
return result;
};