http-request-manager 18.15.25 → 18.15.27

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.
@@ -942,6 +942,39 @@ class QueryParamsTrackerOptionsModel {
942
942
  }
943
943
  }
944
944
 
945
+ class StreamConfigModel {
946
+ constructor(streamType = StreamType.AI_STREAMING, totalHeader = 'X-Total-Count') {
947
+ this.streamType = streamType;
948
+ this.totalHeader = totalHeader;
949
+ }
950
+ static adapt(item) {
951
+ return new StreamConfigModel(item?.streamType, item?.totalHeader);
952
+ }
953
+ }
954
+
955
+ class StreamProgressModel {
956
+ constructor(received = 0, total, percent = 0, stage = 'connecting') {
957
+ this.received = received;
958
+ this.total = total;
959
+ this.percent = percent;
960
+ this.stage = stage;
961
+ }
962
+ static adapt(item) {
963
+ return new StreamProgressModel(item?.received, item?.total, item?.percent, item?.stage);
964
+ }
965
+ }
966
+
967
+ class StreamOutputModel {
968
+ constructor(data = [], progress = new StreamProgressModel(), endpoint) {
969
+ this.data = data;
970
+ this.progress = progress;
971
+ this.endpoint = endpoint;
972
+ }
973
+ static adapt(item) {
974
+ return new StreamOutputModel(Array.isArray(item?.data) ? item.data : [], item?.progress ? StreamProgressModel.adapt(item.progress) : new StreamProgressModel(), item?.endpoint);
975
+ }
976
+ }
977
+
945
978
  /**
946
979
  * Stateful processor for managing streaming data and events
947
980
  */
@@ -951,7 +984,7 @@ class StreamingProcessor {
951
984
  this.contentType = '';
952
985
  this.maxBufferSize = 10 * 1024 * 1024; // 10MB limit
953
986
  this.lastParsedLength = 0; // Track parsed position to avoid duplicates
954
- this.streamConfig = config || { streamType: StreamType.AI_STREAMING };
987
+ this.streamConfig = config || new StreamConfigModel(StreamType.AI_STREAMING);
955
988
  }
956
989
  /**
957
990
  * Process HTTP events and extract streaming data with progress
@@ -984,16 +1017,16 @@ class StreamingProcessor {
984
1017
  const percent = total
985
1018
  ? Math.round((received / total) * 100)
986
1019
  : 0;
987
- const progress = {
1020
+ const progress = StreamProgressModel.adapt({
988
1021
  received,
989
1022
  total,
990
1023
  percent,
991
1024
  stage: 'streaming'
992
- };
993
- return {
1025
+ });
1026
+ return StreamOutputModel.adapt({
994
1027
  data: newItems.length > 0 ? newItems : [],
995
1028
  progress
996
- };
1029
+ });
997
1030
  }
998
1031
  return null;
999
1032
  case HttpEventType.Response:
@@ -1002,15 +1035,15 @@ class StreamingProcessor {
1002
1035
  const parsedData = this.parseBuffer();
1003
1036
  // Calculate final progress
1004
1037
  const received = this.totalFromHeader ? parsedData.length : event.loaded;
1005
- const progress = {
1038
+ const progress = StreamProgressModel.adapt({
1006
1039
  received,
1007
1040
  percent: 100,
1008
1041
  stage: 'complete'
1009
- };
1010
- return {
1042
+ });
1043
+ return StreamOutputModel.adapt({
1011
1044
  data: parsedData.length > 0 ? parsedData : [],
1012
1045
  progress
1013
- };
1046
+ });
1014
1047
  }
1015
1048
  return null;
1016
1049
  default:
@@ -1318,23 +1351,23 @@ function isNdjsonFormat(buffer) {
1318
1351
  */
1319
1352
  // Stream with JSON format
1320
1353
  function streamJSON() {
1321
- return requestStreaming({ streamType: StreamType.JSON });
1354
+ return requestStreaming(StreamConfigModel.adapt({ streamType: StreamType.JSON }));
1322
1355
  }
1323
1356
  // Stream with NDJSON format
1324
1357
  function streamNDJSON() {
1325
- return requestStreaming({ streamType: StreamType.NDJSON });
1358
+ return requestStreaming(StreamConfigModel.adapt({ streamType: StreamType.NDJSON }));
1326
1359
  }
1327
1360
  // Stream AI responses
1328
1361
  function streamAI() {
1329
- return requestStreaming({ streamType: StreamType.AI_STREAMING });
1362
+ return requestStreaming(StreamConfigModel.adapt({ streamType: StreamType.AI_STREAMING }));
1330
1363
  }
1331
1364
  // Stream Server-Sent Events
1332
1365
  function streamEvents() {
1333
- return requestStreaming({ streamType: StreamType.EVENT_STREAM });
1366
+ return requestStreaming(StreamConfigModel.adapt({ streamType: StreamType.EVENT_STREAM }));
1334
1367
  }
1335
1368
  // Auto-detect streaming format
1336
1369
  function streamAuto() {
1337
- return requestStreaming({ streamType: StreamType.AUTO });
1370
+ return requestStreaming(StreamConfigModel.adapt({ streamType: StreamType.AUTO }));
1338
1371
  }
1339
1372
 
1340
1373
  class ChannelInfo {
@@ -2936,12 +2969,12 @@ class RequestService extends WebsocketService {
2936
2969
  this.isPending$ = this.isPending.asObservable();
2937
2970
  this.progress = new BehaviorSubject(0);
2938
2971
  this.progress$ = this.progress.asObservable();
2939
- this.streamProgress = new BehaviorSubject({
2972
+ this.streamProgress = new BehaviorSubject(StreamProgressModel.adapt({
2940
2973
  received: 0,
2941
2974
  total: undefined,
2942
2975
  percent: 0,
2943
2976
  stage: 'connecting'
2944
- });
2977
+ }));
2945
2978
  this.streamProgress$ = this.streamProgress.asObservable();
2946
2979
  }
2947
2980
  // Implementation
@@ -2957,7 +2990,7 @@ class RequestService extends WebsocketService {
2957
2990
  reportProgress: true
2958
2991
  }).pipe(
2959
2992
  // tap(data => console.log('STREAM DATA', data)),
2960
- requestStreaming({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' }), this.requestStreaming(options), this.handleFinalize())
2993
+ requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' })), this.requestStreaming(options), this.handleFinalize())
2961
2994
  : this.http.get(urlPath, headers).pipe(this.request(options));
2962
2995
  }
2963
2996
  createRecordRequest(options, data) {
@@ -2970,7 +3003,7 @@ class RequestService extends WebsocketService {
2970
3003
  observe: 'events',
2971
3004
  responseType: 'text',
2972
3005
  reportProgress: true
2973
- }).pipe(requestStreaming({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' }), this.requestStreaming(options), this.handleFinalize())
3006
+ }).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.NDJSON, totalHeader: 'X-Total-Count' })), this.requestStreaming(options), this.handleFinalize())
2974
3007
  : this.http.post(urlPath, data, headers).pipe(this.request(options));
2975
3008
  }
2976
3009
  updateRecordRequest(options, data) {
@@ -4249,7 +4282,7 @@ class RequestSignalsService extends WebsocketService {
4249
4282
  observe: 'events',
4250
4283
  responseType: 'text',
4251
4284
  reportProgress: true
4252
- }).pipe(requestStreaming({ streamType: options.streamType || StreamType.AI_STREAMING }), this.requestStreamingOperator(options), this.handleFinalize())
4285
+ }).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.AI_STREAMING })), this.requestStreamingOperator(options), this.handleFinalize())
4253
4286
  : this.http.get(urlPath, headers).pipe(this.request(options), this.handleFinalize());
4254
4287
  }
4255
4288
  // Implementation
@@ -4263,7 +4296,7 @@ class RequestSignalsService extends WebsocketService {
4263
4296
  observe: 'events',
4264
4297
  responseType: 'text',
4265
4298
  reportProgress: true
4266
- }).pipe(requestStreaming({ streamType: options.streamType || StreamType.AI_STREAMING }), this.requestStreamingOperator(options), this.handleFinalize())
4299
+ }).pipe(requestStreaming(StreamConfigModel.adapt({ streamType: options.streamType || StreamType.AI_STREAMING })), this.requestStreamingOperator(options), this.handleFinalize())
4267
4300
  : this.http.post(urlPath, data, headers).pipe(this.request(options), this.handleFinalize());
4268
4301
  }
4269
4302
  updateRecordRequest(options, data) {
@@ -5083,6 +5116,39 @@ class OperationResultModel {
5083
5116
  }
5084
5117
  }
5085
5118
 
5119
+ class StreamEventMetadataModel {
5120
+ constructor(timestamp = new Date(), streamType = StreamType.AI_STREAMING, contentLength) {
5121
+ this.timestamp = timestamp;
5122
+ this.streamType = streamType;
5123
+ this.contentLength = contentLength;
5124
+ }
5125
+ static adapt(item) {
5126
+ return new StreamEventMetadataModel(item?.timestamp, item?.streamType, item?.contentLength);
5127
+ }
5128
+ }
5129
+
5130
+ class StreamEventModel {
5131
+ constructor(type = 'data', data = null, metadata) {
5132
+ this.type = type;
5133
+ this.data = data;
5134
+ this.metadata = metadata;
5135
+ }
5136
+ static adapt(item) {
5137
+ return new StreamEventModel(item?.type, item?.data, item?.metadata ? StreamEventMetadataModel.adapt(item.metadata) : undefined);
5138
+ }
5139
+ }
5140
+
5141
+ class ParsingResultModel {
5142
+ constructor(success = false, data, error) {
5143
+ this.success = success;
5144
+ this.data = data;
5145
+ this.error = error;
5146
+ }
5147
+ static adapt(item) {
5148
+ return new ParsingResultModel(item?.success, Array.isArray(item?.data) ? item.data : undefined, item?.error);
5149
+ }
5150
+ }
5151
+
5086
5152
  class ObjectMergerService {
5087
5153
  constructor(configOptions) {
5088
5154
  this.configOptions = configOptions;
@@ -13212,5 +13278,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
13212
13278
  * Generated bundle index. Do not edit.
13213
13279
  */
13214
13280
 
13215
- 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, NormalizedRequestOptionsModel, NotificationMessage, OperationResultModel, PathQueryService, PathTrackerStateModel, PublicMessage, QueryParamsTrackerOptionsModel, QueryTrackerStateModel, 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 };
13281
+ 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, NormalizedRequestOptionsModel, NotificationMessage, OperationResultModel, ParsingResultModel, PathQueryService, PathTrackerStateModel, PublicMessage, QueryParamsTrackerOptionsModel, QueryTrackerStateModel, 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, StreamConfigModel, StreamEventMetadataModel, StreamEventModel, StreamOutputModel, StreamProgressModel, 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 };
13216
13282
  //# sourceMappingURL=http-request-manager.mjs.map