http-request-manager 18.12.3 → 18.12.4

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-request-manager",
3
- "version": "18.12.3",
3
+ "version": "18.12.4",
4
4
  "homepage": "https://wavecoders.ca",
5
5
  "author": "Mike Bonifacio <wavecoders@gmail.com> (http://wavecoders@gmail.com/)",
6
6
  "description": "This is an Angular Module containing Components/Services using Material",
@@ -1,5 +1,5 @@
1
1
  import * as rxjs from 'rxjs';
2
- import { Observable, Subscription, BehaviorSubject, OperatorFunction } from 'rxjs';
2
+ import { Observable, OperatorFunction, Subscription, BehaviorSubject } from 'rxjs';
3
3
  import * as i0 from '@angular/core';
4
4
  import { InjectionToken, OnDestroy, Injector, OnInit, EventEmitter, ModuleWithProviders } from '@angular/core';
5
5
  import { ComponentStore } from '@ngrx/component-store';
@@ -11,6 +11,7 @@ import * as i36 from '@ngx-translate/core';
11
11
  import { TranslateService } from '@ngx-translate/core';
12
12
  import * as _angular_forms from '@angular/forms';
13
13
  import { FormArray, FormBuilder, FormControl } from '@angular/forms';
14
+ import * as http_request_manager from 'http-request-manager';
14
15
  import { DataSource } from '@angular/cdk/collections';
15
16
  import * as i4 from '@angular/common';
16
17
  import * as i7 from '@angular/material/button';
@@ -153,6 +154,88 @@ declare class AppService {
153
154
  static ɵprov: i0.ɵɵInjectableDeclaration<AppService>;
154
155
  }
155
156
 
157
+ declare function countdown(duration: number): Observable<number>;
158
+
159
+ declare function delayedRetry<T>(delayMs: number, maxRetry?: number): (src: Observable<T>) => Observable<T>;
160
+
161
+ declare function requestPolling<T>(pollInterval: number, stopCondition$: Observable<any>, isPending$: any): (source: Observable<T>) => Observable<T>;
162
+
163
+ /**
164
+ * Enum representing valid streaming format types
165
+ *
166
+ * This enum defines all supported streaming formats for HTTP requests.
167
+ * Each enum value corresponds to a specific data format and parsing strategy.
168
+ */
169
+ declare enum StreamType {
170
+ JSON = "json",
171
+ NDJSON = "ndjson",
172
+ AI_STREAMING = "ai_streaming",
173
+ EVENT_STREAM = "event_stream",
174
+ AUTO = "auto"
175
+ }
176
+
177
+ interface StreamConfig {
178
+ streamType: StreamType;
179
+ totalHeader?: string;
180
+ }
181
+ /**
182
+ * Progress information for streaming responses
183
+ */
184
+ interface StreamProgress {
185
+ received: number;
186
+ total?: number;
187
+ percent: number;
188
+ stage: 'connecting' | 'streaming' | 'complete' | 'error';
189
+ bytesLoaded?: number;
190
+ bytesTotal?: number;
191
+ }
192
+ /**
193
+ * Combined output from streaming operators
194
+ */
195
+ interface StreamOutput<T> {
196
+ data: T[];
197
+ progress: StreamProgress;
198
+ endpoint?: string;
199
+ }
200
+ interface StreamEvent<T = any> {
201
+ type: 'progress' | 'complete' | 'data';
202
+ data: T;
203
+ metadata?: {
204
+ timestamp: Date;
205
+ streamType: StreamType;
206
+ contentLength?: number;
207
+ };
208
+ }
209
+ interface ParsingResult<T = any> {
210
+ success: boolean;
211
+ data?: T[];
212
+ error?: string;
213
+ }
214
+ /**
215
+ * COMPREHENSIVE REQUEST STREAMING OPERATOR - FULLY ABSTRACTED
216
+ * Refactored for better type safety and memory management
217
+ *
218
+ * Single function that handles ALL streaming formats without hardcoded assumptions:
219
+ * - JSON format (Individual JSON objects)
220
+ * - NDJSON format (Newline delimited JSON)
221
+ * - AI streaming format (Real-time AI responses)
222
+ * - Server-Sent Events format
223
+ * - Auto-detection mode
224
+ *
225
+ * Usage:
226
+ * this.http.get(url, options).pipe(requestStreaming()).subscribe(data => {...})
227
+ * this.http.get(url, options).pipe(requestStreaming({ streamType: StreamType.NDJSON })).subscribe(data => {...})
228
+ */
229
+ declare function requestStreaming<T = any>(config?: StreamConfig): OperatorFunction<any, StreamOutput<T>>;
230
+ /**
231
+ * Convenience functions for common use cases
232
+ */
233
+ declare function streamJSON<T = any>(): OperatorFunction<any, StreamOutput<T>>;
234
+ declare function streamNDJSON<T = any>(): OperatorFunction<any, StreamOutput<T>>;
235
+ declare function streamAI<T = any>(): OperatorFunction<any, StreamOutput<T>>;
236
+ declare function streamEvents<T = any>(): OperatorFunction<any, StreamOutput<T>>;
237
+ declare function streamAuto<T = any>(): OperatorFunction<any, StreamOutput<T>>;
238
+
156
239
  interface WSOptionsInterface {
157
240
  id: string;
158
241
  wsServer: string;
@@ -176,20 +259,6 @@ declare class WSOptions implements WSOptionsInterface {
176
259
  static adapt(item?: any): WSOptions;
177
260
  }
178
261
 
179
- /**
180
- * Enum representing valid streaming format types
181
- *
182
- * This enum defines all supported streaming formats for HTTP requests.
183
- * Each enum value corresponds to a specific data format and parsing strategy.
184
- */
185
- declare enum StreamType {
186
- JSON = "json",
187
- NDJSON = "ndjson",
188
- AI_STREAMING = "ai_streaming",
189
- EVENT_STREAM = "event_stream",
190
- AUTO = "auto"
191
- }
192
-
193
262
  interface ApiRequestInterface {
194
263
  server: string;
195
264
  path?: any[];
@@ -200,6 +269,7 @@ interface ApiRequestInterface {
200
269
  retry?: RetryOptions;
201
270
  stream?: boolean;
202
271
  streamType?: StreamType;
272
+ totalHeader?: string;
203
273
  displayError?: boolean;
204
274
  displaySuccess?: boolean;
205
275
  successMessage?: string;
@@ -225,6 +295,7 @@ declare class ApiRequest implements ApiRequestInterface {
225
295
  retry?: RetryOptions | undefined;
226
296
  stream?: boolean | undefined;
227
297
  streamType?: StreamType | undefined;
298
+ totalHeader?: string | undefined;
228
299
  displayError?: boolean | undefined;
229
300
  displaySuccess?: boolean | undefined;
230
301
  successMessage?: string | undefined;
@@ -239,7 +310,7 @@ declare class ApiRequest implements ApiRequestInterface {
239
310
  allowedTypes?: string[] | undefined;
240
311
  maxFileSize?: number | undefined;
241
312
  maxTotalSize?: number | undefined;
242
- constructor(server?: string, path?: any[] | undefined, headers?: any, adapter?: any, mapper?: any, polling?: number | undefined, retry?: RetryOptions | undefined, stream?: boolean | undefined, streamType?: StreamType | undefined, displayError?: boolean | undefined, displaySuccess?: boolean | undefined, successMessage?: string | undefined, errorMessage?: string | undefined, saveAs?: string | undefined, fileContentHeader?: string | undefined, ws?: WSOptions | undefined, env?: string | undefined, uploadFiles?: (File | File[]) | undefined, uploadFieldName?: string | undefined, uploadHttpMethod?: ("POST" | "PUT") | undefined, allowedTypes?: string[] | undefined, maxFileSize?: number | undefined, maxTotalSize?: number | undefined);
313
+ constructor(server?: string, path?: any[] | undefined, headers?: any, adapter?: any, mapper?: any, polling?: number | undefined, retry?: RetryOptions | undefined, stream?: boolean | undefined, streamType?: StreamType | undefined, totalHeader?: string | undefined, displayError?: boolean | undefined, displaySuccess?: boolean | undefined, successMessage?: string | undefined, errorMessage?: string | undefined, saveAs?: string | undefined, fileContentHeader?: string | undefined, ws?: WSOptions | undefined, env?: string | undefined, uploadFiles?: (File | File[]) | undefined, uploadFieldName?: string | undefined, uploadHttpMethod?: ("POST" | "PUT") | undefined, allowedTypes?: string[] | undefined, maxFileSize?: number | undefined, maxTotalSize?: number | undefined);
243
314
  static adapt(item?: any): ApiRequest;
244
315
  }
245
316
 
@@ -551,6 +622,8 @@ declare class HTTPManagerStateService<T extends {
551
622
  logger: LoggerService;
552
623
  error$: Observable<boolean>;
553
624
  isPending$: Observable<boolean>;
625
+ progress$: Observable<number>;
626
+ streamProgress$: Observable<StreamProgress>;
554
627
  private operationSuccess;
555
628
  operationSuccess$: Observable<OperationResultModel | null>;
556
629
  private page;
@@ -568,6 +641,7 @@ declare class HTTPManagerStateService<T extends {
568
641
  private databaseOptions?;
569
642
  private wsRetryAttempts;
570
643
  wsRetryAttempts$: Observable<number>;
644
+ private activeStream$;
571
645
  private wsNextRetry;
572
646
  wsNextRetry$: Observable<number>;
573
647
  private messages;
@@ -1031,8 +1105,12 @@ declare class RequestService extends WebsocketService {
1031
1105
  private headersService;
1032
1106
  isPending: BehaviorSubject<boolean>;
1033
1107
  isPending$: Observable<boolean>;
1108
+ isStreamingPending: BehaviorSubject<boolean>;
1109
+ isStreamingPending$: Observable<boolean>;
1034
1110
  progress: BehaviorSubject<number>;
1035
1111
  progress$: Observable<number>;
1112
+ streamProgress: BehaviorSubject<StreamProgress>;
1113
+ streamProgress$: Observable<StreamProgress>;
1036
1114
  getRecordRequest<T>(options: ApiRequest): Observable<T>;
1037
1115
  getRecordRequest<T>(options: ApiRequest): Observable<T>;
1038
1116
  getRecordRequest<T>(options: ApiRequest & {
@@ -1057,6 +1135,7 @@ declare class RequestService extends WebsocketService {
1057
1135
  uploadFileRequest(options: ApiRequest): Observable<any>;
1058
1136
  private validateUploadFiles;
1059
1137
  private buildFormData;
1138
+ private streamProgressReset;
1060
1139
  private handleFinalize;
1061
1140
  private downloadFile;
1062
1141
  private createFileType;
@@ -1238,21 +1317,6 @@ declare class UploadValidationErrorModel implements UploadValidationErrorInterfa
1238
1317
  static adapt(item?: any): UploadValidationErrorModel;
1239
1318
  }
1240
1319
 
1241
- interface UserDataInterface {
1242
- ldap: string;
1243
- name: string;
1244
- email: string;
1245
- color: string;
1246
- }
1247
- declare class UserData implements UserDataInterface {
1248
- ldap: string;
1249
- name: string;
1250
- email: string;
1251
- color: string;
1252
- constructor(ldap?: string, name?: string, email?: string, color?: string);
1253
- static adapt(item?: any): UserData;
1254
- }
1255
-
1256
1320
  declare class ObjectMergerService {
1257
1321
  private configOptions?;
1258
1322
  utils: UtilsService;
@@ -1438,6 +1502,7 @@ declare class HTTPManagerService<T> extends RequestService {
1438
1502
  data$: Observable<any>;
1439
1503
  private polling$;
1440
1504
  config: ApiRequest;
1505
+ streamProgress$: Observable<StreamProgress>;
1441
1506
  constructor(configOptions?: ConfigOptions | undefined);
1442
1507
  /**
1443
1508
  * Connect to WebSocket server
@@ -1588,9 +1653,14 @@ declare class RequestSignalsService extends WebsocketService {
1588
1653
  private http;
1589
1654
  private pathQueryService;
1590
1655
  private headersService;
1591
- isPending: i0.WritableSignal<boolean>;
1656
+ private _activeRequestCount;
1657
+ isPending: i0.Signal<boolean>;
1592
1658
  progress: i0.WritableSignal<number>;
1593
- isIdle: i0.Signal<boolean>;
1659
+ private activeRequests;
1660
+ private activeMethod;
1661
+ private activeStreamMethod;
1662
+ private requestQueue;
1663
+ private destroy$;
1594
1664
  getRecordRequest<T>(options: ApiRequest): Observable<T>;
1595
1665
  getRecordRequest<T>(options: ApiRequest & {
1596
1666
  stream: true;
@@ -1601,6 +1671,20 @@ declare class RequestSignalsService extends WebsocketService {
1601
1671
  }, data: any): Observable<T[]>;
1602
1672
  updateRecordRequest<T>(options: ApiRequest, data: any): Observable<T>;
1603
1673
  deleteRecordRequest<T>(options: ApiRequest): Observable<T>;
1674
+ /**
1675
+ * Queue a request to ensure FIFO processing:
1676
+ * - All requests are queued and processed sequentially
1677
+ * - Streams are protected - non-stream requests wait for active streams
1678
+ */
1679
+ private queueRequest;
1680
+ /**
1681
+ * Start processing a request
1682
+ */
1683
+ private startRequest;
1684
+ /**
1685
+ * Clean up completed request and process next in queue
1686
+ */
1687
+ private cleanupAndProcessNext;
1604
1688
  private buildUrlPath;
1605
1689
  private buildHeaders;
1606
1690
  private buildCombinedHeaders;
@@ -1610,7 +1694,6 @@ declare class RequestSignalsService extends WebsocketService {
1610
1694
  uploadFileRequest(options: ApiRequest): Observable<any>;
1611
1695
  private validateUploadFiles;
1612
1696
  private buildFormData;
1613
- private handleFinalize;
1614
1697
  private downloadFile;
1615
1698
  private createFileType;
1616
1699
  private combineHeaders;
@@ -1778,54 +1861,6 @@ declare class HTTPManagerSignalsService<T> extends RequestSignalsService {
1778
1861
  static ɵprov: i0.ɵɵInjectableDeclaration<HTTPManagerSignalsService<any>>;
1779
1862
  }
1780
1863
 
1781
- declare function countdown(duration: number): Observable<number>;
1782
-
1783
- declare function delayedRetry<T>(delayMs: number, maxRetry?: number): (src: Observable<T>) => Observable<T>;
1784
-
1785
- declare function requestPolling<T>(pollInterval: number, stopCondition$: Observable<any>, isPending$: any): (source: Observable<T>) => Observable<T>;
1786
-
1787
- interface StreamConfig {
1788
- streamType: StreamType;
1789
- }
1790
- interface StreamEvent<T = any> {
1791
- type: 'progress' | 'complete' | 'data';
1792
- data: T;
1793
- metadata?: {
1794
- timestamp: Date;
1795
- streamType: StreamType;
1796
- contentLength?: number;
1797
- };
1798
- }
1799
- interface ParsingResult<T = any> {
1800
- success: boolean;
1801
- data?: T[];
1802
- error?: string;
1803
- }
1804
- /**
1805
- * COMPREHENSIVE REQUEST STREAMING OPERATOR - FULLY ABSTRACTED
1806
- * Refactored for better type safety and memory management
1807
- *
1808
- * Single function that handles ALL streaming formats without hardcoded assumptions:
1809
- * - JSON format (Individual JSON objects)
1810
- * - NDJSON format (Newline delimited JSON)
1811
- * - AI streaming format (Real-time AI responses)
1812
- * - Server-Sent Events format
1813
- * - Auto-detection mode
1814
- *
1815
- * Usage:
1816
- * this.http.get(url, options).pipe(requestStreaming()).subscribe(data => {...})
1817
- * this.http.get(url, options).pipe(requestStreaming({ streamType: StreamType.NDJSON })).subscribe(data => {...})
1818
- */
1819
- declare function requestStreaming<T = any>(config?: StreamConfig): OperatorFunction<any, T[]>;
1820
- /**
1821
- * Convenience functions for common use cases
1822
- */
1823
- declare function streamJSON<T = any>(): OperatorFunction<any, T[]>;
1824
- declare function streamNDJSON<T = any>(): OperatorFunction<any, T[]>;
1825
- declare function streamAI<T = any>(): OperatorFunction<any, T[]>;
1826
- declare function streamEvents<T = any>(): OperatorFunction<any, T[]>;
1827
- declare function streamAuto<T = any>(): OperatorFunction<any, T[]>;
1828
-
1829
1864
  interface State {
1830
1865
  localStores: StorageData[];
1831
1866
  sessionStores: StorageData[];
@@ -2305,6 +2340,21 @@ declare class RequestManagerBasicDemoComponent implements OnInit {
2305
2340
  static ɵcmp: i0.ɵɵComponentDeclaration<RequestManagerBasicDemoComponent, "app-request-manager-basic-demo", never, {}, {}, never, never, false, never>;
2306
2341
  }
2307
2342
 
2343
+ interface UserDataInterface {
2344
+ ldap: string;
2345
+ name: string;
2346
+ email: string;
2347
+ color: string;
2348
+ }
2349
+ declare class UserData implements UserDataInterface {
2350
+ ldap: string;
2351
+ name: string;
2352
+ email: string;
2353
+ color: string;
2354
+ constructor(ldap?: string, name?: string, email?: string, color?: string);
2355
+ static adapt(item?: any): UserData;
2356
+ }
2357
+
2308
2358
  declare class HttpRequestServicesDemoComponent implements OnInit {
2309
2359
  private configOptions?;
2310
2360
  wsServer: string;
@@ -2410,6 +2460,7 @@ declare class RequestManagerStateDemoComponent implements OnInit {
2410
2460
  adapter?: Function;
2411
2461
  mapper?: Function;
2412
2462
  stateManagerDemoService: StateManagerDemoService;
2463
+ progress$: Observable<http_request_manager.StreamProgress>;
2413
2464
  displayedColumns: string[];
2414
2465
  getColumnsFromData(data: any[]): string[];
2415
2466
  updateDisplayedColumns(data: any[]): void;
@@ -2424,6 +2475,7 @@ declare class RequestManagerStateDemoComponent implements OnInit {
2424
2475
  streamType: string;
2425
2476
  httpManagerService: HTTPManagerService<any>;
2426
2477
  isPending$: Observable<boolean>;
2478
+ isStreamingPending$: Observable<boolean>;
2427
2479
  error$: Observable<boolean>;
2428
2480
  countdown$: Observable<number>;
2429
2481
  GET_error$: BehaviorSubject<string>;
@@ -2543,7 +2595,9 @@ declare class RequestManagerDemoComponent implements OnInit {
2543
2595
  private toastMessage;
2544
2596
  questionControl: _angular_forms.FormControl<string | null>;
2545
2597
  httpManagerService: HTTPManagerService<any>;
2598
+ progress$: Observable<StreamProgress>;
2546
2599
  isPending$: Observable<boolean>;
2600
+ isStreamingPending$: Observable<boolean>;
2547
2601
  countdown$: Observable<number>;
2548
2602
  GET_error$: BehaviorSubject<string>;
2549
2603
  POST_error$: BehaviorSubject<string>;
@@ -2751,7 +2805,7 @@ declare class RequestSignalsManagerDemoComponent implements OnInit {
2751
2805
  private fb;
2752
2806
  private toastMessage;
2753
2807
  httpManagerSignalsService: HTTPManagerSignalsService<any>;
2754
- isPending: i0.WritableSignal<boolean>;
2808
+ isPending: i0.Signal<boolean>;
2755
2809
  countdown: i0.WritableSignal<number>;
2756
2810
  GET_result: any;
2757
2811
  POST_result: any;
@@ -3688,4 +3742,4 @@ declare class StoreStateSignalsDemoComponent implements OnInit {
3688
3742
  }
3689
3743
 
3690
3744
  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, InvalidFileInfoModel, LocalStorageDemoComponent, LocalStorageManagerService, LocalStorageOptions, LocalStorageSignalsDemoComponent, LocalStorageSignalsManagerService, LoggerService, NotificationMessage, OperationResultModel, PathQueryService, PublicMessage, Random, RandomHSLColor, RandomHexColor, RandomNumber, RandomNumbers, RandomNumbersUnique, RandomPaletteColor, RandomSignature, RandomStr, RandomVisibleColor, RequestErrorInterceptor, RequestHeadersInterceptor, RequestManagerDemoComponent, RequestManagerStateDemoComponent, RequestOptions, RequestService, RequestSignalsService, RetryOptions, SettingOptions, StateMessage, StateOperationResult, StateStorageOptions, StorageData, StorageOption, StorageType, StoreStateManagerService, StoreStateManagerSignalsService, StoreStateSignalsDemoComponent, StreamType, SymmetricalEncryptionService, TableSchemaDef, UUID, UUID_STR, UploadDemoComponent, UploadValidationErrorModel, UserData, UtilsService, WSOptions, WebSocketMessageService, WithCredentialsInterceptor, calculateBatchProgress, countdown, createChannelName, delayedRetry, isErrorState, isPendingState, isSuccessState, requestPolling, requestStreaming, streamAI, streamAuto, streamEvents, streamJSON, streamNDJSON };
3691
- export type { APIStateManagerData, ApiRequestInterface, BatchErrorState, BatchOptionsInterface, BatchPendingState, BatchProgress, BatchRequestState, BatchResultInterface, BatchSuccessState, ConfigHTTPOptionsInterface, ConfigOptionsInterface, DatabaseStorageInterface, ErrorDisplaySettingsInterface, GlobalStoreOptionsInterface, InvalidFileInfoInterface, LocalStorageOptionsInterface, NotificationMessageInterface, OperationResultInterface, ParsingResult, PublicMessageInterface, RequestOptionsInterface, RetryOptionsInterface, SettingOptionsInterface, State, StateMessageInterface, StateOperationResultInterface, StateStorageOptionsInterface, StateStoreManagerData$1 as StateStoreManagerData, StorageDataInterface, StorageOptionInterface, StreamConfig, StreamEvent, TableRecord, TableSchemaDefInterface, UploadValidationErrorInterface, UserDataInterface, WSOptionsInterface };
3745
+ export type { APIStateManagerData, ApiRequestInterface, BatchErrorState, BatchOptionsInterface, BatchPendingState, BatchProgress, BatchRequestState, BatchResultInterface, BatchSuccessState, ConfigHTTPOptionsInterface, ConfigOptionsInterface, DatabaseStorageInterface, ErrorDisplaySettingsInterface, GlobalStoreOptionsInterface, InvalidFileInfoInterface, LocalStorageOptionsInterface, NotificationMessageInterface, OperationResultInterface, ParsingResult, PublicMessageInterface, RequestOptionsInterface, RetryOptionsInterface, SettingOptionsInterface, State, StateMessageInterface, StateOperationResultInterface, StateStorageOptionsInterface, StateStoreManagerData$1 as StateStoreManagerData, StorageDataInterface, StorageOptionInterface, StreamConfig, StreamEvent, StreamOutput, StreamProgress, TableRecord, TableSchemaDefInterface, UploadValidationErrorInterface, UserDataInterface, WSOptionsInterface };
Binary file