@custom-js/n8n-nodes-pdf-toolkit 1.30.0 → 1.31.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.
@@ -4,9 +4,9 @@ exports.InvoiceGenerator = void 0;
4
4
  class InvoiceGenerator {
5
5
  constructor() {
6
6
  this.description = {
7
- displayName: 'Invoice Generator',
7
+ displayName: 'Invoice Generator (CustomJS)',
8
8
  name: 'invoiceGenerator',
9
- icon: 'file:invoice.svg',
9
+ icon: "file:customJs.svg",
10
10
  group: ['transform'],
11
11
  version: 1,
12
12
  description: 'Create PDF invoices from data and templates',
@@ -195,13 +195,20 @@ class InvoiceGenerator {
195
195
  encoding: 'binary',
196
196
  json: true,
197
197
  };
198
- const responseData = await this.helpers.request(options);
199
- const fileData = responseData.fileData;
200
- const binaryData = Buffer.from(fileData, 'base64');
201
- const binary = await this.helpers.prepareBinaryData(binaryData, 'Invoice.pdf', 'application/pdf');
198
+ const response = await this.helpers.request(options);
199
+ if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
200
+ // No binary data returned; emit only JSON without a binary property
201
+ returnData.push({
202
+ json: items[i].json,
203
+ });
204
+ continue;
205
+ }
206
+ const binaryData = await this.helpers.prepareBinaryData(response, "Invoice.pdf");
202
207
  returnData.push({
203
- json: {},
204
- binary: { data: binary },
208
+ json: items[i].json,
209
+ binary: {
210
+ data: binaryData,
211
+ },
205
212
  });
206
213
  }
207
214
  return [returnData];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@custom-js/n8n-nodes-pdf-toolkit",
3
- "version": "1.30.0",
3
+ "version": "1.31.0",
4
4
  "description": "This is official node for interacting with APIs from customjs.space",
5
5
  "keywords": [
6
6
  "customjs",