@ethlete/query 0.1.0-next.7 → 0.1.0-next.9
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/lib/directives/infinity-query-trigger.directive.mjs +3 -3
- package/esm2020/lib/directives/infinity-query.directive.mjs +8 -7
- package/esm2020/lib/directives/query.directive.mjs +3 -3
- package/esm2020/lib/query/query.utils.mjs +1 -1
- package/esm2020/lib/request/request.mjs +1 -2
- package/esm2020/lib/request/request.util.mjs +13 -5
- package/fesm2015/ethlete-query.mjs +25 -17
- package/fesm2015/ethlete-query.mjs.map +1 -1
- package/fesm2020/ethlete-query.mjs +25 -17
- package/fesm2020/ethlete-query.mjs.map +1 -1
- package/lib/directives/infinity-query-trigger.directive.d.ts +1 -1
- package/lib/directives/infinity-query.directive.d.ts +3 -2
- package/lib/directives/query.directive.d.ts +1 -1
- package/lib/query/query.utils.d.ts +4 -2
- package/package.json +6 -5
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Subject, timer, filter, takeWhile, BehaviorSubject, interval, takeUntil, tap, switchMap, of, fromEvent, startWith, concat, take, debounceTime, combineLatest, map, distinctUntilChanged } from 'rxjs';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, Input, InjectionToken, inject, ChangeDetectorRef, ViewContainerRef, TemplateRef, ErrorHandler, ElementRef } from '@angular/core';
|
|
4
|
+
import * as i1 from '@ethlete/core';
|
|
5
|
+
import { DestroyDirective } from '@ethlete/core';
|
|
4
6
|
import { FormGroup } from '@angular/forms';
|
|
5
7
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
6
8
|
|
|
@@ -200,12 +202,20 @@ const buildRequestError = async (error, route, requestInit) => {
|
|
|
200
202
|
}
|
|
201
203
|
if (isFetchResponse(error)) {
|
|
202
204
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
203
|
-
let detail;
|
|
205
|
+
let detail = null;
|
|
204
206
|
try {
|
|
205
|
-
detail = await error.
|
|
207
|
+
detail = await error.json();
|
|
206
208
|
}
|
|
207
|
-
catch
|
|
208
|
-
|
|
209
|
+
catch {
|
|
210
|
+
// noop
|
|
211
|
+
}
|
|
212
|
+
if (!detail) {
|
|
213
|
+
try {
|
|
214
|
+
detail = await error.text();
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
// noop
|
|
218
|
+
}
|
|
209
219
|
}
|
|
210
220
|
const err = {
|
|
211
221
|
code: error.status,
|
|
@@ -272,7 +282,6 @@ const request = async (options) => {
|
|
|
272
282
|
}
|
|
273
283
|
const isJsonResponse = response.headers.get('Content-Type')?.includes('application/json');
|
|
274
284
|
const isTextResponse = response.headers.get('Content-Type')?.includes('text/plain');
|
|
275
|
-
console.log({ isJsonResponse, isTextResponse, h: response.headers.get('Content-Type') });
|
|
276
285
|
const data = (isJsonResponse ? await response.json() : isTextResponse ? await response.text() : null);
|
|
277
286
|
const expiresInSeconds = options.cacheAdapter
|
|
278
287
|
? options.cacheAdapter(response.headers)
|
|
@@ -720,9 +729,9 @@ class QueryDirective {
|
|
|
720
729
|
}
|
|
721
730
|
}
|
|
722
731
|
}
|
|
723
|
-
QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
724
|
-
QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
725
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
732
|
+
QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
733
|
+
QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: QueryDirective, decorators: [{
|
|
726
735
|
type: Directive,
|
|
727
736
|
args: [{
|
|
728
737
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -916,7 +925,7 @@ class InfinityQueryDirective {
|
|
|
916
925
|
itemsPerPage: null,
|
|
917
926
|
};
|
|
918
927
|
this._infinityQueryInstance = null;
|
|
919
|
-
this._destroy$ =
|
|
928
|
+
this._destroy$ = inject(DestroyDirective).destroy$;
|
|
920
929
|
this._cdr = inject(ChangeDetectorRef);
|
|
921
930
|
this._viewContainerRef = inject(ViewContainerRef);
|
|
922
931
|
this._mainTemplateRef = inject((TemplateRef));
|
|
@@ -952,8 +961,6 @@ class InfinityQueryDirective {
|
|
|
952
961
|
this._renderMainView();
|
|
953
962
|
}
|
|
954
963
|
ngOnDestroy() {
|
|
955
|
-
this._destroy$.next(true);
|
|
956
|
-
this._destroy$.unsubscribe();
|
|
957
964
|
this.instance?._destroy();
|
|
958
965
|
}
|
|
959
966
|
_setupInfinityQuery(config) {
|
|
@@ -1033,9 +1040,9 @@ class InfinityQueryDirective {
|
|
|
1033
1040
|
this._data$.next([]);
|
|
1034
1041
|
}
|
|
1035
1042
|
}
|
|
1036
|
-
InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1037
|
-
InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1038
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1043
|
+
InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1044
|
+
InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }], exportAs: ["infinityQuery"], hostDirectives: [{ directive: i1.DestroyDirective }], ngImport: i0 });
|
|
1045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: InfinityQueryDirective, decorators: [{
|
|
1039
1046
|
type: Directive,
|
|
1040
1047
|
args: [{
|
|
1041
1048
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -1043,6 +1050,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImpor
|
|
|
1043
1050
|
exportAs: 'infinityQuery',
|
|
1044
1051
|
standalone: true,
|
|
1045
1052
|
providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }],
|
|
1053
|
+
hostDirectives: [DestroyDirective],
|
|
1046
1054
|
}]
|
|
1047
1055
|
}], propDecorators: { infinityQuery: [{
|
|
1048
1056
|
type: Input
|
|
@@ -1085,9 +1093,9 @@ class InfinityQueryTriggerDirective {
|
|
|
1085
1093
|
this._observer.observe(this._elementRef.nativeElement);
|
|
1086
1094
|
}
|
|
1087
1095
|
}
|
|
1088
|
-
InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1089
|
-
InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
1090
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1096
|
+
InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1097
|
+
InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
|
|
1098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
|
|
1091
1099
|
type: Directive,
|
|
1092
1100
|
args: [{
|
|
1093
1101
|
// eslint-disable-next-line @angular-eslint/directive-selector
|