How to use the @firebase/component.ComponentType.PRIVATE 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 / app / src / firebaseApp.ts View on Github external
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
      )
    );
    this._addComponent(
      new Component(
        'platform-identifier',
        // Adds a string identifying version header as belonging to JS SDK
        () => new VersionService('fire-js', ''),
        ComponentType.VERSION
      )
github firebase / firebase-js-sdk / packages / database / index.node.ts View on Github external
* 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,
      Database,
      DataSnapshot,
      enableLogging,
      INTERNAL,
      ServerValue,
      TEST_ACCESS
    }
  };
github firebase / firebase-js-sdk / packages / app / src / registerCoreComponents.ts View on Github external
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', '');
}
github firebase / firebase-js-sdk / packages / installations / src / testing / fake-generators.ts View on Github external
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')
  };
}

@firebase/component

Firebase Component Platform

Apache-2.0
Latest version published 14 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages