@forge/bridge 0.0.0-experimental-819498d → 0.0.0-experimental-64caa5a

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 CHANGED
@@ -1,6 +1,66 @@
1
1
  # @forge/bridge
2
2
 
3
- ## 0.0.0-experimental-819498d
3
+ ## 0.0.0-experimental-64caa5a
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
+
27
+ ## 2.1.1
28
+
29
+ ### Patch Changes
30
+
31
+ - abf359f: Enable requestJira and requestConfluence in Forge bridge to generate correct content type for form data
32
+
33
+ ## 2.1.1-next.0
34
+
35
+ ### Patch Changes
36
+
37
+ - abf359f: Enable requestJira and requestConfluence in Forge bridge to generate correct content type for form data
38
+
39
+ ## 2.1.0
40
+
41
+ ### Minor Changes
42
+
43
+ - 63e5561: Add submit method
44
+
45
+ ## 2.1.0-next.0
46
+
47
+ ### Minor Changes
48
+
49
+ - 63e5561: Add submit method
50
+
51
+ ## 2.0.0
52
+
53
+ ### Major Changes
54
+
55
+ - 2f07efb: Add new client-side 3LO requestJira and requestConfluence methods
56
+
57
+ ## 2.0.0-next.0
58
+
59
+ ### Major Changes
60
+
61
+ - 2f07efb: Add new client-side 3LO requestJira and requestConfluence methods
62
+
63
+ ## 1.5.0
4
64
 
5
65
  ### Minor Changes
6
66
 
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QAAO,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAE/D,CAAC"}
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
- exports.getCallBridge = function () {
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
- var tslib_1 = require("tslib");
5
- var BridgeAPIError = (function (_super) {
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;
@@ -0,0 +1,6 @@
1
+ import { getCallBridge } from '../bridge';
2
+ export declare const productFetchApi: (callBridge: ReturnType<typeof getCallBridge>) => {
3
+ requestConfluence: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>;
4
+ requestJira: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>;
5
+ };
6
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +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;kCAuB1C,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;4BAG5D,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;CAGjF,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productFetchApi = void 0;
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');
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
+ });
28
+ return {
29
+ requestConfluence: (restPath, fetchOptions) => fetch('confluence', restPath, fetchOptions),
30
+ requestJira: (restPath, fetchOptions) => fetch('jira', restPath, fetchOptions)
31
+ };
32
+ };
@@ -0,0 +1,2 @@
1
+ export declare const requestConfluence: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>, requestJira: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAQ,iBAAiB,aAJA,MAAM,6CAAiC,OAAO,CAAC,QAAQ,CAAC,EAItD,WAAW,aAHnB,MAAM,6CAAiC,OAAO,CAAC,QAAQ,CAGoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.requestJira = exports.requestConfluence = void 0;
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.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './invoke';
2
2
  export * from './view';
3
3
  export * from './router';
4
4
  export * from './modal';
5
+ export * from './fetch';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/out/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
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);
7
7
  tslib_1.__exportStar(require("./modal"), exports);
8
+ tslib_1.__exportStar(require("./fetch"), exports);
@@ -1,4 +1,2 @@
1
1
  export * from './invoke';
2
- export * from './requestJira';
3
- export * from './requestConfluence';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/invoke/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/invoke/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./invoke"), exports);
5
- tslib_1.__exportStar(require("./requestJira"), exports);
6
- tslib_1.__exportStar(require("./requestConfluence"), exports);
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.invoke = void 0;
4
- var bridge_1 = require("../bridge");
5
- var errors_1 = require("../errors");
6
- var utils_1 = require("../utils");
7
- var callBridge = bridge_1.getCallBridge();
8
- var validatePayload = function (payload) {
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(function (val) { return typeof val === 'function'; })) {
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
- var _invoke = function (functionKey, payload) {
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: functionKey, payload: payload });
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');
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./modal"), exports);
@@ -1,45 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Modal = void 0;
4
- var tslib_1 = require("tslib");
5
- var bridge_1 = require("../bridge");
6
- var errors_1 = require("../errors");
7
- var callBridge = bridge_1.getCallBridge();
8
- var noop = function () { };
9
- var Modal = (function () {
10
- function Modal(opts) {
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
- Modal.prototype.open = function () {
17
- return tslib_1.__awaiter(this, void 0, void 0, function () {
18
- var success, err_1;
19
- return tslib_1.__generator(this, function (_a) {
20
- switch (_a.label) {
21
- case 0:
22
- _a.trys.push([0, 2, , 3]);
23
- return [4, callBridge('openModal', {
24
- resource: this.resource,
25
- onClose: this.onClose,
26
- size: this.size,
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
- return Modal;
44
- }());
33
+ }
34
+ }
45
35
  exports.Modal = Modal;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./router"), exports);
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.router = void 0;
4
- var tslib_1 = require("tslib");
5
- var bridge_1 = require("../bridge");
6
- var callBridge = bridge_1.getCallBridge();
7
- var navigate = function (url) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
8
- return [2, callBridge('navigate', { url: url, type: 'same-tab' })];
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: navigate,
15
- open: open
10
+ navigate,
11
+ open
16
12
  };
package/out/types.d.ts CHANGED
@@ -2,8 +2,8 @@ export declare type InvokePayload = {
2
2
  [key in number | string]: any;
3
3
  };
4
4
  export declare type InvokeResponse = Record<string, any> | void;
5
- export declare type ProductResponse = {
6
- body: any;
7
- } & Pick<Response, 'ok' | 'status' | 'statusText'>;
5
+ export declare type ProductFetchResponse = {
6
+ body?: string;
7
+ } & Pick<ResponseInit, 'headers' | 'status' | 'statusText'>;
8
8
  export declare type FullContext = {};
9
9
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;KACzB,GAAG,IAAI,MAAM,GAAG,MAAM,GAAG,GAAG;CAC9B,CAAC;AAEF,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAExD,oBAAY,eAAe,GAAG;IAAE,IAAI,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAE7F,oBAAY,WAAW,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;KACzB,GAAG,IAAI,MAAM,GAAG,MAAM,GAAG,GAAG;CAC9B,CAAC;AAEF,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAE/G,oBAAY,WAAW,GAAG,EAAE,CAAC"}
@@ -1,31 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withRateLimiter = void 0;
4
- var tslib_1 = require("tslib");
5
- var errors_1 = require("../errors");
6
- exports.withRateLimiter = function (wrappedFn, maxOps, intervalInMs, exceededErrorMessage) {
7
- var start = Date.now();
8
- var numOps = 0;
9
- return function () {
10
- var args = [];
11
- for (var _i = 0; _i < arguments.length; _i++) {
12
- args[_i] = arguments[_i];
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
- return tslib_1.__awaiter(void 0, void 0, void 0, function () {
15
- var now, elapsed;
16
- return tslib_1.__generator(this, function (_a) {
17
- now = Date.now();
18
- elapsed = now - start;
19
- if (elapsed > intervalInMs) {
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
- var tslib_1 = require("tslib");
5
- var bridge_1 = require("../bridge");
6
- var errors_1 = require("../errors");
7
- var callBridge = bridge_1.getCallBridge();
8
- exports.close = function (payload) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
9
- var success, e_1;
10
- return tslib_1.__generator(this, function (_a) {
11
- switch (_a.label) {
12
- case 0:
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
- var bridge_1 = require("../bridge");
5
- var callBridge = bridge_1.getCallBridge();
6
- exports.createHistory = function () {
4
+ const bridge_1 = require("../bridge");
5
+ const callBridge = bridge_1.getCallBridge();
6
+ exports.createHistory = () => {
7
7
  return callBridge('createHistory');
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getContext = void 0;
4
- var bridge_1 = require("../bridge");
5
- var callBridge = bridge_1.getCallBridge();
6
- exports.getContext = function () {
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
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var tslib_1 = require("tslib");
3
+ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./view"), exports);
@@ -0,0 +1,2 @@
1
+ export declare const submit: (payload?: any) => Promise<void>;
2
+ //# sourceMappingURL=submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.d.ts","sourceRoot":"","sources":["../../src/view/submit.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM,aAAoB,GAAG,kBAKzC,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.submit = void 0;
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
+ });
@@ -1,4 +1,5 @@
1
1
  export declare const view: {
2
+ submit: (payload?: any) => Promise<void>;
2
3
  close: (payload?: any) => Promise<void>;
3
4
  createHistory: () => Promise<import("history").History<unknown>>;
4
5
  getContext: () => Promise<import("../types").FullContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC"}
package/out/view/view.js CHANGED
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.view = void 0;
4
- var close_1 = require("./close");
5
- var createHistory_1 = require("./createHistory");
6
- var getContext_1 = require("./getContext");
4
+ const submit_1 = require("./submit");
5
+ const close_1 = require("./close");
6
+ const createHistory_1 = require("./createHistory");
7
+ const getContext_1 = require("./getContext");
7
8
  exports.view = {
9
+ submit: submit_1.submit,
8
10
  close: close_1.close,
9
11
  createHistory: createHistory_1.createHistory,
10
12
  getContext: getContext_1.getContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "0.0.0-experimental-819498d",
3
+ "version": "0.0.0-experimental-64caa5a",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "history": "4.10.1",
19
+ "isomorphic-fetch": "^3.0.0",
19
20
  "jest-date-mock": "^1.0.8"
20
21
  }
21
22
  }
@@ -1,3 +0,0 @@
1
- import { ProductResponse } from '../types';
2
- export declare const requestConfluence: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
3
- //# sourceMappingURL=requestConfluence.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestConfluence.d.ts","sourceRoot":"","sources":["../../src/invoke/requestConfluence.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,iBAAiB,aAAc,MAAM,6CAA+B,OAAO,CAAC,eAAe,CACf,CAAC"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requestConfluence = void 0;
4
- var invoke_1 = require("./invoke");
5
- exports.requestConfluence = function (fetchUrl, fetchOptions) {
6
- return invoke_1.invoke('__request', { product: 'confluence', fetchUrl: fetchUrl, fetchOptions: fetchOptions });
7
- };
@@ -1,3 +0,0 @@
1
- import { ProductResponse } from '../types';
2
- export declare const requestJira: (fetchUrl: string, fetchOptions?: RequestInit | undefined) => Promise<ProductResponse>;
3
- //# sourceMappingURL=requestJira.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestJira.d.ts","sourceRoot":"","sources":["../../src/invoke/requestJira.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,WAAW,aAAc,MAAM,6CAA+B,OAAO,CAAC,eAAe,CACf,CAAC"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requestJira = void 0;
4
- var index_1 = require("./index");
5
- exports.requestJira = function (fetchUrl, fetchOptions) {
6
- return index_1.invoke('__request', { product: 'jira', fetchUrl: fetchUrl, fetchOptions: fetchOptions });
7
- };