@cognite/sdk-core
Advanced tools
+11
-0
@@ -6,2 +6,13 @@ # Change Log | ||
| # [4.8.0](https://github.com/cognitedata/cognite-sdk-js/compare/@cognite/sdk-core@4.7.0...@cognite/sdk-core@4.8.0) (2022-09-23) | ||
| ### Features | ||
| * allow overriding retry validator at request level ([#876](https://github.com/cognitedata/cognite-sdk-js/issues/876)) ([39807e9](https://github.com/cognitedata/cognite-sdk-js/commit/39807e9e2b2380fcc8d842e8634f13d10f181e25)) | ||
| # [4.7.0](https://github.com/cognitedata/cognite-sdk-js/compare/@cognite/sdk-core@4.6.7...@cognite/sdk-core@4.7.0) (2022-09-23) | ||
@@ -8,0 +19,0 @@ |
| import { LoginAPI } from './api/login/loginApi'; | ||
| import { LogoutApi } from './api/logout/logoutApi'; | ||
| import { HttpRequestOptions, HttpResponse } from './httpClient/basicHttpClient'; | ||
| import { HttpResponse } from './httpClient/basicHttpClient'; | ||
| import { HttpHeaders } from './httpClient/httpHeaders'; | ||
@@ -10,2 +10,3 @@ import { CDFHttpClient } from './httpClient/cdfHttpClient'; | ||
| import { ClientCredentials } from './credentialsAuth'; | ||
| import { RetryableHttpRequestOptions } from './httpClient/retryableHttpClient'; | ||
| export interface ClientOptions { | ||
@@ -118,3 +119,3 @@ /** App identifier (ex: 'FileExtractor') */ | ||
| */ | ||
| get: <T = any>(path: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| get: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| /** | ||
@@ -130,3 +131,3 @@ * Basic HTTP method for PUT | ||
| */ | ||
| put: <T = any>(path: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| put: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| /** | ||
@@ -143,3 +144,3 @@ * Basic HTTP method for POST | ||
| */ | ||
| post: <T = any>(path: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| post: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| /** | ||
@@ -154,3 +155,3 @@ * Basic HTTP method for DELETE | ||
| */ | ||
| delete: <T = any>(path: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| delete: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| /** | ||
@@ -165,3 +166,3 @@ * Basic HTTP method for PATCH | ||
| */ | ||
| patch: <T = any>(path: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| patch: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>; | ||
| protected initAPIs(): void; | ||
@@ -179,3 +180,3 @@ /** | ||
| } | ||
| export declare type BaseRequestOptions = HttpRequestOptions; | ||
| export declare type BaseRequestOptions = RetryableHttpRequestOptions; | ||
| export declare type Response = HttpResponse<any>; |
@@ -1,4 +0,4 @@ | ||
| import { HttpRequest, HttpResponse } from './basicHttpClient'; | ||
| import { HttpResponse } from './basicHttpClient'; | ||
| import { HttpError } from './httpError'; | ||
| import { RetryableHttpClient } from './retryableHttpClient'; | ||
| import { RetryableHttpClient, RetryableHttpRequest } from './retryableHttpClient'; | ||
| import { RetryValidator } from './retryValidator'; | ||
@@ -15,5 +15,5 @@ export declare class CDFHttpClient extends RetryableHttpClient { | ||
| set401ResponseHandler(handler: Response401Handler): void; | ||
| protected preRequest(request: HttpRequest): Promise<HttpRequest>; | ||
| protected request<ResponseType>(request: HttpRequest): Promise<HttpResponse<ResponseType>>; | ||
| protected postRequest<T>(response: HttpResponse<T>, request: HttpRequest): Promise<HttpResponse<T>>; | ||
| protected preRequest(request: RetryableHttpRequest): Promise<RetryableHttpRequest>; | ||
| protected request<ResponseType>(request: RetryableHttpRequest): Promise<HttpResponse<ResponseType>>; | ||
| protected postRequest<T>(response: HttpResponse<T>, request: RetryableHttpRequest): Promise<HttpResponse<T>>; | ||
| private enrichWithOneTimeHeaders; | ||
@@ -25,3 +25,3 @@ private response401Handler; | ||
| } | ||
| declare type Response401Handler = (err: HttpError, request: HttpRequest, retry: () => void, reject: () => void) => void; | ||
| declare type Response401Handler = (err: HttpError, request: RetryableHttpRequest, retry: () => void, reject: () => void) => void; | ||
| export {}; |
@@ -1,2 +0,2 @@ | ||
| import { BasicHttpClient, HttpRequest, HttpResponse } from './basicHttpClient'; | ||
| import { BasicHttpClient, HttpRequest, HttpRequestOptions, HttpResponse } from './basicHttpClient'; | ||
| import { RetryValidator } from './retryValidator'; | ||
@@ -7,3 +7,17 @@ export declare class RetryableHttpClient extends BasicHttpClient { | ||
| constructor(baseUrl: string, retryValidator: RetryValidator); | ||
| protected rawRequest<ResponseType>(request: HttpRequest): Promise<HttpResponse<ResponseType>>; | ||
| get<ResponseType>(path: string, options?: RetryableHttpRequestOptions): Promise<HttpResponse<ResponseType>>; | ||
| post<ResponseType>(path: string, options?: RetryableHttpRequestOptions): Promise<HttpResponse<ResponseType>>; | ||
| put<ResponseType>(path: string, options?: RetryableHttpRequestOptions): Promise<HttpResponse<ResponseType>>; | ||
| delete<ResponseType>(path: string, options?: RetryableHttpRequestOptions): Promise<HttpResponse<ResponseType>>; | ||
| patch<ResponseType>(path: string, options?: RetryableHttpRequestOptions): Promise<HttpResponse<ResponseType>>; | ||
| protected preRequest(request: RetryableHttpRequest): Promise<RetryableHttpRequest>; | ||
| protected postRequest<T>(response: HttpResponse<T>, request: RetryableHttpRequest): Promise<HttpResponse<T>>; | ||
| protected rawRequest<ResponseType>(request: RetryableHttpRequest): Promise<HttpResponse<ResponseType>>; | ||
| protected request<ResponseType>(request: RetryableHttpRequest): Promise<HttpResponse<ResponseType>>; | ||
| } | ||
| export declare type RetryableHttpRequest = HttpRequest & HttpRequestRetryValidatorOptions; | ||
| export declare type RetryableHttpRequestOptions = HttpRequestOptions & HttpRequestRetryValidatorOptions; | ||
| declare type HttpRequestRetryValidatorOptions = { | ||
| retryValidator?: false | RetryValidator; | ||
| }; | ||
| export {}; |
@@ -1,4 +0,5 @@ | ||
| import { HttpMethod, HttpRequest, HttpResponse } from './basicHttpClient'; | ||
| import { HttpMethod, HttpResponse } from './basicHttpClient'; | ||
| import { RetryableHttpRequest } from './retryableHttpClient'; | ||
| /** @hidden */ | ||
| export declare type RetryValidator = (request: HttpRequest, response: HttpResponse<any>, retryCount: number) => boolean; | ||
| export declare type RetryValidator = (request: RetryableHttpRequest, response: HttpResponse<any>, retryCount: number) => boolean; | ||
| /** @hidden */ | ||
@@ -8,3 +9,4 @@ export declare type EndpointList = { | ||
| }; | ||
| export declare const MAX_RETRY_ATTEMPTS = 5; | ||
| export declare const createRetryValidator: (endpointsToRetry: EndpointList, maxRetries?: number) => RetryValidator; | ||
| export declare const createUniversalRetryValidator: (maxRetries?: number) => RetryValidator; |
+2
-2
@@ -9,3 +9,3 @@ { | ||
| "types": "dist/src/index.d.js", | ||
| "version": "4.7.0", | ||
| "version": "4.8.0", | ||
| "scripts": { | ||
@@ -42,3 +42,3 @@ "clean": "rm -rf dist/ docs/", | ||
| }, | ||
| "gitHead": "e9eed148d056199353f89efe6f9f80d51837f33a" | ||
| "gitHead": "9797d780e1e20705e7ffaa6767e0e271e6360239" | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
271119
1.87%3793
1.53%