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,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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user