@forge/api 6.0.2-next.1-experimental-255e232 → 6.0.2-next.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 +8 -5
- package/out/api/fetch.d.ts +8 -6
- package/out/api/fetch.d.ts.map +1 -1
- package/out/api/fetch.js +48 -28
- package/out/api/runtime.d.ts +0 -1
- package/out/api/runtime.d.ts.map +1 -1
- package/out/authorization/index.d.ts.map +1 -1
- package/out/authorization/index.js +1 -7
- package/out/index.d.ts +3 -4
- package/out/index.d.ts.map +1 -1
- package/out/index.js +11 -11
- package/out/webTrigger.d.ts.map +1 -1
- package/out/webTrigger.js +7 -7
- package/package.json +3 -3
- package/out/api/index.d.ts +0 -9
- package/out/api/index.d.ts.map +0 -1
- package/out/api/index.js +0 -64
- package/out/api/polyfill-response.d.ts +0 -3
- package/out/api/polyfill-response.d.ts.map +0 -1
- package/out/api/polyfill-response.js +0 -12
- package/out/runtime/fetch-and-storage.d.ts +0 -10
- package/out/runtime/fetch-and-storage.d.ts.map +0 -1
- package/out/runtime/fetch-and-storage.js +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# @forge/api
|
|
2
2
|
|
|
3
|
-
## 6.0.2-next.
|
|
3
|
+
## 6.0.2-next.3
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
7
|
+
- ebad936: Added support for feature flags requests in \_\_fetchProduct
|
|
8
|
+
|
|
9
|
+
## 6.0.2-next.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e118b07: Remove remnants of sandbox runtime
|
|
11
14
|
|
|
12
15
|
## 6.0.2-next.1
|
|
13
16
|
|
package/out/api/fetch.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FetchAPI, FetchMethod,
|
|
1
|
+
import { FetchAPI, FetchMethod, RequestProductMethod, Response } from '..';
|
|
2
2
|
export declare type AuthProvider = 'app' | 'user' | 'none';
|
|
3
|
-
declare type RemoteAPI = 'jira' | 'confluence' | 'stargate' | 'bitbucket' | 'sql' | 'os';
|
|
3
|
+
declare type RemoteAPI = 'jira' | 'confluence' | 'stargate' | 'bitbucket' | 'sql' | 'os' | 'feature-flags';
|
|
4
4
|
declare type ExternalAuthProvider = string;
|
|
5
5
|
declare type ExternalAuthRemote = string;
|
|
6
6
|
declare type FetchArgs = {
|
|
7
7
|
provider: AuthProvider;
|
|
8
8
|
remote: RemoteAPI;
|
|
9
|
-
type: 'fpp' | 'sql' | 'os';
|
|
9
|
+
type: 'fpp' | 'sql' | 'os' | 'feature-flags';
|
|
10
10
|
accountId?: string;
|
|
11
11
|
};
|
|
12
12
|
declare type ExternalAuthFetchArgs = {
|
|
@@ -18,8 +18,10 @@ export declare function __fetchProduct(args: FetchArgs): FetchMethod;
|
|
|
18
18
|
export declare function fetchRemote(args: ExternalAuthFetchArgs): FetchMethod;
|
|
19
19
|
export declare const getForgeProxyError: (response: Response) => string | null;
|
|
20
20
|
export declare const handleProxyResponseErrors: (response: Response) => void;
|
|
21
|
-
export declare const
|
|
22
|
-
export declare
|
|
23
|
-
export declare function
|
|
21
|
+
export declare const wrapRequestGraph: (requestGraphApi: FetchMethod) => (query: string, variables?: any, headers?: {}) => Promise<Response>;
|
|
22
|
+
export declare const wrapRequestConnectedData: (x: FetchMethod) => RequestProductMethod;
|
|
23
|
+
export declare function getFetchAPI(): FetchAPI;
|
|
24
|
+
export declare const __requestAtlassianAsApp: FetchMethod;
|
|
25
|
+
export declare const __requestAtlassianAsUser: FetchMethod;
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=fetch.d.ts.map
|
package/out/api/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/api/fetch.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uBAAuB,EAAE,WAAuC,CAAC;AAC9E,eAAO,MAAM,wBAAwB,EAAE,WAAwC,CAAC"}
|
package/out/api/fetch.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.__requestAtlassianAsUser = exports.__requestAtlassianAsApp = exports.getFetchAPI = exports.wrapRequestConnectedData = exports.wrapRequestGraph = exports.handleProxyResponseErrors = exports.getForgeProxyError = exports.fetchRemote = exports.__fetchProduct = void 0;
|
|
4
|
+
const safeUrl_1 = require("../safeUrl");
|
|
5
5
|
const runtime_1 = require("./runtime");
|
|
6
|
-
const polyfill_response_1 = require("./polyfill-response");
|
|
7
6
|
const errors_1 = require("./errors");
|
|
8
7
|
async function wrapInMetrics(options, cb) {
|
|
9
8
|
const metrics = (0, runtime_1.__getRuntime)().metrics;
|
|
@@ -87,7 +86,7 @@ function buildExternalAuthAccountsInfo(provider, remote) {
|
|
|
87
86
|
hasCredentials: async (scopes) => wrapInMetrics({ name: 'api.asUser.withProvider.hasCredentials', tags: { passingScopes: String(!!scopes) } }, async () => !scopes || scopes.every((scope) => account.scopes.includes(scope))),
|
|
88
87
|
requestCredentials: lazyThrowNeedsAuthenticationError(provider),
|
|
89
88
|
getAccount: async () => wrapInMetrics({ name: 'api.asUser.withProvider.getAccount' }, async () => account),
|
|
90
|
-
fetch:
|
|
89
|
+
fetch: wrapWithRouteUnwrapper(fetchRemote({ provider, remote: remote ?? getDefaultRemote(provider), account: outboundAuthAccountId }))
|
|
91
90
|
});
|
|
92
91
|
return accounts.map((account) => {
|
|
93
92
|
const authAccount = buildAccountModel(account);
|
|
@@ -97,11 +96,6 @@ function buildExternalAuthAccountsInfo(provider, remote) {
|
|
|
97
96
|
};
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
|
-
const addMagicAgent = (init, agentOverride) => ({
|
|
101
|
-
...init,
|
|
102
|
-
agent: (agentOverride ?? 'FORGE_PRODUCT_REQUEST')
|
|
103
|
-
});
|
|
104
|
-
exports.addMagicAgent = addMagicAgent;
|
|
105
99
|
const throwNotImplementedError = () => {
|
|
106
100
|
throw new Error('not implemented');
|
|
107
101
|
};
|
|
@@ -137,36 +131,62 @@ const withProvider = (provider, remote) => {
|
|
|
137
131
|
fetch: defaultAccountInfo ? defaultAccountInfo.methods.fetch : lazyThrowNoValidCredentialsError()
|
|
138
132
|
};
|
|
139
133
|
};
|
|
140
|
-
|
|
134
|
+
const wrapWithRouteUnwrapper = (fetch) => (path, init) => {
|
|
135
|
+
const stringPath = (0, safeUrl_1.isRoute)(path) ? path.value : path;
|
|
136
|
+
return fetch(stringPath, init);
|
|
137
|
+
};
|
|
138
|
+
const wrapRequestProduct = (requestProduct) => (path, init) => {
|
|
139
|
+
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path);
|
|
140
|
+
return requestProduct(safeUrl.value, init);
|
|
141
|
+
};
|
|
142
|
+
const wrapRequestGraph = (requestGraphApi) => (query, variables, headers = {}) => requestGraphApi('/graphql', {
|
|
143
|
+
method: 'POST',
|
|
144
|
+
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
145
|
+
body: JSON.stringify({
|
|
146
|
+
query,
|
|
147
|
+
...(variables ? { variables } : {})
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
exports.wrapRequestGraph = wrapRequestGraph;
|
|
151
|
+
const wrapRequestConnectedData = (fetch) => (path, init) => {
|
|
152
|
+
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path);
|
|
153
|
+
return fetch(`/connected-data/${safeUrl.value.replace(/^\/+/, '')}`, init);
|
|
154
|
+
};
|
|
155
|
+
exports.wrapRequestConnectedData = wrapRequestConnectedData;
|
|
156
|
+
function getFetchAPI() {
|
|
141
157
|
if (global.fetch === undefined) {
|
|
142
158
|
global.fetch = async () => {
|
|
143
159
|
throw new Error('The fetch function is not available');
|
|
144
160
|
};
|
|
145
161
|
}
|
|
146
162
|
return {
|
|
147
|
-
fetch:
|
|
148
|
-
requestJira:
|
|
149
|
-
requestConfluence:
|
|
150
|
-
requestBitbucket:
|
|
163
|
+
fetch: wrapWithRouteUnwrapper(fetch),
|
|
164
|
+
requestJira: wrapRequestProduct(__fetchProduct({ provider: 'none', remote: 'jira', type: 'fpp' })),
|
|
165
|
+
requestConfluence: wrapRequestProduct(__fetchProduct({ provider: 'none', remote: 'confluence', type: 'fpp' })),
|
|
166
|
+
requestBitbucket: wrapRequestProduct(__fetchProduct({ provider: 'none', remote: 'bitbucket', type: 'fpp' })),
|
|
151
167
|
asUser: (userId) => ({
|
|
152
|
-
requestJira:
|
|
153
|
-
requestConfluence:
|
|
154
|
-
requestBitbucket:
|
|
155
|
-
requestGraph: (0,
|
|
156
|
-
requestConnectedData: (0,
|
|
168
|
+
requestJira: wrapRequestProduct(__fetchProduct({ provider: 'user', remote: 'jira', type: 'fpp', accountId: userId })),
|
|
169
|
+
requestConfluence: wrapRequestProduct(__fetchProduct({ provider: 'user', remote: 'confluence', type: 'fpp', accountId: userId })),
|
|
170
|
+
requestBitbucket: wrapRequestProduct(__fetchProduct({ provider: 'user', remote: 'bitbucket', type: 'fpp', accountId: userId })),
|
|
171
|
+
requestGraph: (0, exports.wrapRequestGraph)(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp', accountId: userId })),
|
|
172
|
+
requestConnectedData: (0, exports.wrapRequestConnectedData)(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp' })),
|
|
157
173
|
withProvider
|
|
158
174
|
}),
|
|
159
175
|
asApp: () => ({
|
|
160
|
-
requestJira:
|
|
161
|
-
requestConfluence:
|
|
162
|
-
requestBitbucket:
|
|
163
|
-
requestGraph: (0,
|
|
164
|
-
requestConnectedData: (0,
|
|
176
|
+
requestJira: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'jira', type: 'fpp' })),
|
|
177
|
+
requestConfluence: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'confluence', type: 'fpp' })),
|
|
178
|
+
requestBitbucket: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'bitbucket', type: 'fpp' })),
|
|
179
|
+
requestGraph: (0, exports.wrapRequestGraph)(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' })),
|
|
180
|
+
requestConnectedData: (0, exports.wrapRequestConnectedData)(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' }))
|
|
165
181
|
})
|
|
166
182
|
};
|
|
167
183
|
}
|
|
168
|
-
exports.
|
|
169
|
-
function
|
|
170
|
-
|
|
184
|
+
exports.getFetchAPI = getFetchAPI;
|
|
185
|
+
function getRequestStargate(provider) {
|
|
186
|
+
if (provider !== 'app' && provider !== 'user') {
|
|
187
|
+
throw new Error(`Unsupported provider: ${provider}`);
|
|
188
|
+
}
|
|
189
|
+
return __fetchProduct({ provider, remote: 'stargate', type: 'fpp' });
|
|
171
190
|
}
|
|
172
|
-
exports.
|
|
191
|
+
exports.__requestAtlassianAsApp = getRequestStargate('app');
|
|
192
|
+
exports.__requestAtlassianAsUser = getRequestStargate('user');
|
package/out/api/runtime.d.ts
CHANGED
package/out/api/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAoD,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAIlH,UAAU,KAAK;IACb,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3C;AAED,UAAU,OAAO;IACf,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,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E,EAAE,GAAG,EACvD,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,GAClC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,CAqBjC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,IAAI,GAAG,IAAI,CAShG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS;;;;;CAmBrB,CAAC"}
|
|
@@ -4,13 +4,7 @@ exports.authorize = void 0;
|
|
|
4
4
|
const auth_1 = require("@forge/auth");
|
|
5
5
|
const __1 = require("..");
|
|
6
6
|
const authorize = () => {
|
|
7
|
-
|
|
8
|
-
if (global.api) {
|
|
9
|
-
accountId = process.env.__CURRENT_USER_ACCOUNT_ID;
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
accountId = (0, __1.__getRuntime)().aaid;
|
|
13
|
-
}
|
|
7
|
+
const accountId = (0, __1.__getRuntime)().aaid;
|
|
14
8
|
if (!accountId) {
|
|
15
9
|
throw new Error(`Couldn’t find the accountId of the invoking user. This API can only be used inside user-invoked modules.`);
|
|
16
10
|
}
|
package/out/index.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import { QueryApi, EntityStorageApi } from '@forge/storage';
|
|
|
2
2
|
import { authorize } from './authorization';
|
|
3
3
|
import { Route } from './safeUrl';
|
|
4
4
|
import { webTrigger, WebTriggerResponse, WebTriggerRequest, WebTriggerMethod, WebTriggerContext } from './webTrigger';
|
|
5
|
-
import { __requestAtlassianAsApp, __requestAtlassianAsUser } from './runtime/fetch-and-storage';
|
|
6
5
|
import { invokeRemote } from './api/remote';
|
|
7
|
-
import { __fetchProduct } from './api/fetch';
|
|
6
|
+
import { __fetchProduct, __requestAtlassianAsApp, __requestAtlassianAsUser } from './api/fetch';
|
|
8
7
|
export interface RequestInit {
|
|
9
8
|
body?: ArrayBuffer | string | URLSearchParams;
|
|
10
9
|
headers?: Record<string, string>;
|
|
@@ -77,8 +76,8 @@ export interface ForgeStorageAPI extends StorageAPI {
|
|
|
77
76
|
setSecret: (key: string, value: any) => Promise<void>;
|
|
78
77
|
deleteSecret: (key: string) => Promise<void>;
|
|
79
78
|
}
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
declare type AsUserFetchMethods = RequestProductMethods & GraphQLFetchMethods & ConnectedDataFetchMethods & ExternalAuthFetchMethodsProvider;
|
|
80
|
+
declare type AsAppFetchMethods = RequestProductMethods & GraphQLFetchMethods & ConnectedDataFetchMethods;
|
|
82
81
|
export interface FetchAPI extends RequestProductMethods {
|
|
83
82
|
asUser(userId?: string): AsUserFetchMethods;
|
|
84
83
|
asApp(): AsAppFetchMethods;
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,QAAQ,EAAE,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,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACf,CAAC;AAKF,eAAO,MAAM,0BAA0B,EAAE,MAAM,WAA2C,CAAC;AAE3F,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,KAAK,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,SAAS,EACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,iBAAiB,EACjB,UAAU,EACV,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,EAC7B,eAAe,EACf,8BAA8B,EAC9B,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,IAAI,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "authorize", { enumerable: true, get: function ()
|
|
|
7
7
|
const privacy_1 = require("./privacy");
|
|
8
8
|
const webTrigger_1 = require("./webTrigger");
|
|
9
9
|
Object.defineProperty(exports, "webTrigger", { enumerable: true, get: function () { return webTrigger_1.webTrigger; } });
|
|
10
|
-
const fetch_and_storage_1 = require("./runtime/fetch-and-storage");
|
|
11
|
-
Object.defineProperty(exports, "__requestAtlassianAsApp", { enumerable: true, get: function () { return fetch_and_storage_1.__requestAtlassianAsApp; } });
|
|
12
|
-
Object.defineProperty(exports, "__requestAtlassianAsUser", { enumerable: true, get: function () { return fetch_and_storage_1.__requestAtlassianAsUser; } });
|
|
13
10
|
const remote_1 = require("./api/remote");
|
|
14
11
|
Object.defineProperty(exports, "invokeRemote", { enumerable: true, get: function () { return remote_1.invokeRemote; } });
|
|
15
12
|
const fetch_1 = require("./api/fetch");
|
|
16
13
|
Object.defineProperty(exports, "__fetchProduct", { enumerable: true, get: function () { return fetch_1.__fetchProduct; } });
|
|
17
|
-
|
|
14
|
+
Object.defineProperty(exports, "__requestAtlassianAsApp", { enumerable: true, get: function () { return fetch_1.__requestAtlassianAsApp; } });
|
|
15
|
+
Object.defineProperty(exports, "__requestAtlassianAsUser", { enumerable: true, get: function () { return fetch_1.__requestAtlassianAsUser; } });
|
|
16
|
+
const runtime_1 = require("./api/runtime");
|
|
17
|
+
const fetchAPI = (0, fetch_1.getFetchAPI)();
|
|
18
18
|
const asUser = fetchAPI.asUser;
|
|
19
19
|
exports.asUser = asUser;
|
|
20
20
|
const asApp = fetchAPI.asApp;
|
|
@@ -27,17 +27,17 @@ const requestConfluence = fetchAPI.requestConfluence;
|
|
|
27
27
|
exports.requestConfluence = requestConfluence;
|
|
28
28
|
const requestBitbucket = fetchAPI.requestBitbucket;
|
|
29
29
|
exports.requestBitbucket = requestBitbucket;
|
|
30
|
-
const storage = (0, storage_1.getStorageInstanceWithQuery)(new storage_1.GlobalStorage(
|
|
30
|
+
const storage = (0, storage_1.getStorageInstanceWithQuery)(new storage_1.GlobalStorage(fetch_1.__requestAtlassianAsApp, () => (0, runtime_1.__getRuntime)().metrics));
|
|
31
31
|
exports.storage = storage;
|
|
32
32
|
const API = {
|
|
33
33
|
...fetchAPI,
|
|
34
34
|
invokeRemote: remote_1.invokeRemote
|
|
35
35
|
};
|
|
36
36
|
exports.privacy = {
|
|
37
|
-
reportPersonalData: (0, privacy_1.createReportPersonalData)(
|
|
37
|
+
reportPersonalData: (0, privacy_1.createReportPersonalData)(fetch_1.__requestAtlassianAsApp)
|
|
38
38
|
};
|
|
39
39
|
exports.default = API;
|
|
40
|
-
const createRequestStargateAsApp = () =>
|
|
40
|
+
const createRequestStargateAsApp = () => fetch_1.__requestAtlassianAsApp;
|
|
41
41
|
exports.createRequestStargateAsApp = createRequestStargateAsApp;
|
|
42
42
|
var storage_2 = require("@forge/storage");
|
|
43
43
|
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return storage_2.startsWith; } });
|
|
@@ -48,10 +48,10 @@ var safeUrl_1 = require("./safeUrl");
|
|
|
48
48
|
Object.defineProperty(exports, "route", { enumerable: true, get: function () { return safeUrl_1.route; } });
|
|
49
49
|
Object.defineProperty(exports, "assumeTrustedRoute", { enumerable: true, get: function () { return safeUrl_1.assumeTrustedRoute; } });
|
|
50
50
|
Object.defineProperty(exports, "routeFromAbsolute", { enumerable: true, get: function () { return safeUrl_1.routeFromAbsolute; } });
|
|
51
|
-
var
|
|
52
|
-
Object.defineProperty(exports, "getAppContext", { enumerable: true, get: function () { return
|
|
53
|
-
Object.defineProperty(exports, "__getRuntime", { enumerable: true, get: function () { return
|
|
54
|
-
Object.defineProperty(exports, "bindInvocationContext", { enumerable: true, get: function () { return
|
|
51
|
+
var runtime_2 = require("./api/runtime");
|
|
52
|
+
Object.defineProperty(exports, "getAppContext", { enumerable: true, get: function () { return runtime_2.getAppContext; } });
|
|
53
|
+
Object.defineProperty(exports, "__getRuntime", { enumerable: true, get: function () { return runtime_2.__getRuntime; } });
|
|
54
|
+
Object.defineProperty(exports, "bindInvocationContext", { enumerable: true, get: function () { return runtime_2.bindInvocationContext; } });
|
|
55
55
|
var errors_1 = require("./api/errors");
|
|
56
56
|
Object.defineProperty(exports, "NeedsAuthenticationError", { enumerable: true, get: function () { return errors_1.NeedsAuthenticationError; } });
|
|
57
57
|
Object.defineProperty(exports, "ProxyRequestError", { enumerable: true, get: function () { return errors_1.ProxyRequestError; } });
|
package/out/webTrigger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webTrigger.d.ts","sourceRoot":"","sources":["../src/webTrigger.ts"],"names":[],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AC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC3C"}
|
package/out/webTrigger.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webTrigger = void 0;
|
|
4
4
|
const runtime_1 = require("./api/runtime");
|
|
5
|
-
const
|
|
5
|
+
const fetch_1 = require("./api/fetch");
|
|
6
6
|
const proxyGetWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrl', async (webTriggerModuleKey, forceCreate) => {
|
|
7
7
|
const runtime = (0, runtime_1.__getRuntime)();
|
|
8
|
-
const response = await (0,
|
|
8
|
+
const response = await (0, fetch_1.__requestAtlassianAsApp)('/graphql', {
|
|
9
9
|
method: 'POST',
|
|
10
10
|
headers: { 'Content-Type': 'application/json' },
|
|
11
11
|
body: JSON.stringify({
|
|
@@ -38,7 +38,7 @@ const proxyGetWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrl
|
|
|
38
38
|
});
|
|
39
39
|
const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTriggerUrl', async (webTriggerUrl) => {
|
|
40
40
|
const callDelete = async (webTriggerUrlId) => {
|
|
41
|
-
const response = await (0,
|
|
41
|
+
const response = await (0, fetch_1.__requestAtlassianAsApp)('/graphql', {
|
|
42
42
|
method: 'POST',
|
|
43
43
|
headers: { 'Content-Type': 'application/json' },
|
|
44
44
|
body: JSON.stringify({
|
|
@@ -71,7 +71,7 @@ const proxyDeleteWebTriggerURL = (0, runtime_1.wrapInMetrics)('api.deleteWebTrig
|
|
|
71
71
|
});
|
|
72
72
|
const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTriggerUrlIds', async (webTriggerUrl) => {
|
|
73
73
|
const runtime = (0, runtime_1.__getRuntime)();
|
|
74
|
-
const response = await (0,
|
|
74
|
+
const response = await (0, fetch_1.__requestAtlassianAsApp)('/graphql', {
|
|
75
75
|
method: 'POST',
|
|
76
76
|
headers: { 'Content-Type': 'application/json' },
|
|
77
77
|
body: JSON.stringify({
|
|
@@ -106,7 +106,7 @@ const proxyGetWebTriggerUrlIds = (0, runtime_1.wrapInMetrics)('api.getWebTrigger
|
|
|
106
106
|
return result;
|
|
107
107
|
});
|
|
108
108
|
exports.webTrigger = {
|
|
109
|
-
getUrl: async (webTriggerModuleKey, forceCreate = false) =>
|
|
110
|
-
deleteUrl: async (webTriggerUrl) =>
|
|
111
|
-
getUrlIds: async (webTriggerUrl) =>
|
|
109
|
+
getUrl: async (webTriggerModuleKey, forceCreate = false) => proxyGetWebTriggerURL(webTriggerModuleKey, forceCreate),
|
|
110
|
+
deleteUrl: async (webTriggerUrl) => proxyDeleteWebTriggerURL(webTriggerUrl),
|
|
111
|
+
getUrlIds: async (webTriggerUrl) => proxyGetWebTriggerUrlIds(webTriggerUrl)
|
|
112
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/api",
|
|
3
|
-
"version": "6.0.2-next.
|
|
3
|
+
"version": "6.0.2-next.3",
|
|
4
4
|
"description": "Forge API methods",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@atlassian/ari": "^2.199.0",
|
|
17
17
|
"@atlassian/in-memory-metrics": "0.1.0",
|
|
18
18
|
"@atlassian/metrics-interface": "4.0.0",
|
|
19
|
-
"@forge/runtime": "6.0.
|
|
19
|
+
"@forge/runtime": "6.0.2-next.0",
|
|
20
20
|
"@types/node": "20.19.1",
|
|
21
21
|
"@types/node-fetch": "^2.6.12",
|
|
22
22
|
"expect-type": "^0.17.3",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@forge/auth": "0.0.8",
|
|
29
29
|
"@forge/egress": "2.0.1",
|
|
30
30
|
"@forge/i18n": "0.0.7",
|
|
31
|
-
"@forge/storage": "2.0.2-next.0
|
|
31
|
+
"@forge/storage": "2.0.2-next.0",
|
|
32
32
|
"headers-utils": "^3.0.2"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
package/out/api/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RequestInfo, RequestInit } from 'node-fetch';
|
|
2
|
-
import { FetchAPI, FetchMethod, RequestProductMethod, FetchMethodAllowingRoute, APIResponse } from '..';
|
|
3
|
-
export declare type FetchWrapper = (fetchApi: Function) => (url: RequestInfo, init?: RequestInit) => Promise<APIResponse>;
|
|
4
|
-
export declare const wrapRequestGraph: (requestGraphApi: FetchMethod) => (query: string, variables?: any, headers?: {}) => Promise<import("..").Response>;
|
|
5
|
-
export declare const wrapRequestConnectedData: (x: FetchMethod) => RequestProductMethod;
|
|
6
|
-
export declare const wrapRequestProduct: (x: FetchMethod) => RequestProductMethod;
|
|
7
|
-
export declare const wrapWithRouteUnwrapper: (x: FetchMethod) => FetchMethodAllowingRoute;
|
|
8
|
-
export declare const wrapFetchApiMethods: (api: any, wrapFetch: FetchWrapper) => FetchAPI;
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/out/api/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EACL,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EAExB,WAAW,EAGZ,MAAM,IAAI,CAAC;AAIZ,oBAAY,YAAY,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAElH,eAAO,MAAM,gBAAgB,oBACT,WAAW,aACrB,MAAM,cAAc,GAAG,iDAQ3B,CAAC;AAEP,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,oBAG1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,oBAGpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,wBAGxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,GAAG,aAAa,YAAY,KAAG,QA0CvE,CAAC"}
|
package/out/api/index.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapFetchApiMethods = exports.wrapWithRouteUnwrapper = exports.wrapRequestProduct = exports.wrapRequestConnectedData = exports.wrapRequestGraph = void 0;
|
|
4
|
-
const safeUrl_1 = require("../safeUrl");
|
|
5
|
-
const wrapRequestGraph = (requestGraphApi) => (query, variables, headers = {}) => requestGraphApi('/graphql', {
|
|
6
|
-
method: 'POST',
|
|
7
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
8
|
-
body: JSON.stringify({
|
|
9
|
-
query,
|
|
10
|
-
...(variables ? { variables } : {})
|
|
11
|
-
})
|
|
12
|
-
});
|
|
13
|
-
exports.wrapRequestGraph = wrapRequestGraph;
|
|
14
|
-
const wrapRequestConnectedData = (fetch) => (path, init) => {
|
|
15
|
-
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path);
|
|
16
|
-
return fetch(`/connected-data/${safeUrl.value.replace(/^\/+/, '')}`, init);
|
|
17
|
-
};
|
|
18
|
-
exports.wrapRequestConnectedData = wrapRequestConnectedData;
|
|
19
|
-
const wrapRequestProduct = (requestProduct) => (path, init) => {
|
|
20
|
-
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path);
|
|
21
|
-
return requestProduct(safeUrl.value, init);
|
|
22
|
-
};
|
|
23
|
-
exports.wrapRequestProduct = wrapRequestProduct;
|
|
24
|
-
const wrapWithRouteUnwrapper = (fetch) => (path, init) => {
|
|
25
|
-
const stringPath = (0, safeUrl_1.isRoute)(path) ? path.value : path;
|
|
26
|
-
return fetch(stringPath, init);
|
|
27
|
-
};
|
|
28
|
-
exports.wrapWithRouteUnwrapper = wrapWithRouteUnwrapper;
|
|
29
|
-
const wrapFetchApiMethods = (api, wrapFetch) => {
|
|
30
|
-
return {
|
|
31
|
-
fetch: (0, exports.wrapWithRouteUnwrapper)(wrapFetch(api.fetch)),
|
|
32
|
-
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.requestJira)),
|
|
33
|
-
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.requestConfluence)),
|
|
34
|
-
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.requestBitbucket)),
|
|
35
|
-
asUser: () => ({
|
|
36
|
-
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestJira)),
|
|
37
|
-
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestConfluence)),
|
|
38
|
-
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.asUser().requestBitbucket)),
|
|
39
|
-
requestGraph: (0, exports.wrapRequestGraph)(wrapFetch(api.asUser().requestGraph)),
|
|
40
|
-
requestConnectedData: (0, exports.wrapRequestConnectedData)(wrapFetch(api.asUser().requestConnectedData)),
|
|
41
|
-
withProvider: (provider, remoteName, tokenId) => {
|
|
42
|
-
const { hasCredentials, requestCredentials, listCredentials, fetch: withProviderFetch, listAccounts, getAccount, asAccount } = api.asUser().withProvider(provider, remoteName, tokenId);
|
|
43
|
-
const wrappedRequestRemote = (0, exports.wrapWithRouteUnwrapper)(wrapFetch(withProviderFetch));
|
|
44
|
-
return {
|
|
45
|
-
hasCredentials,
|
|
46
|
-
requestCredentials,
|
|
47
|
-
listCredentials,
|
|
48
|
-
fetch: wrappedRequestRemote,
|
|
49
|
-
listAccounts,
|
|
50
|
-
getAccount,
|
|
51
|
-
asAccount
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
asApp: () => ({
|
|
56
|
-
requestJira: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestJira)),
|
|
57
|
-
requestConfluence: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestConfluence)),
|
|
58
|
-
requestGraph: (0, exports.wrapRequestGraph)(wrapFetch(api.asApp().requestGraph)),
|
|
59
|
-
requestBitbucket: (0, exports.wrapRequestProduct)(wrapFetch(api.asApp().requestBitbucket)),
|
|
60
|
-
requestConnectedData: (0, exports.wrapRequestConnectedData)(wrapFetch(api.asApp().requestConnectedData))
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
exports.wrapFetchApiMethods = wrapFetchApiMethods;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill-response.d.ts","sourceRoot":"","sources":["../../src/api/polyfill-response.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAGjC,eAAO,MAAM,iBAAiB,EAAE,YAQ7B,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformResponse = void 0;
|
|
4
|
-
const headers_utils_1 = require("headers-utils");
|
|
5
|
-
const transformResponse = (fetchApi) => async (url, init) => {
|
|
6
|
-
const response = await fetchApi(url, init);
|
|
7
|
-
return {
|
|
8
|
-
...response,
|
|
9
|
-
headers: new headers_utils_1.Headers(response.headers)
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
exports.transformResponse = transformResponse;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FetchMethod } from '..';
|
|
2
|
-
import { AuthProvider } from '../api/fetch';
|
|
3
|
-
import { Metrics } from '../api/runtime';
|
|
4
|
-
export declare function getContextAri(): any;
|
|
5
|
-
export declare function getFetchAPI(): import("..").FetchAPI;
|
|
6
|
-
export declare function getMetrics(): Metrics | undefined;
|
|
7
|
-
export declare function getRequestStargate(provider: AuthProvider): FetchMethod;
|
|
8
|
-
export declare const __requestAtlassianAsApp: FetchMethod;
|
|
9
|
-
export declare const __requestAtlassianAsUser: FetchMethod;
|
|
10
|
-
//# sourceMappingURL=fetch-and-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-and-storage.d.ts","sourceRoot":"","sources":["../../src/runtime/fetch-and-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,EAA2D,YAAY,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAgB,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEvD,wBAAgB,aAAa,QAE5B;AAED,wBAAgB,WAAW,0BAO1B;AAED,wBAAgB,UAAU,IAAI,OAAO,GAAG,SAAS,CAOhD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,WAAW,CAetE;AAED,eAAO,MAAM,uBAAuB,EAAE,WAAuC,CAAC;AAC9E,eAAO,MAAM,wBAAwB,EAAE,WAAwC,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__requestAtlassianAsUser = exports.__requestAtlassianAsApp = exports.getRequestStargate = exports.getMetrics = exports.getFetchAPI = exports.getContextAri = void 0;
|
|
4
|
-
const fetch_1 = require("../api/fetch");
|
|
5
|
-
const runtime_1 = require("../api/runtime");
|
|
6
|
-
function getContextAri() {
|
|
7
|
-
return global.api?.__getAppAri?.() ?? (0, runtime_1.__getRuntime)().contextAri;
|
|
8
|
-
}
|
|
9
|
-
exports.getContextAri = getContextAri;
|
|
10
|
-
function getFetchAPI() {
|
|
11
|
-
const { api: sandboxAPI } = global;
|
|
12
|
-
if (sandboxAPI && Object.keys(sandboxAPI).length) {
|
|
13
|
-
return (0, fetch_1.getSandboxRuntimeAPI)(sandboxAPI);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
return (0, fetch_1.getNodeRuntimeAPI)();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.getFetchAPI = getFetchAPI;
|
|
20
|
-
function getMetrics() {
|
|
21
|
-
if (global.api) {
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
|
-
return (0, runtime_1.__getRuntime)().metrics;
|
|
25
|
-
}
|
|
26
|
-
exports.getMetrics = getMetrics;
|
|
27
|
-
function getRequestStargate(provider) {
|
|
28
|
-
if (provider !== 'app' && provider !== 'user') {
|
|
29
|
-
throw new Error(`Unsupported provider: ${provider}`);
|
|
30
|
-
}
|
|
31
|
-
const sandboxApi = global.api;
|
|
32
|
-
if (sandboxApi) {
|
|
33
|
-
switch (provider) {
|
|
34
|
-
case 'app':
|
|
35
|
-
return sandboxApi.asApp().__requestAtlassian;
|
|
36
|
-
case 'user':
|
|
37
|
-
return sandboxApi.asUser().__requestAtlassian;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return (0, fetch_1.__fetchProduct)({ provider, remote: 'stargate', type: 'fpp' });
|
|
41
|
-
}
|
|
42
|
-
exports.getRequestStargate = getRequestStargate;
|
|
43
|
-
exports.__requestAtlassianAsApp = getRequestStargate('app');
|
|
44
|
-
exports.__requestAtlassianAsUser = getRequestStargate('user');
|