@angular/common 19.2.0-next.2 → 19.2.0-rc.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/fesm2022/common.mjs +131 -134
- package/fesm2022/common.mjs.map +1 -1
- package/fesm2022/http/testing.mjs +8 -8
- package/fesm2022/http.mjs +194 -40
- package/fesm2022/http.mjs.map +1 -1
- package/fesm2022/testing.mjs +16 -16
- package/fesm2022/upgrade.mjs +16 -6
- package/fesm2022/upgrade.mjs.map +1 -1
- package/http/index.d.ts +259 -1
- package/http/testing/index.d.ts +1 -1
- package/index.d.ts +1 -2
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.0-
|
|
2
|
+
* @license Angular v19.2.0-rc.0
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -315,10 +315,10 @@ class HttpClientTestingBackend {
|
|
|
315
315
|
return `Match by function: ${matcher.name}`;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
319
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
319
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingBackend });
|
|
320
320
|
}
|
|
321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingBackend, decorators: [{
|
|
322
322
|
type: Injectable
|
|
323
323
|
}] });
|
|
324
324
|
function describeRequest(testRequest) {
|
|
@@ -346,11 +346,11 @@ function provideHttpClientTesting() {
|
|
|
346
346
|
* @deprecated Add `provideHttpClientTesting()` to your providers instead.
|
|
347
347
|
*/
|
|
348
348
|
class HttpClientTestingModule {
|
|
349
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
350
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-
|
|
351
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-
|
|
349
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
350
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingModule, imports: [HttpClientModule] });
|
|
351
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingModule, providers: [provideHttpClientTesting()], imports: [HttpClientModule] });
|
|
352
352
|
}
|
|
353
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
353
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientTestingModule, decorators: [{
|
|
354
354
|
type: NgModule,
|
|
355
355
|
args: [{
|
|
356
356
|
imports: [HttpClientModule],
|
package/fesm2022/http.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.0-
|
|
2
|
+
* @license Angular v19.2.0-rc.0
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵRuntimeError, Injectable, InjectionToken, inject, NgZone, runInInjectionContext, ɵPendingTasksInternal, PLATFORM_ID, ɵConsole, ɵformatRuntimeError, Inject, makeEnvironmentProviders, NgModule, TransferState, makeStateKey, ɵperformanceMarkFeature, APP_BOOTSTRAP_LISTENER, ApplicationRef, ɵtruncateMiddle } from '@angular/core';
|
|
8
|
+
import { ɵRuntimeError, Injectable, InjectionToken, inject, NgZone, runInInjectionContext, ɵPendingTasksInternal, PLATFORM_ID, ɵConsole, ɵformatRuntimeError, Inject, makeEnvironmentProviders, NgModule, assertInInjectionContext, Injector, ɵResourceImpl, linkedSignal, computed, ResourceStatus, signal, TransferState, makeStateKey, ɵperformanceMarkFeature, APP_BOOTSTRAP_LISTENER, ApplicationRef, ɵtruncateMiddle } from '@angular/core';
|
|
9
9
|
import { of, Observable, from } from 'rxjs';
|
|
10
10
|
import { concatMap, filter, map, finalize, switchMap, tap } from 'rxjs/operators';
|
|
11
11
|
import * as i1 from '@angular/common';
|
|
@@ -1570,10 +1570,10 @@ class HttpClient {
|
|
|
1570
1570
|
put(url, body, options = {}) {
|
|
1571
1571
|
return this.request('PUT', url, addBody(options, body));
|
|
1572
1572
|
}
|
|
1573
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
1574
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
1573
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1574
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClient });
|
|
1575
1575
|
}
|
|
1576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
1576
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClient, decorators: [{
|
|
1577
1577
|
type: Injectable
|
|
1578
1578
|
}], ctorParameters: () => [{ type: HttpHandler }] });
|
|
1579
1579
|
|
|
@@ -1788,10 +1788,10 @@ class FetchBackend {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
return chunksAll;
|
|
1790
1790
|
}
|
|
1791
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
1792
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
1791
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1792
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: FetchBackend });
|
|
1793
1793
|
}
|
|
1794
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
1794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: FetchBackend, decorators: [{
|
|
1795
1795
|
type: Injectable
|
|
1796
1796
|
}] });
|
|
1797
1797
|
/**
|
|
@@ -1932,10 +1932,10 @@ class HttpInterceptorHandler extends HttpHandler {
|
|
|
1932
1932
|
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
|
|
1933
1933
|
}
|
|
1934
1934
|
}
|
|
1935
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
1936
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
1935
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1936
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpInterceptorHandler });
|
|
1937
1937
|
}
|
|
1938
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
1938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
|
|
1939
1939
|
type: Injectable
|
|
1940
1940
|
}], ctorParameters: () => [{ type: HttpBackend }, { type: i0.EnvironmentInjector }] });
|
|
1941
1941
|
|
|
@@ -2137,10 +2137,10 @@ class JsonpClientBackend {
|
|
|
2137
2137
|
foreignDocument ??= this.document.implementation.createHTMLDocument();
|
|
2138
2138
|
foreignDocument.adoptNode(script);
|
|
2139
2139
|
}
|
|
2140
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2141
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
2140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2141
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpClientBackend });
|
|
2142
2142
|
}
|
|
2143
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpClientBackend, decorators: [{
|
|
2144
2144
|
type: Injectable
|
|
2145
2145
|
}], ctorParameters: () => [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
|
|
2146
2146
|
type: Inject,
|
|
@@ -2179,10 +2179,10 @@ class JsonpInterceptor {
|
|
|
2179
2179
|
intercept(initialRequest, next) {
|
|
2180
2180
|
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
2181
2181
|
}
|
|
2182
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2183
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
2182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2183
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpInterceptor });
|
|
2184
2184
|
}
|
|
2185
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: JsonpInterceptor, decorators: [{
|
|
2186
2186
|
type: Injectable
|
|
2187
2187
|
}], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
|
|
2188
2188
|
|
|
@@ -2464,10 +2464,10 @@ class HttpXhrBackend {
|
|
|
2464
2464
|
});
|
|
2465
2465
|
}));
|
|
2466
2466
|
}
|
|
2467
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2468
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
2467
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXhrBackend, deps: [{ token: i1.XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2468
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXhrBackend });
|
|
2469
2469
|
}
|
|
2470
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2470
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXhrBackend, decorators: [{
|
|
2471
2471
|
type: Injectable
|
|
2472
2472
|
}], ctorParameters: () => [{ type: i1.XhrFactory }] });
|
|
2473
2473
|
|
|
@@ -2519,10 +2519,10 @@ class HttpXsrfCookieExtractor {
|
|
|
2519
2519
|
}
|
|
2520
2520
|
return this.lastToken;
|
|
2521
2521
|
}
|
|
2522
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2523
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
2522
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2523
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor });
|
|
2524
2524
|
}
|
|
2525
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
|
|
2526
2526
|
type: Injectable
|
|
2527
2527
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
2528
2528
|
type: Inject,
|
|
@@ -2566,10 +2566,10 @@ class HttpXsrfInterceptor {
|
|
|
2566
2566
|
intercept(initialRequest, next) {
|
|
2567
2567
|
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
|
|
2568
2568
|
}
|
|
2569
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2570
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-
|
|
2569
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2570
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor });
|
|
2571
2571
|
}
|
|
2572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
|
|
2573
2573
|
type: Injectable
|
|
2574
2574
|
}], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
|
|
2575
2575
|
|
|
@@ -2835,9 +2835,9 @@ class HttpClientXsrfModule {
|
|
|
2835
2835
|
providers: withXsrfConfiguration(options).ɵproviders,
|
|
2836
2836
|
};
|
|
2837
2837
|
}
|
|
2838
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2839
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-
|
|
2840
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-
|
|
2838
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2839
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientXsrfModule });
|
|
2840
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, providers: [
|
|
2841
2841
|
HttpXsrfInterceptor,
|
|
2842
2842
|
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
|
|
2843
2843
|
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
|
|
@@ -2848,7 +2848,7 @@ class HttpClientXsrfModule {
|
|
|
2848
2848
|
{ provide: XSRF_ENABLED, useValue: true },
|
|
2849
2849
|
] });
|
|
2850
2850
|
}
|
|
2851
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
|
|
2852
2852
|
type: NgModule,
|
|
2853
2853
|
args: [{
|
|
2854
2854
|
providers: [
|
|
@@ -2874,11 +2874,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-next.2",
|
|
|
2874
2874
|
* @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
|
|
2875
2875
|
*/
|
|
2876
2876
|
class HttpClientModule {
|
|
2877
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2878
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-
|
|
2879
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-
|
|
2877
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2878
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientModule });
|
|
2879
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] });
|
|
2880
2880
|
}
|
|
2881
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientModule, decorators: [{
|
|
2882
2882
|
type: NgModule,
|
|
2883
2883
|
args: [{
|
|
2884
2884
|
/**
|
|
@@ -2898,17 +2898,172 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-next.2",
|
|
|
2898
2898
|
* @deprecated `withJsonpSupport()` as providers instead
|
|
2899
2899
|
*/
|
|
2900
2900
|
class HttpClientJsonpModule {
|
|
2901
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-
|
|
2902
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-
|
|
2903
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-
|
|
2901
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2902
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientJsonpModule });
|
|
2903
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] });
|
|
2904
2904
|
}
|
|
2905
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-
|
|
2905
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
|
|
2906
2906
|
type: NgModule,
|
|
2907
2907
|
args: [{
|
|
2908
2908
|
providers: [withJsonpSupport().ɵproviders],
|
|
2909
2909
|
}]
|
|
2910
2910
|
}] });
|
|
2911
2911
|
|
|
2912
|
+
/**
|
|
2913
|
+
* `httpResource` makes a reactive HTTP request and exposes the request status and response value as
|
|
2914
|
+
* a `WritableResource`. By default, it assumes that the backend will return JSON data. To make a
|
|
2915
|
+
* request that expects a different kind of data, you can use a sub-constructor of `httpResource`,
|
|
2916
|
+
* such as `httpResource.text`.
|
|
2917
|
+
*
|
|
2918
|
+
* @experimental
|
|
2919
|
+
* @initializerApiFunction
|
|
2920
|
+
*/
|
|
2921
|
+
const httpResource = (() => {
|
|
2922
|
+
const jsonFn = makeHttpResourceFn('json');
|
|
2923
|
+
jsonFn.arrayBuffer = makeHttpResourceFn('arraybuffer');
|
|
2924
|
+
jsonFn.blob = makeHttpResourceFn('blob');
|
|
2925
|
+
jsonFn.text = makeHttpResourceFn('text');
|
|
2926
|
+
return jsonFn;
|
|
2927
|
+
})();
|
|
2928
|
+
function makeHttpResourceFn(responseType) {
|
|
2929
|
+
return function httpResourceRef(request, options) {
|
|
2930
|
+
options?.injector || assertInInjectionContext(httpResource);
|
|
2931
|
+
const injector = options?.injector ?? inject(Injector);
|
|
2932
|
+
return new HttpResourceImpl(injector, () => normalizeRequest(request, responseType), options?.defaultValue, options?.map);
|
|
2933
|
+
};
|
|
2934
|
+
}
|
|
2935
|
+
function normalizeRequest(request, responseType) {
|
|
2936
|
+
let unwrappedRequest = typeof request === 'function' ? request() : request;
|
|
2937
|
+
if (unwrappedRequest === undefined) {
|
|
2938
|
+
return undefined;
|
|
2939
|
+
}
|
|
2940
|
+
else if (typeof unwrappedRequest === 'string') {
|
|
2941
|
+
unwrappedRequest = { url: unwrappedRequest };
|
|
2942
|
+
}
|
|
2943
|
+
const headers = unwrappedRequest.headers instanceof HttpHeaders
|
|
2944
|
+
? unwrappedRequest.headers
|
|
2945
|
+
: new HttpHeaders(unwrappedRequest.headers);
|
|
2946
|
+
const params = unwrappedRequest.params instanceof HttpParams
|
|
2947
|
+
? unwrappedRequest.params
|
|
2948
|
+
: new HttpParams({ fromObject: unwrappedRequest.params });
|
|
2949
|
+
return new HttpRequest(unwrappedRequest.method ?? 'GET', unwrappedRequest.url, unwrappedRequest.body ?? null, {
|
|
2950
|
+
headers,
|
|
2951
|
+
params,
|
|
2952
|
+
reportProgress: unwrappedRequest.reportProgress,
|
|
2953
|
+
withCredentials: unwrappedRequest.withCredentials,
|
|
2954
|
+
responseType,
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
class HttpResourceImpl extends ɵResourceImpl {
|
|
2958
|
+
client;
|
|
2959
|
+
_headers = linkedSignal({
|
|
2960
|
+
source: this.extRequest,
|
|
2961
|
+
computation: () => undefined,
|
|
2962
|
+
});
|
|
2963
|
+
_progress = linkedSignal({
|
|
2964
|
+
source: this.extRequest,
|
|
2965
|
+
computation: () => undefined,
|
|
2966
|
+
});
|
|
2967
|
+
_statusCode = linkedSignal({
|
|
2968
|
+
source: this.extRequest,
|
|
2969
|
+
computation: () => undefined,
|
|
2970
|
+
});
|
|
2971
|
+
headers = computed(() => this.status() === ResourceStatus.Resolved || this.status() === ResourceStatus.Error
|
|
2972
|
+
? this._headers()
|
|
2973
|
+
: undefined);
|
|
2974
|
+
progress = this._progress.asReadonly();
|
|
2975
|
+
statusCode = this._statusCode.asReadonly();
|
|
2976
|
+
constructor(injector, request, defaultValue, map) {
|
|
2977
|
+
super(request, ({ request, abortSignal }) => {
|
|
2978
|
+
let sub;
|
|
2979
|
+
// Track the abort listener so it can be removed if the Observable completes (as a memory
|
|
2980
|
+
// optimization).
|
|
2981
|
+
const onAbort = () => sub.unsubscribe();
|
|
2982
|
+
abortSignal.addEventListener('abort', onAbort);
|
|
2983
|
+
// Start off stream as undefined.
|
|
2984
|
+
const stream = signal({ value: undefined });
|
|
2985
|
+
let resolve;
|
|
2986
|
+
const promise = new Promise((r) => (resolve = r));
|
|
2987
|
+
const send = (value) => {
|
|
2988
|
+
stream.set(value);
|
|
2989
|
+
resolve?.(stream);
|
|
2990
|
+
resolve = undefined;
|
|
2991
|
+
};
|
|
2992
|
+
sub = this.client.request(request).subscribe({
|
|
2993
|
+
next: (event) => {
|
|
2994
|
+
switch (event.type) {
|
|
2995
|
+
case HttpEventType.Response:
|
|
2996
|
+
this._headers.set(event.headers);
|
|
2997
|
+
this._statusCode.set(event.status);
|
|
2998
|
+
try {
|
|
2999
|
+
send({ value: map ? map(event.body) : event.body });
|
|
3000
|
+
}
|
|
3001
|
+
catch (error) {
|
|
3002
|
+
send({ error });
|
|
3003
|
+
}
|
|
3004
|
+
break;
|
|
3005
|
+
case HttpEventType.DownloadProgress:
|
|
3006
|
+
this._progress.set(event);
|
|
3007
|
+
break;
|
|
3008
|
+
}
|
|
3009
|
+
},
|
|
3010
|
+
error: (error) => send({ error }),
|
|
3011
|
+
complete: () => {
|
|
3012
|
+
if (resolve) {
|
|
3013
|
+
send({ error: new Error('Resource completed before producing a value') });
|
|
3014
|
+
}
|
|
3015
|
+
abortSignal.removeEventListener('abort', onAbort);
|
|
3016
|
+
},
|
|
3017
|
+
});
|
|
3018
|
+
return promise;
|
|
3019
|
+
}, defaultValue, undefined, injector);
|
|
3020
|
+
this.client = injector.get(HttpClient);
|
|
3021
|
+
}
|
|
3022
|
+
hasValue() {
|
|
3023
|
+
return super.hasValue();
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* A `Resource` of the `HttpResponse` meant for use in `HttpResource` if we decide to go this route.
|
|
3028
|
+
*
|
|
3029
|
+
* TODO(alxhub): delete this if we decide we don't want it.
|
|
3030
|
+
*/
|
|
3031
|
+
class HttpResponseResource {
|
|
3032
|
+
parent;
|
|
3033
|
+
status;
|
|
3034
|
+
value;
|
|
3035
|
+
error;
|
|
3036
|
+
isLoading;
|
|
3037
|
+
constructor(parent, request) {
|
|
3038
|
+
this.parent = parent;
|
|
3039
|
+
this.status = computed(() => {
|
|
3040
|
+
// There are two kinds of errors which can occur in an HTTP request: HTTP errors or normal JS
|
|
3041
|
+
// errors. Since we have a response for HTTP errors, we report `Resolved` status even if the
|
|
3042
|
+
// overall request is considered to be in an Error state.
|
|
3043
|
+
if (parent.status() === ResourceStatus.Error) {
|
|
3044
|
+
return this.value() !== undefined ? ResourceStatus.Resolved : ResourceStatus.Error;
|
|
3045
|
+
}
|
|
3046
|
+
return parent.status();
|
|
3047
|
+
});
|
|
3048
|
+
this.error = computed(() => {
|
|
3049
|
+
// Filter out HTTP errors.
|
|
3050
|
+
return this.value() === undefined ? parent.error() : undefined;
|
|
3051
|
+
});
|
|
3052
|
+
this.value = linkedSignal({
|
|
3053
|
+
source: request,
|
|
3054
|
+
computation: () => undefined,
|
|
3055
|
+
});
|
|
3056
|
+
this.isLoading = parent.isLoading;
|
|
3057
|
+
}
|
|
3058
|
+
hasValue() {
|
|
3059
|
+
return this.value() !== undefined;
|
|
3060
|
+
}
|
|
3061
|
+
reload() {
|
|
3062
|
+
// TODO: should you be able to reload this way?
|
|
3063
|
+
return this.parent.reload();
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
|
|
2912
3067
|
/**
|
|
2913
3068
|
* If your application uses different HTTP origins to make API calls (via `HttpClient`) on the server and
|
|
2914
3069
|
* on the client, the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token allows you to establish a mapping
|
|
@@ -3106,7 +3261,6 @@ function withHttpTransferCache(cacheOptions) {
|
|
|
3106
3261
|
provide: HTTP_ROOT_INTERCEPTOR_FNS,
|
|
3107
3262
|
useValue: transferCacheInterceptorFn,
|
|
3108
3263
|
multi: true,
|
|
3109
|
-
deps: [TransferState, CACHE_OPTIONS],
|
|
3110
3264
|
},
|
|
3111
3265
|
{
|
|
3112
3266
|
provide: APP_BOOTSTRAP_LISTENER,
|
|
@@ -3182,5 +3336,5 @@ function verifyMappedOrigin(url) {
|
|
|
3182
3336
|
* Generated bundle index. Do not edit.
|
|
3183
3337
|
*/
|
|
3184
3338
|
|
|
3185
|
-
export { FetchBackend, HTTP_INTERCEPTORS, HTTP_TRANSFER_CACHE_ORIGIN_MAP, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpFeatureKind, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpStatusCode, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HTTP_ROOT_INTERCEPTOR_FNS as ɵHTTP_ROOT_INTERCEPTOR_FNS, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, REQUESTS_CONTRIBUTE_TO_STABILITY as ɵREQUESTS_CONTRIBUTE_TO_STABILITY, withHttpTransferCache as ɵwithHttpTransferCache };
|
|
3339
|
+
export { FetchBackend, HTTP_INTERCEPTORS, HTTP_TRANSFER_CACHE_ORIGIN_MAP, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpFeatureKind, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpStatusCode, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, httpResource, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration, HTTP_ROOT_INTERCEPTOR_FNS as ɵHTTP_ROOT_INTERCEPTOR_FNS, HttpInterceptorHandler as ɵHttpInterceptingHandler, HttpInterceptorHandler as ɵHttpInterceptorHandler, REQUESTS_CONTRIBUTE_TO_STABILITY as ɵREQUESTS_CONTRIBUTE_TO_STABILITY, withHttpTransferCache as ɵwithHttpTransferCache };
|
|
3186
3340
|
//# sourceMappingURL=http.mjs.map
|