n8n-nodes-base 1.91.1 → 1.93.0
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.
- package/dist/credentials/Aws.credentials.js +0 -2
- package/dist/credentials/Aws.credentials.js.map +1 -1
- package/dist/credentials/JinaAiApi.credentials.js +61 -0
- package/dist/credentials/JinaAiApi.credentials.js.map +1 -0
- package/dist/credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.js +1 -1
- package/dist/credentials/MicrosoftAzureCosmosDbSharedKeyApi.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftSharePointOAuth2Api.credentials.js +0 -9
- package/dist/credentials/MicrosoftSharePointOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js +13 -0
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/Snowflake.credentials.js +46 -2
- package/dist/credentials/Snowflake.credentials.js.map +1 -1
- package/dist/known/credentials.json +18 -1
- package/dist/known/nodes.json +28 -0
- package/dist/methods/defined.json +6 -0
- package/dist/methods/referenced.json +3 -0
- package/dist/nodes/Affinity/__schema__/v1.0.0/listEntry/getAll.json +1 -4
- package/dist/nodes/Airtop/__schema__/v1.0.0/extraction/query.json +47 -0
- package/dist/nodes/Aws/Cognito/AwsCognito.node.js +102 -0
- package/dist/nodes/Aws/Cognito/AwsCognito.node.js.map +1 -0
- package/dist/nodes/Aws/Cognito/AwsCognito.node.json +18 -0
- package/dist/nodes/Aws/Cognito/cognito.svg +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/common.description.js +160 -0
- package/dist/nodes/Aws/Cognito/descriptions/common.description.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/Group.resource.js +189 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/Group.resource.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/create.operation.js +126 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/create.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/delete.operation.js +47 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/get.operation.js +54 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/get.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/getAll.operation.js +95 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/update.operation.js +120 -0
- package/dist/nodes/Aws/Cognito/descriptions/group/update.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/index.js +45 -0
- package/dist/nodes/Aws/Cognito/descriptions/index.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/User.resource.js +263 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/User.resource.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/addToGroup.operation.js +51 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/addToGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/create.operation.js +299 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/create.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/delete.operation.js +47 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/get.operation.js +54 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/get.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/getAll.operation.js +187 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/removeFromGroup.operation.js +60 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/removeFromGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/update.operation.js +189 -0
- package/dist/nodes/Aws/Cognito/descriptions/user/update.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/userPool/UserPool.resource.js +81 -0
- package/dist/nodes/Aws/Cognito/descriptions/userPool/UserPool.resource.js.map +1 -0
- package/dist/nodes/Aws/Cognito/descriptions/userPool/get.operation.js +50 -0
- package/dist/nodes/Aws/Cognito/descriptions/userPool/get.operation.js.map +1 -0
- package/dist/nodes/Aws/Cognito/helpers/constants.js +91 -0
- package/dist/nodes/Aws/Cognito/helpers/constants.js.map +1 -0
- package/dist/nodes/Aws/Cognito/helpers/errorHandler.js +109 -0
- package/dist/nodes/Aws/Cognito/helpers/errorHandler.js.map +1 -0
- package/dist/nodes/Aws/Cognito/helpers/interfaces.js +17 -0
- package/dist/nodes/Aws/Cognito/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Aws/Cognito/helpers/utils.js +318 -0
- package/dist/nodes/Aws/Cognito/helpers/utils.js.map +1 -0
- package/dist/nodes/Aws/Cognito/methods/index.js +39 -0
- package/dist/nodes/Aws/Cognito/methods/index.js.map +1 -0
- package/dist/nodes/Aws/Cognito/methods/listSearch.js +157 -0
- package/dist/nodes/Aws/Cognito/methods/listSearch.js.map +1 -0
- package/dist/nodes/Aws/Cognito/transport/index.js +72 -0
- package/dist/nodes/Aws/Cognito/transport/index.js.map +1 -0
- package/dist/nodes/Aws/IAM/AwsIam.node.js +95 -0
- package/dist/nodes/Aws/IAM/AwsIam.node.js.map +1 -0
- package/dist/nodes/Aws/IAM/AwsIam.node.json +18 -0
- package/dist/nodes/Aws/IAM/AwsIam.svg +18 -0
- package/dist/nodes/Aws/IAM/descriptions/common.js +188 -0
- package/dist/nodes/Aws/IAM/descriptions/common.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/Group.resource.js +175 -0
- package/dist/nodes/Aws/IAM/descriptions/group/Group.resource.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/create.operation.js +66 -0
- package/dist/nodes/Aws/IAM/descriptions/group/create.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/delete.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/group/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/get.operation.js +50 -0
- package/dist/nodes/Aws/IAM/descriptions/group/get.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/getAll.operation.js +47 -0
- package/dist/nodes/Aws/IAM/descriptions/group/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/update.operation.js +70 -0
- package/dist/nodes/Aws/IAM/descriptions/group/update.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/index.js +42 -0
- package/dist/nodes/Aws/IAM/descriptions/index.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/User.resource.js +231 -0
- package/dist/nodes/Aws/IAM/descriptions/user/User.resource.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/addToGroup.operation.js +47 -0
- package/dist/nodes/Aws/IAM/descriptions/user/addToGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/create.operation.js +118 -0
- package/dist/nodes/Aws/IAM/descriptions/user/create.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/delete.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/user/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/get.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/user/get.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/getAll.operation.js +66 -0
- package/dist/nodes/Aws/IAM/descriptions/user/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/removeFromGroup.operation.js +74 -0
- package/dist/nodes/Aws/IAM/descriptions/user/removeFromGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/update.operation.js +68 -0
- package/dist/nodes/Aws/IAM/descriptions/user/update.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/constants.js +47 -0
- package/dist/nodes/Aws/IAM/helpers/constants.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/errorHandler.js +90 -0
- package/dist/nodes/Aws/IAM/helpers/errorHandler.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/types.js +17 -0
- package/dist/nodes/Aws/IAM/helpers/types.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/utils.js +279 -0
- package/dist/nodes/Aws/IAM/helpers/utils.js.map +1 -0
- package/dist/nodes/Aws/IAM/methods/index.js +39 -0
- package/dist/nodes/Aws/IAM/methods/index.js.map +1 -0
- package/dist/nodes/Aws/IAM/methods/listSearch.js +132 -0
- package/dist/nodes/Aws/IAM/methods/listSearch.js.map +1 -0
- package/dist/nodes/Aws/IAM/transport/index.js +64 -0
- package/dist/nodes/Aws/IAM/transport/index.js.map +1 -0
- package/dist/nodes/Aws/S3/__schema__/v2.0.0/file/getAll.json +1 -7
- package/dist/nodes/BambooHr/__schema__/v1.0.0/employee/get.json +10 -1
- package/dist/nodes/Cron/Cron.node.js +1 -1
- package/dist/nodes/Cron/Cron.node.js.map +1 -1
- package/dist/nodes/Dropcontact/__schema__/v1.0.0/contact/enrich.json +7 -15
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js +2 -2
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +2 -2
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
- package/dist/nodes/EmailSend/__schema__/v2.1.0/email/send.json +7 -1
- package/dist/nodes/Evaluation/Evaluation/Description.node.js +146 -0
- package/dist/nodes/Evaluation/Evaluation/Description.node.js.map +1 -0
- package/dist/nodes/Evaluation/Evaluation/Evaluation.node.ee.js +117 -0
- package/dist/nodes/Evaluation/Evaluation/Evaluation.node.ee.js.map +1 -0
- package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js +187 -0
- package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js.map +1 -0
- package/dist/nodes/Evaluation/methods/index.js +42 -0
- package/dist/nodes/Evaluation/methods/index.js.map +1 -0
- package/dist/nodes/Evaluation/methods/loadOptions.js +40 -0
- package/dist/nodes/Evaluation/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Evaluation/utils/evaluationTriggerUtils.js +119 -0
- package/dist/nodes/Evaluation/utils/evaluationTriggerUtils.js.map +1 -0
- package/dist/nodes/Evaluation/utils/evaluationUtils.js +171 -0
- package/dist/nodes/Evaluation/utils/evaluationUtils.js.map +1 -0
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js +4 -3
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js.map +1 -1
- package/dist/nodes/Form/common.descriptions.js +2 -2
- package/dist/nodes/Form/common.descriptions.js.map +1 -1
- package/dist/nodes/Github/__schema__/v1.1.0/file/list.json +44 -0
- package/dist/nodes/Gitlab/__schema__/v1.0.0/file/get.json +1 -4
- package/dist/nodes/Google/BusinessProfile/__schema__/v1.0.0/review/getAll.json +1 -12
- package/dist/nodes/Google/Calendar/__schema__/v1.3.0/event/getAll.json +4 -7
- package/dist/nodes/Google/Contacts/__schema__/v1.0.0/contact/getAll.json +1 -12
- package/dist/nodes/Google/Drive/__schema__/v3.0.0/file/download.json +9 -0
- package/dist/nodes/Google/Firebase/CloudFirestore/__schema__/v1.1.0/document/query.json +7 -1
- package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/addLabels.json +1 -13
- package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/get.json +7 -1
- package/dist/nodes/Google/Gmail/__schema__/v2.1.0/message/getAll.json +29 -113
- package/dist/nodes/Google/Gmail/__schema__/v2.1.0/thread/get.json +1 -60
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js +3 -2
- package/dist/nodes/Google/Sheet/GoogleSheets.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js +113 -107
- package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/read.operation.js +52 -105
- package/dist/nodes/Google/Sheet/v2/actions/sheet/read.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/utils/readOperation.js +97 -0
- package/dist/nodes/Google/Sheet/v2/actions/utils/readOperation.js.map +1 -0
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js +21 -18
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js +4 -0
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js.map +1 -1
- package/dist/nodes/Google/Task/__schema__/v1.0.0/task/getAll.json +1 -4
- package/dist/nodes/Google/YouTube/YouTube.node.js +4 -2
- package/dist/nodes/Google/YouTube/YouTube.node.js.map +1 -1
- package/dist/nodes/Google/YouTube/__schema__/v1.0.0/video/get.json +35 -1
- package/dist/nodes/Hubspot/__schema__/v2.1.0/company/getAll.json +4 -1
- package/dist/nodes/Hubspot/__schema__/v2.1.0/contact/search.json +1 -4
- package/dist/nodes/Hubspot/__schema__/v2.1.0/deal/getAll.json +45 -11
- package/dist/nodes/Hubspot/__schema__/v2.1.0/deal/search.json +2 -5
- package/dist/nodes/Hubspot/__schema__/v2.1.0/ticket/get.json +4 -4
- package/dist/nodes/Interval/Interval.node.js +1 -1
- package/dist/nodes/Interval/Interval.node.js.map +1 -1
- package/dist/nodes/ItemLists/__schema__/v3.0.0/itemList/limit.json +4 -1
- package/dist/nodes/JinaAI/JinaAi.node.js +486 -0
- package/dist/nodes/JinaAI/JinaAi.node.js.map +1 -0
- package/dist/nodes/JinaAI/JinaAi.node.json +18 -0
- package/dist/nodes/JinaAI/jinaAi.dark.svg +6 -0
- package/dist/nodes/JinaAI/jinaAi.svg +6 -0
- package/dist/nodes/Jira/__schema__/v1.0.0/issue/get.json +259 -1
- package/dist/nodes/Jira/__schema__/v1.0.0/issue/getAll.json +57 -37
- package/dist/nodes/Linear/__schema__/v1.0.0/issue/getAll.json +1 -12
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js +2 -2
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js.map +1 -1
- package/dist/nodes/MQTT/MqttTrigger.node.js +2 -2
- package/dist/nodes/MQTT/MqttTrigger.node.js.map +1 -1
- package/dist/nodes/ManualTrigger/ManualTrigger.node.js +1 -1
- package/dist/nodes/ManualTrigger/ManualTrigger.node.js.map +1 -1
- package/dist/nodes/Microsoft/AzureCosmosDb/AzureCosmosDb.node.json +2 -2
- package/dist/nodes/Microsoft/Entra/MicrosoftEntra.node.js +2 -2
- package/dist/nodes/Microsoft/Entra/MicrosoftEntra.node.js.map +1 -1
- package/dist/nodes/Microsoft/Entra/__schema__/v1.0.0/user/getAll.json +1 -7
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/event/getAll.json +4 -1
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/folderMessage/getAll.json +8 -47
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/message/get.json +124 -1
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/message/getAll.json +40 -20
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/message/sendAndWait.json +12 -11
- package/dist/nodes/Microsoft/Outlook/__schema__/v2.0.0/messageAttachment/get.json +13 -1
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js +93 -0
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharepoint.node.json +18 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/common.descriptions.js +190 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/common.descriptions.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/File.resource.js +108 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/File.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/download.operation.js +62 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/download.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js +129 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js +77 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/index.js +45 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/index.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js +175 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/create.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/create.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/delete.operation.js +62 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/delete.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/get.operation.js +83 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/getAll.operation.js +203 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/update.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/update.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/upsert.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/upsert.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js +99 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/get.operation.js +65 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/getAll.operation.js +105 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/interfaces.js +17 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/utils.js +252 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/utils.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/index.js +42 -0
- package/dist/nodes/Microsoft/SharePoint/methods/index.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/listSearch.js +222 -0
- package/dist/nodes/Microsoft/SharePoint/methods/listSearch.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/resourceMapping.js +104 -0
- package/dist/nodes/Microsoft/SharePoint/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/test/credentials.js +54 -0
- package/dist/nodes/Microsoft/SharePoint/test/credentials.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/transport/index.js +46 -0
- package/dist/nodes/Microsoft/SharePoint/transport/index.js.map +1 -0
- package/dist/nodes/Microsoft/Storage/__schema__/v1.0.0/blob/getAll.json +44 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.js +387 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.json +18 -0
- package/dist/nodes/Microsoft/Teams/__schema__/v2.0.0/channel/getAll.json +1 -4
- package/dist/nodes/Microsoft/Teams/v2/helpers/types.js +17 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/types.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils-trigger.js +147 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils-trigger.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/transport/index.js.map +1 -1
- package/dist/nodes/Microsoft/ToDo/__schema__/v1.0.0/task/getAll.json +21 -5
- package/dist/nodes/Notion/__schema__/v2.2.0/database/get.json +149 -2
- package/dist/nodes/Odoo/__schema__/v1.0.0/contact/getAll.json +10 -1
- package/dist/nodes/Odoo/__schema__/v1.0.0/custom/getAll.json +1 -4
- package/dist/nodes/Odoo/__schema__/v1.0.0/opportunity/getAll.json +49 -1
- package/dist/nodes/OpenAi/__schema__/v1.1.0/chat/complete.json +1 -29
- package/dist/nodes/Pipedrive/__schema__/v1.0.0/organization/search.json +20 -25
- package/dist/nodes/Pipedrive/__schema__/v1.0.0/person/search.json +1 -18
- package/dist/nodes/Plivo/__schema__/v1.0.0/call/make.json +15 -0
- package/dist/nodes/PostBin/BinDescription.js +1 -1
- package/dist/nodes/PostBin/BinDescription.js.map +1 -1
- package/dist/nodes/PostBin/GenericFunctions.js +5 -5
- package/dist/nodes/PostBin/GenericFunctions.js.map +1 -1
- package/dist/nodes/PostBin/PostBin.node.js +1 -1
- package/dist/nodes/PostBin/PostBin.node.js.map +1 -1
- package/dist/nodes/PostBin/RequestDescription.js +2 -2
- package/dist/nodes/PostBin/RequestDescription.js.map +1 -1
- package/dist/nodes/Postgres/PostgresTrigger.node.js +2 -2
- package/dist/nodes/Postgres/PostgresTrigger.node.js.map +1 -1
- package/dist/nodes/QuickBooks/__schema__/v1.0.0/transaction/getReport.json +1 -4
- package/dist/nodes/RabbitMQ/RabbitMQTrigger.node.js +2 -2
- package/dist/nodes/RabbitMQ/RabbitMQTrigger.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js +8 -3
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/utils.js +43 -0
- package/dist/nodes/RespondToWebhook/utils.js.map +1 -0
- package/dist/nodes/Salesforce/__schema__/v1.0.0/customObject/getAll.json +2 -2
- package/dist/nodes/Salesforce/__schema__/v1.0.0/opportunity/getAll.json +5 -2
- package/dist/nodes/Salesforce/__schema__/v1.0.0/task/getAll.json +4 -1
- package/dist/nodes/Schedule/ScheduleTrigger.node.js +1 -1
- package/dist/nodes/Schedule/ScheduleTrigger.node.js.map +1 -1
- package/dist/nodes/SeaTable/__schema__/v2.0.0/row/list.json +30 -0
- package/dist/nodes/ServiceNow/__schema__/v1.0.0/tableRecord/getAll.json +1 -4
- package/dist/nodes/Slack/__schema__/v2.3.0/channel/history.json +49 -3
- package/dist/nodes/Slack/__schema__/v2.3.0/message/post.json +4 -1
- package/dist/nodes/Snowflake/GenericFunctions.js +34 -2
- package/dist/nodes/Snowflake/GenericFunctions.js.map +1 -1
- package/dist/nodes/Snowflake/Snowflake.node.js +5 -7
- package/dist/nodes/Snowflake/Snowflake.node.js.map +1 -1
- package/dist/nodes/SseTrigger/SseTrigger.node.js +2 -2
- package/dist/nodes/SseTrigger/SseTrigger.node.js.map +1 -1
- package/dist/nodes/Ssh/__schema__/v1.0.0/command/execute.json +4 -1
- package/dist/nodes/Strapi/__schema__/v1.0.0/entry/get.json +32 -0
- package/dist/nodes/Strapi/__schema__/v1.0.0/entry/getAll.json +1 -4
- package/dist/nodes/Telegram/__schema__/v1.2.0/chat/get.json +27 -1
- package/dist/nodes/Telegram/__schema__/v1.2.0/chat/member.json +7 -1
- package/dist/nodes/Telegram/__schema__/v1.2.0/message/sendMessage.json +1 -4
- package/dist/nodes/Telegram/__schema__/v1.2.0/message/sendPhoto.json +4 -1
- package/dist/nodes/Trello/__schema__/v1.0.0/list/getAll.json +7 -1
- package/dist/nodes/Trello/__schema__/v1.0.0/list/getCards.json +13 -1
- package/dist/nodes/Wordpress/PageDescription.js +0 -17
- package/dist/nodes/Wordpress/PageDescription.js.map +1 -1
- package/dist/nodes/Wordpress/__schema__/v1.0.0/post/get.json +7 -1
- package/dist/nodes/Zoho/__schema__/v1.0.0/contact/getAll.json +15 -16
- package/dist/nodes/Zoho/__schema__/v1.0.0/lead/getAll.json +1 -122
- package/dist/nodes/Zoom/__schema__/v1.0.0/meeting/getAll.json +1 -4
- package/dist/types/credentials.json +8 -7
- package/dist/types/nodes.json +29 -22
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js +12 -2
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js.map +1 -1
- package/package.json +16 -9
- /package/dist/{credentials/icons/SharePoint.svg → nodes/Microsoft/SharePoint/microsoftSharePoint.svg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../nodes/EmailReadImap/v2/EmailReadImapV2.node.ts"],"sourcesContent":["import type { ImapSimple, ImapSimpleOptions, Message, MessagePart } from '@n8n/imap';\nimport { connect as imapConnect } from '@n8n/imap';\nimport isEmpty from 'lodash/isEmpty';\nimport type {\n\tITriggerFunctions,\n\tIBinaryData,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeType,\n\tINodeTypeBaseDescription,\n\tINodeTypeDescription,\n\tITriggerResponse,\n\tJsonObject,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, TriggerCloseError } from 'n8n-workflow';\nimport rfc2047 from 'rfc2047';\n\nimport type { ICredentialsDataImap } from '@credentials/Imap.credentials';\nimport { isCredentialsDataImap } from '@credentials/Imap.credentials';\n\nimport { getNewEmails } from './utils';\n\nconst versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Email Trigger (IMAP)',\n\tname: 'emailReadImap',\n\ticon: 'fa:inbox',\n\ticonColor: 'green',\n\tgroup: ['trigger'],\n\tversion: 2,\n\tdescription: 'Triggers the workflow when a new email is received',\n\teventTriggerDescription: 'Waiting for you to receive an email',\n\tdefaults: {\n\t\tname: 'Email Trigger (IMAP)',\n\t\tcolor: '#44AA22',\n\t},\n\ttriggerPanel: {\n\t\theader: '',\n\t\texecutionsHelp: {\n\t\t\tinactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'test step' button, then send an email to make an event happen. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time an email is received, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\tactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'test step' button, then send an email to make an event happen. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time an email is received, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t},\n\t\tactivationHint:\n\t\t\t\"Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).\",\n\t},\n\tusableAsTool: true,\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'imap',\n\t\t\trequired: true,\n\t\t\ttestedBy: 'imapConnectionTest',\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Mailbox Name',\n\t\t\tname: 'mailbox',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'INBOX',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Action',\n\t\t\tname: 'postProcessAction',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Mark as Read',\n\t\t\t\t\tvalue: 'read',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Nothing',\n\t\t\t\t\tvalue: 'nothing',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'read',\n\t\t\tdescription:\n\t\t\t\t'What to do after the email has been received. If \"nothing\" gets selected it will be processed multiple times.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Download Attachments',\n\t\t\tname: 'downloadAttachments',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Whether attachments of emails should be downloaded. Only set if needed as it increases processing.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Format',\n\t\t\tname: 'format',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'RAW',\n\t\t\t\t\tvalue: 'raw',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Resolved',\n\t\t\t\t\tvalue: 'resolved',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email with all data resolved and attachments saved as binary data',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Simple',\n\t\t\t\t\tvalue: 'simple',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email; do not use if you wish to gather inline attachments',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'simple',\n\t\t\tdescription: 'The format to return the message in',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['resolved'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t\tdownloadAttachments: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\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{\n\t\t\t\t\tdisplayName: 'Custom Email Rules',\n\t\t\t\t\tname: 'customEmailConfig',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '[\"UNSEEN\"]',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Custom email fetching rules. See <a href=\"https://github.com/mscdex/node-imap\">node-imap</a>\\'s search function for more details.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Force Reconnect Every Minutes',\n\t\t\t\t\tname: 'forceReconnect',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 60,\n\t\t\t\t\tdescription: 'Sets an interval (in minutes) to force a reconnection',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport class EmailReadImapV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync imapConnectionTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tif (isCredentialsDataImap(credential.data)) {\n\t\t\t\t\tconst credentials = credential.data as ICredentialsDataImap;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\t\t\t\timap: {\n\t\t\t\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\t\t\t\tport: credentials.port,\n\t\t\t\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\t\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (credentials.secure) {\n\t\t\t\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst connection = await imapConnect(config);\n\t\t\t\t\t\tawait connection.getBoxes();\n\t\t\t\t\t\tconnection.end();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: 'Credentials are no IMAP credentials.',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst credentialsObject = await this.getCredentials('imap');\n\t\tconst credentials = isCredentialsDataImap(credentialsObject) ? credentialsObject : undefined;\n\t\tif (!credentials) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Credentials are not valid for imap node.');\n\t\t}\n\t\tconst mailbox = this.getNodeParameter('mailbox') as string;\n\t\tconst postProcessAction = this.getNodeParameter('postProcessAction') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as IDataObject;\n\n\t\tconst staticData = this.getWorkflowStaticData('node');\n\t\tthis.logger.debug('Loaded static data for node \"EmailReadImap\"', { staticData });\n\n\t\tlet connection: ImapSimple;\n\t\tlet closeFunctionWasCalled = false;\n\t\tlet isCurrentlyReconnecting = false;\n\n\t\t// Returns the email text\n\n\t\tconst getText = async (\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t\tsubtype: string,\n\t\t): Promise<string> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst textParts = parts.filter((part) => {\n\t\t\t\treturn (\n\t\t\t\t\tpart.type.toUpperCase() === 'TEXT' && part.subtype.toUpperCase() === subtype.toUpperCase()\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tconst part = textParts[0];\n\t\t\tif (!part) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst partData = await connection.getPartData(message, part);\n\t\t\t\treturn partData.toString();\n\t\t\t} catch {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t};\n\n\t\t// Returns the email attachments\n\t\tconst getAttachment = async (\n\t\t\timapConnection: ImapSimple,\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t): Promise<IBinaryData[]> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Check if the message has attachments and if so get them\n\t\t\tconst attachmentParts = parts.filter(\n\t\t\t\t(part) => part.disposition?.type?.toUpperCase() === 'ATTACHMENT',\n\t\t\t);\n\n\t\t\tconst decodeFilename = (filename: string) => {\n\t\t\t\tconst regex = /=\\?([\\w-]+)\\?Q\\?.*\\?=/i;\n\t\t\t\tif (regex.test(filename)) {\n\t\t\t\t\treturn rfc2047.decode(filename);\n\t\t\t\t}\n\t\t\t\treturn filename;\n\t\t\t};\n\n\t\t\tconst attachmentPromises = [];\n\t\t\tlet attachmentPromise;\n\t\t\tfor (const attachmentPart of attachmentParts) {\n\t\t\t\tattachmentPromise = imapConnection\n\t\t\t\t\t.getPartData(message, attachmentPart)\n\t\t\t\t\t.then(async (partData) => {\n\t\t\t\t\t\t// if filename contains utf-8 encoded characters, decode it\n\t\t\t\t\t\tconst fileName = decodeFilename(\n\t\t\t\t\t\t\t((attachmentPart.disposition as IDataObject)?.params as IDataObject)\n\t\t\t\t\t\t\t\t?.filename as string,\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Return it in the format n8n expects\n\t\t\t\t\t\treturn await this.helpers.prepareBinaryData(partData.buffer, fileName);\n\t\t\t\t\t});\n\n\t\t\t\tattachmentPromises.push(attachmentPromise);\n\t\t\t}\n\n\t\t\treturn await Promise.all(attachmentPromises);\n\t\t};\n\n\t\tconst returnedPromise = this.helpers.createDeferredPromise();\n\n\t\tconst establishConnection = async (): Promise<ImapSimple> => {\n\t\t\tlet searchCriteria = ['UNSEEN'] as Array<string | string[]>;\n\t\t\tif (options.customEmailConfig !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tsearchCriteria = JSON.parse(options.customEmailConfig as string) as Array<\n\t\t\t\t\t\tstring | string[]\n\t\t\t\t\t>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Custom email config is not valid JSON.');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\timap: {\n\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\tport: credentials.port,\n\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t},\n\t\t\t\tonMail: async () => {\n\t\t\t\t\tif (connection) {\n\t\t\t\t\t\tif (staticData.lastMessageUid !== undefined) {\n\t\t\t\t\t\t\tsearchCriteria.push(['UID', `${staticData.lastMessageUid as number}:*`]);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A short explanation about UIDs and how they work\n\t\t\t\t\t\t\t * can be found here: https://dev.to/kehers/imap-new-messages-since-last-check-44gm\n\t\t\t\t\t\t\t * TL;DR:\n\t\t\t\t\t\t\t * - You cannot filter using ['UID', 'CURRENT ID + 1:*'] because IMAP\n\t\t\t\t\t\t\t * won't return correct results if current id + 1 does not yet exist.\n\t\t\t\t\t\t\t * - UIDs can change but this is not being treated here.\n\t\t\t\t\t\t\t * If the mailbox is recreated (lets say you remove all emails, remove\n\t\t\t\t\t\t\t * the mail box and create another with same name, UIDs will change)\n\t\t\t\t\t\t\t * - You can check if UIDs changed in the above example\n\t\t\t\t\t\t\t * by checking UIDValidity.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tthis.logger.debug('Querying for new messages on node \"EmailReadImap\"', {\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst returnData = await getNewEmails.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tconnection,\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t\tstaticData,\n\t\t\t\t\t\t\t\tpostProcessAction,\n\t\t\t\t\t\t\t\tgetText,\n\t\t\t\t\t\t\t\tgetAttachment,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (returnData.length) {\n\t\t\t\t\t\t\t\tthis.emit([returnData]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logger.error('Email Read Imap node encountered an error fetching new emails', {\n\t\t\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy\n\t\t\t\t\t\t\t// if it receives an error before the workflow got activated\n\t\t\t\t\t\t\tawait returnedPromise.promise.then(() => {\n\t\t\t\t\t\t\t\tthis.emitError(error as Error);\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\tonUpdate: async (seqNo: number, info) => {\n\t\t\t\t\tthis.logger.debug(`Email Read Imap:update ${seqNo}`, info);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t}\n\n\t\t\tif (credentials.secure) {\n\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t}\n\n\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t}\n\n\t\t\t// Connect to the IMAP server and open the mailbox\n\t\t\t// that we get informed whenever a new email arrives\n\t\t\treturn await imapConnect(config).then(async (conn) => {\n\t\t\t\tconn.on('close', async (_hadError: boolean) => {\n\t\t\t\t\tif (isCurrentlyReconnecting) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Connected closed for forced reconnecting');\n\t\t\t\t\t} else if (closeFunctionWasCalled) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Shutting down workflow - connected closed');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.logger.error('Email Read Imap: Connected closed unexpectedly');\n\t\t\t\t\t\tthis.emitError(new Error('Imap connection closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconn.on('error', async (error) => {\n\t\t\t\t\tconst errorCode = ((error as JsonObject).code as string).toUpperCase();\n\t\t\t\t\tthis.logger.debug(`IMAP connection experienced an error: (${errorCode})`, {\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emitError(error as Error);\n\t\t\t\t});\n\t\t\t\treturn conn;\n\t\t\t});\n\t\t};\n\n\t\tconnection = await establishConnection();\n\n\t\tawait connection.openBox(mailbox);\n\n\t\tlet reconnectionInterval: NodeJS.Timeout | undefined;\n\n\t\tconst handleReconnect = async () => {\n\t\t\tthis.logger.debug('Forcing reconnect to IMAP server');\n\t\t\ttry {\n\t\t\t\tisCurrentlyReconnecting = true;\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t\tconnection = await establishConnection();\n\t\t\t\tawait connection.openBox(mailbox);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(error as string);\n\t\t\t} finally {\n\t\t\t\tisCurrentlyReconnecting = false;\n\t\t\t}\n\t\t};\n\n\t\tif (options.forceReconnect !== undefined) {\n\t\t\treconnectionInterval = setInterval(\n\t\t\t\thandleReconnect,\n\t\t\t\t(options.forceReconnect as number) * 1000 * 60,\n\t\t\t);\n\t\t}\n\n\t\t// When workflow and so node gets set to inactive close the connection\n\t\tconst closeFunction = async () => {\n\t\t\tcloseFunctionWasCalled = true;\n\t\t\tif (reconnectionInterval) {\n\t\t\t\tclearInterval(reconnectionInterval);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'warning' });\n\t\t\t}\n\t\t};\n\n\t\t// Resolve returned-promise so that waiting errors can be emitted\n\t\treturnedPromise.resolve();\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAuC;AACvC,qBAAoB;AAcpB,0BAA2E;AAC3E,qBAAoB;AAGpB,kBAAsC;AAEtC,mBAA6B;AAE7B,MAAM,q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Ae;AAAA,MAClC,UAAE;AACD,kCAA0B;AAAA,MAC3B;AAAA,IACD;AAEA,QAAI,QAAQ,mBAAmB,QAAW;AACzC,6BAAuB;AAAA,QACtB;AAAA,QACC,QAAQ,iBAA4B,MAAO;AAAA,MAC7C;AAAA,IACD;AAGA,UAAM,gBAAgB,YAAY;AACjC,+BAAyB;AACzB,UAAI,sBAAsB;AACzB,sBAAc,oBAAoB;AAAA,MACnC;AACA,UAAI;AACH,YAAI,WAAW,SAAU,OAAM,WAAW,SAAS,KAAK;AACxD,mBAAW,IAAI;AAAA,MAChB,SAAS,OAAO;AACf,cAAM,IAAI,sCAAkB,KAAK,QAAQ,GAAG,EAAE,OAAO,OAAgB,OAAO,UAAU,CAAC;AAAA,MACxF;AAAA,IACD;AAGA,oBAAgB,QAAQ;AAExB,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["isEmpty","imapConnect","part","rfc2047"]}
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/EmailReadImap/v2/EmailReadImapV2.node.ts"],"sourcesContent":["import type { ImapSimple, ImapSimpleOptions, Message, MessagePart } from '@n8n/imap';\nimport { connect as imapConnect } from '@n8n/imap';\nimport isEmpty from 'lodash/isEmpty';\nimport type {\n\tITriggerFunctions,\n\tIBinaryData,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeType,\n\tINodeTypeBaseDescription,\n\tINodeTypeDescription,\n\tITriggerResponse,\n\tJsonObject,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, TriggerCloseError } from 'n8n-workflow';\nimport rfc2047 from 'rfc2047';\n\nimport type { ICredentialsDataImap } from '@credentials/Imap.credentials';\nimport { isCredentialsDataImap } from '@credentials/Imap.credentials';\n\nimport { getNewEmails } from './utils';\n\nconst versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Email Trigger (IMAP)',\n\tname: 'emailReadImap',\n\ticon: 'fa:inbox',\n\ticonColor: 'green',\n\tgroup: ['trigger'],\n\tversion: 2,\n\tdescription: 'Triggers the workflow when a new email is received',\n\teventTriggerDescription: 'Waiting for you to receive an email',\n\tdefaults: {\n\t\tname: 'Email Trigger (IMAP)',\n\t\tcolor: '#44AA22',\n\t},\n\ttriggerPanel: {\n\t\theader: '',\n\t\texecutionsHelp: {\n\t\t\tinactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'execute step' button, then send an email to make an event happen. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time an email is received, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\tactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'execute step' button, then send an email to make an event happen. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time an email is received, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t},\n\t\tactivationHint:\n\t\t\t\"Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).\",\n\t},\n\tusableAsTool: true,\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'imap',\n\t\t\trequired: true,\n\t\t\ttestedBy: 'imapConnectionTest',\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Mailbox Name',\n\t\t\tname: 'mailbox',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'INBOX',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Action',\n\t\t\tname: 'postProcessAction',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Mark as Read',\n\t\t\t\t\tvalue: 'read',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Nothing',\n\t\t\t\t\tvalue: 'nothing',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'read',\n\t\t\tdescription:\n\t\t\t\t'What to do after the email has been received. If \"nothing\" gets selected it will be processed multiple times.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Download Attachments',\n\t\t\tname: 'downloadAttachments',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Whether attachments of emails should be downloaded. Only set if needed as it increases processing.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Format',\n\t\t\tname: 'format',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'RAW',\n\t\t\t\t\tvalue: 'raw',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Resolved',\n\t\t\t\t\tvalue: 'resolved',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email with all data resolved and attachments saved as binary data',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Simple',\n\t\t\t\t\tvalue: 'simple',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email; do not use if you wish to gather inline attachments',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'simple',\n\t\t\tdescription: 'The format to return the message in',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['resolved'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t\tdownloadAttachments: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\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{\n\t\t\t\t\tdisplayName: 'Custom Email Rules',\n\t\t\t\t\tname: 'customEmailConfig',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '[\"UNSEEN\"]',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Custom email fetching rules. See <a href=\"https://github.com/mscdex/node-imap\">node-imap</a>\\'s search function for more details.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Force Reconnect Every Minutes',\n\t\t\t\t\tname: 'forceReconnect',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 60,\n\t\t\t\t\tdescription: 'Sets an interval (in minutes) to force a reconnection',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport class EmailReadImapV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync imapConnectionTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tif (isCredentialsDataImap(credential.data)) {\n\t\t\t\t\tconst credentials = credential.data as ICredentialsDataImap;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\t\t\t\timap: {\n\t\t\t\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\t\t\t\tport: credentials.port,\n\t\t\t\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\t\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (credentials.secure) {\n\t\t\t\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst connection = await imapConnect(config);\n\t\t\t\t\t\tawait connection.getBoxes();\n\t\t\t\t\t\tconnection.end();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: 'Credentials are no IMAP credentials.',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst credentialsObject = await this.getCredentials('imap');\n\t\tconst credentials = isCredentialsDataImap(credentialsObject) ? credentialsObject : undefined;\n\t\tif (!credentials) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Credentials are not valid for imap node.');\n\t\t}\n\t\tconst mailbox = this.getNodeParameter('mailbox') as string;\n\t\tconst postProcessAction = this.getNodeParameter('postProcessAction') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as IDataObject;\n\n\t\tconst staticData = this.getWorkflowStaticData('node');\n\t\tthis.logger.debug('Loaded static data for node \"EmailReadImap\"', { staticData });\n\n\t\tlet connection: ImapSimple;\n\t\tlet closeFunctionWasCalled = false;\n\t\tlet isCurrentlyReconnecting = false;\n\n\t\t// Returns the email text\n\n\t\tconst getText = async (\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t\tsubtype: string,\n\t\t): Promise<string> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst textParts = parts.filter((part) => {\n\t\t\t\treturn (\n\t\t\t\t\tpart.type.toUpperCase() === 'TEXT' && part.subtype.toUpperCase() === subtype.toUpperCase()\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tconst part = textParts[0];\n\t\t\tif (!part) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst partData = await connection.getPartData(message, part);\n\t\t\t\treturn partData.toString();\n\t\t\t} catch {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t};\n\n\t\t// Returns the email attachments\n\t\tconst getAttachment = async (\n\t\t\timapConnection: ImapSimple,\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t): Promise<IBinaryData[]> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Check if the message has attachments and if so get them\n\t\t\tconst attachmentParts = parts.filter(\n\t\t\t\t(part) => part.disposition?.type?.toUpperCase() === 'ATTACHMENT',\n\t\t\t);\n\n\t\t\tconst decodeFilename = (filename: string) => {\n\t\t\t\tconst regex = /=\\?([\\w-]+)\\?Q\\?.*\\?=/i;\n\t\t\t\tif (regex.test(filename)) {\n\t\t\t\t\treturn rfc2047.decode(filename);\n\t\t\t\t}\n\t\t\t\treturn filename;\n\t\t\t};\n\n\t\t\tconst attachmentPromises = [];\n\t\t\tlet attachmentPromise;\n\t\t\tfor (const attachmentPart of attachmentParts) {\n\t\t\t\tattachmentPromise = imapConnection\n\t\t\t\t\t.getPartData(message, attachmentPart)\n\t\t\t\t\t.then(async (partData) => {\n\t\t\t\t\t\t// if filename contains utf-8 encoded characters, decode it\n\t\t\t\t\t\tconst fileName = decodeFilename(\n\t\t\t\t\t\t\t((attachmentPart.disposition as IDataObject)?.params as IDataObject)\n\t\t\t\t\t\t\t\t?.filename as string,\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Return it in the format n8n expects\n\t\t\t\t\t\treturn await this.helpers.prepareBinaryData(partData.buffer, fileName);\n\t\t\t\t\t});\n\n\t\t\t\tattachmentPromises.push(attachmentPromise);\n\t\t\t}\n\n\t\t\treturn await Promise.all(attachmentPromises);\n\t\t};\n\n\t\tconst returnedPromise = this.helpers.createDeferredPromise();\n\n\t\tconst establishConnection = async (): Promise<ImapSimple> => {\n\t\t\tlet searchCriteria = ['UNSEEN'] as Array<string | string[]>;\n\t\t\tif (options.customEmailConfig !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tsearchCriteria = JSON.parse(options.customEmailConfig as string) as Array<\n\t\t\t\t\t\tstring | string[]\n\t\t\t\t\t>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Custom email config is not valid JSON.');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\timap: {\n\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\tport: credentials.port,\n\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t},\n\t\t\t\tonMail: async () => {\n\t\t\t\t\tif (connection) {\n\t\t\t\t\t\tif (staticData.lastMessageUid !== undefined) {\n\t\t\t\t\t\t\tsearchCriteria.push(['UID', `${staticData.lastMessageUid as number}:*`]);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A short explanation about UIDs and how they work\n\t\t\t\t\t\t\t * can be found here: https://dev.to/kehers/imap-new-messages-since-last-check-44gm\n\t\t\t\t\t\t\t * TL;DR:\n\t\t\t\t\t\t\t * - You cannot filter using ['UID', 'CURRENT ID + 1:*'] because IMAP\n\t\t\t\t\t\t\t * won't return correct results if current id + 1 does not yet exist.\n\t\t\t\t\t\t\t * - UIDs can change but this is not being treated here.\n\t\t\t\t\t\t\t * If the mailbox is recreated (lets say you remove all emails, remove\n\t\t\t\t\t\t\t * the mail box and create another with same name, UIDs will change)\n\t\t\t\t\t\t\t * - You can check if UIDs changed in the above example\n\t\t\t\t\t\t\t * by checking UIDValidity.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tthis.logger.debug('Querying for new messages on node \"EmailReadImap\"', {\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst returnData = await getNewEmails.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tconnection,\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t\tstaticData,\n\t\t\t\t\t\t\t\tpostProcessAction,\n\t\t\t\t\t\t\t\tgetText,\n\t\t\t\t\t\t\t\tgetAttachment,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (returnData.length) {\n\t\t\t\t\t\t\t\tthis.emit([returnData]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logger.error('Email Read Imap node encountered an error fetching new emails', {\n\t\t\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy\n\t\t\t\t\t\t\t// if it receives an error before the workflow got activated\n\t\t\t\t\t\t\tawait returnedPromise.promise.then(() => {\n\t\t\t\t\t\t\t\tthis.emitError(error as Error);\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\tonUpdate: async (seqNo: number, info) => {\n\t\t\t\t\tthis.logger.debug(`Email Read Imap:update ${seqNo}`, info);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t}\n\n\t\t\tif (credentials.secure) {\n\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t}\n\n\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t}\n\n\t\t\t// Connect to the IMAP server and open the mailbox\n\t\t\t// that we get informed whenever a new email arrives\n\t\t\treturn await imapConnect(config).then(async (conn) => {\n\t\t\t\tconn.on('close', async (_hadError: boolean) => {\n\t\t\t\t\tif (isCurrentlyReconnecting) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Connected closed for forced reconnecting');\n\t\t\t\t\t} else if (closeFunctionWasCalled) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Shutting down workflow - connected closed');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.logger.error('Email Read Imap: Connected closed unexpectedly');\n\t\t\t\t\t\tthis.emitError(new Error('Imap connection closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconn.on('error', async (error) => {\n\t\t\t\t\tconst errorCode = ((error as JsonObject).code as string).toUpperCase();\n\t\t\t\t\tthis.logger.debug(`IMAP connection experienced an error: (${errorCode})`, {\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emitError(error as Error);\n\t\t\t\t});\n\t\t\t\treturn conn;\n\t\t\t});\n\t\t};\n\n\t\tconnection = await establishConnection();\n\n\t\tawait connection.openBox(mailbox);\n\n\t\tlet reconnectionInterval: NodeJS.Timeout | undefined;\n\n\t\tconst handleReconnect = async () => {\n\t\t\tthis.logger.debug('Forcing reconnect to IMAP server');\n\t\t\ttry {\n\t\t\t\tisCurrentlyReconnecting = true;\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t\tconnection = await establishConnection();\n\t\t\t\tawait connection.openBox(mailbox);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(error as string);\n\t\t\t} finally {\n\t\t\t\tisCurrentlyReconnecting = false;\n\t\t\t}\n\t\t};\n\n\t\tif (options.forceReconnect !== undefined) {\n\t\t\treconnectionInterval = setInterval(\n\t\t\t\thandleReconnect,\n\t\t\t\t(options.forceReconnect as number) * 1000 * 60,\n\t\t\t);\n\t\t}\n\n\t\t// When workflow and so node gets set to inactive close the connection\n\t\tconst closeFunction = async () => {\n\t\t\tcloseFunctionWasCalled = true;\n\t\t\tif (reconnectionInterval) {\n\t\t\t\tclearInterval(reconnectionInterval);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'warning' });\n\t\t\t}\n\t\t};\n\n\t\t// Resolve returned-promise so that waiting errors can be emitted\n\t\treturnedPromise.resolve();\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA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xD,mBAAW,IAAI;AACf,qBAAa,MAAM,oBAAoB;AACvC,cAAM,WAAW,QAAQ,OAAO;AAAA,MACjC,SAAS,OAAO;AACf,aAAK,OAAO,MAAM,KAAe;AAAA,MAClC,UAAE;AACD,kCAA0B;AAAA,MAC3B;AAAA,IACD;AAEA,QAAI,QAAQ,mBAAmB,QAAW;AACzC,6BAAuB;AAAA,QACtB;AAAA,QACC,QAAQ,iBAA4B,MAAO;AAAA,MAC7C;AAAA,IACD;AAGA,UAAM,gBAAgB,YAAY;AACjC,+BAAyB;AACzB,UAAI,sBAAsB;AACzB,sBAAc,oBAAoB;AAAA,MACnC;AACA,UAAI;AACH,YAAI,WAAW,SAAU,OAAM,WAAW,SAAS,KAAK;AACxD,mBAAW,IAAI;AAAA,MAChB,SAAS,OAAO;AACf,cAAM,IAAI,sCAAkB,KAAK,QAAQ,GAAG,EAAE,OAAO,OAAgB,OAAO,UAAU,CAAC;AAAA,MACxF;AAAA,IACD;AAGA,oBAAgB,QAAQ;AAExB,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["isEmpty","imapConnect","part","rfc2047"]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Description_node_exports = {};
|
|
20
|
+
__export(Description_node_exports, {
|
|
21
|
+
setCheckIfEvaluatingProperties: () => setCheckIfEvaluatingProperties,
|
|
22
|
+
setMetricsProperties: () => setMetricsProperties,
|
|
23
|
+
setOutputProperties: () => setOutputProperties
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Description_node_exports);
|
|
26
|
+
var import_GoogleSheetsTrigger = require("../../Google/Sheet/GoogleSheetsTrigger.node");
|
|
27
|
+
const setOutputProperties = [
|
|
28
|
+
{
|
|
29
|
+
displayName: "Credentials",
|
|
30
|
+
name: "credentials",
|
|
31
|
+
type: "credentials",
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
...import_GoogleSheetsTrigger.document,
|
|
36
|
+
displayName: "Document Containing Dataset",
|
|
37
|
+
displayOptions: {
|
|
38
|
+
show: {
|
|
39
|
+
operation: ["setOutputs"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
...import_GoogleSheetsTrigger.sheet,
|
|
45
|
+
displayName: "Sheet Containing Dataset",
|
|
46
|
+
displayOptions: {
|
|
47
|
+
show: {
|
|
48
|
+
operation: ["setOutputs"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: "Outputs",
|
|
54
|
+
name: "outputs",
|
|
55
|
+
placeholder: "Add Output",
|
|
56
|
+
type: "fixedCollection",
|
|
57
|
+
typeOptions: {
|
|
58
|
+
multipleValueButtonText: "Add Output",
|
|
59
|
+
multipleValues: true
|
|
60
|
+
},
|
|
61
|
+
default: {},
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
displayName: "Filter",
|
|
65
|
+
name: "values",
|
|
66
|
+
values: [
|
|
67
|
+
{
|
|
68
|
+
displayName: "Name",
|
|
69
|
+
name: "outputName",
|
|
70
|
+
type: "string",
|
|
71
|
+
default: ""
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: "Value",
|
|
75
|
+
name: "outputValue",
|
|
76
|
+
type: "string",
|
|
77
|
+
default: ""
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
displayOptions: {
|
|
83
|
+
show: {
|
|
84
|
+
operation: ["setOutputs"]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
];
|
|
89
|
+
const setCheckIfEvaluatingProperties = [
|
|
90
|
+
{
|
|
91
|
+
displayName: "Routes to the \u2018evaluation\u2019 branch if the execution started from an evaluation trigger. Otherwise routes to the \u2018normal\u2019 branch.",
|
|
92
|
+
name: "notice",
|
|
93
|
+
type: "notice",
|
|
94
|
+
default: "",
|
|
95
|
+
displayOptions: {
|
|
96
|
+
show: {
|
|
97
|
+
operation: ["checkIfEvaluating"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
const setMetricsProperties = [
|
|
103
|
+
{
|
|
104
|
+
displayName: "Calculate the score(s) for the evaluation, then map them into this node. They will be displayed in the \u2018evaluations\u2019 tab, not the Google Sheet. <a href='https://docs.n8n.io/advanced-ai/evaluations/metric-based-evaluations/#2-calculate-metrics' target='_blank'>View metric examples</a>",
|
|
105
|
+
name: "notice",
|
|
106
|
+
type: "notice",
|
|
107
|
+
default: "",
|
|
108
|
+
displayOptions: {
|
|
109
|
+
show: {
|
|
110
|
+
operation: ["setMetrics"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: "Metrics to Return",
|
|
116
|
+
name: "metrics",
|
|
117
|
+
type: "assignmentCollection",
|
|
118
|
+
default: {
|
|
119
|
+
assignments: [
|
|
120
|
+
{
|
|
121
|
+
name: "",
|
|
122
|
+
value: "",
|
|
123
|
+
type: "number"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
typeOptions: {
|
|
128
|
+
assignment: {
|
|
129
|
+
disableType: true,
|
|
130
|
+
defaultType: "number"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
displayOptions: {
|
|
134
|
+
show: {
|
|
135
|
+
operation: ["setMetrics"]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
setCheckIfEvaluatingProperties,
|
|
143
|
+
setMetricsProperties,
|
|
144
|
+
setOutputProperties
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=Description.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Evaluation/Evaluation/Description.node.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { document, sheet } from '../../Google/Sheet/GoogleSheetsTrigger.node';\n\nexport const setOutputProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Credentials',\n\t\tname: 'credentials',\n\t\ttype: 'credentials',\n\t\tdefault: '',\n\t},\n\t{\n\t\t...document,\n\t\tdisplayName: 'Document Containing Dataset',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['setOutputs'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...sheet,\n\t\tdisplayName: 'Sheet Containing Dataset',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['setOutputs'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Outputs',\n\t\tname: 'outputs',\n\t\tplaceholder: 'Add Output',\n\t\ttype: 'fixedCollection',\n\t\ttypeOptions: {\n\t\t\tmultipleValueButtonText: 'Add Output',\n\t\t\tmultipleValues: true,\n\t\t},\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Filter',\n\t\t\t\tname: 'values',\n\t\t\t\tvalues: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\tname: 'outputName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\tname: 'outputValue',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['setOutputs'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport const setCheckIfEvaluatingProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName:\n\t\t\t'Routes to the ‘evaluation’ branch if the execution started from an evaluation trigger. Otherwise routes to the ‘normal’ branch.',\n\t\tname: 'notice',\n\t\ttype: 'notice',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['checkIfEvaluating'],\n\t\t\t},\n\t\t},\n\t},\n];\n\nexport const setMetricsProperties: INodeProperties[] = [\n\t{\n\t\tdisplayName:\n\t\t\t\"Calculate the score(s) for the evaluation, then map them into this node. They will be displayed in the ‘evaluations’ tab, not the Google Sheet. <a href='https://docs.n8n.io/advanced-ai/evaluations/metric-based-evaluations/#2-calculate-metrics' target='_blank'>View metric examples</a>\",\n\t\tname: 'notice',\n\t\ttype: 'notice',\n\t\tdefault: '',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['setMetrics'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Metrics to Return',\n\t\tname: 'metrics',\n\t\ttype: 'assignmentCollection',\n\t\tdefault: {\n\t\t\tassignments: [\n\t\t\t\t{\n\t\t\t\t\tname: '',\n\t\t\t\t\tvalue: '',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\ttypeOptions: {\n\t\t\tassignment: {\n\t\t\t\tdisableType: true,\n\t\t\t\tdefaultType: 'number',\n\t\t\t},\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\toperation: ['setMetrics'],\n\t\t\t},\n\t\t},\n\t},\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iCAAgC;AAEzB,MAAM,sBAAyC;AAAA,EACrD;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,EACV;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,YAAY;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,YAAY;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,yBAAyB;AAAA,MACzB,gBAAgB;AAAA,IACjB;AAAA,IACA,SAAS,CAAC;AAAA,IACV,SAAS;AAAA,MACR;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,QAAQ;AAAA,UACP;AAAA,YACC,aAAa;AAAA,YACb,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACV;AAAA,UACA;AAAA,YACC,aAAa;AAAA,YACb,MAAM;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACV;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,YAAY;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,iCAAoD;AAAA,EAChE;AAAA,IACC,aACC;AAAA,IACD,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,mBAAmB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,uBAA0C;AAAA,EACtD;AAAA,IACC,aACC;AAAA,IACD,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,YAAY;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,OAAO;AAAA,UACP,MAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAAA,IACA,aAAa;AAAA,MACZ,YAAY;AAAA,QACX,aAAa;AAAA,QACb,aAAa;AAAA,MACd;AAAA,IACD;AAAA,IACA,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,WAAW,CAAC,YAAY;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Evaluation_node_ee_exports = {};
|
|
20
|
+
__export(Evaluation_node_ee_exports, {
|
|
21
|
+
Evaluation: () => Evaluation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Evaluation_node_ee_exports);
|
|
24
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
25
|
+
var import_Description = require("./Description.node");
|
|
26
|
+
var import_versionDescription = require("../../Google/Sheet/v2/actions/versionDescription");
|
|
27
|
+
var import_methods = require("../methods");
|
|
28
|
+
var import_evaluationUtils = require("../utils/evaluationUtils");
|
|
29
|
+
class Evaluation {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.description = {
|
|
32
|
+
displayName: "Evaluation",
|
|
33
|
+
icon: "fa:check-double",
|
|
34
|
+
name: "evaluation",
|
|
35
|
+
group: ["transform"],
|
|
36
|
+
version: 4.6,
|
|
37
|
+
description: "Runs an evaluation",
|
|
38
|
+
eventTriggerDescription: "",
|
|
39
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
40
|
+
defaults: {
|
|
41
|
+
name: "Evaluation",
|
|
42
|
+
color: "#c3c9d5"
|
|
43
|
+
},
|
|
44
|
+
inputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
45
|
+
outputs: `={{(${import_evaluationUtils.setOutputs})($parameter)}}`,
|
|
46
|
+
codex: {
|
|
47
|
+
alias: ["Test", "Metrics", "Evals", "Set Output", "Set Metrics"]
|
|
48
|
+
},
|
|
49
|
+
credentials: [
|
|
50
|
+
{
|
|
51
|
+
name: "googleApi",
|
|
52
|
+
required: true,
|
|
53
|
+
displayOptions: {
|
|
54
|
+
show: {
|
|
55
|
+
authentication: ["serviceAccount"],
|
|
56
|
+
operation: ["setOutputs"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
testedBy: "googleApiCredentialTest"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "googleSheetsOAuth2Api",
|
|
63
|
+
required: true,
|
|
64
|
+
displayOptions: {
|
|
65
|
+
show: {
|
|
66
|
+
authentication: ["oAuth2"],
|
|
67
|
+
operation: ["setOutputs"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
properties: [
|
|
73
|
+
{
|
|
74
|
+
displayName: "Operation",
|
|
75
|
+
name: "operation",
|
|
76
|
+
type: "options",
|
|
77
|
+
noDataExpression: true,
|
|
78
|
+
options: [
|
|
79
|
+
{
|
|
80
|
+
name: "Set Outputs",
|
|
81
|
+
value: "setOutputs"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "Set Metrics",
|
|
85
|
+
value: "setMetrics"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "Check If Evaluating",
|
|
89
|
+
value: "checkIfEvaluating"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
default: "setOutputs"
|
|
93
|
+
},
|
|
94
|
+
import_versionDescription.authentication,
|
|
95
|
+
...import_Description.setOutputProperties,
|
|
96
|
+
...import_Description.setMetricsProperties,
|
|
97
|
+
...import_Description.setCheckIfEvaluatingProperties
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
this.methods = { loadOptions: import_methods.loadOptions, listSearch: import_methods.listSearch };
|
|
101
|
+
}
|
|
102
|
+
async execute() {
|
|
103
|
+
const operation = this.getNodeParameter("operation", 0);
|
|
104
|
+
if (operation === "setOutputs") {
|
|
105
|
+
return await import_evaluationUtils.setOutput.call(this);
|
|
106
|
+
} else if (operation === "setMetrics") {
|
|
107
|
+
return await import_evaluationUtils.setMetrics.call(this);
|
|
108
|
+
} else {
|
|
109
|
+
return await import_evaluationUtils.checkIfEvaluating.call(this);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
Evaluation
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=Evaluation.node.ee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../nodes/Evaluation/Evaluation/Evaluation.node.ee.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport type {\n\tIExecuteFunctions,\n\tINodeType,\n\tINodeTypeDescription,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport {\n\tsetCheckIfEvaluatingProperties,\n\tsetMetricsProperties,\n\tsetOutputProperties,\n} from './Description.node';\nimport { authentication } from '../../Google/Sheet/v2/actions/versionDescription';\nimport { listSearch, loadOptions } from '../methods';\nimport { checkIfEvaluating, setMetrics, setOutputs, setOutput } from '../utils/evaluationUtils';\n\nexport class Evaluation implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Evaluation',\n\t\ticon: 'fa:check-double',\n\t\tname: 'evaluation',\n\t\tgroup: ['transform'],\n\t\tversion: 4.6,\n\t\tdescription: 'Runs an evaluation',\n\t\teventTriggerDescription: '',\n\t\tsubtitle: '={{$parameter[\"operation\"]}}',\n\t\tdefaults: {\n\t\t\tname: 'Evaluation',\n\t\t\tcolor: '#c3c9d5',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: `={{(${setOutputs})($parameter)}}`,\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\toperation: ['setOutputs'],\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\toperation: ['setOutputs'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Operation',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Set Outputs',\n\t\t\t\t\t\tvalue: 'setOutputs',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Set Metrics',\n\t\t\t\t\t\tvalue: 'setMetrics',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Check If Evaluating',\n\t\t\t\t\t\tvalue: 'checkIfEvaluating',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'setOutputs',\n\t\t\t},\n\t\t\tauthentication,\n\t\t\t...setOutputProperties,\n\t\t\t...setMetricsProperties,\n\t\t\t...setCheckIfEvaluatingProperties,\n\t\t],\n\t};\n\n\tmethods = { loadOptions, listSearch };\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'setOutputs') {\n\t\t\treturn await setOutput.call(this);\n\t\t} else if (operation === 'setMetrics') {\n\t\t\treturn await setMetrics.call(this);\n\t\t} else {\n\t\t\t// operation === 'checkIfEvaluating'\n\t\t\treturn await checkIfEvaluating.call(this);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAoC;AAEpC,yBAIO;AACP,gCAA+B;AAC/B,qBAAwC;AACxC,6BAAqE;AAE9D,MAAM,WAAgC;AAAA,EAAtC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,yBAAyB;AAAA,MACzB,UAAU;AAAA,MACV,UAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MACA,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,OAAO,iCAAU;AAAA,MAC1B,OAAO;AAAA,QACN,OAAO,CAAC,QAAQ,WAAW,SAAS,cAAc,aAAa;AAAA,MAChE;AAAA,MACA,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,UACV,gBAAgB;AAAA,YACf,MAAM;AAAA,cACL,gBAAgB,CAAC,gBAAgB;AAAA,cACjC,WAAW,CAAC,YAAY;AAAA,YACzB;AAAA,UACD;AAAA,UACA,UAAU;AAAA,QACX;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,UACV,gBAAgB;AAAA,YACf,MAAM;AAAA,cACL,gBAAgB,CAAC,QAAQ;AAAA,cACzB,WAAW,CAAC,YAAY;AAAA,YACzB;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,SAAS;AAAA,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA,QACA;AAAA,QACA,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,MACJ;AAAA,IACD;AAEA,mBAAU,EAAE,yCAAa,sCAAW;AAAA;AAAA,EAEpC,MAAM,UAAkE;AACvE,UAAM,YAAY,KAAK,iBAAiB,aAAa,CAAC;AAEtD,QAAI,cAAc,cAAc;AAC/B,aAAO,MAAM,iCAAU,KAAK,IAAI;AAAA,IACjC,WAAW,cAAc,cAAc;AACtC,aAAO,MAAM,kCAAW,KAAK,IAAI;AAAA,IAClC,OAAO;AAEN,aAAO,MAAM,yCAAkB,KAAK,IAAI;AAAA,IACzC;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var EvaluationTrigger_node_ee_exports = {};
|
|
20
|
+
__export(EvaluationTrigger_node_ee_exports, {
|
|
21
|
+
EvaluationTrigger: () => EvaluationTrigger,
|
|
22
|
+
startingRow: () => startingRow
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(EvaluationTrigger_node_ee_exports);
|
|
25
|
+
var import_n8n_workflow = require("n8n-workflow");
|
|
26
|
+
var import_GoogleSheetsTrigger = require("../../Google/Sheet/GoogleSheetsTrigger.node");
|
|
27
|
+
var import_read = require("../../Google/Sheet/v2/actions/sheet/read.operation");
|
|
28
|
+
var import_versionDescription = require("../../Google/Sheet/v2/actions/versionDescription");
|
|
29
|
+
var import_methods = require("../methods");
|
|
30
|
+
var import_evaluationTriggerUtils = require("../utils/evaluationTriggerUtils");
|
|
31
|
+
let startingRow = 2;
|
|
32
|
+
class EvaluationTrigger {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.description = {
|
|
35
|
+
displayName: "Evaluation Trigger",
|
|
36
|
+
icon: "fa:check-double",
|
|
37
|
+
name: "evaluationTrigger",
|
|
38
|
+
group: ["trigger"],
|
|
39
|
+
version: 4.6,
|
|
40
|
+
description: "Run a test dataset through your workflow to check performance",
|
|
41
|
+
eventTriggerDescription: "",
|
|
42
|
+
defaults: {
|
|
43
|
+
name: "When fetching a dataset row",
|
|
44
|
+
color: "#c3c9d5"
|
|
45
|
+
},
|
|
46
|
+
inputs: [],
|
|
47
|
+
outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
48
|
+
properties: [
|
|
49
|
+
{
|
|
50
|
+
displayName: '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>.',
|
|
51
|
+
name: "notice",
|
|
52
|
+
type: "notice",
|
|
53
|
+
default: ""
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: "Credentials",
|
|
57
|
+
name: "credentials",
|
|
58
|
+
type: "credentials",
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
import_versionDescription.authentication,
|
|
62
|
+
{
|
|
63
|
+
...import_GoogleSheetsTrigger.document,
|
|
64
|
+
displayName: "Document Containing Dataset",
|
|
65
|
+
hint: 'Example dataset format <a href="https://docs.google.com/spreadsheets/d/1vD_IdeFUg7sHsK9okL6Doy1rGOkWTnPJV3Dro4FBUsY/edit?gid=0#gid=0">here</a>'
|
|
66
|
+
},
|
|
67
|
+
{ ...import_GoogleSheetsTrigger.sheet, displayName: "Sheet Containing Dataset" },
|
|
68
|
+
{
|
|
69
|
+
displayName: "Limit Rows",
|
|
70
|
+
name: "limitRows",
|
|
71
|
+
type: "boolean",
|
|
72
|
+
default: false,
|
|
73
|
+
noDataExpression: true,
|
|
74
|
+
description: "Whether to limit number of rows to process"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: "Max Rows to Process",
|
|
78
|
+
name: "maxRows",
|
|
79
|
+
type: "number",
|
|
80
|
+
default: 10,
|
|
81
|
+
description: "Maximum number of rows to process",
|
|
82
|
+
noDataExpression: false,
|
|
83
|
+
displayOptions: { show: { limitRows: [true] } }
|
|
84
|
+
},
|
|
85
|
+
import_read.readFilter
|
|
86
|
+
],
|
|
87
|
+
codex: {
|
|
88
|
+
alias: ["Test", "Metrics", "Evals", "Set Output", "Set Metrics"]
|
|
89
|
+
},
|
|
90
|
+
credentials: [
|
|
91
|
+
{
|
|
92
|
+
name: "googleApi",
|
|
93
|
+
required: true,
|
|
94
|
+
displayOptions: {
|
|
95
|
+
show: {
|
|
96
|
+
authentication: ["serviceAccount"]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
testedBy: "googleApiCredentialTest"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "googleSheetsOAuth2Api",
|
|
103
|
+
required: true,
|
|
104
|
+
displayOptions: {
|
|
105
|
+
show: {
|
|
106
|
+
authentication: ["oAuth2"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
};
|
|
112
|
+
this.methods = { loadOptions: import_methods.loadOptions, listSearch: import_methods.listSearch };
|
|
113
|
+
}
|
|
114
|
+
async execute(startRow) {
|
|
115
|
+
if (startRow) {
|
|
116
|
+
startingRow = startRow;
|
|
117
|
+
}
|
|
118
|
+
const inputData = this.getInputData();
|
|
119
|
+
const MAX_ROWS = 1e3;
|
|
120
|
+
const maxRows = this.getNodeParameter("limitRows", 0) ? this.getNodeParameter("maxRows", 0) + 1 : MAX_ROWS;
|
|
121
|
+
const rangeOptions = {
|
|
122
|
+
rangeDefinition: "specifyRange",
|
|
123
|
+
headerRow: 1,
|
|
124
|
+
firstDataRow: startingRow
|
|
125
|
+
};
|
|
126
|
+
const googleSheetInstance = import_evaluationTriggerUtils.getGoogleSheet.call(this);
|
|
127
|
+
const googleSheet = await import_evaluationTriggerUtils.getSheet.call(this, googleSheetInstance);
|
|
128
|
+
const allRows = await import_evaluationTriggerUtils.getResults.call(this, [], googleSheetInstance, googleSheet, rangeOptions);
|
|
129
|
+
if (inputData[0].json.requestDataset) {
|
|
130
|
+
const testRunnerResult = await import_evaluationTriggerUtils.getResults.call(
|
|
131
|
+
this,
|
|
132
|
+
[],
|
|
133
|
+
googleSheetInstance,
|
|
134
|
+
googleSheet,
|
|
135
|
+
{}
|
|
136
|
+
);
|
|
137
|
+
const result = testRunnerResult.filter((row) => row?.json?.row_number <= maxRows);
|
|
138
|
+
return [result];
|
|
139
|
+
}
|
|
140
|
+
const hasFilter = this.getNodeParameter("filtersUI.values", 0, []);
|
|
141
|
+
if (hasFilter.length > 0) {
|
|
142
|
+
const currentRow = allRows[0];
|
|
143
|
+
const currentRowNumber = currentRow.json?.row_number;
|
|
144
|
+
if (currentRow === void 0) {
|
|
145
|
+
startingRow = 2;
|
|
146
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), "No row found");
|
|
147
|
+
}
|
|
148
|
+
const rowsLeft = await import_evaluationTriggerUtils.getNumberOfRowsLeftFiltered.call(
|
|
149
|
+
this,
|
|
150
|
+
googleSheetInstance,
|
|
151
|
+
googleSheet.title,
|
|
152
|
+
currentRowNumber + 1,
|
|
153
|
+
maxRows
|
|
154
|
+
);
|
|
155
|
+
currentRow.json._rowsLeft = rowsLeft;
|
|
156
|
+
startingRow = currentRowNumber + 1;
|
|
157
|
+
if (rowsLeft === 0) {
|
|
158
|
+
startingRow = 2;
|
|
159
|
+
}
|
|
160
|
+
return [[currentRow]];
|
|
161
|
+
} else {
|
|
162
|
+
const currentRow = allRows.find((row) => row?.json?.row_number === startingRow);
|
|
163
|
+
const rowsLeft = await import_evaluationTriggerUtils.getRowsLeft.call(
|
|
164
|
+
this,
|
|
165
|
+
googleSheetInstance,
|
|
166
|
+
googleSheet.title,
|
|
167
|
+
`${googleSheet.title}!${startingRow}:${maxRows}`
|
|
168
|
+
);
|
|
169
|
+
if (currentRow === void 0) {
|
|
170
|
+
startingRow = 2;
|
|
171
|
+
throw new import_n8n_workflow.NodeOperationError(this.getNode(), "No row found");
|
|
172
|
+
}
|
|
173
|
+
currentRow.json._rowsLeft = rowsLeft;
|
|
174
|
+
startingRow += 1;
|
|
175
|
+
if (rowsLeft === 0) {
|
|
176
|
+
startingRow = 2;
|
|
177
|
+
}
|
|
178
|
+
return [[currentRow]];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
183
|
+
0 && (module.exports = {
|
|
184
|
+
EvaluationTrigger,
|
|
185
|
+
startingRow
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=EvaluationTrigger.node.ee.js.map
|
|
@@ -0,0 +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 let startingRow = 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, startRow?: number): Promise<INodeExecutionData[][]> {\n\t\t// We need to allow tests to reset the startingRow\n\t\tif (startRow) {\n\t\t\tstartingRow = startRow;\n\t\t}\n\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 rangeOptions = {\n\t\t\trangeDefinition: 'specifyRange',\n\t\t\theaderRow: 1,\n\t\t\tfirstDataRow: startingRow,\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\tstartingRow = 2;\n\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\tstartingRow = currentRowNumber + 1;\n\n\t\t\tif (rowsLeft === 0) {\n\t\t\t\tstartingRow = 2;\n\t\t\t}\n\n\t\t\treturn [[currentRow]];\n\t\t} else {\n\t\t\tconst currentRow = allRows.find((row) => (row?.json?.row_number as number) === startingRow);\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}!${startingRow}:${maxRows}`,\n\t\t\t);\n\n\t\t\tif (currentRow === undefined) {\n\t\t\t\tstartingRow = 2;\n\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\tstartingRow += 1;\n\n\t\t\tif (rowsLeft === 0) {\n\t\t\t\tstartingRow = 2;\n\t\t\t}\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,IAAI,cAAc;AAElB,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;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,UACC,GAAG;AAAA,UACH,aAAa;AAAA,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