Skip to content

Commit 2080ba8

Browse files
Review feedback
1 parent a4a8856 commit 2080ba8

22 files changed

+402
-560
lines changed

integration/firestore/gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function clean() {
2828
}
2929

3030
function isPersistenceEnabled() {
31-
return process.env.USE_FIRESTORE_PERSISTENCE !== 'false';
31+
return process.env.DISABLE_FIRESTORE_PERSISTENCE !== 'true';
3232
}
3333

3434
function copyTests() {
@@ -72,9 +72,9 @@ function copyTests() {
7272
import '${firebaseFirestoreSdk}';
7373
7474
if (typeof process === 'undefined') {
75-
process = { env: { USE_FIRESTORE_PERSISTENCE: '${isPersistenceEnabled()}' } } as any;
75+
process = { env: { DISABLE_FIRESTORE_PERSISTENCE: '${!isPersistenceEnabled()}' } } as any;
7676
} else {
77-
process.env.USE_FIRESTORE_PERSISTENCE = '${isPersistenceEnabled()}';
77+
process.env.DISABLE_FIRESTORE_PERSISTENCE = '${!isPersistenceEnabled()}';
7878
}
7979
`
8080
)

integration/firestore/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"private": true,
55
"scripts": {
66
"build:dependencies": "(cd ../../ ; yarn build)",
7-
"build": "yarn build:dependencies; USE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
8-
"build:memory": "yarn build:dependencies; USE_FIRESTORE_PERSISTENCE=false gulp compile-tests",
7+
"build": "yarn build:dependencies; gulp compile-tests",
8+
"build:memory": "yarn build:dependencies; DISABLE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
99
"pretest": "yarn build:dependencies",
1010
"pretest:manual": "yarn build",
1111
"pretest:manual:memory": "yarn build:memory",
1212
"pretest:debug": "yarn build",
1313
"pretest:debug:memort": "yarn build:memory",
14-
"test": "USE_FIRESTORE_PERSISTENCE=true gulp compile-tests; karma start --single-run; USE_FIRESTORE_PERSISTENCE=false gulp compile-tests; karma start --single-run;",
14+
"test": "gulp compile-tests; karma start --single-run; DISABLE_FIRESTORE_PERSISTENCE=true gulp compile-tests; karma start --single-run;",
1515
"test:manual": "karma start --single-run",
1616
"test:manual:memory": "karma start --single-run",
1717
"test:debug": "karma start --auto-watch --browsers Chrome",

packages/firebase/firestore/index.memory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2020 Google Inc.
3+
* Copyright 2020 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

packages/firestore/index.memory.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2020 Google Inc.
3+
* Copyright 2020 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -20,39 +20,15 @@ import * as types from '@firebase/firestore-types';
2020
import { FirebaseNamespace } from '@firebase/app-types';
2121

2222
import { configureForFirebase } from './src/platform/config';
23+
import './register-module';
2324
import './src/platform_browser/browser_init';
2425

2526
import { name, version } from './package.json';
27+
import {Firestore, PublicMemoryFirestore} from "./src/api/database";
2628

2729
export function registerFirestore(instance: FirebaseNamespace): void {
28-
configureForFirebase(instance);
30+
configureForFirebase(instance, PublicMemoryFirestore, Firestore);
2931
instance.registerVersion(name, version);
3032
}
3133

3234
registerFirestore(firebase);
33-
34-
declare module '@firebase/app-types' {
35-
interface FirebaseNamespace {
36-
firestore?: {
37-
(app?: FirebaseApp): types.FirebaseFirestore;
38-
Blob: typeof types.Blob;
39-
CollectionReference: typeof types.CollectionReference;
40-
DocumentReference: typeof types.DocumentReference;
41-
DocumentSnapshot: typeof types.DocumentSnapshot;
42-
FieldPath: typeof types.FieldPath;
43-
FieldValue: typeof types.FieldValue;
44-
Firestore: typeof types.FirebaseFirestore;
45-
GeoPoint: typeof types.GeoPoint;
46-
Query: typeof types.Query;
47-
QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
48-
QuerySnapshot: typeof types.QuerySnapshot;
49-
Timestamp: typeof types.Timestamp;
50-
Transaction: typeof types.Transaction;
51-
WriteBatch: typeof types.WriteBatch;
52-
setLogLevel: typeof types.setLogLevel;
53-
};
54-
}
55-
interface FirebaseApp {
56-
firestore?(): types.FirebaseFirestore;
57-
}
58-
}
Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2020 Google Inc.
3+
* Copyright 2020 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -16,43 +16,19 @@
1616
*/
1717

1818
import firebase from '@firebase/app';
19-
import * as types from '@firebase/firestore-types';
2019
import { FirebaseNamespace } from '@firebase/app-types';
2120

2221
import { configureForFirebase } from './src/platform/config';
23-
import './src/platform_browser/browser_init';
22+
import './register-module';
23+
import './src/platform_node/node_init';
2424

2525
import { name, version } from './package.json';
26+
import {Firestore, PublicMemoryFirestore} from "./src/api/database";
2627

2728
export function registerFirestore(instance: FirebaseNamespace): void {
28-
configureForFirebase(instance);
29+
configureForFirebase(instance, PublicMemoryFirestore, Firestore);
2930
instance.registerVersion(name, version);
3031
}
3132

3233
registerFirestore(firebase);
3334

34-
declare module '@firebase/app-types' {
35-
interface FirebaseNamespace {
36-
firestore?: {
37-
(app?: FirebaseApp): types.FirebaseFirestore;
38-
Blob: typeof types.Blob;
39-
CollectionReference: typeof types.CollectionReference;
40-
DocumentReference: typeof types.DocumentReference;
41-
DocumentSnapshot: typeof types.DocumentSnapshot;
42-
FieldPath: typeof types.FieldPath;
43-
FieldValue: typeof types.FieldValue;
44-
Firestore: typeof types.FirebaseFirestore;
45-
GeoPoint: typeof types.GeoPoint;
46-
Query: typeof types.Query;
47-
QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
48-
QuerySnapshot: typeof types.QuerySnapshot;
49-
Timestamp: typeof types.Timestamp;
50-
Transaction: typeof types.Transaction;
51-
WriteBatch: typeof types.WriteBatch;
52-
setLogLevel: typeof types.setLogLevel;
53-
};
54-
}
55-
interface FirebaseApp {
56-
firestore?(): types.FirebaseFirestore;
57-
}
58-
}

packages/firestore/index.node.ts

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,21 @@
1515
* limitations under the License.
1616
*/
1717
import firebase from '@firebase/app';
18-
import * as types from '@firebase/firestore-types';
1918
import { configureForFirebase } from './src/platform/config';
20-
import { registerFirestorePersistence } from './src/platform/persistence';
19+
import './register-module';
2120
import './src/platform_node/node_init';
2221
import { FirebaseNamespace } from '@firebase/app-types';
2322

2423
import { name, version } from './package.json';
24+
import {
25+
PersistenceFirestore,
26+
PublicPersistenceFirestore
27+
} from "./src/api/persistence";
2528

2629
export function registerFirestore(instance: FirebaseNamespace): void {
27-
configureForFirebase(instance);
28-
registerFirestorePersistence(instance);
30+
configureForFirebase(instance, PublicPersistenceFirestore, PersistenceFirestore);
2931
instance.registerVersion(name, version, 'node');
3032
}
3133

3234
registerFirestore(firebase);
3335

34-
declare module '@firebase/app-types' {
35-
interface FirebaseNamespace {
36-
firestore?: {
37-
(app?: FirebaseApp): types.FirebaseFirestore;
38-
Blob: typeof types.Blob;
39-
CollectionReference: typeof types.CollectionReference;
40-
DocumentReference: typeof types.DocumentReference;
41-
DocumentSnapshot: typeof types.DocumentSnapshot;
42-
FieldPath: typeof types.FieldPath;
43-
FieldValue: typeof types.FieldValue;
44-
Firestore: typeof types.FirebaseFirestore;
45-
GeoPoint: typeof types.GeoPoint;
46-
Query: typeof types.Query;
47-
QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
48-
QuerySnapshot: typeof types.QuerySnapshot;
49-
Timestamp: typeof types.Timestamp;
50-
Transaction: typeof types.Transaction;
51-
WriteBatch: typeof types.WriteBatch;
52-
setLogLevel: typeof types.setLogLevel;
53-
};
54-
}
55-
interface FirebaseApp {
56-
firestore?(): types.FirebaseFirestore;
57-
}
58-
}

packages/firestore/index.ts

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,19 @@
1717

1818
import firebase from '@firebase/app';
1919
import { configureForFirebase } from './src/platform/config';
20-
import { registerFirestorePersistence } from './src/platform/persistence';
2120
import './src/platform_browser/browser_init';
2221

23-
import * as types from '@firebase/firestore-types';
2422
import { FirebaseNamespace } from '@firebase/app-types';
2523

2624
import { name, version } from './package.json';
25+
import {
26+
PersistenceFirestore,
27+
PublicPersistenceFirestore
28+
} from "./src/api/persistence";
2729

2830
export function registerFirestore(instance: FirebaseNamespace): void {
29-
configureForFirebase(instance);
30-
registerFirestorePersistence(instance);
31+
configureForFirebase(instance, PublicPersistenceFirestore, PersistenceFirestore);
3132
instance.registerVersion(name, version);
3233
}
3334

3435
registerFirestore(firebase);
35-
36-
declare module '@firebase/app-types' {
37-
interface FirebaseNamespace {
38-
firestore?: {
39-
(app?: FirebaseApp): types.FirebaseFirestore;
40-
Blob: typeof types.Blob;
41-
CollectionReference: typeof types.CollectionReference;
42-
DocumentReference: typeof types.DocumentReference;
43-
DocumentSnapshot: typeof types.DocumentSnapshot;
44-
FieldPath: typeof types.FieldPath;
45-
FieldValue: typeof types.FieldValue;
46-
Firestore: typeof types.FirebaseFirestore;
47-
GeoPoint: typeof types.GeoPoint;
48-
Query: typeof types.Query;
49-
QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
50-
QuerySnapshot: typeof types.QuerySnapshot;
51-
Timestamp: typeof types.Timestamp;
52-
Transaction: typeof types.Transaction;
53-
WriteBatch: typeof types.WriteBatch;
54-
setLogLevel: typeof types.setLogLevel;
55-
};
56-
}
57-
interface FirebaseApp {
58-
firestore?(): types.FirebaseFirestore;
59-
}
60-
}

packages/firestore/register-module.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @license
3+
* Copyright 2020 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+
18+
import * as types from '@firebase/firestore-types';
19+
20+
declare module '@firebase/app-types' {
21+
interface FirebaseNamespace {
22+
firestore?: {
23+
(app?: FirebaseApp): types.FirebaseFirestore;
24+
Blob: typeof types.Blob;
25+
CollectionReference: typeof types.CollectionReference;
26+
DocumentReference: typeof types.DocumentReference;
27+
DocumentSnapshot: typeof types.DocumentSnapshot;
28+
FieldPath: typeof types.FieldPath;
29+
FieldValue: typeof types.FieldValue;
30+
Firestore: typeof types.FirebaseFirestore;
31+
GeoPoint: typeof types.GeoPoint;
32+
Query: typeof types.Query;
33+
QueryDocumentSnapshot: typeof types.QueryDocumentSnapshot;
34+
QuerySnapshot: typeof types.QuerySnapshot;
35+
Timestamp: typeof types.Timestamp;
36+
Transaction: typeof types.Transaction;
37+
WriteBatch: typeof types.WriteBatch;
38+
setLogLevel: typeof types.setLogLevel;
39+
};
40+
}
41+
interface FirebaseApp {
42+
firestore?(): types.FirebaseFirestore;
43+
}
44+
}

0 commit comments

Comments
 (0)