http-request-manager 18.13.27 → 18.13.28
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.
|
@@ -7077,12 +7077,9 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7077
7077
|
const tableDef = TableSchemaDef.adapt({ table: this.databaseOptions.table, schema: expectedSchema });
|
|
7078
7078
|
return this.dbManagerService.clearTable(this.databaseOptions.table).pipe(switchMap(() => this.dbManagerService.createDatabaseTable(tableDef)), switchMap(() => fetchFromAPI()));
|
|
7079
7079
|
}
|
|
7080
|
-
const
|
|
7081
|
-
if (
|
|
7082
|
-
|
|
7083
|
-
if (trackerAllowsRequest) {
|
|
7084
|
-
return fetchFromAPI();
|
|
7085
|
-
}
|
|
7080
|
+
const trackerAllowsRequest = this.queryParamsTrackerService.checkRequestOptions(this.resolvePath(effectiveParams), this.buildQueryTrackerOptions(options));
|
|
7081
|
+
if (trackerAllowsRequest) {
|
|
7082
|
+
return fetchFromAPI();
|
|
7086
7083
|
}
|
|
7087
7084
|
return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
|
|
7088
7085
|
if (Array.isArray(dbData) && dbData.length > 0) {
|
|
@@ -7266,26 +7263,23 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
7266
7263
|
if (hasExpired) {
|
|
7267
7264
|
return this.dbManagerService.clearTable(this.databaseOptions.table).pipe(tap(() => this.setCachedRequestSignature(this.databaseOptions.table, 'STREAM', requestSignature)), switchMap(() => this.httpManagerService.getRequest(requestOptions, effectiveParams)), map((apiData) => ({ data: apiData, fromCache: false })));
|
|
7268
7265
|
}
|
|
7269
|
-
const
|
|
7270
|
-
if (
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
return of({ data: this.dataType === DataType.ARRAY ? [] : {}, fromCache: true });
|
|
7287
|
-
}));
|
|
7288
|
-
}
|
|
7266
|
+
const trackerAllowsRequest = this.queryParamsTrackerService.checkRequestOptions(this.resolvePath(effectiveParams), this.buildQueryTrackerOptions(options));
|
|
7267
|
+
if (!trackerAllowsRequest) {
|
|
7268
|
+
return this.dbManagerService.getTableRecords(this.databaseOptions.table).pipe(switchMap((dbData) => {
|
|
7269
|
+
if (Array.isArray(dbData) && dbData.length > 0) {
|
|
7270
|
+
return of({ data: dbData, fromCache: true });
|
|
7271
|
+
}
|
|
7272
|
+
const currentStateData = this.get()?.data;
|
|
7273
|
+
if (Array.isArray(currentStateData) && currentStateData.length > 0) {
|
|
7274
|
+
return of({ data: currentStateData, fromCache: true });
|
|
7275
|
+
}
|
|
7276
|
+
if (currentStateData &&
|
|
7277
|
+
!Array.isArray(currentStateData) &&
|
|
7278
|
+
Object.keys(currentStateData).length > 0) {
|
|
7279
|
+
return of({ data: currentStateData, fromCache: true });
|
|
7280
|
+
}
|
|
7281
|
+
return of({ data: this.dataType === DataType.ARRAY ? [] : {}, fromCache: true });
|
|
7282
|
+
}));
|
|
7289
7283
|
}
|
|
7290
7284
|
this.setCachedRequestSignature(this.databaseOptions.table, 'STREAM', requestSignature);
|
|
7291
7285
|
return this.httpManagerService.getRequest(requestOptions, effectiveParams).pipe(map((apiData) => ({ data: apiData, fromCache: false })));
|