Initial Commit

This commit is contained in:
2026-03-06 04:54:20 -04:00
commit 63677bfcf5
9332 changed files with 1507319 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
# @firebase/remote-compat
This is the compat package that recreates the v8 APIs.
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

View File

@@ -0,0 +1,117 @@
import firebase from '@firebase/app-compat';
import { Component } from '@firebase/component';
import { activate, ensureInitialized, fetchConfig, fetchAndActivate, getAll, getBoolean, getNumber, getString, getValue, setLogLevel, isSupported } from '@firebase/remote-config';
/**
* @license
* Copyright 2020 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.
*/
class RemoteConfigCompatImpl {
constructor(app, _delegate) {
this.app = app;
this._delegate = _delegate;
}
get defaultConfig() {
return this._delegate.defaultConfig;
}
set defaultConfig(value) {
this._delegate.defaultConfig = value;
}
get fetchTimeMillis() {
return this._delegate.fetchTimeMillis;
}
get lastFetchStatus() {
return this._delegate.lastFetchStatus;
}
get settings() {
return this._delegate.settings;
}
set settings(value) {
this._delegate.settings = value;
}
activate() {
return activate(this._delegate);
}
ensureInitialized() {
return ensureInitialized(this._delegate);
}
/**
* @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
* {@link Settings.fetchTimeoutInSeconds} or
* {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
*/
fetch() {
return fetchConfig(this._delegate);
}
fetchAndActivate() {
return fetchAndActivate(this._delegate);
}
getAll() {
return getAll(this._delegate);
}
getBoolean(key) {
return getBoolean(this._delegate, key);
}
getNumber(key) {
return getNumber(this._delegate, key);
}
getString(key) {
return getString(this._delegate, key);
}
getValue(key) {
return getValue(this._delegate, key);
}
// Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels
// to differentiate 2p and 3p use-cases.
setLogLevel(logLevel) {
setLogLevel(this._delegate, logLevel);
}
}
const name = "@firebase/remote-config-compat";
const version = "0.2.22";
/**
* @license
* Copyright 2020 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.
*/
function registerRemoteConfigCompat(firebaseInstance) {
firebaseInstance.INTERNAL.registerComponent(new Component('remoteConfig-compat', remoteConfigFactory, "PUBLIC" /* ComponentType.PUBLIC */)
.setMultipleInstances(true)
.setServiceProps({ isSupported }));
firebaseInstance.registerVersion(name, version);
}
function remoteConfigFactory(container, { instanceIdentifier: namespace }) {
const app = container.getProvider('app-compat').getImmediate();
// The following call will always succeed because rc `import {...} from '@firebase/remote-config'`
const remoteConfig = container.getProvider('remote-config').getImmediate({
identifier: namespace
});
return new RemoteConfigCompatImpl(app, remoteConfig);
}
registerRemoteConfigCompat(firebase);
//# sourceMappingURL=index.esm.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,27 @@
/**
* @license
* Copyright 2020 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 { RemoteConfig as RemoteConfigCompat } from '@firebase/remote-config-types';
declare module '@firebase/app-compat' {
interface FirebaseNamespace {
remoteConfig: {
(app?: FirebaseApp): RemoteConfigCompat;
};
}
interface FirebaseApp {
remoteConfig(): RemoteConfigCompat;
}
}

View File

@@ -0,0 +1,52 @@
/**
* @license
* Copyright 2020 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 { FirebaseApp, _FirebaseService } from '@firebase/app-compat';
import { Value as ValueCompat, FetchStatus as FetchSTatusCompat, Settings as SettingsCompat, LogLevel as RemoteConfigLogLevel, RemoteConfig as RemoteConfigCompat } from '@firebase/remote-config-types';
import { RemoteConfig, isSupported } from '@firebase/remote-config';
export { isSupported };
export declare class RemoteConfigCompatImpl implements RemoteConfigCompat, _FirebaseService {
app: FirebaseApp;
readonly _delegate: RemoteConfig;
constructor(app: FirebaseApp, _delegate: RemoteConfig);
get defaultConfig(): {
[key: string]: string | number | boolean;
};
set defaultConfig(value: {
[key: string]: string | number | boolean;
});
get fetchTimeMillis(): number;
get lastFetchStatus(): FetchSTatusCompat;
get settings(): SettingsCompat;
set settings(value: SettingsCompat);
activate(): Promise<boolean>;
ensureInitialized(): Promise<void>;
/**
* @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
* {@link Settings.fetchTimeoutInSeconds} or
* {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
*/
fetch(): Promise<void>;
fetchAndActivate(): Promise<boolean>;
getAll(): {
[key: string]: ValueCompat;
};
getBoolean(key: string): boolean;
getNumber(key: string): number;
getString(key: string): string;
getValue(key: string): ValueCompat;
setLogLevel(logLevel: RemoteConfigLogLevel): void;
}

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 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 '../test/setup';

View File

@@ -0,0 +1,17 @@
/**
* @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.
*/
export {};

View File

@@ -0,0 +1,20 @@
/**
* @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 { FirebaseApp } from '@firebase/app-compat';
import { RemoteConfig } from '@firebase/remote-config';
export declare function getFakeApp(): FirebaseApp;
export declare function getFakeModularRemoteConfig(): RemoteConfig;

View File

@@ -0,0 +1,123 @@
'use strict';
var firebase = require('@firebase/app-compat');
var component = require('@firebase/component');
var remoteConfig = require('@firebase/remote-config');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
/**
* @license
* Copyright 2020 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.
*/
class RemoteConfigCompatImpl {
constructor(app, _delegate) {
this.app = app;
this._delegate = _delegate;
}
get defaultConfig() {
return this._delegate.defaultConfig;
}
set defaultConfig(value) {
this._delegate.defaultConfig = value;
}
get fetchTimeMillis() {
return this._delegate.fetchTimeMillis;
}
get lastFetchStatus() {
return this._delegate.lastFetchStatus;
}
get settings() {
return this._delegate.settings;
}
set settings(value) {
this._delegate.settings = value;
}
activate() {
return remoteConfig.activate(this._delegate);
}
ensureInitialized() {
return remoteConfig.ensureInitialized(this._delegate);
}
/**
* @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
* {@link Settings.fetchTimeoutInSeconds} or
* {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
*/
fetch() {
return remoteConfig.fetchConfig(this._delegate);
}
fetchAndActivate() {
return remoteConfig.fetchAndActivate(this._delegate);
}
getAll() {
return remoteConfig.getAll(this._delegate);
}
getBoolean(key) {
return remoteConfig.getBoolean(this._delegate, key);
}
getNumber(key) {
return remoteConfig.getNumber(this._delegate, key);
}
getString(key) {
return remoteConfig.getString(this._delegate, key);
}
getValue(key) {
return remoteConfig.getValue(this._delegate, key);
}
// Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels
// to differentiate 2p and 3p use-cases.
setLogLevel(logLevel) {
remoteConfig.setLogLevel(this._delegate, logLevel);
}
}
const name = "@firebase/remote-config-compat";
const version = "0.2.22";
/**
* @license
* Copyright 2020 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.
*/
function registerRemoteConfigCompat(firebaseInstance) {
firebaseInstance.INTERNAL.registerComponent(new component.Component('remoteConfig-compat', remoteConfigFactory, "PUBLIC" /* ComponentType.PUBLIC */)
.setMultipleInstances(true)
.setServiceProps({ isSupported: remoteConfig.isSupported }));
firebaseInstance.registerVersion(name, version);
}
function remoteConfigFactory(container, { instanceIdentifier: namespace }) {
const app = container.getProvider('app-compat').getImmediate();
// The following call will always succeed because rc `import {...} from '@firebase/remote-config'`
const remoteConfig = container.getProvider('remote-config').getImmediate({
identifier: namespace
});
return new RemoteConfigCompatImpl(app, remoteConfig);
}
registerRemoteConfigCompat(firebase__default["default"]);
//# sourceMappingURL=index.cjs.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
/**
* @license
* Copyright 2020 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 { RemoteConfig as RemoteConfigCompat } from '@firebase/remote-config-types';
declare module '@firebase/app-compat' {
interface FirebaseNamespace {
remoteConfig: {
(app?: FirebaseApp): RemoteConfigCompat;
};
}
interface FirebaseApp {
remoteConfig(): RemoteConfigCompat;
}
}
import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
import { type Value, type RemoteConfigOptions, type RemoteConfig, type ConfigUpdateObserver, type Unsubscribe, type CustomSignals, type LogLevel } from "@firebase/remote-config";
declare module "@firebase/remote-config" {
function activate(remoteConfig: RemoteConfigCompat): Promise<boolean>;
function ensureInitialized(remoteConfig: RemoteConfigCompat): Promise<void>;
function fetchAndActivate(remoteConfig: RemoteConfigCompat): Promise<boolean>;
function fetchConfig(remoteConfig: RemoteConfigCompat): Promise<void>;
function getAll(remoteConfig: RemoteConfigCompat): Record<string, Value>;
function getBoolean(remoteConfig: RemoteConfigCompat, key: string): boolean;
function getNumber(remoteConfig: RemoteConfigCompat, key: string): number;
function getRemoteConfig(app?: FirebaseAppCompat, options?: RemoteConfigOptions): RemoteConfig;
function getString(remoteConfig: RemoteConfigCompat, key: string): string;
function getValue(remoteConfig: RemoteConfigCompat, key: string): Value;
function onConfigUpdate(remoteConfig: RemoteConfigCompat, observer: ConfigUpdateObserver): Unsubscribe;
function setCustomSignals(remoteConfig: RemoteConfigCompat, customSignals: CustomSignals): Promise<void>;
function setLogLevel(remoteConfig: RemoteConfigCompat, logLevel: LogLevel): void;
}

View File

@@ -0,0 +1,52 @@
/**
* @license
* Copyright 2020 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 { FirebaseApp, _FirebaseService } from '@firebase/app-compat';
import { Value as ValueCompat, FetchStatus as FetchSTatusCompat, Settings as SettingsCompat, LogLevel as RemoteConfigLogLevel, RemoteConfig as RemoteConfigCompat } from '@firebase/remote-config-types';
import { RemoteConfig, isSupported } from '@firebase/remote-config';
export { isSupported };
export declare class RemoteConfigCompatImpl implements RemoteConfigCompat, _FirebaseService {
app: FirebaseApp;
readonly _delegate: RemoteConfig;
constructor(app: FirebaseApp, _delegate: RemoteConfig);
get defaultConfig(): {
[key: string]: string | number | boolean;
};
set defaultConfig(value: {
[key: string]: string | number | boolean;
});
get fetchTimeMillis(): number;
get lastFetchStatus(): FetchSTatusCompat;
get settings(): SettingsCompat;
set settings(value: SettingsCompat);
activate(): Promise<boolean>;
ensureInitialized(): Promise<void>;
/**
* @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
* {@link Settings.fetchTimeoutInSeconds} or
* {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
*/
fetch(): Promise<void>;
fetchAndActivate(): Promise<boolean>;
getAll(): {
[key: string]: ValueCompat;
};
getBoolean(key: string): boolean;
getNumber(key: string): number;
getString(key: string): string;
getValue(key: string): ValueCompat;
setLogLevel(logLevel: RemoteConfigLogLevel): void;
}

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 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 '../test/setup';

View File

@@ -0,0 +1,17 @@
/**
* @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.
*/
export {};

View File

@@ -0,0 +1,20 @@
/**
* @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 { FirebaseApp } from '@firebase/app-compat';
import { RemoteConfig } from '@firebase/remote-config';
export declare function getFakeApp(): FirebaseApp;
export declare function getFakeModularRemoteConfig(): RemoteConfig;

View File

@@ -0,0 +1,70 @@
{
"name": "@firebase/remote-config-compat",
"version": "0.2.22",
"description": "The compatibility package of Remote Config",
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
"main": "dist/index.cjs.js",
"browser": "dist/esm/index.esm.js",
"module": "dist/esm/index.esm.js",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"require": "./dist/index.cjs.js",
"default": "./dist/esm/index.esm.js"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"scripts": {
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c",
"build:release": "yarn build && yarn add-compat-overloads",
"build:deps": "lerna run --scope @firebase/remote-config-compat --include-dependencies build",
"dev": "rollup -c -w",
"test": "run-p --npm-path npm lint test:all",
"test:all": "run-p --npm-path npm test:browser",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
"test:browser": "karma start",
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../remote-config/dist/remote-config-public.d.ts -o dist/src/index.d.ts -a -r RemoteConfig:RemoteConfigCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/remote-config"
},
"license": "Apache-2.0",
"peerDependencies": {
"@firebase/app-compat": "0.x"
},
"dependencies": {
"@firebase/remote-config": "0.8.1",
"@firebase/remote-config-types": "0.5.0",
"@firebase/util": "1.14.0",
"@firebase/logger": "0.5.0",
"@firebase/component": "0.7.1",
"tslib": "^2.1.0"
},
"devDependencies": {
"rollup": "2.79.2",
"@rollup/plugin-json": "6.1.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.36.0",
"typescript": "5.5.4",
"@firebase/app-compat": "0.5.9"
},
"repository": {
"directory": "packages/remote-config-compat",
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"typings": "dist/src/index.d.ts",
"nyc": {
"extension": [
".ts"
],
"reportDir": "./coverage/node"
}
}