@firebase/firestore 3.11.0 → 3.12.0-20230511201449

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 (61) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/firestore/src/api/long_polling_options.d.ts +55 -0
  3. package/dist/firestore/src/api/settings.d.ts +16 -2
  4. package/dist/firestore/src/api.d.ts +1 -0
  5. package/dist/firestore/src/core/database_info.d.ts +4 -1
  6. package/dist/firestore/src/lite-api/settings.d.ts +3 -0
  7. package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
  8. package/dist/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
  9. package/dist/index.cjs.js +1222 -1181
  10. package/dist/index.cjs.js.map +1 -1
  11. package/dist/index.d.ts +61 -2
  12. package/dist/index.esm2017.js +1137 -1096
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +1041 -1021
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +71 -6
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +71 -6
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +868 -827
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +67 -3
  23. package/dist/lite/firestore/src/api/long_polling_options.d.ts +55 -0
  24. package/dist/lite/firestore/src/api/settings.d.ts +16 -2
  25. package/dist/lite/firestore/src/api.d.ts +1 -0
  26. package/dist/lite/firestore/src/core/database_info.d.ts +4 -1
  27. package/dist/lite/firestore/src/lite-api/settings.d.ts +3 -0
  28. package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
  29. package/dist/lite/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
  30. package/dist/lite/index.browser.esm2017.js +756 -716
  31. package/dist/lite/index.browser.esm2017.js.map +1 -1
  32. package/dist/lite/index.browser.esm5.js +764 -745
  33. package/dist/lite/index.browser.esm5.js.map +1 -1
  34. package/dist/lite/index.cjs.js +756 -716
  35. package/dist/lite/index.cjs.js.map +1 -1
  36. package/dist/lite/index.node.cjs.js +71 -6
  37. package/dist/lite/index.node.cjs.js.map +1 -1
  38. package/dist/lite/index.node.mjs +71 -6
  39. package/dist/lite/index.node.mjs.map +1 -1
  40. package/dist/lite/index.rn.esm2017.js +763 -723
  41. package/dist/lite/index.rn.esm2017.js.map +1 -1
  42. package/dist/lite/internal.d.ts +52 -1
  43. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +127 -144
  44. package/dist/lite/packages/firestore/src/api/long_polling_options.d.ts +55 -0
  45. package/dist/lite/packages/firestore/src/api/settings.d.ts +16 -2
  46. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  47. package/dist/lite/packages/firestore/src/core/database_info.d.ts +4 -1
  48. package/dist/lite/packages/firestore/src/lite-api/settings.d.ts +3 -0
  49. package/dist/lite/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
  50. package/dist/lite/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
  51. package/dist/lite/private.d.ts +52 -1
  52. package/dist/packages/firestore/dist/index.esm2017.d.ts +275 -292
  53. package/dist/packages/firestore/src/api/long_polling_options.d.ts +55 -0
  54. package/dist/packages/firestore/src/api/settings.d.ts +16 -2
  55. package/dist/packages/firestore/src/api.d.ts +1 -0
  56. package/dist/packages/firestore/src/core/database_info.d.ts +4 -1
  57. package/dist/packages/firestore/src/lite-api/settings.d.ts +3 -0
  58. package/dist/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -0
  59. package/dist/packages/firestore/test/unit/api/long_polling_options.test.d.ts +17 -0
  60. package/dist/private.d.ts +67 -3
  61. package/package.json +5 -5
@@ -34,7 +34,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
34
34
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
35
35
 
36
36
  const name = "@firebase/firestore";
37
- const version$1 = "3.11.0";
37
+ const version$1 = "3.12.0-20230511201449";
38
38
 
39
39
  /**
40
40
  * @license
@@ -87,7 +87,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
87
87
  User.FIRST_PARTY = new User('first-party-uid');
88
88
  User.MOCK_USER = new User('mock-user');
89
89
 
90
- const version = "9.21.0";
90
+ const version = "9.22.0-20230511201449";
91
91
 
92
92
  /**
93
93
  * @license
@@ -4348,10 +4348,11 @@ class DatabaseInfo {
4348
4348
  * when using WebChannel as the network transport.
4349
4349
  * @param autoDetectLongPolling - Whether to use the detectBufferingProxy
4350
4350
  * option when using WebChannel as the network transport.
4351
+ * @param longPollingOptions Options that configure long-polling.
4351
4352
  * @param useFetchStreams Whether to use the Fetch API instead of
4352
4353
  * XMLHTTPRequest
4353
4354
  */
4354
- constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
4355
+ constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, longPollingOptions, useFetchStreams) {
4355
4356
  this.databaseId = databaseId;
4356
4357
  this.appId = appId;
4357
4358
  this.persistenceKey = persistenceKey;
@@ -4359,6 +4360,7 @@ class DatabaseInfo {
4359
4360
  this.ssl = ssl;
4360
4361
  this.forceLongPolling = forceLongPolling;
4361
4362
  this.autoDetectLongPolling = autoDetectLongPolling;
4363
+ this.longPollingOptions = longPollingOptions;
4362
4364
  this.useFetchStreams = useFetchStreams;
4363
4365
  }
4364
4366
  }
@@ -26960,6 +26962,40 @@ function firestoreClientSetIndexConfiguration(client, indexes) {
26960
26962
  });
26961
26963
  }
26962
26964
 
26965
+ /**
26966
+ * @license
26967
+ * Copyright 2023 Google LLC
26968
+ *
26969
+ * Licensed under the Apache License, Version 2.0 (the "License");
26970
+ * you may not use this file except in compliance with the License.
26971
+ * You may obtain a copy of the License at
26972
+ *
26973
+ * http://www.apache.org/licenses/LICENSE-2.0
26974
+ *
26975
+ * Unless required by applicable law or agreed to in writing, software
26976
+ * distributed under the License is distributed on an "AS IS" BASIS,
26977
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26978
+ * See the License for the specific language governing permissions and
26979
+ * limitations under the License.
26980
+ */
26981
+ /**
26982
+ * Compares two `ExperimentalLongPollingOptions` objects for equality.
26983
+ */
26984
+ function longPollingOptionsEqual(options1, options2) {
26985
+ return options1.timeoutSeconds === options2.timeoutSeconds;
26986
+ }
26987
+ /**
26988
+ * Creates and returns a new `ExperimentalLongPollingOptions` with the same
26989
+ * option values as the given instance.
26990
+ */
26991
+ function cloneLongPollingOptions(options) {
26992
+ const clone = {};
26993
+ if (options.timeoutSeconds !== undefined) {
26994
+ clone.timeoutSeconds = options.timeoutSeconds;
26995
+ }
26996
+ return clone;
26997
+ }
26998
+
26963
26999
  /**
26964
27000
  * @license
26965
27001
  * Copyright 2020 Google LLC
@@ -26995,7 +27031,7 @@ function removeComponents(firestore) {
26995
27031
  }
26996
27032
  }
26997
27033
  function makeDatabaseInfo(databaseId, appId, persistenceKey, settings) {
26998
- return new DatabaseInfo(databaseId, appId, persistenceKey, settings.host, settings.ssl, settings.experimentalForceLongPolling, settings.experimentalAutoDetectLongPolling, settings.useFetchStreams);
27034
+ return new DatabaseInfo(databaseId, appId, persistenceKey, settings.host, settings.ssl, settings.experimentalForceLongPolling, settings.experimentalAutoDetectLongPolling, cloneLongPollingOptions(settings.experimentalLongPollingOptions), settings.useFetchStreams);
26999
27035
  }
27000
27036
 
27001
27037
  /**
@@ -27017,7 +27053,17 @@ function makeDatabaseInfo(databaseId, appId, persistenceKey, settings) {
27017
27053
  // settings() defaults:
27018
27054
  const DEFAULT_HOST = 'firestore.googleapis.com';
27019
27055
  const DEFAULT_SSL = true;
27020
- const DEFAULT_AUTO_DETECT_LONG_POLLING = false;
27056
+ // The minimum long-polling timeout is hardcoded on the server. The value here
27057
+ // should be kept in sync with the value used by the server, as the server will
27058
+ // silently ignore a value below the minimum and fall back to the default.
27059
+ // Googlers see b/266868871 for relevant discussion.
27060
+ const MIN_LONG_POLLING_TIMEOUT_SECONDS = 5;
27061
+ // No maximum long-polling timeout is configured in the server, and defaults to
27062
+ // 30 seconds, which is what Watch appears to use.
27063
+ // Googlers see b/266868871 for relevant discussion.
27064
+ const MAX_LONG_POLLING_TIMEOUT_SECONDS = 30;
27065
+ // Whether long-polling auto-detected is enabled by default.
27066
+ const DEFAULT_AUTO_DETECT_LONG_POLLING = true;
27021
27067
  /**
27022
27068
  * A concrete type describing all the values that can be applied via a
27023
27069
  * user-supplied `FirestoreSettings` object. This is a separate type so that
@@ -27025,7 +27071,7 @@ const DEFAULT_AUTO_DETECT_LONG_POLLING = false;
27025
27071
  */
27026
27072
  class FirestoreSettingsImpl {
27027
27073
  constructor(settings) {
27028
- var _a;
27074
+ var _a, _b;
27029
27075
  if (settings.host === undefined) {
27030
27076
  if (settings.ssl !== undefined) {
27031
27077
  throw new FirestoreError(Code.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
@@ -27067,6 +27113,8 @@ class FirestoreSettingsImpl {
27067
27113
  this.experimentalAutoDetectLongPolling =
27068
27114
  !!settings.experimentalAutoDetectLongPolling;
27069
27115
  }
27116
+ this.experimentalLongPollingOptions = cloneLongPollingOptions((_b = settings.experimentalLongPollingOptions) !== null && _b !== void 0 ? _b : {});
27117
+ validateLongPollingOptions(this.experimentalLongPollingOptions);
27070
27118
  this.useFetchStreams = !!settings.useFetchStreams;
27071
27119
  }
27072
27120
  isEqual(other) {
@@ -27078,9 +27126,26 @@ class FirestoreSettingsImpl {
27078
27126
  other.experimentalForceLongPolling &&
27079
27127
  this.experimentalAutoDetectLongPolling ===
27080
27128
  other.experimentalAutoDetectLongPolling &&
27129
+ longPollingOptionsEqual(this.experimentalLongPollingOptions, other.experimentalLongPollingOptions) &&
27081
27130
  this.ignoreUndefinedProperties === other.ignoreUndefinedProperties &&
27082
27131
  this.useFetchStreams === other.useFetchStreams);
27083
27132
  }
27133
+ }
27134
+ function validateLongPollingOptions(options) {
27135
+ if (options.timeoutSeconds !== undefined) {
27136
+ if (isNaN(options.timeoutSeconds)) {
27137
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ` +
27138
+ `${options.timeoutSeconds} (must not be NaN)`);
27139
+ }
27140
+ if (options.timeoutSeconds < MIN_LONG_POLLING_TIMEOUT_SECONDS) {
27141
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ${options.timeoutSeconds} ` +
27142
+ `(minimum allowed value is ${MIN_LONG_POLLING_TIMEOUT_SECONDS})`);
27143
+ }
27144
+ if (options.timeoutSeconds > MAX_LONG_POLLING_TIMEOUT_SECONDS) {
27145
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ${options.timeoutSeconds} ` +
27146
+ `(maximum allowed value is ${MAX_LONG_POLLING_TIMEOUT_SECONDS})`);
27147
+ }
27148
+ }
27084
27149
  }
27085
27150
 
27086
27151
  /**