Small improvements to Affinity-Node

This commit is contained in:
Jan Oberhauser
2020-03-08 22:16:06 +01:00
parent 34d6d001d3
commit 4560d02823
4 changed files with 12 additions and 35 deletions

View File

@@ -98,10 +98,6 @@ export class AffinityTrigger implements INodeType {
name: 'list_entry.created',
value: 'list_entry.created',
},
{
name: 'list_entry.updated',
value: 'list_entry.updated',
},
{
name: 'list_entry.deleted',
value: 'list_entry.deleted',
@@ -159,13 +155,6 @@ export class AffinityTrigger implements INodeType {
required: true,
description: 'Webhook events that will be enabled for that endpoint.',
},
{
displayName: 'Resolve Data',
name: 'resolveData',
type: 'boolean',
default: true,
description: 'By default does the webhook-data only contain the ID of the object.<br />If this option gets activated it will resolve the data automatically.',
},
],
};
@@ -239,25 +228,15 @@ export class AffinityTrigger implements INodeType {
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const bodyData = this.getBodyData();
const resolveData = this.getNodeParameter('resolveData', false) as boolean;
if (bodyData.type === 'sample.webhook') {
return {}
}
if (resolveData === false) {
// Return the data as it got received
return {
workflowData: [
this.helpers.returnJsonArray(bodyData),
],
};
return {};
}
let responseData: IDataObject = {};
if (bodyData.type && bodyData.body) {
const resource = (bodyData.type as string).split('.')[0]
const resource = (bodyData.type as string).split('.')[0];
//@ts-ignore
const id = bodyData.body.id;
responseData = await affinityApiRequest.call(this, 'GET', `/${mapResource(resource)}/${id}`);