@aurelia/fetch-client
Advanced tools
Comparing version 2.0.1-dev.202402130428 to 2.0.1-dev.202403021005
@@ -6,2 +6,9 @@ # Change Log | ||
<a name="2.0.0-beta.12"></a> | ||
# 2.0.0-beta.12 (2024-03-02) | ||
### Bug Fixes: | ||
* **di:** new instance resolver (#1909) ([efe208c](https://github.com/aurelia/aurelia/commit/efe208c)) | ||
<a name="2.0.0-beta.11"></a> | ||
@@ -8,0 +15,0 @@ # 2.0.0-beta.11 (2024-02-13) |
{ | ||
"name": "@aurelia/fetch-client", | ||
"version": "2.0.1-dev.202402130428", | ||
"version": "2.0.1-dev.202403021005", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -56,4 +56,4 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202402130428", | ||
"@aurelia/metadata": "2.0.1-dev.202402130428" | ||
"@aurelia/kernel": "2.0.1-dev.202403021005", | ||
"@aurelia/metadata": "2.0.1-dev.202403021005" | ||
}, | ||
@@ -60,0 +60,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
import { DI, IContainer, IIndexable, Registration, resolve } from '@aurelia/kernel'; | ||
import { DI, IIndexable, factory, resolve } from '@aurelia/kernel'; | ||
import { HttpClientConfiguration } from './http-client-configuration'; | ||
@@ -19,15 +19,3 @@ import { IFetchInterceptor } from './interfaces'; | ||
export const IHttpClient = /*@__PURE__*/DI.createInterface<IHttpClient>('IHttpClient', x => x.cachedCallback((handler) => { | ||
// reason for this gymnastic is because the way fetch-client is used in applications | ||
// there's no registration, there's only direct usage | ||
// which means application won't have the opportunity to register IHttpClient and HttpClient properly | ||
// app may inject HttpClient in some places and IHttpClient in some other | ||
// so we need to make sure HttpClient and IHttpClient are the same instance | ||
if (handler.has(HttpClient, false)) { | ||
return handler.get(HttpClient); | ||
} | ||
const client = handler.invoke(HttpClient); | ||
handler.register(Registration.instance(HttpClient, client)); | ||
return client; | ||
})); | ||
export const IHttpClient = /*@__PURE__*/DI.createInterface<IHttpClient>('IHttpClient', x => x.aliasTo(HttpClient)); | ||
@@ -81,3 +69,3 @@ export interface IHttpClient extends HttpClient {} | ||
/** @internal */ | ||
private readonly _container = resolve(IContainer); | ||
private readonly _createConfiguration = resolve(factory(HttpClientConfiguration)); | ||
/** @internal */ | ||
@@ -101,3 +89,3 @@ private readonly _fetchFn = resolve(IFetchFn); | ||
} else if (typeof config === 'function') { | ||
normalizedConfig = this._container.invoke(HttpClientConfiguration); | ||
normalizedConfig = this._createConfiguration(); | ||
normalizedConfig.baseUrl = this.baseUrl; | ||
@@ -104,0 +92,0 @@ normalizedConfig.defaults = { ...this.defaults }; |
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
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
Sorry, the diff of this file is not supported yet
336509
6212
+ Added@aurelia/kernel@2.0.1-dev.202403021005(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202403021005(transitive)
+ Added@aurelia/platform@2.0.1-dev.202403021005(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202402130428(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202402130428(transitive)
- Removed@aurelia/platform@2.0.1-dev.202402130428(transitive)