n8n-nodes-base 1.93.0 → 1.94.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.
Files changed (97) hide show
  1. package/dist/credentials/AirtopApi.credentials.js +2 -1
  2. package/dist/credentials/AirtopApi.credentials.js.map +1 -1
  3. package/dist/credentials/JinaAiApi.credentials.js +1 -1
  4. package/dist/credentials/JinaAiApi.credentials.js.map +1 -1
  5. package/dist/known/nodes.json +0 -4
  6. package/dist/nodes/Airtop/Airtop.node.js +14 -8
  7. package/dist/nodes/Airtop/Airtop.node.js.map +1 -1
  8. package/dist/nodes/Airtop/GenericFunctions.js +87 -15
  9. package/dist/nodes/Airtop/GenericFunctions.js.map +1 -1
  10. package/dist/nodes/Airtop/actions/common/fields.js +9 -0
  11. package/dist/nodes/Airtop/actions/common/fields.js.map +1 -1
  12. package/dist/nodes/Airtop/actions/common/output.utils.js +79 -0
  13. package/dist/nodes/Airtop/actions/common/output.utils.js.map +1 -0
  14. package/dist/nodes/Airtop/actions/common/session.utils.js +2 -2
  15. package/dist/nodes/Airtop/actions/common/session.utils.js.map +1 -1
  16. package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js +13 -4
  17. package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js.map +1 -1
  18. package/dist/nodes/Airtop/actions/extraction/query.operation.js +21 -3
  19. package/dist/nodes/Airtop/actions/extraction/query.operation.js.map +1 -1
  20. package/dist/nodes/Airtop/actions/extraction/scrape.operation.js +2 -1
  21. package/dist/nodes/Airtop/actions/extraction/scrape.operation.js.map +1 -1
  22. package/dist/nodes/Airtop/actions/file/File.resource.js +104 -0
  23. package/dist/nodes/Airtop/actions/file/File.resource.js.map +1 -0
  24. package/dist/nodes/Airtop/actions/file/delete.operation.js +60 -0
  25. package/dist/nodes/Airtop/actions/file/delete.operation.js.map +1 -0
  26. package/dist/nodes/Airtop/actions/file/get.operation.js +91 -0
  27. package/dist/nodes/Airtop/actions/file/get.operation.js.map +1 -0
  28. package/dist/nodes/Airtop/actions/file/getMany.operation.js +100 -0
  29. package/dist/nodes/Airtop/actions/file/getMany.operation.js.map +1 -0
  30. package/dist/nodes/Airtop/actions/file/helpers.js +199 -0
  31. package/dist/nodes/Airtop/actions/file/helpers.js.map +1 -0
  32. package/dist/nodes/Airtop/actions/file/load.operation.js +85 -0
  33. package/dist/nodes/Airtop/actions/file/load.operation.js.map +1 -0
  34. package/dist/nodes/Airtop/actions/file/upload.operation.js +186 -0
  35. package/dist/nodes/Airtop/actions/file/upload.operation.js.map +1 -0
  36. package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js +22 -1
  37. package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js.map +1 -1
  38. package/dist/nodes/Airtop/actions/interaction/fill.operation.js +89 -0
  39. package/dist/nodes/Airtop/actions/interaction/fill.operation.js.map +1 -0
  40. package/dist/nodes/Airtop/actions/interaction/scroll.operation.js +219 -0
  41. package/dist/nodes/Airtop/actions/interaction/scroll.operation.js.map +1 -0
  42. package/dist/nodes/Airtop/actions/node.type.js.map +1 -1
  43. package/dist/nodes/Airtop/actions/router.js +13 -4
  44. package/dist/nodes/Airtop/actions/router.js.map +1 -1
  45. package/dist/nodes/Airtop/actions/session/create.operation.js +85 -32
  46. package/dist/nodes/Airtop/actions/session/create.operation.js.map +1 -1
  47. package/dist/nodes/Airtop/actions/window/Window.resource.js +2 -1
  48. package/dist/nodes/Airtop/actions/window/Window.resource.js.map +1 -1
  49. package/dist/nodes/Airtop/actions/window/create.operation.js +1 -1
  50. package/dist/nodes/Airtop/actions/window/create.operation.js.map +1 -1
  51. package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js +26 -3
  52. package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js.map +1 -1
  53. package/dist/nodes/Airtop/constants.js +38 -5
  54. package/dist/nodes/Airtop/constants.js.map +1 -1
  55. package/dist/nodes/Airtop/countries.js +1026 -0
  56. package/dist/nodes/Airtop/countries.js.map +1 -0
  57. package/dist/nodes/Airtop/transport/index.js +6 -3
  58. package/dist/nodes/Airtop/transport/index.js.map +1 -1
  59. package/dist/nodes/Airtop/transport/types.js.map +1 -1
  60. package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js +4 -1
  61. package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js.map +1 -1
  62. package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js +1 -2
  63. package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js.map +1 -1
  64. package/dist/nodes/HttpRequest/GenericFunctions.js +1 -1
  65. package/dist/nodes/HttpRequest/GenericFunctions.js.map +1 -1
  66. package/dist/nodes/Jira/Jira.node.js +34 -15
  67. package/dist/nodes/Jira/Jira.node.js.map +1 -1
  68. package/dist/nodes/Merge/Merge.node.js +3 -2
  69. package/dist/nodes/Merge/Merge.node.js.map +1 -1
  70. package/dist/nodes/Merge/v3/actions/mode/combineBySql.js +42 -4
  71. package/dist/nodes/Merge/v3/actions/mode/combineBySql.js.map +1 -1
  72. package/dist/nodes/Merge/v3/actions/versionDescription.js +1 -1
  73. package/dist/nodes/Merge/v3/actions/versionDescription.js.map +1 -1
  74. package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js +2 -2
  75. package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js.map +1 -1
  76. package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js +2 -2
  77. package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js.map +1 -1
  78. package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js +1 -1
  79. package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js.map +1 -1
  80. package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js +1 -1
  81. package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js.map +1 -1
  82. package/dist/nodes/MongoDb/GenericFunctions.js +9 -2
  83. package/dist/nodes/MongoDb/GenericFunctions.js.map +1 -1
  84. package/dist/nodes/MongoDb/MongoDb.node.js +25 -5
  85. package/dist/nodes/MongoDb/MongoDb.node.js.map +1 -1
  86. package/dist/nodes/Telegram/Telegram.node.js +5 -1
  87. package/dist/nodes/Telegram/Telegram.node.js.map +1 -1
  88. package/dist/nodes/Transform/Summarize/utils.js +2 -1
  89. package/dist/nodes/Transform/Summarize/utils.js.map +1 -1
  90. package/dist/test/setup.js +1 -0
  91. package/dist/test/setup.js.map +1 -1
  92. package/dist/types/credentials.json +1 -1
  93. package/dist/types/nodes.json +8 -9
  94. package/package.json +6 -7
  95. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js +0 -119
  96. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js.map +0 -1
  97. package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.json +0 -14
@@ -76,13 +76,13 @@ const properties = [
76
76
  displayName: "Updated File Contents",
77
77
  name: "fileContents",
78
78
  default: "",
79
- description: "Find the name of input field containing the binary data to update the file in the Input panel on the left, in the Binary tab",
79
+ description: "Find the name of input field containing the binary data to update the file with in the Input panel on the left, in the Binary tab",
80
80
  displayOptions: {
81
81
  show: {
82
82
  changeFileContent: [true]
83
83
  }
84
84
  },
85
- hint: "The name of the input field containing the binary file data to update the file",
85
+ hint: "The name of the input field containing the binary file data to update the file with",
86
86
  placeholder: "data",
87
87
  required: true,
88
88
  routing: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/file/update.operation.ts"],"sourcesContent":["import {\n\tupdateDisplayOptions,\n\ttype IExecuteSingleFunctions,\n\ttype IN8nHttpFullResponse,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n} from 'n8n-workflow';\n\nimport { microsoftSharePointApiRequest } from '../../transport';\nimport {\n\tfileRLC,\n\tfolderRLC,\n\tsiteRLC,\n\tuntilFolderSelected,\n\tuntilSiteSelected,\n} from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\t...siteRLC,\n\t\tdescription: 'Select the site to retrieve folders from',\n\t},\n\t{\n\t\t...folderRLC,\n\t\tdescription: 'Select the folder to update the file in',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...fileRLC,\n\t\tdescription: 'Select the file to update',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t\t...untilFolderSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Updated File Name',\n\t\tname: 'fileName',\n\t\tdefault: '',\n\t\tdescription: 'If not specified, the original file name will be used',\n\t\tplaceholder: 'e.g. My New File',\n\t\trouting: {\n\t\t\tsend: {\n\t\t\t\tproperty: 'name',\n\t\t\t\ttype: 'body',\n\t\t\t\tvalue: '={{ $value }}',\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n\t{\n\t\tdisplayName: 'Change File Content',\n\t\tname: 'changeFileContent',\n\t\tdefault: false,\n\t\tdescription: 'Whether to update the file contents',\n\t\tplaceholder: 'e.g. My New File',\n\t\trequired: true,\n\t\ttype: 'boolean',\n\t},\n\t{\n\t\tdisplayName: 'Updated File Contents',\n\t\tname: 'fileContents',\n\t\tdefault: '',\n\t\tdescription:\n\t\t\t'Find the name of input field containing the binary data to update the file in the Input panel on the left, in the Binary tab',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tchangeFileContent: [true],\n\t\t\t},\n\t\t},\n\t\thint: 'The name of the input field containing the binary file data to update the file',\n\t\tplaceholder: 'data',\n\t\trequired: true,\n\t\trouting: {\n\t\t\toutput: {\n\t\t\t\tpostReceive: [\n\t\t\t\t\tasync function (\n\t\t\t\t\t\tthis: IExecuteSingleFunctions,\n\t\t\t\t\t\titems: INodeExecutionData[],\n\t\t\t\t\t\t_response: IN8nHttpFullResponse,\n\t\t\t\t\t): Promise<INodeExecutionData[]> {\n\t\t\t\t\t\tfor (const item of items) {\n\t\t\t\t\t\t\tconst site = this.getNodeParameter('site', undefined, {\n\t\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\t\tconst file = this.getNodeParameter('file', undefined, {\n\t\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\t\tconst binaryProperty = this.getNodeParameter('fileContents') as string;\n\t\t\t\t\t\t\tthis.helpers.assertBinaryData(binaryProperty);\n\t\t\t\t\t\t\tconst binaryDataBuffer = await this.helpers.getBinaryDataBuffer(binaryProperty);\n\t\t\t\t\t\t\tconst response = await microsoftSharePointApiRequest.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t'PUT',\n\t\t\t\t\t\t\t\t`/sites/${site}/drive/items/${file}/content`,\n\t\t\t\t\t\t\t\tbinaryDataBuffer,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\titem.json = response;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn items;\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['file'],\n\t\toperation: ['update'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AAEP,uBAA8C;AAC9C,oBAMO;AAEP,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,QACH,GAAG;A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AAA,IACA,MAAM;AAAA,EACP;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,MAAM;AAAA,IACjB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;","names":[]}
1
+ {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/file/update.operation.ts"],"sourcesContent":["import {\n\tupdateDisplayOptions,\n\ttype IExecuteSingleFunctions,\n\ttype IN8nHttpFullResponse,\n\ttype INodeExecutionData,\n\ttype INodeProperties,\n} from 'n8n-workflow';\n\nimport { microsoftSharePointApiRequest } from '../../transport';\nimport {\n\tfileRLC,\n\tfolderRLC,\n\tsiteRLC,\n\tuntilFolderSelected,\n\tuntilSiteSelected,\n} from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\t...siteRLC,\n\t\tdescription: 'Select the site to retrieve folders from',\n\t},\n\t{\n\t\t...folderRLC,\n\t\tdescription: 'Select the folder to update the file in',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...fileRLC,\n\t\tdescription: 'Select the file to update',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t\t...untilFolderSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Updated File Name',\n\t\tname: 'fileName',\n\t\tdefault: '',\n\t\tdescription: 'If not specified, the original file name will be used',\n\t\tplaceholder: 'e.g. My New File',\n\t\trouting: {\n\t\t\tsend: {\n\t\t\t\tproperty: 'name',\n\t\t\t\ttype: 'body',\n\t\t\t\tvalue: '={{ $value }}',\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n\t{\n\t\tdisplayName: 'Change File Content',\n\t\tname: 'changeFileContent',\n\t\tdefault: false,\n\t\tdescription: 'Whether to update the file contents',\n\t\tplaceholder: 'e.g. My New File',\n\t\trequired: true,\n\t\ttype: 'boolean',\n\t},\n\t{\n\t\tdisplayName: 'Updated File Contents',\n\t\tname: 'fileContents',\n\t\tdefault: '',\n\t\tdescription:\n\t\t\t'Find the name of input field containing the binary data to update the file with in the Input panel on the left, in the Binary tab',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tchangeFileContent: [true],\n\t\t\t},\n\t\t},\n\t\thint: 'The name of the input field containing the binary file data to update the file with',\n\t\tplaceholder: 'data',\n\t\trequired: true,\n\t\trouting: {\n\t\t\toutput: {\n\t\t\t\tpostReceive: [\n\t\t\t\t\tasync function (\n\t\t\t\t\t\tthis: IExecuteSingleFunctions,\n\t\t\t\t\t\titems: INodeExecutionData[],\n\t\t\t\t\t\t_response: IN8nHttpFullResponse,\n\t\t\t\t\t): Promise<INodeExecutionData[]> {\n\t\t\t\t\t\tfor (const item of items) {\n\t\t\t\t\t\t\tconst site = this.getNodeParameter('site', undefined, {\n\t\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\t\tconst file = this.getNodeParameter('file', undefined, {\n\t\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\t\tconst binaryProperty = this.getNodeParameter('fileContents') as string;\n\t\t\t\t\t\t\tthis.helpers.assertBinaryData(binaryProperty);\n\t\t\t\t\t\t\tconst binaryDataBuffer = await this.helpers.getBinaryDataBuffer(binaryProperty);\n\t\t\t\t\t\t\tconst response = await microsoftSharePointApiRequest.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t'PUT',\n\t\t\t\t\t\t\t\t`/sites/${site}/drive/items/${file}/content`,\n\t\t\t\t\t\t\t\tbinaryDataBuffer,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\titem.json = response;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn items;\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['file'],\n\t\toperation: ['update'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAMO;AAEP,uBAA8C;AAC9C,oBAMO;AAEP,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,QACH,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,MACR,MAAM;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,UAAU;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,IACD,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,mBAAmB,CAAC,IAAI;AAAA,MACzB;AAAA,IACD;AAAA,IACA,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,SAAS;AAAA,MACR,QAAQ;AAAA,QACP,aAAa;AAAA,UACZ,eAEC,OACA,WACgC;AAChC,uBAAW,QAAQ,OAAO;AACzB,oBAAM,OAAO,KAAK,iBAAiB,QAAQ,QAAW;AAAA,gBACrD,cAAc;AAAA,cACf,CAAC;AACD,oBAAM,OAAO,KAAK,iBAAiB,QAAQ,QAAW;AAAA,gBACrD,cAAc;AAAA,cACf,CAAC;AACD,oBAAM,iBAAiB,KAAK,iBAAiB,cAAc;AAC3D,mBAAK,QAAQ,iBAAiB,cAAc;AAC5C,oBAAM,mBAAmB,MAAM,KAAK,QAAQ,oBAAoB,cAAc;AAC9E,oBAAM,WAAW,MAAM,+CAA8B;AAAA,gBACpD;AAAA,gBACA;AAAA,gBACA,UAAU,IAAI,gBAAgB,IAAI;AAAA,gBAClC;AAAA,cACD;AACA,mBAAK,OAAO;AAAA,YACb;AACA,mBAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,MAAM;AAAA,IACjB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;","names":[]}
@@ -51,8 +51,8 @@ const properties = [
51
51
  displayName: "File Contents",
52
52
  name: "fileContents",
53
53
  default: "",
54
- description: "Find the name of input field containing the binary data to upload the file in the Input panel on the left, in the Binary tab",
55
- hint: "The name of the input field containing the binary file data to update the file",
54
+ description: "Find the name of input field containing the binary data to upload in the Input panel on the left, in the Binary tab",
55
+ hint: "The name of the input field containing the binary file data to upload",
56
56
  placeholder: "data",
57
57
  required: true,
58
58
  routing: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/file/upload.operation.ts"],"sourcesContent":["import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';\n\nimport { uploadFilePreSend } from '../../helpers/utils';\nimport { folderRLC, siteRLC, untilSiteSelected } from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\t...siteRLC,\n\t\tdescription: 'Select the site to retrieve folders from',\n\t},\n\t{\n\t\t...folderRLC,\n\t\tdescription: 'Select the folder to upload the file to',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'File Name',\n\t\tname: 'fileName',\n\t\tdefault: '',\n\t\tdescription: 'The name of the file being uploaded',\n\t\tplaceholder: 'e.g. My New File',\n\t\trequired: true,\n\t\ttype: 'string',\n\t},\n\t{\n\t\tdisplayName: 'File Contents',\n\t\tname: 'fileContents',\n\t\tdefault: '',\n\t\tdescription:\n\t\t\t'Find the name of input field containing the binary data to upload the file in the Input panel on the left, in the Binary tab',\n\t\thint: 'The name of the input field containing the binary file data to update the file',\n\t\tplaceholder: 'data',\n\t\trequired: true,\n\t\trouting: {\n\t\t\tsend: {\n\t\t\t\tpreSend: [uploadFilePreSend],\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['file'],\n\t\toperation: ['upload'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA2D;AAE3D,mBAAkC;AAClC,oBAAsD;AAEtD,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,UAAU;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,IACD,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,SAAS;AAAA,MACR,MAAM;AAAA,QACL,SAAS,CAAC,8BAAiB;AAAA,MAC5B;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,MAAM;AAAA,IACjB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;","names":[]}
1
+ {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/file/upload.operation.ts"],"sourcesContent":["import { updateDisplayOptions, type INodeProperties } from 'n8n-workflow';\n\nimport { uploadFilePreSend } from '../../helpers/utils';\nimport { folderRLC, siteRLC, untilSiteSelected } from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\t...siteRLC,\n\t\tdescription: 'Select the site to retrieve folders from',\n\t},\n\t{\n\t\t...folderRLC,\n\t\tdescription: 'Select the folder to upload the file to',\n\t\tdisplayOptions: {\n\t\t\thide: {\n\t\t\t\t...untilSiteSelected,\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'File Name',\n\t\tname: 'fileName',\n\t\tdefault: '',\n\t\tdescription: 'The name of the file being uploaded',\n\t\tplaceholder: 'e.g. My New File',\n\t\trequired: true,\n\t\ttype: 'string',\n\t},\n\t{\n\t\tdisplayName: 'File Contents',\n\t\tname: 'fileContents',\n\t\tdefault: '',\n\t\tdescription:\n\t\t\t'Find the name of input field containing the binary data to upload in the Input panel on the left, in the Binary tab',\n\t\thint: 'The name of the input field containing the binary file data to upload',\n\t\tplaceholder: 'data',\n\t\trequired: true,\n\t\trouting: {\n\t\t\tsend: {\n\t\t\t\tpreSend: [uploadFilePreSend],\n\t\t\t},\n\t\t},\n\t\ttype: 'string',\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['file'],\n\t\toperation: ['upload'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA2D;AAE3D,mBAAkC;AAClC,oBAAsD;AAEtD,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,EACd;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,aAAa;AAAA,IACb,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,UAAU;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACC;AAAA,IACD,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,SAAS;AAAA,MACR,MAAM;AAAA,QACL,SAAS,CAAC,8BAAiB;AAAA,MAC5B;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,MAAM;AAAA,IACjB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;AAEO,MAAM,kBAAc,0CAAqB,gBAAgB,UAAU;","names":[]}
@@ -68,7 +68,7 @@ const description = [
68
68
  {
69
69
  name: "Create or Update",
70
70
  value: "upsert",
71
- description: "Create a new record, or update the current one if it already exists (upsert)",
71
+ description: "Create a new item, or update the current one if it already exists (upsert)",
72
72
  routing: {
73
73
  request: {
74
74
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/item/Item.resource.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as create from './create.operation';\nimport * as del from './delete.operation';\nimport * as get from './get.operation';\nimport * as getAll from './getAll.operation';\nimport * as update from './update.operation';\nimport * as upsert from './upsert.operation';\nimport { handleErrorPostReceive, simplifyItemPostReceive } from '../../helpers/utils';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['item'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Create',\n\t\t\t\tvalue: 'create',\n\t\t\t\tdescription: 'Create an item in an existing list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Create item in a list',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Create or Update',\n\t\t\t\tvalue: 'upsert',\n\t\t\t\tdescription: 'Create a new record, or update the current one if it already exists (upsert)',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Create or update item (upsert)',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Delete',\n\t\t\t\tvalue: 'delete',\n\t\t\t\tdescription: 'Delete an item from a list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'DELETE',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items/{{ $parameter[\"item\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'set',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tvalue: '={{ { \"deleted\": true } }}',\n\t\t\t\t\t\t\t\t},\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\taction: 'Delete an item',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Retrieve an item from a list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tignoreHttpStatusErrors: true,\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items/{{ $parameter[\"item\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive, simplifyItemPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get an item',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get Many',\n\t\t\t\tvalue: 'getAll',\n\t\t\t\tdescription: 'Get specific items in a list or list many items',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tproperty: 'value',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsimplifyItemPostReceive,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get many items',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Update',\n\t\t\t\tvalue: 'update',\n\t\t\t\tdescription: 'Update an item in an existing list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'PATCH',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Update item in a list',\n\t\t\t},\n\t\t],\n\t\tdefault: 'getAll',\n\t},\n\n\t...create.description,\n\t...del.description,\n\t...get.description,\n\t...getAll.description,\n\t...update.description,\n\t...upsert.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,aAAwB;AACxB,UAAqB;AACrB,UAAqB;AACrB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,mBAAgE;AAEzD,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,S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AAY;AAAA,kBACX,UAAU;AAAA,gBACX;AAAA,cACD;AAAA,cACA;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,mCAAsB;AAAA,UACrC;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EAEA,GAAG,OAAO;AAAA,EACV,GAAG,IAAI;AAAA,EACP,GAAG,IAAI;AAAA,EACP,GAAG,OAAO;AAAA,EACV,GAAG,OAAO;AAAA,EACV,GAAG,OAAO;AACX;","names":[]}
1
+ {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/item/Item.resource.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as create from './create.operation';\nimport * as del from './delete.operation';\nimport * as get from './get.operation';\nimport * as getAll from './getAll.operation';\nimport * as update from './update.operation';\nimport * as upsert from './upsert.operation';\nimport { handleErrorPostReceive, simplifyItemPostReceive } from '../../helpers/utils';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['item'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Create',\n\t\t\t\tvalue: 'create',\n\t\t\t\tdescription: 'Create an item in an existing list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Create item in a list',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Create or Update',\n\t\t\t\tvalue: 'upsert',\n\t\t\t\tdescription: 'Create a new item, or update the current one if it already exists (upsert)',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Create or update item (upsert)',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Delete',\n\t\t\t\tvalue: 'delete',\n\t\t\t\tdescription: 'Delete an item from a list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'DELETE',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items/{{ $parameter[\"item\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'set',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tvalue: '={{ { \"deleted\": true } }}',\n\t\t\t\t\t\t\t\t},\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\taction: 'Delete an item',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Retrieve an item from a list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tignoreHttpStatusErrors: true,\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items/{{ $parameter[\"item\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive, simplifyItemPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get an item',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get Many',\n\t\t\t\tvalue: 'getAll',\n\t\t\t\tdescription: 'Get specific items in a list or list many items',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tproperty: 'value',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsimplifyItemPostReceive,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get many items',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Update',\n\t\t\t\tvalue: 'update',\n\t\t\t\tdescription: 'Update an item in an existing list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'PATCH',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}/items',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Update item in a list',\n\t\t\t},\n\t\t],\n\t\tdefault: 'getAll',\n\t},\n\n\t...create.description,\n\t...del.description,\n\t...get.description,\n\t...getAll.description,\n\t...update.description,\n\t...upsert.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,aAAwB;AACxB,UAAqB;AACrB,UAAqB;AACrB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,mBAAgE;AAEzD,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,mCAAsB;AAAA,UACrC;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,mCAAsB;AAAA,UACrC;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,cACZ;AAAA,cACA;AAAA,gBACC,MAAM;AAAA,gBACN,YAAY;AAAA,kBACX,OAAO;AAAA,gBACR;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,wBAAwB;AAAA,YACxB,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,qCAAwB,oCAAuB;AAAA,UAC9D;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,cACZ;AAAA,cACA;AAAA,gBACC,MAAM;AAAA,gBACN,YAAY;AAAA,kBACX,UAAU;AAAA,gBACX;AAAA,cACD;AAAA,cACA;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,mCAAsB;AAAA,UACrC;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EAEA,GAAG,OAAO;AAAA,EACV,GAAG,IAAI;AAAA,EACP,GAAG,IAAI;AAAA,EACP,GAAG,OAAO;AAAA,EACV,GAAG,OAAO;AAAA,EACV,GAAG,OAAO;AACX;","names":[]}
@@ -65,7 +65,7 @@ const description = [
65
65
  {
66
66
  name: "Get Many",
67
67
  value: "getAll",
68
- description: "Retrieve a list of",
68
+ description: "Retrieve a list of lists",
69
69
  routing: {
70
70
  request: {
71
71
  method: "GET",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/list/List.resource.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as get from './get.operation';\nimport * as getAll from './getAll.operation';\nimport { handleErrorPostReceive, simplifyListPostReceive } from '../../helpers/utils';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['list'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Retrieve details of a single list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tignoreHttpStatusErrors: true,\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive, simplifyListPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get list',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get Many',\n\t\t\t\tvalue: 'getAll',\n\t\t\t\tdescription: 'Retrieve a list of',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tproperty: 'value',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsimplifyListPostReceive,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get many lists',\n\t\t\t},\n\t\t],\n\t\tdefault: 'getAll',\n\t},\n\n\t...get.description,\n\t...getAll.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,UAAqB;AACrB,aAAwB;AACxB,mBAAgE;AAEzD,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,wBAAwB;AAAA,YACxB,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,qCAAwB,oCAAuB;AAAA,UAC9D;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,cACZ;AAAA,cACA;AAAA,gBACC,MAAM;AAAA,gBACN,YAAY;AAAA,kBACX,UAAU;AAAA,gBACX;AAAA,cACD;AAAA,cACA;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EAEA,GAAG,IAAI;AAAA,EACP,GAAG,OAAO;AACX;","names":[]}
1
+ {"version":3,"sources":["../../../../../../nodes/Microsoft/SharePoint/descriptions/list/List.resource.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport * as get from './get.operation';\nimport * as getAll from './getAll.operation';\nimport { handleErrorPostReceive, simplifyListPostReceive } from '../../helpers/utils';\n\nexport const description: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['list'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Retrieve details of a single list',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tignoreHttpStatusErrors: true,\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists/{{ $parameter[\"list\"] }}',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [handleErrorPostReceive, simplifyListPostReceive],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get list',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get Many',\n\t\t\t\tvalue: 'getAll',\n\t\t\t\tdescription: 'Retrieve a list of lists',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/sites/{{ $parameter[\"site\"] }}/lists',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\thandleErrorPostReceive,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'rootProperty',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tproperty: 'value',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsimplifyListPostReceive,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get many lists',\n\t\t\t},\n\t\t],\n\t\tdefault: 'getAll',\n\t},\n\n\t...get.description,\n\t...getAll.description,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,UAAqB;AACrB,aAAwB;AACxB,mBAAgE;AAEzD,MAAM,cAAiC;AAAA,EAC7C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,MAAM;AAAA,MAClB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,wBAAwB;AAAA,YACxB,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,qCAAwB,oCAAuB;AAAA,UAC9D;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa;AAAA,cACZ;AAAA,cACA;AAAA,gBACC,MAAM;AAAA,gBACN,YAAY;AAAA,kBACX,UAAU;AAAA,gBACX;AAAA,cACD;AAAA,cACA;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AAAA,EAEA,GAAG,IAAI;AAAA,EACP,GAAG,OAAO;AACX;","names":[]}
@@ -78,7 +78,14 @@ function validateAndResolveMongoCredentials(self, credentials) {
78
78
  return buildMongoConnectionParams(self, credentials);
79
79
  }
80
80
  }
81
- function prepareItems(items, fields, updateKey = "", useDotNotation = false, dateFields = []) {
81
+ function prepareItems({
82
+ items,
83
+ fields,
84
+ updateKey = "",
85
+ useDotNotation = false,
86
+ dateFields = [],
87
+ isUpdate = false
88
+ }) {
82
89
  let data = items;
83
90
  if (updateKey) {
84
91
  if (!fields.includes(updateKey)) {
@@ -98,7 +105,7 @@ function prepareItems(items, fields, updateKey = "", useDotNotation = false, dat
98
105
  if (fieldData && dateFields.includes(field)) {
99
106
  fieldData = new Date(fieldData);
100
107
  }
101
- if (useDotNotation) {
108
+ if (useDotNotation && !isUpdate) {
102
109
  (0, import_set.default)(updateItem, field, fieldData);
103
110
  } else {
104
111
  updateItem[field] = fieldData;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../nodes/MongoDb/GenericFunctions.ts"],"sourcesContent":["import get from 'lodash/get';\nimport set from 'lodash/set';\nimport { MongoClient, ObjectId } from 'mongodb';\nimport { NodeOperationError } from 'n8n-workflow';\nimport type {\n\tICredentialDataDecryptedObject,\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { createSecureContext } from 'tls';\n\nimport type {\n\tIMongoCredentials,\n\tIMongoCredentialsType,\n\tIMongoParametricCredentials,\n} from './mongoDb.types';\nimport { formatPrivateKey } from '../../utils/utilities';\n\n/**\n * Standard way of building the MongoDB connection string, unless overridden with a provided string\n *\n * @param {ICredentialDataDecryptedObject} credentials MongoDB credentials to use, unless conn string is overridden\n */\nexport function buildParameterizedConnString(credentials: IMongoParametricCredentials): string {\n\tif (credentials.port) {\n\t\treturn `mongodb://${credentials.user}:${credentials.password}@${credentials.host}:${credentials.port}`;\n\t} else {\n\t\treturn `mongodb+srv://${credentials.user}:${credentials.password}@${credentials.host}`;\n\t}\n}\n\n/**\n * Build mongoDb connection string and resolve database name.\n * If a connection string override value is provided, that will be used in place of individual args\n *\n * @param {ICredentialDataDecryptedObject} credentials raw/input MongoDB credentials to use\n */\nexport function buildMongoConnectionParams(\n\tself: IExecuteFunctions,\n\tcredentials: IMongoCredentialsType,\n): IMongoCredentials {\n\tconst sanitizedDbName =\n\t\tcredentials.database && credentials.database.trim().length > 0\n\t\t\t? credentials.database.trim()\n\t\t\t: '';\n\tif (credentials.configurationType === 'connectionString') {\n\t\tif (credentials.connectionString && credentials.connectionString.trim().length > 0) {\n\t\t\treturn {\n\t\t\t\tconnectionString: credentials.connectionString.trim(),\n\t\t\t\tdatabase: sanitizedDbName,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tself.getNode(),\n\t\t\t\t'Cannot override credentials: valid MongoDB connection string not provided ',\n\t\t\t);\n\t\t}\n\t} else {\n\t\treturn {\n\t\t\tconnectionString: buildParameterizedConnString(credentials),\n\t\t\tdatabase: sanitizedDbName,\n\t\t};\n\t}\n}\n\n/**\n * Verify credentials. If ok, build mongoDb connection string and resolve database name.\n *\n * @param {ICredentialDataDecryptedObject} credentials raw/input MongoDB credentials to use\n */\nexport function validateAndResolveMongoCredentials(\n\tself: IExecuteFunctions,\n\tcredentials?: ICredentialDataDecryptedObject,\n): IMongoCredentials {\n\tif (credentials === undefined) {\n\t\tthrow new NodeOperationError(self.getNode(), 'No credentials got returned!');\n\t} else {\n\t\treturn buildMongoConnectionParams(self, credentials as unknown as IMongoCredentialsType);\n\t}\n}\n\nexport function prepareItems(\n\titems: INodeExecutionData[],\n\tfields: string[],\n\tupdateKey = '',\n\tuseDotNotation = false,\n\tdateFields: string[] = [],\n) {\n\tlet data = items;\n\n\tif (updateKey) {\n\t\tif (!fields.includes(updateKey)) {\n\t\t\tfields.push(updateKey);\n\t\t}\n\t\tdata = items.filter((item) => item.json[updateKey] !== undefined);\n\t}\n\n\tconst preparedItems = data.map(({ json }) => {\n\t\tconst updateItem: IDataObject = {};\n\n\t\tfor (const field of fields) {\n\t\t\tlet fieldData;\n\n\t\t\tif (useDotNotation) {\n\t\t\t\tfieldData = get(json, field, null);\n\t\t\t} else {\n\t\t\t\tfieldData = json[field] !== undefined ? json[field] : null;\n\t\t\t}\n\n\t\t\tif (fieldData && dateFields.includes(field)) {\n\t\t\t\tfieldData = new Date(fieldData as string);\n\t\t\t}\n\n\t\t\tif (useDotNotation) {\n\t\t\t\tset(updateItem, field, fieldData);\n\t\t\t} else {\n\t\t\t\tupdateItem[field] = fieldData;\n\t\t\t}\n\t\t}\n\n\t\treturn updateItem;\n\t});\n\n\treturn preparedItems;\n}\n\nexport function prepareFields(fields: string) {\n\treturn fields\n\t\t.split(',')\n\t\t.map((field) => field.trim())\n\t\t.filter((field) => !!field);\n}\n\nexport function stringifyObjectIDs(items: INodeExecutionData[]) {\n\titems.forEach((item) => {\n\t\tif (item._id instanceof ObjectId) {\n\t\t\titem.json._id = item._id.toString();\n\t\t}\n\t\tif (item.id instanceof ObjectId) {\n\t\t\titem.json.id = item.id.toString();\n\t\t}\n\t});\n\n\treturn items;\n}\n\nexport async function connectMongoClient(connectionString: string, credentials: IDataObject = {}) {\n\tlet client: MongoClient;\n\n\tif (credentials.tls) {\n\t\tconst ca = credentials.ca ? formatPrivateKey(credentials.ca as string) : undefined;\n\t\tconst cert = credentials.cert ? formatPrivateKey(credentials.cert as string) : undefined;\n\t\tconst key = credentials.key ? formatPrivateKey(credentials.key as string) : undefined;\n\t\tconst passphrase = (credentials.passphrase as string) || undefined;\n\n\t\tconst secureContext = createSecureContext({\n\t\t\tca,\n\t\t\tcert,\n\t\t\tkey,\n\t\t\tpassphrase,\n\t\t});\n\n\t\tclient = await MongoClient.connect(connectionString, {\n\t\t\ttls: true,\n\t\t\tsecureContext,\n\t\t});\n\t} else {\n\t\tclient = await MongoClient.connect(connectionString);\n\t}\n\n\treturn client;\n}\n"],"mappings":";;;;;;;;;;;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WAAO,mCAAiB,YAAY,IAAc,IAAI;AAC/E,UAAM,MAAM,YAAY,UAAM,mCAAiB,YAAY,GAAa,IAAI;AAC5E,UAAM,aAAc,YAAY,cAAyB;AAEzD,UAAM,oBAAgB,gCAAoB;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAED,aAAS,MAAM,2BAAY,QAAQ,kBAAkB;AAAA,MACpD,KAAK;AAAA,MACL;AAAA,IACD,CAAC;AAAA,EACF,OAAO;AACN,aAAS,MAAM,2BAAY,QAAQ,gBAAgB;AAAA,EACpD;AAEA,SAAO;AACR;","names":["get","set"]}
1
+ {"version":3,"sources":["../../../nodes/MongoDb/GenericFunctions.ts"],"sourcesContent":["import get from 'lodash/get';\nimport set from 'lodash/set';\nimport { MongoClient, ObjectId } from 'mongodb';\nimport { NodeOperationError } from 'n8n-workflow';\nimport type {\n\tICredentialDataDecryptedObject,\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { createSecureContext } from 'tls';\n\nimport type {\n\tIMongoCredentials,\n\tIMongoCredentialsType,\n\tIMongoParametricCredentials,\n} from './mongoDb.types';\nimport { formatPrivateKey } from '../../utils/utilities';\n\n/**\n * Standard way of building the MongoDB connection string, unless overridden with a provided string\n *\n * @param {ICredentialDataDecryptedObject} credentials MongoDB credentials to use, unless conn string is overridden\n */\nexport function buildParameterizedConnString(credentials: IMongoParametricCredentials): string {\n\tif (credentials.port) {\n\t\treturn `mongodb://${credentials.user}:${credentials.password}@${credentials.host}:${credentials.port}`;\n\t} else {\n\t\treturn `mongodb+srv://${credentials.user}:${credentials.password}@${credentials.host}`;\n\t}\n}\n\n/**\n * Build mongoDb connection string and resolve database name.\n * If a connection string override value is provided, that will be used in place of individual args\n *\n * @param {ICredentialDataDecryptedObject} credentials raw/input MongoDB credentials to use\n */\nexport function buildMongoConnectionParams(\n\tself: IExecuteFunctions,\n\tcredentials: IMongoCredentialsType,\n): IMongoCredentials {\n\tconst sanitizedDbName =\n\t\tcredentials.database && credentials.database.trim().length > 0\n\t\t\t? credentials.database.trim()\n\t\t\t: '';\n\tif (credentials.configurationType === 'connectionString') {\n\t\tif (credentials.connectionString && credentials.connectionString.trim().length > 0) {\n\t\t\treturn {\n\t\t\t\tconnectionString: credentials.connectionString.trim(),\n\t\t\t\tdatabase: sanitizedDbName,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tself.getNode(),\n\t\t\t\t'Cannot override credentials: valid MongoDB connection string not provided ',\n\t\t\t);\n\t\t}\n\t} else {\n\t\treturn {\n\t\t\tconnectionString: buildParameterizedConnString(credentials),\n\t\t\tdatabase: sanitizedDbName,\n\t\t};\n\t}\n}\n\n/**\n * Verify credentials. If ok, build mongoDb connection string and resolve database name.\n *\n * @param {ICredentialDataDecryptedObject} credentials raw/input MongoDB credentials to use\n */\nexport function validateAndResolveMongoCredentials(\n\tself: IExecuteFunctions,\n\tcredentials?: ICredentialDataDecryptedObject,\n): IMongoCredentials {\n\tif (credentials === undefined) {\n\t\tthrow new NodeOperationError(self.getNode(), 'No credentials got returned!');\n\t} else {\n\t\treturn buildMongoConnectionParams(self, credentials as unknown as IMongoCredentialsType);\n\t}\n}\n\nexport function prepareItems({\n\titems,\n\tfields,\n\tupdateKey = '',\n\tuseDotNotation = false,\n\tdateFields = [],\n\tisUpdate = false,\n}: {\n\titems: INodeExecutionData[];\n\tfields: string[];\n\tupdateKey?: string;\n\tuseDotNotation?: boolean;\n\tdateFields?: string[];\n\tisUpdate?: boolean;\n}) {\n\tlet data = items;\n\n\tif (updateKey) {\n\t\tif (!fields.includes(updateKey)) {\n\t\t\tfields.push(updateKey);\n\t\t}\n\t\tdata = items.filter((item) => item.json[updateKey] !== undefined);\n\t}\n\n\tconst preparedItems = data.map(({ json }) => {\n\t\tconst updateItem: IDataObject = {};\n\n\t\tfor (const field of fields) {\n\t\t\tlet fieldData;\n\n\t\t\tif (useDotNotation) {\n\t\t\t\tfieldData = get(json, field, null);\n\t\t\t} else {\n\t\t\t\tfieldData = json[field] !== undefined ? json[field] : null;\n\t\t\t}\n\n\t\t\tif (fieldData && dateFields.includes(field)) {\n\t\t\t\tfieldData = new Date(fieldData as string);\n\t\t\t}\n\n\t\t\tif (useDotNotation && !isUpdate) {\n\t\t\t\tset(updateItem, field, fieldData);\n\t\t\t} else {\n\t\t\t\tupdateItem[field] = fieldData;\n\t\t\t}\n\t\t}\n\n\t\treturn updateItem;\n\t});\n\n\treturn preparedItems;\n}\n\nexport function prepareFields(fields: string) {\n\treturn fields\n\t\t.split(',')\n\t\t.map((field) => field.trim())\n\t\t.filter((field) => !!field);\n}\n\nexport function stringifyObjectIDs(items: INodeExecutionData[]) {\n\titems.forEach((item) => {\n\t\tif (item._id instanceof ObjectId) {\n\t\t\titem.json._id = item._id.toString();\n\t\t}\n\t\tif (item.id instanceof ObjectId) {\n\t\t\titem.json.id = item.id.toString();\n\t\t}\n\t});\n\n\treturn items;\n}\n\nexport async function connectMongoClient(connectionString: string, credentials: IDataObject = {}) {\n\tlet client: MongoClient;\n\n\tif (credentials.tls) {\n\t\tconst ca = credentials.ca ? formatPrivateKey(credentials.ca as string) : undefined;\n\t\tconst cert = credentials.cert ? formatPrivateKey(credentials.cert as string) : undefined;\n\t\tconst key = credentials.key ? formatPrivateKey(credentials.key as string) : undefined;\n\t\tconst passphrase = (credentials.passphrase as string) || undefined;\n\n\t\tconst secureContext = createSecureContext({\n\t\t\tca,\n\t\t\tcert,\n\t\t\tkey,\n\t\t\tpassphrase,\n\t\t});\n\n\t\tclient = await MongoClient.connect(connectionString, {\n\t\t\ttls: true,\n\t\t\tsecureContext,\n\t\t});\n\t} else {\n\t\tclient = await MongoClient.connect(connectionString);\n\t}\n\n\treturn client;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA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,IAAI;AAC/E,UAAM,MAAM,YAAY,UAAM,mCAAiB,YAAY,GAAa,IAAI;AAC5E,UAAM,aAAc,YAAY,cAAyB;AAEzD,UAAM,oBAAgB,gCAAoB;AAAA,MACzC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAC;AAED,aAAS,MAAM,2BAAY,QAAQ,kBAAkB;AAAA,MACpD,KAAK;AAAA,MACL;AAAA,IACD,CAAC;AAAA,EACF,OAAO;AACN,aAAS,MAAM,2BAAY,QAAQ,gBAAgB;AAAA,EACpD;AAEA,SAAO;AACR;","names":["get","set"]}
@@ -33,7 +33,7 @@ class MongoDb {
33
33
  name: "mongoDb",
34
34
  icon: "file:mongodb.svg",
35
35
  group: ["input"],
36
- version: [1, 1.1],
36
+ version: [1, 1.1, 1.2],
37
37
  description: "Find, insert and update documents in MongoDB",
38
38
  defaults: {
39
39
  name: "MongoDB"
@@ -199,7 +199,7 @@ class MongoDb {
199
199
  );
200
200
  const updateKey = (this.getNodeParameter("updateKey", 0) || "").trim();
201
201
  const updateOptions = this.getNodeParameter("upsert", 0) ? { upsert: true } : void 0;
202
- const updateItems = (0, import_GenericFunctions.prepareItems)(items, fields, updateKey, useDotNotation, dateFields);
202
+ const updateItems = (0, import_GenericFunctions.prepareItems)({ items, fields, updateKey, useDotNotation, dateFields });
203
203
  for (const item of updateItems) {
204
204
  try {
205
205
  const filter = { [updateKey]: item[updateKey] };
@@ -230,7 +230,14 @@ class MongoDb {
230
230
  );
231
231
  const updateKey = (this.getNodeParameter("updateKey", 0) || "").trim();
232
232
  const updateOptions = this.getNodeParameter("upsert", 0) ? { upsert: true } : void 0;
233
- const updateItems = (0, import_GenericFunctions.prepareItems)(items, fields, updateKey, useDotNotation, dateFields);
233
+ const updateItems = (0, import_GenericFunctions.prepareItems)({
234
+ items,
235
+ fields,
236
+ updateKey,
237
+ useDotNotation,
238
+ dateFields,
239
+ isUpdate: nodeVersion >= 1.2
240
+ });
234
241
  for (const item of updateItems) {
235
242
  try {
236
243
  const filter = { [updateKey]: item[updateKey] };
@@ -261,7 +268,13 @@ class MongoDb {
261
268
  const dateFields = (0, import_GenericFunctions.prepareFields)(
262
269
  this.getNodeParameter("options.dateFields", 0, "")
263
270
  );
264
- const insertItems = (0, import_GenericFunctions.prepareItems)(items, fields, "", useDotNotation, dateFields);
271
+ const insertItems = (0, import_GenericFunctions.prepareItems)({
272
+ items,
273
+ fields,
274
+ updateKey: "",
275
+ useDotNotation,
276
+ dateFields
277
+ });
265
278
  const { insertedIds } = await mdb.collection(this.getNodeParameter("collection", 0)).insertMany(insertItems);
266
279
  for (const i of Object.keys(insertedIds)) {
267
280
  responseData.push({
@@ -290,7 +303,14 @@ class MongoDb {
290
303
  );
291
304
  const updateKey = (this.getNodeParameter("updateKey", 0) || "").trim();
292
305
  const updateOptions = this.getNodeParameter("upsert", 0) ? { upsert: true } : void 0;
293
- const updateItems = (0, import_GenericFunctions.prepareItems)(items, fields, updateKey, useDotNotation, dateFields);
306
+ const updateItems = (0, import_GenericFunctions.prepareItems)({
307
+ items,
308
+ fields,
309
+ updateKey,
310
+ useDotNotation,
311
+ dateFields,
312
+ isUpdate: nodeVersion >= 1.2
313
+ });
294
314
  for (const item of updateItems) {
295
315
  try {
296
316
  const filter = { [updateKey]: item[updateKey] };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../nodes/MongoDb/MongoDb.node.ts"],"sourcesContent":["import type {\n\tFindOneAndReplaceOptions,\n\tFindOneAndUpdateOptions,\n\tUpdateOptions,\n\tSort,\n} from 'mongodb';\nimport { ObjectId } from 'mongodb';\nimport { ApplicationError, NodeConnectionTypes } from 'n8n-workflow';\nimport type {\n\tIExecuteFunctions,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n\tJsonObject,\n} from 'n8n-workflow';\n\nimport {\n\tbuildParameterizedConnString,\n\tconnectMongoClient,\n\tprepareFields,\n\tprepareItems,\n\tstringifyObjectIDs,\n\tvalidateAndResolveMongoCredentials,\n} from './GenericFunctions';\nimport type { IMongoParametricCredentials } from './mongoDb.types';\nimport { nodeProperties } from './MongoDbProperties';\nimport { generatePairedItemData } from '../../utils/utilities';\n\nexport class MongoDb implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'MongoDB',\n\t\tname: 'mongoDb',\n\t\ticon: 'file:mongodb.svg',\n\t\tgroup: ['input'],\n\t\tversion: [1, 1.1],\n\t\tdescription: 'Find, insert and update documents in MongoDB',\n\t\tdefaults: {\n\t\t\tname: 'MongoDB',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tusableAsTool: true,\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'mongoDb',\n\t\t\t\trequired: true,\n\t\t\t\ttestedBy: 'mongoDbCredentialTest',\n\t\t\t},\n\t\t],\n\t\tproperties: nodeProperties,\n\t};\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync mongoDbCredentialTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tconst credentials = credential.data as IDataObject;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst database = ((credentials.database as string) || '').trim();\n\t\t\t\t\tlet connectionString = '';\n\n\t\t\t\t\tif (credentials.configurationType === 'connectionString') {\n\t\t\t\t\t\tconnectionString = ((credentials.connectionString as string) || '').trim();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconnectionString = buildParameterizedConnString(\n\t\t\t\t\t\t\tcredentials as unknown as IMongoParametricCredentials,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst client = await connectMongoClient(connectionString, credentials);\n\n\t\t\t\t\tconst { databases } = await client.db().admin().listDatabases();\n\n\t\t\t\t\tif (!(databases as IDataObject[]).map((db) => db.name).includes(database)) {\n\t\t\t\t\t\tthrow new ApplicationError(`Database \"${database}\" does not exist`, {\n\t\t\t\t\t\t\tlevel: 'warning',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait client.close();\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst credentials = await this.getCredentials('mongoDb');\n\t\tconst { database, connectionString } = validateAndResolveMongoCredentials(this, credentials);\n\n\t\tconst client = await connectMongoClient(connectionString, credentials);\n\n\t\tconst mdb = client.db(database);\n\n\t\tlet returnData: INodeExecutionData[] = [];\n\n\t\tconst items = this.getInputData();\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tlet itemsLength = items.length ? 1 : 0;\n\t\tlet fallbackPairedItems;\n\n\t\tif (nodeVersion >= 1.1) {\n\t\t\titemsLength = items.length;\n\t\t} else {\n\t\t\tfallbackPairedItems = generatePairedItemData(items.length);\n\t\t}\n\n\t\tif (operation === 'aggregate') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst queryParameter = JSON.parse(\n\t\t\t\t\t\tthis.getNodeParameter('query', i) as string,\n\t\t\t\t\t) as IDataObject;\n\n\t\t\t\t\tif (queryParameter._id && typeof queryParameter._id === 'string') {\n\t\t\t\t\t\tqueryParameter._id = new ObjectId(queryParameter._id);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst query = mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.aggregate(queryParameter as unknown as Document[]);\n\n\t\t\t\t\tfor (const entry of await query.toArray()) {\n\t\t\t\t\t\treturnData.push({ json: entry, pairedItem: fallbackPairedItems ?? [{ item: i }] });\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'delete') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { deletedCount } = await mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.deleteMany(JSON.parse(this.getNodeParameter('query', i) as string) as Document);\n\n\t\t\t\t\treturnData.push({\n\t\t\t\t\t\tjson: { deletedCount },\n\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'find') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst queryParameter = JSON.parse(\n\t\t\t\t\t\tthis.getNodeParameter('query', i) as string,\n\t\t\t\t\t) as IDataObject;\n\n\t\t\t\t\tif (queryParameter._id && typeof queryParameter._id === 'string') {\n\t\t\t\t\t\tqueryParameter._id = new ObjectId(queryParameter._id);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet query = mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.find(queryParameter as unknown as Document);\n\n\t\t\t\t\tconst options = this.getNodeParameter('options', i);\n\t\t\t\t\tconst limit = options.limit as number;\n\t\t\t\t\tconst skip = options.skip as number;\n\t\t\t\t\tconst projection =\n\t\t\t\t\t\toptions.projection && (JSON.parse(options.projection as string) as Document);\n\t\t\t\t\tconst sort = options.sort && (JSON.parse(options.sort as string) as Sort);\n\n\t\t\t\t\tif (skip > 0) {\n\t\t\t\t\t\tquery = query.skip(skip);\n\t\t\t\t\t}\n\t\t\t\t\tif (limit > 0) {\n\t\t\t\t\t\tquery = query.limit(limit);\n\t\t\t\t\t}\n\t\t\t\t\tif (sort && Object.keys(sort).length !== 0 && sort.constructor === Object) {\n\t\t\t\t\t\tquery = query.sort(sort);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tprojection &&\n\t\t\t\t\t\tObject.keys(projection).length !== 0 &&\n\t\t\t\t\t\tprojection.constructor === Object\n\t\t\t\t\t) {\n\t\t\t\t\t\tquery = query.project(projection);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst queryResult = await query.toArray();\n\n\t\t\t\t\tfor (const entry of queryResult) {\n\t\t\t\t\t\treturnData.push({ json: entry, pairedItem: fallbackPairedItems ?? [{ item: i }] });\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'findOneAndReplace') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems(items, fields, updateKey, useDotNotation, dateFields);\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.findOneAndReplace(filter, item, updateOptions as FindOneAndReplaceOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'findOneAndUpdate') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems(items, fields, updateKey, useDotNotation, dateFields);\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.findOneAndUpdate(filter, { $set: item }, updateOptions as FindOneAndUpdateOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'insert') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tlet responseData: IDataObject[] = [];\n\t\t\ttry {\n\t\t\t\t// Prepare the data to insert and copy it to be returned\n\t\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\t\tconst dateFields = prepareFields(\n\t\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t\t);\n\n\t\t\t\tconst insertItems = prepareItems(items, fields, '', useDotNotation, dateFields);\n\n\t\t\t\tconst { insertedIds } = await mdb\n\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t.insertMany(insertItems);\n\n\t\t\t\t// Add the id to the data\n\t\t\t\tfor (const i of Object.keys(insertedIds)) {\n\t\t\t\t\tresponseData.push({\n\t\t\t\t\t\t...insertItems[parseInt(i, 10)],\n\t\t\t\t\t\tid: insertedIds[parseInt(i, 10)] as unknown as string,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\tresponseData = [{ error: (error as JsonObject).message }];\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(responseData),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'update') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems(items, fields, updateKey, useDotNotation, dateFields);\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.updateOne(filter, { $set: item }, updateOptions as UpdateOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tawait client.close();\n\n\t\treturn [stringifyObjectIDs(returnData)];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAAyB;AACzB,0BAAsD;AAatD,8BAOO;AAEP,+BAA+B;AAC/B,uBAAuC;AAEhC,MAAM,QAA6B;AAAA,EAAnC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,SAAS,CAAC,GAAG,GAAG;AAAA,MAChB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,cAAc;AAAA,MACd,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,UACV,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,IACb;AAEA,mBAAU;AAAA,MACT,gBAAgB;AAAA,QACf,MAAM,sBAEL,YACqC;AACrC,gBAAM,cAAc,WAAW;AAE/B,cAAI;AAC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,KAAK,IACf;AAEH,YAAM,kBAAc,sCAAa,OAAO,QAAQ,WAAW,gBAAgB,UAAU;AAErF,iBAAW,QAAQ,aAAa;AAC/B,YAAI;AACH,gBAAM,SAAS,EAAE,CAAC,SAAS,GAAG,KAAK,SAAS,EAAE;AAC9C,cAAI,cAAc,OAAO;AACxB,mBAAO,SAAS,IAAI,IAAI,wBAAS,KAAK,SAAS,CAAW;AAC1D,mBAAO,KAAK;AAAA,UACb;AAEA,gBAAM,IACJ,WAAW,KAAK,iBAAiB,cAAc,CAAC,CAAW,EAC3D,UAAU,QAAQ,EAAE,MAAM,KAAK,GAAG,aAA8B;AAAA,QACnE,SAAS,OAAO;AACf,cAAI,KAAK,eAAe,GAAG;AAC1B,iBAAK,OAAO,EAAE,OAAQ,MAAqB,QAAQ;AACnD;AAAA,UACD;AACA,gBAAM;AAAA,QACP;AAAA,MACD;AAEA,mBAAa,KAAK,QAAQ;AAAA,QACzB,KAAK,QAAQ,gBAAgB,WAAW;AAAA,QACxC,EAAE,UAAU,oBAAoB;AAAA,MACjC;AAAA,IACD;AAEA,UAAM,OAAO,MAAM;AAEnB,WAAO,KAAC,4CAAmB,UAAU,CAAC;AAAA,EACvC;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../nodes/MongoDb/MongoDb.node.ts"],"sourcesContent":["import type {\n\tFindOneAndReplaceOptions,\n\tFindOneAndUpdateOptions,\n\tUpdateOptions,\n\tSort,\n} from 'mongodb';\nimport { ObjectId } from 'mongodb';\nimport { ApplicationError, NodeConnectionTypes } from 'n8n-workflow';\nimport type {\n\tIExecuteFunctions,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n\tJsonObject,\n} from 'n8n-workflow';\n\nimport {\n\tbuildParameterizedConnString,\n\tconnectMongoClient,\n\tprepareFields,\n\tprepareItems,\n\tstringifyObjectIDs,\n\tvalidateAndResolveMongoCredentials,\n} from './GenericFunctions';\nimport type { IMongoParametricCredentials } from './mongoDb.types';\nimport { nodeProperties } from './MongoDbProperties';\nimport { generatePairedItemData } from '../../utils/utilities';\n\nexport class MongoDb implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'MongoDB',\n\t\tname: 'mongoDb',\n\t\ticon: 'file:mongodb.svg',\n\t\tgroup: ['input'],\n\t\tversion: [1, 1.1, 1.2],\n\t\tdescription: 'Find, insert and update documents in MongoDB',\n\t\tdefaults: {\n\t\t\tname: 'MongoDB',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tusableAsTool: true,\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'mongoDb',\n\t\t\t\trequired: true,\n\t\t\t\ttestedBy: 'mongoDbCredentialTest',\n\t\t\t},\n\t\t],\n\t\tproperties: nodeProperties,\n\t};\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync mongoDbCredentialTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tconst credentials = credential.data as IDataObject;\n\n\t\t\t\ttry {\n\t\t\t\t\tconst database = ((credentials.database as string) || '').trim();\n\t\t\t\t\tlet connectionString = '';\n\n\t\t\t\t\tif (credentials.configurationType === 'connectionString') {\n\t\t\t\t\t\tconnectionString = ((credentials.connectionString as string) || '').trim();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconnectionString = buildParameterizedConnString(\n\t\t\t\t\t\t\tcredentials as unknown as IMongoParametricCredentials,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst client = await connectMongoClient(connectionString, credentials);\n\n\t\t\t\t\tconst { databases } = await client.db().admin().listDatabases();\n\n\t\t\t\t\tif (!(databases as IDataObject[]).map((db) => db.name).includes(database)) {\n\t\t\t\t\t\tthrow new ApplicationError(`Database \"${database}\" does not exist`, {\n\t\t\t\t\t\t\tlevel: 'warning',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tawait client.close();\n\t\t\t\t} catch (error) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst credentials = await this.getCredentials('mongoDb');\n\t\tconst { database, connectionString } = validateAndResolveMongoCredentials(this, credentials);\n\n\t\tconst client = await connectMongoClient(connectionString, credentials);\n\n\t\tconst mdb = client.db(database);\n\n\t\tlet returnData: INodeExecutionData[] = [];\n\n\t\tconst items = this.getInputData();\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tlet itemsLength = items.length ? 1 : 0;\n\t\tlet fallbackPairedItems;\n\n\t\tif (nodeVersion >= 1.1) {\n\t\t\titemsLength = items.length;\n\t\t} else {\n\t\t\tfallbackPairedItems = generatePairedItemData(items.length);\n\t\t}\n\n\t\tif (operation === 'aggregate') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst queryParameter = JSON.parse(\n\t\t\t\t\t\tthis.getNodeParameter('query', i) as string,\n\t\t\t\t\t) as IDataObject;\n\n\t\t\t\t\tif (queryParameter._id && typeof queryParameter._id === 'string') {\n\t\t\t\t\t\tqueryParameter._id = new ObjectId(queryParameter._id);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst query = mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.aggregate(queryParameter as unknown as Document[]);\n\n\t\t\t\t\tfor (const entry of await query.toArray()) {\n\t\t\t\t\t\treturnData.push({ json: entry, pairedItem: fallbackPairedItems ?? [{ item: i }] });\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'delete') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { deletedCount } = await mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.deleteMany(JSON.parse(this.getNodeParameter('query', i) as string) as Document);\n\n\t\t\t\t\treturnData.push({\n\t\t\t\t\t\tjson: { deletedCount },\n\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'find') {\n\t\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst queryParameter = JSON.parse(\n\t\t\t\t\t\tthis.getNodeParameter('query', i) as string,\n\t\t\t\t\t) as IDataObject;\n\n\t\t\t\t\tif (queryParameter._id && typeof queryParameter._id === 'string') {\n\t\t\t\t\t\tqueryParameter._id = new ObjectId(queryParameter._id);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet query = mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', i) as string)\n\t\t\t\t\t\t.find(queryParameter as unknown as Document);\n\n\t\t\t\t\tconst options = this.getNodeParameter('options', i);\n\t\t\t\t\tconst limit = options.limit as number;\n\t\t\t\t\tconst skip = options.skip as number;\n\t\t\t\t\tconst projection =\n\t\t\t\t\t\toptions.projection && (JSON.parse(options.projection as string) as Document);\n\t\t\t\t\tconst sort = options.sort && (JSON.parse(options.sort as string) as Sort);\n\n\t\t\t\t\tif (skip > 0) {\n\t\t\t\t\t\tquery = query.skip(skip);\n\t\t\t\t\t}\n\t\t\t\t\tif (limit > 0) {\n\t\t\t\t\t\tquery = query.limit(limit);\n\t\t\t\t\t}\n\t\t\t\t\tif (sort && Object.keys(sort).length !== 0 && sort.constructor === Object) {\n\t\t\t\t\t\tquery = query.sort(sort);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tprojection &&\n\t\t\t\t\t\tObject.keys(projection).length !== 0 &&\n\t\t\t\t\t\tprojection.constructor === Object\n\t\t\t\t\t) {\n\t\t\t\t\t\tquery = query.project(projection);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst queryResult = await query.toArray();\n\n\t\t\t\t\tfor (const entry of queryResult) {\n\t\t\t\t\t\treturnData.push({ json: entry, pairedItem: fallbackPairedItems ?? [{ item: i }] });\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\treturnData.push({\n\t\t\t\t\t\t\tjson: { error: (error as JsonObject).message },\n\t\t\t\t\t\t\tpairedItem: fallbackPairedItems ?? [{ item: i }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'findOneAndReplace') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems({ items, fields, updateKey, useDotNotation, dateFields });\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.findOneAndReplace(filter, item, updateOptions as FindOneAndReplaceOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'findOneAndUpdate') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems({\n\t\t\t\titems,\n\t\t\t\tfields,\n\t\t\t\tupdateKey,\n\t\t\t\tuseDotNotation,\n\t\t\t\tdateFields,\n\t\t\t\tisUpdate: nodeVersion >= 1.2,\n\t\t\t});\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.findOneAndUpdate(filter, { $set: item }, updateOptions as FindOneAndUpdateOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'insert') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tlet responseData: IDataObject[] = [];\n\t\t\ttry {\n\t\t\t\t// Prepare the data to insert and copy it to be returned\n\t\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\t\tconst dateFields = prepareFields(\n\t\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t\t);\n\n\t\t\t\tconst insertItems = prepareItems({\n\t\t\t\t\titems,\n\t\t\t\t\tfields,\n\t\t\t\t\tupdateKey: '',\n\t\t\t\t\tuseDotNotation,\n\t\t\t\t\tdateFields,\n\t\t\t\t});\n\n\t\t\t\tconst { insertedIds } = await mdb\n\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t.insertMany(insertItems);\n\n\t\t\t\t// Add the id to the data\n\t\t\t\tfor (const i of Object.keys(insertedIds)) {\n\t\t\t\t\tresponseData.push({\n\t\t\t\t\t\t...insertItems[parseInt(i, 10)],\n\t\t\t\t\t\tid: insertedIds[parseInt(i, 10)] as unknown as string,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\tresponseData = [{ error: (error as JsonObject).message }];\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(responseData),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tif (operation === 'update') {\n\t\t\tfallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);\n\t\t\tconst fields = prepareFields(this.getNodeParameter('fields', 0) as string);\n\t\t\tconst useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;\n\t\t\tconst dateFields = prepareFields(\n\t\t\t\tthis.getNodeParameter('options.dateFields', 0, '') as string,\n\t\t\t);\n\n\t\t\tconst updateKey = ((this.getNodeParameter('updateKey', 0) as string) || '').trim();\n\n\t\t\tconst updateOptions = (this.getNodeParameter('upsert', 0) as boolean)\n\t\t\t\t? { upsert: true }\n\t\t\t\t: undefined;\n\n\t\t\tconst updateItems = prepareItems({\n\t\t\t\titems,\n\t\t\t\tfields,\n\t\t\t\tupdateKey,\n\t\t\t\tuseDotNotation,\n\t\t\t\tdateFields,\n\t\t\t\tisUpdate: nodeVersion >= 1.2,\n\t\t\t});\n\n\t\t\tfor (const item of updateItems) {\n\t\t\t\ttry {\n\t\t\t\t\tconst filter = { [updateKey]: item[updateKey] };\n\t\t\t\t\tif (updateKey === '_id') {\n\t\t\t\t\t\tfilter[updateKey] = new ObjectId(item[updateKey] as string);\n\t\t\t\t\t\tdelete item._id;\n\t\t\t\t\t}\n\n\t\t\t\t\tawait mdb\n\t\t\t\t\t\t.collection(this.getNodeParameter('collection', 0) as string)\n\t\t\t\t\t\t.updateOne(filter, { $set: item }, updateOptions as UpdateOptions);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.continueOnFail()) {\n\t\t\t\t\t\titem.json = { error: (error as JsonObject).message };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturnData = this.helpers.constructExecutionMetaData(\n\t\t\t\tthis.helpers.returnJsonArray(updateItems),\n\t\t\t\t{ itemData: fallbackPairedItems },\n\t\t\t);\n\t\t}\n\n\t\tawait client.close();\n\n\t\treturn [stringifyObjectIDs(returnData)];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,qBAAyB;AACzB,0BAAsD;AAatD,8BAOO;AAEP,+BAA+B;AAC/B,uBAAuC;AAEhC,MAAM,QAA6B;AAAA,EAAnC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,SAAS,CAAC,GAAG,KAAK,GAAG;AAAA,MACrB,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,w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950
1950
  returnData.push(...executionData);
1951
1951
  } catch (error) {
1952
1952
  if (this.continueOnFail()) {
1953
- returnData.push({ json: {}, error: error.message });
1953
+ const executionErrorData = this.helpers.constructExecutionMetaData(
1954
+ this.helpers.returnJsonArray({ error: error.description ?? error.message }),
1955
+ { itemData: { item: i } }
1956
+ );
1957
+ returnData.push(...executionErrorData);
1954
1958
  continue;
1955
1959
  }
1956
1960
  throw error;