n8n-nodes-base 0.230.0 → 0.232.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 (263) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/credentials/AirtableOAuth2Api.credentials.d.ts +8 -0
  3. package/dist/credentials/AirtableOAuth2Api.credentials.js +52 -0
  4. package/dist/credentials/AirtableOAuth2Api.credentials.js.map +1 -0
  5. package/dist/credentials/Aws.credentials.js.map +1 -1
  6. package/dist/credentials/Ldap.credentials.d.ts +1 -0
  7. package/dist/credentials/Ldap.credentials.js +1 -0
  8. package/dist/credentials/Ldap.credentials.js.map +1 -1
  9. package/dist/credentials/LinkedInOAuth2Api.credentials.js +1 -1
  10. package/dist/credentials/LoneScaleApi.credentials.d.ts +1 -0
  11. package/dist/credentials/LoneScaleApi.credentials.js +1 -0
  12. package/dist/credentials/LoneScaleApi.credentials.js.map +1 -1
  13. package/dist/credentials/OAuth2Api.credentials.js +6 -2
  14. package/dist/credentials/OAuth2Api.credentials.js.map +1 -1
  15. package/dist/credentials/ZendeskApi.credentials.js +3 -0
  16. package/dist/credentials/ZendeskApi.credentials.js.map +1 -1
  17. package/dist/known/credentials.json +10 -2
  18. package/dist/known/nodes.json +4 -0
  19. package/dist/nodes/ActionNetwork/GenericFunctions.js +14 -14
  20. package/dist/nodes/ActionNetwork/GenericFunctions.js.map +1 -1
  21. package/dist/nodes/Affinity/PersonDescription.js +2 -2
  22. package/dist/nodes/Affinity/PersonDescription.js.map +1 -1
  23. package/dist/nodes/Airtable/Airtable.node.js +13 -0
  24. package/dist/nodes/Airtable/Airtable.node.js.map +1 -1
  25. package/dist/nodes/Asana/GenericFunctions.js +2 -2
  26. package/dist/nodes/Asana/GenericFunctions.js.map +1 -1
  27. package/dist/nodes/Aws/AwsSnsTrigger.node.js +2 -2
  28. package/dist/nodes/Aws/AwsSnsTrigger.node.js.map +1 -1
  29. package/dist/nodes/Aws/CertificateManager/GenericFunctions.js +2 -2
  30. package/dist/nodes/Aws/CertificateManager/GenericFunctions.js.map +1 -1
  31. package/dist/nodes/Aws/ELB/GenericFunctions.js +8 -8
  32. package/dist/nodes/Aws/ELB/GenericFunctions.js.map +1 -1
  33. package/dist/nodes/Aws/Rekognition/GenericFunctions.js +9 -9
  34. package/dist/nodes/Aws/Rekognition/GenericFunctions.js.map +1 -1
  35. package/dist/nodes/Aws/S3/AwsS3.node.d.ts +3 -4
  36. package/dist/nodes/Aws/S3/AwsS3.node.js +11 -531
  37. package/dist/nodes/Aws/S3/AwsS3.node.js.map +1 -1
  38. package/dist/nodes/Aws/S3/V1/AwsS3V1.node.d.ts +6 -0
  39. package/dist/nodes/Aws/S3/V1/AwsS3V1.node.js +547 -0
  40. package/dist/nodes/Aws/S3/V1/AwsS3V1.node.js.map +1 -0
  41. package/dist/nodes/Aws/S3/V1/BucketDescription.js.map +1 -0
  42. package/dist/nodes/Aws/S3/V1/FileDescription.js.map +1 -0
  43. package/dist/nodes/Aws/S3/V1/FolderDescription.js.map +1 -0
  44. package/dist/nodes/Aws/S3/{GenericFunctions.js → V1/GenericFunctions.js} +9 -9
  45. package/dist/nodes/Aws/S3/V1/GenericFunctions.js.map +1 -0
  46. package/dist/nodes/Aws/S3/V2/AwsS3V2.node.d.ts +6 -0
  47. package/dist/nodes/Aws/S3/V2/AwsS3V2.node.js +628 -0
  48. package/dist/nodes/Aws/S3/V2/AwsS3V2.node.js.map +1 -0
  49. package/dist/nodes/Aws/S3/V2/BucketDescription.d.ts +3 -0
  50. package/dist/nodes/Aws/S3/V2/BucketDescription.js +301 -0
  51. package/dist/nodes/Aws/S3/V2/BucketDescription.js.map +1 -0
  52. package/dist/nodes/Aws/S3/V2/FileDescription.d.ts +3 -0
  53. package/dist/nodes/Aws/S3/V2/FileDescription.js +811 -0
  54. package/dist/nodes/Aws/S3/V2/FileDescription.js.map +1 -0
  55. package/dist/nodes/Aws/S3/V2/FolderDescription.d.ts +3 -0
  56. package/dist/nodes/Aws/S3/V2/FolderDescription.js +230 -0
  57. package/dist/nodes/Aws/S3/V2/FolderDescription.js.map +1 -0
  58. package/dist/nodes/Aws/S3/V2/GenericFunctions.d.ts +5 -0
  59. package/dist/nodes/Aws/S3/V2/GenericFunctions.js +73 -0
  60. package/dist/nodes/Aws/S3/V2/GenericFunctions.js.map +1 -0
  61. package/dist/nodes/Aws/S3/test/V2/AwsS3.file.upload.V2.workflow.json +97 -0
  62. package/dist/nodes/Aws/SES/GenericFunctions.js +8 -8
  63. package/dist/nodes/Aws/SES/GenericFunctions.js.map +1 -1
  64. package/dist/nodes/Aws/Transcribe/GenericFunctions.js +8 -8
  65. package/dist/nodes/Aws/Transcribe/GenericFunctions.js.map +1 -1
  66. package/dist/nodes/Bitwarden/Bitwarden.node.js +8 -8
  67. package/dist/nodes/Bitwarden/Bitwarden.node.js.map +1 -1
  68. package/dist/nodes/CircleCi/PipelineDescription.js +1 -1
  69. package/dist/nodes/CircleCi/PipelineDescription.js.map +1 -1
  70. package/dist/nodes/Cisco/Webex/GenericFunctions.js +5 -5
  71. package/dist/nodes/Cisco/Webex/GenericFunctions.js.map +1 -1
  72. package/dist/nodes/CompareDatasets/GenericFunctions.js +31 -31
  73. package/dist/nodes/CompareDatasets/GenericFunctions.js.map +1 -1
  74. package/dist/nodes/Copper/GenericFunctions.js +11 -11
  75. package/dist/nodes/Copper/GenericFunctions.js.map +1 -1
  76. package/dist/nodes/Cortex/Cortex.node.js +2 -2
  77. package/dist/nodes/Cortex/Cortex.node.js.map +1 -1
  78. package/dist/nodes/Crypto/Crypto.node.js +2 -2
  79. package/dist/nodes/Crypto/Crypto.node.js.map +1 -1
  80. package/dist/nodes/CustomerIo/GenericFunctions.js +2 -2
  81. package/dist/nodes/CustomerIo/GenericFunctions.js.map +1 -1
  82. package/dist/nodes/DateTime/V1/DateTimeV1.node.js +3 -3
  83. package/dist/nodes/DateTime/V1/DateTimeV1.node.js.map +1 -1
  84. package/dist/nodes/DebugHelper/DebugHelper.node.d.ts +5 -0
  85. package/dist/nodes/DebugHelper/DebugHelper.node.js +347 -0
  86. package/dist/nodes/DebugHelper/DebugHelper.node.js.map +1 -0
  87. package/dist/nodes/DebugHelper/DebugHelper.node.json +13 -0
  88. package/dist/nodes/DebugHelper/DebugHelper.svg +28 -0
  89. package/dist/nodes/DebugHelper/functions.d.ts +8 -0
  90. package/dist/nodes/DebugHelper/functions.js +31 -0
  91. package/dist/nodes/DebugHelper/functions.js.map +1 -0
  92. package/dist/nodes/DebugHelper/randomData.d.ts +52 -0
  93. package/dist/nodes/DebugHelper/randomData.js +83 -0
  94. package/dist/nodes/DebugHelper/randomData.js.map +1 -0
  95. package/dist/nodes/ERPNext/utils.js +6 -6
  96. package/dist/nodes/ERPNext/utils.js.map +1 -1
  97. package/dist/nodes/Elastic/Elasticsearch/Elasticsearch.node.js +2 -2
  98. package/dist/nodes/Elastic/Elasticsearch/Elasticsearch.node.js.map +1 -1
  99. package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js +6 -6
  100. package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js.map +1 -1
  101. package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +6 -6
  102. package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
  103. package/dist/nodes/Emelia/Emelia.node.js +3 -3
  104. package/dist/nodes/Emelia/Emelia.node.js.map +1 -1
  105. package/dist/nodes/ExecutionData/ExecutionData.node.json +1 -6
  106. package/dist/nodes/Freshservice/GenericFunctions.js +2 -5
  107. package/dist/nodes/Freshservice/GenericFunctions.js.map +1 -1
  108. package/dist/nodes/FreshworksCrm/GenericFunctions.js +2 -2
  109. package/dist/nodes/FreshworksCrm/GenericFunctions.js.map +1 -1
  110. package/dist/nodes/GoToWebinar/GoToWebinar.node.js +8 -8
  111. package/dist/nodes/GoToWebinar/GoToWebinar.node.js.map +1 -1
  112. package/dist/nodes/Google/Gmail/GenericFunctions.d.ts +2 -1
  113. package/dist/nodes/Google/Gmail/GenericFunctions.js +6 -5
  114. package/dist/nodes/Google/Gmail/GenericFunctions.js.map +1 -1
  115. package/dist/nodes/Google/Gmail/v1/GmailV1.node.js +8 -8
  116. package/dist/nodes/Google/Gmail/v1/GmailV1.node.js.map +1 -1
  117. package/dist/nodes/Google/Gmail/v2/DraftDescription.js +8 -0
  118. package/dist/nodes/Google/Gmail/v2/DraftDescription.js.map +1 -1
  119. package/dist/nodes/Google/Gmail/v2/GmailV2.node.js +12 -2
  120. package/dist/nodes/Google/Gmail/v2/GmailV2.node.js.map +1 -1
  121. package/dist/nodes/Google/Gmail/v2/MessageDescription.js +13 -0
  122. package/dist/nodes/Google/Gmail/v2/MessageDescription.js.map +1 -1
  123. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.utils.js +6 -6
  124. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.utils.js.map +1 -1
  125. package/dist/nodes/Google/Sheet/v1/GoogleSheet.js +2 -2
  126. package/dist/nodes/Google/Sheet/v1/GoogleSheet.js.map +1 -1
  127. package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js +3 -0
  128. package/dist/nodes/Google/Sheet/v2/actions/sheet/update.operation.js.map +1 -1
  129. package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js +2 -2
  130. package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js.map +1 -1
  131. package/dist/nodes/HelpScout/GenericFunctions.js +3 -3
  132. package/dist/nodes/HelpScout/GenericFunctions.js.map +1 -1
  133. package/dist/nodes/HtmlExtract/HtmlExtract.node.js +2 -2
  134. package/dist/nodes/HtmlExtract/HtmlExtract.node.js.map +1 -1
  135. package/dist/nodes/HttpRequest/GenericFunctions.js +2 -2
  136. package/dist/nodes/HttpRequest/GenericFunctions.js.map +1 -1
  137. package/dist/nodes/InvoiceNinja/GenericFunctions.js +2 -2
  138. package/dist/nodes/InvoiceNinja/GenericFunctions.js.map +1 -1
  139. package/dist/nodes/ItemLists/ItemLists.node.js +2 -1
  140. package/dist/nodes/ItemLists/ItemLists.node.js.map +1 -1
  141. package/dist/nodes/ItemLists/V1/ItemListsV1.node.js +45 -45
  142. package/dist/nodes/ItemLists/V1/ItemListsV1.node.js.map +1 -1
  143. package/dist/nodes/ItemLists/V1/summarize.operation.js +2 -2
  144. package/dist/nodes/ItemLists/V1/summarize.operation.js.map +1 -1
  145. package/dist/nodes/ItemLists/V2/ItemListsV2.node.js +131 -114
  146. package/dist/nodes/ItemLists/V2/ItemListsV2.node.js.map +1 -1
  147. package/dist/nodes/ItemLists/V2/summarize.operation.js +2 -2
  148. package/dist/nodes/ItemLists/V2/summarize.operation.js.map +1 -1
  149. package/dist/nodes/ItemLists/test/node/workflow.update_2_2.json +361 -0
  150. package/dist/nodes/Jira/Jira.node.js +2 -2
  151. package/dist/nodes/Jira/Jira.node.js.map +1 -1
  152. package/dist/nodes/KoBoToolbox/GenericFunctions.js +36 -36
  153. package/dist/nodes/KoBoToolbox/GenericFunctions.js.map +1 -1
  154. package/dist/nodes/Ldap/Ldap.node.json +1 -1
  155. package/dist/nodes/Lemlist/Lemlist.node.js +5 -5
  156. package/dist/nodes/Lemlist/Lemlist.node.js.map +1 -1
  157. package/dist/nodes/Linear/GenericFunctions.js +4 -4
  158. package/dist/nodes/Linear/GenericFunctions.js.map +1 -1
  159. package/dist/nodes/LinkedIn/GenericFunctions.js +1 -1
  160. package/dist/nodes/LinkedIn/LinkedIn.node.js +0 -5
  161. package/dist/nodes/LinkedIn/LinkedIn.node.js.map +1 -1
  162. package/dist/nodes/LinkedIn/PostDescription.js +1 -1
  163. package/dist/nodes/LinkedIn/PostDescription.js.map +1 -1
  164. package/dist/nodes/Mandrill/GenericFunctions.js +2 -2
  165. package/dist/nodes/Mandrill/GenericFunctions.js.map +1 -1
  166. package/dist/nodes/Mandrill/Mandrill.node.js +13 -13
  167. package/dist/nodes/Mandrill/Mandrill.node.js.map +1 -1
  168. package/dist/nodes/Markdown/Markdown.node.js +7 -7
  169. package/dist/nodes/Markdown/Markdown.node.js.map +1 -1
  170. package/dist/nodes/Merge/v1/MergeV1.node.js +3 -3
  171. package/dist/nodes/Merge/v1/MergeV1.node.js.map +1 -1
  172. package/dist/nodes/Merge/v2/GenericFunctions.js +14 -14
  173. package/dist/nodes/Merge/v2/GenericFunctions.js.map +1 -1
  174. package/dist/nodes/Merge/v2/MergeV2.node.js +3 -3
  175. package/dist/nodes/Merge/v2/MergeV2.node.js.map +1 -1
  176. package/dist/nodes/MondayCom/GenericFunctions.js +3 -3
  177. package/dist/nodes/MondayCom/GenericFunctions.js.map +1 -1
  178. package/dist/nodes/MongoDb/GenericFunctions.js +4 -4
  179. package/dist/nodes/MongoDb/GenericFunctions.js.map +1 -1
  180. package/dist/nodes/MoveBinaryData/MoveBinaryData.node.js +9 -9
  181. package/dist/nodes/MoveBinaryData/MoveBinaryData.node.js.map +1 -1
  182. package/dist/nodes/N8n/WorkflowLocator.js +3 -3
  183. package/dist/nodes/N8n/WorkflowLocator.js.map +1 -1
  184. package/dist/nodes/Postgres/PostgresTrigger.node.json +1 -1
  185. package/dist/nodes/QuickBooks/GenericFunctions.js +5 -5
  186. package/dist/nodes/QuickBooks/GenericFunctions.js.map +1 -1
  187. package/dist/nodes/QuickBooks/QuickBooks.node.js +8 -8
  188. package/dist/nodes/QuickBooks/QuickBooks.node.js.map +1 -1
  189. package/dist/nodes/Raindrop/Raindrop.node.js +7 -7
  190. package/dist/nodes/Raindrop/Raindrop.node.js.map +1 -1
  191. package/dist/nodes/Redis/Redis.node.js +3 -3
  192. package/dist/nodes/Redis/Redis.node.js.map +1 -1
  193. package/dist/nodes/RenameKeys/RenameKeys.node.js +6 -6
  194. package/dist/nodes/RenameKeys/RenameKeys.node.js.map +1 -1
  195. package/dist/nodes/S3/GenericFunctions.js +9 -9
  196. package/dist/nodes/S3/GenericFunctions.js.map +1 -1
  197. package/dist/nodes/S3/S3.node.js +3 -3
  198. package/dist/nodes/S3/S3.node.js.map +1 -1
  199. package/dist/nodes/Salesforce/LeadDescription.js +2 -2
  200. package/dist/nodes/Salesforce/LeadDescription.js.map +1 -1
  201. package/dist/nodes/Schedule/GenericFunctions.d.ts +3 -0
  202. package/dist/nodes/Schedule/GenericFunctions.js +25 -1
  203. package/dist/nodes/Schedule/GenericFunctions.js.map +1 -1
  204. package/dist/nodes/Schedule/ScheduleTrigger.node.js +5 -1
  205. package/dist/nodes/Schedule/ScheduleTrigger.node.js.map +1 -1
  206. package/dist/nodes/Set/Set.node.js +4 -4
  207. package/dist/nodes/Set/Set.node.js.map +1 -1
  208. package/dist/nodes/Slack/V1/GenericFunctions.js +2 -2
  209. package/dist/nodes/Slack/V1/GenericFunctions.js.map +1 -1
  210. package/dist/nodes/Slack/V2/GenericFunctions.js +2 -2
  211. package/dist/nodes/Slack/V2/GenericFunctions.js.map +1 -1
  212. package/dist/nodes/SplitInBatches/test/SplitInBatches.workflow_v2_done_variable.json +738 -0
  213. package/dist/nodes/SplitInBatches/v2/SplitInBatchesV2.node.js +2 -0
  214. package/dist/nodes/SplitInBatches/v2/SplitInBatchesV2.node.js.map +1 -1
  215. package/dist/nodes/Spotify/GenericFunctions.js +2 -2
  216. package/dist/nodes/Spotify/GenericFunctions.js.map +1 -1
  217. package/dist/nodes/Stripe/Stripe.node.js +7 -7
  218. package/dist/nodes/Stripe/Stripe.node.js.map +1 -1
  219. package/dist/nodes/Stripe/StripeTrigger.node.js +5 -0
  220. package/dist/nodes/Stripe/StripeTrigger.node.js.map +1 -1
  221. package/dist/nodes/Stripe/helpers.js +11 -11
  222. package/dist/nodes/Stripe/helpers.js.map +1 -1
  223. package/dist/nodes/TheHive/TheHive.node.js +3 -3
  224. package/dist/nodes/TheHive/TheHive.node.js.map +1 -1
  225. package/dist/nodes/TravisCi/GenericFunctions.js +2 -2
  226. package/dist/nodes/TravisCi/GenericFunctions.js.map +1 -1
  227. package/dist/nodes/Uplead/PersonDescription.js +1 -1
  228. package/dist/nodes/Uplead/PersonDescription.js.map +1 -1
  229. package/dist/nodes/Venafi/Datacenter/GenericFunctions.js +2 -2
  230. package/dist/nodes/Venafi/Datacenter/GenericFunctions.js.map +1 -1
  231. package/dist/nodes/Venafi/ProtectCloud/GenericFunctions.js +2 -2
  232. package/dist/nodes/Venafi/ProtectCloud/GenericFunctions.js.map +1 -1
  233. package/dist/nodes/WhatsApp/MessageFunctions.js +8 -8
  234. package/dist/nodes/WhatsApp/MessageFunctions.js.map +1 -1
  235. package/dist/nodes/Wise/Wise.node.js +2 -2
  236. package/dist/nodes/Wise/Wise.node.js.map +1 -1
  237. package/dist/nodes/WooCommerce/GenericFunctions.js +2 -2
  238. package/dist/nodes/WooCommerce/GenericFunctions.js.map +1 -1
  239. package/dist/nodes/Zammad/GenericFunctions.js +5 -5
  240. package/dist/nodes/Zammad/GenericFunctions.js.map +1 -1
  241. package/dist/nodes/Zendesk/TicketInterface.d.ts +1 -1
  242. package/dist/nodes/Zendesk/Zendesk.node.js +2 -2
  243. package/dist/nodes/Zendesk/Zendesk.node.js.map +1 -1
  244. package/dist/nodes/Zoho/GenericFunctions.js +13 -13
  245. package/dist/nodes/Zoho/GenericFunctions.js.map +1 -1
  246. package/dist/nodes/Zulip/GenericFunctions.js +1 -1
  247. package/dist/nodes/Zulip/GenericFunctions.js.map +1 -1
  248. package/dist/package.json +9 -84
  249. package/dist/types/credentials.json +6 -5
  250. package/dist/types/nodes.json +21 -18
  251. package/package.json +11 -86
  252. package/dist/nodes/Aws/S3/BucketDescription.js.map +0 -1
  253. package/dist/nodes/Aws/S3/FileDescription.js.map +0 -1
  254. package/dist/nodes/Aws/S3/FolderDescription.js.map +0 -1
  255. package/dist/nodes/Aws/S3/GenericFunctions.js.map +0 -1
  256. /package/dist/nodes/Aws/S3/{BucketDescription.d.ts → V1/BucketDescription.d.ts} +0 -0
  257. /package/dist/nodes/Aws/S3/{BucketDescription.js → V1/BucketDescription.js} +0 -0
  258. /package/dist/nodes/Aws/S3/{FileDescription.d.ts → V1/FileDescription.d.ts} +0 -0
  259. /package/dist/nodes/Aws/S3/{FileDescription.js → V1/FileDescription.js} +0 -0
  260. /package/dist/nodes/Aws/S3/{FolderDescription.d.ts → V1/FolderDescription.d.ts} +0 -0
  261. /package/dist/nodes/Aws/S3/{FolderDescription.js → V1/FolderDescription.js} +0 -0
  262. /package/dist/nodes/Aws/S3/{GenericFunctions.d.ts → V1/GenericFunctions.d.ts} +0 -0
  263. /package/dist/nodes/Aws/S3/test/{AwsS3.file.upload.workflow.json → V1/AwsS3.file.upload.V1.workflow.json} +0 -0
@@ -0,0 +1,628 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AwsS3V2 = void 0;
4
+ const change_case_1 = require("change-case");
5
+ const crypto_1 = require("crypto");
6
+ const xml2js_1 = require("xml2js");
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const BucketDescription_1 = require("./BucketDescription");
9
+ const FolderDescription_1 = require("./FolderDescription");
10
+ const FileDescription_1 = require("./FileDescription");
11
+ const GenericFunctions_1 = require("./GenericFunctions");
12
+ const UPLOAD_CHUNK_SIZE = 5120 * 1024;
13
+ class AwsS3V2 {
14
+ constructor(baseDescription) {
15
+ this.description = {
16
+ ...baseDescription,
17
+ displayName: 'AWS S3',
18
+ name: 'awsS3',
19
+ icon: 'file:s3.svg',
20
+ group: ['output'],
21
+ version: 2,
22
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
23
+ description: 'Sends data to AWS S3',
24
+ defaults: {
25
+ name: 'AWS S3',
26
+ },
27
+ inputs: ['main'],
28
+ outputs: ['main'],
29
+ credentials: [
30
+ {
31
+ name: 'aws',
32
+ required: true,
33
+ },
34
+ ],
35
+ properties: [
36
+ {
37
+ displayName: 'Resource',
38
+ name: 'resource',
39
+ type: 'options',
40
+ noDataExpression: true,
41
+ options: [
42
+ {
43
+ name: 'Bucket',
44
+ value: 'bucket',
45
+ },
46
+ {
47
+ name: 'File',
48
+ value: 'file',
49
+ },
50
+ {
51
+ name: 'Folder',
52
+ value: 'folder',
53
+ },
54
+ ],
55
+ default: 'file',
56
+ },
57
+ ...BucketDescription_1.bucketOperations,
58
+ ...BucketDescription_1.bucketFields,
59
+ ...FolderDescription_1.folderOperations,
60
+ ...FolderDescription_1.folderFields,
61
+ ...FileDescription_1.fileOperations,
62
+ ...FileDescription_1.fileFields,
63
+ ],
64
+ };
65
+ }
66
+ async execute() {
67
+ var _a;
68
+ const items = this.getInputData();
69
+ const returnData = [];
70
+ const qs = {};
71
+ let responseData;
72
+ const resource = this.getNodeParameter('resource', 0);
73
+ const operation = this.getNodeParameter('operation', 0);
74
+ for (let i = 0; i < items.length; i++) {
75
+ let headers = {};
76
+ try {
77
+ if (resource === 'bucket') {
78
+ if (operation === 'create') {
79
+ const credentials = await this.getCredentials('aws');
80
+ const name = this.getNodeParameter('name', i);
81
+ const additionalFields = this.getNodeParameter('additionalFields', i);
82
+ if (additionalFields.acl) {
83
+ headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
84
+ }
85
+ if (additionalFields.bucketObjectLockEnabled) {
86
+ headers['x-amz-bucket-object-lock-enabled'] =
87
+ additionalFields.bucketObjectLockEnabled;
88
+ }
89
+ if (additionalFields.grantFullControl) {
90
+ headers['x-amz-grant-full-control'] = '';
91
+ }
92
+ if (additionalFields.grantRead) {
93
+ headers['x-amz-grant-read'] = '';
94
+ }
95
+ if (additionalFields.grantReadAcp) {
96
+ headers['x-amz-grant-read-acp'] = '';
97
+ }
98
+ if (additionalFields.grantWrite) {
99
+ headers['x-amz-grant-write'] = '';
100
+ }
101
+ if (additionalFields.grantWriteAcp) {
102
+ headers['x-amz-grant-write-acp'] = '';
103
+ }
104
+ let region = credentials.region;
105
+ if (additionalFields.region) {
106
+ region = additionalFields.region;
107
+ }
108
+ const body = {
109
+ CreateBucketConfiguration: {
110
+ $: {
111
+ xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
112
+ },
113
+ },
114
+ };
115
+ let data = '';
116
+ if (region !== 'us-east-1') {
117
+ body.CreateBucketConfiguration.LocationConstraint = [region];
118
+ const builder = new xml2js_1.Builder();
119
+ data = builder.buildObject(body);
120
+ }
121
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${name}.s3`, 'PUT', '', data, qs, headers);
122
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
123
+ returnData.push(...executionData);
124
+ }
125
+ if (operation === 'delete') {
126
+ const name = this.getNodeParameter('name', i);
127
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${name}.s3`, 'DELETE', '', '', {}, headers);
128
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
129
+ returnData.push(...executionData);
130
+ }
131
+ if (operation === 'getAll') {
132
+ const returnAll = this.getNodeParameter('returnAll', 0);
133
+ if (returnAll) {
134
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', 's3', 'GET', '');
135
+ }
136
+ else {
137
+ qs.limit = this.getNodeParameter('limit', 0);
138
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', 's3', 'GET', '', '', qs);
139
+ responseData = responseData.slice(0, qs.limit);
140
+ }
141
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
142
+ returnData.push(...executionData);
143
+ }
144
+ if (operation === 'search') {
145
+ const bucketName = this.getNodeParameter('bucketName', i);
146
+ const returnAll = this.getNodeParameter('returnAll', 0);
147
+ const additionalFields = this.getNodeParameter('additionalFields', 0);
148
+ if (additionalFields.prefix) {
149
+ qs.prefix = additionalFields.prefix;
150
+ }
151
+ if (additionalFields.encodingType) {
152
+ qs['encoding-type'] = additionalFields.encodingType;
153
+ }
154
+ if (additionalFields.delimiter) {
155
+ qs.delimiter = additionalFields.delimiter;
156
+ }
157
+ if (additionalFields.fetchOwner) {
158
+ qs['fetch-owner'] = additionalFields.fetchOwner;
159
+ }
160
+ if (additionalFields.startAfter) {
161
+ qs['start-after'] = additionalFields.startAfter;
162
+ }
163
+ if (additionalFields.requesterPays) {
164
+ qs['x-amz-request-payer'] = 'requester';
165
+ }
166
+ qs['list-type'] = 2;
167
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
168
+ location: '',
169
+ });
170
+ const region = responseData.LocationConstraint._;
171
+ if (returnAll) {
172
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
173
+ }
174
+ else {
175
+ qs['max-keys'] = this.getNodeParameter('limit', 0);
176
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
177
+ responseData = responseData.ListBucketResult.Contents;
178
+ }
179
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
180
+ returnData.push(...executionData);
181
+ }
182
+ }
183
+ if (resource === 'folder') {
184
+ if (operation === 'create') {
185
+ const bucketName = this.getNodeParameter('bucketName', i);
186
+ const folderName = this.getNodeParameter('folderName', i);
187
+ const additionalFields = this.getNodeParameter('additionalFields', i);
188
+ let path = `/${folderName}/`;
189
+ if (additionalFields.requesterPays) {
190
+ headers['x-amz-request-payer'] = 'requester';
191
+ }
192
+ if (additionalFields.parentFolderKey) {
193
+ path = `/${additionalFields.parentFolderKey}${folderName}/`;
194
+ }
195
+ if (additionalFields.storageClass) {
196
+ headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
197
+ }
198
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
199
+ location: '',
200
+ });
201
+ const region = responseData.LocationConstraint._;
202
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'PUT', path, '', qs, headers, {}, region);
203
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
204
+ returnData.push(...executionData);
205
+ }
206
+ if (operation === 'delete') {
207
+ const bucketName = this.getNodeParameter('bucketName', i);
208
+ const folderKey = this.getNodeParameter('folderKey', i);
209
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
210
+ location: '',
211
+ });
212
+ const region = responseData.LocationConstraint._;
213
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '/', '', { 'list-type': 2, prefix: folderKey }, {}, {}, region);
214
+ if (responseData.length === 0) {
215
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region);
216
+ responseData = { deleted: [{ Key: folderKey }] };
217
+ }
218
+ else {
219
+ const body = {
220
+ Delete: {
221
+ $: {
222
+ xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
223
+ },
224
+ Object: [],
225
+ },
226
+ };
227
+ for (const childObject of responseData) {
228
+ body.Delete.Object.push({
229
+ Key: childObject.Key,
230
+ });
231
+ }
232
+ const builder = new xml2js_1.Builder();
233
+ const data = builder.buildObject(body);
234
+ headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(data).digest('base64');
235
+ headers['Content-Type'] = 'application/xml';
236
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'POST', '/', data, { delete: '' }, headers, {}, region);
237
+ responseData = { deleted: responseData.DeleteResult.Deleted };
238
+ }
239
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
240
+ returnData.push(...executionData);
241
+ }
242
+ if (operation === 'getAll') {
243
+ const bucketName = this.getNodeParameter('bucketName', i);
244
+ const returnAll = this.getNodeParameter('returnAll', 0);
245
+ const options = this.getNodeParameter('options', 0);
246
+ if (options.folderKey) {
247
+ qs.prefix = options.folderKey;
248
+ }
249
+ if (options.fetchOwner) {
250
+ qs['fetch-owner'] = options.fetchOwner;
251
+ }
252
+ qs['list-type'] = 2;
253
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
254
+ location: '',
255
+ });
256
+ const region = responseData.LocationConstraint._;
257
+ if (returnAll) {
258
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
259
+ }
260
+ else {
261
+ qs.limit = this.getNodeParameter('limit', 0);
262
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
263
+ }
264
+ if (Array.isArray(responseData)) {
265
+ responseData = responseData.filter((e) => e.Key.endsWith('/') && e.Size === '0' && e.Key !== options.folderKey);
266
+ if (qs.limit) {
267
+ responseData = responseData.splice(0, qs.limit);
268
+ }
269
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
270
+ returnData.push(...executionData);
271
+ }
272
+ }
273
+ }
274
+ if (resource === 'file') {
275
+ if (operation === 'copy') {
276
+ const sourcePath = this.getNodeParameter('sourcePath', i);
277
+ const destinationPath = this.getNodeParameter('destinationPath', i);
278
+ const additionalFields = this.getNodeParameter('additionalFields', i);
279
+ headers['x-amz-copy-source'] = sourcePath;
280
+ if (additionalFields.requesterPays) {
281
+ headers['x-amz-request-payer'] = 'requester';
282
+ }
283
+ if (additionalFields.storageClass) {
284
+ headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
285
+ }
286
+ if (additionalFields.acl) {
287
+ headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
288
+ }
289
+ if (additionalFields.grantFullControl) {
290
+ headers['x-amz-grant-full-control'] = '';
291
+ }
292
+ if (additionalFields.grantRead) {
293
+ headers['x-amz-grant-read'] = '';
294
+ }
295
+ if (additionalFields.grantReadAcp) {
296
+ headers['x-amz-grant-read-acp'] = '';
297
+ }
298
+ if (additionalFields.grantWriteAcp) {
299
+ headers['x-amz-grant-write-acp'] = '';
300
+ }
301
+ if (additionalFields.lockLegalHold) {
302
+ headers['x-amz-object-lock-legal-hold'] = additionalFields.lockLegalHold
303
+ ? 'ON'
304
+ : 'OFF';
305
+ }
306
+ if (additionalFields.lockMode) {
307
+ headers['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
308
+ }
309
+ if (additionalFields.lockRetainUntilDate) {
310
+ headers['x-amz-object-lock-retain-until-date'] =
311
+ additionalFields.lockRetainUntilDate;
312
+ }
313
+ if (additionalFields.serverSideEncryption) {
314
+ headers['x-amz-server-side-encryption'] =
315
+ additionalFields.serverSideEncryption;
316
+ }
317
+ if (additionalFields.encryptionAwsKmsKeyId) {
318
+ headers['x-amz-server-side-encryption-aws-kms-key-id'] =
319
+ additionalFields.encryptionAwsKmsKeyId;
320
+ }
321
+ if (additionalFields.serverSideEncryptionContext) {
322
+ headers['x-amz-server-side-encryption-context'] =
323
+ additionalFields.serverSideEncryptionContext;
324
+ }
325
+ if (additionalFields.serversideEncryptionCustomerAlgorithm) {
326
+ headers['x-amz-server-side-encryption-customer-algorithm'] =
327
+ additionalFields.serversideEncryptionCustomerAlgorithm;
328
+ }
329
+ if (additionalFields.serversideEncryptionCustomerKey) {
330
+ headers['x-amz-server-side-encryption-customer-key'] =
331
+ additionalFields.serversideEncryptionCustomerKey;
332
+ }
333
+ if (additionalFields.serversideEncryptionCustomerKeyMD5) {
334
+ headers['x-amz-server-side-encryption-customer-key-MD5'] =
335
+ additionalFields.serversideEncryptionCustomerKeyMD5;
336
+ }
337
+ if (additionalFields.taggingDirective) {
338
+ headers['x-amz-tagging-directive'] = additionalFields.taggingDirective.toUpperCase();
339
+ }
340
+ if (additionalFields.metadataDirective) {
341
+ headers['x-amz-metadata-directive'] = additionalFields.metadataDirective.toUpperCase();
342
+ }
343
+ const destinationParts = destinationPath.split('/');
344
+ const bucketName = destinationParts[1];
345
+ const destination = `/${destinationParts.slice(2, destinationParts.length).join('/')}`;
346
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
347
+ location: '',
348
+ });
349
+ const region = responseData.LocationConstraint._;
350
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'PUT', destination, '', qs, headers, {}, region);
351
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.CopyObjectResult), { itemData: { item: i } });
352
+ returnData.push(...executionData);
353
+ }
354
+ if (operation === 'download') {
355
+ const bucketName = this.getNodeParameter('bucketName', i);
356
+ const fileKey = this.getNodeParameter('fileKey', i);
357
+ const fileName = fileKey.split('/')[fileKey.split('/').length - 1];
358
+ if (fileKey.substring(fileKey.length - 1) === '/') {
359
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Downloading a whole directory is not yet supported, please provide a file key');
360
+ }
361
+ let region = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
362
+ location: '',
363
+ });
364
+ region = region.LocationConstraint._;
365
+ const response = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', `/${fileKey}`, '', qs, {}, { encoding: null, resolveWithFullResponse: true }, region);
366
+ let mimeType;
367
+ if (response.headers['content-type']) {
368
+ mimeType = response.headers['content-type'];
369
+ }
370
+ const newItem = {
371
+ json: items[i].json,
372
+ binary: {},
373
+ };
374
+ if (items[i].binary !== undefined && newItem.binary) {
375
+ Object.assign(newItem.binary, items[i].binary);
376
+ }
377
+ items[i] = newItem;
378
+ const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
379
+ const data = Buffer.from(response.body, 'utf8');
380
+ items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, fileName, mimeType);
381
+ }
382
+ if (operation === 'delete') {
383
+ const bucketName = this.getNodeParameter('bucketName', i);
384
+ const fileKey = this.getNodeParameter('fileKey', i);
385
+ const options = this.getNodeParameter('options', i);
386
+ if (options.versionId) {
387
+ qs.versionId = options.versionId;
388
+ }
389
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
390
+ location: '',
391
+ });
392
+ const region = responseData.LocationConstraint._;
393
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'DELETE', `/${fileKey}`, '', qs, {}, {}, region);
394
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
395
+ returnData.push(...executionData);
396
+ }
397
+ if (operation === 'getAll') {
398
+ const bucketName = this.getNodeParameter('bucketName', i);
399
+ const returnAll = this.getNodeParameter('returnAll', 0);
400
+ const options = this.getNodeParameter('options', 0);
401
+ if (options.folderKey) {
402
+ qs.prefix = options.folderKey;
403
+ }
404
+ if (options.fetchOwner) {
405
+ qs['fetch-owner'] = options.fetchOwner;
406
+ }
407
+ qs.delimiter = '/';
408
+ qs['list-type'] = 2;
409
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
410
+ location: '',
411
+ });
412
+ const region = responseData.LocationConstraint._;
413
+ if (returnAll) {
414
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
415
+ }
416
+ else {
417
+ qs.limit = this.getNodeParameter('limit', 0);
418
+ responseData = await GenericFunctions_1.awsApiRequestRESTAllItems.call(this, 'ListBucketResult.Contents', `${bucketName}.s3`, 'GET', '', '', qs, {}, {}, region);
419
+ responseData = responseData.splice(0, qs.limit);
420
+ }
421
+ if (Array.isArray(responseData)) {
422
+ responseData = responseData.filter((e) => !e.Key.endsWith('/') && e.Size !== '0');
423
+ if (qs.limit) {
424
+ responseData = responseData.splice(0, qs.limit);
425
+ }
426
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
427
+ returnData.push(...executionData);
428
+ }
429
+ }
430
+ if (operation === 'upload') {
431
+ const bucketName = this.getNodeParameter('bucketName', i);
432
+ const fileName = this.getNodeParameter('fileName', i);
433
+ const isBinaryData = this.getNodeParameter('binaryData', i);
434
+ const additionalFields = this.getNodeParameter('additionalFields', i);
435
+ const tagsValues = this.getNodeParameter('tagsUi', i)
436
+ .tagsValues;
437
+ let path = '';
438
+ let body;
439
+ const multipartHeaders = {};
440
+ const neededHeaders = {};
441
+ if (additionalFields.requesterPays) {
442
+ neededHeaders['x-amz-request-payer'] = 'requester';
443
+ }
444
+ if (additionalFields.parentFolderKey) {
445
+ path = `${additionalFields.parentFolderKey}/${fileName}`;
446
+ }
447
+ else {
448
+ path = `${fileName}`;
449
+ }
450
+ if (additionalFields.storageClass) {
451
+ multipartHeaders['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
452
+ }
453
+ if (additionalFields.acl) {
454
+ multipartHeaders['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
455
+ }
456
+ if (additionalFields.grantFullControl) {
457
+ multipartHeaders['x-amz-grant-full-control'] = '';
458
+ }
459
+ if (additionalFields.grantRead) {
460
+ multipartHeaders['x-amz-grant-read'] = '';
461
+ }
462
+ if (additionalFields.grantReadAcp) {
463
+ multipartHeaders['x-amz-grant-read-acp'] = '';
464
+ }
465
+ if (additionalFields.grantWriteAcp) {
466
+ multipartHeaders['x-amz-grant-write-acp'] = '';
467
+ }
468
+ if (additionalFields.lockLegalHold) {
469
+ multipartHeaders['x-amz-object-lock-legal-hold'] =
470
+ additionalFields.lockLegalHold ? 'ON' : 'OFF';
471
+ }
472
+ if (additionalFields.lockMode) {
473
+ multipartHeaders['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
474
+ }
475
+ if (additionalFields.lockRetainUntilDate) {
476
+ multipartHeaders['x-amz-object-lock-retain-until-date'] =
477
+ additionalFields.lockRetainUntilDate;
478
+ }
479
+ if (additionalFields.serverSideEncryption) {
480
+ neededHeaders['x-amz-server-side-encryption'] =
481
+ additionalFields.serverSideEncryption;
482
+ }
483
+ if (additionalFields.encryptionAwsKmsKeyId) {
484
+ neededHeaders['x-amz-server-side-encryption-aws-kms-key-id'] =
485
+ additionalFields.encryptionAwsKmsKeyId;
486
+ }
487
+ if (additionalFields.serverSideEncryptionContext) {
488
+ neededHeaders['x-amz-server-side-encryption-context'] =
489
+ additionalFields.serverSideEncryptionContext;
490
+ }
491
+ if (additionalFields.serversideEncryptionCustomerAlgorithm) {
492
+ neededHeaders['x-amz-server-side-encryption-customer-algorithm'] =
493
+ additionalFields.serversideEncryptionCustomerAlgorithm;
494
+ }
495
+ if (additionalFields.serversideEncryptionCustomerKey) {
496
+ neededHeaders['x-amz-server-side-encryption-customer-key'] =
497
+ additionalFields.serversideEncryptionCustomerKey;
498
+ }
499
+ if (additionalFields.serversideEncryptionCustomerKeyMD5) {
500
+ neededHeaders['x-amz-server-side-encryption-customer-key-MD5'] =
501
+ additionalFields.serversideEncryptionCustomerKeyMD5;
502
+ }
503
+ if (tagsValues) {
504
+ const tags = [];
505
+ tagsValues.forEach((o) => {
506
+ tags.push(`${o.key}=${o.value}`);
507
+ });
508
+ multipartHeaders['x-amz-tagging'] = tags.join('&');
509
+ }
510
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', '', '', {
511
+ location: '',
512
+ });
513
+ const region = responseData.LocationConstraint._;
514
+ if (isBinaryData) {
515
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
516
+ const binaryPropertyData = this.helpers.assertBinaryData(i, binaryPropertyName);
517
+ let uploadData;
518
+ multipartHeaders['Content-Type'] = binaryPropertyData.mimeType;
519
+ if (binaryPropertyData.id) {
520
+ uploadData = this.helpers.getBinaryStream(binaryPropertyData.id, UPLOAD_CHUNK_SIZE);
521
+ const createMultiPartUpload = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'POST', `/${path}?uploads`, body, qs, { ...neededHeaders, ...multipartHeaders }, {}, region);
522
+ const uploadId = createMultiPartUpload.InitiateMultipartUploadResult.UploadId;
523
+ let part = 1;
524
+ for await (const chunk of uploadData) {
525
+ const chunkBuffer = await this.helpers.binaryToBuffer(chunk);
526
+ const listHeaders = {
527
+ 'Content-Length': chunk.length,
528
+ 'Content-MD5': (0, crypto_1.createHash)('MD5').update(chunkBuffer).digest('base64'),
529
+ ...neededHeaders,
530
+ };
531
+ try {
532
+ await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'PUT', `/${path}?partNumber=${part}&uploadId=${uploadId}`, chunk, qs, listHeaders, {}, region);
533
+ part++;
534
+ }
535
+ catch (error) {
536
+ try {
537
+ await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'DELETE', `/${path}?uploadId=${uploadId}`);
538
+ }
539
+ catch (err) {
540
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), err);
541
+ }
542
+ if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== 308)
543
+ throw error;
544
+ }
545
+ }
546
+ const listParts = (await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'GET', `/${path}?max-parts=${900}&part-number-marker=0&uploadId=${uploadId}`, '', qs, { ...neededHeaders }, {}, region));
547
+ if (!Array.isArray(listParts.ListPartsResult.Part)) {
548
+ body = {
549
+ CompleteMultipartUpload: {
550
+ $: {
551
+ xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
552
+ },
553
+ Part: {
554
+ ETag: listParts.ListPartsResult.Part.ETag,
555
+ PartNumber: listParts.ListPartsResult.Part.PartNumber,
556
+ },
557
+ },
558
+ };
559
+ }
560
+ else {
561
+ body = {
562
+ CompleteMultipartUpload: {
563
+ $: {
564
+ xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
565
+ },
566
+ Part: listParts.ListPartsResult.Part.map((Part) => {
567
+ return {
568
+ ETag: Part.ETag,
569
+ PartNumber: Part.PartNumber,
570
+ };
571
+ }),
572
+ },
573
+ };
574
+ }
575
+ const builder = new xml2js_1.Builder();
576
+ const data = builder.buildObject(body);
577
+ const completeUpload = (await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'POST', `/${path}?uploadId=${uploadId}`, data, qs, {
578
+ ...neededHeaders,
579
+ 'Content-MD5': (0, crypto_1.createHash)('md5').update(data).digest('base64'),
580
+ 'Content-Type': 'application/xml',
581
+ }, {}, region));
582
+ responseData = {
583
+ ...completeUpload.CompleteMultipartUploadResult,
584
+ };
585
+ }
586
+ else {
587
+ const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
588
+ body = binaryDataBuffer;
589
+ headers = { ...neededHeaders, ...multipartHeaders };
590
+ headers['Content-Type'] = binaryPropertyData.mimeType;
591
+ headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(body).digest('base64');
592
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'PUT', `/${path || binaryPropertyData.fileName}`, body, qs, headers, {}, region);
593
+ }
594
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
595
+ returnData.push(...executionData);
596
+ }
597
+ else {
598
+ const fileContent = this.getNodeParameter('fileContent', i);
599
+ body = Buffer.from(fileContent, 'utf8');
600
+ headers = { ...neededHeaders, ...multipartHeaders };
601
+ headers['Content-Type'] = 'text/html';
602
+ headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(fileContent).digest('base64');
603
+ responseData = await GenericFunctions_1.awsApiRequestREST.call(this, `${bucketName}.s3`, 'PUT', `/${path}`, body, qs, { ...headers }, {}, region);
604
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
605
+ returnData.push(...executionData);
606
+ }
607
+ }
608
+ }
609
+ }
610
+ catch (error) {
611
+ if (this.continueOnFail()) {
612
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
613
+ returnData.push(...executionData);
614
+ continue;
615
+ }
616
+ throw error;
617
+ }
618
+ }
619
+ if (resource === 'file' && operation === 'download') {
620
+ return this.prepareOutputData(items);
621
+ }
622
+ else {
623
+ return this.prepareOutputData(returnData);
624
+ }
625
+ }
626
+ }
627
+ exports.AwsS3V2 = AwsS3V2;
628
+ //# sourceMappingURL=AwsS3V2.node.js.map