Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function registerInstallations(instance) {
const installationsName = 'installations';
instance.INTERNAL.registerComponent(new Component(installationsName, container => {
const app = container.getProvider('app').getImmediate();
// Throws if app isn't configured properly.
extractAppConfig(app);
return {
app,
getId: () => getId(app),
getToken: (forceRefresh) => getToken(app, forceRefresh),
delete: () => deleteInstallation$1(app)
};
}, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);
function registerInstallations(instance) {
var installationsName = 'installations';
instance.INTERNAL.registerComponent(new Component(installationsName, function (container) {
var app = container.getProvider('app').getImmediate();
// Throws if app isn't configured properly.
extractAppConfig(app);
return {
app: app,
getId: function () { return getId(app); },
getToken: function (forceRefresh) { return getToken(app, forceRefresh); },
delete: function () { return deleteInstallation$1(app); }
};
}, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);
function registerAnalytics(instance) {
instance.INTERNAL.registerComponent(new Component(ANALYTICS_TYPE, function (container) {
// getImmediate for FirebaseApp will always succeed
var app = container.getProvider('app').getImmediate();
var installations = container
.getProvider('installations')
.getImmediate();
return factory(app, installations);
}, "PUBLIC" /* PUBLIC */).setServiceProps({
settings: settings,
EventName: EventName
}));
instance.INTERNAL.registerComponent(new Component('analytics-internal', internalFactory, "PRIVATE" /* PRIVATE */));
function internalFactory(container) {
try {
var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();
return {
logEvent: analytics.logEvent
};
}
catch (e) {
throw ERROR_FACTORY.create("interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */, {
reason: e
});
}
}
}
registerAnalytics(firebase);
function registerFunctions(instance) {
var namespaceExports = {
// no-inline
Functions: Service
};
instance.INTERNAL.registerComponent(new Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* PUBLIC */)
.setServiceProps(namespaceExports)
.setMultipleInstances(true));
}
export function registerStorage(instance: _FirebaseNamespace): void {
const namespaceExports = {
// no-inline
TaskState,
TaskEvent,
StringFormat,
Storage: Service,
Reference
};
instance.INTERNAL.registerComponent(
new Component(STORAGE_TYPE, factory, ComponentType.PUBLIC)
.setServiceProps(namespaceExports)
.setMultipleInstances(true)
);
instance.registerVersion(name, version);
}
export function registerRemoteConfig(
firebaseInstance: _FirebaseNamespace
): void {
firebaseInstance.INTERNAL.registerComponent(
new Component(
'remoteConfig',
remoteConfigFactory,
ComponentType.PUBLIC
).setMultipleInstances(true)
);
firebaseInstance.registerVersion(packageName, version);
function remoteConfigFactory(
container: ComponentContainer,
namespace?: string
): RemoteConfig {
/* Dependencies */
// getImmediate for FirebaseApp will always succeed
const app = container.getProvider('app').getImmediate();
// The following call will always succeed because rc has `import '@firebase/installations'`
function registerStorage(instance) {
var namespaceExports = {
// no-inline
TaskState: TaskState,
TaskEvent: TaskEvent,
StringFormat: StringFormat,
Storage: Service,
Reference: Reference
};
instance.INTERNAL.registerComponent(new Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */)
.setServiceProps(namespaceExports)
.setMultipleInstances(true));
}
registerStorage(firebase);
function registerRemoteConfig(firebaseInstance) {
firebaseInstance.INTERNAL.registerComponent(new Component('remoteConfig', remoteConfigFactory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
function remoteConfigFactory(container, namespace) {
/* Dependencies */
// getImmediate for FirebaseApp will always succeed
var app = container.getProvider('app').getImmediate();
// The following call will always succeed because rc has `import '@firebase/installations'`
var installations = container.getProvider('installations').getImmediate();
// Guards against the SDK being used in non-browser environments.
if (typeof window === 'undefined') {
throw ERROR_FACTORY.create("registration-window" /* REGISTRATION_WINDOW */);
}
// Normalizes optional inputs.
var _a = app.options, projectId = _a.projectId, apiKey = _a.apiKey, appId = _a.appId;
if (!projectId) {
throw ERROR_FACTORY.create("registration-project-id" /* REGISTRATION_PROJECT_ID */);
}
if (!apiKey) {
export function registerCoreComponents(
firebase: FirebaseNamespace,
variant?: string
): void {
(firebase as _FirebaseNamespace).INTERNAL.registerComponent(
new Component(
'platform-logger',
container => new PlatformLoggerService(container),
ComponentType.PRIVATE
)
);
// Register `app` package.
firebase.registerVersion(name, version, variant);
// Register platform SDK identifier (no version).
firebase.registerVersion('fire-js', '');
}
function registerInstallations(instance) {
var installationsName = 'installations';
instance.INTERNAL.registerComponent(new component.Component(installationsName, function (container) {
var app = container.getProvider('app').getImmediate();
// Throws if app isn't configured properly.
extractAppConfig(app);
return {
app: app,
getId: function () { return getId(app); },
getToken: function (forceRefresh) { return getToken(app, forceRefresh); },
delete: function () { return deleteInstallation$1(app); }
};
}, "PUBLIC" /* PUBLIC */));
}
registerInstallations(firebase);