@forge/jira-bridge

中文文档
1.3.0发布于 2026/11/09SEE LICENSE IN LICENSE.txtTypeScript零依赖近 30 天下载 8.6万

Forge Jira bridge API for custom UI apps

原始使用文档

Forge Jira Bridge API

Register custom-field UIM handlers

customFieldApi.registerUIMHandlers lets an opted-in Forge object custom field validate UIM value and option-visibility proposals in its mounted view or edit runtime. This API requires a Jira host with the completed owner-handler capability enabled. Older or disabled hosts reject with error.code === 'FCF_UIM_HANDLERS_UNSUPPORTED'. Use isFcfError(error) before branching on error.code in a catch (error: unknown) block.

import { customFieldApi, isFcfError, type UIMHandlers } from '@forge/jira-bridge';

type Service = { id: string; name: string };
const handlers: UIMHandlers<Service> = {
  setValue(proposed, context) {
    // Validate the caller and proposed value using your app's domain policy.
    // Return a canonical JSON object, or null to clear the field.
    return { accepted: true, value: proposed };
  }
};

const registration = await customFieldApi.registerUIMHandlers(handlers);
// When this runtime unmounts:
await registration.unregister();

setValue and setOptionsVisibility are independently optional. Register either, both, or an empty handler map. A registered runtime without the requested handler does not support that operation: Jira must reject it with FCF_OPERATION_UNSUPPORTED through UIM's error channel without applying the proposal. A missing registration still follows the host's readiness rules. Both handlers support synchronous and asynchronous results: { accepted: true, value } or { accepted: false, code, message? }. null clears an object field, undefined, non-JSON values and malformed results are invalid. Jira validates and applies accepted results through its existing form or persistence path. Handlers must not persist a proposal or call view.submit themselves.

The host supplies callerAppId, fieldId, requestId, renderContext, currentValue and optionsVisibility. These describe the UIM invocation, they do not provide authenticated app-to-app resolver provenance. UIM setters remain synchronous and chainable, with application failures delivered through uiModificationsApi.onError.

Registration resolves after the host stores the callable handlers. Register once in each mounted runtime. Re-registering replaces that runtime's handlers, disposing an older registration cannot remove its replacement. unregister() returns an idempotent promise and disables local callbacks immediately, even if host cleanup rejects. Application cleanup must also dispose a registration that resolves after unmount.

Keep isUIModificationsEnabled: true in the existing jira:customField or jira:customFieldType module. No extra manifest resource or generic bridge API is required. Host deployment and controlled app migration must precede general use, older hosts retain their prior object-UIM behavior.

版本与发布记录

@forge/jira-bridge 共发布 206 个版本,首次发布于 2022/01/11;过去 12 个月发布了 30 个版本。

版本发布日期距今
1.3.0latest2026/11/096 天前
1.3.0-next.1next2026/11/0312 天前
1.3.0-next.02026/11/0312 天前
1.2.02026/09/281 个月前
1.2.0-next.1-experimental-fd0ebbcexperimental2026/09/231 个月前
1.2.0-next.1-experimental-554d4172026/09/231 个月前

关于 @forge/jira-bridge 的常见问题

@forge/jira-bridge 是什么?

Forge Jira bridge API for custom UI apps

如何安装 @forge/jira-bridge?

在项目目录运行 npm install @forge/jira-bridge,或使用 pnpm add / yarn add / bun add。

@forge/jira-bridge 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@forge/jira-bridge 可以商用吗?

@forge/jira-bridge 使用 SEE LICENSE IN LICENSE.txt 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@forge/jira-bridge 的下载量有多少?

根据 npm 官方下载统计,@forge/jira-bridge 在 2026/10/16 – 2026/11/14 这 30 天内被下载 86,128 次,日均约 2,871 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@forge/jira-bridge 还在维护吗?

最新版本 1.3.0 发布于 2026/11/09(6 天前);至今共发布 206 个版本,其中过去 12 个月发布了 30 个;首次发布于 2022/01/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。