index.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*! firebase-admin v12.1.1 */
  2. "use strict";
  3. /*!
  4. * Copyright 2020 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.InstanceIdClientErrorCode = exports.FirebaseInstanceIdError = exports.getInstanceId = exports.InstanceId = void 0;
  20. /**
  21. * Firebase Instance ID service.
  22. *
  23. * @packageDocumentation
  24. */
  25. const index_1 = require("../app/index");
  26. const instance_id_1 = require("./instance-id");
  27. Object.defineProperty(exports, "InstanceId", { enumerable: true, get: function () { return instance_id_1.InstanceId; } });
  28. /**
  29. * Gets the {@link InstanceId} service for the default app or a given app.
  30. *
  31. * This API is deprecated. Developers are advised to use the
  32. * {@link firebase-admin.installations#getInstallations}
  33. * API to delete their instance IDs and Firebase installation IDs.
  34. *
  35. * `getInstanceId()` can be called with no arguments to access the default
  36. * app's `InstanceId` service or as `getInstanceId(app)` to access the
  37. * `InstanceId` service associated with a specific app.
  38. *
  39. * @example
  40. * ```javascript
  41. * // Get the Instance ID service for the default app
  42. * const defaultInstanceId = getInstanceId();
  43. * ```
  44. *
  45. * @example
  46. * ```javascript
  47. * // Get the Instance ID service for a given app
  48. * const otherInstanceId = getInstanceId(otherApp);
  49. *```
  50. *
  51. * This API is deprecated. Developers are advised to use the `admin.installations()`
  52. * API to delete their instance IDs and Firebase installation IDs.
  53. *
  54. * @param app - Optional app whose `InstanceId` service to
  55. * return. If not provided, the default `InstanceId` service will be
  56. * returned.
  57. *
  58. * @returns The default `InstanceId` service if
  59. * no app is provided or the `InstanceId` service associated with the
  60. * provided app.
  61. *
  62. * @deprecated Use {@link firebase-admin.installations#getInstallations} instead.
  63. */
  64. function getInstanceId(app) {
  65. if (typeof app === 'undefined') {
  66. app = (0, index_1.getApp)();
  67. }
  68. const firebaseApp = app;
  69. return firebaseApp.getOrInitService('instanceId', (app) => new instance_id_1.InstanceId(app));
  70. }
  71. exports.getInstanceId = getInstanceId;
  72. var error_1 = require("../utils/error");
  73. Object.defineProperty(exports, "FirebaseInstanceIdError", { enumerable: true, get: function () { return error_1.FirebaseInstanceIdError; } });
  74. Object.defineProperty(exports, "InstanceIdClientErrorCode", { enumerable: true, get: function () { return error_1.InstanceIdClientErrorCode; } });