@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
@@ -798,6 +798,7 @@ declare class DatabaseInfo {
798
798
  readonly ssl: boolean;
799
799
  readonly forceLongPolling: boolean;
800
800
  readonly autoDetectLongPolling: boolean;
801
+ readonly longPollingOptions: ExperimentalLongPollingOptions;
801
802
  readonly useFetchStreams: boolean;
802
803
  /**
803
804
  * Constructs a DatabaseInfo using the provided host, databaseId and
@@ -813,10 +814,11 @@ declare class DatabaseInfo {
813
814
  * when using WebChannel as the network transport.
814
815
  * @param autoDetectLongPolling - Whether to use the detectBufferingProxy
815
816
  * option when using WebChannel as the network transport.
817
+ * @param longPollingOptions Options that configure long-polling.
816
818
  * @param useFetchStreams Whether to use the Fetch API instead of
817
819
  * XMLHTTPRequest
818
820
  */
819
- constructor(databaseId: _DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, useFetchStreams: boolean);
821
+ constructor(databaseId: _DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, longPollingOptions: ExperimentalLongPollingOptions, useFetchStreams: boolean);
820
822
  }
821
823
 
822
824
  /**
@@ -1583,6 +1585,53 @@ declare interface ExistenceFilterMismatchInfo {
1583
1585
  };
1584
1586
  }
1585
1587
 
1588
+ /**
1589
+ * @license
1590
+ * Copyright 2023 Google LLC
1591
+ *
1592
+ * Licensed under the Apache License, Version 2.0 (the "License");
1593
+ * you may not use this file except in compliance with the License.
1594
+ * You may obtain a copy of the License at
1595
+ *
1596
+ * http://www.apache.org/licenses/LICENSE-2.0
1597
+ *
1598
+ * Unless required by applicable law or agreed to in writing, software
1599
+ * distributed under the License is distributed on an "AS IS" BASIS,
1600
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1601
+ * See the License for the specific language governing permissions and
1602
+ * limitations under the License.
1603
+ */
1604
+ /**
1605
+ * Options that configure the SDK’s underlying network transport (WebChannel)
1606
+ * when long-polling is used.
1607
+ *
1608
+ * Note: This interface is "experimental" and is subject to change.
1609
+ *
1610
+ * See `FirestoreSettings.experimentalAutoDetectLongPolling`,
1611
+ * `FirestoreSettings.experimentalForceLongPolling`, and
1612
+ * `FirestoreSettings.experimentalLongPollingOptions`.
1613
+ */
1614
+ export declare interface ExperimentalLongPollingOptions {
1615
+ /**
1616
+ * The desired maximum timeout interval, in seconds, to complete a
1617
+ * long-polling GET response. Valid values are between 5 and 30, inclusive.
1618
+ * Floating point values are allowed and will be rounded to the nearest
1619
+ * millisecond.
1620
+ *
1621
+ * By default, when long-polling is used the "hanging GET" request sent by
1622
+ * the client times out after 30 seconds. To request a different timeout
1623
+ * from the server, set this setting with the desired timeout.
1624
+ *
1625
+ * Changing the default timeout may be useful, for example, if the buffering
1626
+ * proxy that necessitated enabling long-polling in the first place has a
1627
+ * shorter timeout for hanging GET requests, in which case setting the
1628
+ * long-polling timeout to a shorter value, such as 25 seconds, may fix
1629
+ * prematurely-closed hanging GET requests.
1630
+ * For example, see https://github.com/firebase/firebase-js-sdk/issues/6987.
1631
+ */
1632
+ timeoutSeconds?: number;
1633
+ }
1634
+
1586
1635
  declare class FieldFilter extends Filter {
1587
1636
  readonly field: _FieldPath;
1588
1637
  readonly op: Operator;
@@ -2158,10 +2207,23 @@ export declare interface FirestoreSettings extends FirestoreSettings_2 {
2158
2207
  * detect if long-polling should be used. This is very similar to
2159
2208
  * `experimentalForceLongPolling`, but only uses long-polling if required.
2160
2209
  *
2161
- * This setting will likely be enabled by default in future releases and
2162
- * cannot be combined with `experimentalForceLongPolling`.
2210
+ * After having had a default value of `false` since its inception in 2019,
2211
+ * the default value of this setting was changed in mid-2023 to `true`. That
2212
+ * is, auto-detection of long polling is now enabled by default. To disable
2213
+ * it, set this setting to `false`, and please open a GitHub issue to share
2214
+ * the problems that motivated you disabling long-polling auto-detection.
2163
2215
  */
2164
2216
  experimentalAutoDetectLongPolling?: boolean;
2217
+ /**
2218
+ * Options that configure the SDK’s underlying network transport (WebChannel)
2219
+ * when long-polling is used.
2220
+ *
2221
+ * These options are only used if `experimentalForceLongPolling` is true or if
2222
+ * `experimentalAutoDetectLongPolling` is true and the auto-detection
2223
+ * determined that long-polling was needed. Otherwise, these options have no
2224
+ * effect.
2225
+ */
2226
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
2165
2227
  }
2166
2228
 
2167
2229
  /**
@@ -2195,6 +2257,7 @@ declare class FirestoreSettingsImpl {
2195
2257
  readonly cacheSizeBytes: number;
2196
2258
  readonly experimentalForceLongPolling: boolean;
2197
2259
  readonly experimentalAutoDetectLongPolling: boolean;
2260
+ readonly experimentalLongPollingOptions: ExperimentalLongPollingOptions;
2198
2261
  readonly ignoreUndefinedProperties: boolean;
2199
2262
  readonly useFetchStreams: boolean;
2200
2263
  readonly cache?: FirestoreLocalCache;
@@ -4790,6 +4853,7 @@ declare interface PrivateSettings extends FirestoreSettings_2 {
4790
4853
  cacheSizeBytes?: number;
4791
4854
  experimentalForceLongPolling?: boolean;
4792
4855
  experimentalAutoDetectLongPolling?: boolean;
4856
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
4793
4857
  useFetchStreams?: boolean;
4794
4858
  localCache?: FirestoreLocalCache;
4795
4859
  }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
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
+ * Options that configure the SDK’s underlying network transport (WebChannel)
19
+ * when long-polling is used.
20
+ *
21
+ * Note: This interface is "experimental" and is subject to change.
22
+ *
23
+ * See `FirestoreSettings.experimentalAutoDetectLongPolling`,
24
+ * `FirestoreSettings.experimentalForceLongPolling`, and
25
+ * `FirestoreSettings.experimentalLongPollingOptions`.
26
+ */
27
+ export interface ExperimentalLongPollingOptions {
28
+ /**
29
+ * The desired maximum timeout interval, in seconds, to complete a
30
+ * long-polling GET response. Valid values are between 5 and 30, inclusive.
31
+ * Floating point values are allowed and will be rounded to the nearest
32
+ * millisecond.
33
+ *
34
+ * By default, when long-polling is used the "hanging GET" request sent by
35
+ * the client times out after 30 seconds. To request a different timeout
36
+ * from the server, set this setting with the desired timeout.
37
+ *
38
+ * Changing the default timeout may be useful, for example, if the buffering
39
+ * proxy that necessitated enabling long-polling in the first place has a
40
+ * shorter timeout for hanging GET requests, in which case setting the
41
+ * long-polling timeout to a shorter value, such as 25 seconds, may fix
42
+ * prematurely-closed hanging GET requests.
43
+ * For example, see https://github.com/firebase/firebase-js-sdk/issues/6987.
44
+ */
45
+ timeoutSeconds?: number;
46
+ }
47
+ /**
48
+ * Compares two `ExperimentalLongPollingOptions` objects for equality.
49
+ */
50
+ export declare function longPollingOptionsEqual(options1: ExperimentalLongPollingOptions, options2: ExperimentalLongPollingOptions): boolean;
51
+ /**
52
+ * Creates and returns a new `ExperimentalLongPollingOptions` with the same
53
+ * option values as the given instance.
54
+ */
55
+ export declare function cloneLongPollingOptions(options: ExperimentalLongPollingOptions): ExperimentalLongPollingOptions;
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { FirestoreSettings as LiteSettings } from '../lite-api/settings';
18
18
  import { FirestoreLocalCache } from './cache_config';
19
+ import { ExperimentalLongPollingOptions } from './long_polling_options';
19
20
  export { DEFAULT_HOST } from '../lite-api/settings';
20
21
  /**
21
22
  * Settings that can be passed to `enableIndexedDbPersistence()` to configure
@@ -80,8 +81,21 @@ export interface FirestoreSettings extends LiteSettings {
80
81
  * detect if long-polling should be used. This is very similar to
81
82
  * `experimentalForceLongPolling`, but only uses long-polling if required.
82
83
  *
83
- * This setting will likely be enabled by default in future releases and
84
- * cannot be combined with `experimentalForceLongPolling`.
84
+ * After having had a default value of `false` since its inception in 2019,
85
+ * the default value of this setting was changed in mid-2023 to `true`. That
86
+ * is, auto-detection of long polling is now enabled by default. To disable
87
+ * it, set this setting to `false`, and please open a GitHub issue to share
88
+ * the problems that motivated you disabling long-polling auto-detection.
85
89
  */
86
90
  experimentalAutoDetectLongPolling?: boolean;
91
+ /**
92
+ * Options that configure the SDK’s underlying network transport (WebChannel)
93
+ * when long-polling is used.
94
+ *
95
+ * These options are only used if `experimentalForceLongPolling` is true or if
96
+ * `experimentalAutoDetectLongPolling` is true and the auto-detection
97
+ * determined that long-polling was needed. Otherwise, these options have no
98
+ * effect.
99
+ */
100
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
87
101
  }
@@ -21,6 +21,7 @@ export { documentId, FieldPath } from './api/field_path';
21
21
  export { clearIndexedDbPersistence, connectFirestoreEmulator, disableNetwork, EmulatorMockTokenOptions, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence, enableNetwork, ensureFirestoreConfigured, Firestore, getFirestore, initializeFirestore, loadBundle, namedQuery, terminate, waitForPendingWrites } from './api/database';
22
22
  export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle';
23
23
  export { FirestoreSettings, PersistenceSettings } from './api/settings';
24
+ export { ExperimentalLongPollingOptions } from './api/long_polling_options';
24
25
  export { DocumentChange, DocumentChangeType, DocumentSnapshot, FirestoreDataConverter, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotMetadata, SnapshotOptions } from './api/snapshot';
25
26
  export { collection, collectionGroup, CollectionReference, doc, DocumentData, DocumentReference, PartialWithFieldValue, Query, queryEqual, refEqual, SetOptions, UpdateData, WithFieldValue } from './api/reference';
26
27
  export { and, endAt, endBefore, limit, limitToLast, or, orderBy, OrderByDirection, query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryEndAtConstraint, QueryFieldFilterConstraint, QueryFilterConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryOrderByConstraint, QueryStartAtConstraint, startAfter, startAt, where, WhereFilterOp } from './api/filter';
@@ -1,4 +1,5 @@
1
1
  import { FirebaseApp } from '@firebase/app';
2
+ import { ExperimentalLongPollingOptions } from '../api/long_polling_options';
2
3
  /**
3
4
  * @license
4
5
  * Copyright 2017 Google LLC
@@ -23,6 +24,7 @@ export declare class DatabaseInfo {
23
24
  readonly ssl: boolean;
24
25
  readonly forceLongPolling: boolean;
25
26
  readonly autoDetectLongPolling: boolean;
27
+ readonly longPollingOptions: ExperimentalLongPollingOptions;
26
28
  readonly useFetchStreams: boolean;
27
29
  /**
28
30
  * Constructs a DatabaseInfo using the provided host, databaseId and
@@ -38,10 +40,11 @@ export declare class DatabaseInfo {
38
40
  * when using WebChannel as the network transport.
39
41
  * @param autoDetectLongPolling - Whether to use the detectBufferingProxy
40
42
  * option when using WebChannel as the network transport.
43
+ * @param longPollingOptions Options that configure long-polling.
41
44
  * @param useFetchStreams Whether to use the Fetch API instead of
42
45
  * XMLHTTPRequest
43
46
  */
44
- constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, useFetchStreams: boolean);
47
+ constructor(databaseId: DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, longPollingOptions: ExperimentalLongPollingOptions, useFetchStreams: boolean);
45
48
  }
46
49
  /** The default database name for a project. */
47
50
  export declare const DEFAULT_DATABASE_NAME = "(default)";
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { FirestoreLocalCache } from '../api/cache_config';
18
18
  import { CredentialsSettings } from '../api/credentials';
19
+ import { ExperimentalLongPollingOptions } from '../api/long_polling_options';
19
20
  export declare const DEFAULT_HOST = "firestore.googleapis.com";
20
21
  export declare const DEFAULT_SSL = true;
21
22
  /**
@@ -41,6 +42,7 @@ export interface PrivateSettings extends FirestoreSettings {
41
42
  cacheSizeBytes?: number;
42
43
  experimentalForceLongPolling?: boolean;
43
44
  experimentalAutoDetectLongPolling?: boolean;
45
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
44
46
  useFetchStreams?: boolean;
45
47
  localCache?: FirestoreLocalCache;
46
48
  }
@@ -57,6 +59,7 @@ export declare class FirestoreSettingsImpl {
57
59
  readonly cacheSizeBytes: number;
58
60
  readonly experimentalForceLongPolling: boolean;
59
61
  readonly experimentalAutoDetectLongPolling: boolean;
62
+ readonly experimentalLongPollingOptions: ExperimentalLongPollingOptions;
60
63
  readonly ignoreUndefinedProperties: boolean;
61
64
  readonly useFetchStreams: boolean;
62
65
  readonly cache?: FirestoreLocalCache;
@@ -23,6 +23,7 @@ export declare class WebChannelConnection extends RestConnection {
23
23
  private readonly forceLongPolling;
24
24
  private readonly autoDetectLongPolling;
25
25
  private readonly useFetchStreams;
26
+ private readonly longPollingOptions;
26
27
  constructor(info: DatabaseInfo);
27
28
  protected performRPCRequest<Req, Resp>(rpcName: string, url: string, headers: StringMap, body: Req): Promise<Resp>;
28
29
  openStream<Req, Resp>(rpcName: string, authToken: Token | null, appCheckToken: Token | null): Stream<Req, Resp>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google LLC
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
+ export {};