firestore-internal.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * @license
  4. * Copyright 2017 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. import { Firestore, Settings } from '@google-cloud/firestore';
  19. import { App } from '../app';
  20. /**
  21. * Settings to pass to the Firestore constructor.
  22. *
  23. * @public
  24. */
  25. export interface FirestoreSettings {
  26. /**
  27. * Use HTTP/1.1 REST transport where possible.
  28. *
  29. * `preferRest` will force the use of HTTP/1.1 REST transport until a method
  30. * that requires gRPC is called. When a method requires gRPC, this Firestore
  31. * client will load dependent gRPC libraries and then use gRPC transport for
  32. * all communication from that point forward. Currently the only operation
  33. * that requires gRPC is creating a snapshot listener using `onSnapshot()`.
  34. *
  35. * @defaultValue `undefined`
  36. */
  37. preferRest?: boolean;
  38. }
  39. export declare class FirestoreService {
  40. private readonly appInternal;
  41. private readonly databases;
  42. private readonly firestoreSettings;
  43. constructor(app: App);
  44. initializeDatabase(databaseId: string, settings: FirestoreSettings): Firestore;
  45. getDatabase(databaseId: string): Firestore;
  46. private checkIfSameSettings;
  47. /**
  48. * Returns the app associated with this Storage instance.
  49. *
  50. * @returns The app associated with this Storage instance.
  51. */
  52. get app(): App;
  53. }
  54. export declare function getFirestoreOptions(app: App, firestoreSettings?: FirestoreSettings): Settings;