@shopify/graphql-client
Version:
Shopify GraphQL Client - A lightweight generic GraphQL JS client to interact with Shopify GraphQL APIs
27 lines (24 loc) • 928 B
JavaScript
function generateGetHeaders(config) {
return (customHeaders) => {
return { ...(customHeaders ?? {}), ...config.headers };
};
}
function generateGetGQLClientParams({ getHeaders, getApiUrl }) {
return (operation, options) => {
const props = [operation];
if (options && Object.keys(options).length > 0) {
const { variables, apiVersion: propApiVersion, headers, retries } = options;
props.push({
...(variables ? { variables } : {}),
...(headers ? { headers: getHeaders(headers) } : {}),
...(propApiVersion ? { url: getApiUrl(propApiVersion) } : {}),
...(retries ? { retries } : {}),
});
}
return props;
};
}
exports.generateGetGQLClientParams = generateGetGQLClientParams;
exports.generateGetHeaders = generateGetHeaders;
//# sourceMappingURL=utilities.js.map
;