@pipedream/tableau 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 ADDED
@@ -0,0 +1,17 @@
1
+ # Overview
2
+
3
+ The Tableau API allows you to tap into the robust data visualization and business intelligence capabilities of Tableau. Within Pipedream, you can leverage this API to automate reporting, manage users, update data sources, and extract insights. This enables you to integrate Tableau's analytics with other services, streamlining your data workflows and ensuring your dashboards remain up-to-date with minimal manual effort.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Automated Snapshot Sharing**: Generate snapshots of your key Tableau dashboards and share them via email or Slack at regular intervals. This keeps your team informed with the latest business insights without manual exports.
8
+
9
+ _Example Workflow_: Trigger a Pipedream workflow on a schedule; use Tableau API to capture a view of the dashboard; send the image via Gmail or post to a Slack channel using their respective Pipedream app integrations.
10
+
11
+ - **Dynamic Data Updates**: Automatically update Tableau data sources when new data comes into your backend systems, ensuring that Tableau dashboards reflect the most current data.
12
+
13
+ _Example Workflow_: Trigger a Pipedream workflow with a webhook when new data is added to a database; process and format the data within the workflow; use Tableau API to refresh the corresponding data source on Tableau Server or Tableau Online.
14
+
15
+ - **User Management Automation**: Streamline user provisioning by automating the addition and removal of users to and from Tableau sites based on HR software triggers or internal databases.
16
+
17
+ _Example Workflow_: Trigger a Pipedream workflow from a user management event in an app like BambooHR; use conditions within the workflow to determine if the user should be added or removed; utilize Tableau API to update the user list on the relevant Tableau site.
@@ -4,7 +4,7 @@ export default {
4
4
  key: "tableau-create-project",
5
5
  name: "Create Project",
6
6
  description: "Creates a project on the specified site. You can also create project hierarchies by creating a project under the specified parent project on the site. [See the documentation](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm#create_project)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  app,
@@ -0,0 +1,130 @@
1
+ import app from "../../tableau.app.mjs";
2
+ import fs from "fs";
3
+ import path from "path";
4
+
5
+ export default {
6
+ key: "tableau-download-pdf",
7
+ name: "Download PDF",
8
+ description: "Downloads images of the sheets of a workbook as a PDF file. [See the documentation](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_workbooks_and_views.htm#download_workbook_pdf)",
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ app,
13
+ siteId: {
14
+ propDefinition: [
15
+ app,
16
+ "siteId",
17
+ ],
18
+ },
19
+ workbookId: {
20
+ propDefinition: [
21
+ app,
22
+ "workbookId",
23
+ ({ siteId }) => ({
24
+ siteId,
25
+ }),
26
+ ],
27
+ },
28
+ maxAge: {
29
+ type: "integer",
30
+ label: "Max Age",
31
+ description: "The maximum number of minutes a workbook PDF will be cached before being refreshed. Minimum interval is one minute",
32
+ optional: true,
33
+ min: 1,
34
+ },
35
+ orientation: {
36
+ type: "string",
37
+ label: "Page Orientation",
38
+ description: "The orientation of the pages in the PDF file produced",
39
+ options: [
40
+ "Portrait",
41
+ "Landscape",
42
+ ],
43
+ default: "Portrait",
44
+ optional: true,
45
+ },
46
+ pageType: {
47
+ type: "string",
48
+ label: "Page Type",
49
+ description: "The type of page, which determines the page dimensions of the PDF file returned",
50
+ options: [
51
+ "A3",
52
+ "A4",
53
+ "A5",
54
+ "B5",
55
+ "Executive",
56
+ "Folio",
57
+ "Ledger",
58
+ "Legal",
59
+ "Letter",
60
+ "Note",
61
+ "Quarto",
62
+ "Tabloid",
63
+ ],
64
+ default: "Legal",
65
+ optional: true,
66
+ },
67
+ vizHeight: {
68
+ type: "integer",
69
+ label: "Viz Height",
70
+ description: "The height of the rendered PDF image in pixels that, along with `Viz Width`, determines its resolution and aspect ratio",
71
+ optional: true,
72
+ },
73
+ vizWidth: {
74
+ type: "integer",
75
+ label: "Viz Width",
76
+ description: "The width of the rendered PDF image in pixels that, along with `Viz Height`, determines its resolution and aspect ratio",
77
+ optional: true,
78
+ },
79
+ outputFilename: {
80
+ type: "string",
81
+ label: "Output Filename",
82
+ description: "The filename for the downloaded PDF file, which will be saved to the `/tmp` folder",
83
+ default: "workbook.pdf",
84
+ optional: true,
85
+ },
86
+ syncDir: {
87
+ type: "dir",
88
+ accessMode: "write",
89
+ sync: true,
90
+ },
91
+ },
92
+ async run({ $ }) {
93
+ const {
94
+ siteId,
95
+ workbookId,
96
+ maxAge,
97
+ orientation,
98
+ pageType,
99
+ vizHeight,
100
+ vizWidth,
101
+ outputFilename,
102
+ } = this;
103
+
104
+ const response = await this.app.downloadWorkbookPdf({
105
+ $,
106
+ siteId,
107
+ workbookId,
108
+ params: {
109
+ "max-age-minutes": maxAge,
110
+ orientation,
111
+ "page-type": pageType,
112
+ "viz-height": vizHeight,
113
+ "viz-width": vizWidth,
114
+ },
115
+ responseType: "arraybuffer",
116
+ });
117
+
118
+ // Write the PDF to the /tmp folder
119
+ const filename = outputFilename || "workbook.pdf";
120
+ const filePath = path.join("/tmp", filename);
121
+
122
+ await fs.promises.writeFile(filePath, Buffer.from(response));
123
+
124
+ $.export("$summary", `Successfully downloaded workbook PDF to \`${filePath}\``);
125
+ return {
126
+ filePath,
127
+ fileContent: response,
128
+ };
129
+ },
130
+ };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "tableau-query-projects",
6
6
  name: "Query Projects",
7
7
  description: "Returns a list of projects on the specified site. [See the documentation](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_projects.htm)",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "action",
10
10
  props: {
11
11
  app,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/tableau",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Pipedream Tableau Components",
5
5
  "main": "tableau.app.mjs",
6
6
  "keywords": [
@@ -6,7 +6,7 @@ export default {
6
6
  key: "tableau-label-created-instant",
7
7
  name: "New Label Created (Instant)",
8
8
  description: "Emit new event when a label is created in Tableau. [See the documentation](https://help.tableau.com/current/developer/webhooks/en-us/docs/webhooks-events-payload.html)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  methods: {
@@ -6,7 +6,7 @@ export default {
6
6
  key: "tableau-workbook-created-instant",
7
7
  name: "New Workbook Created (Instant)",
8
8
  description: "Emit new event each time a new workbook is created in Tableau. [See the documentation](https://help.tableau.com/current/developer/webhooks/en-us/docs/webhooks-events-payload.html)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  methods: {
package/tableau.app.mjs CHANGED
@@ -47,6 +47,32 @@ export default {
47
47
  }));
48
48
  },
49
49
  },
50
+ workbookId: {
51
+ type: "string",
52
+ label: "Workbook ID",
53
+ description: "The ID of the workbook to download as PDF",
54
+ async options({
55
+ siteId, page,
56
+ }) {
57
+ if (!siteId) {
58
+ return [];
59
+ }
60
+ const { workbooks: { workbook: data } } =
61
+ await this.listWorkbooks({
62
+ siteId,
63
+ params: {
64
+ pageSize: constants.DEFAULT_LIMIT,
65
+ pageNumber: page + 1,
66
+ },
67
+ });
68
+ return data?.map(({
69
+ id: value, name: label,
70
+ }) => ({
71
+ label,
72
+ value,
73
+ })) || [];
74
+ },
75
+ },
50
76
  },
51
77
  methods: {
52
78
  getUrl(path) {
@@ -95,6 +121,22 @@ export default {
95
121
  ...args,
96
122
  });
97
123
  },
124
+ listWorkbooks({
125
+ siteId, ...args
126
+ }) {
127
+ return this._makeRequest({
128
+ path: `/sites/${siteId}/workbooks`,
129
+ ...args,
130
+ });
131
+ },
132
+ downloadWorkbookPdf({
133
+ siteId, workbookId, ...args
134
+ }) {
135
+ return this._makeRequest({
136
+ path: `/sites/${siteId}/workbooks/${workbookId}/pdf`,
137
+ ...args,
138
+ });
139
+ },
98
140
  async *getIterations({
99
141
  resourcesFn, resourcesFnArgs, resourceName,
100
142
  max = constants.DEFAULT_MAX,