Skip to content

Commit ceb25fe

Browse files
committed
Merge branch 'main' into dl/subq-reb
2 parents 2342adc + 31bddcd commit ceb25fe

36 files changed

Lines changed: 3395 additions & 386 deletions

.changeset/funky-teeth-pick.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'firebase': minor
3+
'@firebase/auth': minor
4+
---
5+
6+
Updated the peer dependency range for @react-native-async-storage/async-storage to support both v2 and v3

.changeset/happy-bugs-attack.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"firebase": minor
3+
"@firebase/firestore": minor
4+
---
5+
6+
Added public preview support for full-text and geo search in Pipelines.

.github/workflows/test-all.yml

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@
1414

1515
name: Test All Packages
1616

17-
on: pull_request
17+
on:
18+
pull_request:
19+
push:
20+
branches:
21+
- main
22+
23+
permissions:
24+
contents: read
1825

1926
env:
2027
# make chromedriver detect installed Chrome version and download the corresponding driver
@@ -73,6 +80,7 @@ jobs:
7380
- name: install Chrome stable
7481
run: |
7582
npx @puppeteer/browsers install chrome@stable
83+
- uses: actions/checkout@v4
7684
- name: Download build archive
7785
uses: actions/download-artifact@v4
7886
with:
@@ -98,11 +106,27 @@ jobs:
98106
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
99107
- name: Generate coverage file
100108
run: yarn ci:coverage
109+
- name: Merge and fix coverage files for test-the-rest
110+
run: |
111+
# Clear out any existing master file just in case
112+
> ./lcov-all.info
113+
114+
# Find all LCOV files across all packages
115+
find ./packages -type f -name "lcov.info" | while read lcov_file; do
116+
# lcov_file looks like: ./packages/analytics/coverage/lcov.info
117+
# Extract the package name (the 3rd part of the path split by '/')
118+
PKG_NAME=$(echo "$lcov_file" | cut -d'/' -f3)
119+
120+
# Fix the path for this specific package and append it to the master file
121+
sed "s|SF:src/|SF:packages/$PKG_NAME/src/|g" "$lcov_file" >> ./lcov-all.info
122+
done
101123
- name: Run coverage
102124
uses: coverallsapp/github-action@master
103125
with:
104126
github-token: ${{ secrets.GITHUB_TOKEN }}
105127
path-to-lcov: ./lcov-all.info
128+
flag-name: test-the-rest-coverage
129+
parallel: true
106130
continue-on-error: true
107131

108132
test-auth:
@@ -120,6 +144,7 @@ jobs:
120144
echo "::warning ::${CHROME_VERSION_MISMATCH_MESSAGE}"
121145
echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString"
122146
fi
147+
- uses: actions/checkout@v4
123148
- name: Download build archive
124149
uses: actions/download-artifact@v4
125150
with:
@@ -144,11 +169,20 @@ jobs:
144169
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
145170
- name: Generate coverage file
146171
run: yarn ci:coverage
172+
- name: Merge and fix coverage files for test-auth
173+
run: |
174+
# 1. Smash all Node and Browser coverage files into one giant file
175+
find ./packages/auth/coverage -type f -name "lcov.info" -exec cat {} + > ./lcov-all-auth.info
176+
177+
# 2. Fix standard Node paths
178+
sed -i 's|SF:src/|SF:packages/auth/src/|g' ./lcov-all-auth.info
147179
- name: Run coverage
148180
uses: coverallsapp/github-action@master
149181
with:
150182
github-token: ${{ secrets.GITHUB_TOKEN }}
151-
path-to-lcov: ./lcov-all.info
183+
path-to-lcov: ./lcov-all-auth.info
184+
flag-name: test-auth-coverage
185+
parallel: true
152186
continue-on-error: true
153187

154188
test-firestore:
@@ -160,6 +194,7 @@ jobs:
160194
- name: install Chrome stable
161195
run: |
162196
npx @puppeteer/browsers install chrome@stable
197+
- uses: actions/checkout@v4
163198
- name: Download build archive
164199
uses: actions/download-artifact@v4
165200
with:
@@ -184,11 +219,20 @@ jobs:
184219
EXPERIMENTAL_MODE: true
185220
- name: Generate coverage file
186221
run: yarn ci:coverage
222+
- name: Merge and fix coverage files for test-firestore
223+
run: |
224+
# 1. Smash all Node and Browser coverage files into one giant file
225+
find ./packages/firestore/coverage -type f -name "lcov.info" -exec cat {} + > ./lcov-all-firestore.info
226+
227+
# 2. Fix standard Node paths
228+
sed -i 's|SF:src/|SF:packages/firestore/src/|g' ./lcov-all-firestore.info
187229
- name: Run coverage
188230
uses: coverallsapp/github-action@master
189231
with:
190232
github-token: ${{ secrets.GITHUB_TOKEN }}
191-
path-to-lcov: ./lcov-all.info
233+
path-to-lcov: ./lcov-all-firestore.info
234+
flag-name: test-firestore-coverage
235+
parallel: true
192236
continue-on-error: true
193237
test-firestore-integration:
194238
strategy:
@@ -203,6 +247,7 @@ jobs:
203247
- name: install Chrome stable
204248
run: |
205249
npx @puppeteer/browsers install chrome@stable
250+
- uses: actions/checkout@v4
206251
- name: Download build archive
207252
uses: actions/download-artifact@v4
208253
with:
@@ -221,3 +266,14 @@ jobs:
221266
working-directory: integration/firestore
222267
env:
223268
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
269+
270+
coveralls-finish:
271+
name: Finalize Coveralls
272+
needs: [test-the-rest-coverage, test-auth-coverage, test-firestore-coverage]
273+
runs-on: ubuntu-latest
274+
steps:
275+
- name: Coveralls Finished
276+
uses: coverallsapp/github-action@master
277+
with:
278+
github-token: ${{ secrets.GITHUB_TOKEN }}
279+
parallel-finished: true

common/api-review/firestore-lite-pipelines.api.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ export function documentId(documentPath: string | DocumentReference): FunctionEx
407407
// @public
408408
export function documentId(documentPathExpr: Expression): FunctionExpression;
409409

410+
// @beta
411+
export function documentMatches(rquery: string | Expression): BooleanExpression;
412+
410413
// @public
411414
export type DocumentsStageOptions = StageOptions & {
412415
docs: Array<string | DocumentReference>;
@@ -844,6 +847,8 @@ export class Field extends Expression implements Selectable {
844847
readonly expressionType: ExpressionType;
845848
// (undocumented)
846849
get fieldName(): string;
850+
// @beta
851+
geoDistance(location: GeoPoint | Expression): Expression;
847852
// (undocumented)
848853
selectable: true;
849854
}
@@ -878,11 +883,13 @@ export function floor(fieldName: string): FunctionExpression;
878883
// @public
879884
export class FunctionExpression extends Expression {
880885
constructor(name: string, params: Expression[]);
881-
constructor(name: string, params: Expression[], _methodName: string | undefined);
882886
// (undocumented)
883887
readonly expressionType: ExpressionType;
884888
}
885889

890+
// @beta
891+
export function geoDistance(fieldName: string | Field, location: GeoPoint | Expression): Expression;
892+
886893
// @public
887894
export function greaterThan(left: Expression, right: Expression): BooleanExpression;
888895

@@ -1224,6 +1231,8 @@ export class Pipeline {
12241231
replaceWith(options: ReplaceWithStageOptions): Pipeline;
12251232
sample(documents: number): Pipeline;
12261233
sample(options: SampleStageOptions): Pipeline;
1234+
// @beta
1235+
search(options: SearchStageOptions): Pipeline;
12271236
select(selection: Selectable | string, ...additionalSelections: Array<Selectable | string>): Pipeline;
12281237
select(options: SelectStageOptions): Pipeline;
12291238
sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline;
@@ -1390,6 +1399,16 @@ export type SampleStageOptions = StageOptions & OneOf<{
13901399
documents: number;
13911400
}>;
13921401

1402+
// @beta
1403+
export function score(): Expression;
1404+
1405+
// @beta
1406+
export type SearchStageOptions = StageOptions & {
1407+
query: BooleanExpression | string;
1408+
sort?: Ordering | Ordering[];
1409+
addFields?: Selectable[];
1410+
};
1411+
13931412
// @public
13941413
export interface Selectable {
13951414
// (undocumented)
@@ -1425,11 +1444,11 @@ export function sqrt(expression: Expression): FunctionExpression;
14251444
export function sqrt(fieldName: string): FunctionExpression;
14261445

14271446
// @public
1428-
export interface StageOptions {
1447+
export type StageOptions = {
14291448
rawOptions?: {
14301449
[name: string]: unknown;
14311450
};
1432-
}
1451+
};
14331452

14341453
// @public
14351454
export function startsWith(fieldName: string, prefix: string): BooleanExpression;

common/api-review/firestore-pipelines.api.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ export function documentId(documentPath: string | DocumentReference): FunctionEx
407407
// @public
408408
export function documentId(documentPathExpr: Expression): FunctionExpression;
409409

410+
// @beta
411+
export function documentMatches(rquery: string | Expression): BooleanExpression;
412+
410413
// @public
411414
export type DocumentsStageOptions = StageOptions & {
412415
docs: Array<string | DocumentReference>;
@@ -847,6 +850,8 @@ export class Field extends Expression implements Selectable {
847850
readonly expressionType: ExpressionType;
848851
// (undocumented)
849852
get fieldName(): string;
853+
// @beta
854+
geoDistance(location: GeoPoint | Expression): Expression;
850855
// (undocumented)
851856
selectable: true;
852857
}
@@ -881,11 +886,13 @@ export function floor(fieldName: string): FunctionExpression;
881886
// @public
882887
export class FunctionExpression extends Expression {
883888
constructor(name: string, params: Expression[]);
884-
constructor(name: string, params: Expression[], _methodName: string | undefined);
885889
// (undocumented)
886890
readonly expressionType: ExpressionType;
887891
}
888892

893+
// @beta
894+
export function geoDistance(fieldName: string | Field, location: GeoPoint | Expression): Expression;
895+
889896
// @public
890897
export function greaterThan(left: Expression, right: Expression): BooleanExpression;
891898

@@ -1233,6 +1240,10 @@ export class Pipeline {
12331240
replaceWith(options: ReplaceWithStageOptions): Pipeline;
12341241
sample(documents: number): Pipeline;
12351242
sample(options: SampleStageOptions): Pipeline;
1243+
// Warning: (ae-incompatible-release-tags) The symbol "search" is marked as @public, but its signature references "SearchStageOptions" which is marked as @beta
1244+
//
1245+
// (undocumented)
1246+
search(options: SearchStageOptions): Pipeline;
12361247
select(selection: Selectable | string, ...additionalSelections: Array<Selectable | string>): Pipeline;
12371248
select(options: SelectStageOptions): Pipeline;
12381249
sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline;
@@ -1416,6 +1427,16 @@ export type SampleStageOptions = StageOptions & OneOf<{
14161427
documents: number;
14171428
}>;
14181429

1430+
// @beta
1431+
export function score(): Expression;
1432+
1433+
// @beta
1434+
export type SearchStageOptions = StageOptions & {
1435+
query: BooleanExpression | string;
1436+
sort?: Ordering | Ordering[];
1437+
addFields?: Selectable[];
1438+
};
1439+
14191440
// @public
14201441
export interface Selectable {
14211442
// (undocumented)
@@ -1451,11 +1472,11 @@ export function sqrt(expression: Expression): FunctionExpression;
14511472
export function sqrt(fieldName: string): FunctionExpression;
14521473

14531474
// @public
1454-
export interface StageOptions {
1475+
export type StageOptions = {
14551476
rawOptions?: {
14561477
[name: string]: unknown;
14571478
};
1458-
}
1479+
};
14591480

14601481
// @public
14611482
export function startsWith(fieldName: string, prefix: string): BooleanExpression;

config/webpack.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,29 @@ module.exports = {
112112
})
113113
]
114114
};
115+
116+
// If we are in a CI environment or a developer has explicity asked for coverage (e.g.
117+
// "COVERAGE=true yarn test:browser:unit"), add the babel-loader to instrument the code with
118+
// istanbul
119+
if (
120+
(process.env.CI && process.env.CI !== 'false') ||
121+
process.env.COVERAGE === 'true'
122+
) {
123+
module.exports.module.rules.push({
124+
test: /\.tsx?$/,
125+
// 'post' ensures this runs AFTER ts-loader converts TS to ES2020 JS
126+
enforce: 'post',
127+
use: {
128+
loader: 'babel-loader',
129+
options: {
130+
plugins: ['istanbul'] // Uses babel-plugin-istanbul to add coverage counters
131+
}
132+
},
133+
include: path.resolve(__dirname, '../packages'),
134+
exclude: [
135+
/node_modules/,
136+
/\.test\.tsx?$/, // Don't instrument the tests themselves
137+
/test\//
138+
]
139+
});
140+
}

docs-devsite/_toc.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,6 @@ toc:
654654
path: /docs/reference/js/firestore_lite_pipelines.querydocumentsnapshot.md
655655
- title: Selectable
656656
path: /docs/reference/js/firestore_lite_pipelines.selectable.md
657-
- title: StageOptions
658-
path: /docs/reference/js/firestore_lite_pipelines.stageoptions.md
659657
- title: Timestamp
660658
path: /docs/reference/js/firestore_lite_pipelines.timestamp.md
661659
- title: VectorValue
@@ -719,8 +717,6 @@ toc:
719717
path: /docs/reference/js/firestore_pipelines.snapshotmetadata.md
720718
- title: SnapshotOptions
721719
path: /docs/reference/js/firestore_pipelines.snapshotoptions.md
722-
- title: StageOptions
723-
path: /docs/reference/js/firestore_pipelines.stageoptions.md
724720
- title: Timestamp
725721
path: /docs/reference/js/firestore_pipelines.timestamp.md
726722
- title: VectorValue

docs-devsite/auth.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Firebase Authentication
2020
| [getAuth(app)](./auth.md#getauth_cf608e1) | Returns the Auth instance associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes an Auth instance with platform-specific default dependencies. |
2121
| [initializeAuth(app, deps)](./auth.md#initializeauth_ca77c9b) | Initializes an [Auth](./auth.auth.md#auth_interface) instance with fine-grained control over [Dependencies](./auth.dependencies.md#dependencies_interface)<!-- -->. |
2222
| <b>function(storage, ...)</b> |
23-
| [getReactNativePersistence(storage)](./auth.md#getreactnativepersistence_bab4ada) | Returns a persistence object that wraps <code>AsyncStorage</code> imported from <code>react-native</code> or <code>@react-native-community/async-storage</code>, and can be used in the persistence dependency field in [initializeAuth()](./auth.md#initializeauth_ca77c9b)<!-- -->. |
23+
| [getReactNativePersistence(storage)](./auth.md#getreactnativepersistence_bab4ada) | Returns a persistence object that wraps <code>AsyncStorage</code> imported from <code>react-native</code> or <code>@react-native-async-storage/async-storage</code>, and can be used in the persistence dependency field in [initializeAuth()](./auth.md#initializeauth_ca77c9b)<!-- -->. |
2424
| <b>function(auth, ...)</b> |
2525
| [applyActionCode(auth, oobCode)](./auth.md#applyactioncode_d2ae15a) | Applies a verification code sent to the user by email or other out-of-band mechanism. |
2626
| [beforeAuthStateChanged(auth, callback, onAbort)](./auth.md#beforeauthstatechanged_22f2ab6) | Adds a blocking callback that runs before an auth state change sets a new user. |
@@ -232,7 +232,7 @@ export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): A
232232

233233
### getReactNativePersistence(storage) {:#getreactnativepersistence_bab4ada}
234234

235-
Returns a persistence object that wraps `AsyncStorage` imported from `react-native` or `@react-native-community/async-storage`<!-- -->, and can be used in the persistence dependency field in [initializeAuth()](./auth.md#initializeauth_ca77c9b)<!-- -->.
235+
Returns a persistence object that wraps `AsyncStorage` imported from `react-native` or `@react-native-async-storage/async-storage`<!-- -->, and can be used in the persistence dependency field in [initializeAuth()](./auth.md#initializeauth_ca77c9b)<!-- -->.
236236

237237
<b>Signature:</b>
238238

@@ -250,6 +250,28 @@ export declare function getReactNativePersistence(storage: ReactNativeAsyncStora
250250

251251
[Persistence](./auth.persistence.md#persistence_interface)
252252

253+
### Example
254+
255+
256+
```javascript
257+
import { initializeAuth, getReactNativePersistence } from 'firebase/auth';
258+
259+
// For @react-native-async-storage/async-storage v3:
260+
import { createAsyncStorage } from '@react-native-async-storage/async-storage';
261+
const appStorage = createAsyncStorage('app');
262+
const persistence = getReactNativePersistence(appStorage);
263+
264+
// For @react-native-async-storage/async-storage v2:
265+
// import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
266+
// const persistence = getReactNativePersistence(ReactNativeAsyncStorage);
267+
268+
// Then, initialize auth:
269+
const auth = initializeAuth(app, {
270+
persistence
271+
});
272+
273+
```
274+
253275
## function(auth, ...)
254276

255277
### applyActionCode(auth, oobCode) {:#applyactioncode_d2ae15a}

0 commit comments

Comments
 (0)