@forge/api
8.4.0-next.68.4.0-next.7
out/api/fetch.js~
out/api/fetch.jsModified+18−10
Index: package/out/api/fetch.js
===================================================================
--- package/out/api/fetch.js
+++ package/out/api/fetch.js
@@ -157,18 +157,26 @@
...(variables ? { variables } : {})
})
});
exports.wrapRequestGraph = wrapRequestGraph;
-const wrapRequestTeamworkGraph = (requestGraphApi) => (query, variables, operationName, extensions, headers = {}) => requestGraphApi('/graphql/twg', {
- method: 'POST',
- headers: { ...headers, 'Content-Type': 'application/json' },
- body: JSON.stringify({
- query,
- ...(variables ? { variables } : {}),
- ...(operationName ? { operationName } : {}),
- ...(extensions ? { extensions } : {})
- })
-});
+const wrapRequestTeamworkGraph = (requestGraphApi) => (query, variables, operationName, extensions, headers = {}) => {
+ const { contextAri } = (0, runtime_1.__getRuntime)();
+ const hasQueryContext = Object.keys(headers).some((name) => name.toLowerCase() === 'x-query-context');
+ return requestGraphApi('/graphql/twg', {
+ method: 'POST',
+ headers: {
+ ...(contextAri && !hasQueryContext ? { 'X-Query-Context': contextAri } : {}),
+ ...headers,
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ query,
+ ...(variables ? { variables } : {}),
+ ...(operationName ? { operationName } : {}),
+ ...(extensions ? { extensions } : {})
+ })
+ });
+};
exports.wrapRequestTeamworkGraph = wrapRequestTeamworkGraph;
const wrapRequestConnectedData = (fetch) => (path, init) => {
const safeUrl = (0, safeUrl_1.requireSafeUrl)(path);
return fetch(`/connected-data/${safeUrl.value.replace(/^\/+/, '')}`, init);