Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@forge/bridge

Package Overview
Dependencies
Maintainers
8
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forge/bridge - npm Package Compare versions

Comparing version 0.0.0-experimental-e8bfa83 to 0.0.0-experimental-ed3737f

out/bridge.d.ts

58

CHANGELOG.md
# @forge/bridge
## 0.0.0-experimental-e8bfa83
## 0.0.0-experimental-ed3737f
### Minor Changes
- 74a0279: Add getContext method
### Patch Changes
- 74a0279: Rate limit invoke calls
## 1.2.0-next.1
### Patch Changes
- 001a027: Rate limit invoke calls
## 1.2.0-next.0
### Minor Changes
- 3bc0722: Add getContext method
## 1.1.0
### Minor Changes
- 83c2eec: New view.close() method for closing modals
### Patch Changes
- 14b6ef7: Remove retriable invoke as is no longer necessary with bridge core handshake
## 1.1.0-next.1
### Minor Changes
- 83c2eec: New view.close() method for closing modals
## 1.0.1-next.0
### Patch Changes
- 14b6ef7: Remove retriable invoke as is no longer necessary with bridge core handshake
## 1.0.0
### Major Changes
- 1daf2c5: Forge packages to 1.0.0 for upcoming platform GA 🎉
## 1.0.0-next.0
### Major Changes
- 1daf2c5: Forge is now generally available 🎉
## 0.2.1
### Patch Changes
- 5b666a5: Fix published content

@@ -8,0 +64,0 @@

18

out/index.d.ts

@@ -1,17 +0,3 @@

declare type InvokePayload = {
[key in number | string]: any;
};
declare type InvokeResponse = Record<string, any> | void;
export declare const invoke: <T = InvokeResponse>(functionKey: string, payload?: InvokePayload | undefined) => Promise<T>;
export declare type ProductResponse = {
body: any;
} & Pick<Response, 'ok' | 'status' | 'statusText'>;
export declare const requestJira: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
export declare const requestConfluence: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
declare const _default: {
invoke: <T = InvokeResponse>(functionKey: string, payload?: InvokePayload | undefined) => Promise<T>;
requestJira: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
requestConfluence: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
};
export default _default;
export * from './invoke';
export * from './view';
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestConfluence = exports.requestJira = exports.invoke = void 0;
var tslib_1 = require("tslib");
var errors_1 = require("./errors");
var delay = function (time) { return Promise.resolve(function (res) { return setTimeout(res, time); }); };
var validatePayload = function (payload) {
if (!payload)
return;
if (Object.values(payload).some(function (val) { return typeof val === 'function'; })) {
throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!');
}
};
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];
}
});
});
};
return retriableInvoke();
};
exports.requestJira = function (fetchUrl, fetchOptions) {
return exports.invoke('__request', { product: 'jira', fetchUrl: fetchUrl, fetchOptions: fetchOptions });
};
exports.requestConfluence = function (fetchUrl, fetchOptions) {
return exports.invoke('__request', { product: 'confluence', fetchUrl: fetchUrl, fetchOptions: fetchOptions });
};
exports.default = {
invoke: exports.invoke,
requestJira: exports.requestJira,
requestConfluence: exports.requestConfluence
};
tslib_1.__exportStar(require("./invoke"), exports);
tslib_1.__exportStar(require("./view"), exports);
{
"name": "@forge/bridge",
"version": "0.0.0-experimental-e8bfa83",
"version": "0.0.0-experimental-ed3737f",
"description": "Forge bridge API for custom UI apps",

@@ -13,3 +13,6 @@ "author": "Atlassian",

"compile": "tsc -b -v"
},
"devDependencies": {
"jest-date-mock": "^1.0.8"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc