@custom-js/n8n-nodes-pdf-toolkit 1.35.0 → 1.37.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.
@@ -72,7 +72,7 @@ class CompressPDF {
72
72
  }
73
73
  const options = {
74
74
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
75
- method: "POST",
75
+ method: 'POST',
76
76
  headers: {
77
77
  "customjs-origin": "n8n/compressPdf",
78
78
  "x-api-key": credentials.apiKey,
@@ -85,10 +85,9 @@ class CompressPDF {
85
85
  return PDF_COMPRESS(input);`,
86
86
  returnBinary: "true",
87
87
  },
88
- encoding: null,
89
88
  json: true,
90
89
  };
91
- const response = await this.helpers.request(options);
90
+ const response = await this.helpers.httpRequest(options);
92
91
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
93
92
  // No binary data returned; emit only JSON without a binary property
94
93
  returnData.push({
@@ -80,7 +80,7 @@ class ExtractPages {
80
80
  }
81
81
  const options = {
82
82
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
83
- method: "POST",
83
+ method: 'POST',
84
84
  headers: {
85
85
  "customjs-origin": "n8n/extractPages",
86
86
  "x-api-key": credentials.apiKey,
@@ -95,10 +95,9 @@ class ExtractPages {
95
95
  return EXTRACT_PAGES_FROM_PDF(pdfBuffer, input.pageRange);`,
96
96
  returnBinary: "true",
97
97
  },
98
- encoding: null,
99
98
  json: true,
100
99
  };
101
- const response = await this.helpers.request(options);
100
+ const response = await this.helpers.httpRequest(options);
102
101
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
103
102
  // No binary data returned; emit only JSON without a binary property
104
103
  returnData.push({
@@ -66,7 +66,7 @@ class GetFormFieldNames {
66
66
  }
67
67
  const options = {
68
68
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
69
- method: "POST",
69
+ method: 'POST',
70
70
  headers: {
71
71
  "customjs-origin": "n8n/getFormFieldNames",
72
72
  "x-api-key": credentials.apiKey,
@@ -79,10 +79,9 @@ class GetFormFieldNames {
79
79
  return PDF_GET_FORM_FIELD_NAMES(pdfInput);`,
80
80
  returnBinary: "false",
81
81
  },
82
- encoding: null,
83
82
  json: true,
84
83
  };
85
- const response = await this.helpers.request(options);
84
+ const response = await this.helpers.httpRequest(options);
86
85
  returnData.push({
87
86
  json: {
88
87
  output: JSON.parse(response.toString()),
@@ -44,7 +44,7 @@ class Html2Docx {
44
44
  const htmlInput = this.getNodeParameter("htmlInput", i);
45
45
  const options = {
46
46
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
47
- method: "POST",
47
+ method: 'POST',
48
48
  headers: {
49
49
  "customjs-origin": "n8n/html2Docx",
50
50
  "x-api-key": credentials.apiKey,
@@ -54,10 +54,9 @@ class Html2Docx {
54
54
  code: "const { HTML2DOCX } = require('./utils'); return HTML2DOCX(input)",
55
55
  returnBinary: "true",
56
56
  },
57
- encoding: null,
58
57
  json: true,
59
58
  };
60
- const response = await this.helpers.request(options);
59
+ const response = await this.helpers.httpRequest(options);
61
60
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
62
61
  // No binary data returned; emit only JSON without a binary property
63
62
  returnData.push({
@@ -44,7 +44,7 @@ class Html2Pdf {
44
44
  const htmlInput = this.getNodeParameter("htmlInput", i);
45
45
  const options = {
46
46
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
47
- method: "POST",
47
+ method: 'POST',
48
48
  headers: {
49
49
  "customjs-origin": "n8n/generatePDF",
50
50
  "x-api-key": credentials.apiKey,
@@ -54,10 +54,9 @@ class Html2Pdf {
54
54
  code: "const { HTML2PDF } = require('./utils'); return HTML2PDF(input)",
55
55
  returnBinary: "true",
56
56
  },
57
- encoding: null,
58
57
  json: true,
59
58
  };
60
- const response = await this.helpers.request(options);
59
+ const response = await this.helpers.httpRequest(options);
61
60
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
62
61
  // No binary data returned; emit only JSON without a binary property
63
62
  returnData.push({
@@ -172,7 +172,7 @@ class InvoiceGenerator {
172
172
  displayName: 'Items JSON',
173
173
  name: 'itemsJson',
174
174
  type: 'json',
175
- default: '[]',
175
+ default: '[{"description":"Item 1","quantity":2,"unitPrice":50}]',
176
176
  displayOptions: {
177
177
  show: {
178
178
  itemsMode: ['json'],
@@ -212,7 +212,6 @@ class InvoiceGenerator {
212
212
  invoiceItems = itemsJson;
213
213
  }
214
214
  else {
215
- // Handle cases where the field might be empty or have other non-array/non-string values
216
215
  invoiceItems = [];
217
216
  }
218
217
  }
@@ -220,6 +219,13 @@ class InvoiceGenerator {
220
219
  const itemsData = this.getNodeParameter('items', i);
221
220
  invoiceItems = itemsData.itemsValues;
222
221
  }
222
+ invoiceItems = invoiceItems.map(item => {
223
+ return {
224
+ description: item.description,
225
+ quantity: Number(item.quantity),
226
+ unitPrice: Number(item.unitPrice),
227
+ };
228
+ });
223
229
  const invoiceData = {
224
230
  issuer,
225
231
  payment,
@@ -254,10 +260,9 @@ class InvoiceGenerator {
254
260
  code: code,
255
261
  returnBinary: 'true',
256
262
  },
257
- encoding: null,
258
263
  json: true,
259
264
  };
260
- const response = await this.helpers.request(options);
265
+ const response = await this.helpers.httpRequest(options);
261
266
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
262
267
  // No binary data returned; emit only JSON without a binary property
263
268
  returnData.push({
@@ -44,7 +44,7 @@ class Markdown2Html {
44
44
  const markdownInput = this.getNodeParameter("markdownInput", i);
45
45
  const options = {
46
46
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
47
- method: "POST",
47
+ method: 'POST',
48
48
  headers: {
49
49
  "customjs-origin": "n8n/markdown2html",
50
50
  "x-api-key": credentials.apiKey,
@@ -54,10 +54,9 @@ class Markdown2Html {
54
54
  code: "const { MD2HTML } = require('./utils'); return MD2HTML(input)",
55
55
  returnBinary: "false",
56
56
  },
57
- encoding: null,
58
57
  json: true,
59
58
  };
60
- const response = await this.helpers.request(options);
59
+ const response = await this.helpers.httpRequest(options);
61
60
  returnData.push({
62
61
  json: {
63
62
  output: response.toString(),
@@ -64,7 +64,7 @@ class MergePdfs {
64
64
  const urls = !isBinary ? field_name : [];
65
65
  const options = {
66
66
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
67
- method: "POST",
67
+ method: 'POST',
68
68
  headers: {
69
69
  "customjs-origin": "n8n/mergePDFs",
70
70
  "x-api-key": credentials.apiKey,
@@ -77,10 +77,9 @@ class MergePdfs {
77
77
  return PDF_MERGE(input);`,
78
78
  returnBinary: "true",
79
79
  },
80
- encoding: null,
81
80
  json: true,
82
81
  };
83
- const response = await this.helpers.request(options);
82
+ const response = await this.helpers.httpRequest(options);
84
83
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
85
84
  // No binary data returned; emit only JSON without a binary property
86
85
  returnData.push({
@@ -99,7 +99,7 @@ class PdfFormFill {
99
99
  }
100
100
  const options = {
101
101
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
102
- method: "POST",
102
+ method: 'POST',
103
103
  headers: {
104
104
  "customjs-origin": "n8n/pdfFormFill",
105
105
  "x-api-key": credentials.apiKey,
@@ -117,10 +117,9 @@ class PdfFormFill {
117
117
  return PDF_FILL_FORM(pdfInput, fieldValues);`,
118
118
  returnBinary: "true",
119
119
  },
120
- encoding: null,
121
120
  json: true,
122
121
  };
123
- const response = await this.helpers.request(options);
122
+ const response = await this.helpers.httpRequest(options);
124
123
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
125
124
  // No binary data returned; emit only JSON without a binary property
126
125
  returnData.push({
@@ -72,7 +72,7 @@ class PdfToPng {
72
72
  }
73
73
  const options = {
74
74
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
75
- method: "POST",
75
+ method: 'POST',
76
76
  headers: {
77
77
  "customjs-origin": "n8n/pdfToPng",
78
78
  "x-api-key": credentials.apiKey,
@@ -85,10 +85,9 @@ class PdfToPng {
85
85
  return PDF2PNG(input);`,
86
86
  returnBinary: "true",
87
87
  },
88
- encoding: null,
89
88
  json: true,
90
89
  };
91
- const response = await this.helpers.request(options);
90
+ const response = await this.helpers.httpRequest(options);
92
91
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
93
92
  // No binary data returned; emit only JSON without a binary property
94
93
  returnData.push({
@@ -72,7 +72,7 @@ class PdfToText {
72
72
  }
73
73
  const options = {
74
74
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
75
- method: "POST",
75
+ method: 'POST',
76
76
  headers: {
77
77
  "customjs-origin": "n8n/pdfToText",
78
78
  "x-api-key": credentials.apiKey,
@@ -85,10 +85,9 @@ class PdfToText {
85
85
  return PDFTOTEXT(input);`,
86
86
  returnBinary: "false",
87
87
  },
88
- encoding: null,
89
88
  json: true,
90
89
  };
91
- const response = await this.helpers.request(options);
90
+ const response = await this.helpers.httpRequest(options);
92
91
  returnData.push({
93
92
  json: {
94
93
  output: response.toString(),
@@ -49,7 +49,7 @@ class SSLChecker {
49
49
  const domain = this.getNodeParameter("domain", i);
50
50
  const options = {
51
51
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
52
- method: "POST",
52
+ method: 'POST',
53
53
  headers: {
54
54
  "customjs-origin": "n8n/sslchecker",
55
55
  "x-api-key": credentials.apiKey,
@@ -60,7 +60,7 @@ class SSLChecker {
60
60
  },
61
61
  json: true,
62
62
  };
63
- const response = await this.helpers.request(options);
63
+ const response = await this.helpers.httpRequest(options);
64
64
  returnData.push({
65
65
  json: {
66
66
  output: response,
@@ -133,7 +133,7 @@ class Scraper {
133
133
  };
134
134
  const options = {
135
135
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
136
- method: "POST",
136
+ method: 'POST',
137
137
  headers: {
138
138
  "customjs-origin": "n8n/scraper",
139
139
  "x-api-key": credentials.apiKey,
@@ -145,10 +145,9 @@ class Scraper {
145
145
  `return SCRAPER(payload.url, payload.commands || [], "${returnValueType === "binary" ? "image" : "html"}", ${debug ? "true" : "false"});`,
146
146
  returnBinary: returnValueType === "binary" ? "true" : "false",
147
147
  },
148
- encoding: null,
149
148
  json: true,
150
149
  };
151
- const response = await this.helpers.request(options);
150
+ const response = await this.helpers.httpRequest(options);
152
151
  if (returnValueType === "binary") {
153
152
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
154
153
  // No binary data returned; emit only JSON without a binary property
@@ -41,7 +41,7 @@ class WebsiteScreenshot {
41
41
  const urlInput = this.getNodeParameter("urlInput", i);
42
42
  const options = {
43
43
  url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
44
- method: "POST",
44
+ method: 'POST',
45
45
  headers: {
46
46
  "customjs-origin": "n8n/screenshot",
47
47
  "x-api-key": credentials.apiKey,
@@ -51,10 +51,9 @@ class WebsiteScreenshot {
51
51
  code: "const { SCREENSHOT } = require('./utils'); return SCREENSHOT(input);",
52
52
  returnBinary: "true",
53
53
  },
54
- encoding: null,
55
54
  json: true,
56
55
  };
57
- const response = await this.helpers.request(options);
56
+ const response = await this.helpers.httpRequest(options);
58
57
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
59
58
  // No binary data returned; emit only JSON without a binary property
60
59
  returnData.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@custom-js/n8n-nodes-pdf-toolkit",
3
- "version": "1.35.0",
3
+ "version": "1.37.0",
4
4
  "description": "This is official node for interacting with APIs from customjs.space",
5
5
  "keywords": [
6
6
  "customjs",
@@ -13,7 +13,10 @@
13
13
  "url": "https://github.com/customjs/n8n-nodes-pdf-toolkit/issues"
14
14
  },
15
15
  "license": "ISC",
16
- "author": "Julian Szuper",
16
+ "author": {
17
+ "name": "Henrik Lippke",
18
+ "email": "h@customjs.io"
19
+ },
17
20
  "files": [
18
21
  "dist"
19
22
  ],