From 8eff962cab608341a6f2fedc640a0e32d96f26e2 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sun, 9 Nov 2025 11:15:19 +0800 Subject: pain --- .../dist/src/client/caching_client.d.ts | 46 +++++++ .../dist/src/client/eventEmitter.d.ts | 39 ++++++ .../dist/src/client/realtime_handler.d.ts | 141 +++++++++++++++++++++ .../src/client/remote_config_fetch_client.d.ts | 104 +++++++++++++++ .../remote-config/dist/src/client/rest_client.d.ts | 41 ++++++ .../dist/src/client/retrying_client.d.ts | 50 ++++++++ .../dist/src/client/visibility_monitor.d.ts | 23 ++++ 7 files changed, 444 insertions(+) create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/caching_client.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/eventEmitter.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/realtime_handler.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/remote_config_fetch_client.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/rest_client.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/retrying_client.d.ts create mode 100644 frontend-old/node_modules/@firebase/remote-config/dist/src/client/visibility_monitor.d.ts (limited to 'frontend-old/node_modules/@firebase/remote-config/dist/src/client') diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/caching_client.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/caching_client.d.ts new file mode 100644 index 0000000..c05bd5f --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/caching_client.d.ts @@ -0,0 +1,46 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { StorageCache } from '../storage/storage_cache'; +import { FetchResponse } from '../public_types'; +import { RemoteConfigFetchClient, FetchRequest } from './remote_config_fetch_client'; +import { Storage } from '../storage/storage'; +import { Logger } from '@firebase/logger'; +/** + * Implements the {@link RemoteConfigClient} abstraction with success response caching. + * + *

Comparable to the browser's Cache API for responses, but the Cache API requires a Service + * Worker, which requires HTTPS, which would significantly complicate SDK installation. Also, the + * Cache API doesn't support matching entries by time. + */ +export declare class CachingClient implements RemoteConfigFetchClient { + private readonly client; + private readonly storage; + private readonly storageCache; + private readonly logger; + constructor(client: RemoteConfigFetchClient, storage: Storage, storageCache: StorageCache, logger: Logger); + /** + * Returns true if the age of the cached fetched configs is less than or equal to + * {@link Settings#minimumFetchIntervalInSeconds}. + * + *

This is comparable to passing `headers = { 'Cache-Control': max-age }` to the + * native Fetch API. + * + *

Visible for testing. + */ + isCachedDataFresh(cacheMaxAgeMillis: number, lastSuccessfulFetchTimestampMillis: number | undefined): boolean; + fetch(request: FetchRequest): Promise; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/eventEmitter.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/eventEmitter.d.ts new file mode 100644 index 0000000..2f8b9cc --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/eventEmitter.d.ts @@ -0,0 +1,39 @@ +/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Base class to be used if you want to emit events. Call the constructor with + * the set of allowed event names. + */ +export declare abstract class EventEmitter { + private allowedEvents_; + private listeners_; + constructor(allowedEvents_: string[]); + /** + * To be overridden by derived classes in order to fire an initial event when + * somebody subscribes for data. + * + * @returns {Array.<*>} Array of parameters to trigger initial event with. + */ + abstract getInitialEvent(eventType: string): unknown[]; + /** + * To be called by derived classes to trigger events. + */ + protected trigger(eventType: string, ...varArgs: unknown[]): void; + on(eventType: string, callback: (a: unknown) => void, context: unknown): void; + off(eventType: string, callback: (a: unknown) => void, context: unknown): void; + private validateEventType_; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/realtime_handler.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/realtime_handler.d.ts new file mode 100644 index 0000000..3fa7c87 --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/realtime_handler.d.ts @@ -0,0 +1,141 @@ +/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +import { Logger } from '@firebase/logger'; +import { ConfigUpdateObserver } from '../public_types'; +import { Storage } from '../storage/storage'; +import { StorageCache } from '../storage/storage_cache'; +import { CachingClient } from './caching_client'; +export declare class RealtimeHandler { + private readonly firebaseInstallations; + private readonly storage; + private readonly sdkVersion; + private readonly namespace; + private readonly projectId; + private readonly apiKey; + private readonly appId; + private readonly logger; + private readonly storageCache; + private readonly cachingClient; + constructor(firebaseInstallations: _FirebaseInstallationsInternal, storage: Storage, sdkVersion: string, namespace: string, projectId: string, apiKey: string, appId: string, logger: Logger, storageCache: StorageCache, cachingClient: CachingClient); + private observers; + private isConnectionActive; + private isRealtimeDisabled; + private controller?; + private reader; + private httpRetriesRemaining; + private isInBackground; + private readonly decoder; + private isClosingConnection; + private setRetriesRemaining; + private propagateError; + /** + * Increment the number of failed stream attempts, increase the backoff duration, set the backoff + * end time to "backoff duration" after `lastFailedStreamTime` and persist the new + * values to storage metadata. + */ + private updateBackoffMetadataWithLastFailedStreamConnectionTime; + /** + * Increase the backoff duration with a new end time based on Retry Interval. + */ + private updateBackoffMetadataWithRetryInterval; + /** + * HTTP status code that the Realtime client should retry on. + */ + private isStatusCodeRetryable; + /** + * Closes the realtime HTTP connection. + * Note: This method is designed to be called only once at a time. + * If a call is already in progress, subsequent calls will be ignored. + */ + private closeRealtimeHttpConnection; + private resetRealtimeBackoff; + private resetRetryCount; + /** + * Assembles the request headers and body and executes the fetch request to + * establish the real-time streaming connection. This is the "worker" method + * that performs the actual network communication. + */ + private establishRealtimeConnection; + private getRealtimeUrl; + private createRealtimeConnection; + /** + * Retries HTTP stream connection asyncly in random time intervals. + */ + private retryHttpConnectionWhenBackoffEnds; + private setIsHttpConnectionRunning; + /** + * Combines the check and set operations to prevent multiple asynchronous + * calls from redundantly starting an HTTP connection. This ensures that + * only one attempt is made at a time. + */ + private checkAndSetHttpConnectionFlagIfNotRunning; + private fetchResponseIsUpToDate; + private parseAndValidateConfigUpdateMessage; + private isEventListenersEmpty; + private getRandomInt; + private executeAllListenerCallbacks; + /** + * Compares two configuration objects and returns a set of keys that have changed. + * A key is considered changed if it's new, removed, or has a different value. + */ + private getChangedParams; + private fetchLatestConfig; + private autoFetch; + /** + * Processes a stream of real-time messages for configuration updates. + * This method reassembles fragmented messages, validates and parses the JSON, + * and automatically fetches a new config if a newer template version is available. + * It also handles server-specified retry intervals and propagates errors for + * invalid messages or when real-time updates are disabled. + */ + private handleNotifications; + private listenForNotifications; + /** + * Open the real-time connection, begin listening for updates, and auto-fetch when an update is + * received. + * + * If the connection is successful, this method will block on its thread while it reads the + * chunk-encoded HTTP body. When the connection closes, it attempts to reestablish the stream. + */ + private prepareAndBeginRealtimeHttpStream; + /** + * Checks whether connection can be made or not based on some conditions + * @returns booelean + */ + private canEstablishStreamConnection; + private makeRealtimeHttpConnection; + private beginRealtime; + /** + * Adds an observer to the realtime updates. + * @param observer The observer to add. + */ + addObserver(observer: ConfigUpdateObserver): void; + /** + * Removes an observer from the realtime updates. + * @param observer The observer to remove. + */ + removeObserver(observer: ConfigUpdateObserver): void; + /** + * Handles changes to the application's visibility state, managing the real-time connection. + * + * When the application is moved to the background, this method closes the existing + * real-time connection to save resources. When the application returns to the + * foreground, it attempts to re-establish the connection. + */ + private onVisibilityChange; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/remote_config_fetch_client.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/remote_config_fetch_client.d.ts new file mode 100644 index 0000000..e72ce51 --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/remote_config_fetch_client.d.ts @@ -0,0 +1,104 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CustomSignals, FetchResponse, FetchType } from '../public_types'; +/** + * Defines a client, as in https://en.wikipedia.org/wiki/Client%E2%80%93server_model, for the + * Remote Config server (https://firebase.google.com/docs/reference/remote-config/rest). + * + *

Abstracts throttle, response cache and network implementation details. + * + *

Modeled after the native {@link GlobalFetch} interface, which is relatively modern and + * convenient, but simplified for Remote Config's use case. + * + * Disambiguation: {@link GlobalFetch} interface and the Remote Config service define "fetch" + * methods. The RestClient uses the former to make HTTP calls. This interface abstracts the latter. + */ +export interface RemoteConfigFetchClient { + /** + * @throws if response status is not 200 or 304. + */ + fetch(request: FetchRequest): Promise; +} +/** + * Shims a minimal AbortSignal. + * + *

AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects + * of networking, such as retries. Firebase doesn't use AbortController enough to justify a + * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be + * swapped out if/when we do. + */ +export declare class RemoteConfigAbortSignal { + listeners: Array<() => void>; + addEventListener(listener: () => void): void; + abort(): void; +} +/** + * Defines per-request inputs for the Remote Config fetch request. + * + *

Modeled after the native {@link Request} interface, but simplified for Remote Config's + * use case. + */ +export interface FetchRequest { + /** + * Uses cached config if it is younger than this age. + * + *

Required because it's defined by settings, which always have a value. + * + *

Comparable to passing `headers = { 'Cache-Control': max-age }` to the native + * Fetch API. + */ + cacheMaxAgeMillis: number; + /** + * An event bus for the signal to abort a request. + * + *

Required because all requests should be abortable. + * + *

Comparable to the native + * Fetch API's "signal" field on its request configuration object + * https://fetch.spec.whatwg.org/#dom-requestinit-signal. + * + *

Disambiguation: Remote Config commonly refers to API inputs as + * "signals". See the private ConfigFetchRequestBody interface for those: + * http://google3/firebase/remote_config/web/src/core/rest_client.ts?l=14&rcl=255515243. + */ + signal: RemoteConfigAbortSignal; + /** + * The ETag header value from the last response. + * + *

Optional in case this is the first request. + * + *

Comparable to passing `headers = { 'If-None-Match': }` to the native Fetch API. + */ + eTag?: string; + /** The custom signals stored for the app instance. + * + *

Optional in case no custom signals are set for the instance. + */ + customSignals?: CustomSignals; + /** + * The type of fetch to perform, such as a regular fetch or a real-time fetch. + * + * Optional as not all fetch requests need to be distinguished. + */ + fetchType?: FetchType; + /** + * The number of fetch attempts made so far for this request. + * + * Optional as not all fetch requests are part of a retry series. + */ + fetchAttempt?: number; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/rest_client.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/rest_client.d.ts new file mode 100644 index 0000000..24a3fe0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/rest_client.d.ts @@ -0,0 +1,41 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FetchResponse } from '../public_types'; +import { RemoteConfigFetchClient, FetchRequest } from './remote_config_fetch_client'; +import { _FirebaseInstallationsInternal } from '@firebase/installations'; +/** + * Implements the Client abstraction for the Remote Config REST API. + */ +export declare class RestClient implements RemoteConfigFetchClient { + private readonly firebaseInstallations; + private readonly sdkVersion; + private readonly namespace; + private readonly projectId; + private readonly apiKey; + private readonly appId; + constructor(firebaseInstallations: _FirebaseInstallationsInternal, sdkVersion: string, namespace: string, projectId: string, apiKey: string, appId: string); + /** + * Fetches from the Remote Config REST API. + * + * @throws a {@link ErrorCode.FETCH_NETWORK} error if {@link GlobalFetch#fetch} can't + * connect to the network. + * @throws a {@link ErrorCode.FETCH_PARSE} error if {@link Response#json} can't parse the + * fetch response. + * @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status. + */ + fetch(request: FetchRequest): Promise; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/retrying_client.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/retrying_client.d.ts new file mode 100644 index 0000000..06c7ff0 --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/retrying_client.d.ts @@ -0,0 +1,50 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { FetchResponse } from '../public_types'; +import { RemoteConfigAbortSignal, RemoteConfigFetchClient, FetchRequest } from './remote_config_fetch_client'; +import { ThrottleMetadata, Storage } from '../storage/storage'; +/** + * Supports waiting on a backoff by: + * + *

+ * + *

Visible for testing. + */ +export declare function setAbortableTimeout(signal: RemoteConfigAbortSignal, throttleEndTimeMillis: number): Promise; +/** + * Decorates a Client with retry logic. + * + *

Comparable to CachingClient, but uses backoff logic instead of cache max age and doesn't cache + * responses (because the SDK has no use for error responses). + */ +export declare class RetryingClient implements RemoteConfigFetchClient { + private readonly client; + private readonly storage; + constructor(client: RemoteConfigFetchClient, storage: Storage); + fetch(request: FetchRequest): Promise; + /** + * A recursive helper for attempting a fetch request repeatedly. + * + * @throws any non-retriable errors. + */ + attemptFetch(request: FetchRequest, { throttleEndTimeMillis, backoffCount }: ThrottleMetadata): Promise; +} diff --git a/frontend-old/node_modules/@firebase/remote-config/dist/src/client/visibility_monitor.d.ts b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/visibility_monitor.d.ts new file mode 100644 index 0000000..ef40083 --- /dev/null +++ b/frontend-old/node_modules/@firebase/remote-config/dist/src/client/visibility_monitor.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { EventEmitter } from './eventEmitter'; +export declare class VisibilityMonitor extends EventEmitter { + private visible_; + static getInstance(): VisibilityMonitor; + constructor(); + getInitialEvent(eventType: string): boolean[]; +} -- cgit v1.2.3