@ethlete/query 2.5.1 → 2.5.2

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.
@@ -601,7 +601,8 @@ const castQueryCreatorTypes = (config) => {
601
601
  const computeQueryMethod = (config) => {
602
602
  let method;
603
603
  if (isGqlQueryConfig(config.config)) {
604
- method = transformMethod({ method: config.config.method, transferVia: config.config.transferVia });
604
+ const transferVia = config.config.transferVia ?? config.client.config.request?.gql?.transferVia;
605
+ method = transformMethod({ method: config.config.method, transferVia });
605
606
  }
606
607
  else {
607
608
  method = transformMethod({ method: config.config.method });
@@ -615,7 +616,7 @@ const computeQueryBody = (config) => {
615
616
  config.method === 'OPTIONS' ||
616
617
  (isGqlQueryConfig(config.config) &&
617
618
  (config.config.transferVia === 'GET' ||
618
- (config.clientConfig.request?.gql?.transferVia === 'GET' && !config.config.transferVia)))) {
619
+ (config.client.config.request?.gql?.transferVia === 'GET' && !config.config.transferVia)))) {
619
620
  return undefined;
620
621
  }
621
622
  if (isGqlQueryConfig(config.config)) {
@@ -651,7 +652,7 @@ const computeQueryHeaders = (config) => {
651
652
  const computeQueryQueryParams = (config) => {
652
653
  if (isGqlQueryConfig(config.config) &&
653
654
  (config.config.transferVia === 'GET' ||
654
- (config.clientConfig.request?.gql?.transferVia === 'GET' && !config.config.transferVia))) {
655
+ (config.client.config.request?.gql?.transferVia === 'GET' && !config.config.transferVia))) {
655
656
  const queryTemplate = config.config.query;
656
657
  const query = transformGql(queryTemplate);
657
658
  let params = query(config.args?.variables);
@@ -742,10 +743,10 @@ class Query {
742
743
  meta,
743
744
  });
744
745
  this._updateUseResultInDependencies();
745
- const method = computeQueryMethod({ config: this._queryConfig });
746
+ const method = computeQueryMethod({ config: this._queryConfig, client: this._client });
746
747
  const body = computeQueryBody({
747
748
  config: this._queryConfig,
748
- clientConfig: this._client.config,
749
+ client: this._client,
749
750
  args: this._args,
750
751
  method,
751
752
  });
@@ -1729,7 +1730,7 @@ class QueryClient {
1729
1730
  base: this._clientConfig.baseRoute,
1730
1731
  route: queryConfig.route,
1731
1732
  pathParams: args?.pathParams,
1732
- queryParams: computeQueryQueryParams({ config: queryConfig, clientConfig: this._clientConfig, args }),
1733
+ queryParams: computeQueryQueryParams({ config: queryConfig, client: this, args }),
1733
1734
  });
1734
1735
  const cacheKey = isGqlQueryConfig(queryConfig) ? buildGqlCacheKey(queryConfig, args) : route;
1735
1736
  if (shouldCacheQuery(queryConfig.method)) {