Skip to content

Commit 909da62

Browse files
committed
Merge branch 'main' into dl/ai
2 parents ad9782c + d5082f9 commit 909da62

25 files changed

+393
-139
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/firestore": patch
3+
"@firebase/util": minor
4+
---
5+
6+
Fix Safari/WebKit cache issues when client-side indexing is used.

.changeset/ninety-ways-dress.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@firebase/app-compat': minor
3+
'@firebase/app-check': minor
4+
'@firebase/app': minor
5+
'firebase': minor
6+
---
7+
8+
Default `automaticDataCollectionEnabled` to true without changing App Check's default behavior.

.vscode/launch.json

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
{
8+
"name": "AI Unit Tests (node)",
9+
"type": "node",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
12+
"cwd": "${workspaceRoot}/packages/vertexai",
13+
"args": [
14+
"--require",
15+
"ts-node/register",
16+
"--require",
17+
"src/index.node.ts",
18+
"--timeout",
19+
"5000",
20+
"src/**/*.test.ts"
21+
],
22+
"env": {
23+
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
24+
},
25+
"sourceMaps": true
26+
},
727
{
828
"type": "node",
929
"request": "launch",
@@ -18,9 +38,9 @@
1838
"${workspaceFolder}/repo-scripts/prune-dts/*.test.ts"
1939
],
2040
"env": {
21-
"TS_NODE_COMPILER_OPTIONS" : "{\"module\":\"commonjs\"}"
41+
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
2242
},
23-
"sourceMaps": true,
43+
"sourceMaps": true
2444
},
2545
{
2646
"type": "node",
@@ -30,16 +50,17 @@
3050
"cwd": "${workspaceRoot}/packages/database",
3151
"args": [
3252
"test/{,!(browser)/**/}*.test.ts",
33-
"--file", "src/index.node.ts",
34-
"--config", "../../config/mocharc.node.js",
53+
"--file",
54+
"src/index.node.ts",
55+
"--config",
56+
"../../config/mocharc.node.js"
3557
],
3658
"env": {
37-
"TS_NODE_FILES":true,
59+
"TS_NODE_FILES": true,
3860
"TS_NODE_CACHE": "NO",
39-
"TS_NODE_COMPILER_OPTIONS" : "{\"module\":\"commonjs\"}"
61+
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
4062
},
41-
"sourceMaps": true,
42-
"protocol": "inspector"
63+
"sourceMaps": true
4364
},
4465
{
4566
"type": "node",
@@ -48,14 +69,16 @@
4869
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
4970
"cwd": "${workspaceRoot}/packages/firestore",
5071
"args": [
51-
"--require", "babel-register.js",
52-
"--require", "src/index.node.ts",
53-
"--timeout", "5000",
72+
"--require",
73+
"babel-register.js",
74+
"--require",
75+
"src/index.node.ts",
76+
"--timeout",
77+
"5000",
5478
"test/{,!(browser|integration)/**/}*.test.ts",
5579
"--exit"
5680
],
57-
"sourceMaps": true,
58-
"protocol": "inspector"
81+
"sourceMaps": true
5982
},
6083
{
6184
"type": "node",
@@ -64,18 +87,21 @@
6487
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
6588
"cwd": "${workspaceRoot}/packages/firestore",
6689
"args": [
67-
"--require", "babel-register.js",
68-
"--require", "index.node.ts",
69-
"--require", "test/util/node_persistence.ts",
70-
"--timeout", "5000",
90+
"--require",
91+
"babel-register.js",
92+
"--require",
93+
"index.node.ts",
94+
"--require",
95+
"test/util/node_persistence.ts",
96+
"--timeout",
97+
"5000",
7198
"test/{,!(browser|integration)/**/}*.test.ts",
7299
"--exit"
73100
],
74101
"env": {
75102
"USE_MOCK_PERSISTENCE": "YES"
76103
},
77-
"sourceMaps": true,
78-
"protocol": "inspector"
104+
"sourceMaps": true
79105
},
80106
{
81107
"type": "node",
@@ -84,17 +110,19 @@
84110
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
85111
"cwd": "${workspaceRoot}/packages/firestore",
86112
"args": [
87-
"--require", "babel-register.js",
88-
"--require", "index.node.ts",
89-
"--timeout", "5000",
113+
"--require",
114+
"babel-register.js",
115+
"--require",
116+
"index.node.ts",
117+
"--timeout",
118+
"5000",
90119
"test/{,!(browser|unit)/**/}*.test.ts",
91120
"--exit"
92121
],
93122
"env": {
94-
"FIRESTORE_TARGET_BACKEND" : "emulator",
123+
"FIRESTORE_TARGET_BACKEND": "emulator"
95124
},
96-
"sourceMaps": true,
97-
"protocol": "inspector"
125+
"sourceMaps": true
98126
},
99127
{
100128
"type": "node",
@@ -103,45 +131,38 @@
103131
"program": "${workspaceRoot}/node_modules/.bin/_mocha",
104132
"cwd": "${workspaceRoot}/packages/firestore",
105133
"args": [
106-
"--require", "babel-register.js",
107-
"--require", "index.node.ts",
108-
"--require", "test/util/node_persistence.ts",
109-
"--timeout", "5000",
134+
"--require",
135+
"babel-register.js",
136+
"--require",
137+
"index.node.ts",
138+
"--require",
139+
"test/util/node_persistence.ts",
140+
"--timeout",
141+
"5000",
110142
"test/{,!(browser|unit)/**/}*.test.ts",
111143
"--exit"
112144
],
113145
"env": {
114146
"USE_MOCK_PERSISTENCE": "YES",
115-
"FIRESTORE_TARGET_BACKEND" : "emulator",
147+
"FIRESTORE_TARGET_BACKEND": "emulator"
116148
},
117-
"sourceMaps": true,
118-
"protocol": "inspector"
149+
"sourceMaps": true
119150
},
120151
{
121152
"type": "node",
122153
"request": "launch",
123154
"name": "Firestore Unit Tests (Browser)",
124155
"program": "${workspaceRoot}/node_modules/.bin/karma",
125156
"cwd": "${workspaceRoot}/packages/firestore",
126-
"args": [
127-
"start",
128-
"--auto-watch",
129-
"--unit",
130-
"--browsers", "Chrome"
131-
]
157+
"args": ["start", "--auto-watch", "--unit", "--browsers", "Chrome"]
132158
},
133159
{
134160
"type": "node",
135161
"request": "launch",
136162
"name": "Firestore Integration Tests (Browser)",
137163
"program": "${workspaceRoot}/node_modules/.bin/karma",
138164
"cwd": "${workspaceRoot}/packages/firestore",
139-
"args": [
140-
"start",
141-
"--auto-watch",
142-
"--integration",
143-
"--browsers", "Chrome"
144-
]
165+
"args": ["start", "--auto-watch", "--integration", "--browsers", "Chrome"]
145166
}
146167
]
147168
}

common/api-review/util.api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ export function isReactNative(): boolean;
317317
// @public
318318
export function isSafari(): boolean;
319319

320+
// Warning: (ae-missing-release-tag) "isSafariOrWebkit" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
321+
//
322+
// @public
323+
export function isSafariOrWebkit(): boolean;
324+
320325
// Warning: (ae-missing-release-tag) "issuedAtTime" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
321326
//
322327
// @public

config/karma.base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const config = {
5353

5454
// Doing 65 seconds to allow for the 20 second firestore tests
5555
browserNoActivityTimeout: 65000,
56+
browserDisconnectTimeout: 65000,
5657

5758
// Preprocess matching files before serving them to the browser.
5859
// Available preprocessors:

docs-devsite/ai.googleaibackend.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# GoogleAIBackend class
13-
Configuration class for the Gemini Developer API (using [Google AI](https://ai.google/)<!-- -->).
13+
Configuration class for the Gemini Developer API.
1414

1515
Use this with [AIOptions](./ai.aioptions.md#aioptions_interface) when initializing the AI service via [getAI()](./ai.md#getai_a94a413) to specify the Gemini Developer API as the backend.
1616

@@ -25,11 +25,11 @@ export declare class GoogleAIBackend extends Backend
2525
2626
| Constructor | Modifiers | Description |
2727
| --- | --- | --- |
28-
| [(constructor)()](./ai.googleaibackend.md#googleaibackendconstructor) | | Creates a configuration object for the Google AI backend. |
28+
| [(constructor)()](./ai.googleaibackend.md#googleaibackendconstructor) | | Creates a configuration object for the Gemini Developer API backend. |
2929
3030
## GoogleAIBackend.(constructor)
3131
32-
Creates a configuration object for the Google AI backend.
32+
Creates a configuration object for the Gemini Developer API backend.
3333
3434
<b>Signature:</b>
3535

docs-devsite/ai.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The Firebase AI Web SDK.
3434
| [BooleanSchema](./ai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. |
3535
| [ChatSession](./ai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. |
3636
| [GenerativeModel](./ai.generativemodel.md#generativemodel_class) | Class for generative model APIs. |
37-
| [GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class) | Configuration class for the Gemini Developer API (using [Google AI](https://ai.google/)<!-- -->).<!-- -->Use this with [AIOptions](./ai.aioptions.md#aioptions_interface) when initializing the AI service via [getAI()](./ai.md#getai_a94a413) to specify the Gemini Developer API as the backend. |
37+
| [GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class) | Configuration class for the Gemini Developer API.<!-- -->Use this with [AIOptions](./ai.aioptions.md#aioptions_interface) when initializing the AI service via [getAI()](./ai.md#getai_a94a413) to specify the Gemini Developer API as the backend. |
3838
| [ImagenImageFormat](./ai.imagenimageformat.md#imagenimageformat_class) | <b><i>(Public Preview)</i></b> Defines the image format for images generated by Imagen.<!-- -->Use this class to specify the desired format (JPEG or PNG) and compression quality for images generated by Imagen. This is typically included as part of [ImagenModelParams](./ai.imagenmodelparams.md#imagenmodelparams_interface)<!-- -->. |
3939
| [ImagenModel](./ai.imagenmodel.md#imagenmodel_class) | <b><i>(Public Preview)</i></b> Class for Imagen model APIs.<!-- -->This class provides methods for generating images using the Imagen model. |
4040
| [IntegerSchema](./ai.integerschema.md#integerschema_class) | Schema class for "integer" types. |

docs-devsite/app.firebaseappsettings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ export interface FirebaseAppSettings
2222

2323
| Property | Type | Description |
2424
| --- | --- | --- |
25-
| [automaticDataCollectionEnabled](./app.firebaseappsettings.md#firebaseappsettingsautomaticdatacollectionenabled) | boolean | The settable config flag for GDPR opt-in/opt-out |
25+
| [automaticDataCollectionEnabled](./app.firebaseappsettings.md#firebaseappsettingsautomaticdatacollectionenabled) | boolean | The settable config flag for GDPR opt-in/opt-out. Defaults to true. |
2626
| [name](./app.firebaseappsettings.md#firebaseappsettingsname) | string | custom name for the Firebase App. The default value is <code>&quot;[DEFAULT]&quot;</code>. |
2727

2828
## FirebaseAppSettings.automaticDataCollectionEnabled
2929

30-
The settable config flag for GDPR opt-in/opt-out
30+
The settable config flag for GDPR opt-in/opt-out. Defaults to true.
3131

3232
<b>Signature:</b>
3333

packages/ai/src/backend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export abstract class Backend {
4242
}
4343

4444
/**
45-
* Configuration class for the Gemini Developer API (using {@link https://ai.google/ | Google AI}).
45+
* Configuration class for the Gemini Developer API.
4646
*
4747
* Use this with {@link AIOptions} when initializing the AI service via
4848
* {@link getAI | getAI()} to specify the Gemini Developer API as the backend.
@@ -51,7 +51,7 @@ export abstract class Backend {
5151
*/
5252
export class GoogleAIBackend extends Backend {
5353
/**
54-
* Creates a configuration object for the Google AI backend.
54+
* Creates a configuration object for the Gemini Developer API backend.
5555
*/
5656
constructor() {
5757
super(BackendType.GOOGLE_AI);

packages/app-check/src/api.test.ts

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,85 @@ describe('api', () => {
239239
expect(getStateReference(app).activated).to.equal(true);
240240
});
241241

242-
it('isTokenAutoRefreshEnabled value defaults to global setting', () => {
242+
it('global false + local unset = false', () => {
243243
app.automaticDataCollectionEnabled = false;
244244
initializeAppCheck(app, {
245245
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY)
246246
});
247247
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
248248
});
249249

250-
it('sets isTokenAutoRefreshEnabled correctly, overriding global setting', () => {
250+
it('global false + local true = false', () => {
251251
app.automaticDataCollectionEnabled = false;
252+
initializeAppCheck(app, {
253+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
254+
isTokenAutoRefreshEnabled: true
255+
});
256+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
257+
});
258+
259+
it('global false + local false = false', () => {
260+
app.automaticDataCollectionEnabled = false;
261+
initializeAppCheck(app, {
262+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
263+
isTokenAutoRefreshEnabled: false
264+
});
265+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
266+
});
267+
268+
it('global unset + local unset = false', () => {
269+
// Global unset should default to true.
270+
initializeAppCheck(app, {
271+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY)
272+
});
273+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
274+
});
275+
276+
it('global unset + local false = false', () => {
277+
// Global unset should default to true.
278+
initializeAppCheck(app, {
279+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
280+
isTokenAutoRefreshEnabled: false
281+
});
282+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
283+
});
284+
285+
it('global unset + local true = true', () => {
286+
// Global unset should default to true.
287+
initializeAppCheck(app, {
288+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
289+
isTokenAutoRefreshEnabled: true
290+
});
291+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(true);
292+
});
293+
294+
it('global true + local unset = false', () => {
295+
app.automaticDataCollectionEnabled = true;
296+
initializeAppCheck(app, {
297+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY)
298+
});
299+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
300+
});
301+
302+
it('global true + local false = false', () => {
303+
app.automaticDataCollectionEnabled = true;
304+
initializeAppCheck(app, {
305+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
306+
isTokenAutoRefreshEnabled: false
307+
});
308+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(false);
309+
});
310+
311+
it('global true + local true = true', () => {
312+
app.automaticDataCollectionEnabled = true;
313+
initializeAppCheck(app, {
314+
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
315+
isTokenAutoRefreshEnabled: true
316+
});
317+
expect(getStateReference(app).isTokenAutoRefreshEnabled).to.equal(true);
318+
});
319+
320+
it('sets isTokenAutoRefreshEnabled correctly, overriding global setting', () => {
252321
initializeAppCheck(app, {
253322
provider: new ReCaptchaV3Provider(FAKE_SITE_KEY),
254323
isTokenAutoRefreshEnabled: true

0 commit comments

Comments
 (0)