@stackone/transport 2.21.0 → 2.23.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
@@ -1,36 +1,12 @@
1
- import * as redis from "redis";
2
- import { AxiosError, AxiosInstance, AxiosInterceptorManager, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
3
1
  import http, { AgentOptions } from "node:http";
4
2
  import https from "node:https";
3
+ import { AxiosError, AxiosInstance, AxiosInterceptorManager, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
4
+ import * as redis from "redis";
5
5
  import { Readable } from "node:stream";
6
6
  import { z } from "@stackone/utils";
7
7
 
8
8
  //#region rolldown:runtime
9
9
  //#endregion
10
- //#region src/authorization/types.d.ts
11
- type NoAuthorizationParams = {
12
- type: 'none';
13
- };
14
- type BasicAuthorizationParams = {
15
- type: 'basic';
16
- username?: string;
17
- password?: string;
18
- encoding?: string;
19
- };
20
- type BearerAuthorizationParams = {
21
- type: 'bearer';
22
- token: string;
23
- includeBearer: boolean;
24
- };
25
- type OAuth2AuthorizationParams = {
26
- type: 'oauth2';
27
- token: string;
28
- includeBearer: boolean;
29
- };
30
- //#endregion
31
- //#region src/authorization/authorizationHeaders.d.ts
32
- declare const createAuthorizationHeaders: (authenticationParams: NoAuthorizationParams | BasicAuthorizationParams | BearerAuthorizationParams | OAuth2AuthorizationParams) => {};
33
- //#endregion
34
10
  //#region ../logger/src/types.d.ts
35
11
  interface ILogger {
36
12
  debug({
@@ -412,7 +388,7 @@ type RequestConfig = {
412
388
  //#region src/parsers/types.d.ts
413
389
  declare const RequestParameterLocations: readonly ["query", "body", "headers"];
414
390
  type RequestParameterLocation = (typeof RequestParameterLocations)[number];
415
- declare const QueryArrayFormats: readonly ["repeat", "brackets", "comma"];
391
+ declare const QueryArrayFormats: readonly ["repeat", "brackets", "comma", "stringify"];
416
392
  type QueryArrayFormat = (typeof QueryArrayFormats)[number];
417
393
  type RequestParameter = {
418
394
  name: string;
@@ -596,6 +572,61 @@ type TransportFactory = ({
596
572
  httpsAgentConfig?: https.AgentOptions;
597
573
  }) => Promise<AxiosInstance>;
598
574
  //#endregion
575
+ //#region src/signing/types.d.ts
576
+ type SigningRequest = {
577
+ method: string;
578
+ url: string;
579
+ headers: Record<string, string>;
580
+ query: HttpQueryParams;
581
+ body: unknown;
582
+ };
583
+ type SigningCredentials = {
584
+ accessKeyId?: string;
585
+ secretAccessKey?: string;
586
+ sessionToken?: string;
587
+ secretKey?: string;
588
+ region?: string;
589
+ [key: string]: unknown;
590
+ };
591
+ type Aws4SigningOptions = {
592
+ strategy: 'aws4';
593
+ service: string;
594
+ region?: string;
595
+ };
596
+ type HmacSigningOptions = {
597
+ strategy: 'hmac';
598
+ algorithm?: 'sha256' | 'sha512';
599
+ headerName?: string;
600
+ prefix?: string;
601
+ };
602
+ type SigningOptions = Aws4SigningOptions | HmacSigningOptions;
603
+ type SigningStrategy = (request: SigningRequest, credentials: SigningCredentials, options: SigningOptions) => Record<string, string>;
604
+ //#endregion
605
+ //#region src/authorization/types.d.ts
606
+ type NoAuthorizationParams = {
607
+ type: 'none';
608
+ signing?: SigningOptions;
609
+ };
610
+ type BasicAuthorizationParams = {
611
+ type: 'basic';
612
+ username?: string;
613
+ password?: string;
614
+ encoding?: string;
615
+ };
616
+ type BearerAuthorizationParams = {
617
+ type: 'bearer';
618
+ token: string;
619
+ includeBearer: boolean;
620
+ };
621
+ type OAuth2AuthorizationParams = {
622
+ type: 'oauth2';
623
+ token: string;
624
+ includeBearer: boolean;
625
+ };
626
+ //#endregion
627
+ //#region src/authorization/authorizationHeaders.d.ts
628
+ declare const createAuthorizationHeaders: (authenticationParams: NoAuthorizationParams | BasicAuthorizationParams | BearerAuthorizationParams | OAuth2AuthorizationParams) => {};
629
+ //#endregion
599
630
  //#region src/customErrors/schemas.d.ts
600
631
  declare const CUSTOM_ERROR_CONFIG_SCHEMA: z.ZodObject<{
601
632
  receivedStatus: z.ZodNumber;
@@ -1045,6 +1076,10 @@ declare class RequestClientFactory {
1045
1076
  static build(type?: RequestClientType): IRequestClient;
1046
1077
  }
1047
1078
  //#endregion
1079
+ //#region src/signing/signingStrategies.d.ts
1080
+ declare const registerSigningStrategy: (name: string, strategy: SigningStrategy) => void;
1081
+ declare const getSigningStrategy: (name: string) => SigningStrategy | undefined;
1082
+ //#endregion
1048
1083
  //#region src/subscriptionManager/types.d.ts
1049
1084
  type SubscriptionManagerOptions = {
1050
1085
  config?: RedisClientConfig;
@@ -1092,4 +1127,4 @@ type LockEntry = {
1092
1127
  unlock: Unlock;
1093
1128
  };
1094
1129
  //#endregion
1095
- export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, ScriptManager, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
1130
+ export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
package/dist/index.d.mts CHANGED
@@ -6,30 +6,6 @@ import https from "node:https";
6
6
  import http, { AgentOptions } from "node:http";
7
7
  import { Readable } from "node:stream";
8
8
 
9
- //#region src/authorization/types.d.ts
10
- type NoAuthorizationParams = {
11
- type: 'none';
12
- };
13
- type BasicAuthorizationParams = {
14
- type: 'basic';
15
- username?: string;
16
- password?: string;
17
- encoding?: string;
18
- };
19
- type BearerAuthorizationParams = {
20
- type: 'bearer';
21
- token: string;
22
- includeBearer: boolean;
23
- };
24
- type OAuth2AuthorizationParams = {
25
- type: 'oauth2';
26
- token: string;
27
- includeBearer: boolean;
28
- };
29
- //#endregion
30
- //#region src/authorization/authorizationHeaders.d.ts
31
- declare const createAuthorizationHeaders: (authenticationParams: NoAuthorizationParams | BasicAuthorizationParams | BearerAuthorizationParams | OAuth2AuthorizationParams) => {};
32
- //#endregion
33
9
  //#region ../logger/src/types.d.ts
34
10
  interface ILogger {
35
11
  debug({
@@ -411,7 +387,7 @@ type RequestConfig = {
411
387
  //#region src/parsers/types.d.ts
412
388
  declare const RequestParameterLocations: readonly ["query", "body", "headers"];
413
389
  type RequestParameterLocation = (typeof RequestParameterLocations)[number];
414
- declare const QueryArrayFormats: readonly ["repeat", "brackets", "comma"];
390
+ declare const QueryArrayFormats: readonly ["repeat", "brackets", "comma", "stringify"];
415
391
  type QueryArrayFormat = (typeof QueryArrayFormats)[number];
416
392
  type RequestParameter = {
417
393
  name: string;
@@ -595,6 +571,61 @@ type TransportFactory = ({
595
571
  httpsAgentConfig?: https.AgentOptions;
596
572
  }) => Promise<AxiosInstance>;
597
573
  //#endregion
574
+ //#region src/signing/types.d.ts
575
+ type SigningRequest = {
576
+ method: string;
577
+ url: string;
578
+ headers: Record<string, string>;
579
+ query: HttpQueryParams;
580
+ body: unknown;
581
+ };
582
+ type SigningCredentials = {
583
+ accessKeyId?: string;
584
+ secretAccessKey?: string;
585
+ sessionToken?: string;
586
+ secretKey?: string;
587
+ region?: string;
588
+ [key: string]: unknown;
589
+ };
590
+ type Aws4SigningOptions = {
591
+ strategy: 'aws4';
592
+ service: string;
593
+ region?: string;
594
+ };
595
+ type HmacSigningOptions = {
596
+ strategy: 'hmac';
597
+ algorithm?: 'sha256' | 'sha512';
598
+ headerName?: string;
599
+ prefix?: string;
600
+ };
601
+ type SigningOptions = Aws4SigningOptions | HmacSigningOptions;
602
+ type SigningStrategy = (request: SigningRequest, credentials: SigningCredentials, options: SigningOptions) => Record<string, string>;
603
+ //#endregion
604
+ //#region src/authorization/types.d.ts
605
+ type NoAuthorizationParams = {
606
+ type: 'none';
607
+ signing?: SigningOptions;
608
+ };
609
+ type BasicAuthorizationParams = {
610
+ type: 'basic';
611
+ username?: string;
612
+ password?: string;
613
+ encoding?: string;
614
+ };
615
+ type BearerAuthorizationParams = {
616
+ type: 'bearer';
617
+ token: string;
618
+ includeBearer: boolean;
619
+ };
620
+ type OAuth2AuthorizationParams = {
621
+ type: 'oauth2';
622
+ token: string;
623
+ includeBearer: boolean;
624
+ };
625
+ //#endregion
626
+ //#region src/authorization/authorizationHeaders.d.ts
627
+ declare const createAuthorizationHeaders: (authenticationParams: NoAuthorizationParams | BasicAuthorizationParams | BearerAuthorizationParams | OAuth2AuthorizationParams) => {};
628
+ //#endregion
598
629
  //#region src/customErrors/schemas.d.ts
599
630
  declare const CUSTOM_ERROR_CONFIG_SCHEMA: z.ZodObject<{
600
631
  receivedStatus: z.ZodNumber;
@@ -1044,6 +1075,10 @@ declare class RequestClientFactory {
1044
1075
  static build(type?: RequestClientType): IRequestClient;
1045
1076
  }
1046
1077
  //#endregion
1078
+ //#region src/signing/signingStrategies.d.ts
1079
+ declare const registerSigningStrategy: (name: string, strategy: SigningStrategy) => void;
1080
+ declare const getSigningStrategy: (name: string) => SigningStrategy | undefined;
1081
+ //#endregion
1047
1082
  //#region src/subscriptionManager/types.d.ts
1048
1083
  type SubscriptionManagerOptions = {
1049
1084
  config?: RedisClientConfig;
@@ -1091,4 +1126,4 @@ type LockEntry = {
1091
1126
  unlock: Unlock;
1092
1127
  };
1093
1128
  //#endregion
1094
- export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, ScriptManager, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
1129
+ export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };