@firebase/firestore 3.7.3-canary.37dd6f6f4 → 3.7.3-canary.7e237cd47
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/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/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 +1 -1
- package/dist/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +5 -1
- package/dist/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/index.d.ts +138 -62
- package/dist/index.esm2017.js +4271 -3734
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4959 -4404
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1609 -874
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1602 -875
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4496 -3959
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +320 -65
- 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/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 +1 -1
- package/dist/lite/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +5 -1
- package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +2059 -1779
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2218 -1997
- 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 +2165 -1788
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2158 -1789
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2203 -1922
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +320 -65
- 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/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 +1 -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 +5 -1
- package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/lite/private.d.ts +232 -65
- 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/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 +1 -1
- package/dist/packages/firestore/test/unit/util/logic_utils.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +5 -1
- package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/private.d.ts +232 -65
- package/package.json +13 -11
package/dist/lite/internal.d.ts
CHANGED
|
@@ -129,10 +129,34 @@ export declare type AggregateSpecData<T extends AggregateSpec> = {
|
|
|
129
129
|
[P in keyof T]: T[P] extends AggregateField<infer U> ? U : never;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Creates a {@link QueryCompositeFilterConstraint} that performs a logical AND
|
|
134
|
+
* of all the provided {@link QueryFilterConstraint}s.
|
|
135
|
+
*
|
|
136
|
+
* @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
|
|
137
|
+
* for AND operation. These must be created with calls to {@link where},
|
|
138
|
+
* {@link or}, or {@link and}.
|
|
139
|
+
* @returns The created {@link QueryCompositeFilterConstraint}.
|
|
140
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
141
|
+
*/
|
|
142
|
+
export declare function and(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
143
|
+
|
|
132
144
|
declare interface ApiClientObjectMap<T> {
|
|
133
145
|
[k: string]: T;
|
|
134
146
|
}
|
|
135
147
|
|
|
148
|
+
/**
|
|
149
|
+
* An `AppliableConstraint` is an abstraction of a constraint that can be applied
|
|
150
|
+
* to a Firestore query.
|
|
151
|
+
*/
|
|
152
|
+
declare abstract class AppliableConstraint {
|
|
153
|
+
/**
|
|
154
|
+
* Takes the provided {@link Query} and returns a copy of the {@link Query} with this
|
|
155
|
+
* {@link AppliableConstraint} applied.
|
|
156
|
+
*/
|
|
157
|
+
abstract _apply<T>(query: Query<T>): Query<T>;
|
|
158
|
+
}
|
|
159
|
+
|
|
136
160
|
/**
|
|
137
161
|
* Returns a special value that can be used with {@link (setDoc:1)} or {@link
|
|
138
162
|
* updateDoc:1} that tells the server to remove the given elements from any
|
|
@@ -466,7 +490,12 @@ export declare class CollectionReference<T = DocumentData> extends Query<T> {
|
|
|
466
490
|
withConverter(converter: null): CollectionReference<DocumentData>;
|
|
467
491
|
}
|
|
468
492
|
|
|
469
|
-
declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND';
|
|
493
|
+
declare type CompositeFilterOp = 'OPERATOR_UNSPECIFIED' | 'AND' | 'OR';
|
|
494
|
+
|
|
495
|
+
declare const enum CompositeOperator {
|
|
496
|
+
OR = "or",
|
|
497
|
+
AND = "and"
|
|
498
|
+
}
|
|
470
499
|
|
|
471
500
|
/**
|
|
472
501
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -877,48 +906,66 @@ export declare class DocumentSnapshot<T = DocumentData> {
|
|
|
877
906
|
export { EmulatorMockTokenOptions }
|
|
878
907
|
|
|
879
908
|
/**
|
|
880
|
-
* Creates a {@link
|
|
881
|
-
* provided document (inclusive). The end position is relative to the order
|
|
882
|
-
* the query. The document must contain all of the fields provided in the
|
|
909
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
910
|
+
* the provided document (inclusive). The end position is relative to the order
|
|
911
|
+
* of the query. The document must contain all of the fields provided in the
|
|
883
912
|
* orderBy of the query.
|
|
884
913
|
*
|
|
885
914
|
* @param snapshot - The snapshot of the document to end at.
|
|
886
|
-
* @returns A {@link
|
|
915
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
887
916
|
*/
|
|
888
|
-
export declare function endAt(snapshot: DocumentSnapshot<unknown>):
|
|
917
|
+
export declare function endAt(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
889
918
|
|
|
890
919
|
/**
|
|
891
|
-
* Creates a {@link
|
|
892
|
-
* provided fields relative to the order of the query. The order of the field
|
|
920
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
921
|
+
* the provided fields relative to the order of the query. The order of the field
|
|
893
922
|
* values must match the order of the order by clauses of the query.
|
|
894
923
|
*
|
|
895
924
|
* @param fieldValues - The field values to end this query at, in order
|
|
896
925
|
* of the query's order by.
|
|
897
|
-
* @returns A {@link
|
|
926
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
898
927
|
*/
|
|
899
|
-
export declare function endAt(...fieldValues: unknown[]):
|
|
928
|
+
export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
900
929
|
|
|
901
930
|
/**
|
|
902
|
-
* Creates a {@link
|
|
903
|
-
* provided document (exclusive). The end position is relative to the
|
|
904
|
-
* the query. The document must contain all of the fields provided in
|
|
905
|
-
* orderBy of the query.
|
|
931
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
932
|
+
* before the provided document (exclusive). The end position is relative to the
|
|
933
|
+
* order of the query. The document must contain all of the fields provided in
|
|
934
|
+
* the orderBy of the query.
|
|
906
935
|
*
|
|
907
936
|
* @param snapshot - The snapshot of the document to end before.
|
|
908
|
-
* @returns A {@link
|
|
937
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
909
938
|
*/
|
|
910
|
-
export declare function endBefore(snapshot: DocumentSnapshot<unknown>):
|
|
939
|
+
export declare function endBefore(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
911
940
|
|
|
912
941
|
/**
|
|
913
|
-
* Creates a {@link
|
|
914
|
-
* provided fields relative to the order of the query. The order of
|
|
915
|
-
* values must match the order of the order by clauses of the query.
|
|
942
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
943
|
+
* before the provided fields relative to the order of the query. The order of
|
|
944
|
+
* the field values must match the order of the order by clauses of the query.
|
|
916
945
|
*
|
|
917
946
|
* @param fieldValues - The field values to end this query before, in order
|
|
918
947
|
* of the query's order by.
|
|
919
|
-
* @returns A {@link
|
|
948
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
920
949
|
*/
|
|
921
|
-
export declare function endBefore(...fieldValues: unknown[]):
|
|
950
|
+
export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
951
|
+
|
|
952
|
+
declare class FieldFilter extends Filter {
|
|
953
|
+
readonly field: FieldPath_2;
|
|
954
|
+
readonly op: Operator;
|
|
955
|
+
readonly value: Value;
|
|
956
|
+
protected constructor(field: FieldPath_2, op: Operator, value: Value);
|
|
957
|
+
/**
|
|
958
|
+
* Creates a filter based on the provided arguments.
|
|
959
|
+
*/
|
|
960
|
+
static create(field: FieldPath_2, op: Operator, value: Value): FieldFilter;
|
|
961
|
+
private static createKeyFieldInFilter;
|
|
962
|
+
matches(doc: Document_2): boolean;
|
|
963
|
+
protected matchesComparison(comparison: number): boolean;
|
|
964
|
+
isInequality(): boolean;
|
|
965
|
+
getFlattenedFilters(): readonly FieldFilter[];
|
|
966
|
+
getFilters(): Filter[];
|
|
967
|
+
getFirstInequalityField(): FieldPath_2 | null;
|
|
968
|
+
}
|
|
922
969
|
|
|
923
970
|
declare type FieldFilterOp = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN';
|
|
924
971
|
|
|
@@ -1040,6 +1087,9 @@ export declare abstract class FieldValue {
|
|
|
1040
1087
|
|
|
1041
1088
|
declare abstract class Filter {
|
|
1042
1089
|
abstract matches(doc: Document_2): boolean;
|
|
1090
|
+
abstract getFlattenedFilters(): readonly FieldFilter[];
|
|
1091
|
+
abstract getFilters(): Filter[];
|
|
1092
|
+
abstract getFirstInequalityField(): FieldPath_2 | null;
|
|
1043
1093
|
}
|
|
1044
1094
|
|
|
1045
1095
|
/**
|
|
@@ -1767,23 +1817,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings
|
|
|
1767
1817
|
export declare function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
|
|
1768
1818
|
|
|
1769
1819
|
/**
|
|
1770
|
-
* Creates a {@link
|
|
1820
|
+
* Creates a {@link QueryLimitConstraint} that only returns the first matching
|
|
1821
|
+
* documents.
|
|
1771
1822
|
*
|
|
1772
1823
|
* @param limit - The maximum number of items to return.
|
|
1773
|
-
* @returns The created {@link
|
|
1824
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
1774
1825
|
*/
|
|
1775
|
-
export declare function limit(limit: number):
|
|
1826
|
+
export declare function limit(limit: number): QueryLimitConstraint;
|
|
1776
1827
|
|
|
1777
1828
|
/**
|
|
1778
|
-
* Creates a {@link
|
|
1829
|
+
* Creates a {@link QueryLimitConstraint} that only returns the last matching
|
|
1830
|
+
* documents.
|
|
1779
1831
|
*
|
|
1780
1832
|
* You must specify at least one `orderBy` clause for `limitToLast` queries,
|
|
1781
1833
|
* otherwise an exception will be thrown during execution.
|
|
1782
1834
|
*
|
|
1783
1835
|
* @param limit - The maximum number of items to return.
|
|
1784
|
-
* @returns The created {@link
|
|
1836
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
1785
1837
|
*/
|
|
1786
|
-
export declare function limitToLast(limit: number):
|
|
1838
|
+
export declare function limitToLast(limit: number): QueryLimitConstraint;
|
|
1787
1839
|
|
|
1788
1840
|
declare const enum LimitType {
|
|
1789
1841
|
First = "F",
|
|
@@ -1986,6 +2038,31 @@ declare class ObjectValue {
|
|
|
1986
2038
|
clone(): ObjectValue;
|
|
1987
2039
|
}
|
|
1988
2040
|
|
|
2041
|
+
declare const enum Operator {
|
|
2042
|
+
LESS_THAN = "<",
|
|
2043
|
+
LESS_THAN_OR_EQUAL = "<=",
|
|
2044
|
+
EQUAL = "==",
|
|
2045
|
+
NOT_EQUAL = "!=",
|
|
2046
|
+
GREATER_THAN = ">",
|
|
2047
|
+
GREATER_THAN_OR_EQUAL = ">=",
|
|
2048
|
+
ARRAY_CONTAINS = "array-contains",
|
|
2049
|
+
IN = "in",
|
|
2050
|
+
NOT_IN = "not-in",
|
|
2051
|
+
ARRAY_CONTAINS_ANY = "array-contains-any"
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
|
|
2056
|
+
* of all the provided {@link QueryFilterConstraint}s.
|
|
2057
|
+
*
|
|
2058
|
+
* @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
|
|
2059
|
+
* for OR operation. These must be created with calls to {@link where},
|
|
2060
|
+
* {@link or}, or {@link and}.
|
|
2061
|
+
* @returns The created {@link QueryCompositeFilterConstraint}.
|
|
2062
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2063
|
+
*/
|
|
2064
|
+
export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
2065
|
+
|
|
1989
2066
|
/**
|
|
1990
2067
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
1991
2068
|
*/
|
|
@@ -1996,15 +2073,18 @@ declare class OrderBy {
|
|
|
1996
2073
|
}
|
|
1997
2074
|
|
|
1998
2075
|
/**
|
|
1999
|
-
* Creates a {@link
|
|
2076
|
+
* Creates a {@link QueryOrderByConstraint} that sorts the query result by the
|
|
2000
2077
|
* specified field, optionally in descending order instead of ascending.
|
|
2001
2078
|
*
|
|
2079
|
+
* Note: Documents that do not contain the specified field will not be present
|
|
2080
|
+
* in the query result.
|
|
2081
|
+
*
|
|
2002
2082
|
* @param fieldPath - The field to sort by.
|
|
2003
2083
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
2004
2084
|
* not specified, order will be ascending.
|
|
2005
|
-
* @returns The created {@link
|
|
2085
|
+
* @returns The created {@link QueryOrderByConstraint}.
|
|
2006
2086
|
*/
|
|
2007
|
-
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection):
|
|
2087
|
+
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
|
|
2008
2088
|
|
|
2009
2089
|
/**
|
|
2010
2090
|
* The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
|
|
@@ -2130,10 +2210,28 @@ export declare class Query<T = DocumentData> {
|
|
|
2130
2210
|
}
|
|
2131
2211
|
|
|
2132
2212
|
/**
|
|
2133
|
-
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2134
|
-
* additional query constraints.
|
|
2213
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2214
|
+
* include additional query constraints.
|
|
2135
2215
|
*
|
|
2136
|
-
* @param query - The {@link Query} instance to use as a base for the new
|
|
2216
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
2217
|
+
* constraints.
|
|
2218
|
+
* @param compositeFilter - The {@link QueryCompositeFilterConstraint} to
|
|
2219
|
+
* apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or
|
|
2220
|
+
* {@link or}.
|
|
2221
|
+
* @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to
|
|
2222
|
+
* apply (e.g. {@link orderBy}, {@link limit}).
|
|
2223
|
+
* @throws if any of the provided query constraints cannot be combined with the
|
|
2224
|
+
* existing or new constraints.
|
|
2225
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2226
|
+
*/
|
|
2227
|
+
export declare function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2231
|
+
* include additional query constraints.
|
|
2232
|
+
*
|
|
2233
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
2234
|
+
* constraints.
|
|
2137
2235
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
2138
2236
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
2139
2237
|
* existing or new constraints.
|
|
@@ -2157,20 +2255,46 @@ declare interface Query_2 {
|
|
|
2157
2255
|
readonly endAt: Bound | null;
|
|
2158
2256
|
}
|
|
2159
2257
|
|
|
2258
|
+
/**
|
|
2259
|
+
* A `QueryCompositeFilterConstraint` is used to narrow the set of documents
|
|
2260
|
+
* returned by a Firestore query by performing the logical OR or AND of multiple
|
|
2261
|
+
* {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
|
|
2262
|
+
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
2263
|
+
* {@link and} and can then be passed to {@link query} to create a new query
|
|
2264
|
+
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
2265
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2266
|
+
*/
|
|
2267
|
+
export declare class QueryCompositeFilterConstraint extends AppliableConstraint {
|
|
2268
|
+
/** The type of this query constraint */
|
|
2269
|
+
readonly type: 'or' | 'and';
|
|
2270
|
+
private readonly _queryConstraints;
|
|
2271
|
+
/**
|
|
2272
|
+
* @internal
|
|
2273
|
+
*/
|
|
2274
|
+
protected constructor(
|
|
2275
|
+
/** The type of this query constraint */
|
|
2276
|
+
type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]);
|
|
2277
|
+
static _create(type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
2278
|
+
_parse<T>(query: Query<T>): Filter;
|
|
2279
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2280
|
+
_getQueryConstraints(): readonly AppliableConstraint[];
|
|
2281
|
+
_getOperator(): CompositeOperator;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2160
2284
|
/**
|
|
2161
2285
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
2162
2286
|
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
2163
|
-
* {@link orderBy}, {@link
|
|
2164
|
-
* endBefore
|
|
2287
|
+
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
|
|
2288
|
+
* endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
|
|
2165
2289
|
* can then be passed to {@link query} to create a new query instance that
|
|
2166
2290
|
* also contains this `QueryConstraint`.
|
|
2167
2291
|
*/
|
|
2168
|
-
export declare abstract class QueryConstraint {
|
|
2169
|
-
/** The type of this query
|
|
2292
|
+
export declare abstract class QueryConstraint extends AppliableConstraint {
|
|
2293
|
+
/** The type of this query constraint */
|
|
2170
2294
|
abstract readonly type: QueryConstraintType;
|
|
2171
2295
|
/**
|
|
2172
2296
|
* Takes the provided {@link Query} and returns a copy of the {@link Query} with this
|
|
2173
|
-
* {@link
|
|
2297
|
+
* {@link AppliableConstraint} applied.
|
|
2174
2298
|
*/
|
|
2175
2299
|
abstract _apply<T>(query: Query<T>): Query<T>;
|
|
2176
2300
|
}
|
|
@@ -2199,6 +2323,28 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
|
|
|
2199
2323
|
data(): T;
|
|
2200
2324
|
}
|
|
2201
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* A `QueryEndAtConstraint` is used to exclude documents from the end of a
|
|
2328
|
+
* result set returned by a Firestore query.
|
|
2329
|
+
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
2330
|
+
* {@link (endBefore:1)} and can then be passed to {@link query} to create a new
|
|
2331
|
+
* query instance that also contains this `QueryEndAtConstraint`.
|
|
2332
|
+
*/
|
|
2333
|
+
export declare class QueryEndAtConstraint extends QueryConstraint {
|
|
2334
|
+
/** The type of this query constraint */
|
|
2335
|
+
readonly type: 'endBefore' | 'endAt';
|
|
2336
|
+
private readonly _docOrFields;
|
|
2337
|
+
private readonly _inclusive;
|
|
2338
|
+
/**
|
|
2339
|
+
* @internal
|
|
2340
|
+
*/
|
|
2341
|
+
protected constructor(
|
|
2342
|
+
/** The type of this query constraint */
|
|
2343
|
+
type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
2344
|
+
static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
|
|
2345
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2202
2348
|
/**
|
|
2203
2349
|
* Returns true if the provided queries point to the same collection and apply
|
|
2204
2350
|
* the same constraints.
|
|
@@ -2210,6 +2356,93 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
|
|
|
2210
2356
|
*/
|
|
2211
2357
|
export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
|
|
2212
2358
|
|
|
2359
|
+
/**
|
|
2360
|
+
* A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
|
|
2361
|
+
* a Firestore query by filtering on one or more document fields.
|
|
2362
|
+
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
2363
|
+
* be passed to {@link query} to create a new query instance that also contains
|
|
2364
|
+
* this `QueryFieldFilterConstraint`.
|
|
2365
|
+
*/
|
|
2366
|
+
export declare class QueryFieldFilterConstraint extends QueryConstraint {
|
|
2367
|
+
private readonly _field;
|
|
2368
|
+
private _op;
|
|
2369
|
+
private _value;
|
|
2370
|
+
/** The type of this query constraint */
|
|
2371
|
+
readonly type = "where";
|
|
2372
|
+
/**
|
|
2373
|
+
* @internal
|
|
2374
|
+
*/
|
|
2375
|
+
protected constructor(_field: FieldPath_2, _op: Operator, _value: unknown);
|
|
2376
|
+
static _create(_field: FieldPath_2, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
|
|
2377
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2378
|
+
_parse<T>(query: Query<T>): FieldFilter;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* `QueryFilterConstraint` is a helper union type that represents
|
|
2383
|
+
* {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}.
|
|
2384
|
+
* `QueryFilterConstraint`s are created by invoking {@link or} or {@link and}
|
|
2385
|
+
* and can then be passed to {@link query} to create a new query instance that
|
|
2386
|
+
* also contains the `QueryConstraint`.
|
|
2387
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2388
|
+
*/
|
|
2389
|
+
export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* A `QueryLimitConstraint` is used to limit the number of documents returned by
|
|
2393
|
+
* a Firestore query.
|
|
2394
|
+
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
2395
|
+
* {@link limitToLast} and can then be passed to {@link query} to create a new
|
|
2396
|
+
* query instance that also contains this `QueryLimitConstraint`.
|
|
2397
|
+
*/
|
|
2398
|
+
export declare class QueryLimitConstraint extends QueryConstraint {
|
|
2399
|
+
/** The type of this query constraint */
|
|
2400
|
+
readonly type: 'limit' | 'limitToLast';
|
|
2401
|
+
private readonly _limit;
|
|
2402
|
+
private readonly _limitType;
|
|
2403
|
+
/**
|
|
2404
|
+
* @internal
|
|
2405
|
+
*/
|
|
2406
|
+
protected constructor(
|
|
2407
|
+
/** The type of this query constraint */
|
|
2408
|
+
type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType);
|
|
2409
|
+
static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
|
|
2410
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
/**
|
|
2414
|
+
* `QueryNonFilterConstraint` is a helper union type that represents
|
|
2415
|
+
* QueryConstraints which are used to narrow or order the set of documents,
|
|
2416
|
+
* but that do not explicitly filter on a document field.
|
|
2417
|
+
* `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
|
|
2418
|
+
* {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
|
|
2419
|
+
* {@link limit} or {@link limitToLast} and can then be passed to {@link query}
|
|
2420
|
+
* to create a new query instance that also contains the `QueryConstraint`.
|
|
2421
|
+
*/
|
|
2422
|
+
export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
2426
|
+
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
2427
|
+
* {@link orderBy} and can then be passed to {@link query} to create a new query
|
|
2428
|
+
* instance that also contains this `QueryOrderByConstraint`.
|
|
2429
|
+
*
|
|
2430
|
+
* Note: Documents that do not contain the orderBy field will not be present in
|
|
2431
|
+
* the query result.
|
|
2432
|
+
*/
|
|
2433
|
+
export declare class QueryOrderByConstraint extends QueryConstraint {
|
|
2434
|
+
private readonly _field;
|
|
2435
|
+
private _direction;
|
|
2436
|
+
/** The type of this query constraint */
|
|
2437
|
+
readonly type = "orderBy";
|
|
2438
|
+
/**
|
|
2439
|
+
* @internal
|
|
2440
|
+
*/
|
|
2441
|
+
protected constructor(_field: FieldPath_2, _direction: Direction);
|
|
2442
|
+
static _create(_field: FieldPath_2, _direction: Direction): QueryOrderByConstraint;
|
|
2443
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2213
2446
|
/**
|
|
2214
2447
|
* A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
|
|
2215
2448
|
* representing the results of a query. The documents can be accessed as an
|
|
@@ -2242,6 +2475,28 @@ export declare class QuerySnapshot<T = DocumentData> {
|
|
|
2242
2475
|
forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
|
|
2243
2476
|
}
|
|
2244
2477
|
|
|
2478
|
+
/**
|
|
2479
|
+
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
2480
|
+
* result set returned by a Firestore query.
|
|
2481
|
+
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
2482
|
+
* {@link (startAfter:1)} and can then be passed to {@link query} to create a
|
|
2483
|
+
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
2484
|
+
*/
|
|
2485
|
+
export declare class QueryStartAtConstraint extends QueryConstraint {
|
|
2486
|
+
/** The type of this query constraint */
|
|
2487
|
+
readonly type: 'startAt' | 'startAfter';
|
|
2488
|
+
private readonly _docOrFields;
|
|
2489
|
+
private readonly _inclusive;
|
|
2490
|
+
/**
|
|
2491
|
+
* @internal
|
|
2492
|
+
*/
|
|
2493
|
+
protected constructor(
|
|
2494
|
+
/** The type of this query constraint */
|
|
2495
|
+
type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
2496
|
+
static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
|
|
2497
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2245
2500
|
/**
|
|
2246
2501
|
* Returns true if the provided references are equal.
|
|
2247
2502
|
*
|
|
@@ -2418,48 +2673,48 @@ declare class SnapshotVersion {
|
|
|
2418
2673
|
}
|
|
2419
2674
|
|
|
2420
2675
|
/**
|
|
2421
|
-
* Creates a {@link
|
|
2422
|
-
* provided document (exclusive). The starting position is
|
|
2423
|
-
* of the query. The document must contain all of the
|
|
2424
|
-
* orderBy of the query.
|
|
2676
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2677
|
+
* start after the provided document (exclusive). The starting position is
|
|
2678
|
+
* relative to the order of the query. The document must contain all of the
|
|
2679
|
+
* fields provided in the orderBy of the query.
|
|
2425
2680
|
*
|
|
2426
2681
|
* @param snapshot - The snapshot of the document to start after.
|
|
2427
|
-
* @returns A {@link
|
|
2682
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
2428
2683
|
*/
|
|
2429
|
-
export declare function startAfter(snapshot: DocumentSnapshot<unknown>):
|
|
2684
|
+
export declare function startAfter(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
2430
2685
|
|
|
2431
2686
|
/**
|
|
2432
|
-
* Creates a {@link
|
|
2433
|
-
* provided fields relative to the order of the query. The order
|
|
2434
|
-
* values must match the order of the order by clauses of the query.
|
|
2687
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2688
|
+
* start after the provided fields relative to the order of the query. The order
|
|
2689
|
+
* of the field values must match the order of the order by clauses of the query.
|
|
2435
2690
|
*
|
|
2436
2691
|
* @param fieldValues - The field values to start this query after, in order
|
|
2437
2692
|
* of the query's order by.
|
|
2438
|
-
* @returns A {@link
|
|
2693
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
2439
2694
|
*/
|
|
2440
|
-
export declare function startAfter(...fieldValues: unknown[]):
|
|
2695
|
+
export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
2441
2696
|
|
|
2442
2697
|
/**
|
|
2443
|
-
* Creates a {@link
|
|
2444
|
-
* provided document (inclusive). The starting position is relative
|
|
2445
|
-
* of the query. The document must contain all of the fields
|
|
2446
|
-
* `orderBy` of this query.
|
|
2698
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2699
|
+
* start at the provided document (inclusive). The starting position is relative
|
|
2700
|
+
* to the order of the query. The document must contain all of the fields
|
|
2701
|
+
* provided in the `orderBy` of this query.
|
|
2447
2702
|
*
|
|
2448
2703
|
* @param snapshot - The snapshot of the document to start at.
|
|
2449
|
-
* @returns A {@link
|
|
2704
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
2450
2705
|
*/
|
|
2451
|
-
export declare function startAt(snapshot: DocumentSnapshot<unknown>):
|
|
2706
|
+
export declare function startAt(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
2452
2707
|
|
|
2453
2708
|
/**
|
|
2454
|
-
* Creates a {@link
|
|
2455
|
-
* provided fields relative to the order of the query. The order of
|
|
2456
|
-
* values must match the order of the order by clauses of the query.
|
|
2709
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2710
|
+
* start at the provided fields relative to the order of the query. The order of
|
|
2711
|
+
* the field values must match the order of the order by clauses of the query.
|
|
2457
2712
|
*
|
|
2458
2713
|
* @param fieldValues - The field values to start this query at, in order
|
|
2459
2714
|
* of the query's order by.
|
|
2460
|
-
* @returns A {@link
|
|
2715
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
2461
2716
|
*/
|
|
2462
|
-
export declare function startAt(...fieldValues: unknown[]):
|
|
2717
|
+
export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
2463
2718
|
|
|
2464
2719
|
declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CURRENT' | 'RESET';
|
|
2465
2720
|
|
|
@@ -2947,17 +3202,17 @@ declare type Value = firestoreV1ApiClientInterfaces.Value;
|
|
|
2947
3202
|
declare type ValueNullValue = 'NULL_VALUE';
|
|
2948
3203
|
|
|
2949
3204
|
/**
|
|
2950
|
-
* Creates a {@link
|
|
2951
|
-
* specified field and that the value should satisfy the
|
|
2952
|
-
* provided.
|
|
3205
|
+
* Creates a {@link QueryFieldFilterConstraint} that enforces that documents
|
|
3206
|
+
* must contain the specified field and that the value should satisfy the
|
|
3207
|
+
* relation constraint provided.
|
|
2953
3208
|
*
|
|
2954
3209
|
* @param fieldPath - The path to compare
|
|
2955
3210
|
* @param opStr - The operation string (e.g "<", "<=", "==", "<",
|
|
2956
3211
|
* "<=", "!=").
|
|
2957
3212
|
* @param value - The value for comparison
|
|
2958
|
-
* @returns The created {@link
|
|
3213
|
+
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
2959
3214
|
*/
|
|
2960
|
-
export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown):
|
|
3215
|
+
export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
|
|
2961
3216
|
|
|
2962
3217
|
/**
|
|
2963
3218
|
* Filter conditions in a {@link where} clause are specified using the
|