@forge/bridge
Advanced tools
Comparing version 0.0.0-experimental-788b6d9 to 0.0.0-experimental-79fda5a
128
CHANGELOG.md
# @forge/bridge | ||
## 0.0.0-experimental-788b6d9 | ||
## 0.0.0-experimental-79fda5a | ||
### Minor Changes | ||
- 05977d4: Add modal api | ||
## 1.5.0-next.0 | ||
### Minor Changes | ||
- 05977d4: Add modal api | ||
## 1.4.0 | ||
### Minor Changes | ||
- 6bb4c77: router.open and router.navigate are now supported in Confluence | ||
## 1.4.0-next.0 | ||
### Minor Changes | ||
- 6bb4c77: router.open and router.navigate are now supported in Confluence | ||
## 1.3.0 | ||
### Minor Changes | ||
- 69e2a9e: Expose router.open for opening external links in new tabs | ||
- fbc16b0: Add router.navigate to bridge | ||
### Patch Changes | ||
- 180e45a: Throw error if router is used from confluence | ||
- ff35ac9: Check for Jira instead of Confluence | ||
## 1.3.0-next.3 | ||
### Patch Changes | ||
- ff35ac9: Check for Jira instead of Confluence | ||
## 1.3.0-next.2 | ||
### Minor Changes | ||
- 69e2a9e: Expose router.open for opening external links in new tabs | ||
## 1.3.0-next.1 | ||
### Patch Changes | ||
- 180e45a: Throw error if router is used from confluence | ||
## 1.3.0-next.0 | ||
### Minor Changes | ||
- fbc16b0: Add router.navigate to bridge | ||
## 1.2.0 | ||
### Minor Changes | ||
- 74a0279: Add getContext method | ||
### Patch Changes | ||
- 74a0279: Rate limit invoke calls | ||
## 1.2.0-next.1 | ||
### Patch Changes | ||
- 001a027: Rate limit invoke calls | ||
## 1.2.0-next.0 | ||
### Minor Changes | ||
- 3bc0722: Add getContext method | ||
## 1.1.0 | ||
### Minor Changes | ||
- 83c2eec: New view.close() method for closing modals | ||
### Patch Changes | ||
- 14b6ef7: Remove retriable invoke as is no longer necessary with bridge core handshake | ||
## 1.1.0-next.1 | ||
### Minor Changes | ||
- 83c2eec: New view.close() method for closing modals | ||
## 1.0.1-next.0 | ||
### Patch Changes | ||
- 14b6ef7: Remove retriable invoke as is no longer necessary with bridge core handshake | ||
## 1.0.0 | ||
### Major Changes | ||
- 1daf2c5: Forge packages to 1.0.0 for upcoming platform GA 🎉 | ||
## 1.0.0-next.0 | ||
### Major Changes | ||
- 1daf2c5: Forge is now generally available 🎉 | ||
## 0.2.1 | ||
### Patch Changes | ||
- 5b666a5: Fix published content | ||
## 0.2.1-next.0 | ||
### Patch Changes | ||
- 5b666a5: Fix published content | ||
## 0.2.0 | ||
@@ -6,0 +132,0 @@ |
@@ -1,17 +0,5 @@ | ||
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>; | ||
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>; | ||
}; | ||
export default _default; | ||
export * from './invoke'; | ||
export * from './view'; | ||
export * from './router'; | ||
export * from './modal'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.requestConfluence = exports.requestJira = exports.invoke = void 0; | ||
var tslib_1 = require("tslib"); | ||
var errors_1 = require("./errors"); | ||
var delay = function (time) { return Promise.resolve(function (res) { return setTimeout(res, time); }); }; | ||
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!'); | ||
} | ||
}; | ||
var MAX_INVOKE_RETRIES = 10; | ||
exports.invoke = function (functionKey, payload) { | ||
if (typeof functionKey !== 'string') { | ||
throw new errors_1.BridgeAPIError('functionKey must be a string!'); | ||
} | ||
validatePayload(payload); | ||
var callBridge = window.__bridge.callBridge; | ||
var retriableInvoke = function (retryCount) { | ||
if (retryCount === void 0) { retryCount = MAX_INVOKE_RETRIES; } | ||
return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var error_1; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (retryCount <= 0) { | ||
throw new errors_1.BridgeAPIError("\n Unable to call invoke(). Product handler for this event was not found or is not ready yet\n "); | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 7]); | ||
return [4, callBridge('invoke', { functionKey: functionKey, payload: payload })]; | ||
case 2: return [2, _a.sent()]; | ||
case 3: | ||
error_1 = _a.sent(); | ||
if (!(error_1 === null || error_1 === void 0 ? void 0 : error_1.message.startsWith('No handler found for post message: invoke'))) return [3, 5]; | ||
return [4, delay((MAX_INVOKE_RETRIES - retryCount + 1) * 100)]; | ||
case 4: | ||
_a.sent(); | ||
return [2, retriableInvoke(--retryCount)]; | ||
case 5: throw error_1; | ||
case 6: return [3, 7]; | ||
case 7: return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return retriableInvoke(); | ||
}; | ||
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 }); | ||
}; | ||
exports.default = { | ||
invoke: exports.invoke, | ||
requestJira: exports.requestJira, | ||
requestConfluence: exports.requestConfluence | ||
}; | ||
tslib_1.__exportStar(require("./invoke"), exports); | ||
tslib_1.__exportStar(require("./view"), exports); | ||
tslib_1.__exportStar(require("./router"), exports); | ||
tslib_1.__exportStar(require("./modal"), exports); |
{ | ||
"name": "@forge/bridge", | ||
"version": "0.0.0-experimental-788b6d9", | ||
"version": "0.0.0-experimental-79fda5a", | ||
"description": "Forge bridge API for custom UI apps", | ||
@@ -9,3 +9,2 @@ "author": "Atlassian", | ||
"types": "out/index.d.ts", | ||
"files": ["out"], | ||
"scripts": { | ||
@@ -15,3 +14,6 @@ "build": "yarn run clean && yarn run compile", | ||
"compile": "tsc -b -v" | ||
}, | ||
"devDependencies": { | ||
"jest-date-mock": "^1.0.8" | ||
} | ||
} |
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
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
18576
54
270
1
1