n8n-nodes-quickpdf 0.1.2 → 0.1.4
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.
|
@@ -3,6 +3,10 @@ export declare class QuickPdfApi implements ICredentialType {
|
|
|
3
3
|
name: string;
|
|
4
4
|
displayName: string;
|
|
5
5
|
documentationUrl: string;
|
|
6
|
+
icon: {
|
|
7
|
+
readonly light: "file:quickpdf.svg";
|
|
8
|
+
readonly dark: "file:quickpdf.svg";
|
|
9
|
+
};
|
|
6
10
|
supportedNodes: string[];
|
|
7
11
|
properties: INodeProperties[];
|
|
8
12
|
authenticate: {
|
|
@@ -6,6 +6,10 @@ class QuickPdfApi {
|
|
|
6
6
|
this.name = "quickPdfApi";
|
|
7
7
|
this.displayName = "Quick PDF Tools API";
|
|
8
8
|
this.documentationUrl = "https://quickpdftools.net/developers/";
|
|
9
|
+
this.icon = {
|
|
10
|
+
light: "file:quickpdf.svg",
|
|
11
|
+
dark: "file:quickpdf.svg",
|
|
12
|
+
};
|
|
9
13
|
this.supportedNodes = ["n8n-nodes-quickpdf.quickPdf"];
|
|
10
14
|
this.properties = [
|
|
11
15
|
{
|
|
@@ -7,12 +7,16 @@ class QuickPdf {
|
|
|
7
7
|
this.description = {
|
|
8
8
|
displayName: "Quick PDF Tools",
|
|
9
9
|
name: "quickPdf",
|
|
10
|
-
icon:
|
|
10
|
+
icon: {
|
|
11
|
+
light: "file:quickpdf.svg",
|
|
12
|
+
dark: "file:quickpdf.dark.svg",
|
|
13
|
+
},
|
|
11
14
|
group: ["transform"],
|
|
12
15
|
version: [1],
|
|
13
16
|
subtitle: '={{$parameter["operation"]}}',
|
|
14
17
|
description: "Server-side PDF unlock, protect, and repair (Quick PDF Tools API v1)",
|
|
15
18
|
defaults: { name: "Quick PDF" },
|
|
19
|
+
usableAsTool: true,
|
|
16
20
|
inputs: ["main" /* NodeConnectionType.Main */],
|
|
17
21
|
outputs: ["main" /* NodeConnectionType.Main */],
|
|
18
22
|
credentials: [{ name: "quickPdfApi", required: true }],
|
|
@@ -98,7 +102,6 @@ class QuickPdf {
|
|
|
98
102
|
const returnData = [];
|
|
99
103
|
const credentials = await this.getCredentials("quickPdfApi");
|
|
100
104
|
const apiBase = String(credentials.apiBase || "https://api.quickpdftools.net").replace(/\/$/, "");
|
|
101
|
-
const apiKey = String(credentials.apiKey || "");
|
|
102
105
|
for (let i = 0; i < items.length; i++) {
|
|
103
106
|
try {
|
|
104
107
|
const resource = this.getNodeParameter("resource", i);
|
|
@@ -117,7 +120,7 @@ class QuickPdf {
|
|
|
117
120
|
const buffer = Buffer.from(binary.data, "base64");
|
|
118
121
|
const form = new FormData();
|
|
119
122
|
const mime = binary.mimeType || "application/pdf";
|
|
120
|
-
form.append("file", new Blob([buffer], { type: mime }), binary.fileName || "document.pdf");
|
|
123
|
+
form.append("file", new Blob([new Uint8Array(buffer)], { type: mime }), binary.fileName || "document.pdf");
|
|
121
124
|
if (operation !== "repair") {
|
|
122
125
|
const password = this.getNodeParameter("password", i);
|
|
123
126
|
if (!password) {
|
|
@@ -125,12 +128,9 @@ class QuickPdf {
|
|
|
125
128
|
}
|
|
126
129
|
form.append("password", password);
|
|
127
130
|
}
|
|
128
|
-
const response = await this.helpers.
|
|
131
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, "quickPdfApi", {
|
|
129
132
|
method: "POST",
|
|
130
133
|
url: `${apiBase}/api/v1/pdf/${operation}`,
|
|
131
|
-
headers: {
|
|
132
|
-
Authorization: `Bearer ${apiKey}`,
|
|
133
|
-
},
|
|
134
134
|
body: form,
|
|
135
135
|
encoding: "arraybuffer",
|
|
136
136
|
returnFullResponse: true,
|
|
@@ -157,7 +157,7 @@ class QuickPdf {
|
|
|
157
157
|
: operation === "protect"
|
|
158
158
|
? (binary.fileName || "document.pdf").replace(/\.pdf$/i, "-protected.pdf")
|
|
159
159
|
: (binary.fileName || "document.pdf").replace(/\.pdf$/i, "-repaired.pdf");
|
|
160
|
-
|
|
160
|
+
returnData.push({
|
|
161
161
|
json: {
|
|
162
162
|
...items[i].json,
|
|
163
163
|
quickPdf: { resource, operation, apiBase, bytes: body.length },
|
|
@@ -166,15 +166,15 @@ class QuickPdf {
|
|
|
166
166
|
...(items[i].binary || {}),
|
|
167
167
|
[outputBinaryPropertyName]: await this.helpers.prepareBinaryData(body, outName, "application/pdf"),
|
|
168
168
|
},
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
pairedItem: { item: i },
|
|
170
|
+
});
|
|
171
171
|
}
|
|
172
172
|
catch (error) {
|
|
173
173
|
if (this.continueOnFail()) {
|
|
174
174
|
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
|
|
175
175
|
continue;
|
|
176
176
|
}
|
|
177
|
-
throw error;
|
|
177
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
return [returnData];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-quickpdf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Unlock, protect, and repair PDFs via Quick PDF Tools API v1 (n8n Cloud friendly — no qpdf on host)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"typescript": "^5.4.5"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"n8n-workflow": "
|
|
53
|
+
"n8n-workflow": "*"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=18.17.0"
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|