npm package diff

Package: @forge/bridge

Versions: 5.8.0-next.12-experimental-f85d28a - 5.8.0-next.13

Modified: package/out/object-store/index.js

Index: package/out/object-store/index.js
===================================================================
--- package/out/object-store/index.js
+++ package/out/object-store/index.js
@@ -1,4 +1,5 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
 const tslib_1 = require("tslib");
 tslib_1.__exportStar(require("./objectStore"), exports);
+tslib_1.__exportStar(require("./types"), exports);

Modified: package/out/object-store/objectStore.js

Index: package/out/object-store/objectStore.js
===================================================================
--- package/out/object-store/objectStore.js
+++ package/out/object-store/objectStore.js
@@ -1,8 +1,9 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.objectStore = void 0;
+exports.createUploadPromises = exports.objectStore = void 0;
 const upload_1 = require("./upload");
+Object.defineProperty(exports, "createUploadPromises", { enumerable: true, get: function () { return upload_1.createUploadPromises; } });
 const deleteObjects_1 = require("./deleteObjects");
 const download_1 = require("./download");
 const getMetadata_1 = require("./getMetadata");
 exports.objectStore = {

Modified: package/out/object-store/upload.js

Index: package/out/object-store/upload.js
===================================================================
--- package/out/object-store/upload.js
+++ package/out/object-store/upload.js
@@ -1,7 +1,7 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.upload = void 0;
+exports.upload = exports.createUploadPromises = void 0;
 const invoke_1 = require("../invoke");
 const errors_1 = require("../errors");
 const base64ToBlob = (base64, mimeType) => {
     const byteCharacters = atob(base64);
@@ -24,9 +24,9 @@
         checksum,
         checksumType
     };
 };
-const upload = async ({ functionKey, objects }) => {
+const createUploadPromises = async ({ functionKey, objects }) => {
     if (!functionKey || functionKey.length === 0) {
         throw new errors_1.BridgeAPIError('functionKey is required to filter and generate presigned URLs');
     }
     if (!Array.isArray(objects) || objects.length === 0) {
@@ -54,47 +54,71 @@
     if (!presignedURLsToObjectMetadata || typeof presignedURLsToObjectMetadata !== 'object') {
         throw new errors_1.BridgeAPIError('Invalid response from functionKey');
     }
     const checksumToBlobMap = new Map();
+    const checksumToIndexMap = new Map();
     blobs.forEach((blob, index) => {
         const metadata = allObjectMetadata[index];
         checksumToBlobMap.set(metadata.checksum, blob);
+        checksumToIndexMap.set(metadata.checksum, index);
     });
-    const uploadPromises = Object.entries(presignedURLsToObjectMetadata).map(async ([presignedUrl, metadata]) => {
-        const { key, length, checksum } = metadata;
+    const uploadPromises = Object.entries(presignedURLsToObjectMetadata).map(([presignedUrl, metadata]) => {
+        const { key, checksum } = metadata;
         const object = checksumToBlobMap.get(checksum);
-        if (!object) {
+        const index = checksumToIndexMap.get(checksum);
+        if (index === undefined) {
             return {
-                success: false,
-                key: key,
-                error: `Blob not found for checksum ${checksum}`
+                promise: Promise.resolve({
+                    success: false,
+                    key: key,
+                    error: `Index not found for checksum ${checksum}`
+                }),
+                index: -1
             };
         }
-        try {
-            const response = await fetch(presignedUrl, {
-                method: 'PUT',
-                body: object,
-                headers: {
-                    'Content-Type': object.type || 'application/octet-stream',
-                    'Content-Length': length.toString()
-                }
-            });
+        if (!object) {
             return {
-                success: response.ok,
-                key: key,
-                status: response.status,
-                error: response.ok ? undefined : `Upload failed with status ${response.status}`
+                promise: Promise.resolve({
+                    success: false,
+                    key: key,
+                    error: `Blob not found for checksum ${checksum}`
+                }),
+                index
             };
         }
-        catch (error) {
-            return {
-                success: false,
-                key: key,
-                status: 503,
-                error: error instanceof Error ? error.message : 'Upload failed'
-            };
-        }
+        const uploadPromise = (async () => {
+            try {
+                const response = await fetch(presignedUrl, {
+                    method: 'PUT',
+                    body: object,
+                    headers: {
+                        'Content-Type': object.type || 'application/octet-stream',
+                        'Content-Length': object.size.toString()
+                    }
+                });
+                return {
+                    success: response.ok,
+                    key: key,
+                    status: response.status,
+                    error: response.ok ? undefined : `Upload failed with status ${response.status}`
+                };
+            }
+            catch (error) {
+                return {
+                    success: false,
+                    key: key,
+                    status: 503,
+                    error: error instanceof Error ? error.message : 'Upload failed'
+                };
+            }
+        })();
+        return { promise: uploadPromise, index, objectType: object.type, objectSize: object.size };
     });
-    const results = await Promise.all(uploadPromises);
+    return uploadPromises;
+};
+exports.createUploadPromises = createUploadPromises;
+const upload = async ({ functionKey, objects }) => {
+    const uploadPromises = await (0, exports.createUploadPromises)({ functionKey, objects });
+    const results = await Promise.all(uploadPromises.map((item) => item.promise));
     return results;
 };
 exports.upload = upload;

Modified: package/package.json

Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
 {
   "name": "@forge/bridge",
-  "version": "5.8.0-next.12-experimental-f85d28a",
+  "version": "5.8.0-next.13",
   "description": "Forge bridge API for custom UI apps",
   "author": "Atlassian",
   "license": "SEE LICENSE IN LICENSE.txt",
   "main": "out/index.js",
@@ -17,9 +17,9 @@
     "@forge/i18n": "0.0.7",
     "@forge/resolver": "1.7.1",
     "@statsig/js-client": "3.18.2",
     "@types/history": "^4.7.11",
-    "@forge/manifest": "11.0.0-next.7-experimental-f85d28a"
+    "@forge/manifest": "11.0.0-next.8"
   },
   "devDependencies": {
     "history": "5.3.0",
     "isomorphic-fetch": "^3.0.0",

Modified: package/out/object-store/index.d.ts.map

Index: package/out/object-store/index.d.ts.map
===================================================================
--- package/out/object-store/index.d.ts.map
+++ package/out/object-store/index.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/object-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
\ No newline at end of file

Modified: package/out/object-store/objectStore.d.ts.map

Index: package/out/object-store/objectStore.d.ts.map
===================================================================
--- package/out/object-store/objectStore.d.ts.map
+++ package/out/object-store/objectStore.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"objectStore.d.ts","sourceRoot":"","sources":["../../src/object-store/objectStore.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;CAKvB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"objectStore.d.ts","sourceRoot":"","sources":["../../src/object-store/objectStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKxD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;CAKvB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
\ No newline at end of file

Modified: package/out/object-store/types.d.ts.map

Index: package/out/object-store/types.d.ts.map
===================================================================
--- package/out/object-store/types.d.ts.map
+++ package/out/object-store/types.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/object-store/types.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,YAAY,GAAG,IAAI,GAAG,YAAY,CAAC;AAE/C,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ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C;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE3D,oBAAY,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
\ No newline at end of file

Modified: package/out/object-store/upload.d.ts.map

Index: package/out/object-store/upload.d.ts.map
===================================================================
--- package/out/object-store/upload.d.ts.map
+++ package/out/object-store/upload.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/object-store/upload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuC,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA4C/F,eAAO,MAAM,MAAM;iBAIJ,MAAM;aACV,YAAY,EAAE;MACrB,QAAQ,YAAY,EAAE,CAuFzB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/object-store/upload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6ClH,eAAO,MAAM,oBAAoB;iBAIlB,MAAM;aACV,YAAY,EAAE;MACrB,QAAQ,iBAAiB,EAAE,CA0G9B,CAAC;AAUF,eAAO,MAAM,MAAM;iBAIJ,MAAM;aACV,YAAY,EAAE;MACrB,QAAQ,YAAY,EAAE,CAIzB,CAAC"}
\ No newline at end of file

Modified: package/CHANGELOG.md

Index: package/CHANGELOG.md
===================================================================
--- package/CHANGELOG.md
+++ package/CHANGELOG.md
@@ -1,27 +1,17 @@
 # @forge/bridge
 
-## 5.8.0-next.12-experimental-f85d28a
+## 5.8.0-next.13
 
 ### Minor Changes
 
-- 1d129f0: Allow objects in event payloads. The object must be JSON-serializable.
-- 08fbb0a: Add rovo.open bridge method that opens rovo chat
-- 617c3d9: Add base64 support to upload bridge method
-- a4bccb7: Export FOS bridge methods and fixing bugs
+- f23a84e: Add useObjectStore hook
 
 ### Patch Changes
 
-- fe20eb0: Changing export names
-- Updated dependencies [0a3f5d5]
-- Updated dependencies [9a6d346]
-- Updated dependencies [260eb24]
-- Updated dependencies [3228cf0]
-- Updated dependencies [8962080]
-- Updated dependencies [f0a5a03]
-- Updated dependencies [d00ef59]
-- Updated dependencies [78efec7]
-  - @forge/[email protected]
+- Updated dependencies [24bd686]
+- Updated dependencies [2011ffe]
+  - @forge/[email protected]
 
 ## 5.8.0-next.12
 
 ### Patch Changes

Modified: package/out/object-store/index.d.ts

Index: package/out/object-store/index.d.ts
===================================================================
--- package/out/object-store/index.d.ts
+++ package/out/object-store/index.d.ts
@@ -1,2 +1,3 @@
 export * from './objectStore';
+export * from './types';
 //# sourceMappingURL=index.d.ts.map
\ No newline at end of file

Modified: package/out/object-store/objectStore.d.ts

Index: package/out/object-store/objectStore.d.ts
===================================================================
--- package/out/object-store/objectStore.d.ts
+++ package/out/object-store/objectStore.d.ts
@@ -1,4 +1,5 @@
+import { createUploadPromises } from './upload';
 export declare const objectStore: {
     upload: ({ functionKey, objects }: {
         functionKey: string;
         objects: import("./types").UploadObject[];
@@ -15,5 +16,6 @@
         functionKey: string;
         keys: string[];
     }) => Promise<void>;
 };
+export { createUploadPromises };
 //# sourceMappingURL=objectStore.d.ts.map
\ No newline at end of file

Modified: package/out/object-store/types.d.ts

Index: package/out/object-store/types.d.ts
===================================================================
--- package/out/object-store/types.d.ts
+++ package/out/object-store/types.d.ts
@@ -5,8 +5,9 @@
 };
 export declare type Base64Object = {
     data: string;
     mimeType?: string;
+    fileSize?: number;
 };
 export declare type UploadObject = Blob | Base64Object;
 export declare type FileMetadata = ObjectMetadata & {
     key: string;
@@ -18,8 +19,14 @@
     key: string;
     status?: number;
     error?: string;
 };
+export declare type UploadPromiseItem = {
+    promise: Promise<UploadResult>;
+    index: number;
+    objectType?: string;
+    objectSize?: number;
+};
 export declare type DownloadResult = {
     success: boolean;
     key: string;
     blob?: Blob;

Modified: package/out/object-store/upload.d.ts

Index: package/out/object-store/upload.d.ts
===================================================================
--- package/out/object-store/upload.d.ts
+++ package/out/object-store/upload.d.ts
@@ -1,5 +1,9 @@
-import type { UploadResult, UploadObject } from './types';
+import type { UploadResult, UploadObject, UploadPromiseItem } from './types';
+export declare const createUploadPromises: ({ functionKey, objects }: {
+    functionKey: string;
+    objects: UploadObject[];
+}) => Promise<UploadPromiseItem[]>;
 export declare const upload: ({ functionKey, objects }: {
     functionKey: string;
     objects: UploadObject[];
 }) => Promise<UploadResult[]>;