Skip to content

Commit 8acf08a

Browse files
authored
Merge branch 'master' into issue-10912
2 parents 4b3098b + 311d74e commit 8acf08a

File tree

304 files changed

+4654
-849
lines changed

Some content is hidden

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

304 files changed

+4654
-849
lines changed
Lines changed: 120 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,127 @@
1+
import { axios } from "@pipedream/platform";
2+
const DEFAULT_LIMIT = 100;
3+
14
export default {
25
type: "app",
36
app: "accuranker",
4-
propDefinitions: {},
7+
propDefinitions: {
8+
domainId: {
9+
type: "string",
10+
label: "Domain ID",
11+
description: "The ID of the domain",
12+
async options({ page }) {
13+
const { results: domains } = await this.listDomains({
14+
params: {
15+
limit: DEFAULT_LIMIT,
16+
offset: DEFAULT_LIMIT * page,
17+
fields: "id,domain",
18+
},
19+
});
20+
return domains?.map((domain) => ({
21+
label: domain.domain,
22+
value: domain.id,
23+
})) || [];
24+
},
25+
},
26+
keywordId: {
27+
type: "string",
28+
label: "Keyword ID",
29+
description: "The ID of the keyword",
30+
async options({
31+
domainId, page,
32+
}) {
33+
const { results: keywords } = await this.listKeywords({
34+
domainId,
35+
params: {
36+
limit: DEFAULT_LIMIT,
37+
offset: DEFAULT_LIMIT * page,
38+
fields: "id,keyword",
39+
},
40+
});
41+
return keywords?.map((keyword) => ({
42+
label: keyword.keyword,
43+
value: keyword.id,
44+
})) || [];
45+
},
46+
},
47+
periodFrom: {
48+
type: "string",
49+
label: "Period From",
50+
description: "Date in format: YYYY-MM-DD",
51+
optional: true,
52+
},
53+
periodTo: {
54+
type: "string",
55+
label: "Period To",
56+
description: "Date in format: YYYY-MM-DD",
57+
optional: true,
58+
},
59+
max: {
60+
type: "integer",
61+
label: "Max",
62+
description: "Maximum number of results to return",
63+
optional: true,
64+
default: 100,
65+
},
66+
},
567
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
68+
_baseUrl() {
69+
return "https://app.accuranker.com/api/v4";
70+
},
71+
_makeRequest({
72+
$ = this, path, ...opts
73+
}) {
74+
return axios($, {
75+
url: `${this._baseUrl()}${path}`,
76+
headers: {
77+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
78+
},
79+
...opts,
80+
});
81+
},
82+
listDomains(opts = {}) {
83+
return this._makeRequest({
84+
path: "/domains/",
85+
...opts,
86+
});
87+
},
88+
listKeywords({
89+
domainId, ...opts
90+
}) {
91+
return this._makeRequest({
92+
path: `/domains/${domainId}/keywords/`,
93+
...opts,
94+
});
95+
},
96+
listBrands(opts = {}) {
97+
return this._makeRequest({
98+
path: "/brands/",
99+
...opts,
100+
});
101+
},
102+
async *paginate({
103+
fn, args, max,
104+
}) {
105+
args = {
106+
...args,
107+
params: {
108+
...args?.params,
109+
limit: DEFAULT_LIMIT,
110+
},
111+
};
112+
113+
let total, count = 0;
114+
do {
115+
const { results } = await fn(args);
116+
for (const item of results) {
117+
yield item;
118+
if (max && ++count >= max) {
119+
return count;
120+
}
121+
}
122+
total = results?.length;
123+
args.params.offset += DEFAULT_LIMIT;
124+
} while (total === DEFAULT_LIMIT);
9125
},
10126
},
11127
};
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import accuranker from "../../accuranker.app.mjs";
2+
3+
export default {
4+
key: "accuranker-list-brands",
5+
name: "List Brands",
6+
description: "List brands in Accuranker. [See the documentation](https://app.accuranker.com/api/read-docs#tag/Brands/operation/List%20Brands)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
accuranker,
16+
fields: {
17+
type: "string[]",
18+
label: "Fields",
19+
description: "The fields to return",
20+
optional: true,
21+
default: [
22+
"id",
23+
"last_scraped",
24+
"group",
25+
"domain",
26+
"display_name",
27+
"brand_list",
28+
"competitors",
29+
"history",
30+
"created_at",
31+
],
32+
},
33+
periodFrom: {
34+
propDefinition: [
35+
accuranker,
36+
"periodFrom",
37+
],
38+
},
39+
periodTo: {
40+
propDefinition: [
41+
accuranker,
42+
"periodTo",
43+
],
44+
},
45+
max: {
46+
propDefinition: [
47+
accuranker,
48+
"max",
49+
],
50+
},
51+
},
52+
async run({ $ }) {
53+
const brands = this.accuranker.paginate({
54+
fn: this.accuranker.listBrands,
55+
args: {
56+
$,
57+
params: {
58+
fields: this.fields.join(","),
59+
period_from: this.periodFrom,
60+
period_to: this.periodTo,
61+
},
62+
},
63+
max: this.max,
64+
});
65+
66+
const results = [];
67+
for await (const brand of brands) {
68+
results.push(brand);
69+
}
70+
71+
$.export("$summary", `Found ${results.length} brand(s)`);
72+
73+
return results;
74+
},
75+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import accuranker from "../../accuranker.app.mjs";
2+
3+
export default {
4+
key: "accuranker-list-domains",
5+
name: "List Domains",
6+
description: "List domains in Accuranker. [See the documentation](https://app.accuranker.com/api/read-docs#tag/Domains/operation/List%20Domains)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
accuranker,
16+
fields: {
17+
type: "string[]",
18+
label: "Fields",
19+
description: "The fields to return",
20+
optional: true,
21+
default: [
22+
"id",
23+
"display_name",
24+
"domain",
25+
"status",
26+
"created_at",
27+
"last_scraped",
28+
],
29+
},
30+
periodFrom: {
31+
propDefinition: [
32+
accuranker,
33+
"periodFrom",
34+
],
35+
},
36+
periodTo: {
37+
propDefinition: [
38+
accuranker,
39+
"periodTo",
40+
],
41+
},
42+
max: {
43+
propDefinition: [
44+
accuranker,
45+
"max",
46+
],
47+
},
48+
},
49+
async run({ $ }) {
50+
const domains = this.accuranker.paginate({
51+
fn: this.accuranker.listDomains,
52+
args: {
53+
$,
54+
params: {
55+
fields: this.fields.join(","),
56+
period_from: this.periodFrom,
57+
period_to: this.periodTo,
58+
},
59+
},
60+
max: this.max,
61+
});
62+
63+
const results = [];
64+
for await (const domain of domains) {
65+
results.push(domain);
66+
}
67+
68+
$.export("$summary", `Found ${results.length} domain(s)`);
69+
70+
return results;
71+
},
72+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import accuranker from "../../accuranker.app.mjs";
2+
3+
export default {
4+
key: "accuranker-list-keywords",
5+
name: "List Keywords",
6+
description: "List keywords for a domain in Accuranker. [See the documentation](https://app.accuranker.com/api/read-docs#tag/Keywords/operation/List%20Keywords)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
accuranker,
16+
domainId: {
17+
propDefinition: [
18+
accuranker,
19+
"domainId",
20+
],
21+
},
22+
fields: {
23+
type: "string[]",
24+
label: "Fields",
25+
description: "The fields to return",
26+
optional: true,
27+
default: [
28+
"id",
29+
"keyword",
30+
"description",
31+
"ranks",
32+
"competitor_ranks",
33+
],
34+
},
35+
periodFrom: {
36+
propDefinition: [
37+
accuranker,
38+
"periodFrom",
39+
],
40+
},
41+
periodTo: {
42+
propDefinition: [
43+
accuranker,
44+
"periodTo",
45+
],
46+
},
47+
max: {
48+
propDefinition: [
49+
accuranker,
50+
"max",
51+
],
52+
max: 100,
53+
},
54+
},
55+
async run({ $ }) {
56+
const keywords = this.accuranker.paginate({
57+
fn: this.accuranker.listKeywords,
58+
args: {
59+
$,
60+
domainId: this.domainId,
61+
params: {
62+
fields: this.fields.join(","),
63+
period_from: this.periodFrom,
64+
period_to: this.periodTo,
65+
},
66+
},
67+
max: this.max,
68+
});
69+
70+
const results = [];
71+
for await (const keyword of keywords) {
72+
results.push(keyword);
73+
}
74+
75+
$.export("$summary", `Found ${results.length} keyword(s)`);
76+
77+
return results;
78+
},
79+
};

components/accuranker/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/accuranker",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "Pipedream accuranker Components",
55
"main": "accuranker.app.mjs",
66
"keywords": [
@@ -13,6 +13,6 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.0"
16+
"@pipedream/platform": "^3.1.0"
1717
}
1818
}

components/afosto/actions/add-information-to-cart/add-information-to-cart.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ export default {
66
key: "afosto-add-information-to-cart",
77
name: "Add Information to Cart",
88
description: "Add customer information to a cart. [See the documentation](https://afosto.com/docs/developers/storefront-js-client/custom-checkout/collecting-customer-data/)",
9-
version: "0.0.1",
9+
version: "0.0.2",
1010
type: "action",
11+
annotations: {
12+
destructiveHint: false,
13+
openWorldHint: true,
14+
readOnlyHint: false,
15+
},
1116
props: {
1217
app,
1318
cartId: {

0 commit comments

Comments
 (0)