@forge/bridge
6.0.1-next.2-experimental-9423de16.0.1-next.3
~
Modified (4 files)
Index: package/out/invoke/invoke.js
===================================================================
--- package/out/invoke/invoke.js
+++ package/out/invoke/invoke.js
@@ -12,42 +12,16 @@
if (Object.values(payload).some((val) => typeof val === 'function')) {
throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!');
}
};
-/**
- * While the rate limit metadata feature is being rolled out, the bridge may return either
- * the resolver body directly or an object of shape `{ body, metadata }`, where the
- * rate limit fields are reported under `metadata`.
- */
-const isMetadataWrappedResponse = (response) => {
- if (typeof response !== 'object' || response === null) {
- return false;
- }
- const keys = Object.keys(response);
- return keys.length === 2 && keys.includes('body') && keys.includes('metadata');
-};
const _invoke = async (functionKey, payload, metadata) => {
- var _a;
if (typeof functionKey !== 'string') {
throw new errors_1.BridgeAPIError('functionKey must be a string!');
}
validatePayload(payload);
- const response = await callBridge('invoke', { functionKey, payload });
- // If metadata is requested, return the response wrapped in metadata.
- if (metadata) {
- // If the bridge response is not wrapped in metadata, return the metadata field as undefined.
- if (!isMetadataWrappedResponse(response)) {
- return { body: response, metadata: undefined };
- }
- const requestedMetadataKeys = Object.keys(metadata !== null && metadata !== void 0 ? metadata : {}).filter((key) => (metadata === null || metadata === void 0 ? void 0 : metadata[key]) === true);
- const responseMetadata = {};
- for (const key of requestedMetadataKeys) {
- responseMetadata[key] = (_a = response.metadata) === null || _a === void 0 ? void 0 : _a[key];
- }
- return { body: response.body, metadata: responseMetadata };
- }
- // If metadata is not requested, return the response directly.
- return (isMetadataWrappedResponse(response) ? response.body : response);
+ // When metadata is defined, the bridge returns the response wrapped in metadata as { body, metadata }
+ // Otherwise, the bridge returns the response directly
+ return await callBridge('invoke', { functionKey, payload, metadata });
};
const limitedInvoke = (0, utils_1.withRateLimiter)(_invoke, 500, 1000 * 25, 'Resolver calls are rate limited at 500req/25s');
/**
* Calls a backend resolver function by key. Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@forge/bridge",
- "version": "6.0.1-next.2-experimental-9423de1",
+ "version": "6.0.1-next.3",
"description": "Forge bridge API for custom UI apps",
"author": "Atlassian",
"license": "SEE LICENSE IN LICENSE.txt",
"main": "out/index.js",
@@ -18,9 +18,9 @@
"@forge/egress": "^3.0.0",
"@forge/i18n": "1.0.0",
"@forge/resolver": "2.0.0",
"@types/history": "^4.7.11",
- "@forge/manifest": "13.1.0-next.2-experimental-9423de1",
+ "@forge/manifest": "13.1.0-next.2",
"@types/iframe-resizer": "^3.5.8",
"iframe-resizer": "^4.4.5"
},
"devDependencies": { Index: package/out/invoke/invoke.d.ts.map
===================================================================
--- package/out/invoke/invoke.d.ts.map
+++ package/out/invoke/invoke.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/invoke/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInF,OAAO,EACL,cAAc,EACd,aAAa,EAEb,cAAc,EAEf,MAAM,UAAU,CAAC;AAyElB;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,OAAO,SAAS,aAAa,EAAE,CAAC,GAAG,cAAc,EACtE,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,GAAG,cAAc,EACvC,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,aAAa,EACvB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAa9B,KAAK,MAAM,CAAC,IAAI,SAAS,WAAW,IAAI,CAAC,GAAG,SAAS,MAAM,IAAI,GAAG,MAAM,EACtE,IAAI,EAAE,G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E"}
\ No newline at end of file Index: package/CHANGELOG.md
===================================================================
--- package/CHANGELOG.md
+++ package/CHANGELOG.md
@@ -1,14 +1,11 @@
# @forge/bridge
-## 6.0.1-next.2-experimental-9423de1
+## 6.0.1-next.3
### Patch Changes
-- Updated dependencies [4cd2242]
-- Updated dependencies [c60a7a5]
-- Updated dependencies [caa7518]
- - @forge/[email protected]
+- 621000d: Update bridge call to include metadata argument
## 6.0.1-next.2
### Patch Changes