Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/omnivore/actions/get-article/get-article.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import article from "../../common/queries/article.mjs";
export default {
key: "omnivore-get-article",
name: "Get Article",
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)",
description: "Get a single article and its content. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
username: {
Expand Down
2 changes: 1 addition & 1 deletion components/omnivore/actions/save-page/save-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Save Page",
description: "Save a page with supplied HTML content. [See the documentation](https://docs.omnivore.app/integrations/api.html#commonly-used-methods)",
type: "action",
version: "0.0.1",
version: "0.0.2",
props: {
app,
url: {
Expand Down
2 changes: 1 addition & 1 deletion components/omnivore/actions/save-url/save-url.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Save URL",
description: "Save a URL to Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2590)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
url: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "Search For Pages",
description: "Search for pages in Omnivore. [See the documentation](https://github.com/omnivore-app/omnivore/blob/main/packages/api/src/schema.ts#L2680)",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
query: {
Expand Down
72 changes: 44 additions & 28 deletions components/omnivore/omnivore.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,22 @@ export default {
value,
}),
}) {
const { users: response } =
await this.listUsers();
try {
const response = await this.listUsers();

if (response.errorCodes?.length) {
throw new Error(JSON.stringify(response, null, 2));
}
if (response?.me === null) {
return [];
}

if (response.errorCodes?.length) {
throw JSON.stringify(response.errorCodes, null, 2);
}

const { users } = response;
return users.map(mapper);
return response.users.map(mapper);
} catch (error) {
console.log("listUsers error", error);
return [];
}
},
},
articleId: {
Expand All @@ -52,30 +59,39 @@ export default {
return [];
}

const { articles: response } =
await this.listArticles({
first: constants.DEFAULT_LIMIT,
after,
});
try {
const response =
await this.listArticles({
first: constants.DEFAULT_LIMIT,
after,
});

if (response.errorCodes?.length) {
throw new Error(JSON.stringify(response, null, 2));
}
if (response?.me === null) {
return [];
}

const {
edges,
pageInfo: {
hasNextPage,
endCursor,
},
} = response;
if (response.errorCodes?.length) {
throw JSON.stringify(response.errorCodes, null, 2);
}

return {
options: edges.map(mapper),
context: {
after: hasNextPage && endCursor || null,
},
};
const {
edges,
pageInfo: {
hasNextPage,
endCursor,
},
} = response.articles;

return {
options: edges.map(mapper),
context: {
after: hasNextPage && endCursor || null,
},
};
} catch (error) {
console.log("listArticles error", error);
return [];
}
},
},
format: {
Expand Down
2 changes: 1 addition & 1 deletion components/omnivore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/omnivore",
"version": "0.2.1",
"version": "0.2.2",
"description": "Pipedream Omnivore Components",
"main": "omnivore.app.mjs",
"keywords": [
Expand Down
Loading