index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.getMachineLearning = exports.Model = exports.MachineLearning = void 0;
  20. /**
  21. * Firebase Machine Learning.
  22. *
  23. * @packageDocumentation
  24. */
  25. const app_1 = require("../app");
  26. const machine_learning_1 = require("./machine-learning");
  27. var machine_learning_2 = require("./machine-learning");
  28. Object.defineProperty(exports, "MachineLearning", { enumerable: true, get: function () { return machine_learning_2.MachineLearning; } });
  29. Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return machine_learning_2.Model; } });
  30. /**
  31. * Gets the {@link MachineLearning} service for the default app or a given app.
  32. *
  33. * `getMachineLearning()` can be called with no arguments to access the
  34. * default app's `MachineLearning` service or as `getMachineLearning(app)` to access
  35. * the `MachineLearning` service associated with a specific app.
  36. *
  37. * @example
  38. * ```javascript
  39. * // Get the MachineLearning service for the default app
  40. * const defaultMachineLearning = getMachineLearning();
  41. * ```
  42. *
  43. * @example
  44. * ```javascript
  45. * // Get the MachineLearning service for a given app
  46. * const otherMachineLearning = getMachineLearning(otherApp);
  47. * ```
  48. *
  49. * @param app - Optional app whose `MachineLearning` service to
  50. * return. If not provided, the default `MachineLearning` service
  51. * will be returned.
  52. *
  53. * @returns The default `MachineLearning` service if no app is provided or the
  54. * `MachineLearning` service associated with the provided app.
  55. */
  56. function getMachineLearning(app) {
  57. if (typeof app === 'undefined') {
  58. app = (0, app_1.getApp)();
  59. }
  60. const firebaseApp = app;
  61. return firebaseApp.getOrInitService('machineLearning', (app) => new machine_learning_1.MachineLearning(app));
  62. }
  63. exports.getMachineLearning = getMachineLearning;