/** * Typed Jira Cloud REST client (API v3). * * Shared by the direct and Platform-managed Jira integrations. Direct Jira * uses Basic auth against an Atlassian site; Platform Jira points the same * client at a connection proxy with a bearer token. Both modes use the same * request shapes, timeout, and error normalization. * * Endpoint notes (Jira Cloud, 2026): * - Issue search is `POST /rest/api/3/search/jql` — the legacy * `GET /rest/api/3/search` endpoint has been removed. The new endpoint * returns only ids unless `fields` is requested explicitly, and pages with * an opaque `nextPageToken` cursor (no `startAt`/`total`). * - Project listing is `GET /rest/api/3/project/search` with classic * `startAt`/`isLast` paging. * - Descriptions and comment bodies are ADF documents (see `adf.ts`). */ import type { AdfNode } from './adf.js'; /** Issue page size — Linear parity (`LINEAR_ISSUES_PAGE_SIZE`). */ export declare const JIRA_ISSUES_PAGE_SIZE = 30; /** Comment page size — Linear parity (`LINEAR_COMMENTS_PAGE_SIZE`). */ export declare const JIRA_COMMENTS_PAGE_SIZE = 50; export declare const JIRA_PROJECTS_PAGE_SIZE = 50; /** Fields requested from issue reads — `search/jql` returns ids only without an explicit list. */ export declare const JIRA_ISSUE_FIELDS: readonly ["summary", "description", "status", "assignee", "reporter", "labels", "priority", "issuetype", "project", "created", "updated"]; interface JiraApiClientBaseConfig { /** Jira API base URL, either the Atlassian site or a Platform connection proxy. */ baseUrl: string; fetchImpl?: typeof fetch; } export type JiraApiClientConfig = JiraApiClientBaseConfig & ({ /** Atlassian account email the API token belongs to. */ email: string; /** API token from id.atlassian.com → Security → API tokens. */ apiToken: string; accessToken?: never; } | { /** Bearer token used when the base URL is a Mastra Platform connection proxy. */ accessToken: string; email?: never; apiToken?: never; }); /** Stable error code the routes/tools surface to the SPA and agents. */ export type JiraApiErrorCode = 'jira_auth_failed' | 'jira_request_failed'; /** Normalized Jira API failure carrying the HTTP status and Jira's error detail. */ export declare class JiraApiError extends Error { readonly status: number | null; readonly code: JiraApiErrorCode; constructor(message: string, status: number | null); } export interface JiraStatusCategory { /** `new` | `indeterminate` | `done` — Jira's fixed status families. */ key: string; name?: string; } export interface JiraStatus { name: string; statusCategory?: JiraStatusCategory; } export interface JiraProject { id: string; key: string; name: string; } export interface JiraProjectSearchPage { values: JiraProject[]; startAt: number; isLast: boolean; } export interface JiraServerInfo { baseUrl: string; serverTitle?: string; } export interface JiraUser { displayName: string; } export interface JiraComment { id: string; author?: JiraUser | null; body?: AdfNode | null; created: string; } export interface JiraCommentPage { comments: JiraComment[]; startAt: number; maxResults: number; total: number; } export interface JiraIssueFields { summary?: string; description?: AdfNode | null; status?: JiraStatus; assignee?: JiraUser | null; reporter?: JiraUser | null; labels?: string[]; priority?: { name: string; } | null; issuetype?: { name: string; }; project?: { id: string; key: string; name?: string; }; created?: string; updated?: string; } export interface JiraIssue { id: string; key: string; fields: JiraIssueFields; } export interface JiraSearchPage { issues: JiraIssue[]; /** Opaque cursor for the next page; absent on the last page. */ nextPageToken?: string | null; } export interface JiraTransition { id: string; name: string; /** Target status the transition moves the issue to. */ to?: JiraStatus; } export declare class JiraApiClient { #private; constructor(config: JiraApiClientConfig); /** Normalized site base URL (no trailing slash) — used for `/browse/` links. */ get baseUrl(): string; getServerInfo(): Promise; /** One page of the site's projects (Settings intake-source picker). */ listProjects(options?: { startAt?: number; }): Promise; /** One page of a JQL search with explicitly requested fields. */ searchIssues(options: { jql: string; fields?: readonly string[]; nextPageToken?: string; maxResults?: number; }): Promise; /** Full issue detail by key (`ENG-42`) or id. */ getIssue(keyOrId: string): Promise; /** One page of an issue's comments (oldest first, Jira default order). */ listComments(keyOrId: string, options?: { startAt?: number; }): Promise; /** Post a plain-text comment (wrapped into a minimal ADF document). */ createComment(keyOrId: string, body: string): Promise; /** Transitions currently legal for the issue (workflow-dependent). */ listTransitions(keyOrId: string): Promise; /** Apply a transition by id (Jira responds 204 on success). */ applyTransition(keyOrId: string, transitionId: string): Promise; } export {}; //# sourceMappingURL=api.d.ts.map