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