mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -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',
|
||||
icon: 'file:typeform.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
version: [1, 1.1],
|
||||
subtitle: '=Form ID: {{$parameter["formId"]}}',
|
||||
description: 'Starts the workflow on a Typeform form submission',
|
||||
defaults: {
|
||||
|
@ -220,6 +220,7 @@ export class TypeformTrigger implements INodeType {
|
|||
};
|
||||
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const version = this.getNode().typeVersion;
|
||||
const bodyData = this.getBodyData();
|
||||
|
||||
const simplifyAnswers = this.getNodeParameter('simplifyAnswers') as boolean;
|
||||
|
@ -278,7 +279,23 @@ export class TypeformTrigger implements INodeType {
|
|||
}
|
||||
|
||||
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 {
|
||||
workflowData: [this.helpers.returnJsonArray([answers as unknown as IDataObject])],
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue