@forge/bridge
Advanced tools
Comparing version 1.0.0 to 1.0.1-next.0
# @forge/bridge | ||
## 1.0.1-next.0 | ||
### Patch Changes | ||
- 14b6ef7: Remove retriable invoke as is no longer necessary with bridge core handshake | ||
## 1.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -6,3 +6,4 @@ "use strict"; | ||
var errors_1 = require("./errors"); | ||
var delay = function (time) { return Promise.resolve(function (res) { return setTimeout(res, time); }); }; | ||
var bridge_1 = require("./bridge"); | ||
var callBridge = bridge_1.getCallBridge(); | ||
var validatePayload = function (payload) { | ||
@@ -15,40 +16,15 @@ if (!payload) | ||
}; | ||
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]; | ||
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!'); | ||
} | ||
}); | ||
}); | ||
}; | ||
return retriableInvoke(); | ||
}; | ||
validatePayload(payload); | ||
return [4, callBridge('invoke', { functionKey: functionKey, payload: payload })]; | ||
case 1: return [2, _a.sent()]; | ||
} | ||
}); | ||
}); }; | ||
exports.requestJira = function (fetchUrl, fetchOptions) { | ||
@@ -55,0 +31,0 @@ return exports.invoke('__request', { product: 'jira', fetchUrl: fetchUrl, fetchOptions: fetchOptions }); |
{ | ||
"name": "@forge/bridge", | ||
"version": "1.0.0", | ||
"version": "1.0.1-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
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
7251
12
2
6357
75
2