How to use the @firebase/component.Provider function in @firebase/component

To help you get started, we’ve selected a few @firebase/component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firebase / firebase-js-sdk / packages / database / index.node.ts View on Github external
export function initStandalone(app: FirebaseApp, url: string, version: string) {
  /**
   * 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: {

@firebase/component

Firebase Component Platform

Apache-2.0
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages