@reforgium/statum 2.2.0 → 2.2.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatDate, isNullable, isDatePeriod, parseToDate, makeQuery, isNumber, isObject, parseToDatePeriod, parseQueryArray, fillUrlWithParams, deepEqual, concatArray, debounceSignal } from '@reforgium/internal';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
3
3
|
import { InjectionToken, inject, signal, computed, DestroyRef, effect, untracked } from '@angular/core';
|
|
4
4
|
import { Subject, filter, timer, merge, map } from 'rxjs';
|
|
5
5
|
import { debounce, tap, throttle, finalize } from 'rxjs/operators';
|
|
@@ -1138,8 +1138,18 @@ class ResourceStore {
|
|
|
1138
1138
|
return joinUrl(this.opts.baseUrl, path);
|
|
1139
1139
|
}
|
|
1140
1140
|
prepareQuery(args) {
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1141
|
+
const presetQuery = this.opts.presetQueries;
|
|
1142
|
+
const requestQuery = args.query;
|
|
1143
|
+
if (!presetQuery && !requestQuery) {
|
|
1144
|
+
return new HttpParams();
|
|
1145
|
+
}
|
|
1146
|
+
const mergedQuery = (!presetQuery ? (requestQuery ?? {}) : !requestQuery ? presetQuery : { ...presetQuery, ...requestQuery });
|
|
1147
|
+
if (this.isEmptyObject(mergedQuery)) {
|
|
1148
|
+
return new HttpParams();
|
|
1149
|
+
}
|
|
1150
|
+
return new HttpParams({
|
|
1151
|
+
fromString: this.serializer.toQuery(mergedQuery),
|
|
1152
|
+
});
|
|
1143
1153
|
}
|
|
1144
1154
|
trace(event) {
|
|
1145
1155
|
try {
|
|
@@ -1217,6 +1227,14 @@ class ResourceStore {
|
|
|
1217
1227
|
this.#status.set(entry.status);
|
|
1218
1228
|
this.#error.set(entry.error);
|
|
1219
1229
|
}
|
|
1230
|
+
isEmptyObject(value) {
|
|
1231
|
+
for (const _key in value) {
|
|
1232
|
+
if (Object.prototype.hasOwnProperty.call(value, _key)) {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
return true;
|
|
1237
|
+
}
|
|
1220
1238
|
}
|
|
1221
1239
|
|
|
1222
1240
|
// noinspection ES6PreferShortImport
|
package/package.json
CHANGED