@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
@@ -9,7 +9,7 @@ import * as grpc from '@grpc/grpc-js';
9
9
  import * as protoLoader from '@grpc/proto-loader';
10
10
 
11
11
  const name = "@firebase/firestore";
12
- const version$1 = "3.11.0";
12
+ const version$1 = "3.12.0-20230511201449";
13
13
 
14
14
  /**
15
15
  * @license
@@ -62,7 +62,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
62
62
  User.FIRST_PARTY = new User('first-party-uid');
63
63
  User.MOCK_USER = new User('mock-user');
64
64
 
65
- const version = "9.21.0";
65
+ const version = "9.22.0-20230511201449";
66
66
 
67
67
  /**
68
68
  * @license
@@ -4323,10 +4323,11 @@ class DatabaseInfo {
4323
4323
  * when using WebChannel as the network transport.
4324
4324
  * @param autoDetectLongPolling - Whether to use the detectBufferingProxy
4325
4325
  * option when using WebChannel as the network transport.
4326
+ * @param longPollingOptions Options that configure long-polling.
4326
4327
  * @param useFetchStreams Whether to use the Fetch API instead of
4327
4328
  * XMLHTTPRequest
4328
4329
  */
4329
- constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, useFetchStreams) {
4330
+ constructor(databaseId, appId, persistenceKey, host, ssl, forceLongPolling, autoDetectLongPolling, longPollingOptions, useFetchStreams) {
4330
4331
  this.databaseId = databaseId;
4331
4332
  this.appId = appId;
4332
4333
  this.persistenceKey = persistenceKey;
@@ -4334,6 +4335,7 @@ class DatabaseInfo {
4334
4335
  this.ssl = ssl;
4335
4336
  this.forceLongPolling = forceLongPolling;
4336
4337
  this.autoDetectLongPolling = autoDetectLongPolling;
4338
+ this.longPollingOptions = longPollingOptions;
4337
4339
  this.useFetchStreams = useFetchStreams;
4338
4340
  }
4339
4341
  }
@@ -26935,6 +26937,40 @@ function firestoreClientSetIndexConfiguration(client, indexes) {
26935
26937
  });
26936
26938
  }
26937
26939
 
26940
+ /**
26941
+ * @license
26942
+ * Copyright 2023 Google LLC
26943
+ *
26944
+ * Licensed under the Apache License, Version 2.0 (the "License");
26945
+ * you may not use this file except in compliance with the License.
26946
+ * You may obtain a copy of the License at
26947
+ *
26948
+ * http://www.apache.org/licenses/LICENSE-2.0
26949
+ *
26950
+ * Unless required by applicable law or agreed to in writing, software
26951
+ * distributed under the License is distributed on an "AS IS" BASIS,
26952
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26953
+ * See the License for the specific language governing permissions and
26954
+ * limitations under the License.
26955
+ */
26956
+ /**
26957
+ * Compares two `ExperimentalLongPollingOptions` objects for equality.
26958
+ */
26959
+ function longPollingOptionsEqual(options1, options2) {
26960
+ return options1.timeoutSeconds === options2.timeoutSeconds;
26961
+ }
26962
+ /**
26963
+ * Creates and returns a new `ExperimentalLongPollingOptions` with the same
26964
+ * option values as the given instance.
26965
+ */
26966
+ function cloneLongPollingOptions(options) {
26967
+ const clone = {};
26968
+ if (options.timeoutSeconds !== undefined) {
26969
+ clone.timeoutSeconds = options.timeoutSeconds;
26970
+ }
26971
+ return clone;
26972
+ }
26973
+
26938
26974
  /**
26939
26975
  * @license
26940
26976
  * Copyright 2020 Google LLC
@@ -26970,7 +27006,7 @@ function removeComponents(firestore) {
26970
27006
  }
26971
27007
  }
26972
27008
  function makeDatabaseInfo(databaseId, appId, persistenceKey, settings) {
26973
- return new DatabaseInfo(databaseId, appId, persistenceKey, settings.host, settings.ssl, settings.experimentalForceLongPolling, settings.experimentalAutoDetectLongPolling, settings.useFetchStreams);
27009
+ return new DatabaseInfo(databaseId, appId, persistenceKey, settings.host, settings.ssl, settings.experimentalForceLongPolling, settings.experimentalAutoDetectLongPolling, cloneLongPollingOptions(settings.experimentalLongPollingOptions), settings.useFetchStreams);
26974
27010
  }
26975
27011
 
26976
27012
  /**
@@ -26992,7 +27028,17 @@ function makeDatabaseInfo(databaseId, appId, persistenceKey, settings) {
26992
27028
  // settings() defaults:
26993
27029
  const DEFAULT_HOST = 'firestore.googleapis.com';
26994
27030
  const DEFAULT_SSL = true;
26995
- const DEFAULT_AUTO_DETECT_LONG_POLLING = false;
27031
+ // The minimum long-polling timeout is hardcoded on the server. The value here
27032
+ // should be kept in sync with the value used by the server, as the server will
27033
+ // silently ignore a value below the minimum and fall back to the default.
27034
+ // Googlers see b/266868871 for relevant discussion.
27035
+ const MIN_LONG_POLLING_TIMEOUT_SECONDS = 5;
27036
+ // No maximum long-polling timeout is configured in the server, and defaults to
27037
+ // 30 seconds, which is what Watch appears to use.
27038
+ // Googlers see b/266868871 for relevant discussion.
27039
+ const MAX_LONG_POLLING_TIMEOUT_SECONDS = 30;
27040
+ // Whether long-polling auto-detected is enabled by default.
27041
+ const DEFAULT_AUTO_DETECT_LONG_POLLING = true;
26996
27042
  /**
26997
27043
  * A concrete type describing all the values that can be applied via a
26998
27044
  * user-supplied `FirestoreSettings` object. This is a separate type so that
@@ -27000,7 +27046,7 @@ const DEFAULT_AUTO_DETECT_LONG_POLLING = false;
27000
27046
  */
27001
27047
  class FirestoreSettingsImpl {
27002
27048
  constructor(settings) {
27003
- var _a;
27049
+ var _a, _b;
27004
27050
  if (settings.host === undefined) {
27005
27051
  if (settings.ssl !== undefined) {
27006
27052
  throw new FirestoreError(Code.INVALID_ARGUMENT, "Can't provide ssl option if host option is not set");
@@ -27042,6 +27088,8 @@ class FirestoreSettingsImpl {
27042
27088
  this.experimentalAutoDetectLongPolling =
27043
27089
  !!settings.experimentalAutoDetectLongPolling;
27044
27090
  }
27091
+ this.experimentalLongPollingOptions = cloneLongPollingOptions((_b = settings.experimentalLongPollingOptions) !== null && _b !== void 0 ? _b : {});
27092
+ validateLongPollingOptions(this.experimentalLongPollingOptions);
27045
27093
  this.useFetchStreams = !!settings.useFetchStreams;
27046
27094
  }
27047
27095
  isEqual(other) {
@@ -27053,9 +27101,26 @@ class FirestoreSettingsImpl {
27053
27101
  other.experimentalForceLongPolling &&
27054
27102
  this.experimentalAutoDetectLongPolling ===
27055
27103
  other.experimentalAutoDetectLongPolling &&
27104
+ longPollingOptionsEqual(this.experimentalLongPollingOptions, other.experimentalLongPollingOptions) &&
27056
27105
  this.ignoreUndefinedProperties === other.ignoreUndefinedProperties &&
27057
27106
  this.useFetchStreams === other.useFetchStreams);
27058
27107
  }
27108
+ }
27109
+ function validateLongPollingOptions(options) {
27110
+ if (options.timeoutSeconds !== undefined) {
27111
+ if (isNaN(options.timeoutSeconds)) {
27112
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ` +
27113
+ `${options.timeoutSeconds} (must not be NaN)`);
27114
+ }
27115
+ if (options.timeoutSeconds < MIN_LONG_POLLING_TIMEOUT_SECONDS) {
27116
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ${options.timeoutSeconds} ` +
27117
+ `(minimum allowed value is ${MIN_LONG_POLLING_TIMEOUT_SECONDS})`);
27118
+ }
27119
+ if (options.timeoutSeconds > MAX_LONG_POLLING_TIMEOUT_SECONDS) {
27120
+ throw new FirestoreError(Code.INVALID_ARGUMENT, `invalid long polling timeout: ${options.timeoutSeconds} ` +
27121
+ `(maximum allowed value is ${MAX_LONG_POLLING_TIMEOUT_SECONDS})`);
27122
+ }
27123
+ }
27059
27124
  }
27060
27125
 
27061
27126
  /**