@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
@@ -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 {};
package/dist/private.d.ts CHANGED
@@ -691,6 +691,7 @@ declare class DatabaseInfo {
691
691
  readonly ssl: boolean;
692
692
  readonly forceLongPolling: boolean;
693
693
  readonly autoDetectLongPolling: boolean;
694
+ readonly longPollingOptions: ExperimentalLongPollingOptions;
694
695
  readonly useFetchStreams: boolean;
695
696
  /**
696
697
  * Constructs a DatabaseInfo using the provided host, databaseId and
@@ -706,10 +707,11 @@ declare class DatabaseInfo {
706
707
  * when using WebChannel as the network transport.
707
708
  * @param autoDetectLongPolling - Whether to use the detectBufferingProxy
708
709
  * option when using WebChannel as the network transport.
710
+ * @param longPollingOptions Options that configure long-polling.
709
711
  * @param useFetchStreams Whether to use the Fetch API instead of
710
712
  * XMLHTTPRequest
711
713
  */
712
- constructor(databaseId: _DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, useFetchStreams: boolean);
714
+ constructor(databaseId: _DatabaseId, appId: string, persistenceKey: string, host: string, ssl: boolean, forceLongPolling: boolean, autoDetectLongPolling: boolean, longPollingOptions: ExperimentalLongPollingOptions, useFetchStreams: boolean);
713
715
  }
714
716
 
715
717
  /**
@@ -1414,6 +1416,53 @@ declare interface ExistenceFilterMismatchInfo {
1414
1416
  };
1415
1417
  }
1416
1418
 
1419
+ /**
1420
+ * @license
1421
+ * Copyright 2023 Google LLC
1422
+ *
1423
+ * Licensed under the Apache License, Version 2.0 (the "License");
1424
+ * you may not use this file except in compliance with the License.
1425
+ * You may obtain a copy of the License at
1426
+ *
1427
+ * http://www.apache.org/licenses/LICENSE-2.0
1428
+ *
1429
+ * Unless required by applicable law or agreed to in writing, software
1430
+ * distributed under the License is distributed on an "AS IS" BASIS,
1431
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1432
+ * See the License for the specific language governing permissions and
1433
+ * limitations under the License.
1434
+ */
1435
+ /**
1436
+ * Options that configure the SDK’s underlying network transport (WebChannel)
1437
+ * when long-polling is used.
1438
+ *
1439
+ * Note: This interface is "experimental" and is subject to change.
1440
+ *
1441
+ * See `FirestoreSettings.experimentalAutoDetectLongPolling`,
1442
+ * `FirestoreSettings.experimentalForceLongPolling`, and
1443
+ * `FirestoreSettings.experimentalLongPollingOptions`.
1444
+ */
1445
+ export declare interface ExperimentalLongPollingOptions {
1446
+ /**
1447
+ * The desired maximum timeout interval, in seconds, to complete a
1448
+ * long-polling GET response. Valid values are between 5 and 30, inclusive.
1449
+ * Floating point values are allowed and will be rounded to the nearest
1450
+ * millisecond.
1451
+ *
1452
+ * By default, when long-polling is used the "hanging GET" request sent by
1453
+ * the client times out after 30 seconds. To request a different timeout
1454
+ * from the server, set this setting with the desired timeout.
1455
+ *
1456
+ * Changing the default timeout may be useful, for example, if the buffering
1457
+ * proxy that necessitated enabling long-polling in the first place has a
1458
+ * shorter timeout for hanging GET requests, in which case setting the
1459
+ * long-polling timeout to a shorter value, such as 25 seconds, may fix
1460
+ * prematurely-closed hanging GET requests.
1461
+ * For example, see https://github.com/firebase/firebase-js-sdk/issues/6987.
1462
+ */
1463
+ timeoutSeconds?: number;
1464
+ }
1465
+
1417
1466
  declare class FieldFilter extends Filter {
1418
1467
  readonly field: _FieldPath;
1419
1468
  readonly op: Operator;
@@ -1958,10 +2007,23 @@ export declare interface FirestoreSettings extends FirestoreSettings_2 {
1958
2007
  * detect if long-polling should be used. This is very similar to
1959
2008
  * `experimentalForceLongPolling`, but only uses long-polling if required.
1960
2009
  *
1961
- * This setting will likely be enabled by default in future releases and
1962
- * cannot be combined with `experimentalForceLongPolling`.
2010
+ * After having had a default value of `false` since its inception in 2019,
2011
+ * the default value of this setting was changed in mid-2023 to `true`. That
2012
+ * is, auto-detection of long polling is now enabled by default. To disable
2013
+ * it, set this setting to `false`, and please open a GitHub issue to share
2014
+ * the problems that motivated you disabling long-polling auto-detection.
1963
2015
  */
1964
2016
  experimentalAutoDetectLongPolling?: boolean;
2017
+ /**
2018
+ * Options that configure the SDK’s underlying network transport (WebChannel)
2019
+ * when long-polling is used.
2020
+ *
2021
+ * These options are only used if `experimentalForceLongPolling` is true or if
2022
+ * `experimentalAutoDetectLongPolling` is true and the auto-detection
2023
+ * determined that long-polling was needed. Otherwise, these options have no
2024
+ * effect.
2025
+ */
2026
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
1965
2027
  }
1966
2028
 
1967
2029
  /**
@@ -1995,6 +2057,7 @@ declare class FirestoreSettingsImpl {
1995
2057
  readonly cacheSizeBytes: number;
1996
2058
  readonly experimentalForceLongPolling: boolean;
1997
2059
  readonly experimentalAutoDetectLongPolling: boolean;
2060
+ readonly experimentalLongPollingOptions: ExperimentalLongPollingOptions;
1998
2061
  readonly ignoreUndefinedProperties: boolean;
1999
2062
  readonly useFetchStreams: boolean;
2000
2063
  readonly cache?: FirestoreLocalCache;
@@ -4493,6 +4556,7 @@ declare interface PrivateSettings extends FirestoreSettings_2 {
4493
4556
  cacheSizeBytes?: number;
4494
4557
  experimentalForceLongPolling?: boolean;
4495
4558
  experimentalAutoDetectLongPolling?: boolean;
4559
+ experimentalLongPollingOptions?: ExperimentalLongPollingOptions;
4496
4560
  useFetchStreams?: boolean;
4497
4561
  localCache?: FirestoreLocalCache;
4498
4562
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/firestore",
3
- "version": "3.11.0",
3
+ "version": "3.12.0-20230511201449",
4
4
  "engines": {
5
5
  "node": ">=10.10.0"
6
6
  },
@@ -102,12 +102,12 @@
102
102
  "tslib": "^2.1.0"
103
103
  },
104
104
  "peerDependencies": {
105
- "@firebase/app": "0.x"
105
+ "@firebase/app": "0.9.10-20230511201449"
106
106
  },
107
107
  "devDependencies": {
108
- "@firebase/app": "0.9.9",
109
- "@firebase/app-compat": "0.2.9",
110
- "@firebase/auth": "0.23.1",
108
+ "@firebase/app": "0.9.10-20230511201449",
109
+ "@firebase/app-compat": "0.2.10-20230511201449",
110
+ "@firebase/auth": "0.23.2-20230511201449",
111
111
  "@rollup/plugin-alias": "3.1.9",
112
112
  "@rollup/plugin-json": "4.1.0",
113
113
  "@types/eslint": "7.29.0",