Skip to content
Merged
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
2 changes: 1 addition & 1 deletion components/confluence/actions/create-page/create-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
key: "confluence-create-page",
name: "Create Page",
description: "Creates a new page in the space. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post)",
version: "0.0.4",
version: "0.0.5",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand All @@ -13,7 +13,7 @@
type: "action",
props: {
confluence,
draftInfo: {

Check warning on line 16 in components/confluence/actions/create-page/create-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop draftInfo must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 16 in components/confluence/actions/create-page/create-page.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop draftInfo must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Pages are created as published by default, unless specified as a draft in the `Status` prop.",
Expand Down
2 changes: 1 addition & 1 deletion components/confluence/actions/create-post/create-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "confluence-create-post",
name: "Create Post",
description: "Creates a new page or blog post on Confluence. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-post)",
version: "0.0.6",
version: "0.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/confluence/actions/delete-post/delete-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "confluence-delete-post",
name: "Delete Post",
description: "Removes a blog post from Confluence by its ID. Use with caution, the action is irreversible. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-id-delete)",
version: "0.0.6",
version: "0.0.7",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
52 changes: 51 additions & 1 deletion components/confluence/actions/get-page-by-id/get-page-by-id.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import confluence from "../../confluence.app.mjs";
import { parseObjectEntries } from "../../common/utils.mjs";
import { BODY_FORMAT_FULL_OPTIONS } from "../../common/constants.mjs";

export default {
key: "confluence-get-page-by-id",
name: "Get Page by ID",
description: "Retrieve a page by its ID. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get)",
version: "0.0.2",
version: "0.1.0",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand All @@ -19,6 +21,47 @@ export default {
"pageId",
],
},
bodyFormat: {
propDefinition: [
confluence,
"bodyFormat",
],
options: BODY_FORMAT_FULL_OPTIONS,
},
getDraft: {
type: "boolean",
label: "Get Draft",
description: "If true, retrieves the draft version of this page.",
optional: true,
default: false,
},
status: {
type: "string[]",
label: "Status",
description: "Filter the page being retrieved by its status.",
optional: true,
options: [
"current",
"archived",
"trashed",
"deleted",
"historical",
"draft",
],
},
version: {
type: "integer",
label: "Version",
description: "Allows you to retrieve a previously published version. Specify the previous version's number to retrieve its details.",
optional: true,
},
additionalOptions: {
type: "object",
label: "Additional Options",
description:
"Additional parameters to send in the request. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get) for available parameters. Values will be parsed as JSON where applicable.",
optional: true,
},
},
async run({ $ }) {
const cloudId = await this.confluence.getCloudId({
Expand All @@ -28,6 +71,13 @@ export default {
$,
cloudId,
pageId: this.pageId,
params: {
"body-format": this.bodyFormat,
"get-draft": this.getDraft,
"status": this.status,
"version": this.version,
...parseObjectEntries(this.additionalOptions),
},
});
$.export("$summary", `Successfully retrieved page with ID: ${this.pageId}`);
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "confluence-get-pages-in-space",
name: "Get Pages in Space",
description: "Retrieve a list of pages in a space. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-spaces-id-pages-get)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down Expand Up @@ -43,12 +43,6 @@ export default {
"bodyFormat",
],
},
subType: {
propDefinition: [
confluence,
"subType",
],
},
cursor: {
propDefinition: [
confluence,
Expand All @@ -71,13 +65,12 @@ export default {
cloudId,
spaceId: this.spaceId,
params: {
sort: this.sort,
status: this.status,
title: this.pageTitle,
bodyFormat: this.bodyFormat,
subType: this.subType,
cursor: this.cursor,
limit: this.limit,
"sort": this.sort,
"status": this.status,
"title": this.pageTitle,
"body-format": this.bodyFormat,
"cursor": this.cursor,
"limit": this.limit,
},
});
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1
Expand Down
16 changes: 8 additions & 8 deletions components/confluence/actions/get-pages/get-pages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "confluence-get-pages",
name: "Get Pages",
description: "Retrieve a list of pages. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-get)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down Expand Up @@ -64,13 +64,13 @@ export default {
$,
cloudId,
params: {
sort: this.sort,
status: this.status,
title: this.pageTitle,
bodyFormat: this.bodyFormat,
subType: this.subType,
cursor: this.cursor,
limit: this.limit,
"sort": this.sort,
"status": this.status,
"title": this.pageTitle,
"body-format": this.bodyFormat,
"subtype": this.subType,
"cursor": this.cursor,
"limit": this.limit,
},
});
$.export("$summary", `Successfully retrieved ${response.results.length} page${response.results.length === 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.5",
version: "0.0.6",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/confluence/actions/update-post/update-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "confluence-update-post",
name: "Update a Post",
description: "Updates a page or blog post on Confluence by its ID. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-blog-post/#api-blogposts-id-put)",
version: "0.0.6",
version: "0.0.7",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
13 changes: 13 additions & 0 deletions components/confluence/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const BODY_FORMAT_OPTIONS = [
"storage",
"atlas_doc_format",
];

export const BODY_FORMAT_FULL_OPTIONS = [
...BODY_FORMAT_OPTIONS,
"view",
"export_view",
"anonymous_export_view",
"styled_view",
"editor",
];
33 changes: 33 additions & 0 deletions components/confluence/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ConfigurationError } from "@pipedream/platform";

function optionalParseAsJSON(value) {
if (typeof value !== "string") {
return value;
}

try {
return JSON.parse(value);
} catch (e) {
return value;
}
}

export function parseObjectEntries(obj = {}) {
if (typeof obj === "string") {
try {
obj = JSON.parse(obj);
} catch (e) {
throw new ConfigurationError(`Invalid JSON string provided: ${e.message}`);
}
}

return Object.fromEntries(
Object.entries(obj || {}).map(([
key,
value,
]) => [
key,
optionalParseAsJSON(value),
]),
);
}
6 changes: 2 additions & 4 deletions components/confluence/confluence.app.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { axios } from "@pipedream/platform";
import { BODY_FORMAT_OPTIONS } from "./common/constants.mjs";

export default {
type: "app",
Expand Down Expand Up @@ -192,10 +193,7 @@ export default {
type: "string",
label: "Body Format",
description: "The content format types to be returned in the body field of the response. If available, the representation will be available under a response field of the same name under the body field.",
options: [
"storage",
"atlas_doc_format",
],
options: BODY_FORMAT_OPTIONS,
optional: true,
},
subType: {
Expand Down
2 changes: 1 addition & 1 deletion components/confluence/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/confluence",
"version": "0.3.0",
"version": "0.4.0",
"description": "Pipedream Confluence Components",
"main": "confluence.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "confluence-new-page-or-blog-post",
name: "New Page or Blog Post",
description: "Emit new event whenever a new page or blog post is created in a specified space",
version: "0.0.5",
version: "0.0.6",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export default {
...common,
key: "confluence-watch-blog-posts",
name: "Watch Blog Posts",

Check warning on line 7 in components/confluence/sources/watch-blog-posts/watch-blog-posts.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a blog post is created or updated",
version: "0.0.5",
version: "0.0.6",
type: "source",
dedupe: "unique",
methods: {
Expand Down
2 changes: 1 addition & 1 deletion components/confluence/sources/watch-pages/watch-pages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export default {
...common,
key: "confluence-watch-pages",
name: "Watch Pages",

Check warning on line 7 in components/confluence/sources/watch-pages/watch-pages.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
description: "Emit new event when a page is created or updated in Confluence",
version: "0.0.5",
version: "0.0.6",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading