@forge/bridge
Advanced tools
Comparing version 2.1.0 to 2.1.1-next.0
# @forge/bridge | ||
## 2.1.1-next.0 | ||
### Patch Changes | ||
- abf359f: Enable requestJira and requestConfluence in Forge bridge to generate correct content type for form data | ||
## 2.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -5,16 +5,8 @@ "use strict"; | ||
var tslib_1 = require("tslib"); | ||
var isHeadersInstance = function (headers) { | ||
return headers.entries !== undefined; | ||
}; | ||
var parseHeaders = function (headers) { | ||
if (!headers) | ||
return {}; | ||
return isHeadersInstance(headers) ? Object.fromEntries(headers.entries()) : headers; | ||
}; | ||
var parseBody = function (init) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var req, _a; | ||
var parseBodyAndHeaders = function (init) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var req, body, _a, headers; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
req = new Request('', { body: init === null || init === void 0 ? void 0 : init.body, method: init === null || init === void 0 ? void 0 : init.method }); | ||
req = new Request('', { body: init === null || init === void 0 ? void 0 : init.body, method: init === null || init === void 0 ? void 0 : init.method, headers: init === null || init === void 0 ? void 0 : init.headers }); | ||
if (!(req.method !== 'GET')) return [3, 2]; | ||
@@ -28,3 +20,9 @@ return [4, req.text()]; | ||
_b.label = 3; | ||
case 3: return [2, _a]; | ||
case 3: | ||
body = _a; | ||
headers = Object.fromEntries(req.headers.entries()); | ||
return [2, { | ||
body: body, | ||
headers: headers | ||
}]; | ||
} | ||
@@ -35,5 +33,5 @@ }); | ||
var fetch = function (product, restPath, init) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var fetchPayload, _a, _b, _c, _d, body, headers, statusText, status; | ||
return tslib_1.__generator(this, function (_e) { | ||
switch (_e.label) { | ||
var fetchPayload, _a, _b, _c, body, headers, statusText, status; | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
@@ -45,10 +43,9 @@ _a = { | ||
_b = [tslib_1.__assign({}, init)]; | ||
_c = {}; | ||
return [4, parseBody(init)]; | ||
return [4, parseBodyAndHeaders(init)]; | ||
case 1: | ||
fetchPayload = (_a.fetchRequestInit = tslib_1.__assign.apply(void 0, _b.concat([(_c.body = _e.sent(), _c.headers = parseHeaders(init === null || init === void 0 ? void 0 : init.headers), _c)])), | ||
fetchPayload = (_a.fetchRequestInit = tslib_1.__assign.apply(void 0, _b.concat([(_d.sent())])), | ||
_a); | ||
return [4, callBridge('fetchProduct', fetchPayload)]; | ||
case 2: | ||
_d = _e.sent(), body = _d.body, headers = _d.headers, statusText = _d.statusText, status = _d.status; | ||
_c = _d.sent(), body = _c.body, headers = _c.headers, statusText = _c.statusText, status = _c.status; | ||
return [2, new Response(body || null, { headers: headers, status: status, statusText: statusText })]; | ||
@@ -55,0 +52,0 @@ } |
{ | ||
"name": "@forge/bridge", | ||
"version": "2.1.0", | ||
"version": "2.1.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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23838
360
2