Skip to content

Commit 3f6a4d2

Browse files
Merge master into release
2 parents a80e29c + b6c231a commit 3f6a4d2

File tree

130 files changed

+1534
-1049
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1534
-1049
lines changed

.changeset/smart-crabs-warn.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/database": patch
3+
---
4+
5+
Fix issue with how get results for filtered queries are added to cache.
6+
Fix issue with events not getting propagated to listeners by get.

.changeset/warm-pillows-know.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/database-compat": patch
3+
"@firebase/database": patch
4+
---
5+
6+
Fixed faulty transaction bug causing filtered index queries to override default queries.

.github/CODEOWNERS

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
* @dwyfrequency @hsubox76 @firebase/jssdk-global-approvers
3737

3838
# Database Code
39-
packages/database @maneesht @jsdt @firebase/jssdk-global-approvers
40-
packages/database-compat @maneesht @jsdt @firebase/jssdk-global-approvers
41-
packages/database-types @maneesht @jsdt @firebase/jssdk-global-approvers
39+
packages/database @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
40+
packages/database-compat @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
41+
packages/database-types @maneesht @jsdt @IanWyszynski @firebase/jssdk-global-approvers
4242

4343
# Firestore Code
4444
packages/firestore @firebase/firestore-js-team @firebase/jssdk-global-approvers

.github/workflows/test-changed-auth.yml

+60-26
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,66 @@ env:
77
DETECT_CHROMEDRIVER_VERSION: true
88

99
jobs:
10-
test:
11-
name: Test Auth If Changed
10+
test-chrome:
11+
name: Test Auth on Chrome and Node If Changed
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
16-
- name: install Chrome stable
17-
run: |
18-
sudo apt-get update
19-
sudo apt-get install google-chrome-stable
20-
- name: Checkout Repo
21-
uses: actions/checkout@master
22-
with:
23-
# This makes Actions fetch all Git history so run-changed script can diff properly.
24-
fetch-depth: 0
25-
- name: Set up Node (14)
26-
uses: actions/setup-node@v2
27-
with:
28-
node-version: 14.x
29-
- name: Bump Node memory limit
30-
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
31-
- name: Test setup and yarn install
32-
run: |
33-
cp config/ci.config.json config/project.json
34-
yarn
35-
- name: build
36-
run: yarn build:changed auth
37-
- name: Run tests on changed packages
38-
run: xvfb-run yarn test:changed auth
15+
# install Chrome first, so the correct version of webdriver can be installed by chromedriver when setting up the repo
16+
- name: install Chrome stable
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install google-chrome-stable
20+
- name: Checkout Repo
21+
uses: actions/checkout@master
22+
with:
23+
# This makes Actions fetch all Git history so run-changed script can diff properly.
24+
fetch-depth: 0
25+
- name: Set up Node (14)
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: 14.x
29+
- name: Bump Node memory limit
30+
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
31+
- name: Test setup and yarn install
32+
run: |
33+
cp config/ci.config.json config/project.json
34+
yarn
35+
- name: build
36+
run: yarn build:changed auth
37+
- name: Run tests on changed packages
38+
run: xvfb-run yarn test:changed auth
39+
test-firefox:
40+
name: Test Auth on Firefox If Changed
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: install Firefox stable
45+
run: |
46+
sudo apt-get update
47+
sudo apt-get install firefox
48+
- name: Checkout Repo
49+
uses: actions/checkout@master
50+
with:
51+
# This makes Actions fetch all Git history so run-changed script can diff properly.
52+
fetch-depth: 0
53+
- name: Set up Node (14)
54+
uses: actions/setup-node@v2
55+
with:
56+
node-version: 14.x
57+
- name: Bump Node memory limit
58+
run: echo "NODE_OPTIONS=--max_old_space_size=4096" >> $GITHUB_ENV
59+
- name: Test setup and yarn install
60+
run: |
61+
cp config/ci.config.json config/project.json
62+
yarn
63+
- name: build
64+
run: yarn build:changed auth
65+
- name: Run tests on auth changed packages
66+
run: xvfb-run yarn --cwd packages/auth test:browser:unit
67+
env:
68+
BROWSERS: 'Firefox'
69+
- name: Run tests on auth-compat changed packages
70+
run: xvfb-run yarn --cwd packages/auth-compat test:browser:unit
71+
env:
72+
BROWSERS: 'Firefox'

.prettierignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# This file is pre-built and need not be formatted
2-
packages/auth
32
packages/firebase/firebase*
43
packages/firestore/scripts
54
dist

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ command, as follows:
126126

127127

128128
```bash
129-
# Select the Firebase project via the text-based UI.
129+
# Select the Firebase project via the text-based UI. This will run tools/config.js
130+
# and deploy from config/ to your Firebase project.
130131
$ yarn test:setup
131132

132133
# Specify the Firebase project via the command-line arguments.

common/api-review/firestore.api.md

-30
Original file line numberDiff line numberDiff line change
@@ -233,30 +233,6 @@ export function getFirestore(app?: FirebaseApp): Firestore;
233233
// @public
234234
export function increment(n: number): FieldValue;
235235

236-
// @public
237-
export interface Index {
238-
// (undocumented)
239-
[key: string]: unknown;
240-
readonly collectionGroup: string;
241-
readonly fields?: IndexField[];
242-
}
243-
244-
// @public
245-
export interface IndexConfiguration {
246-
// (undocumented)
247-
[key: string]: unknown;
248-
readonly indexes?: Index[];
249-
}
250-
251-
// @public
252-
export interface IndexField {
253-
// (undocumented)
254-
[key: string]: unknown;
255-
readonly arrayConfig?: 'CONTAINS';
256-
readonly fieldPath: string;
257-
readonly order?: 'ASCENDING' | 'DESCENDING';
258-
}
259-
260236
// @public
261237
export function initializeFirestore(app: FirebaseApp, settings: FirestoreSettings): Firestore;
262238

@@ -420,12 +396,6 @@ export function setDoc<T>(reference: DocumentReference<T>, data: WithFieldValue<
420396
// @public
421397
export function setDoc<T>(reference: DocumentReference<T>, data: PartialWithFieldValue<T>, options: SetOptions): Promise<void>;
422398

423-
// @public
424-
export function setIndexConfiguration(firestore: Firestore, configuration: IndexConfiguration): Promise<void>;
425-
426-
// @public
427-
export function setIndexConfiguration(firestore: Firestore, json: string): Promise<void>;
428-
429399
// @public
430400
export function setLogLevel(logLevel: LogLevel): void;
431401

config/database.rules.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"rules": {
33
".read": true,
4-
".write": true
4+
".write": true,
5+
"testing": {
6+
".indexOn": "testIndex"
7+
}
58
}
69
}

packages/auth-compat/karma.conf.js

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const files = ['src/**/*.test.ts'];
2222

2323
module.exports = function (config) {
2424
const karmaConfig = Object.assign({}, karmaBase, {
25+
browsers: getTestBrowsers(argv),
2526
// files to load into karma
2627
files: getTestFiles(),
2728
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
@@ -43,6 +44,14 @@ function getTestFiles() {
4344
}
4445
}
4546

47+
function getTestBrowsers(argv) {
48+
let browsers = ['ChromeHeadless'];
49+
if (process.env?.BROWSERS && argv.unit) {
50+
browsers = process.env?.BROWSERS?.split(',');
51+
}
52+
return browsers;
53+
}
54+
4655
function getClientConfig() {
4756
if (!argv.integration) {
4857
return {};

packages/auth-compat/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"test:all": "run-p test:browser test:node test:integration",
3535
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
3636
"test:browser": "karma start --single-run",
37+
"test:browser:unit": "karma start --single-run --unit",
3738
"test:browser:integration": "karma start --single-run --integration",
3839
"test:node": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts",
3940
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",

packages/auth/demo/src/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ import {
8282
logAtLevel_
8383
} from './logging';
8484

85-
/**
85+
/**
8686
* Constants that are used when connecting to the Auth Emulator.
8787
*/
8888
const USE_AUTH_EMULATOR = false;
@@ -1658,7 +1658,6 @@ function initApp() {
16581658
if (USE_AUTH_EMULATOR) {
16591659
connectAuthEmulator(auth, AUTH_EMULATOR_URL);
16601660
}
1661-
16621661

16631662
tempApp = initializeApp(
16641663
{

packages/auth/demo/src/worker/service-worker.ts

+21-25
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,16 @@ function getOriginFromUrl(url: string): string {
7676

7777
self.addEventListener('install', (event: ExtendableEvent) => {
7878
// Perform install steps.
79-
event.waitUntil(
80-
async (): Promise<void> => {
81-
const cache = await caches.open(CACHE_NAME);
82-
// Add all URLs of resources we want to cache.
83-
try {
84-
await cache.addAll(urlsToCache);
85-
} catch {
86-
// Suppress error as some of the files may not be available for the
87-
// current page.
88-
}
79+
event.waitUntil(async (): Promise<void> => {
80+
const cache = await caches.open(CACHE_NAME);
81+
// Add all URLs of resources we want to cache.
82+
try {
83+
await cache.addAll(urlsToCache);
84+
} catch {
85+
// Suppress error as some of the files may not be available for the
86+
// current page.
8987
}
90-
);
88+
});
9189
});
9290

9391
// As this is a test app, let's only return cached data when offline.
@@ -160,18 +158,16 @@ self.addEventListener('fetch', (event: FetchEvent) => {
160158
self.addEventListener('activate', (event: ExtendableEvent) => {
161159
// Update this list with all caches that need to remain cached.
162160
const cacheWhitelist = ['cache-v1'];
163-
event.waitUntil(
164-
async (): Promise<void> => {
165-
const cacheNames = await caches.keys();
166-
await Promise.all(
167-
cacheNames.map(cacheName => {
168-
// Check if cache is not whitelisted above.
169-
if (cacheWhitelist.indexOf(cacheName) === -1) {
170-
// If not whitelisted, delete it.
171-
return caches.delete(cacheName);
172-
}
173-
})
174-
);
175-
}
176-
);
161+
event.waitUntil(async (): Promise<void> => {
162+
const cacheNames = await caches.keys();
163+
await Promise.all(
164+
cacheNames.map(cacheName => {
165+
// Check if cache is not whitelisted above.
166+
if (cacheWhitelist.indexOf(cacheName) === -1) {
167+
// If not whitelisted, delete it.
168+
return caches.delete(cacheName);
169+
}
170+
})
171+
);
172+
});
177173
});

packages/auth/demo/src/worker/web-worker.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ async function runWorkerTests(googleIdToken: string): Promise<void> {
105105
if (!userCredential.user || !userCredential.user.uid) {
106106
throw new Error('signInWithCredential unexpectedly failed!');
107107
}
108-
const googleCredential = GoogleAuthProvider.credentialFromResult(
109-
userCredential
110-
);
108+
const googleCredential =
109+
GoogleAuthProvider.credentialFromResult(userCredential);
111110
if (!googleCredential) {
112111
throw new Error('signInWithCredential unexpectedly failed!');
113112
}

packages/auth/index.doc.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@
2828
export * from './index';
2929

3030
export { cordovaPopupRedirectResolver } from './index.cordova';
31-
export { reactNativeLocalPersistence, getReactNativePersistence } from './index.rn';
31+
export {
32+
reactNativeLocalPersistence,
33+
getReactNativePersistence
34+
} from './index.rn';

packages/auth/index.rn.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ export const reactNativeLocalPersistence: Persistence =
6969
removeItem(...args) {
7070
// Called inline to avoid deprecation warnings on startup.
7171
return ReactNative.AsyncStorage.removeItem(...args);
72-
},
72+
}
7373
});
7474

75-
export {getReactNativePersistence};
75+
export { getReactNativePersistence };
7676

7777
export function getAuth(app: FirebaseApp = getApp()): Auth {
7878
const provider = _getProvider(app, 'auth');

packages/auth/karma.conf.js

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { argv } = require('yargs');
2020

2121
module.exports = function (config) {
2222
const karmaConfig = Object.assign({}, karmaBase, {
23+
browsers: getTestBrowsers(argv),
2324
// files to load into karma
2425
files: getTestFiles(argv),
2526
// frameworks to use
@@ -52,6 +53,14 @@ function getTestFiles(argv) {
5253
}
5354
}
5455

56+
function getTestBrowsers(argv) {
57+
let browsers = ["ChromeHeadless"];
58+
if (process.env?.BROWSERS && argv.unit) {
59+
browsers = process.env?.BROWSERS?.split(',');
60+
}
61+
return browsers;
62+
}
63+
5564
function getClientConfig(argv) {
5665
if (!argv.local) {
5766
return {};

0 commit comments

Comments
 (0)