@stackone/transport 2.7.1 → 2.8.0

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.
package/dist/index.d.cts CHANGED
@@ -2,6 +2,7 @@ import * as redis from "redis";
2
2
  import { AxiosInstance, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
3
3
  import http, { AgentOptions } from "node:http";
4
4
  import https from "node:https";
5
+ import { Readable } from "node:stream";
5
6
  import { z } from "@stackone/utils";
6
7
 
7
8
  //#region src/authorization/types.d.ts
@@ -399,6 +400,12 @@ type HttpResponse<T = any> = {
399
400
  responseTime?: Date;
400
401
  message?: string;
401
402
  };
403
+ type StreamHttpResponse = {
404
+ status: number;
405
+ headers: HttpHeaders;
406
+ stream: Readable;
407
+ requestUrl: string;
408
+ };
402
409
  type HttpParameters = {
403
410
  query: HttpQueryParams;
404
411
  body: Record<string, unknown> | unknown[];
@@ -468,6 +475,33 @@ interface IHttpClient {
468
475
  payload?: P;
469
476
  requestConfig?: RequestConfig;
470
477
  }): Promise<HttpResponse<T>>;
478
+ requestStream({
479
+ headers,
480
+ url,
481
+ method,
482
+ queryParams,
483
+ maxRedirects,
484
+ context,
485
+ traceId,
486
+ payload,
487
+ httpsAgent,
488
+ httpAgent,
489
+ requestConfig,
490
+ httpsAgentConfig
491
+ }: {
492
+ headers?: HttpHeaders;
493
+ url: string;
494
+ method?: HttpMethod;
495
+ queryParams?: HttpQueryParams;
496
+ maxRedirects?: number;
497
+ context?: RequestContext;
498
+ traceId?: string;
499
+ payload?: unknown;
500
+ httpsAgent?: https.Agent;
501
+ httpAgent?: http.Agent;
502
+ requestConfig?: RequestConfig;
503
+ httpsAgentConfig?: https.AgentOptions;
504
+ }): Promise<StreamHttpResponse>;
471
505
  }
472
506
  interface OperationSetting {
473
507
  url?: string;
@@ -703,6 +737,33 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
703
737
  payload?: P;
704
738
  requestConfig?: RequestConfig;
705
739
  }): Promise<HttpResponse<T>>;
740
+ requestStream({
741
+ headers,
742
+ url,
743
+ method,
744
+ queryParams,
745
+ maxRedirects,
746
+ context,
747
+ traceId,
748
+ payload,
749
+ httpsAgent,
750
+ httpAgent,
751
+ requestConfig,
752
+ httpsAgentConfig
753
+ }: {
754
+ headers?: HttpHeaders;
755
+ url: string;
756
+ method?: HttpMethod;
757
+ queryParams?: HttpQueryParams;
758
+ maxRedirects?: number;
759
+ context?: RequestContext;
760
+ traceId?: string;
761
+ payload?: unknown;
762
+ httpsAgent?: https.Agent;
763
+ httpAgent?: http.Agent;
764
+ requestConfig?: RequestConfig;
765
+ httpsAgentConfig?: https.AgentOptions;
766
+ }): Promise<StreamHttpResponse>;
706
767
  }
707
768
  //#endregion
708
769
  //#region src/httpClient/httpClientManager.d.ts
@@ -942,4 +1003,4 @@ type LockEntry = {
942
1003
  unlock: Unlock;
943
1004
  };
944
1005
  //#endregion
945
- export { CUSTOM_ERROR_CONFIG_SCHEMA, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, translateCustomError };
1006
+ export { CUSTOM_ERROR_CONFIG_SCHEMA, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestParameter, RequestParameterLocations, ScriptManager, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, translateCustomError };
package/dist/index.d.mts CHANGED
@@ -3,6 +3,7 @@ import * as redis from "redis";
3
3
  import { AxiosInstance, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
4
4
  import https from "node:https";
5
5
  import http, { AgentOptions } from "node:http";
6
+ import { Readable } from "node:stream";
6
7
 
7
8
  //#region src/authorization/types.d.ts
8
9
  type NoAuthorizationParams = {
@@ -399,6 +400,12 @@ type HttpResponse<T = any> = {
399
400
  responseTime?: Date;
400
401
  message?: string;
401
402
  };
403
+ type StreamHttpResponse = {
404
+ status: number;
405
+ headers: HttpHeaders;
406
+ stream: Readable;
407
+ requestUrl: string;
408
+ };
402
409
  type HttpParameters = {
403
410
  query: HttpQueryParams;
404
411
  body: Record<string, unknown> | unknown[];
@@ -468,6 +475,33 @@ interface IHttpClient {
468
475
  payload?: P;
469
476
  requestConfig?: RequestConfig;
470
477
  }): Promise<HttpResponse<T>>;
478
+ requestStream({
479
+ headers,
480
+ url,
481
+ method,
482
+ queryParams,
483
+ maxRedirects,
484
+ context,
485
+ traceId,
486
+ payload,
487
+ httpsAgent,
488
+ httpAgent,
489
+ requestConfig,
490
+ httpsAgentConfig
491
+ }: {
492
+ headers?: HttpHeaders;
493
+ url: string;
494
+ method?: HttpMethod;
495
+ queryParams?: HttpQueryParams;
496
+ maxRedirects?: number;
497
+ context?: RequestContext;
498
+ traceId?: string;
499
+ payload?: unknown;
500
+ httpsAgent?: https.Agent;
501
+ httpAgent?: http.Agent;
502
+ requestConfig?: RequestConfig;
503
+ httpsAgentConfig?: https.AgentOptions;
504
+ }): Promise<StreamHttpResponse>;
471
505
  }
472
506
  interface OperationSetting {
473
507
  url?: string;
@@ -703,6 +737,33 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
703
737
  payload?: P;
704
738
  requestConfig?: RequestConfig;
705
739
  }): Promise<HttpResponse<T>>;
740
+ requestStream({
741
+ headers,
742
+ url,
743
+ method,
744
+ queryParams,
745
+ maxRedirects,
746
+ context,
747
+ traceId,
748
+ payload,
749
+ httpsAgent,
750
+ httpAgent,
751
+ requestConfig,
752
+ httpsAgentConfig
753
+ }: {
754
+ headers?: HttpHeaders;
755
+ url: string;
756
+ method?: HttpMethod;
757
+ queryParams?: HttpQueryParams;
758
+ maxRedirects?: number;
759
+ context?: RequestContext;
760
+ traceId?: string;
761
+ payload?: unknown;
762
+ httpsAgent?: https.Agent;
763
+ httpAgent?: http.Agent;
764
+ requestConfig?: RequestConfig;
765
+ httpsAgentConfig?: https.AgentOptions;
766
+ }): Promise<StreamHttpResponse>;
706
767
  }
707
768
  //#endregion
708
769
  //#region src/httpClient/httpClientManager.d.ts
@@ -942,4 +1003,4 @@ type LockEntry = {
942
1003
  unlock: Unlock;
943
1004
  };
944
1005
  //#endregion
945
- export { CUSTOM_ERROR_CONFIG_SCHEMA, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, translateCustomError };
1006
+ export { CUSTOM_ERROR_CONFIG_SCHEMA, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestParameter, RequestParameterLocations, ScriptManager, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, translateCustomError };