@forge/bridge
Advanced tools
Comparing version 1.1.0 to 1.2.0-next.0
# @forge/bridge | ||
## 1.2.0-next.0 | ||
### Minor Changes | ||
- 3bc0722: Add getContext method | ||
## 1.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -1,23 +0,3 @@ | ||
declare type InvokePayload = { | ||
[key in number | string]: any; | ||
}; | ||
declare type InvokeResponse = Record<string, any> | void; | ||
export declare const invoke: <T = InvokeResponse>(functionKey: string, payload?: InvokePayload | undefined) => Promise<T>; | ||
export declare type ProductResponse = { | ||
body: any; | ||
} & Pick<Response, 'ok' | 'status' | 'statusText'>; | ||
export declare const requestJira: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>; | ||
export declare const requestConfluence: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>; | ||
export declare const view: { | ||
close: () => Promise<void>; | ||
}; | ||
declare const _default: { | ||
invoke: <T = InvokeResponse>(functionKey: string, payload?: InvokePayload | undefined) => Promise<T>; | ||
requestJira: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>; | ||
requestConfluence: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>; | ||
view: { | ||
close: () => Promise<void>; | ||
}; | ||
}; | ||
export default _default; | ||
export * from './invoke'; | ||
export * from './view'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.view = exports.requestConfluence = exports.requestJira = exports.invoke = void 0; | ||
var tslib_1 = require("tslib"); | ||
var errors_1 = require("./errors"); | ||
var bridge_1 = require("./bridge"); | ||
var callBridge = bridge_1.getCallBridge(); | ||
var validatePayload = function (payload) { | ||
if (!payload) | ||
return; | ||
if (Object.values(payload).some(function (val) { return typeof val === 'function'; })) { | ||
throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!'); | ||
} | ||
}; | ||
exports.invoke = function (functionKey, payload) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (typeof functionKey !== 'string') { | ||
throw new errors_1.BridgeAPIError('functionKey must be a string!'); | ||
} | ||
validatePayload(payload); | ||
return [4, callBridge('invoke', { functionKey: functionKey, payload: payload })]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); }; | ||
exports.requestJira = function (fetchUrl, fetchOptions) { | ||
return exports.invoke('__request', { product: 'jira', fetchUrl: fetchUrl, fetchOptions: fetchOptions }); | ||
}; | ||
exports.requestConfluence = function (fetchUrl, fetchOptions) { | ||
return exports.invoke('__request', { product: 'confluence', fetchUrl: fetchUrl, fetchOptions: fetchOptions }); | ||
}; | ||
var close = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var success, e_1; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4, callBridge('close')]; | ||
case 1: | ||
success = _a.sent(); | ||
if (success === false) { | ||
throw new errors_1.BridgeAPIError("this resource's view is not closable."); | ||
} | ||
return [3, 3]; | ||
case 2: | ||
e_1 = _a.sent(); | ||
throw new errors_1.BridgeAPIError("this resource's view is not closable."); | ||
case 3: return [2]; | ||
} | ||
}); | ||
}); }; | ||
exports.view = { | ||
close: close | ||
}; | ||
exports.default = { | ||
invoke: exports.invoke, | ||
requestJira: exports.requestJira, | ||
requestConfluence: exports.requestConfluence, | ||
view: exports.view | ||
}; | ||
tslib_1.__exportStar(require("./invoke"), exports); | ||
tslib_1.__exportStar(require("./view"), exports); |
{ | ||
"name": "@forge/bridge", | ||
"version": "1.1.0", | ||
"version": "1.2.0-next.0", | ||
"description": "Forge bridge API for custom UI apps", | ||
@@ -5,0 +5,0 @@ "author": "Atlassian", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10825
39
143
2
1