Files
simstudioai--sim/apps/sim/tools/confluence/retrieve.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

118 lines
3.4 KiB
TypeScript

import type { ConfluenceRetrieveParams, ConfluenceRetrieveResponse } from '@/tools/confluence/types'
import {
BODY_FORMAT_PROPERTIES,
TIMESTAMP_OUTPUT,
VERSION_OUTPUT_PROPERTIES,
} from '@/tools/confluence/types'
import { transformPageData } from '@/tools/confluence/utils'
import type { ToolConfig } from '@/tools/types'
export const confluenceRetrieveTool: ToolConfig<
ConfluenceRetrieveParams,
ConfluenceRetrieveResponse
> = {
id: 'confluence_retrieve',
name: 'Confluence Retrieve',
description: 'Retrieve content from Confluence pages using the Confluence API.',
version: '1.0.0',
oauth: {
required: true,
provider: 'confluence',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'OAuth access token for Confluence',
},
domain: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Your Confluence domain (e.g., yourcompany.atlassian.net)',
},
pageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Confluence page ID to retrieve (numeric ID from page URL or API)',
},
cloudId: {
type: 'string',
required: false,
visibility: 'user-only',
description:
'Confluence Cloud ID for the instance. If not provided, it will be fetched using the domain.',
},
},
request: {
url: (params: ConfluenceRetrieveParams) => {
return '/api/tools/confluence/page'
},
method: 'POST',
headers: (params: ConfluenceRetrieveParams) => {
return {
Accept: 'application/json',
Authorization: `Bearer ${params.accessToken}`,
}
},
body: (params: ConfluenceRetrieveParams) => {
return {
domain: params.domain,
accessToken: params.accessToken,
pageId: params.pageId,
cloudId: params.cloudId,
}
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return transformPageData(data)
},
outputs: {
ts: TIMESTAMP_OUTPUT,
pageId: { type: 'string', description: 'Confluence page ID' },
title: { type: 'string', description: 'Page title' },
content: { type: 'string', description: 'Page content with HTML tags stripped' },
status: {
type: 'string',
description: 'Page status (current, archived, trashed, draft)',
optional: true,
},
spaceId: { type: 'string', description: 'ID of the space containing the page', optional: true },
parentId: { type: 'string', description: 'ID of the parent page', optional: true },
authorId: { type: 'string', description: 'Account ID of the page author', optional: true },
createdAt: {
type: 'string',
description: 'ISO 8601 timestamp when the page was created',
optional: true,
},
url: { type: 'string', description: 'URL to view the page in Confluence', optional: true },
body: {
type: 'object',
description: 'Raw page body content in storage format',
properties: {
storage: {
type: 'object',
description: 'Body in storage format (Confluence markup)',
properties: BODY_FORMAT_PROPERTIES,
optional: true,
},
},
optional: true,
},
version: {
type: 'object',
description: 'Page version information',
properties: VERSION_OUTPUT_PROPERTIES,
optional: true,
},
},
}