@forge/bridge 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/out/bridge.d.ts.map +1 -1
- package/out/bridge.js +11 -1
- package/out/errors.js +2 -8
- package/out/fetch/fetch.d.ts.map +1 -1
- package/out/fetch/fetch.js +24 -51
- package/out/fetch/index.js +3 -3
- package/out/index.js +1 -1
- package/out/invoke/index.js +1 -1
- package/out/invoke/invoke.js +8 -8
- package/out/modal/index.js +1 -1
- package/out/modal/modal.js +24 -34
- package/out/router/index.js +1 -1
- package/out/router/router.js +7 -11
- package/out/utils/index.js +17 -26
- package/out/view/close.js +14 -23
- package/out/view/createHistory.js +3 -3
- package/out/view/getContext.js +3 -3
- package/out/view/index.js +1 -1
- package/out/view/submit.js +10 -18
- package/out/view/view.js +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @forge/bridge
|
|
2
2
|
|
|
3
|
+
## 2.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7c11b22: Improve error message for when the Custom UI bridge is not available
|
|
8
|
+
|
|
9
|
+
## 2.1.3-next.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7c11b22: Improve error message for when the Custom UI bridge is not available
|
|
14
|
+
|
|
15
|
+
## 2.1.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 06edfce: Fix headers for some REST endpoints
|
|
20
|
+
|
|
21
|
+
## 2.1.2-next.0
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 06edfce: Fix headers for some REST endpoints
|
|
26
|
+
|
|
3
27
|
## 2.1.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/out/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa,QAAO,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAS/D,CAAC"}
|
package/out/bridge.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCallBridge = void 0;
|
|
4
|
-
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
function isBridgeAvailable(bridge) {
|
|
6
|
+
return !!(bridge === null || bridge === void 0 ? void 0 : bridge.callBridge);
|
|
7
|
+
}
|
|
8
|
+
exports.getCallBridge = () => {
|
|
9
|
+
if (!isBridgeAvailable(window.__bridge)) {
|
|
10
|
+
throw new errors_1.BridgeAPIError(`
|
|
11
|
+
Unable to establish a connection with the Custom UI bridge.
|
|
12
|
+
If you are trying to run your app locally, Forge apps only work in the context of Atlassian products. Refer to https://go.atlassian.com/forge-tunneling-with-custom-ui for how to tunnel when using a local development server.
|
|
13
|
+
`);
|
|
14
|
+
}
|
|
5
15
|
return window.__bridge.callBridge;
|
|
6
16
|
};
|
package/out/errors.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BridgeAPIError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__extends(BridgeAPIError, _super);
|
|
7
|
-
function BridgeAPIError() {
|
|
8
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
9
|
-
}
|
|
10
|
-
return BridgeAPIError;
|
|
11
|
-
}(Error));
|
|
4
|
+
class BridgeAPIError extends Error {
|
|
5
|
+
}
|
|
12
6
|
exports.BridgeAPIError = BridgeAPIError;
|
package/out/fetch/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/fetch/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAqB1C,eAAO,MAAM,eAAe,eAAgB,UAAU,CAAC,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/fetch/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAqB1C,eAAO,MAAM,eAAe,eAAgB,UAAU,CAAC,OAAO,aAAa,CAAC;kCAuB1C,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;4BAG5D,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;CAGjF,CAAC"}
|
package/out/fetch/fetch.js
CHANGED
|
@@ -1,59 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.productFetchApi = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
case 3:
|
|
20
|
-
body = _a;
|
|
21
|
-
headers = Object.fromEntries(req.headers.entries());
|
|
22
|
-
return [2, {
|
|
23
|
-
body: body,
|
|
24
|
-
headers: headers
|
|
25
|
-
}];
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const parseBodyAndHeaders = (init) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
6
|
+
const req = new Request('', { body: init === null || init === void 0 ? void 0 : init.body, method: init === null || init === void 0 ? void 0 : init.method, headers: init === null || init === void 0 ? void 0 : init.headers });
|
|
7
|
+
const body = req.method !== 'GET' ? yield req.text() : null;
|
|
8
|
+
const headers = Object.fromEntries(req.headers.entries());
|
|
9
|
+
return {
|
|
10
|
+
body,
|
|
11
|
+
headers: new Headers(headers)
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
exports.productFetchApi = (callBridge) => {
|
|
15
|
+
const fetch = (product, restPath, init) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const { body: requestBody, headers: requestHeaders } = yield parseBodyAndHeaders(init);
|
|
17
|
+
if (!requestHeaders.has('X-Atlassian-Token')) {
|
|
18
|
+
requestHeaders.set('X-Atlassian-Token', 'no-check');
|
|
26
19
|
}
|
|
20
|
+
const fetchPayload = {
|
|
21
|
+
product,
|
|
22
|
+
restPath,
|
|
23
|
+
fetchRequestInit: Object.assign(Object.assign({}, init), { body: requestBody, headers: [...requestHeaders.entries()] })
|
|
24
|
+
};
|
|
25
|
+
const { body, headers, statusText, status } = yield callBridge('fetchProduct', fetchPayload);
|
|
26
|
+
return new Response(body || null, { headers, status, statusText });
|
|
27
27
|
});
|
|
28
|
-
}); };
|
|
29
|
-
exports.productFetchApi = function (callBridge) {
|
|
30
|
-
var fetch = function (product, restPath, init) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
31
|
-
var fetchPayload, _a, _b, _c, body, headers, statusText, status;
|
|
32
|
-
return tslib_1.__generator(this, function (_d) {
|
|
33
|
-
switch (_d.label) {
|
|
34
|
-
case 0:
|
|
35
|
-
_a = {
|
|
36
|
-
product: product,
|
|
37
|
-
restPath: restPath
|
|
38
|
-
};
|
|
39
|
-
_b = [tslib_1.__assign({}, init)];
|
|
40
|
-
return [4, parseBodyAndHeaders(init)];
|
|
41
|
-
case 1:
|
|
42
|
-
fetchPayload = (_a.fetchRequestInit = tslib_1.__assign.apply(void 0, _b.concat([(_d.sent())])),
|
|
43
|
-
_a);
|
|
44
|
-
return [4, callBridge('fetchProduct', fetchPayload)];
|
|
45
|
-
case 2:
|
|
46
|
-
_c = _d.sent(), body = _c.body, headers = _c.headers, statusText = _c.statusText, status = _c.status;
|
|
47
|
-
return [2, new Response(body || null, { headers: headers, status: status, statusText: statusText })];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}); };
|
|
51
28
|
return {
|
|
52
|
-
requestConfluence:
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
requestJira: function (restPath, fetchOptions) {
|
|
56
|
-
return fetch('jira', restPath, fetchOptions);
|
|
57
|
-
}
|
|
29
|
+
requestConfluence: (restPath, fetchOptions) => fetch('confluence', restPath, fetchOptions),
|
|
30
|
+
requestJira: (restPath, fetchOptions) => fetch('jira', restPath, fetchOptions)
|
|
58
31
|
};
|
|
59
32
|
};
|
package/out/fetch/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.requestJira = exports.requestConfluence = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const fetch_1 = require("./fetch");
|
|
7
|
+
_a = fetch_1.productFetchApi(bridge_1.getCallBridge()), exports.requestConfluence = _a.requestConfluence, exports.requestJira = _a.requestJira;
|
package/out/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./invoke"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./view"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./router"), exports);
|
package/out/invoke/index.js
CHANGED
package/out/invoke/invoke.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.invoke = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const bridge_1 = require("../bridge");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const callBridge = bridge_1.getCallBridge();
|
|
8
|
+
const validatePayload = (payload) => {
|
|
9
9
|
if (!payload)
|
|
10
10
|
return;
|
|
11
|
-
if (Object.values(payload).some(
|
|
11
|
+
if (Object.values(payload).some((val) => typeof val === 'function')) {
|
|
12
12
|
throw new errors_1.BridgeAPIError('Passing functions as part of the payload is not supported!');
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
const _invoke = (functionKey, payload) => {
|
|
16
16
|
if (typeof functionKey !== 'string') {
|
|
17
17
|
throw new errors_1.BridgeAPIError('functionKey must be a string!');
|
|
18
18
|
}
|
|
19
19
|
validatePayload(payload);
|
|
20
|
-
return callBridge('invoke', { functionKey
|
|
20
|
+
return callBridge('invoke', { functionKey, payload });
|
|
21
21
|
};
|
|
22
22
|
exports.invoke = utils_1.withRateLimiter(_invoke, 20, 2000, 'Resolver calls are rate limited at 20req/2s');
|
package/out/modal/index.js
CHANGED
package/out/modal/modal.js
CHANGED
|
@@ -1,45 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Modal = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const callBridge = bridge_1.getCallBridge();
|
|
8
|
+
const noop = () => { };
|
|
9
|
+
class Modal {
|
|
10
|
+
constructor(opts) {
|
|
11
11
|
this.resource = (opts === null || opts === void 0 ? void 0 : opts.resource) || null;
|
|
12
12
|
this.onClose = (opts === null || opts === void 0 ? void 0 : opts.onClose) || noop;
|
|
13
13
|
this.size = (opts === null || opts === void 0 ? void 0 : opts.size) || 'medium';
|
|
14
14
|
this.context = (opts === null || opts === void 0 ? void 0 : opts.context) || {};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
context: this.context
|
|
28
|
-
})];
|
|
29
|
-
case 1:
|
|
30
|
-
success = _a.sent();
|
|
31
|
-
if (success === false) {
|
|
32
|
-
throw new errors_1.BridgeAPIError('Unable to open modal.');
|
|
33
|
-
}
|
|
34
|
-
return [3, 3];
|
|
35
|
-
case 2:
|
|
36
|
-
err_1 = _a.sent();
|
|
37
|
-
throw new errors_1.BridgeAPIError('Unable to open modal.');
|
|
38
|
-
case 3: return [2];
|
|
16
|
+
open() {
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
try {
|
|
19
|
+
const success = yield callBridge('openModal', {
|
|
20
|
+
resource: this.resource,
|
|
21
|
+
onClose: this.onClose,
|
|
22
|
+
size: this.size,
|
|
23
|
+
context: this.context
|
|
24
|
+
});
|
|
25
|
+
if (success === false) {
|
|
26
|
+
throw new errors_1.BridgeAPIError('Unable to open modal.');
|
|
39
27
|
}
|
|
40
|
-
}
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new errors_1.BridgeAPIError('Unable to open modal.');
|
|
31
|
+
}
|
|
41
32
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
45
35
|
exports.Modal = Modal;
|
package/out/router/index.js
CHANGED
package/out/router/router.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.router = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}); }); };
|
|
10
|
-
var open = function (url) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
|
11
|
-
return [2, callBridge('navigate', { url: url, type: 'new-tab' })];
|
|
12
|
-
}); }); };
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const callBridge = bridge_1.getCallBridge();
|
|
7
|
+
const navigate = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'same-tab' }); });
|
|
8
|
+
const open = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'new-tab' }); });
|
|
13
9
|
exports.router = {
|
|
14
|
-
navigate
|
|
15
|
-
open
|
|
10
|
+
navigate,
|
|
11
|
+
open
|
|
16
12
|
};
|
package/out/utils/index.js
CHANGED
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withRateLimiter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.withRateLimiter =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return function () {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
exports.withRateLimiter = (wrappedFn, maxOps, intervalInMs, exceededErrorMessage) => {
|
|
7
|
+
let start = Date.now();
|
|
8
|
+
let numOps = 0;
|
|
9
|
+
return (...args) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
const now = Date.now();
|
|
11
|
+
const elapsed = now - start;
|
|
12
|
+
if (elapsed > intervalInMs) {
|
|
13
|
+
start = now;
|
|
14
|
+
numOps = 0;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
start = now;
|
|
21
|
-
numOps = 0;
|
|
22
|
-
}
|
|
23
|
-
if (numOps >= maxOps) {
|
|
24
|
-
throw new errors_1.BridgeAPIError(exceededErrorMessage || 'Too many invocations.');
|
|
25
|
-
}
|
|
26
|
-
numOps = numOps + 1;
|
|
27
|
-
return [2, wrappedFn.apply(void 0, args)];
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
};
|
|
16
|
+
if (numOps >= maxOps) {
|
|
17
|
+
throw new errors_1.BridgeAPIError(exceededErrorMessage || 'Too many invocations.');
|
|
18
|
+
}
|
|
19
|
+
numOps = numOps + 1;
|
|
20
|
+
return wrappedFn(...args);
|
|
21
|
+
});
|
|
31
22
|
};
|
package/out/view/close.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.close = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.close =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
_a.trys.push([0, 2, , 3]);
|
|
14
|
-
return [4, callBridge('close', payload)];
|
|
15
|
-
case 1:
|
|
16
|
-
success = _a.sent();
|
|
17
|
-
if (success === false) {
|
|
18
|
-
throw new errors_1.BridgeAPIError("this resource's view is not closable.");
|
|
19
|
-
}
|
|
20
|
-
return [3, 3];
|
|
21
|
-
case 2:
|
|
22
|
-
e_1 = _a.sent();
|
|
23
|
-
throw new errors_1.BridgeAPIError("this resource's view is not closable.");
|
|
24
|
-
case 3: return [2];
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const callBridge = bridge_1.getCallBridge();
|
|
8
|
+
exports.close = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
try {
|
|
10
|
+
const success = yield callBridge('close', payload);
|
|
11
|
+
if (success === false) {
|
|
12
|
+
throw new errors_1.BridgeAPIError("this resource's view is not closable.");
|
|
25
13
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
throw new errors_1.BridgeAPIError("this resource's view is not closable.");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createHistory = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.createHistory =
|
|
4
|
+
const bridge_1 = require("../bridge");
|
|
5
|
+
const callBridge = bridge_1.getCallBridge();
|
|
6
|
+
exports.createHistory = () => {
|
|
7
7
|
return callBridge('createHistory');
|
|
8
8
|
};
|
package/out/view/getContext.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getContext = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.getContext =
|
|
4
|
+
const bridge_1 = require("../bridge");
|
|
5
|
+
const callBridge = bridge_1.getCallBridge();
|
|
6
|
+
exports.getContext = () => {
|
|
7
7
|
return callBridge('getContext');
|
|
8
8
|
};
|
package/out/view/index.js
CHANGED
package/out/view/submit.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.submit = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.submit =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
success = _a.sent();
|
|
15
|
-
if (success === false) {
|
|
16
|
-
throw new errors_1.BridgeAPIError("this resource's view is not submittable.");
|
|
17
|
-
}
|
|
18
|
-
return [2];
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}); };
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bridge_1 = require("../bridge");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const callBridge = bridge_1.getCallBridge();
|
|
8
|
+
exports.submit = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const success = yield callBridge('submit', payload);
|
|
10
|
+
if (success === false) {
|
|
11
|
+
throw new errors_1.BridgeAPIError("this resource's view is not submittable.");
|
|
12
|
+
}
|
|
13
|
+
});
|
package/out/view/view.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.view = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const submit_1 = require("./submit");
|
|
5
|
+
const close_1 = require("./close");
|
|
6
|
+
const createHistory_1 = require("./createHistory");
|
|
7
|
+
const getContext_1 = require("./getContext");
|
|
8
8
|
exports.view = {
|
|
9
9
|
submit: submit_1.submit,
|
|
10
10
|
close: close_1.close,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/bridge",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Forge bridge API for custom UI apps",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"history": "4.10.1",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"isomorphic-fetch": "^3.0.0",
|
|
20
|
+
"jest-date-mock": "^1.0.8"
|
|
21
21
|
}
|
|
22
22
|
}
|