Skip to content

Commit 283475c

Browse files
authored
Merge branch 'master' into issue-12416
2 parents 66dfe57 + 50d817c commit 283475c

File tree

102 files changed

+1400
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1400
-111
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import airtable from "../../airtable_oauth.app.mjs";
2+
3+
export default {
4+
key: "airtable_oauth-list-bases",
5+
name: "List Bases",
6+
description:
7+
"Get the list of bases that can be accessed. [See the documentation](https://airtable.com/developers/web/api/list-bases)",
8+
type: "action",
9+
version: "0.0.1",
10+
props: {
11+
airtable,
12+
},
13+
async run({ $ }) {
14+
const { bases } = await this.airtable.listBases({
15+
$,
16+
});
17+
$.export(
18+
"$summary",
19+
`Successfully retrieved ${bases.length} bases`,
20+
);
21+
return bases;
22+
},
23+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import airtable from "../../airtable_oauth.app.mjs";
2+
3+
export default {
4+
key: "airtable_oauth-list-tables",
5+
name: "List Tables",
6+
description:
7+
"Get a list of tables in the selected base. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)",
8+
type: "action",
9+
version: "0.0.1",
10+
props: {
11+
airtable,
12+
baseId: {
13+
propDefinition: [
14+
airtable,
15+
"baseId",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const { tables } = await this.airtable.listTables({
21+
$,
22+
baseId: this.baseId,
23+
});
24+
$.export(
25+
"$summary",
26+
`Successfully retrieved ${tables.length} tables`,
27+
);
28+
return tables;
29+
},
30+
};

components/airtable_oauth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/airtable_oauth",
3-
"version": "0.4.4",
3+
"version": "0.5.0",
44
"description": "Pipedream Airtable (OAuth) Components",
55
"main": "airtable_oauth.app.mjs",
66
"keywords": [

components/google_search_console/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ The Google Search Console API opens a treasure trove of data and insights about
99
- **Sync Search Results with Google Sheets**: Create a workflow that periodically pulls data from the Google Search Console API and adds it to a Google Sheet. This is useful for maintaining an evolving dataset for deeper analysis, historical reference, or sharing insights across teams without giving direct access to the Search Console.
1010

1111
- **Automatic Sitemap Submission**: Set up a Pipedream workflow that triggers whenever a new sitemap is generated in your content management system (CMS). The workflow can then automatically submit the sitemap to Google Search Console via API, ensuring Google has the latest structure of your site for crawling and indexing.
12+
13+
## Available Actions
14+
15+
[Retrieve Site Performance Data](./actions/retrieve-site-performance-data/README.md)
16+
[Submit URL for Indexing](./actions/submit-url-for-indexing/README.md)
17+
18+
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import googleSearchConsole from "../../google_search_console.app.mjs";
2+
import { trimIfString } from "../../common/utils.mjs";
3+
4+
export default {
5+
name: "Retrieve Site Performance Data",
6+
description: "Fetches search analytics from Google Search Console for a verified site.",
7+
key: "google_search_console-retrieve-site-performance-data",
8+
version: "0.0.2",
9+
type: "action",
10+
props: {
11+
googleSearchConsole,
12+
siteUrl: {
13+
type: "string",
14+
label: "Verified Site URL",
15+
description: "Including https:// is strongly advised",
16+
},
17+
startDate: {
18+
type: "string",
19+
label: "Start Date (YYYY-MM-DD)",
20+
description: "Start date of the range for which to retrieve site performance data",
21+
},
22+
endDate: {
23+
type: "string",
24+
label: "End Date (YYYY-MM-DD)",
25+
description: "Enddate of the range for which to retrieve site performance data",
26+
},
27+
dimensions: {
28+
type: "string[]",
29+
label: "Dimensions",
30+
optional: true,
31+
description: "e.g. ['query', 'page', 'country', 'device']",
32+
},
33+
searchType: {
34+
type: "string",
35+
label: "Search Type",
36+
description: "The type of search to use",
37+
optional: true,
38+
options: [
39+
"web",
40+
"image",
41+
"video",
42+
"news",
43+
"googleNews",
44+
"discover",
45+
],
46+
default: "web",
47+
},
48+
aggregationType: {
49+
type: "string",
50+
label: "Aggregation Type",
51+
description: "The aggregation type to use",
52+
optional: true,
53+
options: [
54+
"auto",
55+
"byPage",
56+
],
57+
},
58+
rowLimit: {
59+
type: "integer",
60+
label: "Max Rows",
61+
description: "Max number of rows to return",
62+
default: 10,
63+
optional: true,
64+
},
65+
startRow: {
66+
type: "integer",
67+
label: "Start Row",
68+
description: "Start row (for pagination)",
69+
optional: true,
70+
},
71+
dimensionFilterGroups: {
72+
type: "object",
73+
label: "Dimension Filters",
74+
optional: true,
75+
description: "Follow Search Console API structure for filters",
76+
},
77+
dataState: {
78+
type: "string",
79+
label: "Data State",
80+
description: "The data state to use",
81+
optional: true,
82+
options: [
83+
"all",
84+
"final",
85+
],
86+
default: "final",
87+
},
88+
},
89+
async run({ $ }) {
90+
const {
91+
googleSearchConsole,
92+
siteUrl,
93+
dimensionFilterGroups,
94+
...fields
95+
} = this;
96+
97+
const body = Object.entries(fields).reduce((acc, [
98+
key,
99+
value,
100+
]) => {
101+
acc[key] = trimIfString(value);
102+
return acc;
103+
}, {});
104+
105+
let response;
106+
try {
107+
response = await googleSearchConsole.getSitePerformanceData({
108+
$,
109+
url: siteUrl,
110+
data: {
111+
...body,
112+
dimensionFilterGroups: googleSearchConsole.parseIfJsonString(dimensionFilterGroups),
113+
},
114+
});
115+
} catch (error) {
116+
// Identify if the error was thrown by internal validation or by the API call
117+
const thrower = googleSearchConsole.checkWhoThrewError(error);
118+
throw new Error(`Failed to fetch data ( ${thrower.whoThrew} error ) : ${error.message}. `);
119+
};
120+
121+
$.export("$summary", ` Fetched ${response.rows?.length || 0} rows of data. `);
122+
return response;
123+
},
124+
};
125+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import googleSearchConsole from "../../google_search_console.app.mjs";
2+
import { trimIfString } from "../../common/utils.mjs";
3+
4+
export default {
5+
name: "Submit URL for Indexing",
6+
description: "Sends a URL update notification to the Google Indexing API",
7+
key: "google_search_console-submit-url-for-indexing",
8+
version: "0.0.2",
9+
type: "action",
10+
props: {
11+
googleSearchConsole,
12+
siteUrl: {
13+
type: "string",
14+
label: "URL for indexing",
15+
description: "URL to be submitted for indexing",
16+
},
17+
},
18+
async run({ $ }) {
19+
const siteUrl = trimIfString(this.siteUrl);
20+
21+
const warnings = [];
22+
23+
const urlCheck = this.googleSearchConsole.checkIfUrlValid(siteUrl);
24+
if (urlCheck.warnings) {
25+
warnings.push(...urlCheck.warnings);
26+
}
27+
28+
let response;
29+
try {
30+
response = await this.googleSearchConsole.submitUrlForIndexing({
31+
$,
32+
data: {
33+
url: siteUrl,
34+
type: "URL_UPDATED", // Notifies Google that the content at this URL has been updated
35+
},
36+
});
37+
} catch (error) {
38+
const thrower = this.googleSearchConsole.checkWhoThrewError(error);
39+
throw new Error(`Failed to fetch data ( ${thrower.whoThrew} error ) : ${error.message}. ` + warnings.join("\n- "));
40+
41+
};
42+
43+
// Output a summary message and any accumulated warnings
44+
$.export("$summary", ` URL submitted to Google: ${this.siteUrl}` + warnings.join("\n- "));
45+
46+
return response;
47+
},
48+
};

0 commit comments

Comments
 (0)