@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.
- package/CHANGELOG.md +64 -3
- package/out/bridge.js +4 -3
- package/out/events/events.d.ts +6 -0
- package/out/events/events.d.ts.map +1 -0
- package/out/events/events.js +15 -0
- package/out/events/index.d.ts +2 -0
- package/out/events/index.d.ts.map +1 -0
- package/out/events/index.js +4 -0
- package/out/fetch/fetch.d.ts +2 -2
- package/out/fetch/fetch.d.ts.map +1 -1
- package/out/fetch/fetch.js +2 -1
- package/out/fetch/index.d.ts +1 -1
- package/out/fetch/index.d.ts.map +1 -1
- package/out/fetch/index.js +1 -1
- package/out/flag/flag.d.ts +20 -0
- package/out/flag/flag.d.ts.map +1 -0
- package/out/flag/flag.js +21 -0
- package/out/flag/index.d.ts +2 -0
- package/out/flag/index.d.ts.map +1 -0
- package/out/flag/index.js +5 -0
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -0
- package/out/invoke/invoke.js +2 -2
- package/out/modal/modal.js +1 -1
- package/out/router/router.d.ts +1 -0
- package/out/router/router.d.ts.map +1 -1
- package/out/router/router.js +4 -2
- package/out/types.d.ts +21 -1
- package/out/types.d.ts.map +1 -1
- package/out/utils/index.d.ts +1 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +2 -1
- package/out/view/close.js +3 -2
- package/out/view/createHistory.d.ts.map +1 -1
- package/out/view/createHistory.js +3 -2
- package/out/view/getContext.d.ts.map +1 -1
- package/out/view/getContext.js +3 -2
- package/out/view/refresh.d.ts +2 -0
- package/out/view/refresh.d.ts.map +1 -0
- package/out/view/refresh.js +14 -0
- package/out/view/submit.js +3 -2
- package/out/view/view.d.ts +1 -0
- package/out/view/view.d.ts.map +1 -1
- package/out/view/view.js +2 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,73 @@
|
|
|
1
1
|
# @forge/bridge
|
|
2
2
|
|
|
3
|
-
## 0.0.0-experimental-
|
|
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
|
-
|
|
9
|
-
if (!isBridgeAvailable(
|
|
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
|
|
15
|
+
return window.__bridge.callBridge;
|
|
16
16
|
};
|
|
17
|
+
exports.getCallBridge = getCallBridge;
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/out/fetch/fetch.d.ts
CHANGED
|
@@ -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
|
|
4
|
-
requestJira: (restPath: string, fetchOptions?: RequestInit
|
|
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
|
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,
|
|
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"}
|
package/out/fetch/fetch.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/out/fetch/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const requestConfluence: (restPath: string, fetchOptions?: RequestInit
|
|
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
|
package/out/fetch/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAQ,iBAAiB,aAJA,MAAM,
|
|
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"}
|
package/out/fetch/index.js
CHANGED
|
@@ -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"}
|
package/out/flag/flag.js
ADDED
|
@@ -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 @@
|
|
|
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"}
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -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);
|
package/out/invoke/invoke.js
CHANGED
|
@@ -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');
|
package/out/modal/modal.js
CHANGED
|
@@ -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) {
|
package/out/router/router.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"
|
|
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"}
|
package/out/router/router.js
CHANGED
|
@@ -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
|
|
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
|
package/out/types.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/out/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const withRateLimiter: <Fn extends (...args: any[]) => any>(wrappedFn: Fn, maxOps: number, intervalInMs: number, exceededErrorMessage?: string
|
|
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
|
package/out/utils/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/out/utils/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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"}
|
package/out/view/getContext.js
CHANGED
|
@@ -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
|
-
|
|
5
|
+
const callBridge = (0, bridge_1.getCallBridge)();
|
|
6
|
+
const getContext = () => {
|
|
7
7
|
return callBridge('getContext');
|
|
8
8
|
};
|
|
9
|
+
exports.getContext = getContext;
|
|
@@ -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;
|
package/out/view/submit.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/out/view/view.d.ts
CHANGED
|
@@ -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
|
};
|
package/out/view/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"
|
|
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-
|
|
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": {
|