@pipedream/printnode 0.1.0 → 0.2.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.
- package/README.md +11 -0
- package/actions/send-print-job/send-print-job.mjs +13 -19
- package/common/constants.mjs +0 -8
- package/package.json +2 -2
- package/printnode.app.mjs +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The PrintNode API on Pipedream allows you to integrate cloud printing capabilities into workflows. It supports automating print jobs, managing printers, and querying printer status. With Pipedream's ability to connect to hundreds of apps, you can trigger print jobs from emails, forms, databases, or custom events. The API's functions can be weaved into broader business processes to streamline document handling.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Print Shipping Labels on New Orders**: Automatically print shipping labels when new orders come in from an eCommerce platform like Shopify. When an order is placed, Pipedream triggers a workflow that sends the order's shipping label to a designated printer via PrintNode.
|
|
8
|
+
|
|
9
|
+
- **Print Invoices on Payment Confirmation**: Set up a workflow where invoices are automatically printed when payment is confirmed through payment processors like Stripe or PayPal. Once the payment succeeds, a PDF invoice is generated and sent to PrintNode for printing.
|
|
10
|
+
|
|
11
|
+
- **Daily Printout of Sales Reports**: Schedule a daily workflow that queries your sales database, generates a report, and prints it using PrintNode. This could be connected to apps like Google Sheets or Airtable where your sales data is updated.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import printnode from "../../printnode.app.mjs";
|
|
2
|
-
import
|
|
2
|
+
import { getFileStream } from "@pipedream/platform";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
key: "printnode-send-print-job",
|
|
6
6
|
name: "Send Print Job",
|
|
7
7
|
description: "Sends a print job to a specified printer. [See the documentation](https://www.printnode.com/en/docs/api/curl#creating-print-jobs)",
|
|
8
|
-
version: "0.0
|
|
8
|
+
version: "1.0.0",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
printnode,
|
|
@@ -23,15 +23,8 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
filePath: {
|
|
25
25
|
type: "string",
|
|
26
|
-
label: "File Path",
|
|
27
|
-
description: "The path to a
|
|
28
|
-
optional: true,
|
|
29
|
-
},
|
|
30
|
-
fileUrl: {
|
|
31
|
-
type: "string",
|
|
32
|
-
label: "File URL",
|
|
33
|
-
description: "The URL to a document file.",
|
|
34
|
-
optional: true,
|
|
26
|
+
label: "File Path or URL",
|
|
27
|
+
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`)",
|
|
35
28
|
},
|
|
36
29
|
title: {
|
|
37
30
|
type: "string",
|
|
@@ -73,15 +66,16 @@ export default {
|
|
|
73
66
|
},
|
|
74
67
|
async run({ $ }) {
|
|
75
68
|
const {
|
|
76
|
-
printnode, contentType, filePath,
|
|
69
|
+
printnode, contentType, filePath, ...props
|
|
77
70
|
} = this;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
|
|
72
|
+
const stream = await getFileStream(filePath);
|
|
73
|
+
const chunks = [];
|
|
74
|
+
for await (const chunk of stream) {
|
|
75
|
+
chunks.push(chunk);
|
|
76
|
+
}
|
|
77
|
+
const content = Buffer.concat(chunks).toString("base64");
|
|
78
|
+
|
|
85
79
|
const response = await printnode.createPrintJob({
|
|
86
80
|
$,
|
|
87
81
|
data: {
|
package/common/constants.mjs
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
export const PRINT_CONTENT_OPTIONS = [
|
|
2
|
-
{
|
|
3
|
-
label: "PDF (URL)",
|
|
4
|
-
value: "pdf_uri",
|
|
5
|
-
},
|
|
6
2
|
{
|
|
7
3
|
label: "PDF (File)",
|
|
8
4
|
value: "pdf_base64",
|
|
9
5
|
},
|
|
10
|
-
{
|
|
11
|
-
label: "Raw document (URL)",
|
|
12
|
-
value: "raw_uri",
|
|
13
|
-
},
|
|
14
6
|
{
|
|
15
7
|
label: "Raw Document (File)",
|
|
16
8
|
value: "raw_base64",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/printnode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pipedream PrintNode Components",
|
|
5
5
|
"main": "printnode.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pipedream/platform": "1.
|
|
16
|
+
"@pipedream/platform": "^3.1.0"
|
|
17
17
|
}
|
|
18
18
|
}
|
package/printnode.app.mjs
CHANGED
|
@@ -22,7 +22,7 @@ export default {
|
|
|
22
22
|
contentType: {
|
|
23
23
|
type: "string",
|
|
24
24
|
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)
|
|
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)",
|
|
26
26
|
options: PRINT_CONTENT_OPTIONS,
|
|
27
27
|
},
|
|
28
28
|
},
|