project-config-manager.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*! firebase-admin v12.1.1 */
  2. "use strict";
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.ProjectConfigManager = void 0;
  5. const project_config_1 = require("./project-config");
  6. const auth_api_request_1 = require("./auth-api-request");
  7. /**
  8. * Manages (gets and updates) the current project config.
  9. */
  10. class ProjectConfigManager {
  11. /**
  12. * Initializes a ProjectConfigManager instance for a specified FirebaseApp.
  13. *
  14. * @param app - The app for this ProjectConfigManager instance.
  15. *
  16. * @constructor
  17. * @internal
  18. */
  19. constructor(app) {
  20. this.authRequestHandler = new auth_api_request_1.AuthRequestHandler(app);
  21. }
  22. /**
  23. * Get the project configuration.
  24. *
  25. * @returns A promise fulfilled with the project configuration.
  26. */
  27. getProjectConfig() {
  28. return this.authRequestHandler.getProjectConfig()
  29. .then((response) => {
  30. return new project_config_1.ProjectConfig(response);
  31. });
  32. }
  33. /**
  34. * Updates an existing project configuration.
  35. *
  36. * @param projectConfigOptions - The properties to update on the project.
  37. *
  38. * @returns A promise fulfilled with the updated project config.
  39. */
  40. updateProjectConfig(projectConfigOptions) {
  41. return this.authRequestHandler.updateProjectConfig(projectConfigOptions)
  42. .then((response) => {
  43. return new project_config_1.ProjectConfig(response);
  44. });
  45. }
  46. }
  47. exports.ProjectConfigManager = ProjectConfigManager;