@firebase/firestore 3.4.3-202202014332 → 3.4.3-canary.2d04af91d
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/src/api/database.d.ts +14 -9
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +76 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.esm2017.js +70 -13
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +85 -28
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +91 -11
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +91 -12
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +112 -13
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +118 -9
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +42 -42
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +31 -10
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/private.d.ts +22 -9
- package/package.json +9 -9
|
@@ -209,20 +209,25 @@ export declare function terminate(firestore: Firestore): Promise<void>;
|
|
|
209
209
|
/**
|
|
210
210
|
* Loads a Firestore bundle into the local cache.
|
|
211
211
|
*
|
|
212
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
213
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
214
|
-
*
|
|
212
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
213
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
214
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
215
215
|
*
|
|
216
|
-
* @returns
|
|
217
|
-
*
|
|
218
|
-
*
|
|
216
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
217
|
+
* updates, and completion or error events. It can be used as a
|
|
218
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
219
219
|
*/
|
|
220
220
|
export declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask;
|
|
221
221
|
/**
|
|
222
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
222
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
223
|
+
* name.
|
|
223
224
|
*
|
|
224
225
|
* The named queries are packaged into bundles on the server side (along
|
|
225
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
226
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
226
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
227
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
228
|
+
*
|
|
229
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
230
|
+
* @param name - The name of the query.
|
|
231
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
227
232
|
*/
|
|
228
233
|
export declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Firestore } from './database';
|
|
18
|
+
export { connectFirestoreEmulator, EmulatorMockTokenOptions } from '../lite-api/database';
|
|
19
|
+
/**
|
|
20
|
+
* A single field element in an index configuration.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export interface IndexField {
|
|
25
|
+
/** The field path to index. */
|
|
26
|
+
readonly fieldPath: string;
|
|
27
|
+
/**
|
|
28
|
+
* What type of array index to create. Set to `CONTAINS` for `array-contains`
|
|
29
|
+
* and `array-contains-any` indexes.
|
|
30
|
+
*
|
|
31
|
+
* Only one of `arrayConfig` or `order` should be set;
|
|
32
|
+
*/
|
|
33
|
+
readonly arrayConfig?: 'CONTAINS';
|
|
34
|
+
/**
|
|
35
|
+
* What type of array index to create. Set to `ASCENDING` or 'DESCENDING` for
|
|
36
|
+
* `==`, `!=`, `<=`, `<=`, `in` and `not-in` filters.
|
|
37
|
+
*
|
|
38
|
+
* Only one of `arrayConfig` or `order` should be set.
|
|
39
|
+
*/
|
|
40
|
+
readonly order?: 'ASCENDING' | 'DESCENDING';
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The SDK definition of a Firestore index.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export interface Index {
|
|
49
|
+
/** The ID of the collection to index. */
|
|
50
|
+
readonly collectionGroup: string;
|
|
51
|
+
/** A list of fields to index. */
|
|
52
|
+
readonly fields?: IndexField[];
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A list of Firestore indexes to speed up local query execution.
|
|
57
|
+
*
|
|
58
|
+
* See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format}
|
|
59
|
+
* for a description of the format of the index definition.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export interface IndexConfiguration {
|
|
64
|
+
/** A list of all Firestore indexes. */
|
|
65
|
+
readonly indexes?: Index[];
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Configures indexing for local query execution. Any previous index
|
|
70
|
+
* configuration is overridden. The `Promise` resolves once the index
|
|
71
|
+
* configuration has been persisted.
|
|
72
|
+
*
|
|
73
|
+
* The index entries themselves are created asynchronously. You can continue to
|
|
74
|
+
* use queries that require indexing even if the indices are not yet available.
|
|
75
|
+
* Query execution will automatically start using the index once the index
|
|
76
|
+
* entries have been written.
|
|
77
|
+
*
|
|
78
|
+
* Indexes are only supported with IndexedDb persistence. Invoke either
|
|
79
|
+
* `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
|
|
80
|
+
* before setting an index configuration. If IndexedDb is not enabled, any
|
|
81
|
+
* index configuration is ignored.
|
|
82
|
+
*
|
|
83
|
+
* @internal
|
|
84
|
+
* @param firestore - The {@link Firestore} instance to configure indexes for.
|
|
85
|
+
* @param configuration -The index definition.
|
|
86
|
+
* @throws FirestoreError if the JSON format is invalid.
|
|
87
|
+
* @returns A `Promise` that resolves once all indices are successfully
|
|
88
|
+
* configured.
|
|
89
|
+
*/
|
|
90
|
+
export declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Configures indexing for local query execution. Any previous index
|
|
93
|
+
* configuration is overridden. The `Promise` resolves once the index
|
|
94
|
+
* configuration has been persisted.
|
|
95
|
+
*
|
|
96
|
+
* The index entries themselves are created asynchronously. You can continue to
|
|
97
|
+
* use queries that require indexing even if the indices are not yet available.
|
|
98
|
+
* Query execution will automatically start using the index once the index
|
|
99
|
+
* entries have been written.
|
|
100
|
+
*
|
|
101
|
+
* Indexes are only supported with IndexedDb persistence. Invoke either
|
|
102
|
+
* `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
|
|
103
|
+
* before setting an index configuration. If IndexedDb is not enabled, any
|
|
104
|
+
* index configuration is ignored.
|
|
105
|
+
*
|
|
106
|
+
* The method accepts the JSON format exported by the Firebase CLI (`firebase
|
|
107
|
+
* firestore:indexes`). If the JSON format is invalid, this method throws an
|
|
108
|
+
* error.
|
|
109
|
+
*
|
|
110
|
+
* @internal
|
|
111
|
+
* @param firestore - The {@link Firestore} instance to configure indexes for.
|
|
112
|
+
* @param json -The JSON format exported by the Firebase CLI.
|
|
113
|
+
* @throws FirestoreError if the JSON format is invalid.
|
|
114
|
+
* @returns A `Promise` that resolves once all indices are successfully
|
|
115
|
+
* configured.
|
|
116
|
+
*/
|
|
117
|
+
export declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;
|
|
@@ -49,3 +49,4 @@ export type { ByteString as _ByteString } from './util/byte_string';
|
|
|
49
49
|
export { logWarn as _logWarn } from './util/log';
|
|
50
50
|
export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
|
|
51
51
|
export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
|
|
52
|
+
export { setIndexConfiguration as _setIndexConfiguration } from './api/index_configuration';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FieldPath } from './path';
|
|
18
|
+
/**
|
|
19
|
+
* An index definition for field indexes in Firestore.
|
|
20
|
+
*
|
|
21
|
+
* Every index is associated with a collection. The definition contains a list
|
|
22
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
23
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
24
|
+
*
|
|
25
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
26
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
27
|
+
* collection and collection group queries.
|
|
28
|
+
*/
|
|
29
|
+
export declare class FieldIndex {
|
|
30
|
+
/**
|
|
31
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
32
|
+
* has not yet been persisted).
|
|
33
|
+
*/
|
|
34
|
+
readonly indexId: number;
|
|
35
|
+
/** The collection ID this index applies to. */
|
|
36
|
+
readonly collectionGroup: string;
|
|
37
|
+
/** The field segments for this index. */
|
|
38
|
+
readonly segments: Segment[];
|
|
39
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
40
|
+
static UNKNOWN_ID: -1;
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
44
|
+
* has not yet been persisted).
|
|
45
|
+
*/
|
|
46
|
+
indexId: number,
|
|
47
|
+
/** The collection ID this index applies to. */
|
|
48
|
+
collectionGroup: string,
|
|
49
|
+
/** The field segments for this index. */
|
|
50
|
+
segments: Segment[]);
|
|
51
|
+
}
|
|
52
|
+
/** The type of the index, e.g. for which type of query it can be used. */
|
|
53
|
+
export declare const enum Kind {
|
|
54
|
+
/**
|
|
55
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
56
|
+
*/
|
|
57
|
+
ASCENDING = 0,
|
|
58
|
+
/**
|
|
59
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
60
|
+
*/
|
|
61
|
+
DESCENDING = 1,
|
|
62
|
+
/** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
|
|
63
|
+
CONTAINS = 2
|
|
64
|
+
}
|
|
65
|
+
/** An index component consisting of field path and index type. */
|
|
66
|
+
export declare class Segment {
|
|
67
|
+
/** The field path of the component. */
|
|
68
|
+
readonly fieldPath: FieldPath;
|
|
69
|
+
/** The fields sorting order. */
|
|
70
|
+
readonly kind: Kind;
|
|
71
|
+
constructor(
|
|
72
|
+
/** The field path of the component. */
|
|
73
|
+
fieldPath: FieldPath,
|
|
74
|
+
/** The fields sorting order. */
|
|
75
|
+
kind: Kind);
|
|
76
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
@@ -789,6 +789,22 @@ declare function yt(): boolean;
|
|
|
789
789
|
/**
|
|
790
790
|
* @internal
|
|
791
791
|
*/ declare function F(t: any, ...e: any[]): void;
|
|
792
|
+
/**
|
|
793
|
+
* @license
|
|
794
|
+
* Copyright 2021 Google LLC
|
|
795
|
+
*
|
|
796
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
797
|
+
* you may not use this file except in compliance with the License.
|
|
798
|
+
* You may obtain a copy of the License at
|
|
799
|
+
*
|
|
800
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
801
|
+
*
|
|
802
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
803
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
804
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
805
|
+
* See the License for the specific language governing permissions and
|
|
806
|
+
* limitations under the License.
|
|
807
|
+
*/ declare function Oh(t: any, e: any): Promise<void>;
|
|
792
808
|
/**
|
|
793
809
|
* Validates that two boolean options are not set at the same time.
|
|
794
810
|
* @internal
|
|
@@ -1085,20 +1101,25 @@ declare function lh(t: any): Promise<$u>;
|
|
|
1085
1101
|
/**
|
|
1086
1102
|
* Loads a Firestore bundle into the local cache.
|
|
1087
1103
|
*
|
|
1088
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
1089
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
1090
|
-
*
|
|
1104
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
1105
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
1106
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
1091
1107
|
*
|
|
1092
|
-
* @returns
|
|
1093
|
-
*
|
|
1094
|
-
*
|
|
1108
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
1109
|
+
* updates, and completion or error events. It can be used as a
|
|
1110
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
1095
1111
|
*/ declare function Ya(t: any, e: any): Oa;
|
|
1096
1112
|
/**
|
|
1097
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
1113
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
1114
|
+
* name.
|
|
1098
1115
|
*
|
|
1099
1116
|
* The named queries are packaged into bundles on the server side (along
|
|
1100
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
1101
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
1117
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
1118
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
1119
|
+
*
|
|
1120
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
1121
|
+
* @param name - The name of the query.
|
|
1122
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
1102
1123
|
*/ declare function Xa(t: any, e: any): any;
|
|
1103
1124
|
declare function Ih(t: any, ...e: any[]): () => void;
|
|
1104
1125
|
declare function Ah(t: any, e: any): () => void;
|
|
@@ -1780,4 +1801,4 @@ declare class Mo {
|
|
|
1780
1801
|
field: any;
|
|
1781
1802
|
transform: any;
|
|
1782
1803
|
}
|
|
1783
|
-
export { oh as AbstractUserDataWriter, nu as Bytes, Ma as CACHE_SIZE_UNLIMITED, Va as CollectionReference, Pa as DocumentReference, $u as DocumentSnapshot, tu as FieldPath, su as FieldValue, Fa as Firestore, Q as FirestoreError, iu as GeoPoint, Oa as LoadBundleTask, va as Query, Uu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, xu as SnapshotMetadata, at as Timestamp, Ph as Transaction, uh as WriteBatch, wa as _DatabaseId, Dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ea as _cast, q as _debugAssert, yt as _isBase64Available, F as _logWarn, ga as _validateIsNotUsedTogether, Eh as addDoc, Ch as arrayRemove, Dh as arrayUnion, Wa as clearIndexedDbPersistence, Sa as collection, Da as collectionGroup, ba as connectFirestoreEmulator, Th as deleteDoc, Vh as deleteField, Ha as disableNetwork, Ca as doc, eu as documentId, Ka as enableIndexedDbPersistence, ja as enableMultiTabIndexedDbPersistence, za as enableNetwork, eh as endAt, th as endBefore, Ua as ensureFirestoreConfigured, Rh as executeWrite, lh as getDoc, dh as getDocFromCache, wh as getDocFromServer, _h as getDocs, mh as getDocsFromCache, gh as getDocsFromServer, Ba as getFirestore, Nh as increment, La as initializeFirestore, zu as limit, Hu as limitToLast, Ya as loadBundle, Xa as namedQuery, Ih as onSnapshot, Ah as onSnapshotsInSync, Wu as orderBy, qu as query, ka as queryEqual, Na as refEqual, vh as runTransaction, Sh as serverTimestamp, yh as setDoc, $ as setLogLevel, Lu as snapshotEqual, Xu as startAfter, Yu as startAt, Ja as terminate, ph as updateDoc, Ga as waitForPendingWrites, ju as where, kh as writeBatch };
|
|
1804
|
+
export { oh as AbstractUserDataWriter, nu as Bytes, Ma as CACHE_SIZE_UNLIMITED, Va as CollectionReference, Pa as DocumentReference, $u as DocumentSnapshot, tu as FieldPath, su as FieldValue, Fa as Firestore, Q as FirestoreError, iu as GeoPoint, Oa as LoadBundleTask, va as Query, Uu as QueryConstraint, Ou as QueryDocumentSnapshot, Mu as QuerySnapshot, xu as SnapshotMetadata, at as Timestamp, Ph as Transaction, uh as WriteBatch, wa as _DatabaseId, Dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ea as _cast, q as _debugAssert, yt as _isBase64Available, F as _logWarn, Oh as _setIndexConfiguration, ga as _validateIsNotUsedTogether, Eh as addDoc, Ch as arrayRemove, Dh as arrayUnion, Wa as clearIndexedDbPersistence, Sa as collection, Da as collectionGroup, ba as connectFirestoreEmulator, Th as deleteDoc, Vh as deleteField, Ha as disableNetwork, Ca as doc, eu as documentId, Ka as enableIndexedDbPersistence, ja as enableMultiTabIndexedDbPersistence, za as enableNetwork, eh as endAt, th as endBefore, Ua as ensureFirestoreConfigured, Rh as executeWrite, lh as getDoc, dh as getDocFromCache, wh as getDocFromServer, _h as getDocs, mh as getDocsFromCache, gh as getDocsFromServer, Ba as getFirestore, Nh as increment, La as initializeFirestore, zu as limit, Hu as limitToLast, Ya as loadBundle, Xa as namedQuery, Ih as onSnapshot, Ah as onSnapshotsInSync, Wu as orderBy, qu as query, ka as queryEqual, Na as refEqual, vh as runTransaction, Sh as serverTimestamp, yh as setDoc, $ as setLogLevel, Lu as snapshotEqual, Xu as startAfter, Yu as startAt, Ja as terminate, ph as updateDoc, Ga as waitForPendingWrites, ju as where, kh as writeBatch };
|
|
@@ -209,20 +209,25 @@ export declare function terminate(firestore: Firestore): Promise<void>;
|
|
|
209
209
|
/**
|
|
210
210
|
* Loads a Firestore bundle into the local cache.
|
|
211
211
|
*
|
|
212
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
213
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
214
|
-
*
|
|
212
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
213
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
214
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
215
215
|
*
|
|
216
|
-
* @returns
|
|
217
|
-
*
|
|
218
|
-
*
|
|
216
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
217
|
+
* updates, and completion or error events. It can be used as a
|
|
218
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
219
219
|
*/
|
|
220
220
|
export declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask;
|
|
221
221
|
/**
|
|
222
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
222
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
223
|
+
* name.
|
|
223
224
|
*
|
|
224
225
|
* The named queries are packaged into bundles on the server side (along
|
|
225
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
226
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
226
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
227
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
228
|
+
*
|
|
229
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
230
|
+
* @param name - The name of the query.
|
|
231
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
227
232
|
*/
|
|
228
233
|
export declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Firestore } from './database';
|
|
18
|
+
export { connectFirestoreEmulator, EmulatorMockTokenOptions } from '../lite-api/database';
|
|
19
|
+
/**
|
|
20
|
+
* A single field element in an index configuration.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export interface IndexField {
|
|
25
|
+
/** The field path to index. */
|
|
26
|
+
readonly fieldPath: string;
|
|
27
|
+
/**
|
|
28
|
+
* What type of array index to create. Set to `CONTAINS` for `array-contains`
|
|
29
|
+
* and `array-contains-any` indexes.
|
|
30
|
+
*
|
|
31
|
+
* Only one of `arrayConfig` or `order` should be set;
|
|
32
|
+
*/
|
|
33
|
+
readonly arrayConfig?: 'CONTAINS';
|
|
34
|
+
/**
|
|
35
|
+
* What type of array index to create. Set to `ASCENDING` or 'DESCENDING` for
|
|
36
|
+
* `==`, `!=`, `<=`, `<=`, `in` and `not-in` filters.
|
|
37
|
+
*
|
|
38
|
+
* Only one of `arrayConfig` or `order` should be set.
|
|
39
|
+
*/
|
|
40
|
+
readonly order?: 'ASCENDING' | 'DESCENDING';
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The SDK definition of a Firestore index.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export interface Index {
|
|
49
|
+
/** The ID of the collection to index. */
|
|
50
|
+
readonly collectionGroup: string;
|
|
51
|
+
/** A list of fields to index. */
|
|
52
|
+
readonly fields?: IndexField[];
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A list of Firestore indexes to speed up local query execution.
|
|
57
|
+
*
|
|
58
|
+
* See {@link https://firebase.google.com/docs/reference/firestore/indexes/#json_format | JSON Format}
|
|
59
|
+
* for a description of the format of the index definition.
|
|
60
|
+
*
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export interface IndexConfiguration {
|
|
64
|
+
/** A list of all Firestore indexes. */
|
|
65
|
+
readonly indexes?: Index[];
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Configures indexing for local query execution. Any previous index
|
|
70
|
+
* configuration is overridden. The `Promise` resolves once the index
|
|
71
|
+
* configuration has been persisted.
|
|
72
|
+
*
|
|
73
|
+
* The index entries themselves are created asynchronously. You can continue to
|
|
74
|
+
* use queries that require indexing even if the indices are not yet available.
|
|
75
|
+
* Query execution will automatically start using the index once the index
|
|
76
|
+
* entries have been written.
|
|
77
|
+
*
|
|
78
|
+
* Indexes are only supported with IndexedDb persistence. Invoke either
|
|
79
|
+
* `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
|
|
80
|
+
* before setting an index configuration. If IndexedDb is not enabled, any
|
|
81
|
+
* index configuration is ignored.
|
|
82
|
+
*
|
|
83
|
+
* @internal
|
|
84
|
+
* @param firestore - The {@link Firestore} instance to configure indexes for.
|
|
85
|
+
* @param configuration -The index definition.
|
|
86
|
+
* @throws FirestoreError if the JSON format is invalid.
|
|
87
|
+
* @returns A `Promise` that resolves once all indices are successfully
|
|
88
|
+
* configured.
|
|
89
|
+
*/
|
|
90
|
+
export declare function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Configures indexing for local query execution. Any previous index
|
|
93
|
+
* configuration is overridden. The `Promise` resolves once the index
|
|
94
|
+
* configuration has been persisted.
|
|
95
|
+
*
|
|
96
|
+
* The index entries themselves are created asynchronously. You can continue to
|
|
97
|
+
* use queries that require indexing even if the indices are not yet available.
|
|
98
|
+
* Query execution will automatically start using the index once the index
|
|
99
|
+
* entries have been written.
|
|
100
|
+
*
|
|
101
|
+
* Indexes are only supported with IndexedDb persistence. Invoke either
|
|
102
|
+
* `enableIndexedDbPersistence()` or `enableMultiTabIndexedDbPersistence()`
|
|
103
|
+
* before setting an index configuration. If IndexedDb is not enabled, any
|
|
104
|
+
* index configuration is ignored.
|
|
105
|
+
*
|
|
106
|
+
* The method accepts the JSON format exported by the Firebase CLI (`firebase
|
|
107
|
+
* firestore:indexes`). If the JSON format is invalid, this method throws an
|
|
108
|
+
* error.
|
|
109
|
+
*
|
|
110
|
+
* @internal
|
|
111
|
+
* @param firestore - The {@link Firestore} instance to configure indexes for.
|
|
112
|
+
* @param json -The JSON format exported by the Firebase CLI.
|
|
113
|
+
* @throws FirestoreError if the JSON format is invalid.
|
|
114
|
+
* @returns A `Promise` that resolves once all indices are successfully
|
|
115
|
+
* configured.
|
|
116
|
+
*/
|
|
117
|
+
export declare function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;
|
|
@@ -49,3 +49,4 @@ export type { ByteString as _ByteString } from './util/byte_string';
|
|
|
49
49
|
export { logWarn as _logWarn } from './util/log';
|
|
50
50
|
export { EmptyAuthCredentialsProvider as _EmptyAuthCredentialsProvider } from './api/credentials';
|
|
51
51
|
export { EmptyAppCheckTokenProvider as _EmptyAppCheckTokenProvider } from './api/credentials';
|
|
52
|
+
export { setIndexConfiguration as _setIndexConfiguration } from './api/index_configuration';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FieldPath } from './path';
|
|
18
|
+
/**
|
|
19
|
+
* An index definition for field indexes in Firestore.
|
|
20
|
+
*
|
|
21
|
+
* Every index is associated with a collection. The definition contains a list
|
|
22
|
+
* of fields and their index kind (which can be `ASCENDING`, `DESCENDING` or
|
|
23
|
+
* `CONTAINS` for ArrayContains/ArrayContainsAny queries).
|
|
24
|
+
*
|
|
25
|
+
* Unlike the backend, the SDK does not differentiate between collection or
|
|
26
|
+
* collection group-scoped indices. Every index can be used for both single
|
|
27
|
+
* collection and collection group queries.
|
|
28
|
+
*/
|
|
29
|
+
export declare class FieldIndex {
|
|
30
|
+
/**
|
|
31
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
32
|
+
* has not yet been persisted).
|
|
33
|
+
*/
|
|
34
|
+
readonly indexId: number;
|
|
35
|
+
/** The collection ID this index applies to. */
|
|
36
|
+
readonly collectionGroup: string;
|
|
37
|
+
/** The field segments for this index. */
|
|
38
|
+
readonly segments: Segment[];
|
|
39
|
+
/** An ID for an index that has not yet been added to persistence. */
|
|
40
|
+
static UNKNOWN_ID: -1;
|
|
41
|
+
constructor(
|
|
42
|
+
/**
|
|
43
|
+
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
44
|
+
* has not yet been persisted).
|
|
45
|
+
*/
|
|
46
|
+
indexId: number,
|
|
47
|
+
/** The collection ID this index applies to. */
|
|
48
|
+
collectionGroup: string,
|
|
49
|
+
/** The field segments for this index. */
|
|
50
|
+
segments: Segment[]);
|
|
51
|
+
}
|
|
52
|
+
/** The type of the index, e.g. for which type of query it can be used. */
|
|
53
|
+
export declare const enum Kind {
|
|
54
|
+
/**
|
|
55
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
56
|
+
*/
|
|
57
|
+
ASCENDING = 0,
|
|
58
|
+
/**
|
|
59
|
+
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
60
|
+
*/
|
|
61
|
+
DESCENDING = 1,
|
|
62
|
+
/** Contains index. Can be used for ArrayContains and ArrayContainsAny. */
|
|
63
|
+
CONTAINS = 2
|
|
64
|
+
}
|
|
65
|
+
/** An index component consisting of field path and index type. */
|
|
66
|
+
export declare class Segment {
|
|
67
|
+
/** The field path of the component. */
|
|
68
|
+
readonly fieldPath: FieldPath;
|
|
69
|
+
/** The fields sorting order. */
|
|
70
|
+
readonly kind: Kind;
|
|
71
|
+
constructor(
|
|
72
|
+
/** The field path of the component. */
|
|
73
|
+
fieldPath: FieldPath,
|
|
74
|
+
/** The fields sorting order. */
|
|
75
|
+
kind: Kind);
|
|
76
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
package/dist/private.d.ts
CHANGED
|
@@ -2139,6 +2139,12 @@ export declare function getFirestore(app?: FirebaseApp): Firestore;
|
|
|
2139
2139
|
*/
|
|
2140
2140
|
export declare function increment(n: number): FieldValue;
|
|
2141
2141
|
|
|
2142
|
+
/* Excluded from this release type: Index */
|
|
2143
|
+
|
|
2144
|
+
/* Excluded from this release type: IndexConfiguration */
|
|
2145
|
+
|
|
2146
|
+
/* Excluded from this release type: IndexField */
|
|
2147
|
+
|
|
2142
2148
|
declare type IndexFieldMode = 'MODE_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
2143
2149
|
|
|
2144
2150
|
/**
|
|
@@ -2267,13 +2273,13 @@ declare class LLRBNode<K, V> {
|
|
|
2267
2273
|
/**
|
|
2268
2274
|
* Loads a Firestore bundle into the local cache.
|
|
2269
2275
|
*
|
|
2270
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
2271
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
2272
|
-
*
|
|
2276
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
2277
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
2278
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
2273
2279
|
*
|
|
2274
|
-
* @returns
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2280
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
2281
|
+
* updates, and completion or error events. It can be used as a
|
|
2282
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
2277
2283
|
*/
|
|
2278
2284
|
export declare function loadBundle(firestore: Firestore, bundleData: ReadableStream<Uint8Array> | ArrayBuffer | string): LoadBundleTask;
|
|
2279
2285
|
|
|
@@ -2748,11 +2754,16 @@ declare interface NamedQuery {
|
|
|
2748
2754
|
}
|
|
2749
2755
|
|
|
2750
2756
|
/**
|
|
2751
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
2757
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
2758
|
+
* name.
|
|
2752
2759
|
*
|
|
2753
2760
|
* The named queries are packaged into bundles on the server side (along
|
|
2754
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
2755
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
2761
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
2762
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
2763
|
+
*
|
|
2764
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
2765
|
+
* @param name - The name of the query.
|
|
2766
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
2756
2767
|
*/
|
|
2757
2768
|
export declare function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
|
|
2758
2769
|
|
|
@@ -4031,6 +4042,8 @@ export declare function setDoc<T>(reference: DocumentReference<T>, data: WithFie
|
|
|
4031
4042
|
*/
|
|
4032
4043
|
export declare function setDoc<T>(reference: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): Promise<void>;
|
|
4033
4044
|
|
|
4045
|
+
/* Excluded from this release type: _setIndexConfiguration */
|
|
4046
|
+
|
|
4034
4047
|
/**
|
|
4035
4048
|
* Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
|
|
4036
4049
|
*
|