@firebase/firestore 3.7.3 → 3.8.0

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 (120) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/firestore/lite/index.d.ts +1 -1
  3. package/dist/firestore/src/api/filter.d.ts +1 -1
  4. package/dist/firestore/src/api.d.ts +1 -1
  5. package/dist/firestore/src/core/bound.d.ts +49 -0
  6. package/dist/firestore/src/core/filter.d.ts +134 -0
  7. package/dist/firestore/src/core/order_by.d.ts +35 -0
  8. package/dist/firestore/src/core/query.d.ts +5 -6
  9. package/dist/firestore/src/core/target.d.ts +4 -120
  10. package/dist/firestore/src/lite-api/query.d.ts +273 -66
  11. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  12. package/dist/firestore/src/local/local_documents_view.d.ts +0 -2
  13. package/dist/firestore/src/model/document.d.ts +8 -1
  14. package/dist/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  15. package/dist/firestore/src/remote/serializer.d.ts +10 -3
  16. package/dist/firestore/src/util/logic_utils.d.ts +52 -0
  17. package/dist/firestore/src/util/types.d.ts +1 -1
  18. package/dist/firestore/test/lite/helpers.d.ts +1 -1
  19. package/dist/firestore/test/unit/core/filter.test.d.ts +17 -0
  20. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  21. package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  22. package/dist/firestore/test/util/helpers.d.ts +6 -2
  23. package/dist/firestore/test/util/test_platform.d.ts +2 -2
  24. package/dist/index.d.ts +138 -62
  25. package/dist/index.esm2017.js +4295 -3742
  26. package/dist/index.esm2017.js.map +1 -1
  27. package/dist/index.esm5.js +4981 -4410
  28. package/dist/index.esm5.js.map +1 -1
  29. package/dist/index.node.cjs.js +1657 -889
  30. package/dist/index.node.cjs.js.map +1 -1
  31. package/dist/index.node.mjs +1650 -890
  32. package/dist/index.node.mjs.map +1 -1
  33. package/dist/index.rn.js +4520 -3967
  34. package/dist/index.rn.js.map +1 -1
  35. package/dist/internal.d.ts +328 -68
  36. package/dist/lite/firestore/lite/index.d.ts +1 -1
  37. package/dist/lite/firestore/src/api/filter.d.ts +1 -1
  38. package/dist/lite/firestore/src/api.d.ts +1 -1
  39. package/dist/lite/firestore/src/core/bound.d.ts +49 -0
  40. package/dist/lite/firestore/src/core/filter.d.ts +134 -0
  41. package/dist/lite/firestore/src/core/order_by.d.ts +35 -0
  42. package/dist/lite/firestore/src/core/query.d.ts +5 -6
  43. package/dist/lite/firestore/src/core/target.d.ts +4 -120
  44. package/dist/lite/firestore/src/lite-api/query.d.ts +273 -66
  45. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  46. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -2
  47. package/dist/lite/firestore/src/model/document.d.ts +8 -1
  48. package/dist/lite/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  49. package/dist/lite/firestore/src/remote/serializer.d.ts +10 -3
  50. package/dist/lite/firestore/src/util/logic_utils.d.ts +52 -0
  51. package/dist/lite/firestore/src/util/types.d.ts +1 -1
  52. package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
  53. package/dist/lite/firestore/test/unit/core/filter.test.d.ts +17 -0
  54. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  55. package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  56. package/dist/lite/firestore/test/util/helpers.d.ts +6 -2
  57. package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
  58. package/dist/lite/index.browser.esm2017.js +2091 -1793
  59. package/dist/lite/index.browser.esm2017.js.map +1 -1
  60. package/dist/lite/index.browser.esm5.js +2239 -2000
  61. package/dist/lite/index.browser.esm5.js.map +1 -1
  62. package/dist/lite/index.d.ts +138 -62
  63. package/dist/lite/index.node.cjs.js +2212 -1802
  64. package/dist/lite/index.node.cjs.js.map +1 -1
  65. package/dist/lite/index.node.mjs +2205 -1803
  66. package/dist/lite/index.node.mjs.map +1 -1
  67. package/dist/lite/index.rn.esm2017.js +2077 -1778
  68. package/dist/lite/index.rn.esm2017.js.map +1 -1
  69. package/dist/lite/internal.d.ts +328 -66
  70. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +322 -174
  71. package/dist/lite/packages/firestore/lite/index.d.ts +1 -1
  72. package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
  73. package/dist/lite/packages/firestore/src/api/filter.d.ts +1 -1
  74. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  75. package/dist/lite/packages/firestore/src/core/bound.d.ts +49 -0
  76. package/dist/lite/packages/firestore/src/core/filter.d.ts +134 -0
  77. package/dist/lite/packages/firestore/src/core/order_by.d.ts +35 -0
  78. package/dist/lite/packages/firestore/src/core/query.d.ts +5 -6
  79. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -120
  80. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +273 -66
  81. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  82. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  83. package/dist/lite/packages/firestore/src/model/document.d.ts +8 -1
  84. package/dist/lite/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  85. package/dist/lite/packages/firestore/src/remote/serializer.d.ts +10 -3
  86. package/dist/lite/packages/firestore/src/util/logic_utils.d.ts +52 -0
  87. package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
  88. package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
  89. package/dist/lite/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  90. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  91. package/dist/lite/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  92. package/dist/lite/packages/firestore/test/util/helpers.d.ts +6 -2
  93. package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
  94. package/dist/lite/private.d.ts +240 -66
  95. package/dist/packages/firestore/dist/index.esm2017.d.ts +368 -208
  96. package/dist/packages/firestore/lite/index.d.ts +1 -1
  97. package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
  98. package/dist/packages/firestore/src/api/filter.d.ts +1 -1
  99. package/dist/packages/firestore/src/api.d.ts +1 -1
  100. package/dist/packages/firestore/src/core/bound.d.ts +49 -0
  101. package/dist/packages/firestore/src/core/filter.d.ts +134 -0
  102. package/dist/packages/firestore/src/core/order_by.d.ts +35 -0
  103. package/dist/packages/firestore/src/core/query.d.ts +5 -6
  104. package/dist/packages/firestore/src/core/target.d.ts +4 -120
  105. package/dist/packages/firestore/src/lite-api/query.d.ts +273 -66
  106. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
  107. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -2
  108. package/dist/packages/firestore/src/model/document.d.ts +8 -1
  109. package/dist/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
  110. package/dist/packages/firestore/src/remote/serializer.d.ts +10 -3
  111. package/dist/packages/firestore/src/util/logic_utils.d.ts +52 -0
  112. package/dist/packages/firestore/src/util/types.d.ts +1 -1
  113. package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
  114. package/dist/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
  115. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
  116. package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
  117. package/dist/packages/firestore/test/util/helpers.d.ts +6 -2
  118. package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
  119. package/dist/private.d.ts +240 -68
  120. package/package.json +13 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @firebase/firestore
2
2
 
3
+ ## 3.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ab3f16cba`](https://github.com/firebase/firebase-js-sdk/commit/ab3f16cbabc420fab0a322a21c9e28d3cbed4f24) [#6796](https://github.com/firebase/firebase-js-sdk/pull/6796) - Upgrade TypeScript to 4.7.4 (was 4.2.2)
8
+
9
+ - [`fde5adf63`](https://github.com/firebase/firebase-js-sdk/commit/fde5adf638dae4714ff7f25c75e475344907e05e) [#6694](https://github.com/firebase/firebase-js-sdk/pull/6694) - Functions in the Firestore package that return QueryConstraints (for example: `where(...)`, `limit(...)`, and `orderBy(...)`)
10
+ now return a more specific type, which extends QueryConstraint. Refactoring and code that supports future features is also
11
+ included in this release.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`c20633ed3`](https://github.com/firebase/firebase-js-sdk/commit/c20633ed35056cbadc9d65d9ceddf4e28d1ea666), [`1625f7a95`](https://github.com/firebase/firebase-js-sdk/commit/1625f7a95cc3ffb666845db0a8044329be74b5be)]:
16
+ - @firebase/util@1.8.0
17
+ - @firebase/component@0.6.0
18
+ - @firebase/logger@0.4.0
19
+ - @firebase/webchannel-wrapper@0.9.0
20
+
3
21
  ## 3.7.3
4
22
 
5
23
  ### Patch Changes
@@ -11,7 +11,7 @@ export { AggregateField, AggregateFieldType, AggregateSpec, AggregateSpecData, A
11
11
  export { FirestoreSettings as Settings } from '../src/lite-api/settings';
12
12
  export { Firestore as Firestore, EmulatorMockTokenOptions, initializeFirestore, getFirestore, terminate, connectFirestoreEmulator } from '../src/lite-api/database';
13
13
  export { DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, SetOptions, DocumentReference, Query, CollectionReference, collection, collectionGroup, doc, refEqual, queryEqual } from '../src/lite-api/reference';
14
- export { endAt, endBefore, startAt, startAfter, limit, limitToLast, orderBy, OrderByDirection, where, WhereFilterOp, query, QueryConstraint, QueryConstraintType } from '../src/lite-api/query';
14
+ export { and, endAt, endBefore, startAt, startAfter, limit, limitToLast, where, or, orderBy, query, QueryConstraint, QueryConstraintType, QueryCompositeFilterConstraint, QueryFilterConstraint, QueryFieldFilterConstraint, QueryOrderByConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryStartAtConstraint, QueryEndAtConstraint, OrderByDirection, WhereFilterOp } from '../src/lite-api/query';
15
15
  export { addDoc, deleteDoc, updateDoc, setDoc, getDoc, getDocs } from '../src/lite-api/reference_impl';
16
16
  export { Primitive, NestedUpdateFields, ChildUpdateFields, AddPrefixToKeys, UnionToIntersection } from '../src/lite-api/types';
17
17
  export { FieldPath, documentId } from '../src/lite-api/field_path';
@@ -14,4 +14,4 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- export { endAt, endBefore, startAfter, startAt, limitToLast, limit, orderBy, OrderByDirection, where, WhereFilterOp, query, QueryConstraint, QueryConstraintType } from '../lite-api/query';
17
+ export { and, endAt, endBefore, startAfter, startAt, limitToLast, limit, or, orderBy, OrderByDirection, where, WhereFilterOp, query, QueryCompositeFilterConstraint, QueryConstraint, QueryConstraintType, QueryFilterConstraint, QueryFieldFilterConstraint, QueryOrderByConstraint, QueryLimitConstraint, QueryStartAtConstraint, QueryEndAtConstraint, QueryNonFilterConstraint } from '../lite-api/query';
@@ -22,7 +22,7 @@ export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle'
22
22
  export { FirestoreSettings, PersistenceSettings } from './api/settings';
23
23
  export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotOptions, FirestoreDataConverter, DocumentChangeType, SnapshotMetadata } from './api/snapshot';
24
24
  export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
25
- export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
25
+ export { and, endAt, endBefore, startAt, startAfter, limit, limitToLast, where, or, orderBy, query, QueryConstraint, QueryConstraintType, QueryCompositeFilterConstraint, QueryFilterConstraint, QueryFieldFilterConstraint, QueryOrderByConstraint, QueryLimitConstraint, QueryNonFilterConstraint, QueryStartAtConstraint, QueryEndAtConstraint, OrderByDirection, WhereFilterOp } from './api/filter';
26
26
  export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
27
27
  export { TransactionOptions } from './api/transaction_options';
28
28
  export { runTransaction, Transaction } from './api/transaction';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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
+ import { Document } from '../model/document';
18
+ import { Value as ProtoValue } from '../protos/firestore_proto_api';
19
+ import { OrderBy } from './order_by';
20
+ /**
21
+ * Represents a bound of a query.
22
+ *
23
+ * The bound is specified with the given components representing a position and
24
+ * whether it's just before or just after the position (relative to whatever the
25
+ * query order is).
26
+ *
27
+ * The position represents a logical index position for a query. It's a prefix
28
+ * of values for the (potentially implicit) order by clauses of a query.
29
+ *
30
+ * Bound provides a function to determine whether a document comes before or
31
+ * after a bound. This is influenced by whether the position is just before or
32
+ * just after the provided values.
33
+ */
34
+ export declare class Bound {
35
+ readonly position: ProtoValue[];
36
+ readonly inclusive: boolean;
37
+ constructor(position: ProtoValue[], inclusive: boolean);
38
+ }
39
+ /**
40
+ * Returns true if a document sorts after a bound using the provided sort
41
+ * order.
42
+ */
43
+ export declare function boundSortsAfterDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
44
+ /**
45
+ * Returns true if a document sorts before a bound using the provided sort
46
+ * order.
47
+ */
48
+ export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
49
+ export declare function boundEquals(left: Bound | null, right: Bound | null): boolean;
@@ -0,0 +1,134 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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
+ import { Document } from '../model/document';
18
+ import { FieldPath } from '../model/path';
19
+ import { Value as ProtoValue } from '../protos/firestore_proto_api';
20
+ export declare const enum Operator {
21
+ LESS_THAN = "<",
22
+ LESS_THAN_OR_EQUAL = "<=",
23
+ EQUAL = "==",
24
+ NOT_EQUAL = "!=",
25
+ GREATER_THAN = ">",
26
+ GREATER_THAN_OR_EQUAL = ">=",
27
+ ARRAY_CONTAINS = "array-contains",
28
+ IN = "in",
29
+ NOT_IN = "not-in",
30
+ ARRAY_CONTAINS_ANY = "array-contains-any"
31
+ }
32
+ export declare const enum CompositeOperator {
33
+ OR = "or",
34
+ AND = "and"
35
+ }
36
+ export declare abstract class Filter {
37
+ abstract matches(doc: Document): boolean;
38
+ abstract getFlattenedFilters(): readonly FieldFilter[];
39
+ abstract getFilters(): Filter[];
40
+ abstract getFirstInequalityField(): FieldPath | null;
41
+ }
42
+ export declare class FieldFilter extends Filter {
43
+ readonly field: FieldPath;
44
+ readonly op: Operator;
45
+ readonly value: ProtoValue;
46
+ protected constructor(field: FieldPath, op: Operator, value: ProtoValue);
47
+ /**
48
+ * Creates a filter based on the provided arguments.
49
+ */
50
+ static create(field: FieldPath, op: Operator, value: ProtoValue): FieldFilter;
51
+ private static createKeyFieldInFilter;
52
+ matches(doc: Document): boolean;
53
+ protected matchesComparison(comparison: number): boolean;
54
+ isInequality(): boolean;
55
+ getFlattenedFilters(): readonly FieldFilter[];
56
+ getFilters(): Filter[];
57
+ getFirstInequalityField(): FieldPath | null;
58
+ }
59
+ export declare class CompositeFilter extends Filter {
60
+ readonly filters: readonly Filter[];
61
+ readonly op: CompositeOperator;
62
+ private memoizedFlattenedFilters;
63
+ protected constructor(filters: readonly Filter[], op: CompositeOperator);
64
+ /**
65
+ * Creates a filter based on the provided arguments.
66
+ */
67
+ static create(filters: Filter[], op: CompositeOperator): CompositeFilter;
68
+ matches(doc: Document): boolean;
69
+ getFlattenedFilters(): readonly FieldFilter[];
70
+ getFilters(): Filter[];
71
+ getFirstInequalityField(): FieldPath | null;
72
+ private findFirstMatchingFilter;
73
+ }
74
+ export declare function compositeFilterIsConjunction(compositeFilter: CompositeFilter): boolean;
75
+ export declare function compositeFilterIsDisjunction(compositeFilter: CompositeFilter): boolean;
76
+ /**
77
+ * Returns true if this filter is a conjunction of field filters only. Returns false otherwise.
78
+ */
79
+ export declare function compositeFilterIsFlatConjunction(compositeFilter: CompositeFilter): boolean;
80
+ /**
81
+ * Returns true if this filter does not contain any composite filters. Returns false otherwise.
82
+ */
83
+ export declare function compositeFilterIsFlat(compositeFilter: CompositeFilter): boolean;
84
+ export declare function canonifyFilter(filter: Filter): string;
85
+ export declare function filterEquals(f1: Filter, f2: Filter): boolean;
86
+ export declare function fieldFilterEquals(f1: FieldFilter, f2: Filter): boolean;
87
+ export declare function compositeFilterEquals(f1: CompositeFilter, f2: Filter): boolean;
88
+ /**
89
+ * Returns a new composite filter that contains all filter from
90
+ * `compositeFilter` plus all the given filters in `otherFilters`.
91
+ */
92
+ export declare function compositeFilterWithAddedFilters(compositeFilter: CompositeFilter, otherFilters: Filter[]): CompositeFilter;
93
+ /** Returns a debug description for `filter`. */
94
+ export declare function stringifyFilter(filter: Filter): string;
95
+ export declare function stringifyCompositeFilter(filter: CompositeFilter): string;
96
+ export declare function stringifyFieldFilter(filter: FieldFilter): string;
97
+ /** Filter that matches on key fields (i.e. '__name__'). */
98
+ export declare class KeyFieldFilter extends FieldFilter {
99
+ private readonly key;
100
+ constructor(field: FieldPath, op: Operator, value: ProtoValue);
101
+ matches(doc: Document): boolean;
102
+ }
103
+ /** Filter that matches on key fields within an array. */
104
+ export declare class KeyFieldInFilter extends FieldFilter {
105
+ private readonly keys;
106
+ constructor(field: FieldPath, value: ProtoValue);
107
+ matches(doc: Document): boolean;
108
+ }
109
+ /** Filter that matches on key fields not present within an array. */
110
+ export declare class KeyFieldNotInFilter extends FieldFilter {
111
+ private readonly keys;
112
+ constructor(field: FieldPath, value: ProtoValue);
113
+ matches(doc: Document): boolean;
114
+ }
115
+ /** A Filter that implements the array-contains operator. */
116
+ export declare class ArrayContainsFilter extends FieldFilter {
117
+ constructor(field: FieldPath, value: ProtoValue);
118
+ matches(doc: Document): boolean;
119
+ }
120
+ /** A Filter that implements the IN operator. */
121
+ export declare class InFilter extends FieldFilter {
122
+ constructor(field: FieldPath, value: ProtoValue);
123
+ matches(doc: Document): boolean;
124
+ }
125
+ /** A Filter that implements the not-in operator. */
126
+ export declare class NotInFilter extends FieldFilter {
127
+ constructor(field: FieldPath, value: ProtoValue);
128
+ matches(doc: Document): boolean;
129
+ }
130
+ /** A Filter that implements the array-contains-any operator. */
131
+ export declare class ArrayContainsAnyFilter extends FieldFilter {
132
+ constructor(field: FieldPath, value: ProtoValue);
133
+ matches(doc: Document): boolean;
134
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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
+ import { FieldPath } from '../model/path';
18
+ /**
19
+ * The direction of sorting in an order by.
20
+ */
21
+ export declare const enum Direction {
22
+ ASCENDING = "asc",
23
+ DESCENDING = "desc"
24
+ }
25
+ /**
26
+ * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
27
+ */
28
+ export declare class OrderBy {
29
+ readonly field: FieldPath;
30
+ readonly dir: Direction;
31
+ constructor(field: FieldPath, dir?: Direction);
32
+ }
33
+ export declare function canonifyOrderBy(orderBy: OrderBy): string;
34
+ export declare function stringifyOrderBy(orderBy: OrderBy): string;
35
+ export declare function orderByEquals(left: OrderBy, right: OrderBy): boolean;
@@ -16,7 +16,10 @@
16
16
  */
17
17
  import { Document } from '../model/document';
18
18
  import { FieldPath, ResourcePath } from '../model/path';
19
- import { Bound, Filter, Operator, OrderBy, Target } from './target';
19
+ import { Bound } from './bound';
20
+ import { Filter } from './filter';
21
+ import { OrderBy } from './order_by';
22
+ import { Target } from './target';
20
23
  export declare const enum LimitType {
21
24
  First = "F",
22
25
  Last = "L"
@@ -77,13 +80,9 @@ export declare function asCollectionQueryAtPath(query: Query, path: ResourcePath
77
80
  * could remove results.
78
81
  */
79
82
  export declare function queryMatchesAllDocuments(query: Query): boolean;
83
+ export declare function queryContainsCompositeFilters(query: Query): boolean;
80
84
  export declare function getFirstOrderByField(query: Query): FieldPath | null;
81
85
  export declare function getInequalityFilterField(query: Query): FieldPath | null;
82
- /**
83
- * Checks if any of the provided Operators are included in the query and
84
- * returns the first one that is, or null if none are.
85
- */
86
- export declare function findFilterOperator(query: Query, operators: Operator[]): Operator | null;
87
86
  /**
88
87
  * Creates a new Query for a collection group query that matches all documents
89
88
  * within the provided collection group.
@@ -14,10 +14,12 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { Document } from '../model/document';
18
17
  import { FieldIndex } from '../model/field_index';
19
18
  import { FieldPath, ResourcePath } from '../model/path';
20
19
  import { Value as ProtoValue } from '../protos/firestore_proto_api';
20
+ import { Bound } from './bound';
21
+ import { Filter, FieldFilter } from './filter';
22
+ import { OrderBy } from './order_by';
21
23
  /**
22
24
  * A Target represents the WatchTarget representation of a Query, which is used
23
25
  * by the LocalStore and the RemoteStore to keep track of and to execute
@@ -84,122 +86,4 @@ export declare function targetGetLowerBound(target: Target, fieldIndex: FieldInd
84
86
  export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound;
85
87
  /** Returns the number of segments of a perfect index for this target. */
86
88
  export declare function targetGetSegmentCount(target: Target): number;
87
- export declare abstract class Filter {
88
- abstract matches(doc: Document): boolean;
89
- }
90
- export declare const enum Operator {
91
- LESS_THAN = "<",
92
- LESS_THAN_OR_EQUAL = "<=",
93
- EQUAL = "==",
94
- NOT_EQUAL = "!=",
95
- GREATER_THAN = ">",
96
- GREATER_THAN_OR_EQUAL = ">=",
97
- ARRAY_CONTAINS = "array-contains",
98
- IN = "in",
99
- NOT_IN = "not-in",
100
- ARRAY_CONTAINS_ANY = "array-contains-any"
101
- }
102
- /**
103
- * The direction of sorting in an order by.
104
- */
105
- export declare const enum Direction {
106
- ASCENDING = "asc",
107
- DESCENDING = "desc"
108
- }
109
- export declare class FieldFilter extends Filter {
110
- field: FieldPath;
111
- op: Operator;
112
- value: ProtoValue;
113
- protected constructor(field: FieldPath, op: Operator, value: ProtoValue);
114
- /**
115
- * Creates a filter based on the provided arguments.
116
- */
117
- static create(field: FieldPath, op: Operator, value: ProtoValue): FieldFilter;
118
- private static createKeyFieldInFilter;
119
- matches(doc: Document): boolean;
120
- protected matchesComparison(comparison: number): boolean;
121
- isInequality(): boolean;
122
- }
123
- export declare function canonifyFilter(filter: Filter): string;
124
- export declare function filterEquals(f1: Filter, f2: Filter): boolean;
125
- /** Returns a debug description for `filter`. */
126
- export declare function stringifyFilter(filter: Filter): string;
127
- /** Filter that matches on key fields (i.e. '__name__'). */
128
- export declare class KeyFieldFilter extends FieldFilter {
129
- private readonly key;
130
- constructor(field: FieldPath, op: Operator, value: ProtoValue);
131
- matches(doc: Document): boolean;
132
- }
133
- /** Filter that matches on key fields within an array. */
134
- export declare class KeyFieldInFilter extends FieldFilter {
135
- private readonly keys;
136
- constructor(field: FieldPath, value: ProtoValue);
137
- matches(doc: Document): boolean;
138
- }
139
- /** Filter that matches on key fields not present within an array. */
140
- export declare class KeyFieldNotInFilter extends FieldFilter {
141
- private readonly keys;
142
- constructor(field: FieldPath, value: ProtoValue);
143
- matches(doc: Document): boolean;
144
- }
145
- /** A Filter that implements the array-contains operator. */
146
- export declare class ArrayContainsFilter extends FieldFilter {
147
- constructor(field: FieldPath, value: ProtoValue);
148
- matches(doc: Document): boolean;
149
- }
150
- /** A Filter that implements the IN operator. */
151
- export declare class InFilter extends FieldFilter {
152
- constructor(field: FieldPath, value: ProtoValue);
153
- matches(doc: Document): boolean;
154
- }
155
- /** A Filter that implements the not-in operator. */
156
- export declare class NotInFilter extends FieldFilter {
157
- constructor(field: FieldPath, value: ProtoValue);
158
- matches(doc: Document): boolean;
159
- }
160
- /** A Filter that implements the array-contains-any operator. */
161
- export declare class ArrayContainsAnyFilter extends FieldFilter {
162
- constructor(field: FieldPath, value: ProtoValue);
163
- matches(doc: Document): boolean;
164
- }
165
- /**
166
- * Represents a bound of a query.
167
- *
168
- * The bound is specified with the given components representing a position and
169
- * whether it's just before or just after the position (relative to whatever the
170
- * query order is).
171
- *
172
- * The position represents a logical index position for a query. It's a prefix
173
- * of values for the (potentially implicit) order by clauses of a query.
174
- *
175
- * Bound provides a function to determine whether a document comes before or
176
- * after a bound. This is influenced by whether the position is just before or
177
- * just after the provided values.
178
- */
179
- export declare class Bound {
180
- readonly position: ProtoValue[];
181
- readonly inclusive: boolean;
182
- constructor(position: ProtoValue[], inclusive: boolean);
183
- }
184
- /**
185
- * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
186
- */
187
- export declare class OrderBy {
188
- readonly field: FieldPath;
189
- readonly dir: Direction;
190
- constructor(field: FieldPath, dir?: Direction);
191
- }
192
- export declare function canonifyOrderBy(orderBy: OrderBy): string;
193
- export declare function stringifyOrderBy(orderBy: OrderBy): string;
194
- export declare function orderByEquals(left: OrderBy, right: OrderBy): boolean;
195
- /**
196
- * Returns true if a document sorts after a bound using the provided sort
197
- * order.
198
- */
199
- export declare function boundSortsAfterDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
200
- /**
201
- * Returns true if a document sorts before a bound using the provided sort
202
- * order.
203
- */
204
- export declare function boundSortsBeforeDocument(bound: Bound, orderBy: OrderBy[], doc: Document): boolean;
205
- export declare function boundEquals(left: Bound | null, right: Bound | null): boolean;
89
+ export declare function targetHasLimit(target: Target): boolean;