n8n-nodes-base 1.95.1 → 1.96.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/credentials/PerplexityApi.credentials.js +1 -1
  2. package/dist/credentials/PerplexityApi.credentials.js.map +1 -1
  3. package/dist/nodes/Adalo/__schema__/v1.0.0/collection/getAll.json +21 -0
  4. package/dist/nodes/Airtable/test/v2/node/helpers.js +12 -2
  5. package/dist/nodes/Airtable/test/v2/node/helpers.js.map +1 -1
  6. package/dist/nodes/Airtop/__schema__/v1.0.0/extraction/query.json +7 -1
  7. package/dist/nodes/Airtop/__schema__/v1.0.0/session/create.json +9 -0
  8. package/dist/nodes/Airtop/__schema__/v1.0.0/window/create.json +40 -0
  9. package/dist/nodes/Airtop/test/node/helpers.js +12 -2
  10. package/dist/nodes/Airtop/test/node/helpers.js.map +1 -1
  11. package/dist/nodes/Asana/__schema__/v1.0.0/subtask/getAll.json +4 -1
  12. package/dist/nodes/Aws/S3/__schema__/v2.0.0/file/getAll.json +7 -1
  13. package/dist/nodes/Aws/S3/__schema__/v2.0.0/folder/getAll.json +7 -1
  14. package/dist/nodes/BambooHr/__schema__/v1.0.0/employee/getAll.json +1 -4
  15. package/dist/nodes/ClickUp/__schema__/v1.0.0/list/customFields.json +23 -1
  16. package/dist/nodes/Code/Pyodide.js +24 -0
  17. package/dist/nodes/Code/Pyodide.js.map +1 -1
  18. package/dist/nodes/CompareDatasets/GenericFunctions.js +5 -5
  19. package/dist/nodes/CompareDatasets/GenericFunctions.js.map +1 -1
  20. package/dist/nodes/Discord/__schema__/v2.0.0/message/sendAndWait.json +14 -0
  21. package/dist/nodes/Discord/v2/helpers/utils.js +2 -2
  22. package/dist/nodes/Discord/v2/helpers/utils.js.map +1 -1
  23. package/dist/nodes/Dropbox/__schema__/v1.0.0/file/download.json +31 -1
  24. package/dist/nodes/Dropcontact/__schema__/v1.0.0/contact/enrich.json +15 -1
  25. package/dist/nodes/Dropcontact/__schema__/v1.0.0/contact/fetchRequest.json +50 -0
  26. package/dist/nodes/EmailReadImap/v2/utils.js +16 -3
  27. package/dist/nodes/EmailReadImap/v2/utils.js.map +1 -1
  28. package/dist/nodes/EmailSend/__schema__/v2.1.0/email/send.json +1 -7
  29. package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js +1 -1
  30. package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js.map +1 -1
  31. package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js +2 -2
  32. package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js.map +1 -1
  33. package/dist/nodes/Form/Form.node.js +3 -3
  34. package/dist/nodes/Form/Form.node.js.map +1 -1
  35. package/dist/nodes/Form/utils/formCompletionUtils.js.map +1 -0
  36. package/dist/nodes/Form/utils/formNodeUtils.js.map +1 -0
  37. package/dist/nodes/Form/{utils.js → utils/utils.js} +21 -7
  38. package/dist/nodes/Form/utils/utils.js.map +1 -0
  39. package/dist/nodes/Form/v1/FormTriggerV1.node.js +1 -1
  40. package/dist/nodes/Form/v1/FormTriggerV1.node.js.map +1 -1
  41. package/dist/nodes/Form/v2/FormTriggerV2.node.js +1 -1
  42. package/dist/nodes/Form/v2/FormTriggerV2.node.js.map +1 -1
  43. package/dist/nodes/Freshservice/GenericFunctions.js +12 -2
  44. package/dist/nodes/Freshservice/GenericFunctions.js.map +1 -1
  45. package/dist/nodes/Google/Ads/__schema__/v1.0.0/campaign/getAll.json +13 -1
  46. package/dist/nodes/Google/Analytics/__schema__/v2.0.0/report/get.json +1 -4
  47. package/dist/nodes/Google/Calendar/__schema__/v1.3.0/event/getAll.json +1 -4
  48. package/dist/nodes/Google/Chat/__schema__/v1.0.0/message/create.json +30 -1
  49. package/dist/nodes/Google/Drive/__schema__/v3.0.0/file/upload.json +4 -1
  50. package/dist/nodes/Google/Drive/test/v2/node/helpers.js +12 -2
  51. package/dist/nodes/Google/Drive/test/v2/node/helpers.js.map +1 -1
  52. package/dist/nodes/Google/Firebase/CloudFirestore/__schema__/v1.1.0/document/query.json +1 -7
  53. package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/addLabels.json +13 -1
  54. package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/get.json +1 -7
  55. package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/markAsRead.json +13 -1
  56. package/dist/nodes/Google/Gmail/__schema__/v2.1.0/thread/addLabels.json +16 -1
  57. package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js +10 -4
  58. package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js.map +1 -1
  59. package/dist/nodes/HaloPSA/__schema__/v1.0.0/ticket/getAll.json +1 -268
  60. package/dist/nodes/HttpRequest/shared/optimizeResponse.js +5 -3
  61. package/dist/nodes/HttpRequest/shared/optimizeResponse.js.map +1 -1
  62. package/dist/nodes/Hubspot/__schema__/v2.1.0/company/getAll.json +1 -4
  63. package/dist/nodes/Hubspot/__schema__/v2.1.0/deal/getAll.json +64 -1
  64. package/dist/nodes/Hubspot/__schema__/v2.1.0/deal/search.json +1 -4
  65. package/dist/nodes/Hubspot/__schema__/v2.1.0/ticket/get.json +1 -61
  66. package/dist/nodes/JinaAI/__schema__/v1.0.0/reader/read.json +26 -0
  67. package/dist/nodes/Jira/__schema__/v1.0.0/issue/get.json +604 -7
  68. package/dist/nodes/Jira/__schema__/v1.0.0/issue/getAll.json +1 -110
  69. package/dist/nodes/Lemlist/__schema__/v2.0.0/lead/create.json +1 -4
  70. package/dist/nodes/Lemlist/__schema__/v2.0.0/lead/get.json +30 -0
  71. package/dist/nodes/Line/__schema__/v1.0.0/notification/send.json +4 -7
  72. package/dist/nodes/Linear/__schema__/v1.0.0/issue/getAll.json +12 -1
  73. package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js +23 -3
  74. package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js.map +1 -1
  75. package/dist/nodes/Microsoft/Entra/__schema__/v1.0.0/user/getAll.json +1 -7
  76. package/dist/nodes/Microsoft/Entra/descriptions/GroupDescription.js +12 -2
  77. package/dist/nodes/Microsoft/Entra/descriptions/GroupDescription.js.map +1 -1
  78. package/dist/nodes/Microsoft/Entra/descriptions/UserDescription.js +13 -3
  79. package/dist/nodes/Microsoft/Entra/descriptions/UserDescription.js.map +1 -1
  80. package/dist/nodes/Microsoft/OneDrive/__schema__/v1.0.0/file/download.json +23 -10
  81. package/dist/nodes/Microsoft/OneDrive/__schema__/v1.0.0/folder/create.json +1 -15
  82. package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/event/getAll.json +1 -4
  83. package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/folderMessage/getAll.json +124 -1
  84. package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/message/getAll.json +1 -56
  85. package/dist/nodes/Microsoft/Sql/MicrosoftSql.node.js +12 -2
  86. package/dist/nodes/Microsoft/Sql/MicrosoftSql.node.js.map +1 -1
  87. package/dist/nodes/Microsoft/Storage/__schema__/v1.0.0/blob/create.json +39 -0
  88. package/dist/nodes/Microsoft/Storage/__schema__/v1.0.0/blob/get.json +44 -0
  89. package/dist/nodes/Microsoft/ToDo/__schema__/v1.0.0/task/getAll.json +5 -21
  90. package/dist/nodes/N8n/WorkflowDescription.js +40 -0
  91. package/dist/nodes/N8n/WorkflowDescription.js.map +1 -1
  92. package/dist/nodes/Nasa/__schema__/v1.0.0/donkiSolarFlare/get.json +1 -4
  93. package/dist/nodes/Notion/__schema__/v2.2.0/database/get.json +2 -149
  94. package/dist/nodes/Odoo/__schema__/v1.0.0/contact/get.json +1 -4
  95. package/dist/nodes/Odoo/__schema__/v1.0.0/contact/getAll.json +1 -10
  96. package/dist/nodes/Odoo/__schema__/v1.0.0/opportunity/getAll.json +1 -40
  97. package/dist/nodes/OpenAi/__schema__/v1.1.0/chat/complete.json +29 -1
  98. package/dist/nodes/Pipedrive/__schema__/v1.0.0/person/search.json +7 -1
  99. package/dist/nodes/QuickBase/__schema__/v1.0.0/record/getAll.json +9 -0
  100. package/dist/nodes/QuickBooks/__schema__/v1.0.0/transaction/getReport.json +4 -1
  101. package/dist/nodes/RssFeedRead/RssFeedRead.node.js +9 -3
  102. package/dist/nodes/RssFeedRead/RssFeedRead.node.js.map +1 -1
  103. package/dist/nodes/S3/__schema__/v1.0.0/file/download.json +21 -0
  104. package/dist/nodes/Salesforce/__schema__/v1.0.0/customObject/getAll.json +1 -4
  105. package/dist/nodes/Salesforce/__schema__/v1.0.0/lead/getAll.json +1 -4
  106. package/dist/nodes/Salesforce/__schema__/v1.0.0/opportunity/getAll.json +1 -4
  107. package/dist/nodes/Salesforce/__schema__/v1.0.0/search/query.json +1 -4
  108. package/dist/nodes/Shopify/__schema__/v1.0.0/order/getAll.json +250 -3
  109. package/dist/nodes/Slack/__schema__/v2.3.0/channel/history.json +1 -50
  110. package/dist/nodes/Slack/__schema__/v2.3.0/channel/member.json +168 -2
  111. package/dist/nodes/Slack/__schema__/v2.3.0/message/post.json +1 -4
  112. package/dist/nodes/Sms77/__schema__/v1.0.0/sms/send.json +1 -10
  113. package/dist/nodes/Strapi/__schema__/v1.0.0/entry/getAll.json +10 -1
  114. package/dist/nodes/Telegram/__schema__/v1.2.0/chat/member.json +1 -4
  115. package/dist/nodes/Telegram/__schema__/v1.2.0/message/editMessageText.json +4 -1
  116. package/dist/nodes/Telegram/__schema__/v1.2.0/message/sendAndWait.json +14 -0
  117. package/dist/nodes/Telegram/__schema__/v1.2.0/message/sendMessage.json +4 -21
  118. package/dist/nodes/Telegram/__schema__/v1.2.0/message/sendPhoto.json +1 -7
  119. package/dist/nodes/Telegram/tests/Helpers.js +12 -2
  120. package/dist/nodes/Telegram/tests/Helpers.js.map +1 -1
  121. package/dist/nodes/Transform/RemoveDuplicates/utils.js +8 -6
  122. package/dist/nodes/Transform/RemoveDuplicates/utils.js.map +1 -1
  123. package/dist/nodes/Trello/__schema__/v1.0.0/list/getAll.json +1 -4
  124. package/dist/nodes/Trello/__schema__/v1.0.0/list/getCards.json +1 -4
  125. package/dist/nodes/Twitter/__schema__/v2.0.0/tweet/search.json +7 -1
  126. package/dist/nodes/Wait/Wait.node.js +1 -1
  127. package/dist/nodes/Wait/Wait.node.js.map +1 -1
  128. package/dist/nodes/Wordpress/__schema__/v1.0.0/post/get.json +1 -7
  129. package/dist/nodes/Zoho/__schema__/v1.0.0/contact/getAll.json +1 -4
  130. package/dist/nodes/Zoho/__schema__/v1.0.0/lead/getAll.json +99 -1
  131. package/dist/test/nodes/Helpers.js +12 -2
  132. package/dist/test/nodes/Helpers.js.map +1 -1
  133. package/dist/types/credentials.json +1 -1
  134. package/dist/types/nodes.json +13 -13
  135. package/dist/utils/binary.js +12 -9
  136. package/dist/utils/binary.js.map +1 -1
  137. package/dist/utils/sendAndWait/utils.js +21 -6
  138. package/dist/utils/sendAndWait/utils.js.map +1 -1
  139. package/dist/utils/utilities.js +31 -16
  140. package/dist/utils/utilities.js.map +1 -1
  141. package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js +2 -2
  142. package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js.map +1 -1
  143. package/package.json +9 -9
  144. package/dist/nodes/Form/formCompletionUtils.js.map +0 -1
  145. package/dist/nodes/Form/formNodeUtils.js.map +0 -1
  146. package/dist/nodes/Form/utils.js.map +0 -1
  147. /package/dist/nodes/Form/{formCompletionUtils.js → utils/formCompletionUtils.js} +0 -0
  148. /package/dist/nodes/Form/{formNodeUtils.js → utils/formNodeUtils.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/Discord/v2/helpers/utils.ts"],"sourcesContent":["import FormData from 'form-data';\nimport { isEmpty } from 'lodash';\nimport { extension } from 'mime-types';\nimport type {\n\tIBinaryKeyData,\n\tIDataObject,\n\tIExecuteFunctions,\n\tINode,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { jsonParse, NodeApiError, NodeOperationError } from 'n8n-workflow';\n\nimport { getSendAndWaitConfig } from '../../../../utils/sendAndWait/utils';\nimport { capitalize, createUtmCampaignLink } from '../../../../utils/utilities';\nimport { discordApiMultiPartRequest, discordApiRequest } from '../transport';\n\nexport const createSimplifyFunction =\n\t(includedFields: string[]) =>\n\t(item: IDataObject): IDataObject => {\n\t\tconst result: IDataObject = {};\n\n\t\tfor (const field of includedFields) {\n\t\t\tif (item[field] === undefined) continue;\n\n\t\t\tresult[field] = item[field];\n\t\t}\n\n\t\treturn result;\n\t};\n\nexport function parseDiscordError(this: IExecuteFunctions, error: any, itemIndex = 0) {\n\tlet errorData = error.cause.error;\n\tconst errorOptions: IDataObject = { itemIndex };\n\n\tif (!errorData && error.description) {\n\t\ttry {\n\t\t\tconst errorString = (error.description as string).split(' - ')[1];\n\t\t\tif (errorString) {\n\t\t\t\terrorData = jsonParse(errorString);\n\t\t\t}\n\t\t} catch (err) {}\n\t}\n\n\tif (errorData?.message) {\n\t\terrorOptions.message = errorData.message;\n\t}\n\n\tif ((error?.message as string)?.toLowerCase()?.includes('bad request') && errorData) {\n\t\tif (errorData?.message) {\n\t\t\terrorOptions.message = errorData.message;\n\t\t}\n\n\t\tif (errorData?.errors?.embeds) {\n\t\t\tconst embedErrors = errorData.errors.embeds?.[0];\n\t\t\tconst embedErrorsKeys = Object.keys(embedErrors).map((key) => capitalize(key));\n\n\t\t\tif (embedErrorsKeys.length) {\n\t\t\t\tconst message =\n\t\t\t\t\tembedErrorsKeys.length === 1\n\t\t\t\t\t\t? `The parameter ${embedErrorsKeys[0]} is not properly formatted`\n\t\t\t\t\t\t: `The parameters ${embedErrorsKeys.join(', ')} are not properly formatted`;\n\t\t\t\terrorOptions.message = message;\n\t\t\t\terrorOptions.description = 'Review the formatting or clear it';\n\t\t\t}\n\n\t\t\treturn new NodeOperationError(this.getNode(), errorData.errors, errorOptions);\n\t\t}\n\n\t\tif (errorData?.errors?.message_reference) {\n\t\t\terrorOptions.message = \"The message to reply to ID can't be found\";\n\t\t\terrorOptions.description =\n\t\t\t\t'Check the \"Message to Reply to\" parameter and remove it if you don\\'t want to reply to an existing message';\n\n\t\t\treturn new NodeOperationError(this.getNode(), errorData.errors, errorOptions);\n\t\t}\n\n\t\tif (errorOptions.message === 'Cannot send an empty message') {\n\t\t\terrorOptions.description =\n\t\t\t\t'Something has to be send to the channel whether it is a message, an embed or a file';\n\t\t}\n\t}\n\treturn new NodeOperationError(this.getNode(), errorData || error, errorOptions);\n}\n\nexport function prepareErrorData(this: IExecuteFunctions, error: any, i: number) {\n\tlet description = error.description;\n\n\ttry {\n\t\tdescription = JSON.parse(error.description as string);\n\t} catch (err) {}\n\n\treturn this.helpers.constructExecutionMetaData(\n\t\tthis.helpers.returnJsonArray({ error: error.message, description }),\n\t\t{ itemData: { item: i } },\n\t);\n}\n\nexport function prepareOptions(options: IDataObject, guildId?: string) {\n\tif (options.flags) {\n\t\tif ((options.flags as string[]).length === 2) {\n\t\t\toptions.flags = (1 << 2) + (1 << 12);\n\t\t} else if ((options.flags as string[]).includes('SUPPRESS_EMBEDS')) {\n\t\t\toptions.flags = 1 << 2;\n\t\t} else if ((options.flags as string[]).includes('SUPPRESS_NOTIFICATIONS')) {\n\t\t\toptions.flags = 1 << 12;\n\t\t}\n\t}\n\n\tif (options.message_reference) {\n\t\toptions.message_reference = {\n\t\t\tmessage_id: options.message_reference,\n\t\t\tguild_id: guildId,\n\t\t};\n\t}\n\n\treturn options;\n}\n\nexport function prepareEmbeds(this: IExecuteFunctions, embeds: IDataObject[]) {\n\treturn embeds\n\t\t.map((embed) => {\n\t\t\tlet embedReturnData: IDataObject = {};\n\n\t\t\tif (embed.inputMethod === 'json') {\n\t\t\t\tif (typeof embed.json === 'object') {\n\t\t\t\t\tembedReturnData = embed.json as IDataObject;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tembedReturnData = jsonParse(embed.json as string);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Not a valid JSON', error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete embed.inputMethod;\n\n\t\t\t\tfor (const key of Object.keys(embed)) {\n\t\t\t\t\tif (embed[key] !== '') {\n\t\t\t\t\t\tembedReturnData[key] = embed[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (embedReturnData.author) {\n\t\t\t\tembedReturnData.author = {\n\t\t\t\t\tname: embedReturnData.author,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.color && typeof embedReturnData.color === 'string') {\n\t\t\t\tembedReturnData.color = parseInt(embedReturnData.color.replace('#', ''), 16);\n\t\t\t}\n\t\t\tif (embedReturnData.video) {\n\t\t\t\tembedReturnData.video = {\n\t\t\t\t\turl: embedReturnData.video,\n\t\t\t\t\twidth: 1270,\n\t\t\t\t\theight: 720,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.thumbnail) {\n\t\t\t\tembedReturnData.thumbnail = {\n\t\t\t\t\turl: embedReturnData.thumbnail,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.image) {\n\t\t\t\tembedReturnData.image = {\n\t\t\t\t\turl: embedReturnData.image,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn embedReturnData;\n\t\t})\n\t\t.filter((embed) => !isEmpty(embed));\n}\n\nexport async function prepareMultiPartForm(\n\tthis: IExecuteFunctions,\n\titems: INodeExecutionData[],\n\tfiles: IDataObject[],\n\tjsonPayload: IDataObject,\n\ti: number,\n) {\n\tconst multiPartBody = new FormData();\n\tconst attachments: IDataObject[] = [];\n\tconst filesData: IDataObject[] = [];\n\n\tfor (const [index, file] of files.entries()) {\n\t\tconst binaryData = (items[i].binary as IBinaryKeyData)?.[file.inputFieldName as string];\n\n\t\tif (!binaryData) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`Input item [${i}] does not contain binary data on property ${file.inputFieldName}`,\n\t\t\t);\n\t\t}\n\n\t\tlet filename = binaryData.fileName as string;\n\n\t\tif (!filename.includes('.')) {\n\t\t\tif (binaryData.fileExtension) {\n\t\t\t\tfilename += `.${binaryData.fileExtension}`;\n\t\t\t}\n\t\t\tif (binaryData.mimeType) {\n\t\t\t\tfilename += `.${extension(binaryData.mimeType)}`;\n\t\t\t}\n\t\t}\n\n\t\tattachments.push({\n\t\t\tid: index,\n\t\t\tfilename,\n\t\t});\n\n\t\tfilesData.push({\n\t\t\tdata: await this.helpers.getBinaryDataBuffer(i, file.inputFieldName as string),\n\t\t\tname: filename,\n\t\t\tmime: binaryData.mimeType,\n\t\t});\n\t}\n\n\tmultiPartBody.append('payload_json', JSON.stringify({ ...jsonPayload, attachments }), {\n\t\tcontentType: 'application/json',\n\t});\n\n\tfor (const [index, binaryData] of filesData.entries()) {\n\t\tmultiPartBody.append(`files[${index}]`, binaryData.data, {\n\t\t\tcontentType: binaryData.name as string,\n\t\t\tfilename: binaryData.mime as string,\n\t\t});\n\t}\n\n\treturn multiPartBody;\n}\n\nexport function checkAccessToGuild(\n\tnode: INode,\n\tguildId: string,\n\tuserGuilds: IDataObject[],\n\titemIndex = 0,\n) {\n\tif (!userGuilds.some((guild) => guild.id === guildId)) {\n\t\tthrow new NodeOperationError(\n\t\t\tnode,\n\t\t\t`You do not have access to the guild with the id ${guildId}`,\n\t\t\t{\n\t\t\t\titemIndex,\n\t\t\t\tlevel: 'warning',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport async function checkAccessToChannel(\n\tthis: IExecuteFunctions,\n\tchannelId: string,\n\tuserGuilds: IDataObject[],\n\titemIndex = 0,\n) {\n\tlet guildId = '';\n\n\ttry {\n\t\tconst channel = await discordApiRequest.call(this, 'GET', `/channels/${channelId}`);\n\t\tguildId = channel.guild_id;\n\t} catch (error) {}\n\n\tif (!guildId) {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\t`Could not find server for channel with the id ${channelId}`,\n\t\t\t{\n\t\t\t\titemIndex,\n\t\t\t},\n\t\t);\n\t}\n\n\tcheckAccessToGuild(this.getNode(), guildId, userGuilds, itemIndex);\n}\n\nexport async function setupChannelGetter(this: IExecuteFunctions, userGuilds: IDataObject[]) {\n\tconst isOAuth2 = this.getNodeParameter('authentication', 0) === 'oAuth2';\n\n\treturn async (i: number) => {\n\t\tconst channelId = this.getNodeParameter('channelId', i, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\n\t\tif (isOAuth2) await checkAccessToChannel.call(this, channelId, userGuilds, i);\n\n\t\treturn channelId;\n\t};\n}\n\nexport async function sendDiscordMessage(\n\tthis: IExecuteFunctions,\n\t{\n\t\tguildId,\n\t\tuserGuilds,\n\t\tisOAuth2,\n\t\tbody,\n\t\titems,\n\t\tfiles = [],\n\t\titemIndex = 0,\n\t}: {\n\t\tguildId: string;\n\t\tuserGuilds: IDataObject[];\n\t\tisOAuth2: boolean;\n\t\tbody: IDataObject;\n\t\titems: INodeExecutionData[];\n\t\tfiles?: IDataObject[];\n\t\titemIndex?: number;\n\t},\n) {\n\tconst sendTo = this.getNodeParameter('sendTo', itemIndex) as string;\n\n\tlet channelId = '';\n\n\tif (sendTo === 'user') {\n\t\tconst userId = this.getNodeParameter('userId', itemIndex, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\n\t\tif (isOAuth2) {\n\t\t\ttry {\n\t\t\t\tawait discordApiRequest.call(this, 'GET', `/guilds/${guildId}/members/${userId}`);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof NodeApiError && error.httpCode === '404') {\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t`User with the id ${userId} is not a member of the selected guild`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\t\titemIndex,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tchannelId = (\n\t\t\t(await discordApiRequest.call(this, 'POST', '/users/@me/channels', {\n\t\t\t\trecipient_id: userId,\n\t\t\t})) as IDataObject\n\t\t).id as string;\n\n\t\tif (!channelId) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Could not create a channel to send direct message to',\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t}\n\n\tif (sendTo === 'channel') {\n\t\tchannelId = this.getNodeParameter('channelId', itemIndex, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\t}\n\n\tif (isOAuth2 && sendTo !== 'user') {\n\t\tawait checkAccessToChannel.call(this, channelId, userGuilds, itemIndex);\n\t}\n\n\tif (!channelId) {\n\t\tthrow new NodeOperationError(this.getNode(), 'Channel ID is required', {\n\t\t\titemIndex,\n\t\t});\n\t}\n\n\tlet response: IDataObject[] = [];\n\n\tif (files?.length) {\n\t\tconst multiPartBody = await prepareMultiPartForm.call(this, items, files, body, itemIndex);\n\n\t\tresponse = await discordApiMultiPartRequest.call(\n\t\t\tthis,\n\t\t\t'POST',\n\t\t\t`/channels/${channelId}/messages`,\n\t\t\tmultiPartBody,\n\t\t);\n\t} else {\n\t\tresponse = await discordApiRequest.call(this, 'POST', `/channels/${channelId}/messages`, body);\n\t}\n\n\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\tthis.helpers.returnJsonArray(response),\n\t\t{ itemData: { item: itemIndex } },\n\t);\n\n\treturn executionData;\n}\n\nexport function createSendAndWaitMessageBody(context: IExecuteFunctions) {\n\tconst config = getSendAndWaitConfig(context);\n\tlet description = config.message;\n\tif (config.appendAttribution !== false) {\n\t\tconst instanceId = context.getInstanceId();\n\t\tconst attributionText = 'This message was sent automatically with ';\n\t\tconst link = createUtmCampaignLink('n8n-nodes-base.discord', instanceId);\n\t\tdescription = `${config.message}\\n\\n_${attributionText}_[n8n](${link})`;\n\t}\n\n\tconst body = {\n\t\tembeds: [\n\t\t\t{\n\t\t\t\tdescription,\n\t\t\t\tcolor: 5814783,\n\t\t\t},\n\t\t],\n\t\tcomponents: [\n\t\t\t{\n\t\t\t\ttype: 1,\n\t\t\t\tcomponents: config.options.map((option) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\tstyle: 5,\n\t\t\t\t\t\tlabel: option.label,\n\t\t\t\t\t\turl: `${config.url}?approved=${option.value}`,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t};\n\n\treturn body;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AACrB,oBAAwB;AACxB,wBAA0B;AAQ1B,0BAA4D;AAE5D,mBAAqC;AACrC,uBAAkD;AAClD,uBAA8D;AAEvD,MAAM,yBACZ,CAAC,mBACD,CAAC,SAAmC;AACnC,QAAM,SAAsB,CAAC;AAE7B,aAAW,SAAS,gBAAgB;AACnC,QAAI,KAAK,KAAK,MAAM,OAAW;AAE/B,WAAO,KAAK,IAAI,KAAK,KAAK;AAAA,EAC3B;AAEA,SAAO;AACR;AAEM,SAAS,kBAA2C,OAAY,YAAY,GAAG;AACrF,MAAI,YAAY,MAAM,MAAM;AAC5B,QAAM,eAA4B,EAAE,UAAU;AAE9C,MAAI,CAAC,aAAa,MAAM,aAAa;AACpC,QAAI;AACH,YAAM,cAAe,MAAM,YAAuB,MAAM,KAAK,EAAE,CAAC;AAChE,UAAI,aAAa;AAChB,wBAAY,+BAAU,WAAW;AAAA,MAClC;AAAA,IACD,SAAS,KAAK;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,WAAW,SAAS;AACvB,iBAAa,UAAU,UAAU;AAAA,EAClC;AAEA,MAAK,OAAO,SAAoB,YAAY,GAAG,SAAS,aAAa,KAA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AA,MAC3C;AAAA,MACA;AAAA,MACA,aAAa,SAAS;AAAA,MACtB;AAAA,IACD;AAAA,EACD,OAAO;AACN,eAAW,MAAM,mCAAkB,KAAK,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI;AAAA,EAC9F;AAEA,QAAM,gBAAgB,KAAK,QAAQ;AAAA,IAClC,KAAK,QAAQ,gBAAgB,QAAQ;AAAA,IACrC,EAAE,UAAU,EAAE,MAAM,UAAU,EAAE;AAAA,EACjC;AAEA,SAAO;AACR;AAEO,SAAS,6BAA6B,SAA4B;AACxE,QAAM,aAAS,mCAAqB,OAAO;AAC3C,MAAI,cAAc,OAAO;AACzB,MAAI,OAAO,sBAAsB,OAAO;AACvC,UAAM,aAAa,QAAQ,cAAc;AACzC,UAAM,kBAAkB;AACxB,UAAM,WAAO,wCAAsB,0BAA0B,UAAU;AACvE,kBAAc,GAAG,OAAO,OAAO;AAAA;AAAA,GAAQ,eAAe,UAAU,IAAI;AAAA,EACrE;AAEA,QAAM,OAAO;AAAA,IACZ,QAAQ;AAAA,MACP;AAAA,QACC;AAAA,QACA,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,YAAY;AAAA,MACX;AAAA,QACC,MAAM;AAAA,QACN,YAAY,OAAO,QAAQ,IAAI,CAAC,WAAW;AAC1C,iBAAO;AAAA,YACN,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,OAAO;AAAA,YACd,KAAK,GAAG,OAAO,GAAG,aAAa,OAAO,KAAK;AAAA,UAC5C;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;","names":["FormData"]}
1
+ {"version":3,"sources":["../../../../../nodes/Discord/v2/helpers/utils.ts"],"sourcesContent":["import FormData from 'form-data';\nimport isEmpty from 'lodash/isEmpty';\nimport { extension } from 'mime-types';\nimport type {\n\tIBinaryKeyData,\n\tIDataObject,\n\tIExecuteFunctions,\n\tINode,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { jsonParse, NodeApiError, NodeOperationError } from 'n8n-workflow';\n\nimport { getSendAndWaitConfig } from '../../../../utils/sendAndWait/utils';\nimport { capitalize, createUtmCampaignLink } from '../../../../utils/utilities';\nimport { discordApiMultiPartRequest, discordApiRequest } from '../transport';\n\nexport const createSimplifyFunction =\n\t(includedFields: string[]) =>\n\t(item: IDataObject): IDataObject => {\n\t\tconst result: IDataObject = {};\n\n\t\tfor (const field of includedFields) {\n\t\t\tif (item[field] === undefined) continue;\n\n\t\t\tresult[field] = item[field];\n\t\t}\n\n\t\treturn result;\n\t};\n\nexport function parseDiscordError(this: IExecuteFunctions, error: any, itemIndex = 0) {\n\tlet errorData = error.cause.error;\n\tconst errorOptions: IDataObject = { itemIndex };\n\n\tif (!errorData && error.description) {\n\t\ttry {\n\t\t\tconst errorString = (error.description as string).split(' - ')[1];\n\t\t\tif (errorString) {\n\t\t\t\terrorData = jsonParse(errorString);\n\t\t\t}\n\t\t} catch (err) {}\n\t}\n\n\tif (errorData?.message) {\n\t\terrorOptions.message = errorData.message;\n\t}\n\n\tif ((error?.message as string)?.toLowerCase()?.includes('bad request') && errorData) {\n\t\tif (errorData?.message) {\n\t\t\terrorOptions.message = errorData.message;\n\t\t}\n\n\t\tif (errorData?.errors?.embeds) {\n\t\t\tconst embedErrors = errorData.errors.embeds?.[0];\n\t\t\tconst embedErrorsKeys = Object.keys(embedErrors).map((key) => capitalize(key));\n\n\t\t\tif (embedErrorsKeys.length) {\n\t\t\t\tconst message =\n\t\t\t\t\tembedErrorsKeys.length === 1\n\t\t\t\t\t\t? `The parameter ${embedErrorsKeys[0]} is not properly formatted`\n\t\t\t\t\t\t: `The parameters ${embedErrorsKeys.join(', ')} are not properly formatted`;\n\t\t\t\terrorOptions.message = message;\n\t\t\t\terrorOptions.description = 'Review the formatting or clear it';\n\t\t\t}\n\n\t\t\treturn new NodeOperationError(this.getNode(), errorData.errors, errorOptions);\n\t\t}\n\n\t\tif (errorData?.errors?.message_reference) {\n\t\t\terrorOptions.message = \"The message to reply to ID can't be found\";\n\t\t\terrorOptions.description =\n\t\t\t\t'Check the \"Message to Reply to\" parameter and remove it if you don\\'t want to reply to an existing message';\n\n\t\t\treturn new NodeOperationError(this.getNode(), errorData.errors, errorOptions);\n\t\t}\n\n\t\tif (errorOptions.message === 'Cannot send an empty message') {\n\t\t\terrorOptions.description =\n\t\t\t\t'Something has to be send to the channel whether it is a message, an embed or a file';\n\t\t}\n\t}\n\treturn new NodeOperationError(this.getNode(), errorData || error, errorOptions);\n}\n\nexport function prepareErrorData(this: IExecuteFunctions, error: any, i: number) {\n\tlet description = error.description;\n\n\ttry {\n\t\tdescription = JSON.parse(error.description as string);\n\t} catch (err) {}\n\n\treturn this.helpers.constructExecutionMetaData(\n\t\tthis.helpers.returnJsonArray({ error: error.message, description }),\n\t\t{ itemData: { item: i } },\n\t);\n}\n\nexport function prepareOptions(options: IDataObject, guildId?: string) {\n\tif (options.flags) {\n\t\tif ((options.flags as string[]).length === 2) {\n\t\t\toptions.flags = (1 << 2) + (1 << 12);\n\t\t} else if ((options.flags as string[]).includes('SUPPRESS_EMBEDS')) {\n\t\t\toptions.flags = 1 << 2;\n\t\t} else if ((options.flags as string[]).includes('SUPPRESS_NOTIFICATIONS')) {\n\t\t\toptions.flags = 1 << 12;\n\t\t}\n\t}\n\n\tif (options.message_reference) {\n\t\toptions.message_reference = {\n\t\t\tmessage_id: options.message_reference,\n\t\t\tguild_id: guildId,\n\t\t};\n\t}\n\n\treturn options;\n}\n\nexport function prepareEmbeds(this: IExecuteFunctions, embeds: IDataObject[]) {\n\treturn embeds\n\t\t.map((embed) => {\n\t\t\tlet embedReturnData: IDataObject = {};\n\n\t\t\tif (embed.inputMethod === 'json') {\n\t\t\t\tif (typeof embed.json === 'object') {\n\t\t\t\t\tembedReturnData = embed.json as IDataObject;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tembedReturnData = jsonParse(embed.json as string);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Not a valid JSON', error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete embed.inputMethod;\n\n\t\t\t\tfor (const key of Object.keys(embed)) {\n\t\t\t\t\tif (embed[key] !== '') {\n\t\t\t\t\t\tembedReturnData[key] = embed[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (embedReturnData.author) {\n\t\t\t\tembedReturnData.author = {\n\t\t\t\t\tname: embedReturnData.author,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.color && typeof embedReturnData.color === 'string') {\n\t\t\t\tembedReturnData.color = parseInt(embedReturnData.color.replace('#', ''), 16);\n\t\t\t}\n\t\t\tif (embedReturnData.video) {\n\t\t\t\tembedReturnData.video = {\n\t\t\t\t\turl: embedReturnData.video,\n\t\t\t\t\twidth: 1270,\n\t\t\t\t\theight: 720,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.thumbnail) {\n\t\t\t\tembedReturnData.thumbnail = {\n\t\t\t\t\turl: embedReturnData.thumbnail,\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (embedReturnData.image) {\n\t\t\t\tembedReturnData.image = {\n\t\t\t\t\turl: embedReturnData.image,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn embedReturnData;\n\t\t})\n\t\t.filter((embed) => !isEmpty(embed));\n}\n\nexport async function prepareMultiPartForm(\n\tthis: IExecuteFunctions,\n\titems: INodeExecutionData[],\n\tfiles: IDataObject[],\n\tjsonPayload: IDataObject,\n\ti: number,\n) {\n\tconst multiPartBody = new FormData();\n\tconst attachments: IDataObject[] = [];\n\tconst filesData: IDataObject[] = [];\n\n\tfor (const [index, file] of files.entries()) {\n\t\tconst binaryData = (items[i].binary as IBinaryKeyData)?.[file.inputFieldName as string];\n\n\t\tif (!binaryData) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t`Input item [${i}] does not contain binary data on property ${file.inputFieldName}`,\n\t\t\t);\n\t\t}\n\n\t\tlet filename = binaryData.fileName as string;\n\n\t\tif (!filename.includes('.')) {\n\t\t\tif (binaryData.fileExtension) {\n\t\t\t\tfilename += `.${binaryData.fileExtension}`;\n\t\t\t}\n\t\t\tif (binaryData.mimeType) {\n\t\t\t\tfilename += `.${extension(binaryData.mimeType)}`;\n\t\t\t}\n\t\t}\n\n\t\tattachments.push({\n\t\t\tid: index,\n\t\t\tfilename,\n\t\t});\n\n\t\tfilesData.push({\n\t\t\tdata: await this.helpers.getBinaryDataBuffer(i, file.inputFieldName as string),\n\t\t\tname: filename,\n\t\t\tmime: binaryData.mimeType,\n\t\t});\n\t}\n\n\tmultiPartBody.append('payload_json', JSON.stringify({ ...jsonPayload, attachments }), {\n\t\tcontentType: 'application/json',\n\t});\n\n\tfor (const [index, binaryData] of filesData.entries()) {\n\t\tmultiPartBody.append(`files[${index}]`, binaryData.data, {\n\t\t\tcontentType: binaryData.name as string,\n\t\t\tfilename: binaryData.mime as string,\n\t\t});\n\t}\n\n\treturn multiPartBody;\n}\n\nexport function checkAccessToGuild(\n\tnode: INode,\n\tguildId: string,\n\tuserGuilds: IDataObject[],\n\titemIndex = 0,\n) {\n\tif (!userGuilds.some((guild) => guild.id === guildId)) {\n\t\tthrow new NodeOperationError(\n\t\t\tnode,\n\t\t\t`You do not have access to the guild with the id ${guildId}`,\n\t\t\t{\n\t\t\t\titemIndex,\n\t\t\t\tlevel: 'warning',\n\t\t\t},\n\t\t);\n\t}\n}\n\nexport async function checkAccessToChannel(\n\tthis: IExecuteFunctions,\n\tchannelId: string,\n\tuserGuilds: IDataObject[],\n\titemIndex = 0,\n) {\n\tlet guildId = '';\n\n\ttry {\n\t\tconst channel = await discordApiRequest.call(this, 'GET', `/channels/${channelId}`);\n\t\tguildId = channel.guild_id;\n\t} catch (error) {}\n\n\tif (!guildId) {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\t`Could not find server for channel with the id ${channelId}`,\n\t\t\t{\n\t\t\t\titemIndex,\n\t\t\t},\n\t\t);\n\t}\n\n\tcheckAccessToGuild(this.getNode(), guildId, userGuilds, itemIndex);\n}\n\nexport async function setupChannelGetter(this: IExecuteFunctions, userGuilds: IDataObject[]) {\n\tconst isOAuth2 = this.getNodeParameter('authentication', 0) === 'oAuth2';\n\n\treturn async (i: number) => {\n\t\tconst channelId = this.getNodeParameter('channelId', i, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\n\t\tif (isOAuth2) await checkAccessToChannel.call(this, channelId, userGuilds, i);\n\n\t\treturn channelId;\n\t};\n}\n\nexport async function sendDiscordMessage(\n\tthis: IExecuteFunctions,\n\t{\n\t\tguildId,\n\t\tuserGuilds,\n\t\tisOAuth2,\n\t\tbody,\n\t\titems,\n\t\tfiles = [],\n\t\titemIndex = 0,\n\t}: {\n\t\tguildId: string;\n\t\tuserGuilds: IDataObject[];\n\t\tisOAuth2: boolean;\n\t\tbody: IDataObject;\n\t\titems: INodeExecutionData[];\n\t\tfiles?: IDataObject[];\n\t\titemIndex?: number;\n\t},\n) {\n\tconst sendTo = this.getNodeParameter('sendTo', itemIndex) as string;\n\n\tlet channelId = '';\n\n\tif (sendTo === 'user') {\n\t\tconst userId = this.getNodeParameter('userId', itemIndex, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\n\t\tif (isOAuth2) {\n\t\t\ttry {\n\t\t\t\tawait discordApiRequest.call(this, 'GET', `/guilds/${guildId}/members/${userId}`);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof NodeApiError && error.httpCode === '404') {\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t`User with the id ${userId} is not a member of the selected guild`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new NodeOperationError(this.getNode(), error, {\n\t\t\t\t\titemIndex,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tchannelId = (\n\t\t\t(await discordApiRequest.call(this, 'POST', '/users/@me/channels', {\n\t\t\t\trecipient_id: userId,\n\t\t\t})) as IDataObject\n\t\t).id as string;\n\n\t\tif (!channelId) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Could not create a channel to send direct message to',\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t}\n\n\tif (sendTo === 'channel') {\n\t\tchannelId = this.getNodeParameter('channelId', itemIndex, undefined, {\n\t\t\textractValue: true,\n\t\t}) as string;\n\t}\n\n\tif (isOAuth2 && sendTo !== 'user') {\n\t\tawait checkAccessToChannel.call(this, channelId, userGuilds, itemIndex);\n\t}\n\n\tif (!channelId) {\n\t\tthrow new NodeOperationError(this.getNode(), 'Channel ID is required', {\n\t\t\titemIndex,\n\t\t});\n\t}\n\n\tlet response: IDataObject[] = [];\n\n\tif (files?.length) {\n\t\tconst multiPartBody = await prepareMultiPartForm.call(this, items, files, body, itemIndex);\n\n\t\tresponse = await discordApiMultiPartRequest.call(\n\t\t\tthis,\n\t\t\t'POST',\n\t\t\t`/channels/${channelId}/messages`,\n\t\t\tmultiPartBody,\n\t\t);\n\t} else {\n\t\tresponse = await discordApiRequest.call(this, 'POST', `/channels/${channelId}/messages`, body);\n\t}\n\n\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\tthis.helpers.returnJsonArray(response),\n\t\t{ itemData: { item: itemIndex } },\n\t);\n\n\treturn executionData;\n}\n\nexport function createSendAndWaitMessageBody(context: IExecuteFunctions) {\n\tconst config = getSendAndWaitConfig(context);\n\tlet description = config.message;\n\tif (config.appendAttribution !== false) {\n\t\tconst instanceId = context.getInstanceId();\n\t\tconst attributionText = 'This message was sent automatically with ';\n\t\tconst link = createUtmCampaignLink('n8n-nodes-base.discord', instanceId);\n\t\tdescription = `${config.message}\\n\\n_${attributionText}_[n8n](${link})`;\n\t}\n\n\tconst body = {\n\t\tembeds: [\n\t\t\t{\n\t\t\t\tdescription,\n\t\t\t\tcolor: 5814783,\n\t\t\t},\n\t\t],\n\t\tcomponents: [\n\t\t\t{\n\t\t\t\ttype: 1,\n\t\t\t\tcomponents: config.options.map((option) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\tstyle: 5,\n\t\t\t\t\t\tlabel: option.label,\n\t\t\t\t\t\turl: `${config.url}?approved=${option.value}`,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t};\n\n\treturn body;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AACrB,qBAAoB;AACpB,wBAA0B;AAQ1B,0BAA4D;AAE5D,mBAAqC;AACrC,uBAAkD;AAClD,uBAA8D;AAEvD,MAAM,yBACZ,CAAC,mBACD,CAAC,SAAmC;AACnC,QAAM,SAAsB,CAAC;AAE7B,aAAW,SAAS,gBAAgB;AACnC,QAAI,KAAK,KAAK,MAAM,OAAW;AAE/B,WAAO,KAAK,IAAI,KAAK,KAAK;AAAA,EAC3B;AAEA,SAAO;AACR;AAEM,SAAS,kBAA2C,OAAY,YAAY,GAAG;AACrF,MAAI,YAAY,MAAM,MAAM;AAC5B,QAAM,eAA4B,EAAE,UAAU;AAE9C,MAAI,CAAC,aAAa,MAAM,aAAa;AACpC,QAAI;AACH,YAAM,cAAe,MAAM,YAAuB,MAAM,KAAK,EAAE,CAAC;AAChE,UAAI,aAAa;AAChB,wBAAY,+BAAU,WAAW;AAAA,MAClC;AAAA,IACD,SAAS,KAAK;AAAA,IAAC;AAAA,EAChB;AAEA,MAAI,WAAW,SAAS;AACvB,iBAAa,UAAU,UAAU;AAAA,EAClC;AAEA,MAAK,OAAO,SAAoB,YAAY,GAAG,SAAS,aAAa,KA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A2B;AAAA,MAC3C;AAAA,MACA;AAAA,MACA,aAAa,SAAS;AAAA,MACtB;AAAA,IACD;AAAA,EACD,OAAO;AACN,eAAW,MAAM,mCAAkB,KAAK,MAAM,QAAQ,aAAa,SAAS,aAAa,IAAI;AAAA,EAC9F;AAEA,QAAM,gBAAgB,KAAK,QAAQ;AAAA,IAClC,KAAK,QAAQ,gBAAgB,QAAQ;AAAA,IACrC,EAAE,UAAU,EAAE,MAAM,UAAU,EAAE;AAAA,EACjC;AAEA,SAAO;AACR;AAEO,SAAS,6BAA6B,SAA4B;AACxE,QAAM,aAAS,mCAAqB,OAAO;AAC3C,MAAI,cAAc,OAAO;AACzB,MAAI,OAAO,sBAAsB,OAAO;AACvC,UAAM,aAAa,QAAQ,cAAc;AACzC,UAAM,kBAAkB;AACxB,UAAM,WAAO,wCAAsB,0BAA0B,UAAU;AACvE,kBAAc,GAAG,OAAO,OAAO;AAAA;AAAA,GAAQ,eAAe,UAAU,IAAI;AAAA,EACrE;AAEA,QAAM,OAAO;AAAA,IACZ,QAAQ;AAAA,MACP;AAAA,QACC;AAAA,QACA,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,YAAY;AAAA,MACX;AAAA,QACC,MAAM;AAAA,QACN,YAAY,OAAO,QAAQ,IAAI,CAAC,WAAW;AAC1C,iBAAO;AAAA,YACN,MAAM;AAAA,YACN,OAAO;AAAA,YACP,OAAO,OAAO;AAAA,YACd,KAAK,GAAG,OAAO,GAAG,aAAa,OAAO,KAAK;AAAA,UAC5C;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;","names":["isEmpty","FormData"]}
@@ -1,9 +1,39 @@
1
1
  {
2
2
  "type": "object",
3
3
  "properties": {
4
+ "contentHash": {
5
+ "type": "string"
6
+ },
7
+ "contentSize": {
8
+ "type": "integer"
9
+ },
4
10
  "id": {
5
11
  "type": "string"
12
+ },
13
+ "isDownloadable": {
14
+ "type": "boolean"
15
+ },
16
+ "lastModifiedClient": {
17
+ "type": "string"
18
+ },
19
+ "lastModifiedServer": {
20
+ "type": "string"
21
+ },
22
+ "name": {
23
+ "type": "string"
24
+ },
25
+ "pathDisplay": {
26
+ "type": "string"
27
+ },
28
+ "pathLower": {
29
+ "type": "string"
30
+ },
31
+ "rev": {
32
+ "type": "string"
33
+ },
34
+ "type": {
35
+ "type": "string"
6
36
  }
7
37
  },
8
- "version": 2
38
+ "version": 3
9
39
  }
@@ -13,6 +13,20 @@
13
13
  "country": {
14
14
  "type": "string"
15
15
  },
16
+ "email": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "object",
20
+ "properties": {
21
+ "email": {
22
+ "type": "string"
23
+ },
24
+ "qualification": {
25
+ "type": "string"
26
+ }
27
+ }
28
+ }
29
+ },
16
30
  "first_name": {
17
31
  "type": "string"
18
32
  },
@@ -53,5 +67,5 @@
53
67
  "type": "string"
54
68
  }
55
69
  },
56
- "version": 2
70
+ "version": 3
57
71
  }
@@ -0,0 +1,50 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "civility": {
5
+ "type": "string"
6
+ },
7
+ "company": {
8
+ "type": "string"
9
+ },
10
+ "company_linkedin": {
11
+ "type": "string"
12
+ },
13
+ "country": {
14
+ "type": "string"
15
+ },
16
+ "email": {
17
+ "type": "array",
18
+ "items": {
19
+ "type": "object",
20
+ "properties": {
21
+ "email": {
22
+ "type": "string"
23
+ },
24
+ "qualification": {
25
+ "type": "string"
26
+ }
27
+ }
28
+ }
29
+ },
30
+ "first_name": {
31
+ "type": "string"
32
+ },
33
+ "full_name": {
34
+ "type": "string"
35
+ },
36
+ "last_name": {
37
+ "type": "string"
38
+ },
39
+ "linkedin": {
40
+ "type": "string"
41
+ },
42
+ "nb_employees": {
43
+ "type": "string"
44
+ },
45
+ "website": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "version": 1
50
+ }
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var utils_exports = {};
20
30
  __export(utils_exports, {
@@ -22,7 +32,7 @@ __export(utils_exports, {
22
32
  });
23
33
  module.exports = __toCommonJS(utils_exports);
24
34
  var import_imap = require("@n8n/imap");
25
- var import_lodash = require("lodash");
35
+ var import_find = __toESM(require("lodash/find"));
26
36
  var import_mailparser = require("mailparser");
27
37
  var import_n8n_workflow = require("n8n-workflow");
28
38
  async function parseRawEmail(messageEncoded, dataPropertyNameDownload) {
@@ -84,7 +94,7 @@ async function getNewEmails(imapConnection, searchCriteria, staticData, postProc
84
94
  if (staticData.lastMessageUid === void 0 || staticData.lastMessageUid < message.attributes.uid) {
85
95
  staticData.lastMessageUid = message.attributes.uid;
86
96
  }
87
- const part = (0, import_lodash.find)(message.parts, { which: "" });
97
+ const part = (0, import_find.default)(message.parts, { which: "" });
88
98
  if (part === void 0) {
89
99
  throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Email part could not be parsed.");
90
100
  }
@@ -93,6 +103,9 @@ async function getNewEmails(imapConnection, searchCriteria, staticData, postProc
93
103
  part.body,
94
104
  dataPropertyAttachmentsPrefixName
95
105
  );
106
+ parsedEmail.json.attributes = {
107
+ uid: message.attributes.uid
108
+ };
96
109
  newEmails.push(parsedEmail);
97
110
  }
98
111
  } else if (format === "simple") {
@@ -151,7 +164,7 @@ async function getNewEmails(imapConnection, searchCriteria, staticData, postProc
151
164
  if (staticData.lastMessageUid === void 0 || staticData.lastMessageUid < message.attributes.uid) {
152
165
  staticData.lastMessageUid = message.attributes.uid;
153
166
  }
154
- const part = (0, import_lodash.find)(message.parts, { which: "TEXT" });
167
+ const part = (0, import_find.default)(message.parts, { which: "TEXT" });
155
168
  if (part === void 0) {
156
169
  throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Email part could not be parsed.");
157
170
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/EmailReadImap/v2/utils.ts"],"sourcesContent":["import { getParts, type ImapSimple, type Message, type MessagePart } from '@n8n/imap';\nimport { find } from 'lodash';\nimport { simpleParser, type Source as ParserSource } from 'mailparser';\nimport {\n\ttype IBinaryData,\n\ttype INodeExecutionData,\n\ttype IDataObject,\n\ttype ITriggerFunctions,\n\tNodeOperationError,\n\ttype IBinaryKeyData,\n} from 'n8n-workflow';\n\nasync function parseRawEmail(\n\tthis: ITriggerFunctions,\n\tmessageEncoded: ParserSource,\n\tdataPropertyNameDownload: string,\n): Promise<INodeExecutionData> {\n\tconst responseData = await simpleParser(messageEncoded);\n\tconst headers: IDataObject = {};\n\tconst additionalData: IDataObject = {};\n\n\tfor (const header of responseData.headerLines) {\n\t\theaders[header.key] = header.line;\n\t}\n\n\tadditionalData.headers = headers;\n\tadditionalData.headerLines = undefined;\n\n\tconst binaryData: IBinaryKeyData = {};\n\tif (responseData.attachments) {\n\t\tfor (let i = 0; i < responseData.attachments.length; i++) {\n\t\t\tconst attachment = responseData.attachments[i];\n\t\t\tbinaryData[`${dataPropertyNameDownload}${i}`] = await this.helpers.prepareBinaryData(\n\t\t\t\tattachment.content,\n\t\t\t\tattachment.filename,\n\t\t\t\tattachment.contentType,\n\t\t\t);\n\t\t}\n\n\t\tadditionalData.attachments = undefined;\n\t}\n\n\treturn {\n\t\tjson: { ...responseData, ...additionalData },\n\t\tbinary: Object.keys(binaryData).length ? binaryData : undefined,\n\t} as INodeExecutionData;\n}\n\nexport async function getNewEmails(\n\tthis: ITriggerFunctions,\n\timapConnection: ImapSimple,\n\tsearchCriteria: Array<string | string[]>,\n\tstaticData: IDataObject,\n\tpostProcessAction: string,\n\tgetText: (parts: MessagePart[], message: Message, subtype: string) => Promise<string>,\n\tgetAttachment: (\n\t\timapConnection: ImapSimple,\n\t\tparts: MessagePart[],\n\t\tmessage: Message,\n\t) => Promise<IBinaryData[]>,\n): Promise<INodeExecutionData[]> {\n\tconst format = this.getNodeParameter('format', 0) as string;\n\n\tlet fetchOptions = {};\n\n\tif (format === 'simple' || format === 'raw') {\n\t\tfetchOptions = {\n\t\t\tbodies: ['TEXT', 'HEADER'],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t} else if (format === 'resolved') {\n\t\tfetchOptions = {\n\t\t\tbodies: [''],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t}\n\n\tconst results = await imapConnection.search(searchCriteria, fetchOptions);\n\n\tconst newEmails: INodeExecutionData[] = [];\n\tlet newEmail: INodeExecutionData;\n\tlet attachments: IBinaryData[];\n\tlet propertyName: string;\n\n\t// All properties get by default moved to metadata except the ones\n\t// which are defined here which get set on the top level.\n\tconst topLevelProperties = ['cc', 'date', 'from', 'subject', 'to'];\n\n\tif (format === 'resolved') {\n\t\tconst dataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t) as string;\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: '' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\tconst parsedEmail = await parseRawEmail.call(\n\t\t\t\tthis,\n\t\t\t\tpart.body as Buffer,\n\t\t\t\tdataPropertyAttachmentsPrefixName,\n\t\t\t);\n\n\t\t\tnewEmails.push(parsedEmail);\n\t\t}\n\t} else if (format === 'simple') {\n\t\tconst downloadAttachments = this.getNodeParameter('downloadAttachments') as boolean;\n\n\t\tlet dataPropertyAttachmentsPrefixName = '';\n\t\tif (downloadAttachments) {\n\t\t\tdataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t\t) as string;\n\t\t}\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst parts = getParts(message.attributes.struct as IDataObject[]);\n\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\ttextHtml: await getText(parts, message, 'html'),\n\t\t\t\t\ttextPlain: await getText(parts, message, 'plain'),\n\t\t\t\t\tmetadata: {} as IDataObject,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tuid: message.attributes.uid,\n\t\t\t\t\t} as IDataObject,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst messageHeader = message.parts.filter((part) => part.which === 'HEADER');\n\n\t\t\tconst messageBody = messageHeader[0].body as Record<string, string[]>;\n\t\t\tfor (propertyName of Object.keys(messageBody)) {\n\t\t\t\tif (messageBody[propertyName].length) {\n\t\t\t\t\tif (topLevelProperties.includes(propertyName)) {\n\t\t\t\t\t\tnewEmail.json[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(newEmail.json.metadata as IDataObject)[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (downloadAttachments) {\n\t\t\t\t// Get attachments and add them if any get found\n\t\t\t\tattachments = await getAttachment(imapConnection, parts, message);\n\t\t\t\tif (attachments.length) {\n\t\t\t\t\tnewEmail.binary = {};\n\t\t\t\t\tfor (let i = 0; i < attachments.length; i++) {\n\t\t\t\t\t\tnewEmail.binary[`${dataPropertyAttachmentsPrefixName}${i}`] = attachments[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t} else if (format === 'raw') {\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: 'TEXT' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\t// Return base64 string\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\traw: part.body as string,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t}\n\n\t// only mark messages as seen once processing has finished\n\tif (postProcessAction === 'read') {\n\t\tconst uidList = results.map((e) => e.attributes.uid);\n\t\tif (uidList.length > 0) {\n\t\t\tawait imapConnection.addFlags(uidList, '\\\\SEEN');\n\t\t}\n\t}\n\treturn newEmails;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0E;AAC1E,oBAAqB;AACrB,wBAA0D;AAC1D,0BAOO;AAEP,eAAe,cAEd,gBACA,0BAC8B;AAC9B,QAAM,eAAe,UAAM,gCAAa,cAAc;AACtD,QAAM,UAAuB,CAAC;AAC9B,QAAM,iBAA8B,CAAC;AAErC,aAAW,UAAU,aAAa,aAAa;AAC9C,YAAQ,OAAO,GAAG,IAAI,OAAO;AAAA,EAC9B;AAEA,iBAAe,UAAU;AACzB,iBAAe,cAAc;AAE7B,QAAM,aAA6B,CAAC;AACpC,MAAI,aAAa,aAAa;AAC7B,aAAS,IAAI,GAAG,IAAI,aAAa,YAAY,QAAQ,KAAK;AACzD,YAAM,aAAa,aAAa,YAAY,CAAC;AAC7C,iBAAW,GAAG,wBAAwB,GAAG,CAAC,EAAE,IAAI,MAAM,KAAK,QAAQ;AAAA,QAClE,WAAW;AAAA,QACX,WAAW;AAAA,QACX,WAAW;AAAA,MACZ;AAAA,IACD;AAEA,mBAAe,cAAc;AAAA,EAC9B;AAEA,SAAO;AAAA,IACN,MAAM,EAAE,GAAG,cAAc,GAAG,eAAe;AAAA,IAC3C,QAAQ,OAAO,KAAK,UAAU,EAAE,SAAS,aAAa;AAAA,EACvD;AACD;AAEA,eAAsB,aAErB,gBACA,gBACA,YACA,mBACA,SACA,eAKgC;AAChC,QAAM,SAAS,KAAK,iBAAiB,UAAU,CAAC;AAEhD,MAAI,eAAe,CAAC;AAEpB,MAAI,WAAW,YAAY,WAAW,OAAO;AAC5C,mBAA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AACD;AAAA,MACD;AACA,UACC,WAAW,mBAAmB,UAC7B,WAAW,iBAA4B,QAAQ,WAAW,KAC1D;AACD,mBAAW,iBAAiB,QAAQ,WAAW;AAAA,MAChD;AACA,YAAM,WAAO,oBAAK,QAAQ,OAAO,EAAE,OAAO,OAAO,CAAC;AAElD,UAAI,SAAS,QAAW;AACvB,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,iCAAiC;AAAA,MAC/E;AAEA,iBAAW;AAAA,QACV,MAAM;AAAA,UACL,KAAK,KAAK;AAAA,QACX;AAAA,MACD;AAEA,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAAA,EACD;AAGA,MAAI,sBAAsB,QAAQ;AACjC,UAAM,UAAU,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG;AACnD,QAAI,QAAQ,SAAS,GAAG;AACvB,YAAM,eAAe,SAAS,SAAS,QAAQ;AAAA,IAChD;AAAA,EACD;AACA,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/EmailReadImap/v2/utils.ts"],"sourcesContent":["import { getParts, type ImapSimple, type Message, type MessagePart } from '@n8n/imap';\nimport find from 'lodash/find';\nimport { simpleParser, type Source as ParserSource } from 'mailparser';\nimport {\n\ttype IBinaryData,\n\ttype INodeExecutionData,\n\ttype IDataObject,\n\ttype ITriggerFunctions,\n\tNodeOperationError,\n\ttype IBinaryKeyData,\n} from 'n8n-workflow';\n\nasync function parseRawEmail(\n\tthis: ITriggerFunctions,\n\tmessageEncoded: ParserSource,\n\tdataPropertyNameDownload: string,\n): Promise<INodeExecutionData> {\n\tconst responseData = await simpleParser(messageEncoded);\n\tconst headers: IDataObject = {};\n\tconst additionalData: IDataObject = {};\n\n\tfor (const header of responseData.headerLines) {\n\t\theaders[header.key] = header.line;\n\t}\n\n\tadditionalData.headers = headers;\n\tadditionalData.headerLines = undefined;\n\n\tconst binaryData: IBinaryKeyData = {};\n\tif (responseData.attachments) {\n\t\tfor (let i = 0; i < responseData.attachments.length; i++) {\n\t\t\tconst attachment = responseData.attachments[i];\n\t\t\tbinaryData[`${dataPropertyNameDownload}${i}`] = await this.helpers.prepareBinaryData(\n\t\t\t\tattachment.content,\n\t\t\t\tattachment.filename,\n\t\t\t\tattachment.contentType,\n\t\t\t);\n\t\t}\n\n\t\tadditionalData.attachments = undefined;\n\t}\n\n\treturn {\n\t\tjson: { ...responseData, ...additionalData },\n\t\tbinary: Object.keys(binaryData).length ? binaryData : undefined,\n\t} as INodeExecutionData;\n}\n\nexport async function getNewEmails(\n\tthis: ITriggerFunctions,\n\timapConnection: ImapSimple,\n\tsearchCriteria: Array<string | string[]>,\n\tstaticData: IDataObject,\n\tpostProcessAction: string,\n\tgetText: (parts: MessagePart[], message: Message, subtype: string) => Promise<string>,\n\tgetAttachment: (\n\t\timapConnection: ImapSimple,\n\t\tparts: MessagePart[],\n\t\tmessage: Message,\n\t) => Promise<IBinaryData[]>,\n): Promise<INodeExecutionData[]> {\n\tconst format = this.getNodeParameter('format', 0) as string;\n\n\tlet fetchOptions = {};\n\n\tif (format === 'simple' || format === 'raw') {\n\t\tfetchOptions = {\n\t\t\tbodies: ['TEXT', 'HEADER'],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t} else if (format === 'resolved') {\n\t\tfetchOptions = {\n\t\t\tbodies: [''],\n\t\t\tmarkSeen: false,\n\t\t\tstruct: true,\n\t\t};\n\t}\n\n\tconst results = await imapConnection.search(searchCriteria, fetchOptions);\n\n\tconst newEmails: INodeExecutionData[] = [];\n\tlet newEmail: INodeExecutionData;\n\tlet attachments: IBinaryData[];\n\tlet propertyName: string;\n\n\t// All properties get by default moved to metadata except the ones\n\t// which are defined here which get set on the top level.\n\tconst topLevelProperties = ['cc', 'date', 'from', 'subject', 'to'];\n\n\tif (format === 'resolved') {\n\t\tconst dataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t) as string;\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: '' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\tconst parsedEmail = await parseRawEmail.call(\n\t\t\t\tthis,\n\t\t\t\tpart.body as Buffer,\n\t\t\t\tdataPropertyAttachmentsPrefixName,\n\t\t\t);\n\n\t\t\t(parsedEmail.json as IDataObject).attributes = {\n\t\t\t\tuid: message.attributes.uid,\n\t\t\t};\n\n\t\t\tnewEmails.push(parsedEmail);\n\t\t}\n\t} else if (format === 'simple') {\n\t\tconst downloadAttachments = this.getNodeParameter('downloadAttachments') as boolean;\n\n\t\tlet dataPropertyAttachmentsPrefixName = '';\n\t\tif (downloadAttachments) {\n\t\t\tdataPropertyAttachmentsPrefixName = this.getNodeParameter(\n\t\t\t\t'dataPropertyAttachmentsPrefixName',\n\t\t\t) as string;\n\t\t}\n\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst parts = getParts(message.attributes.struct as IDataObject[]);\n\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\ttextHtml: await getText(parts, message, 'html'),\n\t\t\t\t\ttextPlain: await getText(parts, message, 'plain'),\n\t\t\t\t\tmetadata: {} as IDataObject,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\tuid: message.attributes.uid,\n\t\t\t\t\t} as IDataObject,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst messageHeader = message.parts.filter((part) => part.which === 'HEADER');\n\n\t\t\tconst messageBody = messageHeader[0].body as Record<string, string[]>;\n\t\t\tfor (propertyName of Object.keys(messageBody)) {\n\t\t\t\tif (messageBody[propertyName].length) {\n\t\t\t\t\tif (topLevelProperties.includes(propertyName)) {\n\t\t\t\t\t\tnewEmail.json[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(newEmail.json.metadata as IDataObject)[propertyName] = messageBody[propertyName][0];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (downloadAttachments) {\n\t\t\t\t// Get attachments and add them if any get found\n\t\t\t\tattachments = await getAttachment(imapConnection, parts, message);\n\t\t\t\tif (attachments.length) {\n\t\t\t\t\tnewEmail.binary = {};\n\t\t\t\t\tfor (let i = 0; i < attachments.length; i++) {\n\t\t\t\t\t\tnewEmail.binary[`${dataPropertyAttachmentsPrefixName}${i}`] = attachments[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t} else if (format === 'raw') {\n\t\tfor (const message of results) {\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid !== undefined &&\n\t\t\t\tmessage.attributes.uid <= (staticData.lastMessageUid as number)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstaticData.lastMessageUid === undefined ||\n\t\t\t\t(staticData.lastMessageUid as number) < message.attributes.uid\n\t\t\t) {\n\t\t\t\tstaticData.lastMessageUid = message.attributes.uid;\n\t\t\t}\n\t\t\tconst part = find(message.parts, { which: 'TEXT' });\n\n\t\t\tif (part === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Email part could not be parsed.');\n\t\t\t}\n\t\t\t// Return base64 string\n\t\t\tnewEmail = {\n\t\t\t\tjson: {\n\t\t\t\t\traw: part.body as string,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tnewEmails.push(newEmail);\n\t\t}\n\t}\n\n\t// only mark messages as seen once processing has finished\n\tif (postProcessAction === 'read') {\n\t\tconst uidList = results.map((e) => e.attributes.uid);\n\t\tif (uidList.length > 0) {\n\t\t\tawait imapConnection.addFlags(uidList, '\\\\SEEN');\n\t\t}\n\t}\n\treturn newEmails;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA0E;AAC1E,kBAAiB;AACjB,wBAA0D;AAC1D,0BAOO;AAEP,eAAe,cAEd,gBACA,0BAC8B;AAC9B,QAAM,eAAe,UAAM,gCAAa,cAAc;AACtD,QAAM,UAAuB,CAAC;AAC9B,QAAM,iBAA8B,CAAC;AAErC,aAAW,UAAU,aAAa,aAAa;AAC9C,YAAQ,OAAO,GAAG,IAAI,OAAO;AAAA,EAC9B;AAEA,iBAAe,UAAU;AACzB,iBAAe,cAAc;AAE7B,QAAM,aAA6B,CAAC;AACpC,MAAI,aAAa,aAAa;AAC7B,aAAS,IAAI,GAAG,IAAI,aAAa,YAAY,QAAQ,KAAK;AACzD,YAAM,aAAa,aAAa,YAAY,CAAC;AAC7C,iBAAW,GAAG,wBAAwB,GAAG,CAAC,EAAE,IAAI,MAAM,KAAK,QAAQ;AAAA,QAClE,WAAW;AAAA,QACX,WAAW;AAAA,QACX,WAAW;AAAA,MACZ;AAAA,IACD;AAEA,mBAAe,cAAc;AAAA,EAC9B;AAEA,SAAO;AAAA,IACN,MAAM,EAAE,GAAG,cAAc,GAAG,eAAe;AAAA,IAC3C,QAAQ,OAAO,KAAK,UAAU,EAAE,SAAS,a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AQ,KAAK;AAC5C,qBAAS,OAAO,GAAG,iCAAiC,GAAG,CAAC,EAAE,IAAI,YAAY,CAAC;AAAA,UAC5E;AAAA,QACD;AAAA,MACD;AAEA,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAAA,EACD,WAAW,WAAW,OAAO;AAC5B,eAAW,WAAW,SAAS;AAC9B,UACC,WAAW,mBAAmB,UAC9B,QAAQ,WAAW,OAAQ,WAAW,gBACrC;AACD;AAAA,MACD;AACA,UACC,WAAW,mBAAmB,UAC7B,WAAW,iBAA4B,QAAQ,WAAW,KAC1D;AACD,mBAAW,iBAAiB,QAAQ,WAAW;AAAA,MAChD;AACA,YAAM,WAAO,YAAAA,SAAK,QAAQ,OAAO,EAAE,OAAO,OAAO,CAAC;AAElD,UAAI,SAAS,QAAW;AACvB,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,iCAAiC;AAAA,MAC/E;AAEA,iBAAW;AAAA,QACV,MAAM;AAAA,UACL,KAAK,KAAK;AAAA,QACX;AAAA,MACD;AAEA,gBAAU,KAAK,QAAQ;AAAA,IACxB;AAAA,EACD;AAGA,MAAI,sBAAsB,QAAQ;AACjC,UAAM,UAAU,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG;AACnD,QAAI,QAAQ,SAAS,GAAG;AACvB,YAAM,eAAe,SAAS,SAAS,QAAQ;AAAA,IAChD;AAAA,EACD;AACA,SAAO;AACR;","names":["find"]}
@@ -39,15 +39,9 @@
39
39
  "messageTime": {
40
40
  "type": "integer"
41
41
  },
42
- "rejected": {
43
- "type": "array",
44
- "items": {
45
- "type": "string"
46
- }
47
- },
48
42
  "response": {
49
43
  "type": "string"
50
44
  }
51
45
  },
52
- "version": 2
46
+ "version": 3
53
47
  }
@@ -134,7 +134,7 @@ class EvaluationTrigger {
134
134
  googleSheet,
135
135
  {}
136
136
  );
137
- const result = testRunnerResult.filter((row) => row?.json?.row_number <= maxRows);
137
+ const result = testRunnerResult.slice(0, maxRows - 1);
138
138
  return [result];
139
139
  }
140
140
  const hasFilter = this.getNodeParameter("filtersUI.values", 0, []);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { document, sheet } from '../../Google/Sheet/GoogleSheetsTrigger.node';\nimport { readFilter } from '../../Google/Sheet/v2/actions/sheet/read.operation';\nimport { authentication } from '../../Google/Sheet/v2/actions/versionDescription';\nimport type { ILookupValues } from '../../Google/Sheet/v2/helpers/GoogleSheets.types';\nimport { listSearch, loadOptions } from '../methods';\nimport {\n\tgetGoogleSheet,\n\tgetResults,\n\tgetRowsLeft,\n\tgetNumberOfRowsLeftFiltered,\n\tgetSheet,\n} from '../utils/evaluationTriggerUtils';\n\nexport const DEFAULT_STARTING_ROW = 2;\n\nexport class EvaluationTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Evaluation Trigger',\n\t\ticon: 'fa:check-double',\n\t\tname: 'evaluationTrigger',\n\t\tgroup: ['trigger'],\n\t\tversion: 4.6,\n\t\tdescription: 'Run a test dataset through your workflow to check performance',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'When fetching a dataset row',\n\t\t\tcolor: '#c3c9d5',\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Pulls a test dataset from a Google Sheet. The workflow will run once for each row, in sequence. Tips for wiring this node up <a href=\"https://docs.n8n.io/advanced-ai/evaluations/tips-and-common-issues/#combining-multiple-triggers\">here</a>.',\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Credentials',\n\t\t\t\tname: 'credentials',\n\t\t\t\ttype: 'credentials',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\tauthentication,\n\t\t\t{\n\t\t\t\t...document,\n\t\t\t\tdisplayName: 'Document Containing Dataset',\n\t\t\t\thint: 'Example dataset format <a href=\"https://docs.google.com/spreadsheets/d/1vD_IdeFUg7sHsK9okL6Doy1rGOkWTnPJV3Dro4FBUsY/edit?gid=0#gid=0\">here</a>',\n\t\t\t},\n\t\t\t{ ...sheet, displayName: 'Sheet Containing Dataset' },\n\t\t\t{\n\t\t\t\tdisplayName: 'Limit Rows',\n\t\t\t\tname: 'limitRows',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether to limit number of rows to process',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Rows to Process',\n\t\t\t\tname: 'maxRows',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 10,\n\t\t\t\tdescription: 'Maximum number of rows to process',\n\t\t\t\tnoDataExpression: false,\n\t\t\t\tdisplayOptions: { show: { limitRows: [true] } },\n\t\t\t},\n\t\t\treadFilter,\n\t\t],\n\t\tcodex: {\n\t\t\talias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],\n\t\t},\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'googleApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['serviceAccount'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttestedBy: 'googleApiCredentialTest',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'googleSheetsOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['oAuth2'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n\n\tmethods = { loadOptions, listSearch };\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst inputData = this.getInputData();\n\n\t\tconst MAX_ROWS = 1000;\n\n\t\tconst maxRows = this.getNodeParameter('limitRows', 0)\n\t\t\t? (this.getNodeParameter('maxRows', 0) as number) + 1\n\t\t\t: MAX_ROWS;\n\n\t\tconst previousRunRowNumber = inputData?.[0]?.json?.row_number;\n\t\tconst previousRunRowsLeft = inputData?.[0]?.json?._rowsLeft;\n\n\t\tconst firstDataRow =\n\t\t\ttypeof previousRunRowNumber === 'number' && previousRunRowsLeft !== 0\n\t\t\t\t? previousRunRowNumber + 1\n\t\t\t\t: DEFAULT_STARTING_ROW;\n\t\tconst rangeOptions = {\n\t\t\trangeDefinition: 'specifyRange',\n\t\t\theaderRow: 1,\n\t\t\tfirstDataRow,\n\t\t};\n\n\t\tconst googleSheetInstance = getGoogleSheet.call(this);\n\n\t\tconst googleSheet = await getSheet.call(this, googleSheetInstance);\n\n\t\tconst allRows = await getResults.call(this, [], googleSheetInstance, googleSheet, rangeOptions);\n\n\t\t// This is for test runner which requires a different return format\n\t\tif (inputData[0].json.requestDataset) {\n\t\t\tconst testRunnerResult = await getResults.call(\n\t\t\t\tthis,\n\t\t\t\t[],\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet,\n\t\t\t\t{},\n\t\t\t);\n\n\t\t\tconst result = testRunnerResult.filter((row) => (row?.json?.row_number as number) <= maxRows);\n\n\t\t\treturn [result];\n\t\t}\n\n\t\tconst hasFilter = this.getNodeParameter('filtersUI.values', 0, []) as ILookupValues[];\n\n\t\tif (hasFilter.length > 0) {\n\t\t\tconst currentRow = allRows[0];\n\t\t\tconst currentRowNumber = currentRow.json?.row_number as number;\n\n\t\t\tif (currentRow === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No row found');\n\t\t\t}\n\n\t\t\tconst rowsLeft = await getNumberOfRowsLeftFiltered.call(\n\t\t\t\tthis,\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet.title,\n\t\t\t\tcurrentRowNumber + 1,\n\t\t\t\tmaxRows,\n\t\t\t);\n\n\t\t\tcurrentRow.json._rowsLeft = rowsLeft;\n\n\t\t\treturn [[currentRow]];\n\t\t} else {\n\t\t\tconst currentRow = allRows.find((row) => (row?.json?.row_number as number) === firstDataRow);\n\n\t\t\tconst rowsLeft = await getRowsLeft.call(\n\t\t\t\tthis,\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet.title,\n\t\t\t\t`${googleSheet.title}!${firstDataRow}:${maxRows}`,\n\t\t\t);\n\n\t\t\tif (currentRow === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No row found');\n\t\t\t}\n\n\t\t\tcurrentRow.json._rowsLeft = rowsLeft;\n\n\t\t\treturn [[currentRow]];\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAwD;AAExD,iCAAgC;AAChC,kBAA2B;AAC3B,gCAA+B;AAE/B,qBAAwC;AACxC,oCAMO;AAEA,MAAM,uBAAuB;AAE7B,MAAM,kBAAuC;AAAA,EAA7C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,SAAS;AAAA,MACjB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,yBAAyB;AAAA,MACzB,UAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,YAAY;AAAA,QACX;AAAA,UACC,aACC;AAAA,UACD,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QACV;AAAA,QACA;AAA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AK,IAAI,YAAY,IAAI,OAAO;AAAA,MAChD;AAEA,UAAI,eAAe,QAAW;AAC7B,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,cAAc;AAAA,MAC5D;AAEA,iBAAW,KAAK,YAAY;AAE5B,aAAO,CAAC,CAAC,UAAU,CAAC;AAAA,IACrB;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport type {\n\tINodeType,\n\tINodeTypeDescription,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { document, sheet } from '../../Google/Sheet/GoogleSheetsTrigger.node';\nimport { readFilter } from '../../Google/Sheet/v2/actions/sheet/read.operation';\nimport { authentication } from '../../Google/Sheet/v2/actions/versionDescription';\nimport type { ILookupValues } from '../../Google/Sheet/v2/helpers/GoogleSheets.types';\nimport { listSearch, loadOptions } from '../methods';\nimport {\n\tgetGoogleSheet,\n\tgetResults,\n\tgetRowsLeft,\n\tgetNumberOfRowsLeftFiltered,\n\tgetSheet,\n} from '../utils/evaluationTriggerUtils';\n\nexport const DEFAULT_STARTING_ROW = 2;\n\nexport class EvaluationTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Evaluation Trigger',\n\t\ticon: 'fa:check-double',\n\t\tname: 'evaluationTrigger',\n\t\tgroup: ['trigger'],\n\t\tversion: 4.6,\n\t\tdescription: 'Run a test dataset through your workflow to check performance',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'When fetching a dataset row',\n\t\t\tcolor: '#c3c9d5',\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Pulls a test dataset from a Google Sheet. The workflow will run once for each row, in sequence. Tips for wiring this node up <a href=\"https://docs.n8n.io/advanced-ai/evaluations/tips-and-common-issues/#combining-multiple-triggers\">here</a>.',\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Credentials',\n\t\t\t\tname: 'credentials',\n\t\t\t\ttype: 'credentials',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\tauthentication,\n\t\t\t{\n\t\t\t\t...document,\n\t\t\t\tdisplayName: 'Document Containing Dataset',\n\t\t\t\thint: 'Example dataset format <a href=\"https://docs.google.com/spreadsheets/d/1vD_IdeFUg7sHsK9okL6Doy1rGOkWTnPJV3Dro4FBUsY/edit?gid=0#gid=0\">here</a>',\n\t\t\t},\n\t\t\t{ ...sheet, displayName: 'Sheet Containing Dataset' },\n\t\t\t{\n\t\t\t\tdisplayName: 'Limit Rows',\n\t\t\t\tname: 'limitRows',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether to limit number of rows to process',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Rows to Process',\n\t\t\t\tname: 'maxRows',\n\t\t\t\ttype: 'number',\n\t\t\t\tdefault: 10,\n\t\t\t\tdescription: 'Maximum number of rows to process',\n\t\t\t\tnoDataExpression: false,\n\t\t\t\tdisplayOptions: { show: { limitRows: [true] } },\n\t\t\t},\n\t\t\treadFilter,\n\t\t],\n\t\tcodex: {\n\t\t\talias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],\n\t\t},\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'googleApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['serviceAccount'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttestedBy: 'googleApiCredentialTest',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'googleSheetsOAuth2Api',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['oAuth2'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t};\n\n\tmethods = { loadOptions, listSearch };\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst inputData = this.getInputData();\n\n\t\tconst MAX_ROWS = 1000;\n\n\t\tconst maxRows = this.getNodeParameter('limitRows', 0)\n\t\t\t? (this.getNodeParameter('maxRows', 0) as number) + 1\n\t\t\t: MAX_ROWS;\n\n\t\tconst previousRunRowNumber = inputData?.[0]?.json?.row_number;\n\t\tconst previousRunRowsLeft = inputData?.[0]?.json?._rowsLeft;\n\n\t\tconst firstDataRow =\n\t\t\ttypeof previousRunRowNumber === 'number' && previousRunRowsLeft !== 0\n\t\t\t\t? previousRunRowNumber + 1\n\t\t\t\t: DEFAULT_STARTING_ROW;\n\t\tconst rangeOptions = {\n\t\t\trangeDefinition: 'specifyRange',\n\t\t\theaderRow: 1,\n\t\t\tfirstDataRow,\n\t\t};\n\n\t\tconst googleSheetInstance = getGoogleSheet.call(this);\n\n\t\tconst googleSheet = await getSheet.call(this, googleSheetInstance);\n\n\t\tconst allRows = await getResults.call(this, [], googleSheetInstance, googleSheet, rangeOptions);\n\n\t\t// This is for test runner which requires a different return format\n\t\tif (inputData[0].json.requestDataset) {\n\t\t\tconst testRunnerResult = await getResults.call(\n\t\t\t\tthis,\n\t\t\t\t[],\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet,\n\t\t\t\t{},\n\t\t\t);\n\n\t\t\tconst result = testRunnerResult.slice(0, maxRows - 1);\n\n\t\t\treturn [result];\n\t\t}\n\n\t\tconst hasFilter = this.getNodeParameter('filtersUI.values', 0, []) as ILookupValues[];\n\n\t\tif (hasFilter.length > 0) {\n\t\t\tconst currentRow = allRows[0];\n\t\t\tconst currentRowNumber = currentRow.json?.row_number as number;\n\n\t\t\tif (currentRow === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No row found');\n\t\t\t}\n\n\t\t\tconst rowsLeft = await getNumberOfRowsLeftFiltered.call(\n\t\t\t\tthis,\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet.title,\n\t\t\t\tcurrentRowNumber + 1,\n\t\t\t\tmaxRows,\n\t\t\t);\n\n\t\t\tcurrentRow.json._rowsLeft = rowsLeft;\n\n\t\t\treturn [[currentRow]];\n\t\t} else {\n\t\t\tconst currentRow = allRows.find((row) => (row?.json?.row_number as number) === firstDataRow);\n\n\t\t\tconst rowsLeft = await getRowsLeft.call(\n\t\t\t\tthis,\n\t\t\t\tgoogleSheetInstance,\n\t\t\t\tgoogleSheet.title,\n\t\t\t\t`${googleSheet.title}!${firstDataRow}:${maxRows}`,\n\t\t\t);\n\n\t\t\tif (currentRow === undefined) {\n\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No row found');\n\t\t\t}\n\n\t\t\tcurrentRow.json._rowsLeft = rowsLeft;\n\n\t\t\treturn [[currentRow]];\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAwD;AAExD,iCAAgC;AAChC,kBAA2B;AAC3B,gCAA+B;AAE/B,qBAAwC;AACxC,oCAMO;AAEA,MAAM,uBAAuB;AAE7B,MAAM,kBAAuC;AAAA,EAA7C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,SAAS;AAAA,MACjB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,yBAAyB;AAAA,MACzB,UAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,SAAS,CAA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MAAM,eAA0B,YAAY;AAE3F,YAAM,WAAW,MAAM,0CAAY;AAAA,QAClC;AAAA,QACA;AAAA,QACA,YAAY;AAAA,QACZ,GAAG,YAAY,KAAK,IAAI,YAAY,IAAI,OAAO;AAAA,MAChD;AAEA,UAAI,eAAe,QAAW;AAC7B,cAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,cAAc;AAAA,MAC5D;AAEA,iBAAW,KAAK,YAAY;AAE5B,aAAO,CAAC,CAAC,UAAU,CAAC;AAAA,IACrB;AAAA,EACD;AACD;","names":[]}
@@ -31,7 +31,7 @@ __export(ExecuteWorkflowTrigger_node_exports, {
31
31
  ExecuteWorkflowTrigger: () => ExecuteWorkflowTrigger
32
32
  });
33
33
  module.exports = __toCommonJS(ExecuteWorkflowTrigger_node_exports);
34
- var import_lodash = __toESM(require("lodash"));
34
+ var import_pickBy = __toESM(require("lodash/pickBy"));
35
35
  var import_n8n_workflow = require("n8n-workflow");
36
36
  var import_constants = require("../../../utils/workflowInputsResourceMapping/constants");
37
37
  var import_GenericFunctions = require("../../../utils/workflowInputsResourceMapping/GenericFunctions");
@@ -214,7 +214,7 @@ class ExecuteWorkflowTrigger {
214
214
  ...Object.fromEntries(newParams.fields.map((x) => [x.name, import_constants.FALLBACK_DEFAULT_VALUE])),
215
215
  // Need to trim to the expected schema to support legacy Execute Workflow callers passing through all their data
216
216
  // which we do not want to expose past this node.
217
- ...import_lodash.default.pickBy(json, (_value, key) => newKeys.has(key))
217
+ ...(0, import_pickBy.default)(json, (_value, key) => newKeys.has(key))
218
218
  },
219
219
  index,
220
220
  binary
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.ts"],"sourcesContent":["import _ from 'lodash';\nimport {\n\ttype INodeExecutionData,\n\tNodeConnectionTypes,\n\ttype IExecuteFunctions,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n} from 'n8n-workflow';\n\nimport {\n\tINPUT_SOURCE,\n\tWORKFLOW_INPUTS,\n\tJSON_EXAMPLE,\n\tVALUES,\n\tTYPE_OPTIONS,\n\tPASSTHROUGH,\n\tFALLBACK_DEFAULT_VALUE,\n} from '../../../utils/workflowInputsResourceMapping/constants';\nimport { getFieldEntries } from '../../../utils/workflowInputsResourceMapping/GenericFunctions';\n\nexport class ExecuteWorkflowTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Execute Workflow Trigger',\n\t\tname: 'executeWorkflowTrigger',\n\t\ticon: 'fa:sign-out-alt',\n\t\tgroup: ['trigger'],\n\t\tversion: [1, 1.1],\n\t\tdescription:\n\t\t\t'Helpers for calling other n8n workflows. Used for designing modular, microservice-like workflows.',\n\t\teventTriggerDescription: '',\n\t\tmaxNodes: 1,\n\t\tdefaults: {\n\t\t\tname: 'When Executed by Another Workflow',\n\t\t\tcolor: '#ff6d5a',\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\thints: [\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"This workflow isn't set to accept any input data. Fill out the workflow input schema or change the workflow to accept any data passed to it.\",\n\t\t\t\t// This condition checks if we have no input fields, which gets a bit awkward:\n\t\t\t\t// For WORKFLOW_INPUTS: keys() only contains `VALUES` if at least one value is provided\n\t\t\t\t// For JSON_EXAMPLE: We remove all whitespace and check if we're left with an empty object. Note that we already error if the example is not valid JSON\n\t\t\t\tdisplayCondition:\n\t\t\t\t\t`={{$parameter['${INPUT_SOURCE}'] === '${WORKFLOW_INPUTS}' && !$parameter['${WORKFLOW_INPUTS}'].keys().length ` +\n\t\t\t\t\t`|| $parameter['${INPUT_SOURCE}'] === '${JSON_EXAMPLE}' && $parameter['${JSON_EXAMPLE}'].toString().replaceAll(' ', '').replaceAll('\\\\n', '') === '{}' }}`,\n\t\t\t\twhenToDisplay: 'always',\n\t\t\t\tlocation: 'ndv',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Events',\n\t\t\t\tname: 'events',\n\t\t\t\ttype: 'hidden',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Workflow Call',\n\t\t\t\t\t\tvalue: 'worklfow_call',\n\t\t\t\t\t\tdescription: 'When executed by another workflow using Execute Workflow Trigger',\n\t\t\t\t\t\taction: 'When executed by Another Workflow',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'worklfow_call',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t\"When an ‘execute workflow’ node calls this workflow, the execution starts here. Any data passed into the 'execute workflow' node will be output by this node.\",\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { eq: 1 } }] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'This node is out of date. Please upgrade by removing it and adding a new one',\n\t\t\t\tname: 'outdatedVersionWarning',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { eq: 1 } }] } },\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'Input data mode',\n\t\t\t\tname: INPUT_SOURCE,\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Define using fields below',\n\t\t\t\t\t\tvalue: WORKFLOW_INPUTS,\n\t\t\t\t\t\tdescription: 'Provide input fields via UI',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Define using JSON example',\n\t\t\t\t\t\tvalue: JSON_EXAMPLE,\n\t\t\t\t\t\tdescription: 'Generate a schema from an example JSON object',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Accept all data',\n\t\t\t\t\t\tvalue: PASSTHROUGH,\n\t\t\t\t\t\tdescription: 'Use all incoming data from the parent workflow',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: WORKFLOW_INPUTS,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Provide an example object to infer fields and their types.<br>To allow any type for a given field, set the value to null.',\n\t\t\t\tname: `${JSON_EXAMPLE}_notice`,\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [JSON_EXAMPLE] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'JSON Example',\n\t\t\t\tname: JSON_EXAMPLE,\n\t\t\t\ttype: 'json',\n\t\t\t\tdefault: JSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\taField: 'a string',\n\t\t\t\t\t\taNumber: 123,\n\t\t\t\t\t\tthisFieldAcceptsAnyType: null,\n\t\t\t\t\t\tanArray: [],\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [JSON_EXAMPLE] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Workflow Input Schema',\n\t\t\t\tname: WORKFLOW_INPUTS,\n\t\t\t\tplaceholder: 'Add field',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\tdescription:\n\t\t\t\t\t'Define expected input fields. If no inputs are provided, all data from the calling workflow will be passed through.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\tminRequiredFields: 1,\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [WORKFLOW_INPUTS] },\n\t\t\t\t},\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: VALUES,\n\t\t\t\t\t\tdisplayName: 'Values',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'e.g. fieldName',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'A unique name for this workflow input, used to reference it from another workflows',\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Type',\n\t\t\t\t\t\t\t\tname: 'type',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Expected data type for this input value. Determines how this field's values are stored, validated, and displayed.\",\n\t\t\t\t\t\t\t\toptions: TYPE_OPTIONS,\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tdefault: 'string',\n\t\t\t\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions) {\n\t\tconst inputData = this.getInputData();\n\t\tconst inputSource = this.getNodeParameter(INPUT_SOURCE, 0, PASSTHROUGH) as string;\n\n\t\t// Note on the data we receive from ExecuteWorkflow caller:\n\t\t//\n\t\t// The ExecuteWorkflow node typechecks all fields explicitly provided by the user here via the resourceMapper\n\t\t// and removes all fields that are in the schema, but `removed` in the resourceMapper.\n\t\t//\n\t\t// In passthrough and legacy node versions, inputData will line up since the resourceMapper is empty,\n\t\t// in which case all input is passed through.\n\t\t// In other cases we will already have matching types and fields provided by the resource mapper,\n\t\t// so we just need to be permissive on this end,\n\t\t// while ensuring we provide default values for fields in our schema, which are removed in the resourceMapper.\n\n\t\tif (inputSource === PASSTHROUGH) {\n\t\t\treturn [inputData];\n\t\t} else {\n\t\t\tconst newParams = getFieldEntries(this);\n\t\t\tconst newKeys = new Set(newParams.fields.map((x) => x.name));\n\t\t\tconst itemsInSchema: INodeExecutionData[] = inputData.map(({ json, binary }, index) => ({\n\t\t\t\tjson: {\n\t\t\t\t\t...Object.fromEntries(newParams.fields.map((x) => [x.name, FALLBACK_DEFAULT_VALUE])),\n\t\t\t\t\t// Need to trim to the expected schema to support legacy Execute Workflow callers passing through all their data\n\t\t\t\t\t// which we do not want to expose past this node.\n\t\t\t\t\t..._.pickBy(json, (_value, key) => newKeys.has(key)),\n\t\t\t\t},\n\t\t\t\tindex,\n\t\t\t\tbinary,\n\t\t\t}));\n\n\t\t\treturn [itemsInSchema];\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAc;AACd,0BAMO;AAEP,uBAQO;AACP,8BAAgC;AAEzB,MAAM,uBAA4C;AAAA,EAAlD;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,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,MACD,EAAE;AAEF,aAAO,CAAC,aAAa;AAAA,IACtB;AAAA,EACD;AACD;","names":["_"]}
1
+ {"version":3,"sources":["../../../../nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.ts"],"sourcesContent":["import pickBy from 'lodash/pickBy';\nimport {\n\ttype INodeExecutionData,\n\tNodeConnectionTypes,\n\ttype IExecuteFunctions,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n} from 'n8n-workflow';\n\nimport {\n\tINPUT_SOURCE,\n\tWORKFLOW_INPUTS,\n\tJSON_EXAMPLE,\n\tVALUES,\n\tTYPE_OPTIONS,\n\tPASSTHROUGH,\n\tFALLBACK_DEFAULT_VALUE,\n} from '../../../utils/workflowInputsResourceMapping/constants';\nimport { getFieldEntries } from '../../../utils/workflowInputsResourceMapping/GenericFunctions';\n\nexport class ExecuteWorkflowTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Execute Workflow Trigger',\n\t\tname: 'executeWorkflowTrigger',\n\t\ticon: 'fa:sign-out-alt',\n\t\tgroup: ['trigger'],\n\t\tversion: [1, 1.1],\n\t\tdescription:\n\t\t\t'Helpers for calling other n8n workflows. Used for designing modular, microservice-like workflows.',\n\t\teventTriggerDescription: '',\n\t\tmaxNodes: 1,\n\t\tdefaults: {\n\t\t\tname: 'When Executed by Another Workflow',\n\t\t\tcolor: '#ff6d5a',\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\thints: [\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"This workflow isn't set to accept any input data. Fill out the workflow input schema or change the workflow to accept any data passed to it.\",\n\t\t\t\t// This condition checks if we have no input fields, which gets a bit awkward:\n\t\t\t\t// For WORKFLOW_INPUTS: keys() only contains `VALUES` if at least one value is provided\n\t\t\t\t// For JSON_EXAMPLE: We remove all whitespace and check if we're left with an empty object. Note that we already error if the example is not valid JSON\n\t\t\t\tdisplayCondition:\n\t\t\t\t\t`={{$parameter['${INPUT_SOURCE}'] === '${WORKFLOW_INPUTS}' && !$parameter['${WORKFLOW_INPUTS}'].keys().length ` +\n\t\t\t\t\t`|| $parameter['${INPUT_SOURCE}'] === '${JSON_EXAMPLE}' && $parameter['${JSON_EXAMPLE}'].toString().replaceAll(' ', '').replaceAll('\\\\n', '') === '{}' }}`,\n\t\t\t\twhenToDisplay: 'always',\n\t\t\t\tlocation: 'ndv',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Events',\n\t\t\t\tname: 'events',\n\t\t\t\ttype: 'hidden',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Workflow Call',\n\t\t\t\t\t\tvalue: 'worklfow_call',\n\t\t\t\t\t\tdescription: 'When executed by another workflow using Execute Workflow Trigger',\n\t\t\t\t\t\taction: 'When executed by Another Workflow',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'worklfow_call',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t\"When an ‘execute workflow’ node calls this workflow, the execution starts here. Any data passed into the 'execute workflow' node will be output by this node.\",\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { eq: 1 } }] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'This node is out of date. Please upgrade by removing it and adding a new one',\n\t\t\t\tname: 'outdatedVersionWarning',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { eq: 1 } }] } },\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'Input data mode',\n\t\t\t\tname: INPUT_SOURCE,\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Define using fields below',\n\t\t\t\t\t\tvalue: WORKFLOW_INPUTS,\n\t\t\t\t\t\tdescription: 'Provide input fields via UI',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Define using JSON example',\n\t\t\t\t\t\tvalue: JSON_EXAMPLE,\n\t\t\t\t\t\tdescription: 'Generate a schema from an example JSON object',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'Accept all data',\n\t\t\t\t\t\tvalue: PASSTHROUGH,\n\t\t\t\t\t\tdescription: 'Use all incoming data from the parent workflow',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: WORKFLOW_INPUTS,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Provide an example object to infer fields and their types.<br>To allow any type for a given field, set the value to null.',\n\t\t\t\tname: `${JSON_EXAMPLE}_notice`,\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [JSON_EXAMPLE] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'JSON Example',\n\t\t\t\tname: JSON_EXAMPLE,\n\t\t\t\ttype: 'json',\n\t\t\t\tdefault: JSON.stringify(\n\t\t\t\t\t{\n\t\t\t\t\t\taField: 'a string',\n\t\t\t\t\t\taNumber: 123,\n\t\t\t\t\t\tthisFieldAcceptsAnyType: null,\n\t\t\t\t\t\tanArray: [],\n\t\t\t\t\t},\n\t\t\t\t\tnull,\n\t\t\t\t\t2,\n\t\t\t\t),\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [JSON_EXAMPLE] },\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Workflow Input Schema',\n\t\t\t\tname: WORKFLOW_INPUTS,\n\t\t\t\tplaceholder: 'Add field',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\tdescription:\n\t\t\t\t\t'Define expected input fields. If no inputs are provided, all data from the calling workflow will be passed through.',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\tminRequiredFields: 1,\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: [WORKFLOW_INPUTS] },\n\t\t\t\t},\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: VALUES,\n\t\t\t\t\t\tdisplayName: 'Values',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'e.g. fieldName',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'A unique name for this workflow input, used to reference it from another workflows',\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Type',\n\t\t\t\t\t\t\t\tname: 'type',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Expected data type for this input value. Determines how this field's values are stored, validated, and displayed.\",\n\t\t\t\t\t\t\t\toptions: TYPE_OPTIONS,\n\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\tdefault: 'string',\n\t\t\t\t\t\t\t\tnoDataExpression: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions) {\n\t\tconst inputData = this.getInputData();\n\t\tconst inputSource = this.getNodeParameter(INPUT_SOURCE, 0, PASSTHROUGH) as string;\n\n\t\t// Note on the data we receive from ExecuteWorkflow caller:\n\t\t//\n\t\t// The ExecuteWorkflow node typechecks all fields explicitly provided by the user here via the resourceMapper\n\t\t// and removes all fields that are in the schema, but `removed` in the resourceMapper.\n\t\t//\n\t\t// In passthrough and legacy node versions, inputData will line up since the resourceMapper is empty,\n\t\t// in which case all input is passed through.\n\t\t// In other cases we will already have matching types and fields provided by the resource mapper,\n\t\t// so we just need to be permissive on this end,\n\t\t// while ensuring we provide default values for fields in our schema, which are removed in the resourceMapper.\n\n\t\tif (inputSource === PASSTHROUGH) {\n\t\t\treturn [inputData];\n\t\t} else {\n\t\t\tconst newParams = getFieldEntries(this);\n\t\t\tconst newKeys = new Set(newParams.fields.map((x) => x.name));\n\t\t\tconst itemsInSchema: INodeExecutionData[] = inputData.map(({ json, binary }, index) => ({\n\t\t\t\tjson: {\n\t\t\t\t\t...Object.fromEntries(newParams.fields.map((x) => [x.name, FALLBACK_DEFAULT_VALUE])),\n\t\t\t\t\t// Need to trim to the expected schema to support legacy Execute Workflow callers passing through all their data\n\t\t\t\t\t// which we do not want to expose past this node.\n\t\t\t\t\t...pickBy(json, (_value, key) => newKeys.has(key)),\n\t\t\t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,gBAAsC,UAAU,IAAI,CAAC,EAAE,MAAM,OAAO,GAAG,WAAW;AAAA,QACvF,MAAM;AAAA,UACL,GAAG,OAAO,YAAY,UAAU,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,uCAAsB,CAAC,CAAC;AAAA;AAAA;AAAA,UAGnF,OAAG,cAAAA,SAAO,MAAM,CAAC,QAAQ,QAAQ,QAAQ,IAAI,GAAG,CAAC;AAAA,QAClD;AAAA,QACA;AAAA,QACA;AAAA,MACD,EAAE;AAEF,aAAO,CAAC,aAAa;AAAA,IACtB;AAAA,EACD;AACD;","names":["pickBy"]}
@@ -24,12 +24,12 @@ __export(Form_node_exports, {
24
24
  module.exports = __toCommonJS(Form_node_exports);
25
25
  var import_n8n_workflow = require("n8n-workflow");
26
26
  var import_cssVariables = require("./cssVariables");
27
- var import_formCompletionUtils = require("./formCompletionUtils");
28
- var import_formNodeUtils = require("./formNodeUtils");
27
+ var import_formCompletionUtils = require("./utils/formCompletionUtils");
28
+ var import_formNodeUtils = require("./utils/formNodeUtils");
29
+ var import_utils = require("./utils/utils");
29
30
  var import_configureWaitTillDate = require("../../utils/sendAndWait/configureWaitTillDate.util");
30
31
  var import_descriptions = require("../../utils/sendAndWait/descriptions");
31
32
  var import_common = require("../Form/common.descriptions");
32
- var import_utils = require("../Form/utils");
33
33
  const waitTimeProperties = [
34
34
  {
35
35
  displayName: "Limit Wait Time",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../nodes/Form/Form.node.ts"],"sourcesContent":["import type {\n\tFormFieldsParameter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeTypeDescription,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tNodeTypeAndVersion,\n} from 'n8n-workflow';\nimport {\n\tNode,\n\tupdateDisplayOptions,\n\tNodeOperationError,\n\tFORM_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\ttryToParseJsonToFormFields,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { cssVariables } from './cssVariables';\nimport { renderFormCompletion } from './formCompletionUtils';\nimport { renderFormNode } from './formNodeUtils';\nimport { configureWaitTillDate } from '../../utils/sendAndWait/configureWaitTillDate.util';\nimport { limitWaitTimeProperties } from '../../utils/sendAndWait/descriptions';\nimport { formDescription, formFields, formTitle } from '../Form/common.descriptions';\nimport { prepareFormReturnItem, resolveRawData } from '../Form/utils';\n\nconst waitTimeProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Limit Wait Time',\n\t\tname: 'limitWaitTime',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to limit the time this node should wait for a user response before execution resumes',\n\t},\n\t...updateDisplayOptions(\n\t\t{\n\t\t\tshow: {\n\t\t\t\tlimitWaitTime: [true],\n\t\t\t},\n\t\t},\n\t\tlimitWaitTimeProperties,\n\t),\n];\n\nexport const formFieldsProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Define Form',\n\t\tname: 'defineForm',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Using Fields Below',\n\t\t\t\tvalue: 'fields',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Using JSON',\n\t\t\t\tvalue: 'json',\n\t\t\t},\n\t\t],\n\t\tdefault: 'fields',\n\t},\n\t{\n\t\tdisplayName: 'Form Fields',\n\t\tname: 'jsonOutput',\n\t\ttype: 'json',\n\t\ttypeOptions: {\n\t\t\trows: 5,\n\t\t},\n\t\tdefault:\n\t\t\t'[\\n {\\n \"fieldLabel\":\"Name\",\\n \"placeholder\":\"enter you name\",\\n \"requiredField\":true\\n },\\n {\\n \"fieldLabel\":\"Age\",\\n \"fieldType\":\"number\",\\n \"placeholder\":\"enter your age\"\\n },\\n {\\n \"fieldLabel\":\"Email\",\\n \"fieldType\":\"email\",\\n \"requiredField\":true\\n }\\n]',\n\t\tvalidateType: 'form-fields',\n\t\tignoreValidationDuringExecution: true,\n\t\thint: '<a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.form/\" target=\"_blank\">See docs</a> for field syntax',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tdefineForm: ['json'],\n\t\t\t},\n\t\t},\n\t},\n\t{ ...formFields, displayOptions: { show: { defineForm: ['fields'] } } },\n];\n\nconst pageProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['page'],\n\t\t},\n\t},\n\t[\n\t\t...formFieldsProperties,\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false },\n\t\t\t\tformDescription,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Button Label',\n\t\t\t\t\tname: 'buttonLabel',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: 'Submit',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n);\n\nconst completionProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['completion'],\n\t\t},\n\t},\n\t[\n\t\t{\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\tdisplayName: 'On n8n Form Submission',\n\t\t\tname: 'respondWith',\n\t\t\ttype: 'options',\n\t\t\tdefault: 'text',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Completion Screen',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t\tdescription: 'Show a response text to the user',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Redirect to URL',\n\t\t\t\t\tvalue: 'redirect',\n\t\t\t\t\tdescription: 'Redirect the user to a URL',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Text',\n\t\t\t\t\tvalue: 'showText',\n\t\t\t\t\tdescription: 'Display simple text or HTML',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Return Binary File',\n\t\t\t\t\tvalue: 'returnBinary',\n\t\t\t\t\tdescription: 'Return incoming binary file',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'URL',\n\t\t\tname: 'redirectUrl',\n\t\t\tvalidateType: 'url',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Title',\n\t\t\tname: 'completionTitle',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Message',\n\t\t\tname: 'completionMessage',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Text',\n\t\t\tname: 'responseText',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['showText'],\n\t\t\t\t},\n\t\t\t},\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. Thanks for filling the form',\n\t\t\tdescription: 'The text to display on the page. Use HTML to show a customized web page.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Input Data Field Name',\n\t\t\tname: 'inputDataFieldName',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: 'data',\n\t\t\tplaceholder: 'e.g. data',\n\t\t\tdescription:\n\t\t\t\t'Find the name of input field containing the binary data to return in the Input panel on the left, in the Binary tab',\n\t\t\thint: 'The name of the input field containing the binary file data to be returned',\n\t\t},\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false, displayName: 'Completion Page Title' },\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n);\n\nexport class Form extends Node {\n\tnodeInputData: INodeExecutionData[] = [];\n\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'n8n Form',\n\t\tname: 'form',\n\t\ticon: 'file:form.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\t\tdefaults: {\n\t\t\tname: 'Form',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: 'responseNode',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'An n8n Form Trigger node must be set up before this node',\n\t\t\t\tname: 'triggerNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Page Type',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'page',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Next Form Page',\n\t\t\t\t\t\tvalue: 'page',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Form Ending',\n\t\t\t\t\t\tvalue: 'completion',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t...pageProperties,\n\t\t\t...completionProperties,\n\t\t],\n\t};\n\n\tasync webhook(context: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = context.getResponseObject();\n\n\t\tconst operation = context.getNodeParameter('operation', '') as string;\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst trigger = parentNodes.find(\n\t\t\t(node) => node.type === 'n8n-nodes-base.formTrigger',\n\t\t) as NodeTypeAndVersion;\n\n\t\tconst mode = context.evaluateExpression(`{{ $('${trigger?.name}').first().json.formMode }}`) as\n\t\t\t| 'test'\n\t\t\t| 'production';\n\n\t\tconst defineForm = context.getNodeParameter('defineForm', false) as string;\n\n\t\tlet fields: FormFieldsParameter = [];\n\t\tif (defineForm === 'json') {\n\t\t\ttry {\n\t\t\t\tconst jsonOutput = context.getNodeParameter('jsonOutput', '', {\n\t\t\t\t\trawExpressions: true,\n\t\t\t\t}) as string;\n\n\t\t\t\tfields = tryToParseJsonToFormFields(resolveRawData(context, jsonOutput));\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), error.message, {\n\t\t\t\t\tdescription: error.message,\n\t\t\t\t\ttype: mode === 'test' ? 'manual-form-test' : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tfields = context.getNodeParameter('formFields.values', []) as FormFieldsParameter;\n\t\t}\n\n\t\tconst method = context.getRequestObject().method;\n\n\t\tif (operation === 'completion' && method === 'GET') {\n\t\t\treturn await renderFormCompletion(context, res, trigger);\n\t\t}\n\n\t\tif (operation === 'completion' && method === 'POST') {\n\t\t\treturn {\n\t\t\t\tworkflowData: [context.evaluateExpression('{{ $input.all() }}') as INodeExecutionData[]],\n\t\t\t};\n\t\t}\n\n\t\tif (method === 'GET') {\n\t\t\treturn await renderFormNode(context, res, trigger, fields, mode);\n\t\t}\n\n\t\tlet useWorkflowTimezone = context.evaluateExpression(\n\t\t\t`{{ $('${trigger?.name}').params.options?.useWorkflowTimezone }}`,\n\t\t) as boolean;\n\n\t\tif (useWorkflowTimezone === undefined && trigger?.typeVersion > 2) {\n\t\t\tuseWorkflowTimezone = true;\n\t\t}\n\n\t\tconst returnItem = await prepareFormReturnItem(context, fields, mode, useWorkflowTimezone);\n\n\t\treturn {\n\t\t\twebhookResponse: { status: 200 },\n\t\t\tworkflowData: [[returnItem]],\n\t\t};\n\t}\n\n\tasync execute(context: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst operation = context.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'completion') {\n\t\t\tthis.nodeInputData = context.getInputData();\n\t\t}\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst hasFormTrigger = parentNodes.some((node) => node.type === FORM_TRIGGER_NODE_TYPE);\n\n\t\tif (!hasFormTrigger) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Form Trigger node must be set before this node',\n\t\t\t);\n\t\t}\n\n\t\tconst childNodes = context.getChildNodes(context.getNode().name);\n\t\tconst hasNextPage = childNodes.some((node) => node.type === FORM_NODE_TYPE);\n\n\t\tif (operation === 'completion' && hasNextPage) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Completion has to be the last Form node in the workflow',\n\t\t\t);\n\t\t}\n\n\t\tconst waitTill = configureWaitTillDate(context, 'root');\n\t\tawait context.putExecutionToWait(waitTill);\n\n\t\tcontext.sendResponse({\n\t\t\theaders: {\n\t\t\t\tlocation: context.evaluateExpression('{{ $execution.resumeFormUrl }}', 0),\n\t\t\t},\n\t\t\tstatusCode: 307,\n\t\t});\n\n\t\treturn [context.getInputData()];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,0BAQO;AAEP,0BAA6B;AAC7B,iCAAqC;AACrC,2BAA+B;AAC/B,mCAAsC;AACtC,0BAAwC;AACxC,oBAAuD;AACvD,mBAAsD;AAEtD,MAAM,qBAAwC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SA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1E,UAAM,YAAY,QAAQ,iBAAiB,aAAa,CAAC;AAEzD,QAAI,cAAc,cAAc;AAC/B,WAAK,gBAAgB,QAAQ,aAAa;AAAA,IAC3C;AAEA,UAAM,cAAc,QAAQ,eAAe,QAAQ,QAAQ,EAAE,IAAI;AACjE,UAAM,iBAAiB,YAAY,KAAK,CAAC,SAAS,KAAK,SAAS,0CAAsB;AAEtF,QAAI,CAAC,gBAAgB;AACpB,YAAM,IAAI;AAAA,QACT,QAAQ,QAAQ;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,UAAM,aAAa,QAAQ,cAAc,QAAQ,QAAQ,EAAE,IAAI;AAC/D,UAAM,cAAc,WAAW,KAAK,CAAC,SAAS,KAAK,SAAS,kCAAc;AAE1E,QAAI,cAAc,gBAAgB,aAAa;AAC9C,YAAM,IAAI;AAAA,QACT,QAAQ,QAAQ;AAAA,QAChB;AAAA,MACD;AAAA,IACD;AAEA,UAAM,eAAW,oDAAsB,SAAS,MAAM;AACtD,UAAM,QAAQ,mBAAmB,QAAQ;AAEzC,YAAQ,aAAa;AAAA,MACpB,SAAS;AAAA,QACR,UAAU,QAAQ,mBAAmB,kCAAkC,CAAC;AAAA,MACzE;AAAA,MACA,YAAY;AAAA,IACb,CAAC;AAED,WAAO,CAAC,QAAQ,aAAa,CAAC;AAAA,EAC/B;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../nodes/Form/Form.node.ts"],"sourcesContent":["import type {\n\tFormFieldsParameter,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeTypeDescription,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tNodeTypeAndVersion,\n} from 'n8n-workflow';\nimport {\n\tNode,\n\tupdateDisplayOptions,\n\tNodeOperationError,\n\tFORM_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\ttryToParseJsonToFormFields,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport { cssVariables } from './cssVariables';\nimport { renderFormCompletion } from './utils/formCompletionUtils';\nimport { renderFormNode } from './utils/formNodeUtils';\nimport { prepareFormReturnItem, resolveRawData } from './utils/utils';\nimport { configureWaitTillDate } from '../../utils/sendAndWait/configureWaitTillDate.util';\nimport { limitWaitTimeProperties } from '../../utils/sendAndWait/descriptions';\nimport { formDescription, formFields, formTitle } from '../Form/common.descriptions';\n\nconst waitTimeProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Limit Wait Time',\n\t\tname: 'limitWaitTime',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t'Whether to limit the time this node should wait for a user response before execution resumes',\n\t},\n\t...updateDisplayOptions(\n\t\t{\n\t\t\tshow: {\n\t\t\t\tlimitWaitTime: [true],\n\t\t\t},\n\t\t},\n\t\tlimitWaitTimeProperties,\n\t),\n];\n\nexport const formFieldsProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Define Form',\n\t\tname: 'defineForm',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Using Fields Below',\n\t\t\t\tvalue: 'fields',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Using JSON',\n\t\t\t\tvalue: 'json',\n\t\t\t},\n\t\t],\n\t\tdefault: 'fields',\n\t},\n\t{\n\t\tdisplayName: 'Form Fields',\n\t\tname: 'jsonOutput',\n\t\ttype: 'json',\n\t\ttypeOptions: {\n\t\t\trows: 5,\n\t\t},\n\t\tdefault:\n\t\t\t'[\\n {\\n \"fieldLabel\":\"Name\",\\n \"placeholder\":\"enter you name\",\\n \"requiredField\":true\\n },\\n {\\n \"fieldLabel\":\"Age\",\\n \"fieldType\":\"number\",\\n \"placeholder\":\"enter your age\"\\n },\\n {\\n \"fieldLabel\":\"Email\",\\n \"fieldType\":\"email\",\\n \"requiredField\":true\\n }\\n]',\n\t\tvalidateType: 'form-fields',\n\t\tignoreValidationDuringExecution: true,\n\t\thint: '<a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.form/\" target=\"_blank\">See docs</a> for field syntax',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tdefineForm: ['json'],\n\t\t\t},\n\t\t},\n\t},\n\t{ ...formFields, displayOptions: { show: { defineForm: ['fields'] } } },\n];\n\nconst pageProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['page'],\n\t\t},\n\t},\n\t[\n\t\t...formFieldsProperties,\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false },\n\t\t\t\tformDescription,\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Button Label',\n\t\t\t\t\tname: 'buttonLabel',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: 'Submit',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n);\n\nconst completionProperties = updateDisplayOptions(\n\t{\n\t\tshow: {\n\t\t\toperation: ['completion'],\n\t\t},\n\t},\n\t[\n\t\t{\n\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\tdisplayName: 'On n8n Form Submission',\n\t\t\tname: 'respondWith',\n\t\t\ttype: 'options',\n\t\t\tdefault: 'text',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Completion Screen',\n\t\t\t\t\tvalue: 'text',\n\t\t\t\t\tdescription: 'Show a response text to the user',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Redirect to URL',\n\t\t\t\t\tvalue: 'redirect',\n\t\t\t\t\tdescription: 'Redirect the user to a URL',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Show Text',\n\t\t\t\t\tvalue: 'showText',\n\t\t\t\t\tdescription: 'Display simple text or HTML',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Return Binary File',\n\t\t\t\t\tvalue: 'returnBinary',\n\t\t\t\t\tdescription: 'Return incoming binary file',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'URL',\n\t\t\tname: 'redirectUrl',\n\t\t\tvalidateType: 'url',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Title',\n\t\t\tname: 'completionTitle',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\trequired: true,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Completion Message',\n\t\t\tname: 'completionMessage',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Text',\n\t\t\tname: 'responseText',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['showText'],\n\t\t\t\t},\n\t\t\t},\n\t\t\ttypeOptions: {\n\t\t\t\trows: 2,\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'e.g. Thanks for filling the form',\n\t\t\tdescription: 'The text to display on the page. Use HTML to show a customized web page.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Input Data Field Name',\n\t\t\tname: 'inputDataFieldName',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: 'data',\n\t\t\tplaceholder: 'e.g. data',\n\t\t\tdescription:\n\t\t\t\t'Find the name of input field containing the binary data to return in the Input panel on the left, in the Binary tab',\n\t\t\thint: 'The name of the input field containing the binary file data to be returned',\n\t\t},\n\t\t...waitTimeProperties,\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{ ...formTitle, required: false, displayName: 'Completion Page Title' },\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Form Styling',\n\t\t\t\t\tname: 'customCss',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\trows: 10,\n\t\t\t\t\t\teditor: 'cssEditor',\n\t\t\t\t\t},\n\t\t\t\t\tdefault: cssVariables.trim(),\n\t\t\t\t\tdescription: 'Override default styling of the public form interface with CSS',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\trespondWith: ['text', 'returnBinary'],\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n);\n\nexport class Form extends Node {\n\tnodeInputData: INodeExecutionData[] = [];\n\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'n8n Form',\n\t\tname: 'form',\n\t\ticon: 'file:form.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Generate webforms in n8n and pass their responses to the workflow',\n\t\tdefaults: {\n\t\t\tname: 'Form',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: 'responseNode',\n\t\t\t\tpath: '',\n\t\t\t\trestartWebhook: true,\n\t\t\t\tisFullPath: true,\n\t\t\t\tnodeType: 'form',\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'An n8n Form Trigger node must be set up before this node',\n\t\t\t\tname: 'triggerNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Page Type',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tdefault: 'page',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Next Form Page',\n\t\t\t\t\t\tvalue: 'page',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Form Ending',\n\t\t\t\t\t\tvalue: 'completion',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t...pageProperties,\n\t\t\t...completionProperties,\n\t\t],\n\t};\n\n\tasync webhook(context: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = context.getResponseObject();\n\n\t\tconst operation = context.getNodeParameter('operation', '') as string;\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst trigger = parentNodes.find(\n\t\t\t(node) => node.type === 'n8n-nodes-base.formTrigger',\n\t\t) as NodeTypeAndVersion;\n\n\t\tconst mode = context.evaluateExpression(`{{ $('${trigger?.name}').first().json.formMode }}`) as\n\t\t\t| 'test'\n\t\t\t| 'production';\n\n\t\tconst defineForm = context.getNodeParameter('defineForm', false) as string;\n\n\t\tlet fields: FormFieldsParameter = [];\n\t\tif (defineForm === 'json') {\n\t\t\ttry {\n\t\t\t\tconst jsonOutput = context.getNodeParameter('jsonOutput', '', {\n\t\t\t\t\trawExpressions: true,\n\t\t\t\t}) as string;\n\n\t\t\t\tfields = tryToParseJsonToFormFields(resolveRawData(context, jsonOutput));\n\t\t\t} catch (error) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), error.message, {\n\t\t\t\t\tdescription: error.message,\n\t\t\t\t\ttype: mode === 'test' ? 'manual-form-test' : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tfields = context.getNodeParameter('formFields.values', []) as FormFieldsParameter;\n\t\t}\n\n\t\tconst method = context.getRequestObject().method;\n\n\t\tif (operation === 'completion' && method === 'GET') {\n\t\t\treturn await renderFormCompletion(context, res, trigger);\n\t\t}\n\n\t\tif (operation === 'completion' && method === 'POST') {\n\t\t\treturn {\n\t\t\t\tworkflowData: [context.evaluateExpression('{{ $input.all() }}') as INodeExecutionData[]],\n\t\t\t};\n\t\t}\n\n\t\tif (method === 'GET') {\n\t\t\treturn await renderFormNode(context, res, trigger, fields, mode);\n\t\t}\n\n\t\tlet useWorkflowTimezone = context.evaluateExpression(\n\t\t\t`{{ $('${trigger?.name}').params.options?.useWorkflowTimezone }}`,\n\t\t) as boolean;\n\n\t\tif (useWorkflowTimezone === undefined && trigger?.typeVersion > 2) {\n\t\t\tuseWorkflowTimezone = true;\n\t\t}\n\n\t\tconst returnItem = await prepareFormReturnItem(context, fields, mode, useWorkflowTimezone);\n\n\t\treturn {\n\t\t\twebhookResponse: { status: 200 },\n\t\t\tworkflowData: [[returnItem]],\n\t\t};\n\t}\n\n\tasync execute(context: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst operation = context.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'completion') {\n\t\t\tthis.nodeInputData = context.getInputData();\n\t\t}\n\n\t\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\t\tconst hasFormTrigger = parentNodes.some((node) => node.type === FORM_TRIGGER_NODE_TYPE);\n\n\t\tif (!hasFormTrigger) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Form Trigger node must be set before this node',\n\t\t\t);\n\t\t}\n\n\t\tconst childNodes = context.getChildNodes(context.getNode().name);\n\t\tconst hasNextPage = childNodes.some((node) => node.type === FORM_NODE_TYPE);\n\n\t\tif (operation === 'completion' && hasNextPage) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Completion has to be the last Form node in the workflow',\n\t\t\t);\n\t\t}\n\n\t\tconst waitTill = configureWaitTillDate(context, 'root');\n\t\tawait context.putExecutionToWait(waitTill);\n\n\t\tcontext.sendResponse({\n\t\t\theaders: {\n\t\t\t\tlocation: context.evaluateExpression('{{ $execution.resumeFormUrl }}', 0),\n\t\t\t},\n\t\t\tstatusCode: 307,\n\t\t});\n\n\t\treturn [context.getInputData()];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,0BAQO;AAEP,0BAA6B;AAC7B,iCAAqC;AACrC,2BAA+B;AAC/B,mBAAsD;AACtD,mCAAsC;AACtC,0BAAwC;AACxC,oBAAuD;AAEvD,MAAM,qBAAwC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,EACF;AAAA,EACA,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