ForgeFunctionAdapter
ForgeFunctionAdapter is the adapter for Forge Functions — the backend resolvers
that run inside Atlassian’s Forge runtime. It wraps @forge/api’s requestJira and
requestConfluence utilities.
import { ForgeFunctionAdapter } from '@forge-clients/core';
// One adapter per productconst jiraAdapter = new ForgeFunctionAdapter({ product: 'jira' });const confluenceAdapter = new ForgeFunctionAdapter({ product: 'confluence' });Full example
Section titled “Full example”import Resolver from '@forge/resolver';import { ForgeFunctionAdapter, asApp, asUser } from '@forge-clients/core';import { getIssue, addComment } from '@forge-clients/jira/v3';
const resolver = new Resolver();const adapter = new ForgeFunctionAdapter({ product: 'jira' });
resolver.define('commentOnIssue', async (req) => { const { issueKey, comment } = req.payload;
// Read as app, write as the user who triggered the action const issue = await getIssue(asApp(adapter), { path: { issueIdOrKey: issueKey }, });
await addComment(asUser(adapter), { path: { issueIdOrKey: issueKey }, body: { body: { type: 'doc', version: 1, content: [{ type: 'paragraph', content: [{ type: 'text', text: comment }] }], }, }, });
return { success: true, issueSummary: issue.fields?.summary };});
export const handler = resolver.getDefinitions();@forge/apiis a peer dependency — it must be installed in your Forge app- The adapter dynamically imports
@forge/apiat runtime (it is not bundled) - Both
asAppandasUserauth contexts are supported - Rate limiting is handled by the Forge runtime automatically