From 87931813c23697aaf1799a88760bcc96f8ab5adc Mon Sep 17 00:00:00 2001 From: Jorge Cortes Date: Thu, 18 Sep 2025 12:54:39 -0500 Subject: [PATCH] [FIX] Omnivore Get Article cannot list users --- .../actions/get-article/get-article.mjs | 4 +- .../omnivore/actions/save-page/save-page.mjs | 2 +- .../omnivore/actions/save-url/save-url.mjs | 2 +- .../search-for-pages/search-for-pages.mjs | 2 +- components/omnivore/omnivore.app.mjs | 72 +++++++++++-------- components/omnivore/package.json | 2 +- 6 files changed, 50 insertions(+), 34 deletions(-) diff --git a/components/omnivore/actions/get-article/get-article.mjs b/components/omnivore/actions/get-article/get-article.mjs index abe45d09a43fe..9dddbbb0965bc 100644 --- a/components/omnivore/actions/get-article/get-article.mjs +++ b/components/omnivore/actions/get-article/get-article.mjs @@ -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: { diff --git a/components/omnivore/actions/save-page/save-page.mjs b/components/omnivore/actions/save-page/save-page.mjs index 940501393872c..55535dfbec480 100644 --- a/components/omnivore/actions/save-page/save-page.mjs +++ b/components/omnivore/actions/save-page/save-page.mjs @@ -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: { diff --git a/components/omnivore/actions/save-url/save-url.mjs b/components/omnivore/actions/save-url/save-url.mjs index 16d94a000f999..2887d54e4fd00 100644 --- a/components/omnivore/actions/save-url/save-url.mjs +++ b/components/omnivore/actions/save-url/save-url.mjs @@ -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: { diff --git a/components/omnivore/actions/search-for-pages/search-for-pages.mjs b/components/omnivore/actions/search-for-pages/search-for-pages.mjs index 7c6afdc46e6a3..c3f5be7a9ce19 100644 --- a/components/omnivore/actions/search-for-pages/search-for-pages.mjs +++ b/components/omnivore/actions/search-for-pages/search-for-pages.mjs @@ -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: { diff --git a/components/omnivore/omnivore.app.mjs b/components/omnivore/omnivore.app.mjs index ca09bc289e0a8..c6a4b6a5d9d82 100644 --- a/components/omnivore/omnivore.app.mjs +++ b/components/omnivore/omnivore.app.mjs @@ -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: { @@ -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: { diff --git a/components/omnivore/package.json b/components/omnivore/package.json index f38e66a9c7bf4..7447ac8264a0b 100644 --- a/components/omnivore/package.json +++ b/components/omnivore/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/omnivore", - "version": "0.2.1", + "version": "0.2.2", "description": "Pipedream Omnivore Components", "main": "omnivore.app.mjs", "keywords": [