index.js 2.2 KB

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