n8n-nodes-resend 3.1.1 → 3.2.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.
@@ -19,7 +19,7 @@ const description = [require_nodes_Resend_actions_inboxThread_shared.createInbox
19
19
  operation: ["create"]
20
20
  } },
21
21
  options: [
22
- require_nodes_Resend_actions_inboxThread_shared.draftAttachmentsField("Files to store on the draft, from binary data. Each one needs a file name and a content type. The files of a draft can total at most 25 MB. An empty file or a blocked file type returns an error."),
22
+ require_nodes_Resend_actions_inboxThread_shared.draftAttachmentsField("Files to store on the draft, from binary data or a URL. Each one needs a file name. Binary data also needs a content type. A URL file is downloaded when the request is made. The files of a draft, downloaded ones included, can total at most 25 MB. An empty file, a blocked file type, or a URL that is not http or https or cannot be downloaded returns an error, and so do downloads that take more than 20 seconds together."),
23
23
  require_nodes_Resend_actions_inboxThread_shared.bccField,
24
24
  require_nodes_Resend_actions_inboxThread_shared.ccField,
25
25
  require_nodes_Resend_actions_inboxThread_shared.htmlField,
@@ -22,7 +22,7 @@ const description = [
22
22
  operation: ["update"]
23
23
  } },
24
24
  options: [
25
- require_nodes_Resend_actions_inboxThread_shared.draftAttachmentsField("Files to store on the draft, from binary data. They replace every attachment on the draft. Each one needs a file name and a content type. The files of a draft can total at most 25 MB. An empty file or a blocked file type returns an error."),
25
+ require_nodes_Resend_actions_inboxThread_shared.draftAttachmentsField("Files to store on the draft, from binary data or a URL. They replace every attachment on the draft. Each one needs a file name. Binary data also needs a content type. A URL file is downloaded when the request is made. The files of a draft, downloaded ones included, can total at most 25 MB. An empty file, a blocked file type, or a URL that is not http or https or cannot be downloaded returns an error, and so do downloads that take more than 20 seconds together."),
26
26
  require_nodes_Resend_actions_inboxThread_shared.bccField,
27
27
  require_nodes_Resend_actions_inboxThread_shared.ccField,
28
28
  {
@@ -335,13 +335,29 @@ const draftAttachmentsField = (description) => ({
335
335
  name: "attachments",
336
336
  displayName: "Attachment",
337
337
  values: [
338
+ {
339
+ displayName: "Attachment Type",
340
+ name: "attachmentType",
341
+ type: "options",
342
+ default: "binaryData",
343
+ options: [{
344
+ name: "Binary Data",
345
+ value: "binaryData",
346
+ description: "Use binary file data from a previous node in the workflow"
347
+ }, {
348
+ name: "Remote URL",
349
+ value: "url",
350
+ description: "Resend downloads the file from a public URL when the draft is saved, not when it is sent"
351
+ }]
352
+ },
338
353
  {
339
354
  displayName: "Binary Property",
340
355
  name: "binaryPropertyName",
341
356
  type: "string",
342
357
  default: "data",
343
358
  placeholder: "data",
344
- description: "The name of the binary property that holds the file data"
359
+ description: "The name of the binary property that holds the file data",
360
+ displayOptions: { show: { attachmentType: ["binaryData"] } }
345
361
  },
346
362
  {
347
363
  displayName: "Content Type",
@@ -349,7 +365,7 @@ const draftAttachmentsField = (description) => ({
349
365
  type: "string",
350
366
  default: "",
351
367
  placeholder: "application/pdf",
352
- description: "The MIME type of the file. Defaults to the MIME type of the binary data."
368
+ description: "The MIME type of the file. Defaults to the MIME type of the binary data, or of the downloaded file for a URL."
353
369
  },
354
370
  {
355
371
  displayName: "File Name",
@@ -357,7 +373,16 @@ const draftAttachmentsField = (description) => ({
357
373
  type: "string",
358
374
  default: "",
359
375
  placeholder: "document.pdf",
360
- description: "The name of the attached file. Defaults to the binary file name."
376
+ description: "The name of the attached file. Defaults to the binary file name. Required for a URL."
377
+ },
378
+ {
379
+ displayName: "File URL",
380
+ name: "fileUrl",
381
+ type: "string",
382
+ default: "",
383
+ placeholder: "https://example.com/file.pdf",
384
+ description: "The public http or https URL of the file. It is downloaded when the request is made.",
385
+ displayOptions: { show: { attachmentType: ["url"] } }
361
386
  }
362
387
  ]
363
388
  }]
@@ -368,6 +393,19 @@ async function buildDraftAttachments(context, value, index) {
368
393
  const attachments = [];
369
394
  for (const input of inputs) {
370
395
  var _context$getInputData2;
396
+ if (input.attachmentType === "url") {
397
+ var _input$fileUrl2;
398
+ const fileUrl = String((_input$fileUrl2 = input.fileUrl) !== null && _input$fileUrl2 !== void 0 ? _input$fileUrl2 : "").trim();
399
+ if (!fileUrl) throw new n8n_workflow.NodeOperationError(context.getNode(), "File URL is required for URL attachments", { itemIndex: index });
400
+ if (!input.filename) throw new n8n_workflow.NodeOperationError(context.getNode(), "Draft attachments from a URL need a File Name", { itemIndex: index });
401
+ const entry = {
402
+ path: fileUrl,
403
+ filename: input.filename
404
+ };
405
+ if (input.content_type) entry.content_type = input.content_type;
406
+ attachments.push(entry);
407
+ continue;
408
+ }
371
409
  const propertyName = input.binaryPropertyName || "data";
372
410
  const binary = (_context$getInputData2 = context.getInputData()[index]) === null || _context$getInputData2 === void 0 || (_context$getInputData2 = _context$getInputData2.binary) === null || _context$getInputData2 === void 0 ? void 0 : _context$getInputData2[propertyName];
373
411
  if (!binary) throw new n8n_workflow.NodeOperationError(context.getNode(), `Binary property "${propertyName}" not found in item ${index}`, { itemIndex: index });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-resend",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Resend integration for n8n: Email, Broadcasts, Templates, Domains, Contacts, Segments, Topics, Webhooks, Automations, Events, and more",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",