@forge/bridge 0.0.0-experimental-e1cefc4 → 0.0.0-experimental-72f4150

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +64 -3
  2. package/out/bridge.js +4 -3
  3. package/out/events/events.d.ts +6 -0
  4. package/out/events/events.d.ts.map +1 -0
  5. package/out/events/events.js +15 -0
  6. package/out/events/index.d.ts +2 -0
  7. package/out/events/index.d.ts.map +1 -0
  8. package/out/events/index.js +4 -0
  9. package/out/fetch/fetch.d.ts +2 -2
  10. package/out/fetch/fetch.d.ts.map +1 -1
  11. package/out/fetch/fetch.js +2 -1
  12. package/out/fetch/index.d.ts +1 -1
  13. package/out/fetch/index.d.ts.map +1 -1
  14. package/out/fetch/index.js +1 -1
  15. package/out/flag/flag.d.ts +20 -0
  16. package/out/flag/flag.d.ts.map +1 -0
  17. package/out/flag/flag.js +21 -0
  18. package/out/flag/index.d.ts +2 -0
  19. package/out/flag/index.d.ts.map +1 -0
  20. package/out/flag/index.js +5 -0
  21. package/out/index.d.ts +2 -0
  22. package/out/index.d.ts.map +1 -1
  23. package/out/index.js +2 -0
  24. package/out/invoke/invoke.js +2 -2
  25. package/out/modal/modal.js +1 -1
  26. package/out/router/router.d.ts +1 -0
  27. package/out/router/router.d.ts.map +1 -1
  28. package/out/router/router.js +4 -2
  29. package/out/types.d.ts +21 -1
  30. package/out/types.d.ts.map +1 -1
  31. package/out/utils/index.d.ts +1 -1
  32. package/out/utils/index.d.ts.map +1 -1
  33. package/out/utils/index.js +2 -1
  34. package/out/view/close.js +3 -2
  35. package/out/view/createHistory.d.ts.map +1 -1
  36. package/out/view/createHistory.js +3 -2
  37. package/out/view/getContext.d.ts.map +1 -1
  38. package/out/view/getContext.js +3 -2
  39. package/out/view/refresh.d.ts +2 -0
  40. package/out/view/refresh.d.ts.map +1 -0
  41. package/out/view/refresh.js +14 -0
  42. package/out/view/submit.js +3 -2
  43. package/out/view/view.d.ts +1 -0
  44. package/out/view/view.d.ts.map +1 -1
  45. package/out/view/view.js +2 -0
  46. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,73 @@
1
1
  # @forge/bridge
2
2
 
3
- ## 0.0.0-experimental-e1cefc4
3
+ ## 0.0.0-experimental-72f4150
4
+
5
+ ### Patch Changes
6
+
7
+ - 6c53377: Add main field to package.json
8
+
9
+ ## 2.5.1-next.0
10
+
11
+ ### Patch Changes
12
+
13
+ - 6c533774: Add main field to package.json
14
+
15
+ ## 2.5.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 4eef67b: Fix return type for getContext method
20
+ - 6269d73: Fix return type for getContext method
21
+
22
+ ## 2.5.0-next.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 6269d73d: Fix return type for getContext method
27
+
28
+ ## 2.4.0
29
+
30
+ ### Minor Changes
31
+
32
+ - 14cd9b0: Add a new view.refresh() method
33
+
34
+ ## 2.4.0-next.0
35
+
36
+ ### Minor Changes
37
+
38
+ - 14cd9b02: Add a new view.refresh() method
39
+
40
+ ## 2.3.0
41
+
42
+ ### Minor Changes
43
+
44
+ - ae90999: Add router.reload()
45
+ - 27af6ce: Add showFlag API to open flags in products
46
+ - d307c8f: Add on and emit methods to Events API
47
+
48
+ ## 2.3.0-next.2
49
+
50
+ ### Minor Changes
51
+
52
+ - 27af6ce4: Add showFlag API to open flags in products
53
+
54
+ ## 2.3.0-next.1
55
+
56
+ ### Minor Changes
57
+
58
+ - ae90999: Add router.reload()
59
+
60
+ ## 2.3.0-next.0
61
+
62
+ ### Minor Changes
63
+
64
+ - d307c8f: Add on and emit methods to Events API
65
+
66
+ ## 2.2.1
4
67
 
5
68
  ### Patch Changes
6
69
 
7
- - 869511d: Change
8
70
  - 97ce1f3: update history.location in bridge when route changes
9
- - 869511d: Add
10
71
 
11
72
  ## 2.2.1-next.0
12
73
 
package/out/bridge.js CHANGED
@@ -5,12 +5,13 @@ const errors_1 = require("./errors");
5
5
  function isBridgeAvailable(bridge) {
6
6
  return !!(bridge === null || bridge === void 0 ? void 0 : bridge.callBridge);
7
7
  }
8
- exports.getCallBridge = () => {
9
- if (!isBridgeAvailable(self.__bridge)) {
8
+ const getCallBridge = () => {
9
+ if (!isBridgeAvailable(window.__bridge)) {
10
10
  throw new errors_1.BridgeAPIError(`
11
11
  Unable to establish a connection with the Custom UI bridge.
12
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
13
  `);
14
14
  }
15
- return self.__bridge.callBridge;
15
+ return window.__bridge.callBridge;
16
16
  };
17
+ exports.getCallBridge = getCallBridge;
@@ -0,0 +1,6 @@
1
+ import { Subscription } from '../types';
2
+ export declare const events: {
3
+ emit: (event: string, payload?: any) => Promise<void>;
4
+ on: (event: string, callback: (payload?: any) => any) => Promise<Subscription>;
5
+ };
6
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAYxC,eAAO,MAAM,MAAM;kBARE,MAAM,YAAY,GAAG,KAAG,QAAQ,IAAI,CAAC;gBAIvC,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAG,QAAQ,YAAY,CAAC;CAOlF,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.events = void 0;
4
+ const bridge_1 = require("../bridge");
5
+ const callBridge = (0, bridge_1.getCallBridge)();
6
+ const emit = (event, payload) => {
7
+ return callBridge('emit', { event, payload });
8
+ };
9
+ const on = (event, callback) => {
10
+ return callBridge('on', { event, callback });
11
+ };
12
+ exports.events = {
13
+ emit,
14
+ on
15
+ };
@@ -0,0 +1,2 @@
1
+ export * from './events';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./events"), exports);
@@ -1,6 +1,6 @@
1
1
  import { getCallBridge } from '../bridge';
2
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>;
3
+ requestConfluence: (restPath: string, fetchOptions?: RequestInit) => Promise<Response>;
4
+ requestJira: (restPath: string, fetchOptions?: RequestInit) => Promise<Response>;
5
5
  };
6
6
  //# sourceMappingURL=fetch.d.ts.map
@@ -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;kCAuB1C,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;4BAG5D,MAAM,6CAA+B,OAAO,CAAC,QAAQ,CAAC;CAGjF,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,WAAW,oBAAoB,CAAC;kCAuB1C,MAAM,iBAAiB,WAAW,KAAG,QAAQ,QAAQ,CAAC;4BAG5D,MAAM,iBAAiB,WAAW,KAAG,QAAQ,QAAQ,CAAC;CAGjF,CAAC"}
@@ -11,7 +11,7 @@ const parseBodyAndHeaders = (init) => tslib_1.__awaiter(void 0, void 0, void 0,
11
11
  headers: new Headers(headers)
12
12
  };
13
13
  });
14
- exports.productFetchApi = (callBridge) => {
14
+ const productFetchApi = (callBridge) => {
15
15
  const fetch = (product, restPath, init) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
16
  const { body: requestBody, headers: requestHeaders } = yield parseBodyAndHeaders(init);
17
17
  if (!requestHeaders.has('X-Atlassian-Token')) {
@@ -30,3 +30,4 @@ exports.productFetchApi = (callBridge) => {
30
30
  requestJira: (restPath, fetchOptions) => fetch('jira', restPath, fetchOptions)
31
31
  };
32
32
  };
33
+ exports.productFetchApi = productFetchApi;
@@ -1,2 +1,2 @@
1
- export declare const requestConfluence: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>, requestJira: (restPath: string, fetchOptions?: RequestInit | undefined) => Promise<Response>;
1
+ export declare const requestConfluence: (restPath: string, fetchOptions?: RequestInit) => Promise<Response>, requestJira: (restPath: string, fetchOptions?: RequestInit) => Promise<Response>;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAQ,iBAAiB,aAJA,MAAM,iBAAiB,WAAW,KAAK,QAAQ,QAAQ,CAAC,EAItD,WAAW,aAHnB,MAAM,iBAAiB,WAAW,KAAK,QAAQ,QAAQ,CAGoB,CAAC"}
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.requestJira = exports.requestConfluence = void 0;
5
5
  const bridge_1 = require("../bridge");
6
6
  const fetch_1 = require("./fetch");
7
- _a = fetch_1.productFetchApi(bridge_1.getCallBridge()), exports.requestConfluence = _a.requestConfluence, exports.requestJira = _a.requestJira;
7
+ _a = (0, fetch_1.productFetchApi)((0, bridge_1.getCallBridge)()), exports.requestConfluence = _a.requestConfluence, exports.requestJira = _a.requestJira;
@@ -0,0 +1,20 @@
1
+ export declare type FlagAppearance = 'info' | 'success' | 'warning' | 'error';
2
+ export declare type FlagType = FlagAppearance;
3
+ export interface Flag {
4
+ close: () => Promise<boolean | void>;
5
+ }
6
+ export interface FlagAction {
7
+ text: string;
8
+ onClick: () => void;
9
+ }
10
+ export interface FlagOptions {
11
+ id: number | string;
12
+ title?: string;
13
+ description?: string;
14
+ type?: FlagType;
15
+ appearance?: FlagAppearance;
16
+ actions?: FlagAction[];
17
+ isAutoDismiss?: boolean;
18
+ }
19
+ export declare const showFlag: (options: FlagOptions) => Flag;
20
+ //# sourceMappingURL=flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag.d.ts","sourceRoot":"","sources":["../../src/flag/flag.ts"],"names":[],"mappings":"AAGA,oBAAY,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACtE,oBAAY,QAAQ,GAAG,cAAc,CAAC;AAEtC,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAIhB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAID,eAAO,MAAM,QAAQ,YAAa,WAAW,KAAG,IAgB/C,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showFlag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const bridge_1 = require("../bridge");
6
+ const errors_1 = require("../errors");
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
+ const showFlag = (options) => {
9
+ var _a;
10
+ if (!options.id) {
11
+ throw new errors_1.BridgeAPIError('"id" must be defined in flag options');
12
+ }
13
+ const result = callBridge('showFlag', Object.assign(Object.assign({}, options), { type: (_a = options.type) !== null && _a !== void 0 ? _a : 'info' }));
14
+ return {
15
+ close: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
+ yield result;
17
+ return callBridge('closeFlag', { id: options.id });
18
+ })
19
+ };
20
+ };
21
+ exports.showFlag = showFlag;
@@ -0,0 +1,2 @@
1
+ export { showFlag, FlagOptions } from './flag';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showFlag = void 0;
4
+ var flag_1 = require("./flag");
5
+ Object.defineProperty(exports, "showFlag", { enumerable: true, get: function () { return flag_1.showFlag; } });
package/out/index.d.ts CHANGED
@@ -3,4 +3,6 @@ export * from './view';
3
3
  export * from './router';
4
4
  export * from './modal';
5
5
  export * from './fetch';
6
+ export * from './flag';
7
+ export * from './events';
6
8
  //# 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;AACxB,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;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
package/out/index.js CHANGED
@@ -6,3 +6,5 @@ tslib_1.__exportStar(require("./view"), exports);
6
6
  tslib_1.__exportStar(require("./router"), exports);
7
7
  tslib_1.__exportStar(require("./modal"), exports);
8
8
  tslib_1.__exportStar(require("./fetch"), exports);
9
+ tslib_1.__exportStar(require("./flag"), exports);
10
+ tslib_1.__exportStar(require("./events"), exports);
@@ -4,7 +4,7 @@ exports.invoke = void 0;
4
4
  const bridge_1 = require("../bridge");
5
5
  const errors_1 = require("../errors");
6
6
  const utils_1 = require("../utils");
7
- const callBridge = bridge_1.getCallBridge();
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
8
  const validatePayload = (payload) => {
9
9
  if (!payload)
10
10
  return;
@@ -19,4 +19,4 @@ const _invoke = (functionKey, payload) => {
19
19
  validatePayload(payload);
20
20
  return callBridge('invoke', { functionKey, payload });
21
21
  };
22
- exports.invoke = utils_1.withRateLimiter(_invoke, 20, 2000, 'Resolver calls are rate limited at 20req/2s');
22
+ exports.invoke = (0, utils_1.withRateLimiter)(_invoke, 20, 2000, 'Resolver calls are rate limited at 20req/2s');
@@ -4,7 +4,7 @@ exports.Modal = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bridge_1 = require("../bridge");
6
6
  const errors_1 = require("../errors");
7
- const callBridge = bridge_1.getCallBridge();
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
8
  const noop = () => { };
9
9
  class Modal {
10
10
  constructor(opts) {
@@ -1,5 +1,6 @@
1
1
  export declare const router: {
2
2
  navigate: (url: string) => Promise<void>;
3
3
  open: (url: string) => Promise<void>;
4
+ reload: () => Promise<void>;
4
5
  };
5
6
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM;oBAJG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;gBAE5B,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;CAKzC,CAAC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;oBANG,MAAM,KAAK,QAAQ,IAAI,CAAC;gBAE5B,MAAM,KAAK,QAAQ,IAAI,CAAC;kBAEtB,QAAQ,IAAI,CAAC;CAMhC,CAAC"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.router = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bridge_1 = require("../bridge");
6
- const callBridge = bridge_1.getCallBridge();
6
+ const callBridge = (0, bridge_1.getCallBridge)();
7
7
  const navigate = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'same-tab' }); });
8
8
  const open = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'new-tab' }); });
9
+ const reload = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('reload'); });
9
10
  exports.router = {
10
11
  navigate,
11
- open
12
+ open,
13
+ reload
12
14
  };
package/out/types.d.ts CHANGED
@@ -5,5 +5,25 @@ export declare type InvokeResponse = Record<string, any> | void;
5
5
  export declare type ProductFetchResponse = {
6
6
  body?: string;
7
7
  } & Pick<ResponseInit, 'headers' | 'status' | 'statusText'>;
8
- export declare type FullContext = {};
8
+ export interface FullContext {
9
+ accountId?: string;
10
+ cloudId?: string;
11
+ extension: ExtensionData;
12
+ license?: LicenseState;
13
+ localId: string;
14
+ locale: string;
15
+ moduleKey: string;
16
+ siteUrl: string;
17
+ timezone: string;
18
+ }
19
+ interface ExtensionData {
20
+ [k: string]: any;
21
+ }
22
+ interface LicenseState {
23
+ isActive?: boolean;
24
+ }
25
+ export declare type Subscription = {
26
+ unsubscribe: () => void;
27
+ };
28
+ export {};
9
29
  //# 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,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
+ {"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,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,UAAU,aAAa;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAClB;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,oBAAY,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const withRateLimiter: <Fn extends (...args: any[]) => any>(wrappedFn: Fn, maxOps: number, intervalInMs: number, exceededErrorMessage?: string | undefined) => <T>(...args: Parameters<Fn>) => Promise<T>;
1
+ export declare const withRateLimiter: <Fn extends (...args: any[]) => any>(wrappedFn: Fn, maxOps: number, intervalInMs: number, exceededErrorMessage?: string) => <T>(...args: Parameters<Fn>) => Promise<T>;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,wBAAyB,GAAG,EAAE,KAAK,GAAG,yBAExD,MAAM,gBACA,MAAM,0FAsBrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,wBAAyB,GAAG,EAAE,KAAK,GAAG,yBAExD,MAAM,gBACA,MAAM,yBACG,MAAM,+CAqB9B,CAAC"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withRateLimiter = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const errors_1 = require("../errors");
6
- exports.withRateLimiter = (wrappedFn, maxOps, intervalInMs, exceededErrorMessage) => {
6
+ const withRateLimiter = (wrappedFn, maxOps, intervalInMs, exceededErrorMessage) => {
7
7
  let start = Date.now();
8
8
  let numOps = 0;
9
9
  return (...args) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -20,3 +20,4 @@ exports.withRateLimiter = (wrappedFn, maxOps, intervalInMs, exceededErrorMessage
20
20
  return wrappedFn(...args);
21
21
  });
22
22
  };
23
+ exports.withRateLimiter = withRateLimiter;
package/out/view/close.js CHANGED
@@ -4,8 +4,8 @@ exports.close = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bridge_1 = require("../bridge");
6
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* () {
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
+ const close = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
9
  try {
10
10
  const success = yield callBridge('close', payload);
11
11
  if (success === false) {
@@ -16,3 +16,4 @@ exports.close = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function*
16
16
  throw new errors_1.BridgeAPIError("this resource's view is not closable.");
17
17
  }
18
18
  });
19
+ exports.close = close;
@@ -1 +1 @@
1
- {"version":3,"file":"createHistory.d.ts","sourceRoot":"","sources":["../../src/view/createHistory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIvC,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,OAAO,CAOrD,CAAC"}
1
+ {"version":3,"file":"createHistory.d.ts","sourceRoot":"","sources":["../../src/view/createHistory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIvC,eAAO,MAAM,aAAa,QAAa,QAAQ,OAAO,CAOrD,CAAC"}
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createHistory = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bridge_1 = require("../bridge");
6
- const callBridge = bridge_1.getCallBridge();
7
- exports.createHistory = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
+ const callBridge = (0, bridge_1.getCallBridge)();
7
+ const createHistory = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
8
8
  const history = yield callBridge('createHistory');
9
9
  history.listen((location) => {
10
10
  history.location = location;
11
11
  });
12
12
  return history;
13
13
  });
14
+ exports.createHistory = createHistory;
@@ -1 +1 @@
1
- {"version":3,"file":"getContext.d.ts","sourceRoot":"","sources":["../../src/view/getContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,eAAO,MAAM,UAAU,QAAO,OAAO,CAAC,WAAW,CAEhD,CAAC"}
1
+ {"version":3,"file":"getContext.d.ts","sourceRoot":"","sources":["../../src/view/getContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,eAAO,MAAM,UAAU,QAAO,QAAQ,WAAW,CAEhD,CAAC"}
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getContext = void 0;
4
4
  const bridge_1 = require("../bridge");
5
- const callBridge = bridge_1.getCallBridge();
6
- exports.getContext = () => {
5
+ const callBridge = (0, bridge_1.getCallBridge)();
6
+ const getContext = () => {
7
7
  return callBridge('getContext');
8
8
  };
9
+ exports.getContext = getContext;
@@ -0,0 +1,2 @@
1
+ export declare const refresh: (payload?: any) => Promise<void>;
2
+ //# sourceMappingURL=refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/view/refresh.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,aAAoB,GAAG,kBAK1C,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refresh = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const bridge_1 = require("../bridge");
6
+ const errors_1 = require("../errors");
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
+ const refresh = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
+ const success = yield callBridge('refresh', payload);
10
+ if (success === false) {
11
+ throw new errors_1.BridgeAPIError("this resource's view is not refreshable.");
12
+ }
13
+ });
14
+ exports.refresh = refresh;
@@ -4,10 +4,11 @@ exports.submit = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const bridge_1 = require("../bridge");
6
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* () {
7
+ const callBridge = (0, bridge_1.getCallBridge)();
8
+ const submit = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
9
  const success = yield callBridge('submit', payload);
10
10
  if (success === false) {
11
11
  throw new errors_1.BridgeAPIError("this resource's view is not submittable.");
12
12
  }
13
13
  });
14
+ exports.submit = submit;
@@ -1,6 +1,7 @@
1
1
  export declare const view: {
2
2
  submit: (payload?: any) => Promise<void>;
3
3
  close: (payload?: any) => Promise<void>;
4
+ refresh: (payload?: any) => Promise<void>;
4
5
  createHistory: () => Promise<import("history").History<unknown>>;
5
6
  getContext: () => Promise<import("../types").FullContext>;
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI;;;;;;CAMhB,CAAC"}
package/out/view/view.js CHANGED
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.view = void 0;
4
4
  const submit_1 = require("./submit");
5
5
  const close_1 = require("./close");
6
+ const refresh_1 = require("./refresh");
6
7
  const createHistory_1 = require("./createHistory");
7
8
  const getContext_1 = require("./getContext");
8
9
  exports.view = {
9
10
  submit: submit_1.submit,
10
11
  close: close_1.close,
12
+ refresh: refresh_1.refresh,
11
13
  createHistory: createHistory_1.createHistory,
12
14
  getContext: getContext_1.getContext
13
15
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "0.0.0-experimental-e1cefc4",
3
+ "version": "0.0.0-experimental-72f4150",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
7
+ "main": "out/index.js",
7
8
  "browser": "out/index.js",
8
9
  "types": "out/index.d.ts",
9
10
  "scripts": {