@firebase/firestore 3.8.4 → 3.9.0-20230314181055

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/firestore/src/lite-api/query.d.ts +11 -19
  3. package/dist/firestore/src/lite-api/reference.d.ts +1 -1
  4. package/dist/firestore/src/util/debug_uid.d.ts +28 -0
  5. package/dist/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  6. package/dist/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  7. package/dist/index.cjs.js +1359 -1309
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +66 -14
  10. package/dist/index.esm2017.js +1272 -1222
  11. package/dist/index.esm2017.js.map +1 -1
  12. package/dist/index.esm5.js +1335 -1259
  13. package/dist/index.esm5.js.map +1 -1
  14. package/dist/index.node.cjs.js +97 -32
  15. package/dist/index.node.cjs.js.map +1 -1
  16. package/dist/index.node.mjs +97 -32
  17. package/dist/index.node.mjs.map +1 -1
  18. package/dist/index.rn.js +1380 -1330
  19. package/dist/index.rn.js.map +1 -1
  20. package/dist/internal.d.ts +12 -20
  21. package/dist/lite/firestore/src/lite-api/query.d.ts +11 -19
  22. package/dist/lite/firestore/src/lite-api/reference.d.ts +1 -1
  23. package/dist/lite/firestore/src/util/debug_uid.d.ts +28 -0
  24. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  25. package/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  26. package/dist/lite/index.browser.esm2017.js +775 -730
  27. package/dist/lite/index.browser.esm2017.js.map +1 -1
  28. package/dist/lite/index.browser.esm5.js +736 -693
  29. package/dist/lite/index.browser.esm5.js.map +1 -1
  30. package/dist/lite/index.cjs.js +775 -730
  31. package/dist/lite/index.cjs.js.map +1 -1
  32. package/dist/lite/index.d.ts +66 -14
  33. package/dist/lite/index.node.cjs.js +76 -18
  34. package/dist/lite/index.node.cjs.js.map +1 -1
  35. package/dist/lite/index.node.mjs +76 -18
  36. package/dist/lite/index.node.mjs.map +1 -1
  37. package/dist/lite/index.rn.esm2017.js +777 -732
  38. package/dist/lite/index.rn.esm2017.js.map +1 -1
  39. package/dist/lite/internal.d.ts +12 -20
  40. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +139 -142
  41. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +11 -19
  42. package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +1 -1
  43. package/dist/lite/packages/firestore/src/util/debug_uid.d.ts +28 -0
  44. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  45. package/dist/lite/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  46. package/dist/lite/private.d.ts +72 -16
  47. package/dist/packages/firestore/dist/index.esm2017.d.ts +157 -160
  48. package/dist/packages/firestore/src/lite-api/query.d.ts +11 -19
  49. package/dist/packages/firestore/src/lite-api/reference.d.ts +1 -1
  50. package/dist/packages/firestore/src/util/debug_uid.d.ts +28 -0
  51. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +3 -0
  52. package/dist/packages/firestore/test/unit/specs/spec_test_components.d.ts +5 -1
  53. package/dist/private.d.ts +72 -16
  54. package/package.json +2 -2
@@ -6,7 +6,7 @@ import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken,
6
6
  import nodeFetch from 'node-fetch';
7
7
  import { randomBytes as randomBytes$1 } from 'crypto';
8
8
 
9
- const version$1 = "3.8.4";
9
+ const version$1 = "3.9.0-20230314181055";
10
10
 
11
11
  /**
12
12
  * @license
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
59
59
  User.FIRST_PARTY = new User('first-party-uid');
60
60
  User.MOCK_USER = new User('mock-user');
61
61
 
62
- const version = "9.17.2";
62
+ const version = "9.18.0-20230314181055";
63
63
 
64
64
  /**
65
65
  * @license
@@ -1177,6 +1177,66 @@ function validatePositiveNumber(functionName, n) {
1177
1177
  }
1178
1178
  }
1179
1179
 
1180
+ /**
1181
+ * @license
1182
+ * Copyright 2023 Google LLC
1183
+ *
1184
+ * Licensed under the Apache License, Version 2.0 (the "License");
1185
+ * you may not use this file except in compliance with the License.
1186
+ * You may obtain a copy of the License at
1187
+ *
1188
+ * http://www.apache.org/licenses/LICENSE-2.0
1189
+ *
1190
+ * Unless required by applicable law or agreed to in writing, software
1191
+ * distributed under the License is distributed on an "AS IS" BASIS,
1192
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1193
+ * See the License for the specific language governing permissions and
1194
+ * limitations under the License.
1195
+ */
1196
+ /**
1197
+ * The value returned from the most recent invocation of
1198
+ * `generateUniqueDebugId()`, or null if it has never been invoked.
1199
+ */
1200
+ let lastUniqueDebugId = null;
1201
+ /**
1202
+ * Generates and returns an initial value for `lastUniqueDebugId`.
1203
+ *
1204
+ * The returned value is randomly selected from a range of integers that are
1205
+ * represented as 8 hexadecimal digits. This means that (within reason) any
1206
+ * numbers generated by incrementing the returned number by 1 will also be
1207
+ * represented by 8 hexadecimal digits. This leads to all "IDs" having the same
1208
+ * length when converted to a hexadecimal string, making reading logs containing
1209
+ * these IDs easier to follow. And since the return value is randomly selected
1210
+ * it will help to differentiate between logs from different executions.
1211
+ */
1212
+ function generateInitialUniqueDebugId() {
1213
+ const minResult = 0x10000000;
1214
+ const maxResult = 0x90000000;
1215
+ const resultRange = maxResult - minResult;
1216
+ const resultOffset = Math.round(resultRange * Math.random());
1217
+ return minResult + resultOffset;
1218
+ }
1219
+ /**
1220
+ * Generates and returns a unique ID as a hexadecimal string.
1221
+ *
1222
+ * The returned ID is intended to be used in debug logging messages to help
1223
+ * correlate log messages that may be spatially separated in the logs, but
1224
+ * logically related. For example, a network connection could include the same
1225
+ * "debug ID" string in all of its log messages to help trace a specific
1226
+ * connection over time.
1227
+ *
1228
+ * @return the 10-character generated ID (e.g. "0xa1b2c3d4").
1229
+ */
1230
+ function generateUniqueDebugId() {
1231
+ if (lastUniqueDebugId === null) {
1232
+ lastUniqueDebugId = generateInitialUniqueDebugId();
1233
+ }
1234
+ else {
1235
+ lastUniqueDebugId++;
1236
+ }
1237
+ return '0x' + lastUniqueDebugId.toString(16);
1238
+ }
1239
+
1180
1240
  /**
1181
1241
  * @license
1182
1242
  * Copyright 2020 Google LLC
@@ -1233,15 +1293,16 @@ class RestConnection {
1233
1293
  return false;
1234
1294
  }
1235
1295
  invokeRPC(rpcName, path, req, authToken, appCheckToken) {
1296
+ const streamId = generateUniqueDebugId();
1236
1297
  const url = this.makeUrl(rpcName, path);
1237
- logDebug(LOG_TAG$3, 'Sending: ', url, req);
1298
+ logDebug(LOG_TAG$3, `Sending RPC '${rpcName}' ${streamId}:`, url, req);
1238
1299
  const headers = {};
1239
1300
  this.modifyHeadersForRequest(headers, authToken, appCheckToken);
1240
1301
  return this.performRPCRequest(rpcName, url, headers, req).then(response => {
1241
- logDebug(LOG_TAG$3, 'Received: ', response);
1302
+ logDebug(LOG_TAG$3, `Received RPC '${rpcName}' ${streamId}: `, response);
1242
1303
  return response;
1243
1304
  }, (err) => {
1244
- logWarn(LOG_TAG$3, `${rpcName} failed with error: `, err, 'url: ', url, 'request:', req);
1305
+ logWarn(LOG_TAG$3, `RPC '${rpcName}' ${streamId} failed with error: `, err, 'url: ', url, 'request:', req);
1245
1306
  throw err;
1246
1307
  });
1247
1308
  }
@@ -5871,7 +5932,7 @@ class Query {
5871
5932
  }
5872
5933
  /**
5873
5934
  * A `CollectionReference` object can be used for adding documents, getting
5874
- * document references, and querying for documents (using {@link query}).
5935
+ * document references, and querying for documents (using {@link (query:1)}).
5875
5936
  */
5876
5937
  class CollectionReference extends Query {
5877
5938
  /** @hideconstructor */
@@ -7154,9 +7215,9 @@ class AppliableConstraint {
7154
7215
  /**
7155
7216
  * A `QueryConstraint` is used to narrow the set of documents returned by a
7156
7217
  * Firestore query. `QueryConstraint`s are created by invoking {@link where},
7157
- * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
7158
- * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
7159
- * can then be passed to {@link query} to create a new query instance that
7218
+ * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
7219
+ * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
7220
+ * can then be passed to {@link (query:1)} to create a new query instance that
7160
7221
  * also contains this `QueryConstraint`.
7161
7222
  */
7162
7223
  class QueryConstraint extends AppliableConstraint {
@@ -7177,7 +7238,7 @@ function query(query, queryConstraint, ...additionalQueryConstraints) {
7177
7238
  * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
7178
7239
  * a Firestore query by filtering on one or more document fields.
7179
7240
  * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
7180
- * be passed to {@link query} to create a new query instance that also contains
7241
+ * be passed to {@link (query:1)} to create a new query instance that also contains
7181
7242
  * this `QueryFieldFilterConstraint`.
7182
7243
  */
7183
7244
  class QueryFieldFilterConstraint extends QueryConstraint {
@@ -7227,9 +7288,8 @@ function where(fieldPath, opStr, value) {
7227
7288
  * returned by a Firestore query by performing the logical OR or AND of multiple
7228
7289
  * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
7229
7290
  * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
7230
- * {@link and} and can then be passed to {@link query} to create a new query
7291
+ * {@link and} and can then be passed to {@link (query:1)} to create a new query
7231
7292
  * instance that also contains the `QueryCompositeFilterConstraint`.
7232
- * @internal TODO remove this internal tag with OR Query support in the server
7233
7293
  */
7234
7294
  class QueryCompositeFilterConstraint extends AppliableConstraint {
7235
7295
  /**
@@ -7282,7 +7342,6 @@ class QueryCompositeFilterConstraint extends AppliableConstraint {
7282
7342
  * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
7283
7343
  * created with calls to {@link where}, {@link or}, or {@link and}.
7284
7344
  * @returns The newly created {@link QueryCompositeFilterConstraint}.
7285
- * @internal TODO remove this internal tag with OR Query support in the server
7286
7345
  */
7287
7346
  function or(...queryConstraints) {
7288
7347
  // Only support QueryFilterConstraints
@@ -7298,7 +7357,6 @@ function or(...queryConstraints) {
7298
7357
  * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
7299
7358
  * created with calls to {@link where}, {@link or}, or {@link and}.
7300
7359
  * @returns The newly created {@link QueryCompositeFilterConstraint}.
7301
- * @internal TODO remove this internal tag with OR Query support in the server
7302
7360
  */
7303
7361
  function and(...queryConstraints) {
7304
7362
  // Only support QueryFilterConstraints
@@ -7308,7 +7366,7 @@ function and(...queryConstraints) {
7308
7366
  /**
7309
7367
  * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
7310
7368
  * Firestore query. `QueryOrderByConstraint`s are created by invoking
7311
- * {@link orderBy} and can then be passed to {@link query} to create a new query
7369
+ * {@link orderBy} and can then be passed to {@link (query:1)} to create a new query
7312
7370
  * instance that also contains this `QueryOrderByConstraint`.
7313
7371
  *
7314
7372
  * Note: Documents that do not contain the orderBy field will not be present in
@@ -7354,7 +7412,7 @@ function orderBy(fieldPath, directionStr = 'asc') {
7354
7412
  * A `QueryLimitConstraint` is used to limit the number of documents returned by
7355
7413
  * a Firestore query.
7356
7414
  * `QueryLimitConstraint`s are created by invoking {@link limit} or
7357
- * {@link limitToLast} and can then be passed to {@link query} to create a new
7415
+ * {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
7358
7416
  * query instance that also contains this `QueryLimitConstraint`.
7359
7417
  */
7360
7418
  class QueryLimitConstraint extends QueryConstraint {
@@ -7405,7 +7463,7 @@ function limitToLast(limit) {
7405
7463
  * A `QueryStartAtConstraint` is used to exclude documents from the start of a
7406
7464
  * result set returned by a Firestore query.
7407
7465
  * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
7408
- * {@link (startAfter:1)} and can then be passed to {@link query} to create a
7466
+ * {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
7409
7467
  * new query instance that also contains this `QueryStartAtConstraint`.
7410
7468
  */
7411
7469
  class QueryStartAtConstraint extends QueryConstraint {
@@ -7440,7 +7498,7 @@ function startAfter(...docOrFields) {
7440
7498
  * A `QueryEndAtConstraint` is used to exclude documents from the end of a
7441
7499
  * result set returned by a Firestore query.
7442
7500
  * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
7443
- * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
7501
+ * {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
7444
7502
  * query instance that also contains this `QueryEndAtConstraint`.
7445
7503
  */
7446
7504
  class QueryEndAtConstraint extends QueryConstraint {