Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.container = new ComponentContainer(config.name);
// add itself to container
this._addComponent(new Component('app', () => this, "PUBLIC" /* PUBLIC */));
// populate ComponentContainer with existing components
for (const component of this.firebase_.INTERNAL.components.values()) {
this._addComponent(component);
}
}
get automaticDataCollectionEnabled() {
function FirebaseAppImpl(options, config, firebase_) {
var e_1, _a;
var _this = this;
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.container = new ComponentContainer(config.name);
// add itself to container
this._addComponent(new Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
try {
// populate ComponentContainer with existing components
for (var _b = __values(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component = _c.value;
this._addComponent(component);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
function FirebaseAppImpl(options, config, firebase_) {
var e_1, _a;
var _this = this;
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = util.deepCopy(options);
this.container = new component.ComponentContainer(config.name);
// add itself to container
this._addComponent(new component.Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
try {
// populate ComponentContainer with existing components
for (var _b = tslib.__values(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component$1 = _c.value;
this._addComponent(component$1);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
function FirebaseAppImpl(options, config, firebase_) {
var e_1, _a;
var _this = this;
this.firebase_ = firebase_;
this.isDeleted_ = false;
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = util.deepCopy(options);
this.container = new component.ComponentContainer(config.name);
// add itself to container
this._addComponent(new component.Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
try {
// populate ComponentContainer with existing components
for (var _b = tslib.__values(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component$1 = _c.value;
this._addComponent(component$1);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
/**
* This should allow the firebase-admin package to provide a custom version
* to the backend
*/
CONSTANTS.NODE_ADMIN = true;
setSDKVersion(version);
/**
* Create a 'auth-internal' component using firebase-admin-node's implementation
* that implements FirebaseAuthInternal.
* ComponentContainer('database-admin') is just a placeholder that doesn't perform
* any actual function.
*/
const authProvider = new Provider(
'auth-internal',
new ComponentContainer('database-admin')
);
authProvider.setComponent(
new Component(
'auth-internal',
// firebase-admin-node's app.INTERNAL implements FirebaseAuthInternal interface
// eslint-disable-next-line @typescript-eslint/no-explicit-any
() => (app as any).INTERNAL,
ComponentType.PRIVATE
)
);
return {
instance: RepoManager.getInstance().databaseFromApp(app, authProvider, url),
namespace: {
Reference,
Query,
constructor(options, config, firebase_) {
this.firebase_ = firebase_;
this.isDeleted_ = false;
// lite version has an empty INTERNAL namespace
this.INTERNAL = {};
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.container = new ComponentContainer(config.name);
// add itself to container
this.container.addComponent(new Component('app', () => this, "PUBLIC" /* PUBLIC */));
// populate ComponentContainer with existing components
for (const component of this.firebase_.INTERNAL.components.values()) {
this.container.addComponent(component);
}
}
get automaticDataCollectionEnabled() {
function FirebaseAppLiteImpl(options, config, firebase_) {
var e_1, _a;
var _this = this;
this.firebase_ = firebase_;
this.isDeleted_ = false;
// lite version has an empty INTERNAL namespace
this.INTERNAL = {};
this.name_ = config.name;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.container = new ComponentContainer(config.name);
// add itself to container
this.container.addComponent(new Component('app', function () { return _this; }, "PUBLIC" /* PUBLIC */));
try {
// populate ComponentContainer with existing components
for (var _b = __values(this.firebase_.INTERNAL.components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
var component = _c.value;
this.container.addComponent(component);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
constructor(
options: FirebaseOptions,
config: FirebaseAppConfig,
private readonly firebase_: _FirebaseNamespace
) {
this.name_ = config.name!;
this.automaticDataCollectionEnabled_ =
config.automaticDataCollectionEnabled || false;
this.options_ = deepCopy(options);
this.container = new ComponentContainer(config.name!);
// add itself to container
this._addComponent(new Component('app', () => this, ComponentType.PUBLIC));
this._addComponent(
new Component(
'platform-logger',
container => new PlatformLoggerService(container),
ComponentType.PRIVATE
)
);
this._addComponent(
new Component(
'app-version',
() => new VersionService('app', version),
ComponentType.VERSION
)
export function getFakeDependencies(): FirebaseDependencies {
const container = new ComponentContainer('test');
container.addComponent(
new Component(
'platform-logger',
() => ({ getPlatformInfoString: () => 'a/1.2.3 b/2.3.4' }),
ComponentType.PRIVATE
)
);
return {
appConfig: getFakeAppConfig(),
platformLoggerProvider: container.getProvider('platform-logger')
};
}
automaticDataCollectionEnabled: false,
...rawConfig
};
const name = config.name;
if (typeof name !== 'string' || !name) {
throw ERROR_FACTORY.create(AppError.BAD_APP_NAME, {
appName: String(name)
});
}
if (apps.has(name)) {
throw ERROR_FACTORY.create(AppError.DUPLICATE_APP, { appName: name });
}
const container = new ComponentContainer(name);
for (const component of components.values()) {
container.addComponent(component);
}
const newApp = new FirebaseAppImplNext(options, config, container);
apps.set(name, newApp);
return newApp;
}