Skip to content

Commit 8793181

Browse files
committed
[FIX] Omnivore Get Article cannot list users
1 parent 4636f3e commit 8793181

File tree

6 files changed

+50
-34
lines changed

6 files changed

+50
-34
lines changed

components/omnivore/actions/get-article/get-article.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import article from "../../common/queries/article.mjs";
44
export default {
55
key: "omnivore-get-article",
66
name: "Get Article",
7-
description: "Get a single article and its content. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2659)",
7+
description: "Get a single article and its content. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts)",
88
type: "action",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
props: {
1111
app,
1212
username: {

components/omnivore/actions/save-page/save-page.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "Save Page",
88
description: "Save a page with supplied HTML content. [See the documentation](https://docs.omnivore.app/integrations/api.html#commonly-used-methods)",
99
type: "action",
10-
version: "0.0.1",
10+
version: "0.0.2",
1111
props: {
1212
app,
1313
url: {

components/omnivore/actions/save-url/save-url.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "Save URL",
88
description: "Save a URL to Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2590)",
99
type: "action",
10-
version: "0.0.2",
10+
version: "0.0.3",
1111
props: {
1212
app,
1313
url: {

components/omnivore/actions/search-for-pages/search-for-pages.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
name: "Search For Pages",
88
description: "Search for pages in Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2680)",
99
type: "action",
10-
version: "0.0.2",
10+
version: "0.0.3",
1111
props: {
1212
app,
1313
query: {

components/omnivore/omnivore.app.mjs

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@ export default {
2020
value,
2121
}),
2222
}) {
23-
const { users: response } =
24-
await this.listUsers();
23+
try {
24+
const response = await this.listUsers();
2525

26-
if (response.errorCodes?.length) {
27-
throw new Error(JSON.stringify(response, null, 2));
28-
}
26+
if (response?.me === null) {
27+
return [];
28+
}
29+
30+
if (response.errorCodes?.length) {
31+
throw JSON.stringify(response.errorCodes, null, 2);
32+
}
2933

30-
const { users } = response;
31-
return users.map(mapper);
34+
return response.users.map(mapper);
35+
} catch (error) {
36+
console.log("listUsers error", error);
37+
return [];
38+
}
3239
},
3340
},
3441
articleId: {
@@ -52,30 +59,39 @@ export default {
5259
return [];
5360
}
5461

55-
const { articles: response } =
56-
await this.listArticles({
57-
first: constants.DEFAULT_LIMIT,
58-
after,
59-
});
62+
try {
63+
const response =
64+
await this.listArticles({
65+
first: constants.DEFAULT_LIMIT,
66+
after,
67+
});
6068

61-
if (response.errorCodes?.length) {
62-
throw new Error(JSON.stringify(response, null, 2));
63-
}
69+
if (response?.me === null) {
70+
return [];
71+
}
6472

65-
const {
66-
edges,
67-
pageInfo: {
68-
hasNextPage,
69-
endCursor,
70-
},
71-
} = response;
73+
if (response.errorCodes?.length) {
74+
throw JSON.stringify(response.errorCodes, null, 2);
75+
}
7276

73-
return {
74-
options: edges.map(mapper),
75-
context: {
76-
after: hasNextPage && endCursor || null,
77-
},
78-
};
77+
const {
78+
edges,
79+
pageInfo: {
80+
hasNextPage,
81+
endCursor,
82+
},
83+
} = response.articles;
84+
85+
return {
86+
options: edges.map(mapper),
87+
context: {
88+
after: hasNextPage && endCursor || null,
89+
},
90+
};
91+
} catch (error) {
92+
console.log("listArticles error", error);
93+
return [];
94+
}
7995
},
8096
},
8197
format: {

components/omnivore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/omnivore",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "Pipedream Omnivore Components",
55
"main": "omnivore.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)