@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
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.
|
|
@@ -688,6 +717,12 @@ declare interface Document_2 {
|
|
|
688
717
|
* `SnapshotVersion.min()` for documents created by the user.
|
|
689
718
|
*/
|
|
690
719
|
readonly readTime: SnapshotVersion;
|
|
720
|
+
/**
|
|
721
|
+
* The timestamp at which the document was created. This value increases
|
|
722
|
+
* monotonically when a document is deleted then recreated. It can also be
|
|
723
|
+
* compared to `createTime` of other documents and the `readTime` of a query.
|
|
724
|
+
*/
|
|
725
|
+
readonly createTime: SnapshotVersion;
|
|
691
726
|
/** The underlying data of this document or an empty value if no data exists. */
|
|
692
727
|
readonly data: ObjectValue;
|
|
693
728
|
/** Returns whether local mutations were applied via the mutation queue. */
|
|
@@ -877,48 +912,66 @@ export declare class DocumentSnapshot<T = DocumentData> {
|
|
|
877
912
|
export { EmulatorMockTokenOptions }
|
|
878
913
|
|
|
879
914
|
/**
|
|
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
|
|
915
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
916
|
+
* the provided document (inclusive). The end position is relative to the order
|
|
917
|
+
* of the query. The document must contain all of the fields provided in the
|
|
883
918
|
* orderBy of the query.
|
|
884
919
|
*
|
|
885
920
|
* @param snapshot - The snapshot of the document to end at.
|
|
886
|
-
* @returns A {@link
|
|
921
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
887
922
|
*/
|
|
888
|
-
export declare function endAt(snapshot: DocumentSnapshot<unknown>):
|
|
923
|
+
export declare function endAt(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
889
924
|
|
|
890
925
|
/**
|
|
891
|
-
* Creates a {@link
|
|
892
|
-
* provided fields relative to the order of the query. The order of the field
|
|
926
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end at
|
|
927
|
+
* the provided fields relative to the order of the query. The order of the field
|
|
893
928
|
* values must match the order of the order by clauses of the query.
|
|
894
929
|
*
|
|
895
930
|
* @param fieldValues - The field values to end this query at, in order
|
|
896
931
|
* of the query's order by.
|
|
897
|
-
* @returns A {@link
|
|
932
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
898
933
|
*/
|
|
899
|
-
export declare function endAt(...fieldValues: unknown[]):
|
|
934
|
+
export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
900
935
|
|
|
901
936
|
/**
|
|
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.
|
|
937
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
938
|
+
* before the provided document (exclusive). The end position is relative to the
|
|
939
|
+
* order of the query. The document must contain all of the fields provided in
|
|
940
|
+
* the orderBy of the query.
|
|
906
941
|
*
|
|
907
942
|
* @param snapshot - The snapshot of the document to end before.
|
|
908
|
-
* @returns A {@link
|
|
943
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
909
944
|
*/
|
|
910
|
-
export declare function endBefore(snapshot: DocumentSnapshot<unknown>):
|
|
945
|
+
export declare function endBefore(snapshot: DocumentSnapshot<unknown>): QueryEndAtConstraint;
|
|
911
946
|
|
|
912
947
|
/**
|
|
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.
|
|
948
|
+
* Creates a {@link QueryEndAtConstraint} that modifies the result set to end
|
|
949
|
+
* before the provided fields relative to the order of the query. The order of
|
|
950
|
+
* the field values must match the order of the order by clauses of the query.
|
|
916
951
|
*
|
|
917
952
|
* @param fieldValues - The field values to end this query before, in order
|
|
918
953
|
* of the query's order by.
|
|
919
|
-
* @returns A {@link
|
|
954
|
+
* @returns A {@link QueryEndAtConstraint} to pass to `query()`
|
|
920
955
|
*/
|
|
921
|
-
export declare function endBefore(...fieldValues: unknown[]):
|
|
956
|
+
export declare function endBefore(...fieldValues: unknown[]): QueryEndAtConstraint;
|
|
957
|
+
|
|
958
|
+
declare class FieldFilter extends Filter {
|
|
959
|
+
readonly field: FieldPath_2;
|
|
960
|
+
readonly op: Operator;
|
|
961
|
+
readonly value: Value;
|
|
962
|
+
protected constructor(field: FieldPath_2, op: Operator, value: Value);
|
|
963
|
+
/**
|
|
964
|
+
* Creates a filter based on the provided arguments.
|
|
965
|
+
*/
|
|
966
|
+
static create(field: FieldPath_2, op: Operator, value: Value): FieldFilter;
|
|
967
|
+
private static createKeyFieldInFilter;
|
|
968
|
+
matches(doc: Document_2): boolean;
|
|
969
|
+
protected matchesComparison(comparison: number): boolean;
|
|
970
|
+
isInequality(): boolean;
|
|
971
|
+
getFlattenedFilters(): readonly FieldFilter[];
|
|
972
|
+
getFilters(): Filter[];
|
|
973
|
+
getFirstInequalityField(): FieldPath_2 | null;
|
|
974
|
+
}
|
|
922
975
|
|
|
923
976
|
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
977
|
|
|
@@ -1040,6 +1093,9 @@ export declare abstract class FieldValue {
|
|
|
1040
1093
|
|
|
1041
1094
|
declare abstract class Filter {
|
|
1042
1095
|
abstract matches(doc: Document_2): boolean;
|
|
1096
|
+
abstract getFlattenedFilters(): readonly FieldFilter[];
|
|
1097
|
+
abstract getFilters(): Filter[];
|
|
1098
|
+
abstract getFirstInequalityField(): FieldPath_2 | null;
|
|
1043
1099
|
}
|
|
1044
1100
|
|
|
1045
1101
|
/**
|
|
@@ -1767,23 +1823,25 @@ export declare function initializeFirestore(app: FirebaseApp, settings: Settings
|
|
|
1767
1823
|
export declare function initializeFirestore(app: FirebaseApp, settings: Settings, databaseId?: string): Firestore;
|
|
1768
1824
|
|
|
1769
1825
|
/**
|
|
1770
|
-
* Creates a {@link
|
|
1826
|
+
* Creates a {@link QueryLimitConstraint} that only returns the first matching
|
|
1827
|
+
* documents.
|
|
1771
1828
|
*
|
|
1772
1829
|
* @param limit - The maximum number of items to return.
|
|
1773
|
-
* @returns The created {@link
|
|
1830
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
1774
1831
|
*/
|
|
1775
|
-
export declare function limit(limit: number):
|
|
1832
|
+
export declare function limit(limit: number): QueryLimitConstraint;
|
|
1776
1833
|
|
|
1777
1834
|
/**
|
|
1778
|
-
* Creates a {@link
|
|
1835
|
+
* Creates a {@link QueryLimitConstraint} that only returns the last matching
|
|
1836
|
+
* documents.
|
|
1779
1837
|
*
|
|
1780
1838
|
* You must specify at least one `orderBy` clause for `limitToLast` queries,
|
|
1781
1839
|
* otherwise an exception will be thrown during execution.
|
|
1782
1840
|
*
|
|
1783
1841
|
* @param limit - The maximum number of items to return.
|
|
1784
|
-
* @returns The created {@link
|
|
1842
|
+
* @returns The created {@link QueryLimitConstraint}.
|
|
1785
1843
|
*/
|
|
1786
|
-
export declare function limitToLast(limit: number):
|
|
1844
|
+
export declare function limitToLast(limit: number): QueryLimitConstraint;
|
|
1787
1845
|
|
|
1788
1846
|
declare const enum LimitType {
|
|
1789
1847
|
First = "F",
|
|
@@ -1808,6 +1866,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
1808
1866
|
private documentType;
|
|
1809
1867
|
version: SnapshotVersion;
|
|
1810
1868
|
readTime: SnapshotVersion;
|
|
1869
|
+
createTime: SnapshotVersion;
|
|
1811
1870
|
data: ObjectValue;
|
|
1812
1871
|
private documentState;
|
|
1813
1872
|
private constructor();
|
|
@@ -1820,7 +1879,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
1820
1879
|
* Creates a new document that is known to exist with the given data at the
|
|
1821
1880
|
* given version.
|
|
1822
1881
|
*/
|
|
1823
|
-
static newFoundDocument(documentKey: DocumentKey, version: SnapshotVersion, value: ObjectValue): MutableDocument;
|
|
1882
|
+
static newFoundDocument(documentKey: DocumentKey, version: SnapshotVersion, createTime: SnapshotVersion, value: ObjectValue): MutableDocument;
|
|
1824
1883
|
/** Creates a new document that is known to not exist at the given version. */
|
|
1825
1884
|
static newNoDocument(documentKey: DocumentKey, version: SnapshotVersion): MutableDocument;
|
|
1826
1885
|
/**
|
|
@@ -1986,6 +2045,31 @@ declare class ObjectValue {
|
|
|
1986
2045
|
clone(): ObjectValue;
|
|
1987
2046
|
}
|
|
1988
2047
|
|
|
2048
|
+
declare const enum Operator {
|
|
2049
|
+
LESS_THAN = "<",
|
|
2050
|
+
LESS_THAN_OR_EQUAL = "<=",
|
|
2051
|
+
EQUAL = "==",
|
|
2052
|
+
NOT_EQUAL = "!=",
|
|
2053
|
+
GREATER_THAN = ">",
|
|
2054
|
+
GREATER_THAN_OR_EQUAL = ">=",
|
|
2055
|
+
ARRAY_CONTAINS = "array-contains",
|
|
2056
|
+
IN = "in",
|
|
2057
|
+
NOT_IN = "not-in",
|
|
2058
|
+
ARRAY_CONTAINS_ANY = "array-contains-any"
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Creates a {@link QueryCompositeFilterConstraint} that performs a logical OR
|
|
2063
|
+
* of all the provided {@link QueryFilterConstraint}s.
|
|
2064
|
+
*
|
|
2065
|
+
* @param queryConstraints - Optional. The {@link QueryFilterConstraint}s
|
|
2066
|
+
* for OR operation. These must be created with calls to {@link where},
|
|
2067
|
+
* {@link or}, or {@link and}.
|
|
2068
|
+
* @returns The created {@link QueryCompositeFilterConstraint}.
|
|
2069
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2070
|
+
*/
|
|
2071
|
+
export declare function or(...queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
2072
|
+
|
|
1989
2073
|
/**
|
|
1990
2074
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
1991
2075
|
*/
|
|
@@ -1996,15 +2080,18 @@ declare class OrderBy {
|
|
|
1996
2080
|
}
|
|
1997
2081
|
|
|
1998
2082
|
/**
|
|
1999
|
-
* Creates a {@link
|
|
2083
|
+
* Creates a {@link QueryOrderByConstraint} that sorts the query result by the
|
|
2000
2084
|
* specified field, optionally in descending order instead of ascending.
|
|
2001
2085
|
*
|
|
2086
|
+
* Note: Documents that do not contain the specified field will not be present
|
|
2087
|
+
* in the query result.
|
|
2088
|
+
*
|
|
2002
2089
|
* @param fieldPath - The field to sort by.
|
|
2003
2090
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
2004
2091
|
* not specified, order will be ascending.
|
|
2005
|
-
* @returns The created {@link
|
|
2092
|
+
* @returns The created {@link QueryOrderByConstraint}.
|
|
2006
2093
|
*/
|
|
2007
|
-
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection):
|
|
2094
|
+
export declare function orderBy(fieldPath: string | FieldPath, directionStr?: OrderByDirection): QueryOrderByConstraint;
|
|
2008
2095
|
|
|
2009
2096
|
/**
|
|
2010
2097
|
* The direction of a {@link orderBy} clause is specified as 'desc' or 'asc'
|
|
@@ -2130,10 +2217,28 @@ export declare class Query<T = DocumentData> {
|
|
|
2130
2217
|
}
|
|
2131
2218
|
|
|
2132
2219
|
/**
|
|
2133
|
-
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2134
|
-
* additional query constraints.
|
|
2220
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2221
|
+
* include additional query constraints.
|
|
2135
2222
|
*
|
|
2136
|
-
* @param query - The {@link Query} instance to use as a base for the new
|
|
2223
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
2224
|
+
* constraints.
|
|
2225
|
+
* @param compositeFilter - The {@link QueryCompositeFilterConstraint} to
|
|
2226
|
+
* apply. Create {@link QueryCompositeFilterConstraint} using {@link and} or
|
|
2227
|
+
* {@link or}.
|
|
2228
|
+
* @param queryConstraints - Additional {@link QueryNonFilterConstraint}s to
|
|
2229
|
+
* apply (e.g. {@link orderBy}, {@link limit}).
|
|
2230
|
+
* @throws if any of the provided query constraints cannot be combined with the
|
|
2231
|
+
* existing or new constraints.
|
|
2232
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2233
|
+
*/
|
|
2234
|
+
export declare function query<T>(query: Query<T>, compositeFilter: QueryCompositeFilterConstraint, ...queryConstraints: QueryNonFilterConstraint[]): Query<T>;
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* Creates a new immutable instance of {@link Query} that is extended to also
|
|
2238
|
+
* include additional query constraints.
|
|
2239
|
+
*
|
|
2240
|
+
* @param query - The {@link Query} instance to use as a base for the new
|
|
2241
|
+
* constraints.
|
|
2137
2242
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
2138
2243
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
2139
2244
|
* existing or new constraints.
|
|
@@ -2157,20 +2262,46 @@ declare interface Query_2 {
|
|
|
2157
2262
|
readonly endAt: Bound | null;
|
|
2158
2263
|
}
|
|
2159
2264
|
|
|
2265
|
+
/**
|
|
2266
|
+
* A `QueryCompositeFilterConstraint` is used to narrow the set of documents
|
|
2267
|
+
* returned by a Firestore query by performing the logical OR or AND of multiple
|
|
2268
|
+
* {@link QueryFieldFilterConstraint}s or {@link QueryCompositeFilterConstraint}s.
|
|
2269
|
+
* `QueryCompositeFilterConstraint`s are created by invoking {@link or} or
|
|
2270
|
+
* {@link and} and can then be passed to {@link query} to create a new query
|
|
2271
|
+
* instance that also contains the `QueryCompositeFilterConstraint`.
|
|
2272
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2273
|
+
*/
|
|
2274
|
+
export declare class QueryCompositeFilterConstraint extends AppliableConstraint {
|
|
2275
|
+
/** The type of this query constraint */
|
|
2276
|
+
readonly type: 'or' | 'and';
|
|
2277
|
+
private readonly _queryConstraints;
|
|
2278
|
+
/**
|
|
2279
|
+
* @internal
|
|
2280
|
+
*/
|
|
2281
|
+
protected constructor(
|
|
2282
|
+
/** The type of this query constraint */
|
|
2283
|
+
type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]);
|
|
2284
|
+
static _create(type: 'or' | 'and', _queryConstraints: QueryFilterConstraint[]): QueryCompositeFilterConstraint;
|
|
2285
|
+
_parse<T>(query: Query<T>): Filter;
|
|
2286
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2287
|
+
_getQueryConstraints(): readonly AppliableConstraint[];
|
|
2288
|
+
_getOperator(): CompositeOperator;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2160
2291
|
/**
|
|
2161
2292
|
* A `QueryConstraint` is used to narrow the set of documents returned by a
|
|
2162
2293
|
* Firestore query. `QueryConstraint`s are created by invoking {@link where},
|
|
2163
|
-
* {@link orderBy}, {@link
|
|
2164
|
-
* endBefore
|
|
2294
|
+
* {@link orderBy}, {@link startAt}, {@link startAfter}, {@link
|
|
2295
|
+
* endBefore}, {@link endAt}, {@link limit}, {@link limitToLast} and
|
|
2165
2296
|
* can then be passed to {@link query} to create a new query instance that
|
|
2166
2297
|
* also contains this `QueryConstraint`.
|
|
2167
2298
|
*/
|
|
2168
|
-
export declare abstract class QueryConstraint {
|
|
2169
|
-
/** The type of this query
|
|
2299
|
+
export declare abstract class QueryConstraint extends AppliableConstraint {
|
|
2300
|
+
/** The type of this query constraint */
|
|
2170
2301
|
abstract readonly type: QueryConstraintType;
|
|
2171
2302
|
/**
|
|
2172
2303
|
* Takes the provided {@link Query} and returns a copy of the {@link Query} with this
|
|
2173
|
-
* {@link
|
|
2304
|
+
* {@link AppliableConstraint} applied.
|
|
2174
2305
|
*/
|
|
2175
2306
|
abstract _apply<T>(query: Query<T>): Query<T>;
|
|
2176
2307
|
}
|
|
@@ -2199,6 +2330,28 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
|
|
|
2199
2330
|
data(): T;
|
|
2200
2331
|
}
|
|
2201
2332
|
|
|
2333
|
+
/**
|
|
2334
|
+
* A `QueryEndAtConstraint` is used to exclude documents from the end of a
|
|
2335
|
+
* result set returned by a Firestore query.
|
|
2336
|
+
* `QueryEndAtConstraint`s are created by invoking {@link (endAt:1)} or
|
|
2337
|
+
* {@link (endBefore:1)} and can then be passed to {@link query} to create a new
|
|
2338
|
+
* query instance that also contains this `QueryEndAtConstraint`.
|
|
2339
|
+
*/
|
|
2340
|
+
export declare class QueryEndAtConstraint extends QueryConstraint {
|
|
2341
|
+
/** The type of this query constraint */
|
|
2342
|
+
readonly type: 'endBefore' | 'endAt';
|
|
2343
|
+
private readonly _docOrFields;
|
|
2344
|
+
private readonly _inclusive;
|
|
2345
|
+
/**
|
|
2346
|
+
* @internal
|
|
2347
|
+
*/
|
|
2348
|
+
protected constructor(
|
|
2349
|
+
/** The type of this query constraint */
|
|
2350
|
+
type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
2351
|
+
static _create(type: 'endBefore' | 'endAt', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryEndAtConstraint;
|
|
2352
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2202
2355
|
/**
|
|
2203
2356
|
* Returns true if the provided queries point to the same collection and apply
|
|
2204
2357
|
* the same constraints.
|
|
@@ -2210,6 +2363,93 @@ export declare class QueryDocumentSnapshot<T = DocumentData> extends DocumentSna
|
|
|
2210
2363
|
*/
|
|
2211
2364
|
export declare function queryEqual<T>(left: Query<T>, right: Query<T>): boolean;
|
|
2212
2365
|
|
|
2366
|
+
/**
|
|
2367
|
+
* A `QueryFieldFilterConstraint` is used to narrow the set of documents returned by
|
|
2368
|
+
* a Firestore query by filtering on one or more document fields.
|
|
2369
|
+
* `QueryFieldFilterConstraint`s are created by invoking {@link where} and can then
|
|
2370
|
+
* be passed to {@link query} to create a new query instance that also contains
|
|
2371
|
+
* this `QueryFieldFilterConstraint`.
|
|
2372
|
+
*/
|
|
2373
|
+
export declare class QueryFieldFilterConstraint extends QueryConstraint {
|
|
2374
|
+
private readonly _field;
|
|
2375
|
+
private _op;
|
|
2376
|
+
private _value;
|
|
2377
|
+
/** The type of this query constraint */
|
|
2378
|
+
readonly type = "where";
|
|
2379
|
+
/**
|
|
2380
|
+
* @internal
|
|
2381
|
+
*/
|
|
2382
|
+
protected constructor(_field: FieldPath_2, _op: Operator, _value: unknown);
|
|
2383
|
+
static _create(_field: FieldPath_2, _op: Operator, _value: unknown): QueryFieldFilterConstraint;
|
|
2384
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2385
|
+
_parse<T>(query: Query<T>): FieldFilter;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* `QueryFilterConstraint` is a helper union type that represents
|
|
2390
|
+
* {@link QueryFieldFilterConstraint} and {@link QueryCompositeFilterConstraint}.
|
|
2391
|
+
* `QueryFilterConstraint`s are created by invoking {@link or} or {@link and}
|
|
2392
|
+
* and can then be passed to {@link query} to create a new query instance that
|
|
2393
|
+
* also contains the `QueryConstraint`.
|
|
2394
|
+
* @internal TODO remove this internal tag with OR Query support in the server
|
|
2395
|
+
*/
|
|
2396
|
+
export declare type QueryFilterConstraint = QueryFieldFilterConstraint | QueryCompositeFilterConstraint;
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* A `QueryLimitConstraint` is used to limit the number of documents returned by
|
|
2400
|
+
* a Firestore query.
|
|
2401
|
+
* `QueryLimitConstraint`s are created by invoking {@link limit} or
|
|
2402
|
+
* {@link limitToLast} and can then be passed to {@link query} to create a new
|
|
2403
|
+
* query instance that also contains this `QueryLimitConstraint`.
|
|
2404
|
+
*/
|
|
2405
|
+
export declare class QueryLimitConstraint extends QueryConstraint {
|
|
2406
|
+
/** The type of this query constraint */
|
|
2407
|
+
readonly type: 'limit' | 'limitToLast';
|
|
2408
|
+
private readonly _limit;
|
|
2409
|
+
private readonly _limitType;
|
|
2410
|
+
/**
|
|
2411
|
+
* @internal
|
|
2412
|
+
*/
|
|
2413
|
+
protected constructor(
|
|
2414
|
+
/** The type of this query constraint */
|
|
2415
|
+
type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType);
|
|
2416
|
+
static _create(type: 'limit' | 'limitToLast', _limit: number, _limitType: LimitType): QueryLimitConstraint;
|
|
2417
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
/**
|
|
2421
|
+
* `QueryNonFilterConstraint` is a helper union type that represents
|
|
2422
|
+
* QueryConstraints which are used to narrow or order the set of documents,
|
|
2423
|
+
* but that do not explicitly filter on a document field.
|
|
2424
|
+
* `QueryNonFilterConstraint`s are created by invoking {@link orderBy},
|
|
2425
|
+
* {@link startAt}, {@link startAfter}, {@link endBefore}, {@link endAt},
|
|
2426
|
+
* {@link limit} or {@link limitToLast} and can then be passed to {@link query}
|
|
2427
|
+
* to create a new query instance that also contains the `QueryConstraint`.
|
|
2428
|
+
*/
|
|
2429
|
+
export declare type QueryNonFilterConstraint = QueryOrderByConstraint | QueryLimitConstraint | QueryStartAtConstraint | QueryEndAtConstraint;
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* A `QueryOrderByConstraint` is used to sort the set of documents returned by a
|
|
2433
|
+
* Firestore query. `QueryOrderByConstraint`s are created by invoking
|
|
2434
|
+
* {@link orderBy} and can then be passed to {@link query} to create a new query
|
|
2435
|
+
* instance that also contains this `QueryOrderByConstraint`.
|
|
2436
|
+
*
|
|
2437
|
+
* Note: Documents that do not contain the orderBy field will not be present in
|
|
2438
|
+
* the query result.
|
|
2439
|
+
*/
|
|
2440
|
+
export declare class QueryOrderByConstraint extends QueryConstraint {
|
|
2441
|
+
private readonly _field;
|
|
2442
|
+
private _direction;
|
|
2443
|
+
/** The type of this query constraint */
|
|
2444
|
+
readonly type = "orderBy";
|
|
2445
|
+
/**
|
|
2446
|
+
* @internal
|
|
2447
|
+
*/
|
|
2448
|
+
protected constructor(_field: FieldPath_2, _direction: Direction);
|
|
2449
|
+
static _create(_field: FieldPath_2, _direction: Direction): QueryOrderByConstraint;
|
|
2450
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2213
2453
|
/**
|
|
2214
2454
|
* A `QuerySnapshot` contains zero or more `DocumentSnapshot` objects
|
|
2215
2455
|
* representing the results of a query. The documents can be accessed as an
|
|
@@ -2242,6 +2482,28 @@ export declare class QuerySnapshot<T = DocumentData> {
|
|
|
2242
2482
|
forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: unknown): void;
|
|
2243
2483
|
}
|
|
2244
2484
|
|
|
2485
|
+
/**
|
|
2486
|
+
* A `QueryStartAtConstraint` is used to exclude documents from the start of a
|
|
2487
|
+
* result set returned by a Firestore query.
|
|
2488
|
+
* `QueryStartAtConstraint`s are created by invoking {@link (startAt:1)} or
|
|
2489
|
+
* {@link (startAfter:1)} and can then be passed to {@link query} to create a
|
|
2490
|
+
* new query instance that also contains this `QueryStartAtConstraint`.
|
|
2491
|
+
*/
|
|
2492
|
+
export declare class QueryStartAtConstraint extends QueryConstraint {
|
|
2493
|
+
/** The type of this query constraint */
|
|
2494
|
+
readonly type: 'startAt' | 'startAfter';
|
|
2495
|
+
private readonly _docOrFields;
|
|
2496
|
+
private readonly _inclusive;
|
|
2497
|
+
/**
|
|
2498
|
+
* @internal
|
|
2499
|
+
*/
|
|
2500
|
+
protected constructor(
|
|
2501
|
+
/** The type of this query constraint */
|
|
2502
|
+
type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean);
|
|
2503
|
+
static _create(type: 'startAt' | 'startAfter', _docOrFields: Array<unknown | DocumentSnapshot<unknown>>, _inclusive: boolean): QueryStartAtConstraint;
|
|
2504
|
+
_apply<T>(query: Query<T>): Query<T>;
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2245
2507
|
/**
|
|
2246
2508
|
* Returns true if the provided references are equal.
|
|
2247
2509
|
*
|
|
@@ -2418,48 +2680,48 @@ declare class SnapshotVersion {
|
|
|
2418
2680
|
}
|
|
2419
2681
|
|
|
2420
2682
|
/**
|
|
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.
|
|
2683
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2684
|
+
* start after the provided document (exclusive). The starting position is
|
|
2685
|
+
* relative to the order of the query. The document must contain all of the
|
|
2686
|
+
* fields provided in the orderBy of the query.
|
|
2425
2687
|
*
|
|
2426
2688
|
* @param snapshot - The snapshot of the document to start after.
|
|
2427
|
-
* @returns A {@link
|
|
2689
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
2428
2690
|
*/
|
|
2429
|
-
export declare function startAfter(snapshot: DocumentSnapshot<unknown>):
|
|
2691
|
+
export declare function startAfter(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
2430
2692
|
|
|
2431
2693
|
/**
|
|
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.
|
|
2694
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2695
|
+
* start after the provided fields relative to the order of the query. The order
|
|
2696
|
+
* of the field values must match the order of the order by clauses of the query.
|
|
2435
2697
|
*
|
|
2436
2698
|
* @param fieldValues - The field values to start this query after, in order
|
|
2437
2699
|
* of the query's order by.
|
|
2438
|
-
* @returns A {@link
|
|
2700
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`
|
|
2439
2701
|
*/
|
|
2440
|
-
export declare function startAfter(...fieldValues: unknown[]):
|
|
2702
|
+
export declare function startAfter(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
2441
2703
|
|
|
2442
2704
|
/**
|
|
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.
|
|
2705
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2706
|
+
* start at the provided document (inclusive). The starting position is relative
|
|
2707
|
+
* to the order of the query. The document must contain all of the fields
|
|
2708
|
+
* provided in the `orderBy` of this query.
|
|
2447
2709
|
*
|
|
2448
2710
|
* @param snapshot - The snapshot of the document to start at.
|
|
2449
|
-
* @returns A {@link
|
|
2711
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
2450
2712
|
*/
|
|
2451
|
-
export declare function startAt(snapshot: DocumentSnapshot<unknown>):
|
|
2713
|
+
export declare function startAt(snapshot: DocumentSnapshot<unknown>): QueryStartAtConstraint;
|
|
2452
2714
|
|
|
2453
2715
|
/**
|
|
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.
|
|
2716
|
+
* Creates a {@link QueryStartAtConstraint} that modifies the result set to
|
|
2717
|
+
* start at the provided fields relative to the order of the query. The order of
|
|
2718
|
+
* the field values must match the order of the order by clauses of the query.
|
|
2457
2719
|
*
|
|
2458
2720
|
* @param fieldValues - The field values to start this query at, in order
|
|
2459
2721
|
* of the query's order by.
|
|
2460
|
-
* @returns A {@link
|
|
2722
|
+
* @returns A {@link QueryStartAtConstraint} to pass to `query()`.
|
|
2461
2723
|
*/
|
|
2462
|
-
export declare function startAt(...fieldValues: unknown[]):
|
|
2724
|
+
export declare function startAt(...fieldValues: unknown[]): QueryStartAtConstraint;
|
|
2463
2725
|
|
|
2464
2726
|
declare type TargetChangeTargetChangeType = 'NO_CHANGE' | 'ADD' | 'REMOVE' | 'CURRENT' | 'RESET';
|
|
2465
2727
|
|
|
@@ -2947,17 +3209,17 @@ declare type Value = firestoreV1ApiClientInterfaces.Value;
|
|
|
2947
3209
|
declare type ValueNullValue = 'NULL_VALUE';
|
|
2948
3210
|
|
|
2949
3211
|
/**
|
|
2950
|
-
* Creates a {@link
|
|
2951
|
-
* specified field and that the value should satisfy the
|
|
2952
|
-
* provided.
|
|
3212
|
+
* Creates a {@link QueryFieldFilterConstraint} that enforces that documents
|
|
3213
|
+
* must contain the specified field and that the value should satisfy the
|
|
3214
|
+
* relation constraint provided.
|
|
2953
3215
|
*
|
|
2954
3216
|
* @param fieldPath - The path to compare
|
|
2955
3217
|
* @param opStr - The operation string (e.g "<", "<=", "==", "<",
|
|
2956
3218
|
* "<=", "!=").
|
|
2957
3219
|
* @param value - The value for comparison
|
|
2958
|
-
* @returns The created {@link
|
|
3220
|
+
* @returns The created {@link QueryFieldFilterConstraint}.
|
|
2959
3221
|
*/
|
|
2960
|
-
export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown):
|
|
3222
|
+
export declare function where(fieldPath: string | FieldPath, opStr: WhereFilterOp, value: unknown): QueryFieldFilterConstraint;
|
|
2961
3223
|
|
|
2962
3224
|
/**
|
|
2963
3225
|
* Filter conditions in a {@link where} clause are specified using the
|