mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(Typeform Trigger Node): Change output format for TypeForm trigger to object instead of array (#7315)
Github issue / Community forum post (link here to close automatically): --------- Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
3aac22b4c1
commit
b3fc00e045
|
@ -25,7 +25,7 @@ export class TypeformTrigger implements INodeType {
|
||||||
name: 'typeformTrigger',
|
name: 'typeformTrigger',
|
||||||
icon: 'file:typeform.svg',
|
icon: 'file:typeform.svg',
|
||||||
group: ['trigger'],
|
group: ['trigger'],
|
||||||
version: 1,
|
version: [1, 1.1],
|
||||||
subtitle: '=Form ID: {{$parameter["formId"]}}',
|
subtitle: '=Form ID: {{$parameter["formId"]}}',
|
||||||
description: 'Starts the workflow on a Typeform form submission',
|
description: 'Starts the workflow on a Typeform form submission',
|
||||||
defaults: {
|
defaults: {
|
||||||
|
@ -220,6 +220,7 @@ export class TypeformTrigger implements INodeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||||
|
const version = this.getNode().typeVersion;
|
||||||
const bodyData = this.getBodyData();
|
const bodyData = this.getBodyData();
|
||||||
|
|
||||||
const simplifyAnswers = this.getNodeParameter('simplifyAnswers') as boolean;
|
const simplifyAnswers = this.getNodeParameter('simplifyAnswers') as boolean;
|
||||||
|
@ -278,7 +279,23 @@ export class TypeformTrigger implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onlyAnswers) {
|
if (onlyAnswers) {
|
||||||
// Return only the answer
|
// Return only the answers
|
||||||
|
if (version >= 1.1) {
|
||||||
|
return {
|
||||||
|
workflowData: [
|
||||||
|
this.helpers.returnJsonArray([
|
||||||
|
answers.reduce(
|
||||||
|
(acc, answer) => {
|
||||||
|
acc[answer.field.id] = answer;
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, ITypeformAnswer>,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
workflowData: [this.helpers.returnJsonArray([answers as unknown as IDataObject])],
|
workflowData: [this.helpers.returnJsonArray([answers as unknown as IDataObject])],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue