@ethlete/query 2.5.4 → 2.6.0
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.
- package/esm2020/index.mjs +2 -1
- package/esm2020/lib/directives/infinity-query-trigger.directive.mjs +3 -3
- package/esm2020/lib/directives/infinity-query.directive.mjs +3 -3
- package/esm2020/lib/directives/query.directive.mjs +3 -3
- package/esm2020/lib/entity/entity-store.mjs +141 -0
- package/esm2020/lib/entity/entity.types.mjs +2 -0
- package/esm2020/lib/entity/index.mjs +3 -0
- package/esm2020/lib/infinite-query/infinity-query.mjs +17 -3
- package/esm2020/lib/query/query.mjs +76 -1
- package/esm2020/lib/query/query.types.mjs +1 -1
- package/esm2020/lib/query/query.utils.mjs +1 -1
- package/esm2020/lib/query-client/query-client.mjs +2 -2
- package/esm2020/lib/query-client/query-client.types.mjs +1 -1
- package/esm2020/lib/query-client/query-client.utils.mjs +2 -4
- package/esm2020/lib/query-store/query-store.mjs +2 -1
- package/fesm2015/ethlete-query.mjs +240 -19
- package/fesm2015/ethlete-query.mjs.map +1 -1
- package/fesm2020/ethlete-query.mjs +244 -16
- package/fesm2020/ethlete-query.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/lib/entity/entity-store.d.ts +33 -0
- package/lib/entity/entity.types.d.ts +10 -0
- package/lib/entity/index.d.ts +2 -0
- package/lib/infinite-query/infinity-query.d.ts +8 -6
- package/lib/query/query.d.ts +11 -5
- package/lib/query/query.types.d.ts +24 -9
- package/lib/query/query.utils.d.ts +7 -7
- package/lib/query-client/query-client.d.ts +8 -8
- package/lib/query-client/query-client.types.d.ts +12 -10
- package/lib/query-client/query-client.utils.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BehaviorSubjectWithSubscriberCount, getCookie, setCookie, deleteCookie, DestroyService, equal, clone } from '@ethlete/core';
|
|
2
|
-
import { Observable, filter, takeWhile, switchMap, of, BehaviorSubject, Subject, takeUntil, interval, startWith, finalize, tap, timer, fromEvent, take, concat,
|
|
2
|
+
import { Observable, filter, takeWhile, switchMap, of, BehaviorSubject, Subject, takeUntil, interval, startWith, finalize, tap, timer, map, fromEvent, debounceTime, take, concat, combineLatest, distinctUntilChanged } from 'rxjs';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { Directive, Input, InjectionToken, inject, ChangeDetectorRef, ViewContainerRef, TemplateRef, ErrorHandler, ElementRef } from '@angular/core';
|
|
5
5
|
import { FormGroup } from '@angular/forms';
|
|
@@ -704,6 +704,9 @@ class Query {
|
|
|
704
704
|
get _enableSmartPolling() {
|
|
705
705
|
return this._queryConfig.enableSmartPolling ?? true;
|
|
706
706
|
}
|
|
707
|
+
get store() {
|
|
708
|
+
return this._queryConfig.entity?.store ?? null;
|
|
709
|
+
}
|
|
707
710
|
constructor(_client, _queryConfig, _routeWithParams, _args) {
|
|
708
711
|
this._client = _client;
|
|
709
712
|
this._queryConfig = _queryConfig;
|
|
@@ -711,6 +714,7 @@ class Query {
|
|
|
711
714
|
this._args = _args;
|
|
712
715
|
this._currentId = 0;
|
|
713
716
|
this._pollingSubscription = null;
|
|
717
|
+
this._entitySubscription = null;
|
|
714
718
|
this._onAbort$ = new Subject();
|
|
715
719
|
this._currentPollConfig = null;
|
|
716
720
|
/**
|
|
@@ -721,6 +725,62 @@ class Query {
|
|
|
721
725
|
type: "PREPARED" /* QueryStateType.Prepared */,
|
|
722
726
|
meta: { id: this._currentId, triggeredVia: 'program' },
|
|
723
727
|
});
|
|
728
|
+
if (this._queryConfig.entity?.store) {
|
|
729
|
+
this._entitySubscription = this._queryConfig.entity.store.events$.subscribe((event) => {
|
|
730
|
+
if (event.type !== 'update' && event.type !== 'set') {
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
if (!isQueryStateSuccess(this.state)) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const response = this.state.response;
|
|
737
|
+
const rawResponse = this.state.rawResponse;
|
|
738
|
+
const key = this._queryConfig.entity?.store.config.idKey;
|
|
739
|
+
if (!key) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const currentValue = this._queryConfig.entity?.valueSelector({
|
|
743
|
+
args: this._args,
|
|
744
|
+
response,
|
|
745
|
+
rawResponse,
|
|
746
|
+
});
|
|
747
|
+
const newData = this._queryConfig.entity?.store.getOne(event.key);
|
|
748
|
+
if (Array.isArray(currentValue)) {
|
|
749
|
+
const index = currentValue.findIndex((item) => item[key] === event.key);
|
|
750
|
+
if (index === -1) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
const newValue = [...currentValue];
|
|
754
|
+
if (newData) {
|
|
755
|
+
newValue[index] = newData;
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
newValue.splice(index, 1);
|
|
759
|
+
}
|
|
760
|
+
this._state$.next({
|
|
761
|
+
...this.state,
|
|
762
|
+
response: newValue,
|
|
763
|
+
meta: {
|
|
764
|
+
...this.state.meta,
|
|
765
|
+
triggeredVia: 'auto',
|
|
766
|
+
},
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
if (currentValue?.[key] !== event.key) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
this._state$.next({
|
|
774
|
+
...this.state,
|
|
775
|
+
response: newData,
|
|
776
|
+
meta: {
|
|
777
|
+
...this.state.meta,
|
|
778
|
+
triggeredVia: 'auto',
|
|
779
|
+
},
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
}
|
|
724
784
|
}
|
|
725
785
|
clone() {
|
|
726
786
|
return this._client.fetch(this._queryConfig);
|
|
@@ -809,6 +869,12 @@ class Query {
|
|
|
809
869
|
const transformedResponse = this._queryConfig.responseTransformer
|
|
810
870
|
? this._queryConfig.responseTransformer(responseData)
|
|
811
871
|
: responseData;
|
|
872
|
+
this._queryConfig.entity?.successAction?.({
|
|
873
|
+
args: this._args,
|
|
874
|
+
rawResponse: state.response,
|
|
875
|
+
response: transformedResponse,
|
|
876
|
+
store: this._queryConfig.entity.store,
|
|
877
|
+
});
|
|
812
878
|
this._state$.next({
|
|
813
879
|
type: "SUCCESS" /* QueryStateType.Success */,
|
|
814
880
|
rawResponse: state.response,
|
|
@@ -894,6 +960,15 @@ class Query {
|
|
|
894
960
|
}))
|
|
895
961
|
.subscribe();
|
|
896
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* @internal
|
|
965
|
+
*/
|
|
966
|
+
_destroy() {
|
|
967
|
+
this._state$.complete();
|
|
968
|
+
this._onAbort$.complete();
|
|
969
|
+
this._pollingSubscription?.unsubscribe();
|
|
970
|
+
this._entitySubscription?.unsubscribe();
|
|
971
|
+
}
|
|
897
972
|
}
|
|
898
973
|
|
|
899
974
|
const isBasicAuthProvider = (authProvider) => authProvider instanceof BasicAuthProvider;
|
|
@@ -1139,9 +1214,9 @@ class QueryDirective {
|
|
|
1139
1214
|
}
|
|
1140
1215
|
}
|
|
1141
1216
|
}
|
|
1142
|
-
QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
1143
|
-
QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
1144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
1217
|
+
QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1218
|
+
QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.4", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
|
|
1219
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: QueryDirective, decorators: [{
|
|
1145
1220
|
type: Directive,
|
|
1146
1221
|
args: [{
|
|
1147
1222
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -1202,6 +1277,7 @@ class InfinityQuery {
|
|
|
1202
1277
|
this._currentQuery$ = new BehaviorSubject(null);
|
|
1203
1278
|
this._data$ = new BehaviorSubject([]);
|
|
1204
1279
|
this._subscriptions = [];
|
|
1280
|
+
this._responsiveDataSubscription = null;
|
|
1205
1281
|
}
|
|
1206
1282
|
nextPage() {
|
|
1207
1283
|
const newPage = (this._currentPage$.value ?? 0) + 1;
|
|
@@ -1239,6 +1315,7 @@ class InfinityQuery {
|
|
|
1239
1315
|
_clearSubscriptions() {
|
|
1240
1316
|
this._subscriptions.forEach((sub) => sub.unsubscribe());
|
|
1241
1317
|
this._subscriptions = [];
|
|
1318
|
+
this._responsiveDataSubscription?.unsubscribe();
|
|
1242
1319
|
}
|
|
1243
1320
|
_handleNewQuery(query) {
|
|
1244
1321
|
const stateChangesSub = query.state$.pipe(takeUntilResponse(), filterSuccess()).subscribe({
|
|
@@ -1253,7 +1330,19 @@ class InfinityQuery {
|
|
|
1253
1330
|
else {
|
|
1254
1331
|
newData = [...this.data, ...newData];
|
|
1255
1332
|
}
|
|
1256
|
-
|
|
1333
|
+
if (query.store) {
|
|
1334
|
+
this._responsiveDataSubscription?.unsubscribe();
|
|
1335
|
+
const key = query.store.idKey;
|
|
1336
|
+
const responsiveData = query.store.entities$.pipe(map((entities) => newData.map((item) => {
|
|
1337
|
+
// TODO(TRB): This is kind of unsafe. The entity array keys might not be the same as the response keys
|
|
1338
|
+
const index = entities.values.findIndex((entity) => entity[key] === item[key]);
|
|
1339
|
+
return index > -1 ? entities.values[index] : item;
|
|
1340
|
+
})));
|
|
1341
|
+
this._responsiveDataSubscription = responsiveData.subscribe((data) => this._data$.next(data));
|
|
1342
|
+
}
|
|
1343
|
+
else {
|
|
1344
|
+
this._data$.next(newData);
|
|
1345
|
+
}
|
|
1257
1346
|
const totalPages = this._config.response.totalPagesExtractor?.({
|
|
1258
1347
|
response: state.response,
|
|
1259
1348
|
itemsPerPage: this.itemsPerPage,
|
|
@@ -1479,9 +1568,9 @@ class InfinityQueryDirective {
|
|
|
1479
1568
|
this._data$.next([]);
|
|
1480
1569
|
}
|
|
1481
1570
|
}
|
|
1482
|
-
InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
1483
|
-
InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
1484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
1571
|
+
InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1572
|
+
InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.4", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }, DestroyService], exportAs: ["infinityQuery"], ngImport: i0 });
|
|
1573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: InfinityQueryDirective, decorators: [{
|
|
1485
1574
|
type: Directive,
|
|
1486
1575
|
args: [{
|
|
1487
1576
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -1531,9 +1620,9 @@ class InfinityQueryTriggerDirective {
|
|
|
1531
1620
|
this._observer.observe(this._elementRef.nativeElement);
|
|
1532
1621
|
}
|
|
1533
1622
|
}
|
|
1534
|
-
InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
1535
|
-
InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.
|
|
1536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
1623
|
+
InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1624
|
+
InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.4", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
|
|
1625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
|
|
1537
1626
|
type: Directive,
|
|
1538
1627
|
args: [{
|
|
1539
1628
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -1544,6 +1633,146 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImpor
|
|
|
1544
1633
|
type: Input
|
|
1545
1634
|
}] } });
|
|
1546
1635
|
|
|
1636
|
+
class EntityStore {
|
|
1637
|
+
get events$() {
|
|
1638
|
+
return this._events$.asObservable();
|
|
1639
|
+
}
|
|
1640
|
+
get keys() {
|
|
1641
|
+
return [...this._keys];
|
|
1642
|
+
}
|
|
1643
|
+
get values() {
|
|
1644
|
+
return [...this._dictionary.values()];
|
|
1645
|
+
}
|
|
1646
|
+
get size() {
|
|
1647
|
+
return this._keys.size;
|
|
1648
|
+
}
|
|
1649
|
+
get isEmpty() {
|
|
1650
|
+
return this.size === 0;
|
|
1651
|
+
}
|
|
1652
|
+
get config() {
|
|
1653
|
+
return this._config;
|
|
1654
|
+
}
|
|
1655
|
+
get idKey() {
|
|
1656
|
+
return this._config.idKey || 'id';
|
|
1657
|
+
}
|
|
1658
|
+
constructor(_config) {
|
|
1659
|
+
this._config = _config;
|
|
1660
|
+
this._dictionary = new Map();
|
|
1661
|
+
this._keys = new Set();
|
|
1662
|
+
this._events$ = new Subject();
|
|
1663
|
+
this.entities$ = this.events$.pipe(startWith(null), debounceTime(0), map(() => ({
|
|
1664
|
+
keys: this.keys,
|
|
1665
|
+
values: this.values,
|
|
1666
|
+
})));
|
|
1667
|
+
}
|
|
1668
|
+
getOne(key) {
|
|
1669
|
+
const value = this._dictionary.get(key);
|
|
1670
|
+
if (!value) {
|
|
1671
|
+
console.error(`EntityStore: ${this._config.name || 'unknown'}: missing key "${key}" for get`);
|
|
1672
|
+
return null;
|
|
1673
|
+
}
|
|
1674
|
+
if (this._config.logActions) {
|
|
1675
|
+
console.log(`EntityStore: ${this._config.name || 'unknown'}: get "${key}"`);
|
|
1676
|
+
}
|
|
1677
|
+
return value;
|
|
1678
|
+
}
|
|
1679
|
+
getMany(keys) {
|
|
1680
|
+
return keys.map((key) => this.getOne(key));
|
|
1681
|
+
}
|
|
1682
|
+
addOne(value) {
|
|
1683
|
+
const key = this.getKey(value);
|
|
1684
|
+
if (this._dictionary.has(key)) {
|
|
1685
|
+
console.error(`EntityStore: ${this._config.name || 'unknown'}: duplicate key "${key}" for add`);
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
this._dictionary.set(key, value);
|
|
1689
|
+
this._keys.add(key);
|
|
1690
|
+
const event = { type: 'add', key };
|
|
1691
|
+
this._events$.next(event);
|
|
1692
|
+
if (this._config.logActions) {
|
|
1693
|
+
console.log(`EntityStore: ${this._config.name || 'unknown'}: add "${key}"`);
|
|
1694
|
+
}
|
|
1695
|
+
return event;
|
|
1696
|
+
}
|
|
1697
|
+
addMany(values) {
|
|
1698
|
+
const events = values.map((value) => this.addOne(value));
|
|
1699
|
+
return events;
|
|
1700
|
+
}
|
|
1701
|
+
updateOne(value) {
|
|
1702
|
+
const key = this.getKey(value);
|
|
1703
|
+
const existing = this._dictionary.get(key);
|
|
1704
|
+
if (!existing) {
|
|
1705
|
+
console.error(`EntityStore: ${this._config.name || 'unknown'}: missing key "${key}" for update`);
|
|
1706
|
+
return null;
|
|
1707
|
+
}
|
|
1708
|
+
this._dictionary.set(key, value);
|
|
1709
|
+
const event = { type: 'update', key };
|
|
1710
|
+
this._events$.next(event);
|
|
1711
|
+
if (this._config.logActions) {
|
|
1712
|
+
console.log(`EntityStore: ${this._config.name || 'unknown'}: update "${key}"`);
|
|
1713
|
+
}
|
|
1714
|
+
return event;
|
|
1715
|
+
}
|
|
1716
|
+
updateMany(values) {
|
|
1717
|
+
const events = values.map((value) => this.updateOne(value));
|
|
1718
|
+
return events;
|
|
1719
|
+
}
|
|
1720
|
+
setOne(value) {
|
|
1721
|
+
const key = this.getKey(value);
|
|
1722
|
+
this._dictionary.set(key, value);
|
|
1723
|
+
this._keys.add(key);
|
|
1724
|
+
const event = { type: 'set', key };
|
|
1725
|
+
this._events$.next(event);
|
|
1726
|
+
if (this._config.logActions) {
|
|
1727
|
+
console.log(`EntityStore: ${this._config.name || 'unknown'}: set "${key}"`);
|
|
1728
|
+
}
|
|
1729
|
+
return event;
|
|
1730
|
+
}
|
|
1731
|
+
setMany(values) {
|
|
1732
|
+
const events = values.map((value) => this.setOne(value));
|
|
1733
|
+
return events;
|
|
1734
|
+
}
|
|
1735
|
+
removeOne(key) {
|
|
1736
|
+
if (!this._dictionary.has(key)) {
|
|
1737
|
+
console.error(`EntityStore: ${this._config.name || 'unknown'}: missing key "${key}" for remove`);
|
|
1738
|
+
return null;
|
|
1739
|
+
}
|
|
1740
|
+
this._dictionary.delete(key);
|
|
1741
|
+
this._keys.delete(key);
|
|
1742
|
+
const event = { type: 'remove', key };
|
|
1743
|
+
this._events$.next(event);
|
|
1744
|
+
if (this._config.logActions) {
|
|
1745
|
+
console.log(`EntityStore: ${this._config.name || 'unknown'}: remove "${key}"`);
|
|
1746
|
+
}
|
|
1747
|
+
return event;
|
|
1748
|
+
}
|
|
1749
|
+
removeMany(keys) {
|
|
1750
|
+
const events = keys.map((key) => this.removeOne(key));
|
|
1751
|
+
return events;
|
|
1752
|
+
}
|
|
1753
|
+
has(key) {
|
|
1754
|
+
return this._dictionary.has(key);
|
|
1755
|
+
}
|
|
1756
|
+
clear() {
|
|
1757
|
+
this._dictionary.clear();
|
|
1758
|
+
this._keys.clear();
|
|
1759
|
+
}
|
|
1760
|
+
getKey(value) {
|
|
1761
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1762
|
+
const key = value[this._config.idKey || 'id'];
|
|
1763
|
+
if (key === undefined) {
|
|
1764
|
+
throw new Error(`EntityStore: ${this._config.name || 'unknown'}: missing key`);
|
|
1765
|
+
}
|
|
1766
|
+
return key;
|
|
1767
|
+
}
|
|
1768
|
+
logState() {
|
|
1769
|
+
console.log('EntityStore:', this._config.name, {
|
|
1770
|
+
dictionary: this._dictionary,
|
|
1771
|
+
keys: this._keys,
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1547
1776
|
class QueryStore {
|
|
1548
1777
|
constructor(_config) {
|
|
1549
1778
|
this._config = _config;
|
|
@@ -1562,6 +1791,7 @@ class QueryStore {
|
|
|
1562
1791
|
return this._store.get(id) ?? null;
|
|
1563
1792
|
}
|
|
1564
1793
|
remove(id) {
|
|
1794
|
+
this.get(id)?._destroy();
|
|
1565
1795
|
this._store.delete(id);
|
|
1566
1796
|
this._logState(id, null, 'REMOVE');
|
|
1567
1797
|
}
|
|
@@ -1675,9 +1905,7 @@ class QueryStore {
|
|
|
1675
1905
|
const shouldCacheQuery = (method) => {
|
|
1676
1906
|
return method === 'GET' || method === 'OPTIONS' || method === 'HEAD' || method === 'GQL_QUERY';
|
|
1677
1907
|
};
|
|
1678
|
-
const buildGqlCacheKey = (
|
|
1679
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1680
|
-
config, args) => {
|
|
1908
|
+
const buildGqlCacheKey = (config, args) => {
|
|
1681
1909
|
const { query } = config;
|
|
1682
1910
|
const variables = args?.variables || {};
|
|
1683
1911
|
const queryWithoutNewLinesAndWhitespace = query.replace(/\s/g, '');
|
|
@@ -1744,7 +1972,7 @@ class QueryClient {
|
|
|
1744
1972
|
return existingQuery;
|
|
1745
1973
|
}
|
|
1746
1974
|
}
|
|
1747
|
-
const query = new Query(this, queryConfig, route, args);
|
|
1975
|
+
const query = new Query(this, queryConfig, route, args ?? {});
|
|
1748
1976
|
if (shouldCacheQuery(queryConfig.method)) {
|
|
1749
1977
|
this._store.add(cacheKey, query);
|
|
1750
1978
|
}
|
|
@@ -2031,5 +2259,5 @@ const def = () => null;
|
|
|
2031
2259
|
* Generated bundle index. Do not edit.
|
|
2032
2260
|
*/
|
|
2033
2261
|
|
|
2034
|
-
export { BasicAuthProvider, BearerAuthProvider, CustomHeaderAuthProvider, INFINITY_QUERY_TOKEN, InfinityQuery, InfinityQueryDirective, InfinityQueryTriggerDirective, Query, QueryClient, QueryDirective, QueryError, QueryField, QueryForm, QueryStore, buildErrorMessage, buildGqlCacheKey, buildQueryArrayString, buildQueryString, buildRoute, buildTimestampFromSeconds, castQueryCreatorTypes, computeQueryAuthHeader, computeQueryBody, computeQueryHeaders, computeQueryMethod, computeQueryQueryParams, createInfinityQueryConfig, createQueryCollection, decryptBearer, deepFreeze, def, detectContentTypeHeader, extractExpiresInSeconds, extractQuery, filterFailure, filterInvalidParams, filterNull, filterQueryStates, filterSuccess, forEachHeader, getDefaultHeaders, getResponseUrl, gql, hasHeader, ignoreAutoRefresh, invalidBaseRouteError, invalidBodyError, invalidRouteError, isAutoRefresh, isBasicAuthProvider, isBearerAuthProvider, isCustomHeaderAuthProvider, isFetchResponse, isGqlQueryConfig, isParamValid, isQuery, isQueryStateCancelled, isQueryStateFailure, isQueryStateLoading, isQueryStatePrepared, isQueryStateSuccess, isRequestError, mergeHeaders, parseAllXhrResponseHeaders, pathParamsMissingInRouteFunctionError, queryStateAlreadyHasKeyError, queryStateCannotTransformError, queryStateDoesNotContainKeyError, request, serializeBody, shouldCacheQuery, shouldRetryRequest, skipPaginationPageParamCalculator, switchQueryCollectionState, switchQueryState, takeUntilResponse, transformGql, transformMethod, transformToBoolean, transformToBooleanArray, transformToDate, transformToDateArray, transformToNumber, transformToNumberArray, transformToSort, transformToSortQueryParam, transformToString, transformToStringArray };
|
|
2262
|
+
export { BasicAuthProvider, BearerAuthProvider, CustomHeaderAuthProvider, EntityStore, INFINITY_QUERY_TOKEN, InfinityQuery, InfinityQueryDirective, InfinityQueryTriggerDirective, Query, QueryClient, QueryDirective, QueryError, QueryField, QueryForm, QueryStore, buildErrorMessage, buildGqlCacheKey, buildQueryArrayString, buildQueryString, buildRoute, buildTimestampFromSeconds, castQueryCreatorTypes, computeQueryAuthHeader, computeQueryBody, computeQueryHeaders, computeQueryMethod, computeQueryQueryParams, createInfinityQueryConfig, createQueryCollection, decryptBearer, deepFreeze, def, detectContentTypeHeader, extractExpiresInSeconds, extractQuery, filterFailure, filterInvalidParams, filterNull, filterQueryStates, filterSuccess, forEachHeader, getDefaultHeaders, getResponseUrl, gql, hasHeader, ignoreAutoRefresh, invalidBaseRouteError, invalidBodyError, invalidRouteError, isAutoRefresh, isBasicAuthProvider, isBearerAuthProvider, isCustomHeaderAuthProvider, isFetchResponse, isGqlQueryConfig, isParamValid, isQuery, isQueryStateCancelled, isQueryStateFailure, isQueryStateLoading, isQueryStatePrepared, isQueryStateSuccess, isRequestError, mergeHeaders, parseAllXhrResponseHeaders, pathParamsMissingInRouteFunctionError, queryStateAlreadyHasKeyError, queryStateCannotTransformError, queryStateDoesNotContainKeyError, request, serializeBody, shouldCacheQuery, shouldRetryRequest, skipPaginationPageParamCalculator, switchQueryCollectionState, switchQueryState, takeUntilResponse, transformGql, transformMethod, transformToBoolean, transformToBooleanArray, transformToDate, transformToDateArray, transformToNumber, transformToNumberArray, transformToSort, transformToSortQueryParam, transformToString, transformToStringArray };
|
|
2035
2263
|
//# sourceMappingURL=ethlete-query.mjs.map
|