Skip to content

Commit 3e1053f

Browse files
[AUTOMATED]: Prettier Code Styling
1 parent 07e44e7 commit 3e1053f

File tree

4 files changed

+51
-36
lines changed

4 files changed

+51
-36
lines changed

packages/firestore/src/local/indexeddb_migrations.ts

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,30 @@
1414
* limitations under the License.
1515
*/
1616
import {
17-
DbDocumentMutation, DbInstance,
18-
DbMutationBatch, DbMutationQueue, DbOwner,
19-
DbRemoteDocument, DbTarget,
20-
DbTargetDocument, DbTargetGlobal
17+
DbDocumentMutation,
18+
DbInstance,
19+
DbMutationBatch,
20+
DbMutationQueue,
21+
DbOwner,
22+
DbRemoteDocument,
23+
DbTarget,
24+
DbTargetDocument,
25+
DbTargetGlobal
2126
} from './indexeddb_schema';
22-
import {assert, fail} from '../util/assert';
27+
import { assert, fail } from '../util/assert';
2328

2429
// TODO(mikelehen): Get rid of "as any" if/when TypeScript fixes their types.
2530
// https://github.com/Microsoft/TypeScript/issues/14322
2631
type KeyPath = any; // tslint:disable-line:no-any
2732

2833
function createCache(db: IDBDatabase): void {
29-
const targetDocumentsStore = db.createObjectStore(
30-
DbTargetDocument.store,
31-
{ keyPath: DbTargetDocument.keyPath as KeyPath }
32-
);
34+
const targetDocumentsStore = db.createObjectStore(DbTargetDocument.store, {
35+
keyPath: DbTargetDocument.keyPath as KeyPath
36+
});
3337
targetDocumentsStore.createIndex(
34-
DbTargetDocument.documentTargetsIndex,
35-
DbTargetDocument.documentTargetsKeyPath,
36-
{ unique: true }
38+
DbTargetDocument.documentTargetsIndex,
39+
DbTargetDocument.documentTargetsKeyPath,
40+
{ unique: true }
3741
);
3842

3943
const targetStore = db.createObjectStore(DbTarget.store, {
@@ -42,9 +46,9 @@ function createCache(db: IDBDatabase): void {
4246

4347
// NOTE: This is unique only because the TargetId is the suffix.
4448
targetStore.createIndex(
45-
DbTarget.queryTargetsIndexName,
46-
DbTarget.queryTargetsKeyPath,
47-
{ unique: true }
49+
DbTarget.queryTargetsIndexName,
50+
DbTarget.queryTargetsKeyPath,
51+
{ unique: true }
4852
);
4953
db.createObjectStore(DbRemoteDocument.store);
5054
db.createObjectStore(DbTargetGlobal.store);
@@ -57,25 +61,24 @@ function dropCache(db: IDBDatabase): void {
5761
db.deleteObjectStore(DbTargetGlobal.store);
5862
}
5963

60-
function createOwnerStore(db: IDBDatabase) : void {
64+
function createOwnerStore(db: IDBDatabase): void {
6165
db.createObjectStore(DbOwner.store);
6266
}
6367

64-
function createInstanceStore(db: IDBDatabase) : void {
68+
function createInstanceStore(db: IDBDatabase): void {
6569
db.createObjectStore(DbInstance.store, {
6670
keyPath: DbInstance.keyPath as KeyPath
6771
});
6872
}
6973

70-
function createMutationQueue(db: IDBDatabase) : void {
74+
function createMutationQueue(db: IDBDatabase): void {
7175
db.createObjectStore(DbMutationQueue.store, {
7276
keyPath: DbMutationQueue.keyPath
7377
});
7478

75-
db.createObjectStore(
76-
DbMutationBatch.store,
77-
{ keyPath: DbMutationBatch.keyPath as KeyPath }
78-
);
79+
db.createObjectStore(DbMutationBatch.store, {
80+
keyPath: DbMutationBatch.keyPath as KeyPath
81+
});
7982

8083
// NOTE: keys for these stores are specified explicitly rather than using a
8184
// keyPath.
@@ -86,9 +89,19 @@ function createMutationQueue(db: IDBDatabase) : void {
8689
* Runs any migrations needed to bring the given database up to the current
8790
* schema version.
8891
*/
89-
export function createOrUpgradeDb(db: IDBDatabase, oldVersion: number, newVersion: number): void {
90-
assert(oldVersion >= 0 || oldVersion <= 1, 'Unexpected upgrade from version ' + oldVersion);
91-
assert(newVersion >= 1 || newVersion <= 2, 'Unexpected upgrade to version ' + newVersion);
92+
export function createOrUpgradeDb(
93+
db: IDBDatabase,
94+
oldVersion: number,
95+
newVersion: number
96+
): void {
97+
assert(
98+
oldVersion >= 0 || oldVersion <= 1,
99+
'Unexpected upgrade from version ' + oldVersion
100+
);
101+
assert(
102+
newVersion >= 1 || newVersion <= 2,
103+
'Unexpected upgrade to version ' + newVersion
104+
);
92105

93106
const createV1 = newVersion >= 1 && oldVersion <= 1;
94107
const dropV1 = oldVersion >= 1;
@@ -107,4 +120,4 @@ export function createOrUpgradeDb(db: IDBDatabase, oldVersion: number, newVersio
107120
if (createV2) {
108121
createInstanceStore(db);
109122
}
110-
}
123+
}

packages/firestore/src/local/indexeddb_persistence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { PersistencePromise } from './persistence_promise';
3434
import { QueryCache } from './query_cache';
3535
import { RemoteDocumentCache } from './remote_document_cache';
3636
import { SimpleDb, SimpleDbTransaction } from './simple_db';
37-
import {createOrUpgradeDb} from './indexeddb_migrations';
37+
import { createOrUpgradeDb } from './indexeddb_migrations';
3838

3939
const LOG_TAG = 'IndexedDbPersistence';
4040

packages/firestore/src/local/indexeddb_schema.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ResourcePath } from '../model/path';
2121
import { assert } from '../util/assert';
2222

2323
import { encode, EncodedResourcePath } from './encoded_resource_path';
24-
import {SnapshotVersion} from '../core/snapshot_version';
24+
import { SnapshotVersion } from '../core/snapshot_version';
2525

2626
export const SCHEMA_VERSION = 1;
2727

@@ -88,14 +88,13 @@ export class DbMutationQueue {
8888
* only a single stream token is retained.
8989
*/
9090
public lastStreamToken: string,
91-
9291
/**
9392
* An identifier for the highest numbered batch that has been acknowledged
9493
* by the server. All MutationBatches in this queue with batchIds less
9594
* than or equal to this value are considered to have been acknowledged by
9695
* the server.
9796
*/
98-
public highestPendingBatchId: number,
97+
public highestPendingBatchId: number
9998
) {}
10099
}
101100

@@ -368,7 +367,6 @@ export class DbTargetDocument {
368367
* The targetId identifying a target.
369368
*/
370369
public targetId: TargetId,
371-
372370
public snapshotVersion: number,
373371
/**
374372
* The path to the document, as encoded in the key.
@@ -429,9 +427,9 @@ export class DbInstance {
429427
static keyPath = ['userId', 'instanceId'];
430428

431429
constructor(
432-
public userId: string,
433-
public instanceId: string,
434-
public updateTimeMs: number
430+
public userId: string,
431+
public instanceId: string,
432+
public updateTimeMs: number
435433
) {}
436434
}
437435

packages/firestore/src/local/simple_db.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { debug } from '../util/log';
1919
import { AnyDuringMigration } from '../util/misc';
2020

2121
import { PersistencePromise } from './persistence_promise';
22-
import {SCHEMA_VERSION} from './indexeddb_schema';
22+
import { SCHEMA_VERSION } from './indexeddb_schema';
2323

2424
const LOG_TAG = 'SimpleDb';
2525

@@ -35,7 +35,11 @@ export class SimpleDb {
3535
static openOrCreate(
3636
name: string,
3737
version: number,
38-
runUpgrade: (db: IDBDatabase, oldVersion: number, newVersion: number) => void
38+
runUpgrade: (
39+
db: IDBDatabase,
40+
oldVersion: number,
41+
newVersion: number
42+
) => void
3943
): Promise<SimpleDb> {
4044
assert(
4145
SimpleDb.isAvailable(),

0 commit comments

Comments
 (0)