@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.
- package/CHANGELOG.md +18 -0
- package/dist/firestore/lite/index.d.ts +1 -1
- package/dist/firestore/src/api/filter.d.ts +1 -1
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/bound.d.ts +49 -0
- package/dist/firestore/src/core/filter.d.ts +134 -0
- package/dist/firestore/src/core/order_by.d.ts +35 -0
- package/dist/firestore/src/core/query.d.ts +5 -6
- package/dist/firestore/src/core/target.d.ts +4 -120
- package/dist/firestore/src/lite-api/query.d.ts +273 -66
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
- package/dist/firestore/src/local/local_documents_view.d.ts +0 -2
- package/dist/firestore/src/model/document.d.ts +8 -1
- package/dist/firestore/src/protos/firestore_proto_api.d.ts +1 -1
- package/dist/firestore/src/remote/serializer.d.ts +10 -3
- package/dist/firestore/src/util/logic_utils.d.ts +52 -0
- package/dist/firestore/src/util/types.d.ts +1 -1
- package/dist/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/firestore/test/unit/core/filter.test.d.ts +17 -0
- package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
- package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +6 -2
- package/dist/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/index.d.ts +138 -62
- package/dist/index.esm2017.js +4295 -3742
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4981 -4410
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1657 -889
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1650 -890
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4520 -3967
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +328 -68
- package/dist/lite/firestore/lite/index.d.ts +1 -1
- package/dist/lite/firestore/src/api/filter.d.ts +1 -1
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/bound.d.ts +49 -0
- package/dist/lite/firestore/src/core/filter.d.ts +134 -0
- package/dist/lite/firestore/src/core/order_by.d.ts +35 -0
- package/dist/lite/firestore/src/core/query.d.ts +5 -6
- package/dist/lite/firestore/src/core/target.d.ts +4 -120
- package/dist/lite/firestore/src/lite-api/query.d.ts +273 -66
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -2
- package/dist/lite/firestore/src/model/document.d.ts +8 -1
- package/dist/lite/firestore/src/protos/firestore_proto_api.d.ts +1 -1
- package/dist/lite/firestore/src/remote/serializer.d.ts +10 -3
- package/dist/lite/firestore/src/util/logic_utils.d.ts +52 -0
- package/dist/lite/firestore/src/util/types.d.ts +1 -1
- package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/lite/firestore/test/unit/core/filter.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
- package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +6 -2
- package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +2091 -1793
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2239 -2000
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +138 -62
- package/dist/lite/index.node.cjs.js +2212 -1802
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2205 -1803
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2077 -1778
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +328 -66
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +322 -174
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -1
- package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
- package/dist/lite/packages/firestore/src/api/filter.d.ts +1 -1
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/bound.d.ts +49 -0
- package/dist/lite/packages/firestore/src/core/filter.d.ts +134 -0
- package/dist/lite/packages/firestore/src/core/order_by.d.ts +35 -0
- package/dist/lite/packages/firestore/src/core/query.d.ts +5 -6
- package/dist/lite/packages/firestore/src/core/target.d.ts +4 -120
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +273 -66
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -2
- package/dist/lite/packages/firestore/src/model/document.d.ts +8 -1
- package/dist/lite/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/remote/serializer.d.ts +10 -3
- package/dist/lite/packages/firestore/src/util/logic_utils.d.ts +52 -0
- package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
- package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
- package/dist/lite/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +6 -2
- package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/lite/private.d.ts +240 -66
- package/dist/packages/firestore/dist/index.esm2017.d.ts +368 -208
- package/dist/packages/firestore/lite/index.d.ts +1 -1
- package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
- package/dist/packages/firestore/src/api/filter.d.ts +1 -1
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/bound.d.ts +49 -0
- package/dist/packages/firestore/src/core/filter.d.ts +134 -0
- package/dist/packages/firestore/src/core/order_by.d.ts +35 -0
- package/dist/packages/firestore/src/core/query.d.ts +5 -6
- package/dist/packages/firestore/src/core/target.d.ts +4 -120
- package/dist/packages/firestore/src/lite-api/query.d.ts +273 -66
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +2 -0
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -2
- package/dist/packages/firestore/src/model/document.d.ts +8 -1
- package/dist/packages/firestore/src/protos/firestore_proto_api.d.ts +1 -1
- package/dist/packages/firestore/src/remote/serializer.d.ts +10 -3
- package/dist/packages/firestore/src/util/logic_utils.d.ts +52 -0
- package/dist/packages/firestore/src/util/types.d.ts +1 -1
- package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/packages/firestore/test/unit/core/filter.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +2 -1
- package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +6 -2
- package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/private.d.ts +240 -68
- package/package.json +13 -11
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { Bound } from '../core/bound';
|
|
17
18
|
import { DatabaseId } from '../core/database_info';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { CompositeOperator, FieldFilter, Filter, Operator } from '../core/filter';
|
|
20
|
+
import { Direction, OrderBy } from '../core/order_by';
|
|
21
|
+
import { LimitType, Query as InternalQuery } from '../core/query';
|
|
20
22
|
import { Document } from '../model/document';
|
|
21
23
|
import { FieldPath as InternalFieldPath } from '../model/path';
|
|
22
24
|
import { FieldPath } from './field_path';
|
|
@@ -26,33 +28,82 @@ import { UserDataReader } from './user_data_reader';
|
|
|
26
28
|
export declare function validateHasExplicitOrderByForLimitToLast(query: InternalQuery): void;
|
|
27
29
|
/** Describes the different query constraints available in this SDK. */
|
|
28
30
|
export declare type QueryConstraintType = 'where' | 'orderBy' | 'limit' | 'limitToLast' | 'startAt' | 'startAfter' | 'endAt' | 'endBefore';
|
|
31
|
+
/**
|
|
32
|
+
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
33
|
+
* to a Firestore query.
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class AppliableConstraint {
|
|
36
|
+
/**
|
|
37
|
+
* Takes the provided {@link Query} and returns a copy of the {@link Query} with this
|
|
38
|
+
* {@link AppliableConstraint} applied.
|
|
39
|
+
*/
|
|
40
|
+
abstract _apply<T>(query: Query<T>): Query<T>;
|
|
41
|
+
}
|
|
29
42
|
/**
|
|
30
43
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
31
44
|
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
32
|
-
* {@link orderBy}, {@link
|
|
33
|
-
* endBefore
|
|
45
|
+
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
|
|
46
|
+
* endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
|
|
34
47
|
* can then be passed to {@link query} to create a new query instance that
|
|
35
48
|
* also contains this `QueryConstraint`.
|
|
36
49
|
*/
|
|
37
|
-
export declare abstract class QueryConstraint {
|
|
38
|
-
/** The type of this query
|
|
50
|
+
export declare abstract class QueryConstraint extends AppliableConstraint {
|
|
51
|
+
/** The type of this query constraint */
|
|
39
52
|
abstract readonly type: QueryConstraintType;
|
|
40
53
|
/**
|
|
41
54
|
* Takes the provided {@link Query} and returns a copy of the {@link Query} with this
|
|
42
|
-
* {@link
|
|
55
|
+
* {@link AppliableConstraint} applied.
|
|
43
56
|
*/
|
|
44
57
|
abstract _apply<T>(query: Query<T>): Query<T>;
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
47
|
-
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
48
|
-
* additional query constraints.
|
|
60
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
61
|
+
* include additional query constraints.
|
|
62
|
+
*
|
|
63
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
64
|
+
* constraints.
|
|
65
|
+
* @param compositeFilter - The {@link QueryCompositeFilterConstraint} to
|
|
66
|
+
* apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or
|
|
67
|
+
* {@link or}.
|
|
68
|
+
* @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to
|
|
69
|
+
* apply (e.g. {@link orderBy}, {@link limit}).
|
|
70
|
+
* @throws if any of the provided query constraints cannot be combined with the
|
|
71
|
+
* existing or new constraints.
|
|
72
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
73
|
+
*/
|
|
74
|
+
export declare function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
77
|
+
* include additional query constraints.
|
|
49
78
|
*
|
|
50
|
-
* @param query - The {@link Query} instance to use as a base for the new
|
|
79
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
80
|
+
* constraints.
|
|
51
81
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
52
82
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
53
83
|
* existing or new constraints.
|
|
54
84
|
*/
|
|
55
85
|
export declare function query<T>(query: Query<T>, ...queryConstraints: QueryConstraint[]): Query<T>;
|
|
86
|
+
/**
|
|
87
|
+
* A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
|
|
88
|
+
* a Firestore query by filtering on one or more document fields.
|
|
89
|
+
* `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
|
|
91
|
+
* this `QueryFieldFilterConstraint`.
|
|
92
|
+
*/
|
|
93
|
+
export declare class QueryFieldFilterConstraint extends QueryConstraint {
|
|
94
|
+
private readonly _field;
|
|
95
|
+
private _op;
|
|
96
|
+
private _value;
|
|
97
|
+
/** The type of this query constraint */
|
|
98
|
+
readonly type = "where";
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
protected constructor(_field: InternalFieldPath, _op: Operator, _value: unknown);
|
|
103
|
+
static _create(_field: InternalFieldPath, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
|
|
104
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
105
|
+
_parse<T>(query: Query<T>): FieldFilter;
|
|
106
|
+
}
|
|
56
107
|
/**
|
|
57
108
|
* Filter conditions in a {@link where} clause are specified using the
|
|
58
109
|
* strings '<', '<=', '==', '!=', '>=', '>', 'array-contains', 'in',
|
|
@@ -60,129 +111,284 @@ export declare function query<T>(query: Query<T>, ...queryConstraints: QueryCons
|
|
|
60
111
|
*/
|
|
61
112
|
export declare type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'array-contains-any' | 'not-in';
|
|
62
113
|
/**
|
|
63
|
-
* Creates a {@link
|
|
64
|
-
* specified field and that the value should satisfy the
|
|
65
|
-
* provided.
|
|
114
|
+
* Creates a {@link QueryFieldFilterConstraint} that enforces that documents
|
|
115
|
+
* must contain the specified field and that the value should satisfy the
|
|
116
|
+
* relation constraint provided.
|
|
66
117
|
*
|
|
67
118
|
* @param fieldPath - The path to compare
|
|
68
119
|
* @param opStr - The operation string (e.g "<", "<=", "==", "<",
|
|
69
120
|
* "<=", "!=").
|
|
70
121
|
* @param value - The value for comparison
|
|
71
|
-
* @returns The created {@link
|
|
122
|
+
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
123
|
+
*/
|
|
124
|
+
export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
|
|
125
|
+
/**
|
|
126
|
+
* A `QueryCompositeFilterConstraint` is used to narrow the set of documents
|
|
127
|
+
* returned by a Firestore query by performing the logical OR or AND of multiple
|
|
128
|
+
* {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
|
|
129
|
+
* `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
|
|
131
|
+
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
132
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
133
|
+
*/
|
|
134
|
+
export declare class QueryCompositeFilterConstraint extends AppliableConstraint {
|
|
135
|
+
/** The type of this query constraint */
|
|
136
|
+
readonly type: 'or' | 'and';
|
|
137
|
+
private readonly _queryConstraints;
|
|
138
|
+
/**
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
protected constructor(
|
|
142
|
+
/** The type of this query constraint */
|
|
143
|
+
type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]);
|
|
144
|
+
static _create(type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
145
|
+
_parse<T>(query: Query<T>): Filter;
|
|
146
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
147
|
+
_getQueryConstraints(): readonly AppliableConstraint[];
|
|
148
|
+
_getOperator(): CompositeOperator;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* `QueryNonFilterConstraint` is a helper union type that represents
|
|
152
|
+
* QueryConstraints which are used to narrow or order the set of documents,
|
|
153
|
+
* but that do not explicitly filter on a document field.
|
|
154
|
+
* `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}
|
|
157
|
+
* to create a new query instance that also contains the `QueryConstraint`.
|
|
158
|
+
*/
|
|
159
|
+
export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
|
|
160
|
+
/**
|
|
161
|
+
* `QueryFilterConstraint` is a helper union type that represents
|
|
162
|
+
* {@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
|
+
*/
|
|
168
|
+
export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
|
|
169
|
+
/**
|
|
170
|
+
* Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
|
|
171
|
+
* of all the provided {@link QueryFilterConstraint}s.
|
|
172
|
+
*
|
|
173
|
+
* @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
|
|
174
|
+
* for OR operation. These must be created with calls to {@link where},
|
|
175
|
+
* {@link or}, or {@link and}.
|
|
176
|
+
* @returns The created {@link QueryCompositeFilterConstraint}.
|
|
177
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
178
|
+
*/
|
|
179
|
+
export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
180
|
+
/**
|
|
181
|
+
* Creates a {@link QueryCompositeFilterConstraint} that performs a logical AND
|
|
182
|
+
* of all the provided {@link QueryFilterConstraint}s.
|
|
183
|
+
*
|
|
184
|
+
* @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
|
|
185
|
+
* for AND operation. These must be created with calls to {@link where},
|
|
186
|
+
* {@link or}, or {@link and}.
|
|
187
|
+
* @returns The created {@link QueryCompositeFilterConstraint}.
|
|
188
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
189
|
+
*/
|
|
190
|
+
export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
191
|
+
/**
|
|
192
|
+
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
193
|
+
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
194
|
+
* {@link orderBy} and can then be passed to {@link query} to create a new query
|
|
195
|
+
* instance that also contains this `QueryOrderByConstraint`.
|
|
196
|
+
*
|
|
197
|
+
* Note: Documents that do not contain the orderBy field will not be present in
|
|
198
|
+
* the query result.
|
|
72
199
|
*/
|
|
73
|
-
export declare
|
|
200
|
+
export declare class QueryOrderByConstraint extends QueryConstraint {
|
|
201
|
+
private readonly _field;
|
|
202
|
+
private _direction;
|
|
203
|
+
/** The type of this query constraint */
|
|
204
|
+
readonly type = "orderBy";
|
|
205
|
+
/**
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
protected constructor(_field: InternalFieldPath, _direction: Direction);
|
|
209
|
+
static _create(_field: InternalFieldPath, _direction: Direction): QueryOrderByConstraint;
|
|
210
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
211
|
+
}
|
|
74
212
|
/**
|
|
75
213
|
* The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
|
|
76
214
|
* (descending or ascending).
|
|
77
215
|
*/
|
|
78
216
|
export declare type OrderByDirection = 'desc' | 'asc';
|
|
79
217
|
/**
|
|
80
|
-
* Creates a {@link
|
|
218
|
+
* Creates a {@link QueryOrderByConstraint} that sorts the query result by the
|
|
81
219
|
* specified field, optionally in descending order instead of ascending.
|
|
82
220
|
*
|
|
221
|
+
* Note: Documents that do not contain the specified field will not be present
|
|
222
|
+
* in the query result.
|
|
223
|
+
*
|
|
83
224
|
* @param fieldPath - The field to sort by.
|
|
84
225
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
85
226
|
* not specified, order will be ascending.
|
|
86
|
-
* @returns The created {@link
|
|
227
|
+
* @returns The created {@link QueryOrderByConstraint}.
|
|
87
228
|
*/
|
|
88
|
-
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection):
|
|
229
|
+
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
|
|
89
230
|
/**
|
|
90
|
-
*
|
|
231
|
+
* A `QueryLimitConstraint` is used to limit the number of documents returned by
|
|
232
|
+
* a Firestore query.
|
|
233
|
+
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
234
|
+
* {@link limitToLast} and can then be passed to {@link query} to create a new
|
|
235
|
+
* query instance that also contains this `QueryLimitConstraint`.
|
|
236
|
+
*/
|
|
237
|
+
export declare class QueryLimitConstraint extends QueryConstraint {
|
|
238
|
+
/** The type of this query constraint */
|
|
239
|
+
readonly type: 'limit' | 'limitToLast';
|
|
240
|
+
private readonly _limit;
|
|
241
|
+
private readonly _limitType;
|
|
242
|
+
/**
|
|
243
|
+
* @internal
|
|
244
|
+
*/
|
|
245
|
+
protected constructor(
|
|
246
|
+
/** The type of this query constraint */
|
|
247
|
+
type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType);
|
|
248
|
+
static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
|
|
249
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Creates a {@link QueryLimitConstraint} that only returns the first matching
|
|
253
|
+
* documents.
|
|
91
254
|
*
|
|
92
255
|
* @param limit - The maximum number of items to return.
|
|
93
|
-
* @returns The created {@link
|
|
256
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
94
257
|
*/
|
|
95
|
-
export declare function limit(limit: number):
|
|
258
|
+
export declare function limit(limit: number): QueryLimitConstraint;
|
|
96
259
|
/**
|
|
97
|
-
* Creates a {@link
|
|
260
|
+
* Creates a {@link QueryLimitConstraint} that only returns the last matching
|
|
261
|
+
* documents.
|
|
98
262
|
*
|
|
99
263
|
* You must specify at least one `orderBy` clause for `limitToLast` queries,
|
|
100
264
|
* otherwise an exception will be thrown during execution.
|
|
101
265
|
*
|
|
102
266
|
* @param limit - The maximum number of items to return.
|
|
103
|
-
* @returns The created {@link
|
|
267
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
104
268
|
*/
|
|
105
|
-
export declare function limitToLast(limit: number):
|
|
269
|
+
export declare function limitToLast(limit: number): QueryLimitConstraint;
|
|
106
270
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
271
|
+
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
272
|
+
* result set returned by a Firestore query.
|
|
273
|
+
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
274
|
+
* {@link (startAfter:1)} and can then be passed to {@link query} to create a
|
|
275
|
+
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
276
|
+
*/
|
|
277
|
+
export declare class QueryStartAtConstraint extends QueryConstraint {
|
|
278
|
+
/** The type of this query constraint */
|
|
279
|
+
readonly type: 'startAt' | 'startAfter';
|
|
280
|
+
private readonly _docOrFields;
|
|
281
|
+
private readonly _inclusive;
|
|
282
|
+
/**
|
|
283
|
+
* @internal
|
|
284
|
+
*/
|
|
285
|
+
protected constructor(
|
|
286
|
+
/** The type of this query constraint */
|
|
287
|
+
type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
288
|
+
static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
|
|
289
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
293
|
+
* start at the provided document (inclusive). The starting position is relative
|
|
294
|
+
* to the order of the query. The document must contain all of the fields
|
|
295
|
+
* provided in the `orderBy` of this query.
|
|
111
296
|
*
|
|
112
297
|
* @param snapshot - The snapshot of the document to start at.
|
|
113
|
-
* @returns A {@link
|
|
298
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
114
299
|
*/
|
|
115
|
-
export declare function startAt(snapshot: DocumentSnapshot<unknown>):
|
|
300
|
+
export declare function startAt(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
116
301
|
/**
|
|
117
|
-
* Creates a {@link
|
|
118
|
-
* provided fields relative to the order of the query. The order of
|
|
119
|
-
* values must match the order of the order by clauses of the query.
|
|
302
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
303
|
+
* start at the provided fields relative to the order of the query. The order of
|
|
304
|
+
* the field values must match the order of the order by clauses of the query.
|
|
120
305
|
*
|
|
121
306
|
* @param fieldValues - The field values to start this query at, in order
|
|
122
307
|
* of the query's order by.
|
|
123
|
-
* @returns A {@link
|
|
308
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
124
309
|
*/
|
|
125
|
-
export declare function startAt(...fieldValues: unknown[]):
|
|
310
|
+
export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
126
311
|
/**
|
|
127
|
-
* Creates a {@link
|
|
128
|
-
* provided document (exclusive). The starting position is
|
|
129
|
-
* of the query. The document must contain all of the
|
|
130
|
-
* orderBy of the query.
|
|
312
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
313
|
+
* start after the provided document (exclusive). The starting position is
|
|
314
|
+
* relative to the order of the query. The document must contain all of the
|
|
315
|
+
* fields provided in the orderBy of the query.
|
|
131
316
|
*
|
|
132
317
|
* @param snapshot - The snapshot of the document to start after.
|
|
133
|
-
* @returns A {@link
|
|
318
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
134
319
|
*/
|
|
135
|
-
export declare function startAfter(snapshot: DocumentSnapshot<unknown>):
|
|
320
|
+
export declare function startAfter(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
136
321
|
/**
|
|
137
|
-
* Creates a {@link
|
|
138
|
-
* provided fields relative to the order of the query. The order
|
|
139
|
-
* values must match the order of the order by clauses of the query.
|
|
322
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
323
|
+
* start after the provided fields relative to the order of the query. The order
|
|
324
|
+
* of the field values must match the order of the order by clauses of the query.
|
|
140
325
|
*
|
|
141
326
|
* @param fieldValues - The field values to start this query after, in order
|
|
142
327
|
* of the query's order by.
|
|
143
|
-
* @returns A {@link
|
|
328
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
144
329
|
*/
|
|
145
|
-
export declare function startAfter(...fieldValues: unknown[]):
|
|
330
|
+
export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
146
331
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
332
|
+
* A `QueryEndAtConstraint` is used to exclude documents from the end of a
|
|
333
|
+
* result set returned by a Firestore query.
|
|
334
|
+
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
335
|
+
* {@link (endBefore:1)} and can then be passed to {@link query} to create a new
|
|
336
|
+
* query instance that also contains this `QueryEndAtConstraint`.
|
|
337
|
+
*/
|
|
338
|
+
export declare class QueryEndAtConstraint extends QueryConstraint {
|
|
339
|
+
/** The type of this query constraint */
|
|
340
|
+
readonly type: 'endBefore' | 'endAt';
|
|
341
|
+
private readonly _docOrFields;
|
|
342
|
+
private readonly _inclusive;
|
|
343
|
+
/**
|
|
344
|
+
* @internal
|
|
345
|
+
*/
|
|
346
|
+
protected constructor(
|
|
347
|
+
/** The type of this query constraint */
|
|
348
|
+
type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
349
|
+
static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
|
|
350
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
354
|
+
* before the provided document (exclusive). The end position is relative to the
|
|
355
|
+
* order of the query. The document must contain all of the fields provided in
|
|
356
|
+
* the orderBy of the query.
|
|
151
357
|
*
|
|
152
358
|
* @param snapshot - The snapshot of the document to end before.
|
|
153
|
-
* @returns A {@link
|
|
359
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
154
360
|
*/
|
|
155
|
-
export declare function endBefore(snapshot: DocumentSnapshot<unknown>):
|
|
361
|
+
export declare function endBefore(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
156
362
|
/**
|
|
157
|
-
* Creates a {@link
|
|
158
|
-
* provided fields relative to the order of the query. The order of
|
|
159
|
-
* values must match the order of the order by clauses of the query.
|
|
363
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
364
|
+
* before the provided fields relative to the order of the query. The order of
|
|
365
|
+
* the field values must match the order of the order by clauses of the query.
|
|
160
366
|
*
|
|
161
367
|
* @param fieldValues - The field values to end this query before, in order
|
|
162
368
|
* of the query's order by.
|
|
163
|
-
* @returns A {@link
|
|
369
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
164
370
|
*/
|
|
165
|
-
export declare function endBefore(...fieldValues: unknown[]):
|
|
371
|
+
export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
166
372
|
/**
|
|
167
|
-
* Creates a {@link
|
|
168
|
-
* provided document (inclusive). The end position is relative to the order
|
|
169
|
-
* the query. The document must contain all of the fields provided in the
|
|
373
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
374
|
+
* the provided document (inclusive). The end position is relative to the order
|
|
375
|
+
* of the query. The document must contain all of the fields provided in the
|
|
170
376
|
* orderBy of the query.
|
|
171
377
|
*
|
|
172
378
|
* @param snapshot - The snapshot of the document to end at.
|
|
173
|
-
* @returns A {@link
|
|
379
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
174
380
|
*/
|
|
175
|
-
export declare function endAt(snapshot: DocumentSnapshot<unknown>):
|
|
381
|
+
export declare function endAt(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
176
382
|
/**
|
|
177
|
-
* Creates a {@link
|
|
178
|
-
* provided fields relative to the order of the query. The order of the field
|
|
383
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
384
|
+
* the provided fields relative to the order of the query. The order of the field
|
|
179
385
|
* values must match the order of the order by clauses of the query.
|
|
180
386
|
*
|
|
181
387
|
* @param fieldValues - The field values to end this query at, in order
|
|
182
388
|
* of the query's order by.
|
|
183
|
-
* @returns A {@link
|
|
389
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
184
390
|
*/
|
|
185
|
-
export declare function endAt(...fieldValues: unknown[]):
|
|
391
|
+
export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
186
392
|
export declare function newQueryFilter(query: InternalQuery, methodName: string, dataReader: UserDataReader, databaseId: DatabaseId, fieldPath: InternalFieldPath, op: Operator, value: unknown): FieldFilter;
|
|
187
393
|
export declare function newQueryOrderBy(query: InternalQuery, fieldPath: InternalFieldPath, direction: Direction): OrderBy;
|
|
188
394
|
/**
|
|
@@ -201,3 +407,4 @@ export declare function newQueryBoundFromDocument(query: InternalQuery, database
|
|
|
201
407
|
* Converts a list of field values to a `Bound` for the given query.
|
|
202
408
|
*/
|
|
203
409
|
export declare function newQueryBoundFromFields(query: InternalQuery, databaseId: DatabaseId, dataReader: UserDataReader, methodName: string, values: unknown[], inclusive: boolean): Bound;
|
|
410
|
+
export declare function validateQueryFilterConstraint(functionName: string, queryConstraint: AppliableConstraint): void;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { User } from '../auth/user';
|
|
18
18
|
import { DatabaseId } from '../core/database_info';
|
|
19
19
|
import { Target } from '../core/target';
|
|
20
|
+
import { IndexEntry } from '../index/index_entry';
|
|
20
21
|
import { DocumentMap } from '../model/collections';
|
|
21
22
|
import { DocumentKey } from '../model/document_key';
|
|
22
23
|
import { FieldIndex, IndexOffset } from '../model/field_index';
|
|
@@ -128,6 +129,7 @@ export declare class IndexedDbIndexManager implements IndexManager {
|
|
|
128
129
|
* '[foo > 2 && foo != 3]` becomes `[foo > 2 && < 3, foo > 3]`.
|
|
129
130
|
*/
|
|
130
131
|
private createRange;
|
|
132
|
+
isRangeMatchable(lowerBound: IndexEntry, upperBound: IndexEntry): boolean;
|
|
131
133
|
getMinOffsetFromCollectionGroup(transaction: PersistenceTransaction, collectionGroup: string): PersistencePromise<IndexOffset>;
|
|
132
134
|
getMinOffset(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexOffset>;
|
|
133
135
|
}
|
|
@@ -121,6 +121,4 @@ export declare class LocalDocumentsView {
|
|
|
121
121
|
private getDocumentsMatchingDocumentQuery;
|
|
122
122
|
private getDocumentsMatchingCollectionGroupQuery;
|
|
123
123
|
private getDocumentsMatchingCollectionQuery;
|
|
124
|
-
/** Returns a base document that can be used to apply `overlay`. */
|
|
125
|
-
private getBaseDocument;
|
|
126
124
|
}
|
|
@@ -35,6 +35,12 @@ export interface Document {
|
|
|
35
35
|
* `SnapshotVersion.min()` for documents created by the user.
|
|
36
36
|
*/
|
|
37
37
|
readonly readTime: SnapshotVersion;
|
|
38
|
+
/**
|
|
39
|
+
* The timestamp at which the document was created. This value increases
|
|
40
|
+
* monotonically when a document is deleted then recreated. It can also be
|
|
41
|
+
* compared to `createTime` of other documents and the `readTime` of a query.
|
|
42
|
+
*/
|
|
43
|
+
readonly createTime: SnapshotVersion;
|
|
38
44
|
/** The underlying data of this document or an empty value if no data exists. */
|
|
39
45
|
readonly data: ObjectValue;
|
|
40
46
|
/** Returns whether local mutations were applied via the mutation queue. */
|
|
@@ -85,6 +91,7 @@ export declare class MutableDocument implements Document {
|
|
|
85
91
|
private documentType;
|
|
86
92
|
version: SnapshotVersion;
|
|
87
93
|
readTime: SnapshotVersion;
|
|
94
|
+
createTime: SnapshotVersion;
|
|
88
95
|
data: ObjectValue;
|
|
89
96
|
private documentState;
|
|
90
97
|
private constructor();
|
|
@@ -97,7 +104,7 @@ export declare class MutableDocument implements Document {
|
|
|
97
104
|
* Creates a new document that is known to exist with the given data at the
|
|
98
105
|
* given version.
|
|
99
106
|
*/
|
|
100
|
-
static newFoundDocument(documentKey: DocumentKey, version: SnapshotVersion, value: ObjectValue): MutableDocument;
|
|
107
|
+
static newFoundDocument(documentKey: DocumentKey, version: SnapshotVersion, createTime: SnapshotVersion, value: ObjectValue): MutableDocument;
|
|
101
108
|
/** Creates a new document that is known to not exist at the given version. */
|
|
102
109
|
static newNoDocument(documentKey: DocumentKey, version: SnapshotVersion): MutableDocument;
|
|
103
110
|
/**
|
|
@@ -23,7 +23,7 @@ export declare type Timestamp = string | {
|
|
|
23
23
|
seconds?: string | number;
|
|
24
24
|
nanos?: number;
|
|
25
25
|
};
|
|
26
|
-
export declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND';
|
|
26
|
+
export declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR';
|
|
27
27
|
export interface ICompositeFilterOpEnum {
|
|
28
28
|
OPERATOR_UNSPECIFIED: CompositeFilterOp;
|
|
29
29
|
AND: CompositeFilterOp;
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { DatabaseId } from '../core/database_info';
|
|
18
|
+
import { CompositeFilter, CompositeOperator, FieldFilter, Filter, Operator } from '../core/filter';
|
|
19
|
+
import { Direction, OrderBy } from '../core/order_by';
|
|
18
20
|
import { Query } from '../core/query';
|
|
19
21
|
import { SnapshotVersion } from '../core/snapshot_version';
|
|
20
|
-
import {
|
|
22
|
+
import { Target } from '../core/target';
|
|
21
23
|
import { Timestamp } from '../lite-api/timestamp';
|
|
22
24
|
import { TargetData } from '../local/target_data';
|
|
23
25
|
import { MutableDocument } from '../model/document';
|
|
@@ -26,7 +28,7 @@ import { FieldMask } from '../model/field_mask';
|
|
|
26
28
|
import { Mutation, MutationResult } from '../model/mutation';
|
|
27
29
|
import { ObjectValue } from '../model/object_value';
|
|
28
30
|
import { FieldPath, ResourcePath } from '../model/path';
|
|
29
|
-
import { ApiClientObjectMap as ProtoApiClientObjectMap, BatchGetDocumentsResponse as ProtoBatchGetDocumentsResponse, Document as ProtoDocument, DocumentMask as ProtoDocumentMask, DocumentsTarget as ProtoDocumentsTarget, FieldFilterOp as ProtoFieldFilterOp, FieldReference as ProtoFieldReference, Filter as ProtoFilter, ListenResponse as ProtoListenResponse, Order as ProtoOrder, OrderDirection as ProtoOrderDirection, QueryTarget as ProtoQueryTarget, RunAggregationQueryRequest as ProtoRunAggregationQueryRequest, Target as ProtoTarget, Timestamp as ProtoTimestamp, Write as ProtoWrite, WriteResult as ProtoWriteResult } from '../protos/firestore_proto_api';
|
|
31
|
+
import { ApiClientObjectMap as ProtoApiClientObjectMap, BatchGetDocumentsResponse as ProtoBatchGetDocumentsResponse, CompositeFilterOp as ProtoCompositeFilterOp, Document as ProtoDocument, DocumentMask as ProtoDocumentMask, DocumentsTarget as ProtoDocumentsTarget, FieldFilterOp as ProtoFieldFilterOp, FieldReference as ProtoFieldReference, Filter as ProtoFilter, ListenResponse as ProtoListenResponse, Order as ProtoOrder, OrderDirection as ProtoOrderDirection, QueryTarget as ProtoQueryTarget, RunAggregationQueryRequest as ProtoRunAggregationQueryRequest, Target as ProtoTarget, Timestamp as ProtoTimestamp, Write as ProtoWrite, WriteResult as ProtoWriteResult } from '../protos/firestore_proto_api';
|
|
30
32
|
import { ByteString } from '../util/byte_string';
|
|
31
33
|
import { Serializer } from './number_serializer';
|
|
32
34
|
import { WatchChange } from './watch_change';
|
|
@@ -90,14 +92,19 @@ export declare function toTarget(serializer: JsonProtoSerializer, targetData: Ta
|
|
|
90
92
|
export declare function toDirection(dir: Direction): ProtoOrderDirection;
|
|
91
93
|
export declare function fromDirection(dir: ProtoOrderDirection | undefined): Direction | undefined;
|
|
92
94
|
export declare function toOperatorName(op: Operator): ProtoFieldFilterOp;
|
|
95
|
+
export declare function toCompositeOperatorName(op: CompositeOperator): ProtoCompositeFilterOp;
|
|
93
96
|
export declare function fromOperatorName(op: ProtoFieldFilterOp): Operator;
|
|
97
|
+
export declare function fromCompositeOperatorName(op: ProtoCompositeFilterOp): CompositeOperator;
|
|
94
98
|
export declare function toFieldPathReference(path: FieldPath): ProtoFieldReference;
|
|
95
99
|
export declare function fromFieldPathReference(fieldReference: ProtoFieldReference): FieldPath;
|
|
96
100
|
export declare function toPropertyOrder(orderBy: OrderBy): ProtoOrder;
|
|
97
101
|
export declare function fromPropertyOrder(orderBy: ProtoOrder): OrderBy;
|
|
98
|
-
export declare function
|
|
102
|
+
export declare function toFilter(filter: Filter): ProtoFilter;
|
|
103
|
+
export declare function toCompositeFilter(filter: CompositeFilter): ProtoFilter;
|
|
99
104
|
export declare function toUnaryOrFieldFilter(filter: FieldFilter): ProtoFilter;
|
|
100
105
|
export declare function fromUnaryFilter(filter: ProtoFilter): Filter;
|
|
106
|
+
export declare function fromFieldFilter(filter: ProtoFilter): FieldFilter;
|
|
107
|
+
export declare function fromCompositeFilter(filter: ProtoFilter): CompositeFilter;
|
|
101
108
|
export declare function toDocumentMask(fieldMask: FieldMask): ProtoDocumentMask;
|
|
102
109
|
export declare function fromDocumentMask(proto: ProtoDocumentMask): FieldMask;
|
|
103
110
|
export declare function isValidResourceName(path: ResourcePath): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { CompositeFilter, Filter } from '../core/filter';
|
|
18
|
+
/**
|
|
19
|
+
* Provides utility functions that help with boolean logic transformations needed for handling
|
|
20
|
+
* complex filters used in queries.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The `in` filter is only a syntactic sugar over a disjunction of equalities. For instance: `a in
|
|
24
|
+
* [1,2,3]` is in fact `a==1 || a==2 || a==3`. This method expands any `in` filter in the given
|
|
25
|
+
* input into a disjunction of equality filters and returns the expanded filter.
|
|
26
|
+
*/
|
|
27
|
+
export declare function computeInExpansion(filter: Filter): Filter;
|
|
28
|
+
/**
|
|
29
|
+
* Given a composite filter, returns the list of terms in its disjunctive normal form.
|
|
30
|
+
*
|
|
31
|
+
* <p>Each element in the return value is one term of the resulting DNF. For instance: For the
|
|
32
|
+
* input: (A || B) && C, the DNF form is: (A && C) || (B && C), and the return value is a list
|
|
33
|
+
* with two elements: a composite filter that performs (A && C), and a composite filter that
|
|
34
|
+
* performs (B && C).
|
|
35
|
+
*
|
|
36
|
+
* @param filter the composite filter to calculate DNF transform for.
|
|
37
|
+
* @return the terms in the DNF transform.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getDnfTerms(filter: CompositeFilter): Filter[];
|
|
40
|
+
export declare function computeDistributedNormalForm(filter: Filter): Filter;
|
|
41
|
+
export declare function applyDistribution(lhs: Filter, rhs: Filter): Filter;
|
|
42
|
+
/**
|
|
43
|
+
* Applies the associativity property to the given filter and returns the resulting filter.
|
|
44
|
+
*
|
|
45
|
+
* <ul>
|
|
46
|
+
* <li>A | (B | C) == (A | B) | C == (A | B | C)
|
|
47
|
+
* <li>A & (B & C) == (A & B) & C == (A & B & C)
|
|
48
|
+
* </ul>
|
|
49
|
+
*
|
|
50
|
+
* <p>For more info, visit: https://en.wikipedia.org/wiki/Associative_property#Propositional_logic
|
|
51
|
+
*/
|
|
52
|
+
export declare function applyAssociation(filter: Filter): Filter;
|
|
@@ -39,7 +39,7 @@ export interface WindowLike {
|
|
|
39
39
|
}
|
|
40
40
|
/** The subset of the browser's Document interface used by the SDK. */
|
|
41
41
|
export interface DocumentLike {
|
|
42
|
-
readonly visibilityState:
|
|
42
|
+
readonly visibilityState: DocumentVisibilityState;
|
|
43
43
|
addEventListener(type: string, listener: EventListener): void;
|
|
44
44
|
removeEventListener(type: string, listener: EventListener): void;
|
|
45
45
|
}
|
|
@@ -36,6 +36,6 @@ export declare const postConverter: {
|
|
|
36
36
|
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): Post;
|
|
37
37
|
};
|
|
38
38
|
export declare const postConverterMerge: {
|
|
39
|
-
toFirestore(post: PartialWithFieldValue<Post>, options?: SetOptions
|
|
39
|
+
toFirestore(post: PartialWithFieldValue<Post>, options?: SetOptions): DocumentData;
|
|
40
40
|
fromFirestore(snapshot: QueryDocumentSnapshot<DocumentData>): Post;
|
|
41
41
|
};
|