From 4ef2a4af400cd053c6f9e28eb1cb4eddbd8d12be Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Apr 2025 14:21:03 -0400 Subject: [PATCH 1/2] search-content --- .../actions/search-content/search-content.mjs | 60 +++++++++++++++++++ components/confluence/package.json | 4 +- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 components/confluence/actions/search-content/search-content.mjs diff --git a/components/confluence/actions/search-content/search-content.mjs b/components/confluence/actions/search-content/search-content.mjs new file mode 100644 index 0000000000000..209bb20f24765 --- /dev/null +++ b/components/confluence/actions/search-content/search-content.mjs @@ -0,0 +1,60 @@ +import confluence from "../../confluence.app.mjs"; + +export default { + key: "confluence-search-content", + name: "Search Content", + description: "Searches for content using the Confluence Query Language (CQL). [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search#api-wiki-rest-api-search-get)", + version: "0.0.1", + type: "action", + props: { + confluence, + cql: { + type: "string", + label: "CQL", + description: "The CQL query to be used for the search. See [Advanced Searching using CQL](https://developer.atlassian.com/cloud/confluence/advanced-searching-using-cql/) for instructions on how to build a CQL query.", + }, + maxResults: { + type: "integer", + label: "Max Results", + description: "The maximum number of results to return", + default: 100, + optional: true, + }, + }, + methods: { + searchContent({ + cloudId, ...opts + }) { + return this.confluence._makeRequest({ + url: `https://api.atlassian.com/ex/confluence/${cloudId}/wiki/rest/api/search`, + ...opts, + }); + }, + }, + async run({ $ }) { + const cloudId = await this.confluence.getCloudId({ + $, + }); + const items = this.confluence.paginate({ + resourceFn: this.searchContent, + args: { + $, + cloudId, + params: { + cql: this.cql, + }, + }, + max: this.maxResults, + }); + + const results = []; + for await (const item of items) { + results.push(item); + } + + $.export("$summary", `Successfully found ${results.length} result${results.length === 1 + ? "" + : "s"}`); + return results; + }, +}; diff --git a/components/confluence/package.json b/components/confluence/package.json index 9b4f1e4418f3a..37bf8be53416a 100644 --- a/components/confluence/package.json +++ b/components/confluence/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/confluence", - "version": "0.0.2", + "version": "0.1.0", "description": "Pipedream Confluence Components", "main": "confluence.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.0" + "@pipedream/platform": "^3.0.3" } } From 4e0c12590adecafd474f694f9470f2b1989a9d81 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Apr 2025 14:24:08 -0400 Subject: [PATCH 2/2] pnpm-lock.yaml --- pnpm-lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 371d148f83508..ec9474fd88998 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2810,8 +2810,8 @@ importers: components/confluence: dependencies: '@pipedream/platform': - specifier: ^1.6.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/confluent: {}