Skip to content

Commit 768ac9f

Browse files
authored
Merge branch 'master' into yifany/size
2 parents 573e4f2 + afaf982 commit 768ac9f

28 files changed

+494
-566
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"scripts": {
2020
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
2121
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire prepare",
22-
"prepush": "node tools/gitHooks/prepush.js",
2322
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
2423
"stage:packages": "./scripts/prepublish.sh",
2524
"repl": "node tools/repl.js",
@@ -124,5 +123,10 @@
124123
"yargs": "15.3.1",
125124
"lodash": "4.17.15",
126125
"terser": "4.6.7"
126+
},
127+
"husky": {
128+
"hooks": {
129+
"pre-push": "node tools/gitHooks/prepush.js"
130+
}
127131
}
128132
}

packages/firestore/rollup.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ const browserBuilds = [
194194
// MARK: Node builds
195195

196196
const nodeBuildPlugins = [
197-
...es5BuildPlugins,
197+
typescriptPlugin({
198+
typescript,
199+
cacheRoot: `./.cache/node/`
200+
}),
201+
json(),
198202
// Needed as we also use the *.proto files
199203
copy({
200204
assets: ['./src/protos']

packages/firestore/src/local/indexeddb_persistence.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export class IndexedDbPersistence implements Persistence {
325325
this.scheduleClientMetadataAndPrimaryLeaseRefreshes();
326326

327327
return this.simpleDb.runTransaction(
328-
'readonly-idempotent',
328+
'readonly',
329329
[DbTargetGlobal.store],
330330
txn => getHighestListenSequenceNumber(txn)
331331
);
@@ -388,7 +388,7 @@ export class IndexedDbPersistence implements Persistence {
388388
*/
389389
private updateClientMetadataAndTryBecomePrimary(): Promise<void> {
390390
return this.simpleDb
391-
.runTransaction('readwrite-idempotent', ALL_STORES, txn => {
391+
.runTransaction('readwrite', ALL_STORES, txn => {
392392
const metadataStore = clientMetadataStore(txn);
393393
return metadataStore
394394
.put(
@@ -474,7 +474,7 @@ export class IndexedDbPersistence implements Persistence {
474474

475475
const inactiveClients = await this.runTransaction(
476476
'maybeGarbageCollectMultiClientState',
477-
'readwrite-primary-idempotent',
477+
'readwrite-primary',
478478
txn => {
479479
const metadataStore = IndexedDbPersistence.getStore<
480480
DbClientMetadataKey,
@@ -658,7 +658,7 @@ export class IndexedDbPersistence implements Persistence {
658658
this.detachVisibilityHandler();
659659
this.detachWindowUnloadHook();
660660
await this.simpleDb.runTransaction(
661-
'readwrite-idempotent',
661+
'readwrite',
662662
[DbPrimaryClient.store, DbClientMetadata.store],
663663
txn => {
664664
return this.releasePrimaryLeaseIfHeld(txn).next(() =>
@@ -690,7 +690,7 @@ export class IndexedDbPersistence implements Persistence {
690690

691691
getActiveClients(): Promise<ClientId[]> {
692692
return this.simpleDb.runTransaction(
693-
'readonly-idempotent',
693+
'readonly',
694694
[DbClientMetadata.store],
695695
txn => {
696696
return clientMetadataStore(txn)
@@ -762,16 +762,7 @@ export class IndexedDbPersistence implements Persistence {
762762
): Promise<T> {
763763
log.debug(LOG_TAG, 'Starting transaction:', action);
764764

765-
// TODO(schmidt-sebastian): Simplify once all transactions are idempotent.
766-
const idempotent = mode.endsWith('idempotent');
767-
const readonly = mode.startsWith('readonly');
768-
const simpleDbMode = readonly
769-
? idempotent
770-
? 'readonly-idempotent'
771-
: 'readonly'
772-
: idempotent
773-
? 'readwrite-idempotent'
774-
: 'readwrite';
765+
const simpleDbMode = mode === 'readonly' ? 'readonly' : 'readwrite';
775766

776767
let persistenceTransaction: PersistenceTransaction;
777768

@@ -784,10 +775,7 @@ export class IndexedDbPersistence implements Persistence {
784775
this.listenSequence.next()
785776
);
786777

787-
if (
788-
mode === 'readwrite-primary' ||
789-
mode === 'readwrite-primary-idempotent'
790-
) {
778+
if (mode === 'readwrite-primary') {
791779
// While we merely verify that we have (or can acquire) the lease
792780
// immediately, we wait to extend the primary lease until after
793781
// executing transactionOperation(). This ensures that even if the

0 commit comments

Comments
 (0)