@ethlete/query 2.5.1 → 2.5.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.
@@ -600,9 +600,11 @@ const castQueryCreatorTypes = (config) => {
600
600
  return config.creator;
601
601
  };
602
602
  const computeQueryMethod = (config) => {
603
+ var _a, _b, _c;
603
604
  let method;
604
605
  if (isGqlQueryConfig(config.config)) {
605
- method = transformMethod({ method: config.config.method, transferVia: config.config.transferVia });
606
+ const transferVia = (_a = config.config.transferVia) !== null && _a !== void 0 ? _a : (_c = (_b = config.client.config.request) === null || _b === void 0 ? void 0 : _b.gql) === null || _c === void 0 ? void 0 : _c.transferVia;
607
+ method = transformMethod({ method: config.config.method, transferVia });
606
608
  }
607
609
  else {
608
610
  method = transformMethod({ method: config.config.method });
@@ -617,7 +619,7 @@ const computeQueryBody = (config) => {
617
619
  config.method === 'OPTIONS' ||
618
620
  (isGqlQueryConfig(config.config) &&
619
621
  (config.config.transferVia === 'GET' ||
620
- (((_b = (_a = config.clientConfig.request) === null || _a === void 0 ? void 0 : _a.gql) === null || _b === void 0 ? void 0 : _b.transferVia) === 'GET' && !config.config.transferVia)))) {
622
+ (((_b = (_a = config.client.config.request) === null || _a === void 0 ? void 0 : _a.gql) === null || _b === void 0 ? void 0 : _b.transferVia) === 'GET' && !config.config.transferVia)))) {
621
623
  return undefined;
622
624
  }
623
625
  if (isGqlQueryConfig(config.config)) {
@@ -656,7 +658,7 @@ const computeQueryQueryParams = (config) => {
656
658
  var _a, _b, _c, _d, _e, _f;
657
659
  if (isGqlQueryConfig(config.config) &&
658
660
  (config.config.transferVia === 'GET' ||
659
- (((_b = (_a = config.clientConfig.request) === null || _a === void 0 ? void 0 : _a.gql) === null || _b === void 0 ? void 0 : _b.transferVia) === 'GET' && !config.config.transferVia))) {
661
+ (((_b = (_a = config.client.config.request) === null || _a === void 0 ? void 0 : _a.gql) === null || _b === void 0 ? void 0 : _b.transferVia) === 'GET' && !config.config.transferVia))) {
660
662
  const queryTemplate = config.config.query;
661
663
  const query = transformGql(queryTemplate);
662
664
  let params = query((_c = config.args) === null || _c === void 0 ? void 0 : _c.variables);
@@ -750,10 +752,10 @@ class Query {
750
752
  meta,
751
753
  });
752
754
  this._updateUseResultInDependencies();
753
- const method = computeQueryMethod({ config: this._queryConfig });
755
+ const method = computeQueryMethod({ config: this._queryConfig, client: this._client });
754
756
  const body = computeQueryBody({
755
757
  config: this._queryConfig,
756
- clientConfig: this._client.config,
758
+ client: this._client,
757
759
  args: this._args,
758
760
  method,
759
761
  });
@@ -849,7 +851,12 @@ class Query {
849
851
  : interval(config.interval);
850
852
  this._pollingSubscription = _interval
851
853
  .pipe(takeUntil(config.takeUntil), finalize(() => this.stopPolling()))
852
- .subscribe(() => this.execute({ skipCache: true, _triggeredVia: 'poll' }));
854
+ .subscribe(() => {
855
+ if (this.state.type === "LOADING" /* QueryStateType.Loading */) {
856
+ return;
857
+ }
858
+ this.execute({ skipCache: true, _triggeredVia: 'poll' });
859
+ });
853
860
  return this;
854
861
  }
855
862
  stopPolling() {
@@ -1150,9 +1157,9 @@ class QueryDirective {
1150
1157
  }
1151
1158
  }
1152
1159
  }
1153
- QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1154
- QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.2", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
1155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: QueryDirective, decorators: [{
1160
+ QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1161
+ QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
1162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: QueryDirective, decorators: [{
1156
1163
  type: Directive,
1157
1164
  args: [{
1158
1165
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1477,9 +1484,9 @@ class InfinityQueryDirective {
1477
1484
  this._data$.next([]);
1478
1485
  }
1479
1486
  }
1480
- InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1481
- InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.2", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }, DestroyService], exportAs: ["infinityQuery"], ngImport: i0 });
1482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InfinityQueryDirective, decorators: [{
1487
+ InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1488
+ InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }, DestroyService], exportAs: ["infinityQuery"], ngImport: i0 });
1489
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: InfinityQueryDirective, decorators: [{
1483
1490
  type: Directive,
1484
1491
  args: [{
1485
1492
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1530,9 +1537,9 @@ class InfinityQueryTriggerDirective {
1530
1537
  this._observer.observe(this._elementRef.nativeElement);
1531
1538
  }
1532
1539
  }
1533
- InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1534
- InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.2", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
1535
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1540
+ InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1541
+ InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
1542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1536
1543
  type: Directive,
1537
1544
  args: [{
1538
1545
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1722,7 +1729,7 @@ class QueryClient {
1722
1729
  base: this._clientConfig.baseRoute,
1723
1730
  route: queryConfig.route,
1724
1731
  pathParams: args === null || args === void 0 ? void 0 : args.pathParams,
1725
- queryParams: computeQueryQueryParams({ config: queryConfig, clientConfig: this._clientConfig, args }),
1732
+ queryParams: computeQueryQueryParams({ config: queryConfig, client: this, args }),
1726
1733
  });
1727
1734
  const cacheKey = isGqlQueryConfig(queryConfig) ? buildGqlCacheKey(queryConfig, args) : route;
1728
1735
  if (shouldCacheQuery(queryConfig.method)) {
@@ -1786,11 +1793,11 @@ class QueryField {
1786
1793
  this.changes$ = this._setupChangesObservable();
1787
1794
  this._currentDebounceTimeout = null;
1788
1795
  }
1789
- setValue(value) {
1796
+ setValue(value, options) {
1790
1797
  if (this._currentDebounceTimeout !== null) {
1791
1798
  clearTimeout(this._currentDebounceTimeout);
1792
1799
  }
1793
- if (this.data.debounce) {
1800
+ if (this.data.debounce && !(options === null || options === void 0 ? void 0 : options.skipDebounce)) {
1794
1801
  this._currentDebounceTimeout = window.setTimeout(() => {
1795
1802
  this.control.setValue(value);
1796
1803
  }, this.data.debounce);
@@ -1825,8 +1832,8 @@ class QueryForm {
1825
1832
  }
1826
1833
  }));
1827
1834
  }
1828
- setFormValueFromUrlQueryParams() {
1829
- var _a, _b, _c;
1835
+ setFormValueFromUrlQueryParams(options) {
1836
+ var _a, _b, _c, _d;
1830
1837
  if (!this._activatedRoute) {
1831
1838
  throw new Error('Cannot set form value from url query params without ActivatedRoute');
1832
1839
  }
@@ -1838,7 +1845,7 @@ class QueryForm {
1838
1845
  continue;
1839
1846
  }
1840
1847
  const deserializedValue = (_c = (_b = (_a = field.data).queryParamToValueTransformFn) === null || _b === void 0 ? void 0 : _b.call(_a, value)) !== null && _c !== void 0 ? _c : value;
1841
- field.setValue(deserializedValue);
1848
+ field.setValue(deserializedValue, { skipDebounce: (_d = options === null || options === void 0 ? void 0 : options.skipDebounce) !== null && _d !== void 0 ? _d : true });
1842
1849
  }
1843
1850
  }
1844
1851
  updateFormOnUrlQueryParamsChange() {