diff --git a/components/arxiv/actions/search-articles/search-articles.mjs b/components/arxiv/actions/search-articles/search-articles.mjs new file mode 100644 index 0000000000000..2a4aa4f151e14 --- /dev/null +++ b/components/arxiv/actions/search-articles/search-articles.mjs @@ -0,0 +1,80 @@ +import arxiv from "../../arxiv.app.mjs"; +import fs from "fs"; + +export default { + key: "arxiv-search-articles", + name: "Search Articles", + description: "Search for articles on arXiv. [See the documentation](https://info.arxiv.org/help/api/user-manual.html#2-api-quickstart)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + arxiv, + searchQuery: { + type: "string", + label: "Search Query", + description: "The search query to use. Example: `all:electron`. [See the documentation](https://info.arxiv.org/help/api/user-manual.html#51-details-of-query-construction) for information on constructing a search query.", + optional: true, + }, + idList: { + type: "string[]", + label: "ID List", + description: "A list of arXiv article IDs to search for. Example ID: `2505.08081v1`", + optional: true, + }, + start: { + type: "integer", + label: "Start", + description: "The index of the first result to return. Defaults to 0.", + optional: true, + }, + maxResults: { + type: "integer", + label: "Max Results", + description: "The maximum number of results to return. Defaults to 10.", + optional: true, + }, + filename: { + type: "string", + label: "Filename", + description: "A filename to save the result as an xml file to the /tmp directory. Example: `arxiv-search-results.xml`", + optional: true, + }, + syncDir: { + type: "dir", + accessMode: "write", + sync: true, + }, + }, + async run({ $ }) { + const response = await this.arxiv.search({ + $, + params: { + search_query: this.searchQuery, + id_list: this.idList + ? this.idList.join(",") + : undefined, + start: this.start, + max_results: this.maxResults, + }, + }); + + if (!this.filename) { + $.export("$summary", "Successfully searched for articles"); + return response; + } + + const filePath = `/tmp/${this.filename}`; + fs.writeFileSync(filePath, response, "utf8"); + + $.export("$summary", `Successfully saved search results to ${filePath}`); + return { + filePath, + fileContent: response, + }; + }, +}; diff --git a/components/arxiv/arxiv.app.mjs b/components/arxiv/arxiv.app.mjs index 49a11ec7bed53..a46215900cdb1 100644 --- a/components/arxiv/arxiv.app.mjs +++ b/components/arxiv/arxiv.app.mjs @@ -1,11 +1,26 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "arxiv", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://export.arxiv.org/api"; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + ...opts, + }); + }, + search(opts = {}) { + return this._makeRequest({ + path: "/query", + ...opts, + }); }, }, }; diff --git a/components/arxiv/package.json b/components/arxiv/package.json index 40b892640b977..b6719969deb3b 100644 --- a/components/arxiv/package.json +++ b/components/arxiv/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/arxiv", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream arXiv Components", "main": "arxiv.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.1" } } diff --git a/components/meetgeek/meetgeek.app.mjs b/components/meetgeek/meetgeek.app.mjs index 27d216dc58a05..8b925cbc312ea 100644 --- a/components/meetgeek/meetgeek.app.mjs +++ b/components/meetgeek/meetgeek.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/nele_ai/nele_ai.app.mjs b/components/nele_ai/nele_ai.app.mjs index b42004b0862a7..2de15e4012a22 100644 --- a/components/nele_ai/nele_ai.app.mjs +++ b/components/nele_ai/nele_ai.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/octave/octave.app.mjs b/components/octave/octave.app.mjs index c3b7165562982..b975b70d481c7 100644 --- a/components/octave/octave.app.mjs +++ b/components/octave/octave.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/olostep/olostep.app.mjs b/components/olostep/olostep.app.mjs index c0909a866dcd9..28e3236bf609f 100644 --- a/components/olostep/olostep.app.mjs +++ b/components/olostep/olostep.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/opencti/opencti.app.mjs b/components/opencti/opencti.app.mjs index 0d4a9cd757665..82f69a4353bc7 100644 --- a/components/opencti/opencti.app.mjs +++ b/components/opencti/opencti.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/orq_ai/orq_ai.app.mjs b/components/orq_ai/orq_ai.app.mjs index 72e17774008d6..433582d952155 100644 --- a/components/orq_ai/orq_ai.app.mjs +++ b/components/orq_ai/orq_ai.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/progress_agentic_rag/progress_agentic_rag.app.mjs b/components/progress_agentic_rag/progress_agentic_rag.app.mjs index 3108ca5de7ba3..e957baf846b40 100644 --- a/components/progress_agentic_rag/progress_agentic_rag.app.mjs +++ b/components/progress_agentic_rag/progress_agentic_rag.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d0187bab4b03d..5d9c300768ac3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1125,7 +1125,11 @@ importers: components/arpoone: {} - components/arxiv: {} + components/arxiv: + dependencies: + '@pipedream/platform': + specifier: ^3.1.1 + version: 3.1.1 components/aryn: {} @@ -35885,7 +35889,7 @@ snapshots: debug: 4.4.1(supports-color@10.0.0) gensync: 1.0.0-beta.2 json5: 2.2.3 - semver: 7.7.3 + semver: 7.7.2 transitivePeerDependencies: - supports-color @@ -35895,7 +35899,7 @@ snapshots: eslint: 8.57.1 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 - semver: 7.7.3 + semver: 7.7.2 '@babel/generator@7.26.2': dependencies: @@ -38450,7 +38454,7 @@ snapshots: find-up: 7.0.0 minimatch: 9.0.5 read-pkg: 9.0.1 - semver: 7.7.3 + semver: 7.7.2 yaml: 2.8.0 yargs: 17.7.2 @@ -38502,7 +38506,7 @@ snapshots: resolve: 2.0.0-next.5 rfdc: 1.4.1 safe-json-stringify: 1.2.0 - semver: 7.7.3 + semver: 7.7.2 string-width: 7.2.0 strip-ansi: 7.1.0 supports-color: 10.0.0 @@ -38572,7 +38576,7 @@ snapshots: js-image-generator: 1.0.4 lodash.debounce: 4.0.8 parse-gitignore: 2.0.0 - semver: 7.7.3 + semver: 7.7.2 tmp-promise: 3.0.3 uuid: 11.1.0 write-file-atomic: 5.0.1 @@ -38596,7 +38600,7 @@ snapshots: p-wait-for: 5.0.2 parse-imports: 2.2.1 path-key: 4.0.0 - semver: 7.7.3 + semver: 7.7.2 tmp-promise: 3.0.3 urlpattern-polyfill: 8.0.2 uuid: 11.1.0 @@ -38744,7 +38748,7 @@ snapshots: precinct: 12.2.0(supports-color@10.0.0) require-package-name: 2.0.1 resolve: 2.0.0-next.5 - semver: 7.7.3 + semver: 7.7.2 tmp-promise: 3.0.3 toml: 3.0.0 unixify: 1.0.0 @@ -42429,7 +42433,7 @@ snapshots: fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 - semver: 7.7.3 + semver: 7.7.1 ts-api-utils: 1.4.0(typescript@5.6.3) optionalDependencies: typescript: 5.6.3 @@ -45416,7 +45420,7 @@ snapshots: globals: 15.12.0 ignore: 5.3.2 minimatch: 9.0.5 - semver: 7.7.3 + semver: 7.7.2 eslint-plugin-putout@23.2.0(eslint@8.57.1)(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)): dependencies: @@ -45909,7 +45913,7 @@ snapshots: proxy-addr: 2.0.7 rfdc: 1.4.1 secure-json-parse: 2.7.0 - semver: 7.7.3 + semver: 7.7.2 toad-cache: 3.7.0 fastparse@1.1.2: {} @@ -46531,7 +46535,7 @@ snapshots: dependencies: '@xhmikosr/downloader': 13.0.1 node-fetch: 3.3.2 - semver: 7.7.3 + semver: 7.7.2 git-repo-info@2.1.1: {} @@ -48602,7 +48606,7 @@ snapshots: jws: 3.2.2 lodash: 4.17.21 ms: 2.1.3 - semver: 7.7.3 + semver: 7.7.2 jsonwebtoken@9.0.2: dependencies: @@ -48615,7 +48619,7 @@ snapshots: lodash.isstring: 4.0.1 lodash.once: 4.1.1 ms: 2.1.3 - semver: 7.7.3 + semver: 7.6.3 jsprim@1.4.2: dependencies: @@ -50261,7 +50265,7 @@ snapshots: normalize-package-data@7.0.1: dependencies: hosted-git-info: 8.1.0 - semver: 7.7.3 + semver: 7.7.2 validate-npm-package-license: 3.0.4 normalize-path@2.1.1: @@ -51271,7 +51275,7 @@ snapshots: jsdoc: 4.0.4 minimist: 1.2.8 protobufjs: 7.2.6 - semver: 7.7.3 + semver: 7.7.2 tmp: 0.2.3 uglify-js: 3.19.3 @@ -52590,7 +52594,7 @@ snapshots: dependencies: color: 4.2.3 detect-libc: 2.0.4 - semver: 7.7.3 + semver: 7.7.2 optionalDependencies: '@img/sharp-darwin-arm64': 0.34.3 '@img/sharp-darwin-x64': 0.34.3 @@ -52717,7 +52721,7 @@ snapshots: simple-update-notifier@2.0.0: dependencies: - semver: 7.7.3 + semver: 7.7.2 simple-xml2json@1.2.3: {} @@ -53305,7 +53309,7 @@ snapshots: mime: 2.6.0 qs: 6.14.0 readable-stream: 3.6.2 - semver: 7.7.3 + semver: 7.7.2 transitivePeerDependencies: - supports-color @@ -53827,7 +53831,7 @@ snapshots: hookable: 5.5.3 rolldown: 1.0.0-beta.9 rolldown-plugin-dts: 0.13.12(rolldown@1.0.0-beta.9)(typescript@5.9.2) - semver: 7.7.3 + semver: 7.7.2 tinyexec: 1.0.1 tinyglobby: 0.2.14 unconfig: 7.3.2 @@ -54312,7 +54316,7 @@ snapshots: is-npm: 6.0.0 latest-version: 9.0.0 pupa: 3.1.0 - semver: 7.7.3 + semver: 7.7.2 xdg-basedir: 5.1.0 uqr@0.1.2: {}