@sevtech/kit 20.2.0 → 20.3.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/browser/index.d.ts +3 -3
- package/environments/index.d.ts +3 -2
- package/fesm2022/browser.mjs +16 -12
- package/fesm2022/browser.mjs.map +1 -1
- package/fesm2022/environments.mjs +8 -6
- package/fesm2022/environments.mjs.map +1 -1
- package/fesm2022/http.mjs +160 -97
- package/fesm2022/http.mjs.map +1 -1
- package/http/index.d.ts +39 -18
- package/package.json +1 -1
package/http/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpErrorResponse, HttpParams, HttpContext, HttpHeaders, HttpEvent, HttpResponse, HttpContextToken, HttpInterceptorFn, HttpRequest } from '@angular/common/http';
|
|
2
|
-
import { MaybeArray, SafeAny } from '@sevtech/kit/misc';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Provider, Signal } from '@angular/core';
|
|
2
|
+
import { MaybeArray, SafeAny, MaybeFunction } from '@sevtech/kit/misc';
|
|
5
3
|
import { Observable } from 'rxjs';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { Provider, EnvironmentProviders, Signal } from '@angular/core';
|
|
6
6
|
|
|
7
7
|
declare abstract class HttpBaseError<Error = BaseError> {
|
|
8
8
|
abstract readonly kind: ApiErrorKind;
|
|
@@ -493,10 +493,6 @@ interface SerializeConfig {
|
|
|
493
493
|
unsupported: 'skip' | 'stringify' | 'error';
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
declare function provideApiPrefix(prefix: string | (() => string | null)): Provider;
|
|
497
|
-
declare function provideApiOptions(options: (() => ApiOptions) | ApiOptions): Provider;
|
|
498
|
-
declare function provideApiBodyTransform(transform: (body: SafeAny) => SafeAny): Provider;
|
|
499
|
-
|
|
500
496
|
declare class ApiBase {
|
|
501
497
|
private readonly httpClient;
|
|
502
498
|
private readonly bodyTransform;
|
|
@@ -575,6 +571,31 @@ declare class HttpApiService extends ApiBase {
|
|
|
575
571
|
static ɵprov: i0.ɵɵInjectableDeclaration<HttpApiService>;
|
|
576
572
|
}
|
|
577
573
|
|
|
574
|
+
declare const enum FeatureKind {
|
|
575
|
+
Prefix = 0,
|
|
576
|
+
BodyTransform = 1
|
|
577
|
+
}
|
|
578
|
+
interface Feature {
|
|
579
|
+
kind: FeatureKind;
|
|
580
|
+
providers: Provider[];
|
|
581
|
+
}
|
|
582
|
+
declare function withPrefix(prefix: MaybeFunction<string | null>): Feature;
|
|
583
|
+
declare function withBodyTransform(transform: (body: SafeAny) => SafeAny): Feature;
|
|
584
|
+
declare function provideHttpApi(options: MaybeFunction<ApiOptions>, ...features: Feature[]): EnvironmentProviders;
|
|
585
|
+
declare function provideHttpApi(...features: Feature[]): EnvironmentProviders;
|
|
586
|
+
/**
|
|
587
|
+
* @deprecated use provideHttpApi({}, withPrefix())
|
|
588
|
+
*/
|
|
589
|
+
declare function provideApiPrefix(prefix: MaybeFunction<string | null>): Provider;
|
|
590
|
+
/**
|
|
591
|
+
* @deprecated use provideHttpApi({}, withBodyTransform())
|
|
592
|
+
*/
|
|
593
|
+
declare function provideApiBodyTransform(transform: (body: SafeAny) => SafeAny): Provider;
|
|
594
|
+
/**
|
|
595
|
+
* @deprecated use provideHttpApi()
|
|
596
|
+
*/
|
|
597
|
+
declare function provideApiOptions(options: MaybeFunction<ApiOptions>): Provider;
|
|
598
|
+
|
|
578
599
|
type ProgressToken = boolean | string;
|
|
579
600
|
interface ProgressConfig {
|
|
580
601
|
/**
|
|
@@ -608,7 +629,7 @@ interface ProgressConfig {
|
|
|
608
629
|
* @default null
|
|
609
630
|
*/
|
|
610
631
|
declare const USE_PROGRESS: HttpContextToken<ProgressToken | null>;
|
|
611
|
-
declare function provideProgressConfig(config:
|
|
632
|
+
declare function provideProgressConfig(config: MaybeFunction<Partial<ProgressConfig>>): EnvironmentProviders;
|
|
612
633
|
|
|
613
634
|
declare class ProgressHttpService {
|
|
614
635
|
private readonly manager;
|
|
@@ -672,9 +693,9 @@ type HeadersConfig = {
|
|
|
672
693
|
};
|
|
673
694
|
|
|
674
695
|
declare const USE_HEADERS: HttpContextToken<boolean | null>;
|
|
675
|
-
declare function provideHeadersConfig(config:
|
|
676
|
-
declare function provideHeaders(headers: HeadersMap, strategy?: ApplyStrategy):
|
|
677
|
-
declare function provideHeaders(resolver: HeadersResolver):
|
|
696
|
+
declare function provideHeadersConfig(config: MaybeFunction<Partial<HeadersConfig>>): EnvironmentProviders;
|
|
697
|
+
declare function provideHeaders(headers: HeadersMap, strategy?: ApplyStrategy): EnvironmentProviders;
|
|
698
|
+
declare function provideHeaders(resolver: HeadersResolver): EnvironmentProviders;
|
|
678
699
|
|
|
679
700
|
declare const headersInterceptor: HttpInterceptorFn;
|
|
680
701
|
|
|
@@ -758,8 +779,8 @@ declare const httpLogger: LoggerFn;
|
|
|
758
779
|
* });
|
|
759
780
|
*/
|
|
760
781
|
declare const USE_LOGGER: HttpContextToken<number | boolean | RegExp | number[]>;
|
|
761
|
-
declare function provideLoggerConfig(config:
|
|
762
|
-
declare function provideLoggerHandler(handler:
|
|
782
|
+
declare function provideLoggerConfig(config: MaybeFunction<Partial<LoggerConfig>>): EnvironmentProviders;
|
|
783
|
+
declare function provideLoggerHandler(handler: LoggerFn): EnvironmentProviders;
|
|
763
784
|
|
|
764
785
|
declare const loggerInterceptor: HttpInterceptorFn;
|
|
765
786
|
|
|
@@ -848,7 +869,7 @@ interface MockConfig<R extends unknown> extends Partial<Omit<BaseMockConfig, 'fa
|
|
|
848
869
|
declare function defineMock<Response extends unknown>(id: string, config: MockConfig<Response>): void;
|
|
849
870
|
|
|
850
871
|
declare const USE_MOCK: HttpContextToken<string | null>;
|
|
851
|
-
declare function provideMockConfig(config:
|
|
872
|
+
declare function provideMockConfig(config: MaybeFunction<Partial<BaseMockConfig>>): EnvironmentProviders;
|
|
852
873
|
|
|
853
874
|
declare const mockInterceptor: HttpInterceptorFn;
|
|
854
875
|
|
|
@@ -860,7 +881,7 @@ interface OpenApiConfig {
|
|
|
860
881
|
responseResolver?: (response: HttpResponse<unknown>) => HttpResponse<unknown>;
|
|
861
882
|
}
|
|
862
883
|
|
|
863
|
-
declare function provideOpenApiConfig(config:
|
|
884
|
+
declare function provideOpenApiConfig(config: MaybeFunction<Partial<OpenApiConfig>>): EnvironmentProviders;
|
|
864
885
|
|
|
865
886
|
interface BaseRetryConfig {
|
|
866
887
|
/**
|
|
@@ -936,7 +957,7 @@ interface RetryConfig extends BaseRetryConfig {
|
|
|
936
957
|
}
|
|
937
958
|
|
|
938
959
|
declare const USE_RETRY: HttpContextToken<boolean | Partial<BaseRetryConfig> | null>;
|
|
939
|
-
declare function provideRetryConfig(config:
|
|
960
|
+
declare function provideRetryConfig(config: MaybeFunction<Partial<RetryConfig>>): EnvironmentProviders;
|
|
940
961
|
|
|
941
962
|
declare const retryInterceptor: HttpInterceptorFn;
|
|
942
963
|
|
|
@@ -972,7 +993,7 @@ interface TimeoutRule extends Partial<BaseTimeoutConfig> {
|
|
|
972
993
|
}
|
|
973
994
|
|
|
974
995
|
declare const USE_TIMEOUT: HttpContextToken<number | null>;
|
|
975
|
-
declare function provideTimeoutConfig(config:
|
|
996
|
+
declare function provideTimeoutConfig(config: MaybeFunction<Partial<TimeoutConfig>>): EnvironmentProviders;
|
|
976
997
|
|
|
977
|
-
export { ApiErrorKind, HttpAccessError, HttpApiService, HttpDomainError, HttpNetworkError, HttpNotExistError, HttpTimeoutError, HttpUnauthorizedError, HttpUnknownError, HttpValidationError, ProgressHttpService, USE_HEADERS, USE_LOGGER, USE_MOCK, USE_PROGRESS, USE_RETRY, USE_TIMEOUT, defineMock, headersInterceptor, httpLogger, isApiError, loggerInterceptor, mockInterceptor, openApiInterceptor, progressInterceptor, provideApiBodyTransform, provideApiOptions, provideApiPrefix, provideHeaders, provideHeadersConfig, provideLoggerConfig, provideLoggerHandler, provideMockConfig, provideOpenApiConfig, provideProgressConfig, provideRetryConfig, provideTimeoutConfig, retryInterceptor, timeoutInterceptor };
|
|
998
|
+
export { ApiErrorKind, HttpAccessError, HttpApiService, HttpDomainError, HttpNetworkError, HttpNotExistError, HttpTimeoutError, HttpUnauthorizedError, HttpUnknownError, HttpValidationError, ProgressHttpService, USE_HEADERS, USE_LOGGER, USE_MOCK, USE_PROGRESS, USE_RETRY, USE_TIMEOUT, defineMock, headersInterceptor, httpLogger, isApiError, loggerInterceptor, mockInterceptor, openApiInterceptor, progressInterceptor, provideApiBodyTransform, provideApiOptions, provideApiPrefix, provideHeaders, provideHeadersConfig, provideHttpApi, provideLoggerConfig, provideLoggerHandler, provideMockConfig, provideOpenApiConfig, provideProgressConfig, provideRetryConfig, provideTimeoutConfig, retryInterceptor, timeoutInterceptor, withBodyTransform, withPrefix };
|
|
978
999
|
export type { ApiError, ApiResponse };
|