@forge/bridge
Advanced tools
Comparing version 0.1.0 to 0.2.0-next.0
# @forge/bridge | ||
## 0.2.0-next.0 | ||
### Minor Changes | ||
- bb78f70: Add client side request methods for Jira and Confluence | ||
## 0.1.0 | ||
@@ -4,0 +10,0 @@ |
@@ -38,2 +38,47 @@ "use strict"; | ||
}); }); | ||
it('calls the global bridge with the correct Jira resolver arguments without options', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, __1.requestJira('/test')]; | ||
case 1: | ||
_a.sent(); | ||
expect(callBridgeMock).toHaveBeenCalledTimes(1); | ||
expect(callBridgeMock).toHaveBeenCalledWith('invoke', { | ||
functionKey: '__request', | ||
payload: { product: 'jira', fetchUrl: '/test' } | ||
}); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
it('calls the global bridge with the correct Jira resolver arguments with options', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, __1.requestJira('/test', { method: 'POST' })]; | ||
case 1: | ||
_a.sent(); | ||
expect(callBridgeMock).toHaveBeenCalledTimes(1); | ||
expect(callBridgeMock).toHaveBeenCalledWith('invoke', { | ||
functionKey: '__request', | ||
payload: { product: 'jira', fetchUrl: '/test', fetchOptions: { method: 'POST' } } | ||
}); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
it('calls the global bridge with the correct Confluence resolver arguments with options', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, __1.requestConfluence('/test', { method: 'POST' })]; | ||
case 1: | ||
_a.sent(); | ||
expect(callBridgeMock).toHaveBeenCalledTimes(1); | ||
expect(callBridgeMock).toHaveBeenCalledWith('invoke', { | ||
functionKey: '__request', | ||
payload: { product: 'confluence', fetchUrl: '/test', fetchOptions: { method: 'POST' } } | ||
}); | ||
return [2]; | ||
} | ||
}); | ||
}); }); | ||
it('retries if callBridgeMock returns an error due to a handler not being found', function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
@@ -40,0 +85,0 @@ return tslib_1.__generator(this, function (_a) { |
@@ -5,7 +5,14 @@ declare type InvokePayload = { | ||
declare type InvokeResponse = Record<string, any> | void; | ||
export declare const invoke: (functionKey: string, payload?: InvokePayload | undefined) => Promise<InvokeResponse>; | ||
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: (functionKey: string, payload?: InvokePayload | undefined) => Promise<InvokeResponse>; | ||
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; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.invoke = void 0; | ||
exports.requestConfluence = exports.requestJira = exports.invoke = void 0; | ||
var tslib_1 = require("tslib"); | ||
@@ -52,4 +52,12 @@ var errors_1 = require("./errors"); | ||
}; | ||
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 | ||
invoke: exports.invoke, | ||
requestJira: exports.requestJira, | ||
requestConfluence: exports.requestConfluence | ||
}; |
{ | ||
"name": "@forge/bridge", | ||
"version": "0.1.0", | ||
"version": "0.2.0-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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13088
226