n8n-nodes-cakemail 1.1.0 → 1.1.2

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.
@@ -1039,12 +1039,27 @@ class Cakemail {
1039
1039
  displayOptions: {
1040
1040
  show: {
1041
1041
  resource: ['campaign'],
1042
- operation: ['get', 'update', 'delete', 'schedule', 'unschedule', 'reschedule', 'sendTest', 'archive', 'unarchive', 'suspend', 'resume', 'cancel', 'getLinks', 'render', 'getRevisions'],
1042
+ operation: ['get', 'delete', 'schedule', 'unschedule', 'reschedule', 'sendTest', 'archive', 'unarchive', 'suspend', 'resume', 'cancel', 'getLinks', 'render', 'getRevisions'],
1043
1043
  },
1044
1044
  },
1045
1045
  default: 0,
1046
1046
  description: 'The ID of the campaign',
1047
1047
  },
1048
+ {
1049
+ displayName: 'Campaign',
1050
+ name: 'campaignIdForUpdate',
1051
+ type: 'string',
1052
+ required: true,
1053
+ displayOptions: {
1054
+ show: {
1055
+ resource: ['campaign'],
1056
+ operation: ['update'],
1057
+ },
1058
+ },
1059
+ default: '',
1060
+ description: 'Enter campaign ID or use expression to get from previous node',
1061
+ placeholder: 'e.g., 12345 or {{ $json.id }}',
1062
+ },
1048
1063
  {
1049
1064
  displayName: 'Campaign Name',
1050
1065
  name: 'campaignName',
@@ -1086,6 +1101,19 @@ class Cakemail {
1086
1101
  default: 0,
1087
1102
  description: 'ID of the list to send the campaign to',
1088
1103
  },
1104
+ {
1105
+ displayName: 'List ID',
1106
+ name: 'listId',
1107
+ type: 'number',
1108
+ displayOptions: {
1109
+ show: {
1110
+ resource: ['campaign'],
1111
+ operation: ['update'],
1112
+ },
1113
+ },
1114
+ default: 0,
1115
+ description: 'New list ID (leave as 0 to keep current)',
1116
+ },
1089
1117
  {
1090
1118
  displayName: 'Sender Name',
1091
1119
  name: 'senderName',
@@ -1686,14 +1714,21 @@ class Cakemail {
1686
1714
  }, options);
1687
1715
  }
1688
1716
  else if (operation === 'update') {
1689
- const campaignId = this.getNodeParameter('campaignId', itemIndex);
1717
+ const campaignIdStr = this.getNodeParameter('campaignIdForUpdate', itemIndex);
1718
+ const campaignId = parseInt(campaignIdStr, 10);
1719
+ if (isNaN(campaignId)) {
1720
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid campaign ID: "${campaignIdStr}". Please provide a valid number.`, { itemIndex });
1721
+ }
1690
1722
  const updateData = {};
1691
1723
  const name = this.getNodeParameter('campaignName', itemIndex, '');
1724
+ const listId = this.getNodeParameter('listId', itemIndex, 0);
1692
1725
  const subject = this.getNodeParameter('subject', itemIndex, '');
1693
1726
  const htmlContent = this.getNodeParameter('htmlContent', itemIndex, '');
1694
1727
  const textContent = this.getNodeParameter('textContent', itemIndex, '');
1695
1728
  if (name)
1696
1729
  updateData.name = name;
1730
+ if (listId > 0)
1731
+ updateData.list_ids = [listId];
1697
1732
  if (subject)
1698
1733
  updateData.subject = subject;
1699
1734
  if (htmlContent || textContent) {
@@ -1108,13 +1108,30 @@ export class Cakemail implements INodeType {
1108
1108
  displayOptions: {
1109
1109
  show: {
1110
1110
  resource: ['campaign'],
1111
- operation: ['get', 'update', 'delete', 'schedule', 'unschedule', 'reschedule', 'sendTest', 'archive', 'unarchive', 'suspend', 'resume', 'cancel', 'getLinks', 'render', 'getRevisions'],
1111
+ operation: ['get', 'delete', 'schedule', 'unschedule', 'reschedule', 'sendTest', 'archive', 'unarchive', 'suspend', 'resume', 'cancel', 'getLinks', 'render', 'getRevisions'],
1112
1112
  },
1113
1113
  },
1114
1114
  default: 0,
1115
1115
  description: 'The ID of the campaign',
1116
1116
  },
1117
1117
 
1118
+ // Campaign selection for update (with load button)
1119
+ {
1120
+ displayName: 'Campaign',
1121
+ name: 'campaignIdForUpdate',
1122
+ type: 'string',
1123
+ required: true,
1124
+ displayOptions: {
1125
+ show: {
1126
+ resource: ['campaign'],
1127
+ operation: ['update'],
1128
+ },
1129
+ },
1130
+ default: '',
1131
+ description: 'Enter campaign ID or use expression to get from previous node',
1132
+ placeholder: 'e.g., 12345 or {{ $json.id }}',
1133
+ },
1134
+
1118
1135
  // Campaign Name (for create, update)
1119
1136
  {
1120
1137
  displayName: 'Campaign Name',
@@ -1144,7 +1161,7 @@ export class Cakemail implements INodeType {
1144
1161
  description: 'New name for the campaign (leave empty to keep current)',
1145
1162
  },
1146
1163
 
1147
- // List ID (for create)
1164
+ // List ID (for create, update)
1148
1165
  {
1149
1166
  displayName: 'List ID',
1150
1167
  name: 'listId',
@@ -1159,6 +1176,19 @@ export class Cakemail implements INodeType {
1159
1176
  default: 0,
1160
1177
  description: 'ID of the list to send the campaign to',
1161
1178
  },
1179
+ {
1180
+ displayName: 'List ID',
1181
+ name: 'listId',
1182
+ type: 'number',
1183
+ displayOptions: {
1184
+ show: {
1185
+ resource: ['campaign'],
1186
+ operation: ['update'],
1187
+ },
1188
+ },
1189
+ default: 0,
1190
+ description: 'New list ID (leave as 0 to keep current)',
1191
+ },
1162
1192
 
1163
1193
  // Sender information (for create)
1164
1194
  {
@@ -2031,15 +2061,27 @@ export class Cakemail implements INodeType {
2031
2061
  },
2032
2062
  }, options);
2033
2063
  } else if (operation === 'update') {
2034
- const campaignId = this.getNodeParameter('campaignId', itemIndex) as number;
2064
+ const campaignIdStr = this.getNodeParameter('campaignIdForUpdate', itemIndex) as string;
2065
+ const campaignId = parseInt(campaignIdStr, 10);
2066
+
2067
+ if (isNaN(campaignId)) {
2068
+ throw new NodeOperationError(
2069
+ this.getNode(),
2070
+ `Invalid campaign ID: "${campaignIdStr}". Please provide a valid number.`,
2071
+ { itemIndex }
2072
+ );
2073
+ }
2074
+
2035
2075
  const updateData: any = {};
2036
2076
 
2037
2077
  const name = this.getNodeParameter('campaignName', itemIndex, '') as string;
2078
+ const listId = this.getNodeParameter('listId', itemIndex, 0) as number;
2038
2079
  const subject = this.getNodeParameter('subject', itemIndex, '') as string;
2039
2080
  const htmlContent = this.getNodeParameter('htmlContent', itemIndex, '') as string;
2040
2081
  const textContent = this.getNodeParameter('textContent', itemIndex, '') as string;
2041
2082
 
2042
2083
  if (name) updateData.name = name;
2084
+ if (listId > 0) updateData.list_ids = [listId];
2043
2085
  if (subject) updateData.subject = subject;
2044
2086
  if (htmlContent || textContent) {
2045
2087
  updateData.content = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-cakemail",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "n8n node for Cakemail - workflow-native email platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",