@firebase/firestore 3.4.4-canary.222f264ff → 3.4.4-canary.2dd99ae2d
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/{query.d.ts → filter.d.ts} +0 -0
- package/dist/firestore/src/api.d.ts +1 -1
- package/dist/firestore/src/core/database_info.d.ts +1 -0
- package/dist/firestore/src/core/target.d.ts +26 -1
- package/dist/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/firestore/src/model/document.d.ts +7 -0
- package/dist/firestore/src/model/document_key.d.ts +1 -0
- package/dist/firestore/src/model/field_index.d.ts +87 -7
- package/dist/firestore/src/model/values.d.ts +7 -0
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/firestore/test/util/helpers.d.ts +8 -2
- package/dist/index.esm2017.js +3300 -3205
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +3646 -3587
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +266 -150
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +266 -150
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +3299 -3246
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +12 -12
- package/dist/lite/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/firestore/src/api.d.ts +1 -1
- package/dist/lite/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/firestore/src/core/target.d.ts +26 -1
- package/dist/lite/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +87 -7
- package/dist/lite/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/index.browser.esm2017.js +20 -9
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +49 -42
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +20 -8
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +20 -8
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +20 -9
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +9 -0
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -1
- package/dist/lite/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/target.d.ts +26 -1
- package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/lite/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/lite/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +87 -7
- package/dist/lite/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/lite/private.d.ts +7 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +183 -181
- package/dist/packages/firestore/src/api/{query.d.ts → filter.d.ts} +0 -0
- package/dist/packages/firestore/src/api.d.ts +1 -1
- package/dist/packages/firestore/src/core/database_info.d.ts +1 -0
- package/dist/packages/firestore/src/core/target.d.ts +26 -1
- package/dist/packages/firestore/src/local/local_serializer.d.ts +1 -1
- package/dist/packages/firestore/src/local/remote_document_change_buffer.d.ts +3 -12
- package/dist/packages/firestore/src/model/document.d.ts +7 -0
- package/dist/packages/firestore/src/model/document_key.d.ts +1 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +87 -7
- package/dist/packages/firestore/src/model/values.d.ts +7 -0
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +1 -1
- package/dist/packages/firestore/test/unit/model/field_index.test.d.ts +17 -0
- package/dist/packages/firestore/test/unit/model/target.test.d.ts +17 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +8 -2
- package/dist/private.d.ts +10 -12
- package/package.json +9 -9
package/dist/internal.d.ts
CHANGED
|
@@ -623,6 +623,7 @@ export declare class _DatabaseId {
|
|
|
623
623
|
readonly projectId: string;
|
|
624
624
|
readonly database: string;
|
|
625
625
|
constructor(projectId: string, database?: string);
|
|
626
|
+
static empty(): _DatabaseId;
|
|
626
627
|
get isDefaultDatabase(): boolean;
|
|
627
628
|
isEqual(other: {}): boolean;
|
|
628
629
|
}
|
|
@@ -841,6 +842,11 @@ declare interface Document_2 {
|
|
|
841
842
|
* document was guaranteed to not exist.
|
|
842
843
|
*/
|
|
843
844
|
readonly version: SnapshotVersion;
|
|
845
|
+
/**
|
|
846
|
+
* The timestamp at which this document was read from the remote server. Uses
|
|
847
|
+
* `SnapshotVersion.min()` for documents created by the user.
|
|
848
|
+
*/
|
|
849
|
+
readonly readTime: SnapshotVersion;
|
|
844
850
|
/** The underlying data of this document or an empty value if no data exists. */
|
|
845
851
|
readonly data: ObjectValue;
|
|
846
852
|
/** Returns whether local mutations were applied via the mutation queue. */
|
|
@@ -931,6 +937,7 @@ export declare class _DocumentKey {
|
|
|
931
937
|
constructor(path: _ResourcePath);
|
|
932
938
|
static fromPath(path: string): _DocumentKey;
|
|
933
939
|
static fromName(name: string): _DocumentKey;
|
|
940
|
+
static empty(): _DocumentKey;
|
|
934
941
|
/** Returns true if the document is in the specified collectionId. */
|
|
935
942
|
hasCollectionId(collectionId: string): boolean;
|
|
936
943
|
isEqual(other: _DocumentKey | null): boolean;
|
|
@@ -2639,6 +2646,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
2639
2646
|
readonly key: _DocumentKey;
|
|
2640
2647
|
private documentType;
|
|
2641
2648
|
version: SnapshotVersion;
|
|
2649
|
+
readTime: SnapshotVersion;
|
|
2642
2650
|
data: ObjectValue;
|
|
2643
2651
|
private documentState;
|
|
2644
2652
|
private constructor();
|
|
@@ -2678,6 +2686,7 @@ declare class MutableDocument implements Document_2 {
|
|
|
2678
2686
|
convertToUnknownDocument(version: SnapshotVersion): MutableDocument;
|
|
2679
2687
|
setHasCommittedMutations(): MutableDocument;
|
|
2680
2688
|
setHasLocalMutations(): MutableDocument;
|
|
2689
|
+
setReadTime(readTime: SnapshotVersion): MutableDocument;
|
|
2681
2690
|
get hasLocalMutations(): boolean;
|
|
2682
2691
|
get hasCommittedMutations(): boolean;
|
|
2683
2692
|
get hasPendingWrites(): boolean;
|
|
@@ -3994,14 +4003,6 @@ declare interface RemoteDocumentCache {
|
|
|
3994
4003
|
getSize(transaction: PersistenceTransaction): PersistencePromise<number>;
|
|
3995
4004
|
}
|
|
3996
4005
|
|
|
3997
|
-
/**
|
|
3998
|
-
* Represents a document change to be applied to remote document cache.
|
|
3999
|
-
*/
|
|
4000
|
-
declare interface RemoteDocumentChange {
|
|
4001
|
-
readonly document: MutableDocument;
|
|
4002
|
-
readonly readTime: SnapshotVersion | null;
|
|
4003
|
-
}
|
|
4004
|
-
|
|
4005
4006
|
/**
|
|
4006
4007
|
* An in-memory buffer of entries to be written to a RemoteDocumentCache.
|
|
4007
4008
|
* It can be used to batch up a set of changes to be written to the cache, but
|
|
@@ -4017,26 +4018,25 @@ declare interface RemoteDocumentChange {
|
|
|
4017
4018
|
* porting this class as part of that implementation work.
|
|
4018
4019
|
*/
|
|
4019
4020
|
declare abstract class RemoteDocumentChangeBuffer {
|
|
4020
|
-
protected changes: ObjectMap<_DocumentKey,
|
|
4021
|
+
protected changes: ObjectMap<_DocumentKey, MutableDocument>;
|
|
4021
4022
|
private changesApplied;
|
|
4022
4023
|
protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: _DocumentKey): PersistencePromise<MutableDocument>;
|
|
4023
4024
|
protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
4024
4025
|
protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>;
|
|
4025
|
-
protected getReadTime(key: _DocumentKey): SnapshotVersion;
|
|
4026
4026
|
/**
|
|
4027
4027
|
* Buffers a `RemoteDocumentCache.addEntry()` call.
|
|
4028
4028
|
*
|
|
4029
4029
|
* You can only modify documents that have already been retrieved via
|
|
4030
4030
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
4031
4031
|
*/
|
|
4032
|
-
addEntry(document: MutableDocument
|
|
4032
|
+
addEntry(document: MutableDocument): void;
|
|
4033
4033
|
/**
|
|
4034
4034
|
* Buffers a `RemoteDocumentCache.removeEntry()` call.
|
|
4035
4035
|
*
|
|
4036
4036
|
* You can only remove documents that have already been retrieved via
|
|
4037
4037
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
4038
4038
|
*/
|
|
4039
|
-
removeEntry(key: _DocumentKey, readTime
|
|
4039
|
+
removeEntry(key: _DocumentKey, readTime: SnapshotVersion): void;
|
|
4040
4040
|
/**
|
|
4041
4041
|
* Looks up an entry in the cache. The buffered changes will first be checked,
|
|
4042
4042
|
* and if no buffered change applies, this will forward to
|
|
File without changes
|
|
@@ -20,7 +20,7 @@ export { LoadBundleTask, LoadBundleTaskProgress, TaskState } from './api/bundle'
|
|
|
20
20
|
export { FirestoreSettings, PersistenceSettings } from './api/settings';
|
|
21
21
|
export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual, SnapshotOptions, FirestoreDataConverter, DocumentChangeType, SnapshotMetadata } from './api/snapshot';
|
|
22
22
|
export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
|
|
23
|
-
export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/
|
|
23
|
+
export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
|
|
24
24
|
export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
|
|
25
25
|
export { runTransaction, Transaction } from './api/transaction';
|
|
26
26
|
export { getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc, deleteDoc, addDoc, executeWrite } from './api/reference_impl';
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Document } from '../model/document';
|
|
18
|
+
import { FieldIndex } from '../model/field_index';
|
|
18
19
|
import { FieldPath, ResourcePath } from '../model/path';
|
|
19
20
|
import { Value as ProtoValue } from '../protos/firestore_proto_api';
|
|
20
21
|
/**
|
|
@@ -56,7 +57,31 @@ export declare function newTarget(path: ResourcePath, collectionGroup?: string |
|
|
|
56
57
|
export declare function canonifyTarget(target: Target): string;
|
|
57
58
|
export declare function stringifyTarget(target: Target): string;
|
|
58
59
|
export declare function targetEquals(left: Target, right: Target): boolean;
|
|
59
|
-
export declare function
|
|
60
|
+
export declare function targetIsDocumentTarget(target: Target): boolean;
|
|
61
|
+
/** Returns the field filters that target the given field path. */
|
|
62
|
+
export declare function targetGetFieldFiltersForPath(target: Target, path: FieldPath): FieldFilter[];
|
|
63
|
+
/**
|
|
64
|
+
* Returns the values that are used in ARRAY_CONTAINS or ARRAY_CONTAINS_ANY
|
|
65
|
+
* filters. Returns `null` if there are no such filters.
|
|
66
|
+
*/
|
|
67
|
+
export declare function targetGetArrayValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the list of values that are used in != or NOT_IN filters. Returns
|
|
70
|
+
* `null` if there are no such filters.
|
|
71
|
+
*/
|
|
72
|
+
export declare function targetGetNotInValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
|
|
73
|
+
/**
|
|
74
|
+
* Returns a lower bound of field values that can be used as a starting point to
|
|
75
|
+
* scan the index defined by `fieldIndex`. Returns `null` if no lower bound
|
|
76
|
+
* exists.
|
|
77
|
+
*/
|
|
78
|
+
export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound | null;
|
|
79
|
+
/**
|
|
80
|
+
* Returns an upper bound of field values that can be used as an ending point
|
|
81
|
+
* when scanning the index defined by `fieldIndex`. Returns `null` if no
|
|
82
|
+
* upper bound exists.
|
|
83
|
+
*/
|
|
84
|
+
export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound | null;
|
|
60
85
|
export declare abstract class Filter {
|
|
61
86
|
abstract matches(doc: Document): boolean;
|
|
62
87
|
}
|
|
@@ -31,7 +31,7 @@ export declare class LocalSerializer {
|
|
|
31
31
|
/** Decodes a remote document from storage locally to a Document. */
|
|
32
32
|
export declare function fromDbRemoteDocument(localSerializer: LocalSerializer, remoteDoc: DbRemoteDocument): MutableDocument;
|
|
33
33
|
/** Encodes a document for storage locally. */
|
|
34
|
-
export declare function toDbRemoteDocument(localSerializer: LocalSerializer, document: MutableDocument
|
|
34
|
+
export declare function toDbRemoteDocument(localSerializer: LocalSerializer, document: MutableDocument): DbRemoteDocument;
|
|
35
35
|
export declare function toDbTimestampKey(snapshotVersion: SnapshotVersion): DbTimestampKey;
|
|
36
36
|
export declare function fromDbTimestampKey(dbTimestampKey: DbTimestampKey): SnapshotVersion;
|
|
37
37
|
/** Encodes a batch of mutations into a DbMutationBatch for local storage. */
|
|
@@ -21,13 +21,6 @@ import { DocumentKey } from '../model/document_key';
|
|
|
21
21
|
import { ObjectMap } from '../util/obj_map';
|
|
22
22
|
import { PersistencePromise } from './persistence_promise';
|
|
23
23
|
import { PersistenceTransaction } from './persistence_transaction';
|
|
24
|
-
/**
|
|
25
|
-
* Represents a document change to be applied to remote document cache.
|
|
26
|
-
*/
|
|
27
|
-
interface RemoteDocumentChange {
|
|
28
|
-
readonly document: MutableDocument;
|
|
29
|
-
readonly readTime: SnapshotVersion | null;
|
|
30
|
-
}
|
|
31
24
|
/**
|
|
32
25
|
* An in-memory buffer of entries to be written to a RemoteDocumentCache.
|
|
33
26
|
* It can be used to batch up a set of changes to be written to the cache, but
|
|
@@ -43,26 +36,25 @@ interface RemoteDocumentChange {
|
|
|
43
36
|
* porting this class as part of that implementation work.
|
|
44
37
|
*/
|
|
45
38
|
export declare abstract class RemoteDocumentChangeBuffer {
|
|
46
|
-
protected changes: ObjectMap<DocumentKey,
|
|
39
|
+
protected changes: ObjectMap<DocumentKey, MutableDocument>;
|
|
47
40
|
private changesApplied;
|
|
48
41
|
protected abstract getFromCache(transaction: PersistenceTransaction, documentKey: DocumentKey): PersistencePromise<MutableDocument>;
|
|
49
42
|
protected abstract getAllFromCache(transaction: PersistenceTransaction, documentKeys: DocumentKeySet): PersistencePromise<MutableDocumentMap>;
|
|
50
43
|
protected abstract applyChanges(transaction: PersistenceTransaction): PersistencePromise<void>;
|
|
51
|
-
protected getReadTime(key: DocumentKey): SnapshotVersion;
|
|
52
44
|
/**
|
|
53
45
|
* Buffers a `RemoteDocumentCache.addEntry()` call.
|
|
54
46
|
*
|
|
55
47
|
* You can only modify documents that have already been retrieved via
|
|
56
48
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
57
49
|
*/
|
|
58
|
-
addEntry(document: MutableDocument
|
|
50
|
+
addEntry(document: MutableDocument): void;
|
|
59
51
|
/**
|
|
60
52
|
* Buffers a `RemoteDocumentCache.removeEntry()` call.
|
|
61
53
|
*
|
|
62
54
|
* You can only remove documents that have already been retrieved via
|
|
63
55
|
* `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
|
|
64
56
|
*/
|
|
65
|
-
removeEntry(key: DocumentKey, readTime
|
|
57
|
+
removeEntry(key: DocumentKey, readTime: SnapshotVersion): void;
|
|
66
58
|
/**
|
|
67
59
|
* Looks up an entry in the cache. The buffered changes will first be checked,
|
|
68
60
|
* and if no buffered change applies, this will forward to
|
|
@@ -94,4 +86,3 @@ export declare abstract class RemoteDocumentChangeBuffer {
|
|
|
94
86
|
/** Helper to assert this.changes is not null */
|
|
95
87
|
protected assertNotApplied(): void;
|
|
96
88
|
}
|
|
97
|
-
export {};
|
|
@@ -30,6 +30,11 @@ export interface Document {
|
|
|
30
30
|
* document was guaranteed to not exist.
|
|
31
31
|
*/
|
|
32
32
|
readonly version: SnapshotVersion;
|
|
33
|
+
/**
|
|
34
|
+
* The timestamp at which this document was read from the remote server. Uses
|
|
35
|
+
* `SnapshotVersion.min()` for documents created by the user.
|
|
36
|
+
*/
|
|
37
|
+
readonly readTime: SnapshotVersion;
|
|
33
38
|
/** The underlying data of this document or an empty value if no data exists. */
|
|
34
39
|
readonly data: ObjectValue;
|
|
35
40
|
/** Returns whether local mutations were applied via the mutation queue. */
|
|
@@ -79,6 +84,7 @@ export declare class MutableDocument implements Document {
|
|
|
79
84
|
readonly key: DocumentKey;
|
|
80
85
|
private documentType;
|
|
81
86
|
version: SnapshotVersion;
|
|
87
|
+
readTime: SnapshotVersion;
|
|
82
88
|
data: ObjectValue;
|
|
83
89
|
private documentState;
|
|
84
90
|
private constructor();
|
|
@@ -118,6 +124,7 @@ export declare class MutableDocument implements Document {
|
|
|
118
124
|
convertToUnknownDocument(version: SnapshotVersion): MutableDocument;
|
|
119
125
|
setHasCommittedMutations(): MutableDocument;
|
|
120
126
|
setHasLocalMutations(): MutableDocument;
|
|
127
|
+
setReadTime(readTime: SnapshotVersion): MutableDocument;
|
|
121
128
|
get hasLocalMutations(): boolean;
|
|
122
129
|
get hasCommittedMutations(): boolean;
|
|
123
130
|
get hasPendingWrites(): boolean;
|
|
@@ -23,6 +23,7 @@ export declare class DocumentKey {
|
|
|
23
23
|
constructor(path: ResourcePath);
|
|
24
24
|
static fromPath(path: string): DocumentKey;
|
|
25
25
|
static fromName(name: string): DocumentKey;
|
|
26
|
+
static empty(): DocumentKey;
|
|
26
27
|
/** Returns true if the document is in the specified collectionId. */
|
|
27
28
|
hasCollectionId(collectionId: string): boolean;
|
|
28
29
|
isEqual(other: DocumentKey | null): boolean;
|
|
@@ -14,7 +14,15 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import { SnapshotVersion } from '../core/snapshot_version';
|
|
18
|
+
import { Document } from './document';
|
|
19
|
+
import { DocumentKey } from './document_key';
|
|
17
20
|
import { FieldPath } from './path';
|
|
21
|
+
/**
|
|
22
|
+
* The initial sequence number for each index. Gets updated during index
|
|
23
|
+
* backfill.
|
|
24
|
+
*/
|
|
25
|
+
export declare const INITIAL_SEQUENCE_NUMBER = 0;
|
|
18
26
|
/**
|
|
19
27
|
* An index definition for field indexes in Firestore.
|
|
20
28
|
*
|
|
@@ -35,9 +43,11 @@ export declare class FieldIndex {
|
|
|
35
43
|
/** The collection ID this index applies to. */
|
|
36
44
|
readonly collectionGroup: string;
|
|
37
45
|
/** The field segments for this index. */
|
|
38
|
-
readonly segments:
|
|
46
|
+
readonly segments: IndexSegment[];
|
|
47
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
48
|
+
readonly indexState: IndexState;
|
|
39
49
|
/** An ID for an index that has not yet been added to persistence. */
|
|
40
|
-
static UNKNOWN_ID:
|
|
50
|
+
static UNKNOWN_ID: number;
|
|
41
51
|
constructor(
|
|
42
52
|
/**
|
|
43
53
|
* The index ID. Returns -1 if the index ID is not available (e.g. the index
|
|
@@ -47,10 +57,21 @@ export declare class FieldIndex {
|
|
|
47
57
|
/** The collection ID this index applies to. */
|
|
48
58
|
collectionGroup: string,
|
|
49
59
|
/** The field segments for this index. */
|
|
50
|
-
segments:
|
|
60
|
+
segments: IndexSegment[],
|
|
61
|
+
/** Shows how up-to-date the index is for the current user. */
|
|
62
|
+
indexState: IndexState);
|
|
51
63
|
}
|
|
64
|
+
/** Returns the ArrayContains/ArrayContainsAny segment for this index. */
|
|
65
|
+
export declare function fieldIndexGetArraySegment(fieldIndex: FieldIndex): IndexSegment | undefined;
|
|
66
|
+
/** Returns all directional (ascending/descending) segments for this index. */
|
|
67
|
+
export declare function fieldIndexGetDirectionalSegments(fieldIndex: FieldIndex): IndexSegment[];
|
|
68
|
+
/**
|
|
69
|
+
* Compares indexes by collection group and segments. Ignores update time and
|
|
70
|
+
* index ID.
|
|
71
|
+
*/
|
|
72
|
+
export declare function fieldIndexSemanticComparator(left: FieldIndex, right: FieldIndex): number;
|
|
52
73
|
/** The type of the index, e.g. for which type of query it can be used. */
|
|
53
|
-
export declare const enum
|
|
74
|
+
export declare const enum IndexKind {
|
|
54
75
|
/**
|
|
55
76
|
* Ordered index. Can be used for <, <=, ==, >=, >, !=, IN and NOT IN queries.
|
|
56
77
|
*/
|
|
@@ -63,14 +84,73 @@ export declare const enum Kind {
|
|
|
63
84
|
CONTAINS = 2
|
|
64
85
|
}
|
|
65
86
|
/** An index component consisting of field path and index type. */
|
|
66
|
-
export declare class
|
|
87
|
+
export declare class IndexSegment {
|
|
67
88
|
/** The field path of the component. */
|
|
68
89
|
readonly fieldPath: FieldPath;
|
|
69
90
|
/** The fields sorting order. */
|
|
70
|
-
readonly kind:
|
|
91
|
+
readonly kind: IndexKind;
|
|
71
92
|
constructor(
|
|
72
93
|
/** The field path of the component. */
|
|
73
94
|
fieldPath: FieldPath,
|
|
74
95
|
/** The fields sorting order. */
|
|
75
|
-
kind:
|
|
96
|
+
kind: IndexKind);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Stores the "high water mark" that indicates how updated the Index is for the
|
|
100
|
+
* current user.
|
|
101
|
+
*/
|
|
102
|
+
export declare class IndexState {
|
|
103
|
+
/**
|
|
104
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
105
|
+
*/
|
|
106
|
+
readonly sequenceNumber: number;
|
|
107
|
+
/** The the latest indexed read time, document and batch id. */
|
|
108
|
+
readonly offset: IndexOffset;
|
|
109
|
+
constructor(
|
|
110
|
+
/**
|
|
111
|
+
* Indicates when the index was last updated (relative to other indexes).
|
|
112
|
+
*/
|
|
113
|
+
sequenceNumber: number,
|
|
114
|
+
/** The the latest indexed read time, document and batch id. */
|
|
115
|
+
offset: IndexOffset);
|
|
116
|
+
/** The state of an index that has not yet been backfilled. */
|
|
117
|
+
static empty(): IndexState;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates an offset that matches all documents with a read time higher than
|
|
121
|
+
* `readTime`.
|
|
122
|
+
*/
|
|
123
|
+
export declare function newIndexOffsetSuccessorFromReadTime(readTime: SnapshotVersion, largestBatchId: number): IndexOffset;
|
|
124
|
+
/** Creates a new offset based on the provided document. */
|
|
125
|
+
export declare function newIndexOffsetFromDocument(document: Document): IndexOffset;
|
|
126
|
+
/**
|
|
127
|
+
* Stores the latest read time, document and batch ID that were processed for an
|
|
128
|
+
* index.
|
|
129
|
+
*/
|
|
130
|
+
export declare class IndexOffset {
|
|
131
|
+
/**
|
|
132
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
133
|
+
* field index.
|
|
134
|
+
*/
|
|
135
|
+
readonly readTime: SnapshotVersion;
|
|
136
|
+
/**
|
|
137
|
+
* The key of the last document that was indexed for this query. Use
|
|
138
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
139
|
+
*/
|
|
140
|
+
readonly documentKey: DocumentKey;
|
|
141
|
+
readonly largestBatchId: number;
|
|
142
|
+
constructor(
|
|
143
|
+
/**
|
|
144
|
+
* The latest read time version that has been indexed by Firestore for this
|
|
145
|
+
* field index.
|
|
146
|
+
*/
|
|
147
|
+
readTime: SnapshotVersion,
|
|
148
|
+
/**
|
|
149
|
+
* The key of the last document that was indexed for this query. Use
|
|
150
|
+
* `DocumentKey.empty()` if no document has been indexed.
|
|
151
|
+
*/
|
|
152
|
+
documentKey: DocumentKey, largestBatchId: number);
|
|
153
|
+
/** The state of an index that has not yet been backfilled. */
|
|
154
|
+
static min(): IndexOffset;
|
|
76
155
|
}
|
|
156
|
+
export declare function indexOffsetComparator(left: IndexOffset, right: IndexOffset): number;
|
|
@@ -19,6 +19,7 @@ import { ArrayValue, MapValue, Value } from '../protos/firestore_proto_api';
|
|
|
19
19
|
import { DocumentKey } from './document_key';
|
|
20
20
|
import { TypeOrder } from './type_order';
|
|
21
21
|
export declare const MAX_VALUE: Value;
|
|
22
|
+
export declare const MIN_VALUE: Value;
|
|
22
23
|
/** Extracts the backend's type order for the provided value. */
|
|
23
24
|
export declare function typeOrder(value: Value): TypeOrder;
|
|
24
25
|
/** Tests `left` and `right` for equality based on the backend semantics. */
|
|
@@ -76,3 +77,9 @@ export declare function isMapValue(value?: Value | null): value is {
|
|
|
76
77
|
export declare function deepClone(source: Value): Value;
|
|
77
78
|
/** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
|
|
78
79
|
export declare function isMaxValue(value: Value): boolean;
|
|
80
|
+
/** Returns the lowest value for the given value type (inclusive). */
|
|
81
|
+
export declare function valuesGetLowerBound(value: Value): Value;
|
|
82
|
+
/** Returns the largest value for the given value type (exclusive). */
|
|
83
|
+
export declare function valuesGetUpperBound(value: Value): Value;
|
|
84
|
+
export declare function valuesMax(left: Value | undefined, right: Value | undefined): Value | undefined;
|
|
85
|
+
export declare function valuesMin(left: Value | undefined, right: Value | undefined): Value | undefined;
|
|
@@ -33,7 +33,7 @@ export declare class TestRemoteDocumentCache {
|
|
|
33
33
|
* Reads all of the documents first so we can safely add them and keep the size calculation in
|
|
34
34
|
* sync.
|
|
35
35
|
*/
|
|
36
|
-
addEntries(documents: MutableDocument[]
|
|
36
|
+
addEntries(documents: MutableDocument[]): Promise<void>;
|
|
37
37
|
/**
|
|
38
38
|
* Adds a single document using the document's version as its read time.
|
|
39
39
|
* Reads the document first to track the document size internally.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { Bytes, DocumentReference
|
|
17
|
+
import { Bytes, DocumentReference } from '../../src';
|
|
18
18
|
import { BundledDocuments } from '../../src/core/bundle';
|
|
19
19
|
import { DatabaseId } from '../../src/core/database_info';
|
|
20
20
|
import { Query } from '../../src/core/query';
|
|
@@ -30,6 +30,7 @@ import { Document, MutableDocument } from '../../src/model/document';
|
|
|
30
30
|
import { DocumentComparator } from '../../src/model/document_comparator';
|
|
31
31
|
import { DocumentKey } from '../../src/model/document_key';
|
|
32
32
|
import { DocumentSet } from '../../src/model/document_set';
|
|
33
|
+
import { FieldIndex, IndexKind, IndexOffset } from '../../src/model/field_index';
|
|
33
34
|
import { FieldMask } from '../../src/model/field_mask';
|
|
34
35
|
import { DeleteMutation, MutationResult, PatchMutation, Precondition, SetMutation } from '../../src/model/mutation';
|
|
35
36
|
import { JsonObject, ObjectValue } from '../../src/model/object_value';
|
|
@@ -58,6 +59,11 @@ export declare function key(path: string): DocumentKey;
|
|
|
58
59
|
export declare function keys(...documents: Array<Document | string>): DocumentKeySet;
|
|
59
60
|
export declare function path(path: string, offset?: number): ResourcePath;
|
|
60
61
|
export declare function field(path: string): FieldPath;
|
|
62
|
+
export declare function fieldIndex(collectionGroup: string, options?: {
|
|
63
|
+
id?: number;
|
|
64
|
+
fields?: Array<[field: string, kind: IndexKind]>;
|
|
65
|
+
offset?: IndexOffset;
|
|
66
|
+
}): FieldIndex;
|
|
61
67
|
export declare function mask(...paths: string[]): FieldMask;
|
|
62
68
|
export declare function blob(...bytes: number[]): Bytes;
|
|
63
69
|
export declare function filter(path: string, op: string, value: unknown): FieldFilter;
|
|
@@ -65,7 +71,7 @@ export declare function setMutation(keyStr: string, json: JsonObject<unknown>):
|
|
|
65
71
|
export declare function patchMutation(keyStr: string, json: JsonObject<unknown>, precondition?: Precondition): PatchMutation;
|
|
66
72
|
export declare function deleteMutation(keyStr: string): DeleteMutation;
|
|
67
73
|
export declare function mutationResult(testVersion: TestSnapshotVersion): MutationResult;
|
|
68
|
-
export declare function bound(values:
|
|
74
|
+
export declare function bound(values: unknown[], before: boolean): Bound;
|
|
69
75
|
export declare function query(resourcePath: string, ...constraints: Array<OrderBy | Filter>): Query;
|
|
70
76
|
export declare function targetData(targetId: TargetId, queryPurpose: TargetPurpose, path: string): TargetData;
|
|
71
77
|
export declare function noChangeEvent(targetId: number, snapshotVersion: number, resumeToken?: ByteString): RemoteEvent;
|
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.5-canary.
|
|
66
|
+
let f = "9.6.5-canary.2dd99ae2d";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -447,6 +447,9 @@ class K {
|
|
|
447
447
|
constructor(t, n) {
|
|
448
448
|
this.projectId = t, this.database = n || "(default)";
|
|
449
449
|
}
|
|
450
|
+
static empty() {
|
|
451
|
+
return new K("", "");
|
|
452
|
+
}
|
|
450
453
|
get isDefaultDatabase() {
|
|
451
454
|
return "(default)" === this.database;
|
|
452
455
|
}
|
|
@@ -672,6 +675,9 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
|
|
|
672
675
|
static fromName(t) {
|
|
673
676
|
return new nt(X.fromString(t).popFirst(5));
|
|
674
677
|
}
|
|
678
|
+
static empty() {
|
|
679
|
+
return new nt(X.emptyPath());
|
|
680
|
+
}
|
|
675
681
|
/** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
|
|
676
682
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
677
683
|
}
|
|
@@ -1989,30 +1995,31 @@ function Ct(t, n) {
|
|
|
1989
1995
|
* applied, `isValidDocument()` returns false and the document should be removed
|
|
1990
1996
|
* from all views.
|
|
1991
1997
|
*/ class zt {
|
|
1992
|
-
constructor(t, n, e, r, s) {
|
|
1993
|
-
this.key = t, this.documentType = n, this.version = e, this.
|
|
1998
|
+
constructor(t, n, e, r, s, i) {
|
|
1999
|
+
this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
|
|
2000
|
+
this.documentState = i;
|
|
1994
2001
|
}
|
|
1995
2002
|
/**
|
|
1996
2003
|
* Creates a document with no known version or data, but which can serve as
|
|
1997
2004
|
* base document for mutations.
|
|
1998
2005
|
*/ static newInvalidDocument(t) {
|
|
1999
|
-
return new zt(t, 0 /* INVALID */ , vt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2006
|
+
return new zt(t, 0 /* INVALID */ , vt.min(), vt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2000
2007
|
}
|
|
2001
2008
|
/**
|
|
2002
2009
|
* Creates a new document that is known to exist with the given data at the
|
|
2003
2010
|
* given version.
|
|
2004
2011
|
*/ static newFoundDocument(t, n, e) {
|
|
2005
|
-
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, e, 0 /* SYNCED */);
|
|
2012
|
+
return new zt(t, 1 /* FOUND_DOCUMENT */ , n, vt.min(), e, 0 /* SYNCED */);
|
|
2006
2013
|
}
|
|
2007
2014
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
|
|
2008
|
-
return new zt(t, 2 /* NO_DOCUMENT */ , n, Bt.empty(), 0 /* SYNCED */);
|
|
2015
|
+
return new zt(t, 2 /* NO_DOCUMENT */ , n, vt.min(), Bt.empty(), 0 /* SYNCED */);
|
|
2009
2016
|
}
|
|
2010
2017
|
/**
|
|
2011
2018
|
* Creates a new document that is known to exist at the given version but
|
|
2012
2019
|
* whose data is not known (e.g. a document that was updated without a known
|
|
2013
2020
|
* base document).
|
|
2014
2021
|
*/ static newUnknownDocument(t, n) {
|
|
2015
|
-
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2022
|
+
return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, vt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
2016
2023
|
}
|
|
2017
2024
|
/**
|
|
2018
2025
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -2042,6 +2049,9 @@ function Ct(t, n) {
|
|
|
2042
2049
|
setHasLocalMutations() {
|
|
2043
2050
|
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this;
|
|
2044
2051
|
}
|
|
2052
|
+
setReadTime(t) {
|
|
2053
|
+
return this.readTime = t, this;
|
|
2054
|
+
}
|
|
2045
2055
|
get hasLocalMutations() {
|
|
2046
2056
|
return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
2047
2057
|
}
|
|
@@ -2067,7 +2077,7 @@ function Ct(t, n) {
|
|
|
2067
2077
|
return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
2068
2078
|
}
|
|
2069
2079
|
mutableCopy() {
|
|
2070
|
-
return new zt(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
2080
|
+
return new zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
|
|
2071
2081
|
}
|
|
2072
2082
|
toString() {
|
|
2073
2083
|
return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
|
|
@@ -2233,6 +2243,7 @@ function Jt(t, n) {
|
|
|
2233
2243
|
}
|
|
2234
2244
|
}
|
|
2235
2245
|
|
|
2246
|
+
// TODO(indexing): Change Bound.before to "inclusive"
|
|
2236
2247
|
/**
|
|
2237
2248
|
* Represents a bound of a query.
|
|
2238
2249
|
*
|
|
@@ -5938,7 +5949,7 @@ class kr {
|
|
|
5938
5949
|
return n && r._setSettings(n), r;
|
|
5939
5950
|
}), "PUBLIC")),
|
|
5940
5951
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5941
|
-
registerVersion("firestore-lite", "3.4.4-canary.
|
|
5952
|
+
registerVersion("firestore-lite", "3.4.4-canary.2dd99ae2d", ""), registerVersion("firestore-lite", "3.4.4-canary.2dd99ae2d", "esm2017");
|
|
5942
5953
|
|
|
5943
5954
|
export { ve as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, be as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, gt as Timestamp, kr as Transaction, Sr as WriteBatch, Rr as addDoc, Nr as arrayRemove, Dr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, br as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, w as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
|
|
5944
5955
|
//# sourceMappingURL=index.browser.esm2017.js.map
|