http-request-manager 18.12.3 → 18.12.5

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.5",
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",
@@ -44,5 +44,6 @@
44
44
  "types": "./types/http-request-manager.d.ts",
45
45
  "default": "./fesm2022/http-request-manager.mjs"
46
46
  }
47
- }
47
+ },
48
+ "type": "module"
48
49
  }
@@ -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';
@@ -153,6 +153,88 @@ declare class AppService {
153
153
  static ɵprov: i0.ɵɵInjectableDeclaration<AppService>;
154
154
  }
155
155
 
156
+ declare function countdown(duration: number): Observable<number>;
157
+
158
+ declare function delayedRetry<T>(delayMs: number, maxRetry?: number): (src: Observable<T>) => Observable<T>;
159
+
160
+ declare function requestPolling<T>(pollInterval: number, stopCondition$: Observable<any>, isPending$: any): (source: Observable<T>) => Observable<T>;
161
+
162
+ /**
163
+ * Enum representing valid streaming format types
164
+ *
165
+ * This enum defines all supported streaming formats for HTTP requests.
166
+ * Each enum value corresponds to a specific data format and parsing strategy.
167
+ */
168
+ declare enum StreamType {
169
+ JSON = "json",
170
+ NDJSON = "ndjson",
171
+ AI_STREAMING = "ai_streaming",
172
+ EVENT_STREAM = "event_stream",
173
+ AUTO = "auto"
174
+ }
175
+
176
+ interface StreamConfig {
177
+ streamType: StreamType;
178
+ totalHeader?: string;
179
+ }
180
+ /**
181
+ * Progress information for streaming responses
182
+ */
183
+ interface StreamProgress {
184
+ received: number;
185
+ total?: number;
186
+ percent: number;
187
+ stage: 'connecting' | 'streaming' | 'complete' | 'error';
188
+ bytesLoaded?: number;
189
+ bytesTotal?: number;
190
+ }
191
+ /**
192
+ * Combined output from streaming operators
193
+ */
194
+ interface StreamOutput<T> {
195
+ data: T[];
196
+ progress: StreamProgress;
197
+ endpoint?: string;
198
+ }
199
+ interface StreamEvent<T = any> {
200
+ type: 'progress' | 'complete' | 'data';
201
+ data: T;
202
+ metadata?: {
203
+ timestamp: Date;
204
+ streamType: StreamType;
205
+ contentLength?: number;
206
+ };
207
+ }
208
+ interface ParsingResult<T = any> {
209
+ success: boolean;
210
+ data?: T[];
211
+ error?: string;
212
+ }
213
+ /**
214
+ * COMPREHENSIVE REQUEST STREAMING OPERATOR - FULLY ABSTRACTED
215
+ * Refactored for better type safety and memory management
216
+ *
217
+ * Single function that handles ALL streaming formats without hardcoded assumptions:
218
+ * - JSON format (Individual JSON objects)
219
+ * - NDJSON format (Newline delimited JSON)
220
+ * - AI streaming format (Real-time AI responses)
221
+ * - Server-Sent Events format
222
+ * - Auto-detection mode
223
+ *
224
+ * Usage:
225
+ * this.http.get(url, options).pipe(requestStreaming()).subscribe(data => {...})
226
+ * this.http.get(url, options).pipe(requestStreaming({ streamType: StreamType.NDJSON })).subscribe(data => {...})
227
+ */
228
+ declare function requestStreaming<T = any>(config?: StreamConfig): OperatorFunction<any, StreamOutput<T>>;
229
+ /**
230
+ * Convenience functions for common use cases
231
+ */
232
+ declare function streamJSON<T = any>(): OperatorFunction<any, StreamOutput<T>>;
233
+ declare function streamNDJSON<T = any>(): OperatorFunction<any, StreamOutput<T>>;
234
+ declare function streamAI<T = any>(): OperatorFunction<any, StreamOutput<T>>;
235
+ declare function streamEvents<T = any>(): OperatorFunction<any, StreamOutput<T>>;
236
+ declare function streamAuto<T = any>(): OperatorFunction<any, StreamOutput<T>>;
237
+
156
238
  interface WSOptionsInterface {
157
239
  id: string;
158
240
  wsServer: string;
@@ -176,20 +258,6 @@ declare class WSOptions implements WSOptionsInterface {
176
258
  static adapt(item?: any): WSOptions;
177
259
  }
178
260
 
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
261
  interface ApiRequestInterface {
194
262
  server: string;
195
263
  path?: any[];
@@ -365,11 +433,13 @@ declare class DatabaseStorage implements DatabaseStorageInterface {
365
433
  interface RequestOptionsInterface {
366
434
  path: any[];
367
435
  headers: any;
436
+ forceRefresh?: boolean;
368
437
  }
369
438
  declare class RequestOptions implements RequestOptionsInterface {
370
439
  path: any[];
371
440
  headers: {};
372
- constructor(path?: any[], headers?: {});
441
+ forceRefresh?: boolean | undefined;
442
+ constructor(path?: any[], headers?: {}, forceRefresh?: boolean | undefined);
373
443
  static adapt(item?: any): RequestOptions;
374
444
  }
375
445
 
@@ -435,15 +505,9 @@ declare class DatabaseManagerService extends DbService {
435
505
  getTableRecords(table: string): Observable<unknown>;
436
506
  getTableRecord(table: string, id: number): Observable<any>;
437
507
  createTableRecord(table: string, record: any): Observable<any>;
438
- createTableRecords(table: string, records: any[]): Observable<{
439
- [key: string]: any;
440
- }[]>;
441
- updateTableRecord(table: string, record: any): Observable<{
442
- [key: string]: any;
443
- } | null>;
444
- updateTableRecords(table: string, records: any[]): Observable<{
445
- [key: string]: any;
446
- }[]>;
508
+ createTableRecords(table: string, records: any[]): Observable<any[]>;
509
+ updateTableRecord(table: string, record: any): Observable<any>;
510
+ updateTableRecords(table: string, records: any[]): Observable<any[]>;
447
511
  deleteTableRecord<T>(table: string, id: number): Observable<number | null>;
448
512
  deleteTableRecords(table: string, ids: number[]): Observable<number[]>;
449
513
  clearTable(table: string): Observable<never[]>;
@@ -566,6 +630,7 @@ declare class HTTPManagerStateService<T extends {
566
630
  private shouldRetry;
567
631
  private connectionStatusSubscription?;
568
632
  private databaseOptions?;
633
+ private readonly volatileHeaders;
569
634
  private wsRetryAttempts;
570
635
  wsRetryAttempts$: Observable<number>;
571
636
  private wsNextRetry;
@@ -631,6 +696,9 @@ declare class HTTPManagerStateService<T extends {
631
696
  readonly clearRecords: (observableOrValue?: void | Observable<void> | undefined) => Subscription;
632
697
  readonly fetchRecords: (options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
633
698
  private initDBStorageAsync;
699
+ private buildSchemaFromAdapter;
700
+ private buildSchemaFromSample;
701
+ private persistStreamDataToDb;
634
702
  readonly fetchRecord: (options: RequestOptions, method: string) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
635
703
  readonly createRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
636
704
  readonly updateRecord: (data: any | null, options?: RequestOptions) => ((observableOrValue?: any) => Subscription) | ((observableOrValue: any) => Subscription);
@@ -736,6 +804,17 @@ declare class HTTPManagerStateService<T extends {
736
804
  clearDatabase(): void;
737
805
  private isEmpty;
738
806
  private updateRequestOptions;
807
+ private normalizeObject;
808
+ private filterHeaders;
809
+ private resolvePath;
810
+ private getEffectiveParams;
811
+ private buildRequestSignature;
812
+ private buildSchemaSignature;
813
+ private getRequestCacheMetadata;
814
+ private getStoredSchemaSignature;
815
+ private saveSchemaSignature;
816
+ private saveRequestCacheMetadata;
817
+ private clearRequestCacheMetadata;
739
818
  static ɵfac: i0.ɵɵFactoryDeclaration<HTTPManagerStateService<any>, never>;
740
819
  static ɵprov: i0.ɵɵInjectableDeclaration<HTTPManagerStateService<any>>;
741
820
  }
@@ -1033,6 +1112,8 @@ declare class RequestService extends WebsocketService {
1033
1112
  isPending$: Observable<boolean>;
1034
1113
  progress: BehaviorSubject<number>;
1035
1114
  progress$: Observable<number>;
1115
+ streamProgress: BehaviorSubject<StreamProgress>;
1116
+ streamProgress$: Observable<StreamProgress>;
1036
1117
  getRecordRequest<T>(options: ApiRequest): Observable<T>;
1037
1118
  getRecordRequest<T>(options: ApiRequest): Observable<T>;
1038
1119
  getRecordRequest<T>(options: ApiRequest & {
@@ -1238,21 +1319,6 @@ declare class UploadValidationErrorModel implements UploadValidationErrorInterfa
1238
1319
  static adapt(item?: any): UploadValidationErrorModel;
1239
1320
  }
1240
1321
 
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
1322
  declare class ObjectMergerService {
1257
1323
  private configOptions?;
1258
1324
  utils: UtilsService;
@@ -1438,6 +1504,7 @@ declare class HTTPManagerService<T> extends RequestService {
1438
1504
  data$: Observable<any>;
1439
1505
  private polling$;
1440
1506
  config: ApiRequest;
1507
+ streamProgress$: Observable<StreamProgress>;
1441
1508
  constructor(configOptions?: ConfigOptions | undefined);
1442
1509
  /**
1443
1510
  * Connect to WebSocket server
@@ -1778,54 +1845,6 @@ declare class HTTPManagerSignalsService<T> extends RequestSignalsService {
1778
1845
  static ɵprov: i0.ɵɵInjectableDeclaration<HTTPManagerSignalsService<any>>;
1779
1846
  }
1780
1847
 
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
1848
  interface State {
1830
1849
  localStores: StorageData[];
1831
1850
  sessionStores: StorageData[];
@@ -2305,6 +2324,21 @@ declare class RequestManagerBasicDemoComponent implements OnInit {
2305
2324
  static ɵcmp: i0.ɵɵComponentDeclaration<RequestManagerBasicDemoComponent, "app-request-manager-basic-demo", never, {}, {}, never, never, false, never>;
2306
2325
  }
2307
2326
 
2327
+ interface UserDataInterface {
2328
+ ldap: string;
2329
+ name: string;
2330
+ email: string;
2331
+ color: string;
2332
+ }
2333
+ declare class UserData implements UserDataInterface {
2334
+ ldap: string;
2335
+ name: string;
2336
+ email: string;
2337
+ color: string;
2338
+ constructor(ldap?: string, name?: string, email?: string, color?: string);
2339
+ static adapt(item?: any): UserData;
2340
+ }
2341
+
2308
2342
  declare class HttpRequestServicesDemoComponent implements OnInit {
2309
2343
  private configOptions?;
2310
2344
  wsServer: string;
@@ -2376,7 +2410,7 @@ declare class StateManagerDemoService extends HTTPManagerStateService<any> {
2376
2410
  createClient(data: any): void;
2377
2411
  updateClient(data: ClientInfo$1): void;
2378
2412
  deleteClient(data: ClientInfo$1): void;
2379
- streamRequest(): void;
2413
+ streamRequest(options?: RequestOptions): void;
2380
2414
  static ɵfac: i0.ɵɵFactoryDeclaration<StateManagerDemoService, never>;
2381
2415
  static ɵprov: i0.ɵɵInjectableDeclaration<StateManagerDemoService>;
2382
2416
  }
@@ -3688,4 +3722,4 @@ declare class StoreStateSignalsDemoComponent implements OnInit {
3688
3722
  }
3689
3723
 
3690
3724
  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 };
3725
+ 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