@exceptionless/fetchclient
Advanced tools
Comparing version 0.24.0 to 0.25.0
@@ -1,2 +0,2 @@ | ||
export * from "./src/FetchClient.js"; | ||
export { FetchClient } from "./src/FetchClient.js"; | ||
export { ProblemDetails } from "./src/ProblemDetails.js"; | ||
@@ -3,0 +3,0 @@ export { FetchClientCache } from "./src/FetchClientCache.js"; |
@@ -23,4 +23,9 @@ import { Counter } from "./Counter.js"; | ||
else { | ||
this.#options = optionsOrProvider; | ||
this.#provider = optionsOrProvider?.provider ?? getCurrentProvider(); | ||
if (optionsOrProvider) { | ||
this.#options = { | ||
...this.#provider.options, | ||
...optionsOrProvider, | ||
}; | ||
} | ||
} | ||
@@ -27,0 +32,0 @@ } |
{ | ||
"name": "@exceptionless/fetchclient", | ||
"version": "0.24.0", | ||
"version": "0.25.0", | ||
"description": "A simple fetch client with middleware support for Deno and the browser.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -17,4 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FetchClientProvider = exports.FetchClientCache = exports.ProblemDetails = void 0; | ||
__exportStar(require("./src/FetchClient.js"), exports); | ||
exports.FetchClientProvider = exports.FetchClientCache = exports.ProblemDetails = exports.FetchClient = void 0; | ||
var FetchClient_js_1 = require("./src/FetchClient.js"); | ||
Object.defineProperty(exports, "FetchClient", { enumerable: true, get: function () { return FetchClient_js_1.FetchClient; } }); | ||
var ProblemDetails_js_1 = require("./src/ProblemDetails.js"); | ||
@@ -21,0 +22,0 @@ Object.defineProperty(exports, "ProblemDetails", { enumerable: true, get: function () { return ProblemDetails_js_1.ProblemDetails; } }); |
@@ -26,4 +26,9 @@ "use strict"; | ||
else { | ||
this.#options = optionsOrProvider; | ||
this.#provider = optionsOrProvider?.provider ?? (0, DefaultHelpers_js_1.getCurrentProvider)(); | ||
if (optionsOrProvider) { | ||
this.#options = { | ||
...this.#provider.options, | ||
...optionsOrProvider, | ||
}; | ||
} | ||
} | ||
@@ -30,0 +35,0 @@ } |
@@ -1,2 +0,3 @@ | ||
export * from "./src/FetchClient.js"; | ||
export { FetchClient } from "./src/FetchClient.js"; | ||
export type { FetchClientOptions } from "./src/FetchClientOptions.js"; | ||
export type { FetchClientResponse } from "./src/FetchClientResponse.js"; | ||
@@ -3,0 +4,0 @@ export { ProblemDetails } from "./src/ProblemDetails.js"; |
@@ -1,3 +0,4 @@ | ||
import type { FetchClient, FetchClientOptions } from "./FetchClient.js"; | ||
import type { FetchClient } from "./FetchClient.js"; | ||
import type { FetchClientMiddleware } from "./FetchClientMiddleware.js"; | ||
import type { FetchClientOptions } from "./FetchClientOptions.js"; | ||
import { type FetchClientProvider } from "./FetchClientProvider.js"; | ||
@@ -4,0 +5,0 @@ import type { ProblemDetails } from "./ProblemDetails.js"; |
@@ -1,4 +0,2 @@ | ||
import { Counter } from "./Counter.js"; | ||
import type { GetRequestOptions, RequestOptions } from "./RequestOptions.js"; | ||
import { ProblemDetails } from "./ProblemDetails.js"; | ||
import type { FetchClientResponse } from "./FetchClientResponse.js"; | ||
@@ -8,48 +6,5 @@ import type { FetchClientMiddleware } from "./FetchClientMiddleware.js"; | ||
import { FetchClientProvider } from "./FetchClientProvider.js"; | ||
import type { FetchClientOptions } from "./FetchClientOptions.js"; | ||
type Fetch = typeof globalThis.fetch; | ||
/** | ||
* Fetch client options to use for making HTTP requests. | ||
*/ | ||
export type FetchClientOptions = { | ||
/** | ||
* The fetch client provider to get shared options from. Any options specified in this options class will override the provider options. | ||
*/ | ||
provider?: FetchClientProvider; | ||
/** | ||
* The default request options to use for requests. If specified, these options will be merged with the | ||
* options from the FetchClientProvider and the options provided in each request. | ||
*/ | ||
defaultRequestOptions?: RequestOptions; | ||
/** | ||
* The cache to use for storing HTTP responses. | ||
*/ | ||
cache?: FetchClientCache; | ||
/** | ||
* The fetch implementation to use for making HTTP requests. | ||
* If not provided, the global fetch function will be used. | ||
*/ | ||
fetch?: Fetch; | ||
/** | ||
* An array of middleware functions to be applied to the request. | ||
*/ | ||
middleware?: FetchClientMiddleware[]; | ||
/** | ||
* The base URL for making HTTP requests. | ||
*/ | ||
baseUrl?: string; | ||
/** | ||
* A function that validates the model before making the request. | ||
* Returns a Promise that resolves to a ProblemDetails object if validation fails, or null if validation succeeds. | ||
*/ | ||
modelValidator?: (model: object | null) => Promise<ProblemDetails | null>; | ||
/** | ||
* A function that returns the access token to use for making requests. | ||
*/ | ||
accessTokenFunc?: () => string | null; | ||
/** | ||
* Counter for tracking the number of inflight requests at the provider level | ||
*/ | ||
providerCounter?: Counter; | ||
} & Record<string, unknown>; | ||
/** | ||
* Represents a client for making HTTP requests using the Fetch API. | ||
@@ -56,0 +11,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
import { FetchClient, type FetchClientOptions } from "./FetchClient.js"; | ||
import { FetchClient } from "./FetchClient.js"; | ||
import { Counter } from "./Counter.js"; | ||
@@ -6,2 +6,3 @@ import type { FetchClientMiddleware } from "./FetchClientMiddleware.js"; | ||
import { FetchClientCache } from "./FetchClientCache.js"; | ||
import type { FetchClientOptions } from "./FetchClientOptions.js"; | ||
type Fetch = typeof globalThis.fetch; | ||
@@ -8,0 +9,0 @@ /** |
@@ -15,3 +15,4 @@ import type { CacheKey } from "./FetchClientCache.js"; | ||
/** | ||
* The expected status codes for the response. | ||
* The expected status codes for the response. If the response status code does not match any of the expected status codes, an error will be thrown. | ||
* Only status codes that are specifically being handled should be included in this array. | ||
*/ | ||
@@ -18,0 +19,0 @@ expectedStatusCodes?: number[]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179086
107
2431