@forge/api
8.1.1-next.0-experimental-fd0ebbc8.2.0-next.2
out/api/fetch.js~
out/api/fetch.jsModified+15−4
Index: package/out/api/fetch.js
===================================================================
--- package/out/api/fetch.js
+++ package/out/api/fetch.js
@@ -22,10 +22,11 @@
return async (path, init) => {
const response = await global.__forge_fetch__({
type: args.type,
provider: args.provider,
- remote: args.remote,
- accountId: args.accountId
+ accountId: args.accountId,
+ ...(args.remote ? { remote: args.remote } : {}),
+ ...(args.contextAri ? { contextAri: args.contextAri } : {})
}, path, init);
(0, exports.handleProxyResponseErrors)(response);
return response;
};
@@ -131,8 +132,16 @@
},
fetch: defaultAccountInfo ? defaultAccountInfo.methods.fetch : lazyThrowNoValidCredentialsError()
};
};
+const withContext = (provider, accountId) => (contextAri) => {
+ const requestProductFn = wrapRequestProduct(__fetchProduct({ provider, contextAri, type: 'fpp', accountId }));
+ return {
+ requestJira: requestProductFn,
+ requestConfluence: requestProductFn,
+ requestBitbucket: requestProductFn
+ };
+};
const wrapWithRouteUnwrapper = (fetch) => (path, init) => {
const stringPath = (0, safeUrl_1.isRoute)(path) ? path.value : path;
return fetch(stringPath, init);
};
@@ -183,17 +192,19 @@
requestGraph: (0, exports.wrapRequestGraph)(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp', accountId: userId })),
requestTeamworkGraph: (0, exports.wrapRequestTeamworkGraph)(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp', accountId: userId })),
requestConnectedData: (0, exports.wrapRequestConnectedData)(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp' })),
requestAtlassian: wrapRequestProduct(__fetchProduct({ provider: 'user', remote: 'stargate', type: 'fpp', accountId: userId })),
- withProvider
+ withProvider,
+ withContext: withContext('user', userId)
}),
asApp: () => ({
requestJira: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'jira', type: 'fpp' })),
requestConfluence: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'confluence', type: 'fpp' })),
requestBitbucket: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'bitbucket', type: 'fpp' })),
requestGraph: (0, exports.wrapRequestGraph)(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' })),
requestConnectedData: (0, exports.wrapRequestConnectedData)(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' })),
- requestAtlassian: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' }))
+ requestAtlassian: wrapRequestProduct(__fetchProduct({ provider: 'app', remote: 'stargate', type: 'fpp' })),
+ withContext: withContext('app')
})
};
}
function getRequestStargate(provider) {