n8n-nodes-digit 0.1.18 → 0.1.19

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.
@@ -188,39 +188,54 @@ class DIGIT {
188
188
  }
189
189
  }
190
190
  // ==================================================
191
- // NOTIFICATION — SEND EMAIL
191
+ // NOTIFICATION — SEND EMAIL (FIXED)
192
192
  // ==================================================
193
193
  if (resource === 'notification') {
194
194
  const operation = this.getNodeParameter('notificationOperation', 0);
195
195
  if (operation === 'notification_send_email') {
196
196
  for (let i = 0; i < items.length; i++) {
197
- const tenantId = this.getNodeParameter('tenantId', i);
198
- const accessToken = this.getNodeParameter('accessToken', i);
199
- const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
200
- let body;
201
197
  try {
202
- body = JSON.parse(this.getNodeParameter('requestBody', i));
198
+ const tenantId = this.getNodeParameter('tenantId', i);
199
+ const accessToken = this.getNodeParameter('accessToken', i);
200
+ const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
201
+ let body;
202
+ try {
203
+ body = JSON.parse(this.getNodeParameter('requestBody', i));
204
+ }
205
+ catch {
206
+ throw new Error('Invalid JSON in Request Body');
207
+ }
208
+ const url = new URL('/notification/v1/email/send', baseUrl).toString();
209
+ const response = await this.helpers.httpRequest({
210
+ method: 'POST',
211
+ url,
212
+ headers: {
213
+ 'X-Tenant-ID': tenantId,
214
+ Authorization: `Bearer ${cleanToken}`,
215
+ 'Content-Type': 'application/json',
216
+ },
217
+ body,
218
+ json: true,
219
+ });
220
+ // ✅ Push only JSON-safe data
221
+ returnData.push({
222
+ json: response,
223
+ });
203
224
  }
204
- catch {
205
- throw new Error('Invalid JSON in Request Body');
225
+ catch (error) {
226
+ if (this.continueOnFail()) {
227
+ // ✅ Never push raw error object
228
+ returnData.push({
229
+ json: {
230
+ error: error.message,
231
+ statusCode: error.statusCode || null,
232
+ },
233
+ });
234
+ }
235
+ else {
236
+ throw error;
237
+ }
206
238
  }
207
- // Gateway compatible path
208
- const notificationPath = '/notification/v1/email/send';
209
- const apiResponse = await this.helpers.httpRequest({
210
- method: 'POST',
211
- url: new URL(notificationPath, baseUrl).toString(),
212
- headers: {
213
- 'X-Tenant-ID': tenantId,
214
- Authorization: `Bearer ${cleanToken}`,
215
- 'Content-Type': 'application/json',
216
- },
217
- body,
218
- json: true,
219
- });
220
- // Prevent circular reference crash
221
- returnData.push({
222
- json: JSON.parse(JSON.stringify(apiResponse)),
223
- });
224
239
  }
225
240
  return [returnData];
226
241
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-digit",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "DIGIT Platform nodes for n8n",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-digit",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "DIGIT Platform nodes for n8n",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",