Skip to content

Commit 9d2183e

Browse files
committed
add: printnode,ragie
1 parent 4448b2a commit 9d2183e

File tree

6 files changed

+9
-40
lines changed

6 files changed

+9
-40
lines changed

components/printnode/actions/send-print-job/send-print-job.mjs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ export default {
2525
type: "string",
2626
label: "File Path or URL",
2727
description: "The file to upload. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.txt`)",
28-
optional: true,
29-
},
30-
fileUrl: {
31-
type: "string",
32-
label: "File URL",
33-
description: "The URL to a document file.",
34-
optional: true,
3528
},
3629
title: {
3730
type: "string",
@@ -73,22 +66,15 @@ export default {
7366
},
7467
async run({ $ }) {
7568
const {
76-
printnode, contentType, filePath, fileUrl, ...props
69+
printnode, contentType, filePath, ...props
7770
} = this;
7871

79-
let content;
80-
if (contentType.endsWith("base64") && filePath) {
81-
const { stream } = getFileStream(filePath.includes("tmp/")
82-
? filePath
83-
: `/tmp/${filePath}`);
84-
const chunks = [];
85-
for await (const chunk of stream) {
86-
chunks.push(chunk);
87-
}
88-
content = Buffer.concat(chunks).toString("base64");
89-
} else {
90-
content = fileUrl;
72+
const stream = getFileStream(filePath);
73+
const chunks = [];
74+
for await (const chunk of stream) {
75+
chunks.push(chunk);
9176
}
77+
const content = Buffer.concat(chunks).toString("base64");
9278

9379
const response = await printnode.createPrintJob({
9480
$,

components/printnode/common/constants.mjs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
export const PRINT_CONTENT_OPTIONS = [
2-
{
3-
label: "PDF (URL)",
4-
value: "pdf_uri",
5-
},
62
{
73
label: "PDF (File)",
84
value: "pdf_base64",
95
},
10-
{
11-
label: "Raw document (URL)",
12-
value: "raw_uri",
13-
},
146
{
157
label: "Raw Document (File)",
168
value: "raw_base64",

components/printnode/printnode.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default {
2222
contentType: {
2323
type: "string",
2424
label: "Content Type",
25-
description: "The type of content you are sending. [See the documentation for more information](https://www.printnode.com/en/docs/api/curl#create-printjob-content). You must also specify a `File Path` or `File URL`.",
25+
description: "The type of content you are sending. [See the documentation for more information](https://www.printnode.com/en/docs/api/curl#create-printjob-content)",
2626
options: PRINT_CONTENT_OPTIONS,
2727
},
2828
},

components/ragie/actions/create-document/create-document.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import FormData from "form-data";
22
import { getFileStreamAndMetadata } from "@pipedream/platform";
3-
import { checkTmp } from "../../common/utils.mjs";
43
import ragie from "../../ragie.app.mjs";
54

65
export default {
@@ -54,7 +53,7 @@ export default {
5453
const data = new FormData();
5554
const {
5655
stream, metadata,
57-
} = getFileStreamAndMetadata(checkTmp(this.file));
56+
} = getFileStreamAndMetadata(this.file);
5857
data.append("file", stream, {
5958
contentType: metadata.contentType,
6059
knownLength: metadata.size,

components/ragie/actions/update-document-file/update-document-file.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import FormData from "form-data";
22
import { getFileStreamAndMetadata } from "@pipedream/platform";
3-
import { checkTmp } from "../../common/utils.mjs";
43
import ragie from "../../ragie.app.mjs";
54

65
export default {
@@ -35,7 +34,7 @@ export default {
3534
const data = new FormData();
3635
const {
3736
stream, metadata,
38-
} = getFileStreamAndMetadata(checkTmp(this.file));
37+
} = getFileStreamAndMetadata(this.file);
3938
data.append("file", stream, {
4039
contentType: metadata.contentType,
4140
knownLength: metadata.size,

components/ragie/common/utils.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
export const checkTmp = (filename) => {
2-
if (!filename.startsWith("/tmp")) {
3-
return `/tmp/${filename}`;
4-
}
5-
return filename;
6-
};
7-
81
export const parseObject = (obj) => {
92
if (!obj) return undefined;
103

0 commit comments

Comments
 (0)