index.d.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * Copyright 2020 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /**
  18. * Cloud Firestore.
  19. *
  20. * @packageDocumentation
  21. */
  22. import { Firestore } from '@google-cloud/firestore';
  23. import { App } from '../app';
  24. import { FirestoreSettings } from './firestore-internal';
  25. export { AddPrefixToKeys, AggregateField, AggregateFieldType, AggregateQuery, AggregateQuerySnapshot, AggregateSpecData, AggregateSpec, AggregateType, BulkWriter, BulkWriterOptions, BundleBuilder, ChildUpdateFields, CollectionGroup, CollectionReference, DocumentChange, DocumentChangeType, DocumentData, DocumentReference, DocumentSnapshot, FieldPath, FieldValue, Filter, Firestore, FirestoreDataConverter, GeoPoint, GrpcStatus, NestedUpdateFields, OrderByDirection, PartialWithFieldValue, Precondition, Primitive, Query, QueryDocumentSnapshot, QueryPartition, QuerySnapshot, ReadOptions, ReadOnlyTransactionOptions, ReadWriteTransactionOptions, Settings, SetOptions, Timestamp, Transaction, UpdateData, UnionToIntersection, WhereFilterOp, WithFieldValue, WriteBatch, WriteResult, v1, setLogFunction, } from '@google-cloud/firestore';
  26. export { FirestoreSettings };
  27. /**
  28. * Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  29. * service for the default app.
  30. *
  31. * @example
  32. * ```javascript
  33. * // Get the default Firestore service for the default app
  34. * const defaultFirestore = getFirestore();
  35. * ```
  36. * @returns The default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  37. * service for the default app.
  38. */
  39. export declare function getFirestore(): Firestore;
  40. /**
  41. * Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  42. * service for the given app.
  43. *
  44. * @example
  45. * ```javascript
  46. * // Get the default Firestore service for a specific app
  47. * const otherFirestore = getFirestore(app);
  48. * ```
  49. *
  50. * @param app - which `Firestore` service to return.
  51. *
  52. * @returns The default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  53. * service associated with the provided app.
  54. */
  55. export declare function getFirestore(app: App): Firestore;
  56. /**
  57. * Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  58. * service for the default app.
  59. *
  60. * @example
  61. * ```javascript
  62. * // Get the Firestore service for a named database and default app
  63. * const otherFirestore = getFirestore('otherDb');
  64. * ```
  65. *
  66. * @param databaseId - name of database to return.
  67. *
  68. * @returns The named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  69. * service for the default app.
  70. * @beta
  71. */
  72. export declare function getFirestore(databaseId: string): Firestore;
  73. /**
  74. * Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  75. * service for the given app.
  76. *
  77. * @example
  78. * ```javascript
  79. * // Get the Firestore service for a named database and specific app.
  80. * const otherFirestore = getFirestore('otherDb');
  81. * ```
  82. *
  83. * @param app - which `Firestore` service to return.
  84. *
  85. * @param databaseId - name of database to return.
  86. *
  87. * @returns The named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  88. * service associated with the provided app.
  89. * @beta
  90. */
  91. export declare function getFirestore(app: App, databaseId: string): Firestore;
  92. /**
  93. * Gets the default {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  94. * service for the given app, passing extra parameters to its constructor.
  95. *
  96. * @example
  97. * ```javascript
  98. * // Get the Firestore service for a specific app, require HTTP/1.1 REST transport
  99. * const otherFirestore = initializeFirestore(app, {preferRest: true});
  100. * ```
  101. *
  102. * @param app - which `Firestore` service to return.
  103. *
  104. * @param settings - Settings object to be passed to the constructor.
  105. *
  106. * @returns The default `Firestore` service associated with the provided app and settings.
  107. */
  108. export declare function initializeFirestore(app: App, settings?: FirestoreSettings): Firestore;
  109. /**
  110. * Gets the named {@link https://googleapis.dev/nodejs/firestore/latest/Firestore.html | Firestore}
  111. * service for the given app, passing extra parameters to its constructor.
  112. *
  113. * @example
  114. * ```javascript
  115. * // Get the Firestore service for a specific app, require HTTP/1.1 REST transport
  116. * const otherFirestore = initializeFirestore(app, {preferRest: true}, 'otherDb');
  117. * ```
  118. *
  119. * @param app - which `Firestore` service to return.
  120. *
  121. * @param settings - Settings object to be passed to the constructor.
  122. *
  123. * @param databaseId - name of database to return.
  124. *
  125. * @returns The named `Firestore` service associated with the provided app and settings.
  126. * @beta
  127. */
  128. export declare function initializeFirestore(app: App, settings: FirestoreSettings, databaseId: string): Firestore;
  129. export { FirebaseFirestoreError } from '../utils/error';