Skip to content

Commit 0b42fc1

Browse files
Merge branch 'master' into multitab-instancestate
2 parents ede438e + 453677f commit 0b42fc1

32 files changed

+274
-198
lines changed

packages/firestore/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"scripts": {
77
"dev": "gulp dev",
8-
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
8+
"lint": "tslint -p tsconfig.json -c tslint.json src/**/*.ts test/**/*.ts",
9+
"lint:fix": "tslint --fix -p tsconfig.json -c tslint.json src/**/*.ts test/**/*.ts",
910
"test": "run-s lint test:all",
1011
"test:all": "run-p test:browser test:node",
1112
"test:browser": "karma start --single-run",

packages/firestore/src/api/credentials.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { User } from '../auth/user';
1818
import { assert, fail } from '../util/assert';
1919
import { Code, FirestoreError } from '../util/error';
20-
import { AnyJs } from '../util/misc';
2120
import { FirebaseApp } from '@firebase/app-types';
2221
import { _FirebaseApp } from '@firebase/app-types/private';
2322

packages/firestore/src/api/database.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ import {
3333
RelationOp
3434
} from '../core/query';
3535
import { Transaction as InternalTransaction } from '../core/transaction';
36-
import {
37-
ChangeType,
38-
DocumentViewChange,
39-
ViewSnapshot
40-
} from '../core/view_snapshot';
36+
import { ChangeType, ViewSnapshot } from '../core/view_snapshot';
4137
import { Document, MaybeDocument, NoDocument } from '../model/document';
4238
import { DocumentKey } from '../model/document_key';
4339
import {

packages/firestore/src/api/user_data_converter.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as firestore from '@firebase/firestore-types';
18-
1917
import { DatabaseId } from '../core/database_info';
2018
import { Timestamp } from '../core/timestamp';
2119
import { DocumentKey } from '../model/document_key';
@@ -248,13 +246,6 @@ class ParseContext {
248246
throw this.createError('Document fields cannot begin and end with __');
249247
}
250248
}
251-
252-
private isWrite(): boolean {
253-
return (
254-
this.dataSource === UserDataSource.Set ||
255-
this.dataSource === UserDataSource.Update
256-
);
257-
}
258249
}
259250
/**
260251
* An interface that allows arbitrary pre-converting of user data. This

packages/firestore/src/auth/user.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ export class User {
2929

3030
constructor(readonly uid: string | null) {}
3131

32-
isUnauthenticated(): boolean {
33-
return this.uid == null;
32+
isAuthenticated(): boolean {
33+
return this.uid != null;
3434
}
3535

3636
/**
3737
* Returns a key representing this user, suitable for inclusion in a
3838
* dictionary.
3939
*/
4040
toKey(): string {
41-
if (this.isUnauthenticated()) {
42-
return 'anonymous-user';
43-
} else {
41+
if (this.isAuthenticated()) {
4442
return 'uid:' + this.uid;
43+
} else {
44+
return 'anonymous-user';
4545
}
4646
}
4747

packages/firestore/src/core/event_manager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { ChangeType, ViewSnapshot } from './view_snapshot';
2222
import { DocumentSet } from '../model/document_set';
2323
import { assert } from '../util/assert';
2424
import { EventHandler } from '../util/misc';
25-
import * as obj from '../util/obj';
2625
import { ObjectMap } from '../util/obj_map';
2726

2827
/**

packages/firestore/src/core/firestore_client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ export class FirestoreClient {
274274
this.databaseInfo.databaseId
275275
);
276276
const datastore = new Datastore(
277-
this.databaseInfo,
278277
this.asyncQueue,
279278
connection,
280279
this.credentials,

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class IndexedDbMutationQueue implements MutationQueue {
8080
// For the moment store these together in the same mutations table assuming
8181
// that empty userIDs aren't allowed.
8282
assert(user.uid !== '', 'UserID must not be an empty string.');
83-
const userId = user.isUnauthenticated() ? '' : user.uid!;
83+
const userId = user.isAuthenticated() ? user.uid! : '';
8484
return new IndexedDbMutationQueue(userId, serializer);
8585
}
8686

@@ -222,7 +222,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
222222
.next(() => {
223223
const promises: Array<PersistencePromise<void>> = [];
224224
for (const mutation of mutations) {
225-
const encodedPath = EncodedResourcePath.encode(mutation.key.path);
226225
const indexKey = DbDocumentMutation.key(
227226
this.userId,
228227
mutation.key.path,
@@ -379,7 +378,6 @@ export class IndexedDbMutationQueue implements MutationQueue {
379378
this.userId,
380379
queryPath
381380
);
382-
const encodedQueryPath = indexPrefix[1];
383381
const indexStart = IDBKeyRange.lowerBound(indexPrefix);
384382

385383
// Collect up unique batchIDs encountered during a scan of the index. Use a
@@ -516,8 +514,8 @@ export class IndexedDbMutationQueue implements MutationQueue {
516514
const startRange = IDBKeyRange.lowerBound(indexKey);
517515
let containsKey = false;
518516
return documentMutationsStore(txn)
519-
.iterate({ range: startRange, keysOnly: true }, (key, _, control) => {
520-
const [userID, keyPath, batchID] = key;
517+
.iterate({ range: startRange, keysOnly: true }, (key, value, control) => {
518+
const [userID, keyPath, /*batchID*/ _] = key;
521519
if (userID === this.userId && keyPath === encodedPath) {
522520
containsKey = true;
523521
}

packages/firestore/src/local/indexeddb_query_cache.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as api from '../protos/firestore_proto_api';
1817
import { Query } from '../core/query';
1918
import { SnapshotVersion } from '../core/snapshot_version';
2019
import { Timestamp } from '../core/timestamp';
@@ -27,7 +26,6 @@ import { immediateSuccessor } from '../util/misc';
2726
import * as EncodedResourcePath from './encoded_resource_path';
2827
import { GarbageCollector } from './garbage_collector';
2928
import {
30-
DbQuery,
3129
DbTarget,
3230
DbTargetDocument,
3331
DbTargetDocumentKey,
@@ -237,7 +235,6 @@ export class IndexedDbQueryCache implements QueryCache {
237235
txn: PersistenceTransaction,
238236
targetId: TargetId
239237
): PersistencePromise<DocumentKeySet> {
240-
const promises: Array<PersistencePromise<void>> = [];
241238
const range = IDBKeyRange.bound(
242239
[targetId],
243240
[targetId + 1],

packages/firestore/src/local/memory_query_cache.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { TargetId } from '../core/types';
2020
import { DocumentKeySet } from '../model/collections';
2121
import { DocumentKey } from '../model/document_key';
2222
import { ObjectMap } from '../util/obj_map';
23-
import { SortedSet } from '../util/sorted_set';
2423

2524
import { GarbageCollector } from './garbage_collector';
2625
import { PersistenceTransaction } from './persistence';

0 commit comments

Comments
 (0)