@forge/jira-bridge
1.3.0-next.01.3.0-next.1
+
Added (3 files)
~
Modified (14 files)
Index: package/out/errors.js
===================================================================
--- package/out/errors.js
+++ package/out/errors.js
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.ERROR_TYPES = exports.ON_FIELD_DATA_CHANGE_ERROR = exports.ON_ERROR_ERROR = exports.GET_API_ERROR = exports.SUBSCRIBE_TO_CHANGES_ERROR = exports.ON_INIT_ERROR = exports.AppExecutionError = exports.BridgeAPIError = void 0;
+exports.ERROR_TYPES = exports.REGISTER_UIM_HANDLERS_ERROR = exports.ON_FIELD_DATA_CHANGE_ERROR = exports.ON_ERROR_ERROR = exports.GET_API_ERROR = exports.SUBSCRIBE_TO_CHANGES_ERROR = exports.ON_INIT_ERROR = exports.AppExecutionError = exports.BridgeAPIError = void 0;
class BridgeAPIError extends Error {
}
exports.BridgeAPIError = BridgeAPIError;
class AppExecutionError extends Error {
@@ -11,5 +11,6 @@
exports.SUBSCRIBE_TO_CHANGES_ERROR = 'subscribeToChangesError';
exports.GET_API_ERROR = 'getApiError';
exports.ON_ERROR_ERROR = 'onErrorError';
exports.ON_FIELD_DATA_CHANGE_ERROR = 'onFieldDataChangeError';
+exports.REGISTER_UIM_HANDLERS_ERROR = 'registerUIMHandlersError';
exports.ERROR_TYPES = [exports.ON_INIT_ERROR, exports.SUBSCRIBE_TO_CHANGES_ERROR, exports.GET_API_ERROR, exports.ON_ERROR_ERROR]; Index: package/out/ui-modifications/types/errors.js
===================================================================
--- package/out/ui-modifications/types/errors.js
+++ package/out/ui-modifications/types/errors.js
@@ -1,2 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
+exports.FCF_ERROR_CODES = void 0;
+exports.FCF_ERROR_CODES = [
+ 'FCF_HANDLER_UNAVAILABLE',
+ 'FCF_UIM_HANDLERS_UNSUPPORTED',
+ 'FCF_OPERATION_UNSUPPORTED',
+ 'FCF_OPERATION_DENIED',
+ 'FCF_HANDLER_TIMEOUT',
+ 'FCF_HANDLER_FAILED',
+ 'FCF_INVALID_RESULT',
+ 'FCF_STALE_CONTEXT',
+ 'FCF_PERSISTENCE_FAILED'
+]; Index: package/out/custom-field/index.js
===================================================================
--- package/out/custom-field/index.js
+++ package/out/custom-field/index.js
@@ -1,9 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.customFieldApi = void 0;
+exports.customFieldApi = exports.isFcfError = void 0;
+const registerUIMHandlers_1 = require("./registerUIMHandlers");
const getFieldData_1 = require("./getFieldData");
const subscribeToFieldData_1 = require("./subscribeToFieldData");
+var registerUIMHandlers_2 = require("./registerUIMHandlers");
+Object.defineProperty(exports, "isFcfError", { enumerable: true, get: function () { return registerUIMHandlers_2.isFcfError; } });
exports.customFieldApi = {
+ registerUIMHandlers: registerUIMHandlers_1.registerUIMHandlers,
subscribeToFieldData: subscribeToFieldData_1.subscribeToFieldData,
getFieldData: getFieldData_1.getFieldData
}; Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@forge/jira-bridge",
- "version": "1.3.0-next.0",
+ "version": "1.3.0-next.1",
"description": "Forge Jira bridge API for custom UI apps",
"author": "Atlassian",
"license": "SEE LICENSE IN LICENSE.txt",
"browser": "out/index.js", Index: package/out/errors.d.ts.map
===================================================================
--- package/out/errors.d.ts.map
+++ package/out/errors.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;CAAG;AAC5C,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,0BAA0B,4BAA4B,CAAC;AACpE,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAC7C,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAEnE,eAAO,MAAM,WAAW,oFAAsF,CAAC"}
\ No newline at end of file
+{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;CAAG;AAC5C,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,0BAA0B,4BAA4B,CAAC;AACpE,eAAO,MAAM,aAAa,gBAAgB,CAAC;AAC3C,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAC7C,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,2BAA2B,6BAA6B,CAAC;AAEtE,eAAO,MAAM,WAAW,oFAAsF,CAAC"}
\ No newline at end of file Index: package/out/ui-modifications/types/errors.d.ts.map
===================================================================
--- package/out/ui-modifications/types/errors.d.ts.map
+++ package/out/ui-modifications/types/errors.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/ui-modifications/types/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACpE,MAAM,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AAC9E,MAAM,MAAM,oCAAoC,GAAG,sCAAsC,CAAC;AAE1F,MAAM,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC9D,MAAM,MAAM,kCAAkC,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,uCAAuC,GAAG,YAAY,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAC;AAElD,MAAM,MAAM,YAAY,GACpB,yBAAyB,GACzB,2BAA2B,GAC3B,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,wBAAwB,CAAC;AAE7B,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,oCAAoC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B;IACE,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,kCAAkC,CAAC;IAC1C,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB,GACD;IACE,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,uCAAuC,CAAC;IAC/C,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/ui-modifications/types/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACpE,MAAM,MAAM,g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AAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,uCAAuC,CAAC;IAC/C,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
\ No newline at end of file Index: package/out/custom-field/index.d.ts.map
===================================================================
--- package/out/custom-field/index.d.ts.map
+++ package/out/custom-field/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvF,eAAO,MAAM,cAAc;;;CAM1B,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,cAAc;;;;CAO1B,CAAC"}
\ No newline at end of file Index: package/out/custom-field/types.d.ts.map
===================================================================
--- package/out/custom-field/types.d.ts.map
+++ package/out/custom-field/types.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/custom-field/types.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AC,IAAI,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE;QAEP,mBAAmB,CAAC,EAAE,CAAC,CAAC,SAAS,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAM1G,iBAAiB,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,KAAK,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAAC;QAChH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,KAAK,IAAI,CAAC;KACtE,CAAC;CACH"}
\ No newline at end of file Index: package/CHANGELOG.md
===================================================================
--- package/CHANGELOG.md
+++ package/CHANGELOG.md
@@ -1,6 +1,12 @@
# @forge/jira-bridge
+## 1.3.0-next.1
+
+### Minor Changes
+
+- 0d2fbdb: Add customFieldApi.registerUIMHandlers for owner validation in mounted custom-field runtimes, with independently optional value and visibility handlers, explicit unsupported-host errors and asynchronous cleanup.
+
## 1.3.0-next.0
### Minor Changes Index: package/README.md
===================================================================
--- package/README.md
+++ package/README.md
@@ -1,2 +1,53 @@
# 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.
+
+```ts
+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. Index: package/out/errors.d.ts
===================================================================
--- package/out/errors.d.ts
+++ package/out/errors.d.ts
@@ -6,6 +6,7 @@
export declare const SUBSCRIBE_TO_CHANGES_ERROR = "subscribeToChangesError";
export declare const GET_API_ERROR = "getApiError";
export declare const ON_ERROR_ERROR = "onErrorError";
export declare const ON_FIELD_DATA_CHANGE_ERROR = "onFieldDataChangeError";
+export declare const REGISTER_UIM_HANDLERS_ERROR = "registerUIMHandlersError";
export declare const ERROR_TYPES: readonly ["onInitError", "subscribeToChangesError", "getApiError", "onErrorError"];
//# sourceMappingURL=errors.d.ts.map
\ No newline at end of file Index: package/out/ui-modifications/types/errors.d.ts
===================================================================
--- package/out/ui-modifications/types/errors.d.ts
+++ package/out/ui-modifications/types/errors.d.ts
@@ -1,13 +1,14 @@
-import { Field, FieldId, FieldType } from './field-api';
+import type { Field, FieldId, FieldType } from './field-api';
export type FIELD_VALIDATION_ERROR_TYPE = 'FIELD_VALIDATION_FAILED';
export type SCREENTABS_VALIDATION_ERROR_TYPE = 'SCREENTABS_VALIDATION_FAILED';
export type APPLY_CHANGES_FOR_UNREGISTERED_FIELD = 'APPLY_CHANGES_FOR_UNREGISTERED_FIELD';
export type MULTIPLE_APPS_CONFLICT = 'MULTIPLE_APPS_CONFLICT';
export type MULTIPLE_APPS_CONFLICT_CAUSE_FIELD = 'FIELD';
export type MULTIPLE_APPS_CONFLICT_CAUSE_SCREENTABS = 'SCREENTABS';
export type LifecycleHook = 'onInit' | 'onChange';
-export type FcfErrorCode = 'FCF_HANDLER_UNAVAILABLE' | 'FCF_OPERATION_UNSUPPORTED' | 'FCF_OPERATION_DENIED' | 'FCF_HANDLER_TIMEOUT' | 'FCF_HANDLER_FAILED' | 'FCF_INVALID_RESULT' | 'FCF_STALE_CONTEXT' | 'FCF_PERSISTENCE_FAILED';
+export declare const FCF_ERROR_CODES: readonly ["FCF_HANDLER_UNAVAILABLE", "FCF_UIM_HANDLERS_UNSUPPORTED", "FCF_OPERATION_UNSUPPORTED", "FCF_OPERATION_DENIED", "FCF_HANDLER_TIMEOUT", "FCF_HANDLER_FAILED", "FCF_INVALID_RESULT", "FCF_STALE_CONTEXT", "FCF_PERSISTENCE_FAILED"];
+export type FcfErrorCode = (typeof FCF_ERROR_CODES)[number];
export type ValidationError = {
type: FIELD_VALIDATION_ERROR_TYPE;
fieldId: string;
fieldType: string; Index: package/out/custom-field/index.d.ts
===================================================================
--- package/out/custom-field/index.d.ts
+++ package/out/custom-field/index.d.ts
@@ -1,8 +1,12 @@
+import { registerUIMHandlers } from './registerUIMHandlers';
import { getFieldData } from './getFieldData';
import { subscribeToFieldData } from './subscribeToFieldData';
-export type { FieldData, FieldDataSubscription, JsonObject, JsonValue } from './types';
+export { isFcfError } from './registerUIMHandlers';
+export type { FcfError } from './registerUIMHandlers';
+export type { FieldData, FieldDataSubscription, JsonObject, JsonValue, UIMHandlers, UIMHandlerContext, UIMHandlerResult, UIMHandlerRegistration } from './types';
export declare const customFieldApi: {
+ registerUIMHandlers: typeof registerUIMHandlers;
subscribeToFieldData: typeof subscribeToFieldData;
getFieldData: typeof getFieldData;
};
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file Index: package/out/custom-field/types.d.ts
===================================================================
--- package/out/custom-field/types.d.ts
+++ package/out/custom-field/types.d.ts
@@ -1,6 +1,30 @@
import type { OptionsVisibility } from '../ui-modifications/types/field-api';
+import type { JsonObject } from '../types/json';
export type { JsonObject, JsonValue } from '../types/json';
+export type UIMHandlerResult<T> = {
+ accepted: true;
+ value: T;
+} | {
+ accepted: false;
+ code: string;
+ message?: string;
+};
+export type UIMHandlerContext<T> = {
+ callerAppId: string;
+ fieldId: string;
+ requestId: string;
+ renderContext: 'issue-create' | 'issue-view' | 'issue-transition';
+ currentValue: T | null;
+ optionsVisibility: OptionsVisibility | undefined;
+};
+export type UIMHandlers<T extends JsonObject> = {
+ setValue?: (proposedValue: T | null, context: UIMHandlerContext<T>) => UIMHandlerResult<T | null> | Promise<UIMHandlerResult<T | null>>;
+ setOptionsVisibility?: (proposedVisibility: OptionsVisibility, context: UIMHandlerContext<T>) => UIMHandlerResult<OptionsVisibility> | Promise<UIMHandlerResult<OptionsVisibility>>;
+};
+export type UIMHandlerRegistration = {
+ unregister(): Promise<void>;
+};
export type FieldData = {
fieldValue: unknown;
optionsVisibility?: OptionsVisibility;
revision?: number;
@@ -12,8 +36,9 @@
unsubscribe: () => void | Promise<void>;
};
export interface CustomFieldInternalAPI {
actions: {
+ registerUIMHandlers?: <T extends JsonObject>(handlers: UIMHandlers<T>) => Promise<UIMHandlerRegistration>;
onFieldDataChange: (callback: (fieldData: FieldData) => void) => Promise<HostFieldDataSubscription | undefined>;
onBridgeError?: (payload: {
error: string;
cause: unknown;