@angular/common
Version:
Angular - commonly needed directives and services
1 lines • 40.9 kB
Source Map (JSON)
{"version":3,"file":"http.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/common/http/src/resource.ts","../../../../../darwin_arm64-fastbuild-ST-2d99d9656325/bin/packages/common/http/src/transfer_cache.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n Injector,\n Signal,\n ɵResourceImpl as ResourceImpl,\n inject,\n linkedSignal,\n assertInInjectionContext,\n signal,\n ResourceStatus,\n computed,\n Resource,\n WritableSignal,\n ResourceStreamItem,\n type ValueEqualityFn,\n} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {HttpRequest} from './request';\nimport {HttpClient} from './client';\nimport {HttpErrorResponse, HttpEventType, HttpProgressEvent, HttpResponseBase} from './response';\nimport {HttpHeaders} from './headers';\nimport {HttpParams} from './params';\nimport {HttpResourceRef, HttpResourceOptions, HttpResourceRequest} from './resource_api';\n\n/**\n * Type for the `httpRequest` top-level function, which includes the call signatures for the JSON-\n * based `httpRequest` as well as sub-functions for `ArrayBuffer`, `Blob`, and `string` type\n * requests.\n *\n * @experimental\n */\nexport interface HttpResourceFn {\n /**\n * Create a `Resource` that fetches data with an HTTP GET request to the given URL.\n *\n * If a reactive function is passed for the URL, the resource will update when the URL changes via\n * signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of\n * `httpResource`, such as `httpResource.text()`, to parse the response differently.\n *\n * @experimental\n */\n <TResult = unknown>(\n url: string | (() => string | undefined),\n options: HttpResourceOptions<TResult, unknown> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n /**\n * Create a `Resource` that fetches data with an HTTP GET request to the given URL.\n *\n * If a reactive function is passed for the URL, the resource will update when the URL changes via\n * signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of\n * `httpResource`, such as `httpResource.text()`, to parse the response differently.\n *\n * @experimental\n */\n <TResult = unknown>(\n url: string | (() => string | undefined),\n options?: HttpResourceOptions<TResult, unknown>,\n ): HttpResourceRef<TResult | undefined>;\n\n /**\n * Create a `Resource` that fetches data with the configured HTTP request.\n *\n * If a reactive function is passed for the request, the resource will update when the request\n * changes via signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of\n * `httpResource`, such as `httpResource.text()`, to parse the response differently.\n *\n * @experimental\n */\n <TResult = unknown>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options: HttpResourceOptions<TResult, unknown> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n /**\n * Create a `Resource` that fetches data with the configured HTTP request.\n *\n * If a reactive function is passed for the request, the resource will update when the request\n * changes via signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed as JSON by default - use a sub-function of\n * `httpResource`, such as `httpResource.text()`, to parse the response differently.\n *\n * @experimental\n */\n <TResult = unknown>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options?: HttpResourceOptions<TResult, unknown>,\n ): HttpResourceRef<TResult | undefined>;\n\n /**\n * Create a `Resource` that fetches data with the configured HTTP request.\n *\n * If a reactive function is passed for the URL or request, the resource will update when the\n * URL or request changes via signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed into an `ArrayBuffer`.\n *\n * @experimental\n */\n arrayBuffer: {\n <TResult = ArrayBuffer>(\n url: string | (() => string | undefined),\n options: HttpResourceOptions<TResult, ArrayBuffer> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = ArrayBuffer>(\n url: string | (() => string | undefined),\n options?: HttpResourceOptions<TResult, ArrayBuffer>,\n ): HttpResourceRef<TResult | undefined>;\n\n <TResult = ArrayBuffer>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options: HttpResourceOptions<TResult, ArrayBuffer> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = ArrayBuffer>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options?: HttpResourceOptions<TResult, ArrayBuffer>,\n ): HttpResourceRef<TResult | undefined>;\n };\n\n /**\n * Create a `Resource` that fetches data with the configured HTTP request.\n *\n * If a reactive function is passed for the URL or request, the resource will update when the\n * URL or request changes via signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed into a `Blob`.\n *\n * @experimental\n */\n blob: {\n <TResult = Blob>(\n url: string | (() => string | undefined),\n options: HttpResourceOptions<TResult, Blob> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = Blob>(\n url: string | (() => string | undefined),\n options?: HttpResourceOptions<TResult, Blob>,\n ): HttpResourceRef<TResult | undefined>;\n\n <TResult = Blob>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options: HttpResourceOptions<TResult, Blob> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = Blob>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options?: HttpResourceOptions<TResult, Blob>,\n ): HttpResourceRef<TResult | undefined>;\n };\n\n /**\n * Create a `Resource` that fetches data with the configured HTTP request.\n *\n * If a reactive function is passed for the URL or request, the resource will update when the\n * URL or request changes via signals.\n *\n * Uses `HttpClient` to make requests and supports interceptors, testing, and the other features\n * of the `HttpClient` API. Data is parsed as a `string`.\n *\n * @experimental\n */\n text: {\n <TResult = string>(\n url: string | (() => string | undefined),\n options: HttpResourceOptions<TResult, string> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = string>(\n url: string | (() => string | undefined),\n options?: HttpResourceOptions<TResult, string>,\n ): HttpResourceRef<TResult | undefined>;\n\n <TResult = string>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options: HttpResourceOptions<TResult, string> & {defaultValue: NoInfer<TResult>},\n ): HttpResourceRef<TResult>;\n\n <TResult = string>(\n request: HttpResourceRequest | (() => HttpResourceRequest | undefined),\n options?: HttpResourceOptions<TResult, string>,\n ): HttpResourceRef<TResult | undefined>;\n };\n}\n\n/**\n * `httpResource` makes a reactive HTTP request and exposes the request status and response value as\n * a `WritableResource`. By default, it assumes that the backend will return JSON data. To make a\n * request that expects a different kind of data, you can use a sub-constructor of `httpResource`,\n * such as `httpResource.text`.\n *\n * @experimental\n * @initializerApiFunction\n */\nexport const httpResource: HttpResourceFn = (() => {\n const jsonFn = makeHttpResourceFn<unknown>('json') as HttpResourceFn;\n jsonFn.arrayBuffer = makeHttpResourceFn<ArrayBuffer>('arraybuffer');\n jsonFn.blob = makeHttpResourceFn('blob');\n jsonFn.text = makeHttpResourceFn('text');\n return jsonFn;\n})();\n\ntype RawRequestType =\n | string\n | (() => string | undefined)\n | HttpResourceRequest\n | (() => HttpResourceRequest | undefined);\n\nfunction makeHttpResourceFn<TRaw>(responseType: 'arraybuffer' | 'blob' | 'json' | 'text') {\n return function httpResourceRef<TResult = TRaw>(\n request: RawRequestType,\n options?: HttpResourceOptions<TResult, TRaw>,\n ): HttpResourceRef<TResult> {\n options?.injector || assertInInjectionContext(httpResource);\n const injector = options?.injector ?? inject(Injector);\n return new HttpResourceImpl(\n injector,\n () => normalizeRequest(request, responseType),\n options?.defaultValue,\n options?.parse as (value: unknown) => TResult,\n options?.equal as ValueEqualityFn<unknown>,\n ) as HttpResourceRef<TResult>;\n };\n}\n\nfunction normalizeRequest(\n request: RawRequestType,\n responseType: 'arraybuffer' | 'blob' | 'json' | 'text',\n): HttpRequest<unknown> | undefined {\n let unwrappedRequest = typeof request === 'function' ? request() : request;\n if (unwrappedRequest === undefined) {\n return undefined;\n } else if (typeof unwrappedRequest === 'string') {\n unwrappedRequest = {url: unwrappedRequest};\n }\n\n const headers =\n unwrappedRequest.headers instanceof HttpHeaders\n ? unwrappedRequest.headers\n : new HttpHeaders(\n unwrappedRequest.headers as\n | Record<string, string | number | Array<string | number>>\n | undefined,\n );\n\n const params =\n unwrappedRequest.params instanceof HttpParams\n ? unwrappedRequest.params\n : new HttpParams({fromObject: unwrappedRequest.params});\n\n return new HttpRequest(\n unwrappedRequest.method ?? 'GET',\n unwrappedRequest.url,\n unwrappedRequest.body ?? null,\n {\n headers,\n params,\n reportProgress: unwrappedRequest.reportProgress,\n withCredentials: unwrappedRequest.withCredentials,\n responseType,\n context: unwrappedRequest.context,\n transferCache: unwrappedRequest.transferCache,\n },\n );\n}\nclass HttpResourceImpl<T>\n extends ResourceImpl<T, HttpRequest<unknown> | undefined>\n implements HttpResourceRef<T>\n{\n private client!: HttpClient;\n private _headers = linkedSignal({\n source: this.extRequest,\n computation: () => undefined as HttpHeaders | undefined,\n });\n private _progress = linkedSignal({\n source: this.extRequest,\n computation: () => undefined as HttpProgressEvent | undefined,\n });\n private _statusCode = linkedSignal({\n source: this.extRequest,\n computation: () => undefined as number | undefined,\n });\n\n readonly headers = computed(() =>\n this.status() === ResourceStatus.Resolved || this.status() === ResourceStatus.Error\n ? this._headers()\n : undefined,\n );\n readonly progress = this._progress.asReadonly();\n readonly statusCode = this._statusCode.asReadonly();\n\n constructor(\n injector: Injector,\n request: () => HttpRequest<T> | undefined,\n defaultValue: T,\n parse?: (value: unknown) => T,\n equal?: ValueEqualityFn<unknown>,\n ) {\n super(\n request,\n ({request, abortSignal}) => {\n let sub: Subscription;\n\n // Track the abort listener so it can be removed if the Observable completes (as a memory\n // optimization).\n const onAbort = () => sub.unsubscribe();\n abortSignal.addEventListener('abort', onAbort);\n\n // Start off stream as undefined.\n const stream = signal<ResourceStreamItem<T>>({value: undefined as T});\n let resolve: ((value: Signal<ResourceStreamItem<T>>) => void) | undefined;\n const promise = new Promise<Signal<ResourceStreamItem<T>>>((r) => (resolve = r));\n\n const send = (value: ResourceStreamItem<T>): void => {\n stream.set(value);\n resolve?.(stream);\n resolve = undefined;\n };\n\n sub = this.client.request(request!).subscribe({\n next: (event) => {\n switch (event.type) {\n case HttpEventType.Response:\n this._headers.set(event.headers);\n this._statusCode.set(event.status);\n try {\n send({value: parse ? parse(event.body) : (event.body as T)});\n } catch (error) {\n send({error});\n }\n break;\n case HttpEventType.DownloadProgress:\n this._progress.set(event);\n break;\n }\n },\n error: (error) => {\n if (error instanceof HttpErrorResponse) {\n this._headers.set(error.headers);\n this._statusCode.set(error.status);\n }\n\n send({error});\n abortSignal.removeEventListener('abort', onAbort);\n },\n complete: () => {\n if (resolve) {\n send({error: new Error('Resource completed before producing a value')});\n }\n abortSignal.removeEventListener('abort', onAbort);\n },\n });\n\n return promise;\n },\n defaultValue,\n equal,\n injector,\n );\n this.client = injector.get(HttpClient);\n }\n\n // This is a type only override of the method\n declare hasValue: () => this is HttpResourceRef<Exclude<T, undefined>>;\n}\n\n/**\n * A `Resource` of the `HttpResponse` meant for use in `HttpResource` if we decide to go this route.\n *\n * TODO(alxhub): delete this if we decide we don't want it.\n */\nclass HttpResponseResource implements Resource<HttpResponseBase | undefined> {\n readonly status: Signal<ResourceStatus>;\n readonly value: WritableSignal<HttpResponseBase | undefined>;\n readonly error: Signal<unknown>;\n readonly isLoading: Signal<boolean>;\n\n constructor(\n private parent: Resource<unknown>,\n request: Signal<unknown>,\n ) {\n this.status = computed(() => {\n // There are two kinds of errors which can occur in an HTTP request: HTTP errors or normal JS\n // errors. Since we have a response for HTTP errors, we report `Resolved` status even if the\n // overall request is considered to be in an Error state.\n if (parent.status() === ResourceStatus.Error) {\n return this.value() !== undefined ? ResourceStatus.Resolved : ResourceStatus.Error;\n }\n return parent.status();\n });\n this.error = computed(() => {\n // Filter out HTTP errors.\n return this.value() === undefined ? parent.error() : undefined;\n });\n this.value = linkedSignal({\n source: request,\n computation: () => undefined as HttpResponseBase | undefined,\n });\n this.isLoading = parent.isLoading;\n }\n\n hasValue(): this is Resource<HttpResponseBase> {\n return this.value() !== undefined;\n }\n\n reload(): boolean {\n // TODO: should you be able to reload this way?\n return this.parent.reload();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n APP_BOOTSTRAP_LISTENER,\n ApplicationRef,\n inject,\n InjectionToken,\n makeStateKey,\n Provider,\n StateKey,\n TransferState,\n ɵformatRuntimeError as formatRuntimeError,\n ɵperformanceMarkFeature as performanceMarkFeature,\n ɵtruncateMiddle as truncateMiddle,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\nimport {Observable, of} from 'rxjs';\nimport {tap} from 'rxjs/operators';\n\nimport {RuntimeErrorCode} from './errors';\nimport {HttpHeaders} from './headers';\nimport {HTTP_ROOT_INTERCEPTOR_FNS, HttpHandlerFn} from './interceptor';\nimport {HttpRequest} from './request';\nimport {HttpEvent, HttpResponse} from './response';\nimport {HttpParams} from './params';\n\n/**\n * Options to configure how TransferCache should be used to cache requests made via HttpClient.\n *\n * @param includeHeaders Specifies which headers should be included into cached responses. No\n * headers are included by default.\n * @param filter A function that receives a request as an argument and returns a boolean to indicate\n * whether a request should be included into the cache.\n * @param includePostRequests Enables caching for POST requests. By default, only GET and HEAD\n * requests are cached. This option can be enabled if POST requests are used to retrieve data\n * (for example using GraphQL).\n * @param includeRequestsWithAuthHeaders Enables caching of requests containing either `Authorization`\n * or `Proxy-Authorization` headers. By default, these requests are excluded from caching.\n *\n * @publicApi\n */\nexport type HttpTransferCacheOptions = {\n includeHeaders?: string[];\n filter?: (req: HttpRequest<unknown>) => boolean;\n includePostRequests?: boolean;\n includeRequestsWithAuthHeaders?: boolean;\n};\n\n/**\n * If your application uses different HTTP origins to make API calls (via `HttpClient`) on the server and\n * on the client, the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token allows you to establish a mapping\n * between those origins, so that `HttpTransferCache` feature can recognize those requests as the same\n * ones and reuse the data cached on the server during hydration on the client.\n *\n * **Important note**: the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token should *only* be provided in\n * the *server* code of your application (typically in the `app.server.config.ts` script). Angular throws an\n * error if it detects that the token is defined while running on the client.\n *\n * @usageNotes\n *\n * When the same API endpoint is accessed via `http://internal-domain.com:8080` on the server and\n * via `https://external-domain.com` on the client, you can use the following configuration:\n * ```ts\n * // in app.server.config.ts\n * {\n * provide: HTTP_TRANSFER_CACHE_ORIGIN_MAP,\n * useValue: {\n * 'http://internal-domain.com:8080': 'https://external-domain.com'\n * }\n * }\n * ```\n *\n * @publicApi\n */\nexport const HTTP_TRANSFER_CACHE_ORIGIN_MAP = new InjectionToken<Record<string, string>>(\n ngDevMode ? 'HTTP_TRANSFER_CACHE_ORIGIN_MAP' : '',\n);\n\n/**\n * Keys within cached response data structure.\n */\n\nexport const BODY = 'b';\nexport const HEADERS = 'h';\nexport const STATUS = 's';\nexport const STATUS_TEXT = 'st';\nexport const REQ_URL = 'u';\nexport const RESPONSE_TYPE = 'rt';\n\ninterface TransferHttpResponse {\n /** body */\n [BODY]: any;\n /** headers */\n [HEADERS]: Record<string, string[]>;\n /** status */\n [STATUS]?: number;\n /** statusText */\n [STATUS_TEXT]?: string;\n /** url */\n [REQ_URL]?: string;\n /** responseType */\n [RESPONSE_TYPE]?: HttpRequest<unknown>['responseType'];\n}\n\ninterface CacheOptions extends HttpTransferCacheOptions {\n isCacheActive: boolean;\n}\n\nconst CACHE_OPTIONS = new InjectionToken<CacheOptions>(\n ngDevMode ? 'HTTP_TRANSFER_STATE_CACHE_OPTIONS' : '',\n);\n\n/**\n * A list of allowed HTTP methods to cache.\n */\nconst ALLOWED_METHODS = ['GET', 'HEAD'];\n\nexport function transferCacheInterceptorFn(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n const {isCacheActive, ...globalOptions} = inject(CACHE_OPTIONS);\n const {transferCache: requestOptions, method: requestMethod} = req;\n\n // In the following situations we do not want to cache the request\n if (\n !isCacheActive ||\n requestOptions === false ||\n // POST requests are allowed either globally or at request level\n (requestMethod === 'POST' && !globalOptions.includePostRequests && !requestOptions) ||\n (requestMethod !== 'POST' && !ALLOWED_METHODS.includes(requestMethod)) ||\n // Do not cache request that require authorization when includeRequestsWithAuthHeaders is falsey\n (!globalOptions.includeRequestsWithAuthHeaders && hasAuthHeaders(req)) ||\n globalOptions.filter?.(req) === false\n ) {\n return next(req);\n }\n\n const transferState = inject(TransferState);\n\n const originMap: Record<string, string> | null = inject(HTTP_TRANSFER_CACHE_ORIGIN_MAP, {\n optional: true,\n });\n\n if (typeof ngServerMode !== 'undefined' && !ngServerMode && originMap) {\n throw new RuntimeError(\n RuntimeErrorCode.HTTP_ORIGIN_MAP_USED_IN_CLIENT,\n ngDevMode &&\n 'Angular detected that the `HTTP_TRANSFER_CACHE_ORIGIN_MAP` token is configured and ' +\n 'present in the client side code. Please ensure that this token is only provided in the ' +\n 'server code of the application.',\n );\n }\n\n const requestUrl =\n typeof ngServerMode !== 'undefined' && ngServerMode && originMap\n ? mapRequestOriginUrl(req.url, originMap)\n : req.url;\n\n const storeKey = makeCacheKey(req, requestUrl);\n const response = transferState.get(storeKey, null);\n\n let headersToInclude = globalOptions.includeHeaders;\n if (typeof requestOptions === 'object' && requestOptions.includeHeaders) {\n // Request-specific config takes precedence over the global config.\n headersToInclude = requestOptions.includeHeaders;\n }\n\n if (response) {\n const {\n [BODY]: undecodedBody,\n [RESPONSE_TYPE]: responseType,\n [HEADERS]: httpHeaders,\n [STATUS]: status,\n [STATUS_TEXT]: statusText,\n [REQ_URL]: url,\n } = response;\n // Request found in cache. Respond using it.\n let body: ArrayBuffer | Blob | string | undefined = undecodedBody;\n\n switch (responseType) {\n case 'arraybuffer':\n body = new TextEncoder().encode(undecodedBody).buffer;\n break;\n case 'blob':\n body = new Blob([undecodedBody]);\n break;\n }\n\n // We want to warn users accessing a header provided from the cache\n // That HttpTransferCache alters the headers\n // The warning will be logged a single time by HttpHeaders instance\n let headers = new HttpHeaders(httpHeaders);\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Append extra logic in dev mode to produce a warning when a header\n // that was not transferred to the client is accessed in the code via `get`\n // and `has` calls.\n headers = appendMissingHeadersDetection(req.url, headers, headersToInclude ?? []);\n }\n\n return of(\n new HttpResponse({\n body,\n headers,\n status,\n statusText,\n url,\n }),\n );\n }\n\n // Request not found in cache. Make the request and cache it if on the server.\n return next(req).pipe(\n tap((event: HttpEvent<unknown>) => {\n if (event instanceof HttpResponse && typeof ngServerMode !== 'undefined' && ngServerMode) {\n transferState.set<TransferHttpResponse>(storeKey, {\n [BODY]: event.body,\n [HEADERS]: getFilteredHeaders(event.headers, headersToInclude),\n [STATUS]: event.status,\n [STATUS_TEXT]: event.statusText,\n [REQ_URL]: requestUrl,\n [RESPONSE_TYPE]: req.responseType,\n });\n }\n }),\n );\n}\n\n/** @returns true when the requests contains autorization related headers. */\nfunction hasAuthHeaders(req: HttpRequest<unknown>): boolean {\n return req.headers.has('authorization') || req.headers.has('proxy-authorization');\n}\n\nfunction getFilteredHeaders(\n headers: HttpHeaders,\n includeHeaders: string[] | undefined,\n): Record<string, string[]> {\n if (!includeHeaders) {\n return {};\n }\n\n const headersMap: Record<string, string[]> = {};\n for (const key of includeHeaders) {\n const values = headers.getAll(key);\n if (values !== null) {\n headersMap[key] = values;\n }\n }\n\n return headersMap;\n}\n\nfunction sortAndConcatParams(params: HttpParams | URLSearchParams): string {\n return [...params.keys()]\n .sort()\n .map((k) => `${k}=${params.getAll(k)}`)\n .join('&');\n}\n\nfunction makeCacheKey(\n request: HttpRequest<any>,\n mappedRequestUrl: string,\n): StateKey<TransferHttpResponse> {\n // make the params encoded same as a url so it's easy to identify\n const {params, method, responseType} = request;\n const encodedParams = sortAndConcatParams(params);\n\n let serializedBody = request.serializeBody();\n if (serializedBody instanceof URLSearchParams) {\n serializedBody = sortAndConcatParams(serializedBody);\n } else if (typeof serializedBody !== 'string') {\n serializedBody = '';\n }\n\n const key = [method, responseType, mappedRequestUrl, serializedBody, encodedParams].join('|');\n const hash = generateHash(key);\n\n return makeStateKey(hash);\n}\n\n/**\n * A method that returns a hash representation of a string using a variant of DJB2 hash\n * algorithm.\n *\n * This is the same hashing logic that is used to generate component ids.\n */\nfunction generateHash(value: string): string {\n let hash = 0;\n\n for (const char of value) {\n hash = (Math.imul(31, hash) + char.charCodeAt(0)) << 0;\n }\n\n // Force positive number hash.\n // 2147483647 = equivalent of Integer.MAX_VALUE.\n hash += 2147483647 + 1;\n\n return hash.toString();\n}\n\n/**\n * Returns the DI providers needed to enable HTTP transfer cache.\n *\n * By default, when using server rendering, requests are performed twice: once on the server and\n * other one on the browser.\n *\n * When these providers are added, requests performed on the server are cached and reused during the\n * bootstrapping of the application in the browser thus avoiding duplicate requests and reducing\n * load time.\n *\n */\nexport function withHttpTransferCache(cacheOptions: HttpTransferCacheOptions): Provider[] {\n return [\n {\n provide: CACHE_OPTIONS,\n useFactory: (): CacheOptions => {\n performanceMarkFeature('NgHttpTransferCache');\n return {isCacheActive: true, ...cacheOptions};\n },\n },\n {\n provide: HTTP_ROOT_INTERCEPTOR_FNS,\n useValue: transferCacheInterceptorFn,\n multi: true,\n },\n {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: () => {\n const appRef = inject(ApplicationRef);\n const cacheState = inject(CACHE_OPTIONS);\n\n return () => {\n appRef.whenStable().then(() => {\n cacheState.isCacheActive = false;\n });\n };\n },\n },\n ];\n}\n\n/**\n * This function will add a proxy to an HttpHeader to intercept calls to get/has\n * and log a warning if the header entry requested has been removed\n */\nfunction appendMissingHeadersDetection(\n url: string,\n headers: HttpHeaders,\n headersToInclude: string[],\n): HttpHeaders {\n const warningProduced = new Set();\n return new Proxy<HttpHeaders>(headers, {\n get(target: HttpHeaders, prop: keyof HttpHeaders): unknown {\n const value = Reflect.get(target, prop);\n const methods: Set<keyof HttpHeaders> = new Set(['get', 'has', 'getAll']);\n\n if (typeof value !== 'function' || !methods.has(prop)) {\n return value;\n }\n\n return (headerName: string) => {\n // We log when the key has been removed and a warning hasn't been produced for the header\n const key = (prop + ':' + headerName).toLowerCase(); // e.g. `get:cache-control`\n if (!headersToInclude.includes(headerName) && !warningProduced.has(key)) {\n warningProduced.add(key);\n const truncatedUrl = truncateMiddle(url);\n\n // TODO: create Error guide for this warning\n console.warn(\n formatRuntimeError(\n RuntimeErrorCode.HEADERS_ALTERED_BY_TRANSFER_CACHE,\n `Angular detected that the \\`${headerName}\\` header is accessed, but the value of the header ` +\n `was not transferred from the server to the client by the HttpTransferCache. ` +\n `To include the value of the \\`${headerName}\\` header for the \\`${truncatedUrl}\\` request, ` +\n `use the \\`includeHeaders\\` list. The \\`includeHeaders\\` can be defined either ` +\n `on a request level by adding the \\`transferCache\\` parameter, or on an application ` +\n `level by adding the \\`httpCacheTransfer.includeHeaders\\` argument to the ` +\n `\\`provideClientHydration()\\` call. `,\n ),\n );\n }\n\n // invoking the original method\n return (value as Function).apply(target, [headerName]);\n };\n },\n });\n}\n\nfunction mapRequestOriginUrl(url: string, originMap: Record<string, string>): string {\n const origin = new URL(url, 'resolve://').origin;\n const mappedOrigin = originMap[origin];\n if (!mappedOrigin) {\n return url;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n verifyMappedOrigin(mappedOrigin);\n }\n\n return url.replace(origin, mappedOrigin);\n}\n\nfunction verifyMappedOrigin(url: string): void {\n if (new URL(url, 'resolve://').pathname !== '/') {\n throw new RuntimeError(\n RuntimeErrorCode.HTTP_ORIGIN_MAP_CONTAINS_PATH,\n 'Angular detected a URL with a path segment in the value provided for the ' +\n `\\`HTTP_TRANSFER_CACHE_ORIGIN_MAP\\` token: ${url}. The map should only contain origins ` +\n 'without any other segments.',\n );\n }\n}\n"],"names":["ResourceImpl","RuntimeError","performanceMarkFeature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