http-request-manager 18.11.8 → 18.11.10
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.
|
@@ -2961,6 +2961,19 @@ class BatchResult {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
}
|
|
2963
2963
|
|
|
2964
|
+
class BatchRequestResultModel {
|
|
2965
|
+
constructor(request = null, data = null, index = 0, status = 'success', error) {
|
|
2966
|
+
this.request = request;
|
|
2967
|
+
this.data = data;
|
|
2968
|
+
this.index = index;
|
|
2969
|
+
this.status = status;
|
|
2970
|
+
this.error = error;
|
|
2971
|
+
}
|
|
2972
|
+
static adapt(item) {
|
|
2973
|
+
return new BatchRequestResultModel(item?.request, item?.data, item?.index, item?.status, item?.error);
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2964
2977
|
function isPendingState(state) {
|
|
2965
2978
|
return state.isPending === true;
|
|
2966
2979
|
}
|
|
@@ -3778,7 +3791,7 @@ class HTTPManagerService extends RequestService {
|
|
|
3778
3791
|
* Execute multiple HTTP requests with configurable execution strategy
|
|
3779
3792
|
* @param requests Array of ApiRequest configurations
|
|
3780
3793
|
* @param options Optional batch configuration (all properties optional)
|
|
3781
|
-
* @returns Observable emitting array of
|
|
3794
|
+
* @returns Observable emitting array of wrapped results in the order of requests provided
|
|
3782
3795
|
*/
|
|
3783
3796
|
getBatchRequests(requests, options) {
|
|
3784
3797
|
const batchOptions = BatchOptions.adapt(options);
|
|
@@ -3794,22 +3807,22 @@ class HTTPManagerService extends RequestService {
|
|
|
3794
3807
|
* Execute requests sequentially (one at a time, in order)
|
|
3795
3808
|
* @param requests Array of ApiRequest configurations
|
|
3796
3809
|
* @param options Optional batch configuration
|
|
3797
|
-
* @returns Observable emitting array of
|
|
3810
|
+
* @returns Observable emitting array of wrapped results when all requests complete
|
|
3798
3811
|
*/
|
|
3799
3812
|
getSequentialRequest(requests, options) {
|
|
3800
3813
|
const batchOptions = BatchOptions.adapt(options);
|
|
3801
3814
|
const results = new Array(requests.length);
|
|
3802
3815
|
return from(requests).pipe(concatMap((req, index) => {
|
|
3803
3816
|
return this.getRequest(req).pipe(tap(data => {
|
|
3804
|
-
results[index] = data;
|
|
3805
|
-
}), catchError(error => this.handleSequentialError(req, error, index, batchOptions)));
|
|
3817
|
+
results[index] = new BatchRequestResultModel(req, data, index, 'success');
|
|
3818
|
+
}), catchError(error => this.handleSequentialError(req, error, index, batchOptions).pipe(tap(result => { results[index] = result; }))));
|
|
3806
3819
|
}), toArray(), map(() => results));
|
|
3807
3820
|
}
|
|
3808
3821
|
/**
|
|
3809
3822
|
* Execute requests in parallel with concurrency control
|
|
3810
3823
|
* @param requests Array of ApiRequest configurations
|
|
3811
3824
|
* @param options Optional batch configuration with concurrency limit
|
|
3812
|
-
* @returns Observable emitting array of
|
|
3825
|
+
* @returns Observable emitting array of wrapped results when all requests complete
|
|
3813
3826
|
*/
|
|
3814
3827
|
getParallelRequest(requests, options) {
|
|
3815
3828
|
const batchOptions = BatchOptions.adapt(options);
|
|
@@ -3817,8 +3830,8 @@ class HTTPManagerService extends RequestService {
|
|
|
3817
3830
|
const results = new Array(requests.length);
|
|
3818
3831
|
return from(requests).pipe(mergeMap((req, index) => {
|
|
3819
3832
|
return this.getRequest(req).pipe(tap(data => {
|
|
3820
|
-
results[index] = data;
|
|
3821
|
-
}), catchError(error => this.handleParallelError(req, error, index, batchOptions)));
|
|
3833
|
+
results[index] = new BatchRequestResultModel(req, data, index, 'success');
|
|
3834
|
+
}), catchError(error => this.handleParallelError(req, error, index, batchOptions).pipe(tap(result => { results[index] = result; }))));
|
|
3822
3835
|
}, concurrency), toArray(), map(() => results));
|
|
3823
3836
|
}
|
|
3824
3837
|
/**
|
|
@@ -3893,19 +3906,13 @@ class HTTPManagerService extends RequestService {
|
|
|
3893
3906
|
if (options.stopOnError) {
|
|
3894
3907
|
return throwError(() => error);
|
|
3895
3908
|
}
|
|
3896
|
-
|
|
3897
|
-
return of(undefined);
|
|
3898
|
-
}
|
|
3899
|
-
return throwError(() => error);
|
|
3909
|
+
return of(new BatchRequestResultModel(request, null, index, 'error', error));
|
|
3900
3910
|
}
|
|
3901
3911
|
handleParallelError(request, error, index, options) {
|
|
3902
3912
|
if (options.logErrors !== false) {
|
|
3903
3913
|
console.error(`Batch request ${index} failed:`, error);
|
|
3904
3914
|
}
|
|
3905
|
-
|
|
3906
|
-
return of(undefined);
|
|
3907
|
-
}
|
|
3908
|
-
return of(undefined);
|
|
3915
|
+
return of(new BatchRequestResultModel(request, null, index, 'error', error));
|
|
3909
3916
|
}
|
|
3910
3917
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerService, deps: [{ token: CONFIG_SETTINGS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3911
3918
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerService, providedIn: 'root' }); }
|
|
@@ -4442,22 +4449,22 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4442
4449
|
* Execute requests sequentially (one at a time, in order)
|
|
4443
4450
|
* @param requests Array of ApiRequest configurations
|
|
4444
4451
|
* @param options Optional batch configuration
|
|
4445
|
-
* @returns Observable emitting array of
|
|
4452
|
+
* @returns Observable emitting array of wrapped results when all requests complete
|
|
4446
4453
|
*/
|
|
4447
4454
|
getSequentialRequest(requests, options) {
|
|
4448
4455
|
const batchOptions = BatchOptions.adapt(options);
|
|
4449
4456
|
const results = new Array(requests.length);
|
|
4450
4457
|
return from(requests).pipe(concatMap((req, index) => {
|
|
4451
4458
|
return this.getRequest(req).pipe(tap(data => {
|
|
4452
|
-
results[index] = data;
|
|
4453
|
-
}), catchError(error => this.handleSequentialError(req, error, index, batchOptions)));
|
|
4459
|
+
results[index] = new BatchRequestResultModel(req, data, index, 'success');
|
|
4460
|
+
}), catchError(error => this.handleSequentialError(req, error, index, batchOptions).pipe(tap(result => { results[index] = result; }))));
|
|
4454
4461
|
}), toArray(), map(() => results));
|
|
4455
4462
|
}
|
|
4456
4463
|
/**
|
|
4457
4464
|
* Execute requests in parallel with concurrency control
|
|
4458
4465
|
* @param requests Array of ApiRequest configurations
|
|
4459
4466
|
* @param options Optional batch configuration with concurrency limit
|
|
4460
|
-
* @returns Observable emitting array of
|
|
4467
|
+
* @returns Observable emitting array of wrapped results when all requests complete
|
|
4461
4468
|
*/
|
|
4462
4469
|
getParallelRequest(requests, options) {
|
|
4463
4470
|
const batchOptions = BatchOptions.adapt(options);
|
|
@@ -4465,8 +4472,8 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4465
4472
|
const results = new Array(requests.length);
|
|
4466
4473
|
return from(requests).pipe(mergeMap((req, index) => {
|
|
4467
4474
|
return this.getRequest(req).pipe(tap(data => {
|
|
4468
|
-
results[index] = data;
|
|
4469
|
-
}), catchError(error => this.handleParallelError(req, error, index, batchOptions)));
|
|
4475
|
+
results[index] = new BatchRequestResultModel(req, data, index, 'success');
|
|
4476
|
+
}), catchError(error => this.handleParallelError(req, error, index, batchOptions).pipe(tap(result => { results[index] = result; }))));
|
|
4470
4477
|
}, concurrency), toArray(), map(() => results));
|
|
4471
4478
|
}
|
|
4472
4479
|
/**
|
|
@@ -4541,19 +4548,13 @@ class HTTPManagerSignalsService extends RequestSignalsService {
|
|
|
4541
4548
|
if (options.stopOnError) {
|
|
4542
4549
|
return throwError(() => error);
|
|
4543
4550
|
}
|
|
4544
|
-
|
|
4545
|
-
return of(undefined);
|
|
4546
|
-
}
|
|
4547
|
-
return throwError(() => error);
|
|
4551
|
+
return of(new BatchRequestResultModel(request, null, index, 'error', error));
|
|
4548
4552
|
}
|
|
4549
4553
|
handleParallelError(request, error, index, options) {
|
|
4550
4554
|
if (options.logErrors !== false) {
|
|
4551
4555
|
console.error(`Batch request ${index} failed:`, error);
|
|
4552
4556
|
}
|
|
4553
|
-
|
|
4554
|
-
return of(undefined);
|
|
4555
|
-
}
|
|
4556
|
-
return of(undefined);
|
|
4557
|
+
return of(new BatchRequestResultModel(request, null, index, 'error', error));
|
|
4557
4558
|
}
|
|
4558
4559
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerSignalsService, deps: [{ token: CONFIG_SETTINGS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4559
4560
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: HTTPManagerSignalsService, providedIn: 'root' }); }
|
|
@@ -11186,5 +11187,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
11186
11187
|
* Generated bundle index. Do not edit.
|
|
11187
11188
|
*/
|
|
11188
11189
|
|
|
11189
|
-
export { ApiRequest, AppService, AsymmetricalEncryptionService, BatchOptions, BatchResult, CONFIG_SETTINGS_TOKEN, ChannelType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsDemoComponent, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateMessage, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StoreStateManagerSignalsService, StoreStateSignalsDemoComponent, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, calculateBatchProgress, countdown, createChannelName, delayedRetry, isErrorState, isPendingState, isSuccessState, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
|
|
11190
|
+
export { ApiRequest, AppService, AsymmetricalEncryptionService, BatchOptions, BatchRequestResultModel, BatchResult, CONFIG_SETTINGS_TOKEN, ChannelType, ConfigHTTPOptions, ConfigOptions, DataType, DatabaseDataDemoComponent, DatabaseManagerService, DatabaseStorage, DbService, ErrorDisplaySettings, GlobalStoreOptions, HTTPManagerService, HTTPManagerSignalsService, HTTPManagerStateService, HeadersService, HttpRequestManagerModule, HttpRequestServicesDemoComponent, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsDemoComponent, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateMessage, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StoreStateManagerSignalsService, StoreStateSignalsDemoComponent, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, calculateBatchProgress, countdown, createChannelName, delayedRetry, isErrorState, isPendingState, isSuccessState, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
|
|
11190
11191
|
//# sourceMappingURL=http-request-manager.mjs.map
|