index.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*! firebase-admin v12.1.1 */
  2. "use strict";
  3. /*!
  4. * Copyright 2021 Google Inc.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. Object.defineProperty(exports, "__esModule", { value: true });
  19. exports.InstallationsClientErrorCode = exports.FirebaseInstallationsError = exports.getInstallations = exports.Installations = void 0;
  20. /**
  21. * Firebase Instance ID service.
  22. *
  23. * @packageDocumentation
  24. */
  25. const index_1 = require("../app/index");
  26. const installations_1 = require("./installations");
  27. Object.defineProperty(exports, "Installations", { enumerable: true, get: function () { return installations_1.Installations; } });
  28. /**
  29. * Gets the {@link Installations} service for the default app or a given app.
  30. *
  31. * `getInstallations()` can be called with no arguments to access the default
  32. * app's `Installations` service or as `getInstallations(app)` to access the
  33. * `Installations` service associated with a specific app.
  34. *
  35. * @example
  36. * ```javascript
  37. * // Get the Installations service for the default app
  38. * const defaultInstallations = getInstallations();
  39. * ```
  40. *
  41. * @example
  42. * ```javascript
  43. * // Get the Installations service for a given app
  44. * const otherInstallations = getInstallations(otherApp);
  45. *```
  46. *
  47. * @param app - Optional app whose `Installations` service to
  48. * return. If not provided, the default `Installations` service will be
  49. * returned.
  50. *
  51. * @returns The default `Installations` service if
  52. * no app is provided or the `Installations` service associated with the
  53. * provided app.
  54. */
  55. function getInstallations(app) {
  56. if (typeof app === 'undefined') {
  57. app = (0, index_1.getApp)();
  58. }
  59. const firebaseApp = app;
  60. return firebaseApp.getOrInitService('installations', (app) => new installations_1.Installations(app));
  61. }
  62. exports.getInstallations = getInstallations;
  63. var error_1 = require("../utils/error");
  64. Object.defineProperty(exports, "FirebaseInstallationsError", { enumerable: true, get: function () { return error_1.FirebaseInstallationsError; } });
  65. Object.defineProperty(exports, "InstallationsClientErrorCode", { enumerable: true, get: function () { return error_1.InstallationsClientErrorCode; } });