npm package diff

Package: @forge/bridge

Versions: 4.0.0 - 4.0.1-next.0

File: package/out/fetch/fetch.js

Index: package/out/fetch/fetch.js
===================================================================
--- package/out/fetch/fetch.js
+++ package/out/fetch/fetch.js
@@ -1,53 +1,56 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.productFetchApi = void 0;
-const tslib_1 = require("tslib");
 const blobParser_1 = require("../utils/blobParser");
-const parseFormData = (form) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
+const parseFormData = async (form) => {
     const parsed = {};
     for (const [key, value] of form.entries()) {
         if (key === 'file') {
             const fileName = value.name;
             const fileType = value.type;
-            parsed['file'] = yield (0, blobParser_1.blobToBase64)(value);
+            parsed['file'] = await (0, blobParser_1.blobToBase64)(value);
             parsed['__fileName'] = fileName;
             parsed['__fileType'] = fileType;
         }
         else {
             parsed[key] = value;
         }
     }
     return JSON.stringify(parsed);
-});
-const parseRequest = (init) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
+};
+const parseRequest = async (init) => {
     const isFormData = (init === null || init === void 0 ? void 0 : init.body) instanceof FormData ? true : false;
-    const requestBody = isFormData ? yield parseFormData(init === null || init === void 0 ? void 0 : init.body) : init === null || init === void 0 ? void 0 : init.body;
+    const requestBody = isFormData ? await parseFormData(init === null || init === void 0 ? void 0 : init.body) : init === null || init === void 0 ? void 0 : init.body;
     const req = new Request('', { body: requestBody, method: init === null || init === void 0 ? void 0 : init.method, headers: init === null || init === void 0 ? void 0 : init.headers });
     const headers = Object.fromEntries(req.headers.entries());
-    const body = req.method !== 'GET' ? yield req.text() : null;
+    const body = req.method !== 'GET' ? await req.text() : null;
     return {
         body,
         headers: new Headers(headers),
         isMultipartFormData: isFormData
     };
-});
+};
 const productFetchApi = (callBridge) => {
-    const fetch = (product, restPath, init) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
-        const { body: requestBody, headers: requestHeaders, isMultipartFormData } = yield parseRequest(init);
+    const fetch = async (product, restPath, init) => {
+        const { body: requestBody, headers: requestHeaders, isMultipartFormData } = await parseRequest(init);
         if (!requestHeaders.has('X-Atlassian-Token')) {
             requestHeaders.set('X-Atlassian-Token', 'no-check');
         }
         const fetchPayload = {
             product,
             restPath,
-            fetchRequestInit: Object.assign(Object.assign({}, init), { body: requestBody, headers: [...requestHeaders.entries()] }),
+            fetchRequestInit: {
+                ...init,
+                body: requestBody,
+                headers: [...requestHeaders.entries()]
+            },
             isMultipartFormData
         };
-        const { body, headers, statusText, status, isAttachment } = yield callBridge('fetchProduct', fetchPayload);
+        const { body, headers, statusText, status, isAttachment } = await callBridge('fetchProduct', fetchPayload);
         const responseBody = isAttachment ? (0, blobParser_1.base64ToBlob)(body, headers['content-type']) : body;
         return new Response(responseBody || null, { headers, status, statusText });
-    });
+    };
     return {
         requestConfluence: (restPath, fetchOptions) => fetch('confluence', restPath, fetchOptions),
         requestJira: (restPath, fetchOptions) => fetch('jira', restPath, fetchOptions),
         requestBitbucket: (restPath, fetchOptions) => fetch('bitbucket', restPath, fetchOptions)