@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.9.0-20230314181055
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5ba524313`](https://github.com/firebase/firebase-js-sdk/commit/5ba524313bdeddb012c44b1b1161c9229396b195) [#7053](https://github.com/firebase/firebase-js-sdk/pull/7053) - Add support for disjunctions in queries (OR queries).
8
+
9
+ ### Patch Changes
10
+
11
+ - [`e2bf2eca2`](https://github.com/firebase/firebase-js-sdk/commit/e2bf2eca21308670c73d6c642a88c06f0b87d44a) [#7076](https://github.com/firebase/firebase-js-sdk/pull/7076) - Improved debug logging of networking abstractions
12
+
13
+ - [`5099f0f60`](https://github.com/firebase/firebase-js-sdk/commit/5099f0f60a5198b48942e8b2a574505432bdc213) [#6899](https://github.com/firebase/firebase-js-sdk/pull/6899) (fixes [#6509](https://github.com/firebase/firebase-js-sdk/issues/6509)) - Check navigator.userAgent, in addition to navigator.appVersion, when determining whether to work around an IndexedDb bug in Safari.
14
+
3
15
  ## 3.8.4
4
16
 
5
17
  ### Patch Changes
@@ -42,9 +42,9 @@ export declare abstract class AppliableConstraint {
42
42
  /**
43
43
  * A `QueryConstraint` is used to narrow the set of documents returned by a
44
44
  * Firestore query. `QueryConstraint`s are created by invoking {@link where},
45
- * {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
46
- * endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
47
- * can then be passed to {@link query} to create a new query instance that
45
+ * {@link orderBy}, {@link (startAt:1)}, {@link (startAfter:1)}, {@link
46
+ * (endBefore:1)}, {@link (endAt:1)}, {@link limit}, {@link limitToLast} and
47
+ * can then be passed to {@link (query:1)} to create a new query instance that
48
48
  * also contains this `QueryConstraint`.
49
49
  */
50
50
  export declare abstract class QueryConstraint extends AppliableConstraint {
@@ -69,7 +69,6 @@ export declare abstract class QueryConstraint extends AppliableConstraint {
69
69
  * apply (e.g. {@link orderBy}, {@link limit}).
70
70
  * @throws if any of the provided query constraints cannot be combined with the
71
71
  * existing or new constraints.
72
- * @internal TODO remove this internal tag with OR Query support in the server
73
72
  */
74
73
  export declare function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
75
74
  /**
@@ -87,7 +86,7 @@ export declare function query<T>(query: Query<T>, ...queryConstraints: QueryCons
87
86
  * A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
88
87
  * a Firestore query by filtering on one or more document fields.
89
88
  * `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
90
- * be passed to {@link query} to create a new query instance that also contains
89
+ * be passed to {@link (query:1)} to create a new query instance that also contains
91
90
  * this `QueryFieldFilterConstraint`.
92
91
  */
93
92
  export declare class QueryFieldFilterConstraint extends QueryConstraint {
@@ -127,9 +126,8 @@ export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterO
127
126
  * returned by a Firestore query by performing the logical OR or AND of multiple
128
127
  * {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
129
128
  * `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
130
- * {@link and} and can then be passed to {@link query} to create a new query
129
+ * {@link and} and can then be passed to {@link (query:1)} to create a new query
131
130
  * instance that also contains the `QueryCompositeFilterConstraint`.
132
- * @internal TODO remove this internal tag with OR Query support in the server
133
131
  */
134
132
  export declare class QueryCompositeFilterConstraint extends AppliableConstraint {
135
133
  /** The type of this query constraint */
@@ -152,18 +150,14 @@ export declare class QueryCompositeFilterConstraint extends AppliableConstraint
152
150
  * QueryConstraints which are used to narrow or order the set of documents,
153
151
  * but that do not explicitly filter on a document field.
154
152
  * `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
155
- * {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
156
- * {@link limit} or {@link limitToLast} and can then be passed to {@link query}
153
+ * {@link (startAt:1)}, {@link (startAfter:1)}, {@link (endBefore:1)}, {@link (endAt:1)},
154
+ * {@link limit} or {@link limitToLast} and can then be passed to {@link (query:1)}
157
155
  * to create a new query instance that also contains the `QueryConstraint`.
158
156
  */
159
157
  export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
160
158
  /**
161
159
  * `QueryFilterConstraint` is a helper union type that represents
162
160
  * {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}.
163
- * `QueryFilterConstraint`s are created by invoking {@link or} or {@link and}
164
- * and can then be passed to {@link query} to create a new query instance that
165
- * also contains the `QueryConstraint`.
166
- * @internal TODO remove this internal tag with OR Query support in the server
167
161
  */
168
162
  export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
169
163
  /**
@@ -175,7 +169,6 @@ export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCo
175
169
  * {@link QueryFilterConstraint}s to perform a disjunction for. These must be
176
170
  * created with calls to {@link where}, {@link or}, or {@link and}.
177
171
  * @returns The newly created {@link QueryCompositeFilterConstraint}.
178
- * @internal TODO remove this internal tag with OR Query support in the server
179
172
  */
180
173
  export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
181
174
  /**
@@ -187,13 +180,12 @@ export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryC
187
180
  * {@link QueryFilterConstraint}s to perform a conjunction for. These must be
188
181
  * created with calls to {@link where}, {@link or}, or {@link and}.
189
182
  * @returns The newly created {@link QueryCompositeFilterConstraint}.
190
- * @internal TODO remove this internal tag with OR Query support in the server
191
183
  */
192
184
  export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
193
185
  /**
194
186
  * A `QueryOrderByConstraint` is used to sort the set of documents returned by a
195
187
  * Firestore query. `QueryOrderByConstraint`s are created by invoking
196
- * {@link orderBy} and can then be passed to {@link query} to create a new query
188
+ * {@link orderBy} and can then be passed to {@link (query:1)} to create a new query
197
189
  * instance that also contains this `QueryOrderByConstraint`.
198
190
  *
199
191
  * Note: Documents that do not contain the orderBy field will not be present in
@@ -233,7 +225,7 @@ export declare function orderBy(fieldPath: string | FieldPath, directionStr?: Or
233
225
  * A `QueryLimitConstraint` is used to limit the number of documents returned by
234
226
  * a Firestore query.
235
227
  * `QueryLimitConstraint`s are created by invoking {@link limit} or
236
- * {@link limitToLast} and can then be passed to {@link query} to create a new
228
+ * {@link limitToLast} and can then be passed to {@link (query:1)} to create a new
237
229
  * query instance that also contains this `QueryLimitConstraint`.
238
230
  */
239
231
  export declare class QueryLimitConstraint extends QueryConstraint {
@@ -273,7 +265,7 @@ export declare function limitToLast(limit: number): QueryLimitConstraint;
273
265
  * A `QueryStartAtConstraint` is used to exclude documents from the start of a
274
266
  * result set returned by a Firestore query.
275
267
  * `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
276
- * {@link (startAfter:1)} and can then be passed to {@link query} to create a
268
+ * {@link (startAfter:1)} and can then be passed to {@link (query:1)} to create a
277
269
  * new query instance that also contains this `QueryStartAtConstraint`.
278
270
  */
279
271
  export declare class QueryStartAtConstraint extends QueryConstraint {
@@ -334,7 +326,7 @@ export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConst
334
326
  * A `QueryEndAtConstraint` is used to exclude documents from the end of a
335
327
  * result set returned by a Firestore query.
336
328
  * `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
337
- * {@link (endBefore:1)} and can then be passed to {@link query} to create a new
329
+ * {@link (endBefore:1)} and can then be passed to {@link (query:1)} to create a new
338
330
  * query instance that also contains this `QueryEndAtConstraint`.
339
331
  */
340
332
  export declare class QueryEndAtConstraint extends QueryConstraint {
@@ -173,7 +173,7 @@ export declare class Query<T = DocumentData> {
173
173
  }
174
174
  /**
175
175
  * A `CollectionReference` object can be used for adding documents, getting
176
- * document references, and querying for documents (using {@link query}).
176
+ * document references, and querying for documents (using {@link (query:1)}).
177
177
  */
178
178
  export declare class CollectionReference<T = DocumentData> extends Query<T> {
179
179
  readonly _path: ResourcePath;
@@ -0,0 +1,28 @@
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
+ * Generates and returns a unique ID as a hexadecimal string.
19
+ *
20
+ * The returned ID is intended to be used in debug logging messages to help
21
+ * correlate log messages that may be spatially separated in the logs, but
22
+ * logically related. For example, a network connection could include the same
23
+ * "debug ID" string in all of its log messages to help trace a specific
24
+ * connection over time.
25
+ *
26
+ * @return the 10-character generated ID (e.g. "0xa1b2c3d4").
27
+ */
28
+ export declare function generateUniqueDebugId(): string;
@@ -19,6 +19,7 @@ import { Query } from '../../../src/core/query';
19
19
  import { Target } from '../../../src/core/target';
20
20
  import { TargetIdGenerator } from '../../../src/core/target_id_generator';
21
21
  import { TargetId } from '../../../src/core/types';
22
+ import { TargetPurpose } from '../../../src/local/target_data';
22
23
  import { Document } from '../../../src/model/document';
23
24
  import { DocumentKey } from '../../../src/model/document_key';
24
25
  import { FieldIndex } from '../../../src/model/field_index';
@@ -34,6 +35,7 @@ export interface LimboMap {
34
35
  }
35
36
  export interface ActiveTargetSpec {
36
37
  queries: SpecQuery[];
38
+ targetPurpose?: TargetPurpose;
37
39
  resumeToken?: string;
38
40
  readTime?: TestSnapshotVersion;
39
41
  }
@@ -139,6 +141,7 @@ export declare class SpecBuilder {
139
141
  /** Overrides the currently expected set of active targets. */
140
142
  expectActiveTargets(...targets: Array<{
141
143
  query: Query;
144
+ targetPurpose?: TargetPurpose;
142
145
  resumeToken?: string;
143
146
  readTime?: TestSnapshotVersion;
144
147
  }>): this;
@@ -28,6 +28,7 @@ import { PersistenceTransaction, PersistenceTransactionMode } from '../../../src
28
28
  import { SharedClientState } from '../../../src/local/shared_client_state';
29
29
  import { Mutation } from '../../../src/model/mutation';
30
30
  import * as api from '../../../src/protos/firestore_proto_api';
31
+ import { ApiClientObjectMap } from '../../../src/protos/firestore_proto_api';
31
32
  import { Connection, Stream } from '../../../src/remote/connection';
32
33
  import { Datastore } from '../../../src/remote/datastore';
33
34
  import { StreamBridge } from '../../../src/remote/stream_bridge';
@@ -102,7 +103,10 @@ export declare class MockConnection implements Connection {
102
103
  * stream, as a mapping from target ID to query Target.
103
104
  */
104
105
  activeTargets: {
105
- [targetId: number]: api.Target;
106
+ [targetId: number]: {
107
+ target: api.Target;
108
+ labels?: ApiClientObjectMap<string>;
109
+ };
106
110
  };
107
111
  /** A Deferred that is resolved once watch opens. */
108
112
  watchOpen: Deferred<void>;