Skip to content

Commit

Permalink
Merge branch 'main' into dl/vertex-imagen
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque committed Feb 12, 2025
2 parents c3173a9 + 554c7bd commit a33e819
Show file tree
Hide file tree
Showing 69 changed files with 1,527 additions and 871 deletions.
6 changes: 6 additions & 0 deletions .changeset/flat-plums-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/remote-config': minor
'firebase': minor
---

Adds support for initial state hydration (from SSR contexts)
8 changes: 8 additions & 0 deletions .changeset/forty-bags-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@firebase/database-compat': patch
'@firebase/database': patch
'firebase': patch
---

Fixed: invoking `connectDatabaseEmulator` multiple times with the same parameters will no longer
cause an error. Fixes [GitHub Issue #6824](https://github.com/firebase/firebase-js-sdk/issues/6824).
8 changes: 8 additions & 0 deletions .changeset/lemon-candles-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@firebase/auth': patch
'firebase': patch
---

Fixed: invoking `connectAuthEmulator` multiple times with the same parameters will no longer cause
an error. Fixes [GitHub Issue #6824](https://github.com/firebase/firebase-js-sdk/issues/6824).

5 changes: 5 additions & 0 deletions .changeset/seven-oranges-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/vertexai': patch
---

Filter out empty text parts from streaming responses.
6 changes: 6 additions & 0 deletions .changeset/slimy-chicken-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': patch
'firebase': patch
---

Reverted a change to use UTF-8 encoding in string comparisons which caused a performance issue. See [GitHub issue #8778](https://github.com/firebase/firebase-js-sdk/issues/8778)
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ packages/app-check-types @hsubox76 @firebase/jssdk-global-approvers
packages/app-check-interop-types @hsubox76 @firebase/jssdk-global-approvers

# Documentation Changes
packages/firebase/index.d.ts @egilmorez @firebase/jssdk-global-approvers
packages/firebase/compat/index.d.ts @egilmorez @firebase/jssdk-global-approvers
scripts/docgen/content-sources/ @egilmorez @firebase/jssdk-global-approvers
docs-devsite/ @firebase/firebase-techwriters

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ docs/

# vertexai test data
vertexai-sdk-test-data
mocks-lookup.ts
mocks-lookup.ts

# temp changeset output
changeset-temp.json
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Reference docs for the Firebase [JS SDK](https://firebase.google.com/docs/refere
[Typedoc](https://typedoc.org/).
Typedoc generates this documentation from the main
[firebase index.d.ts type definition file](packages/firebase/index.d.ts). Any updates to
[firebase index.d.ts type definition file](packages/firebase/compat/index.d.ts). Any updates to
documentation should be made in that file.
If any pages are added or removed by your change (by adding or removing a class or interface), the
Expand Down
1 change: 1 addition & 0 deletions common/api-review/firestore-lite.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,5 @@ export class WriteBatch {
// @public
export function writeBatch(firestore: Firestore): WriteBatch;


```
21 changes: 20 additions & 1 deletion common/api-review/remote-config.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ export function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;
// @public
export function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;

// @public
export interface FetchResponse {
config?: FirebaseRemoteConfigObject;
eTag?: string;
status: number;
}

// @public
export type FetchStatus = 'no-fetch-yet' | 'success' | 'failure' | 'throttle';

// @public
export interface FirebaseRemoteConfigObject {
// (undocumented)
[key: string]: string;
}

// @public
export function getAll(remoteConfig: RemoteConfig): Record<string, Value>;

Expand All @@ -37,7 +50,7 @@ export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;
export function getNumber(remoteConfig: RemoteConfig, key: string): number;

// @public (undocumented)
export function getRemoteConfig(app?: FirebaseApp): RemoteConfig;
export function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig;

// @public
export function getString(remoteConfig: RemoteConfig, key: string): string;
Expand All @@ -62,6 +75,12 @@ export interface RemoteConfig {
settings: RemoteConfigSettings;
}

// @public
export interface RemoteConfigOptions {
initialFetchResponse?: FetchResponse;
templateId?: string;
}

// @public
export interface RemoteConfigSettings {
fetchTimeoutMillis: number;
Expand Down
6 changes: 6 additions & 0 deletions docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,14 @@ toc:
section:
- title: CustomSignals
path: /docs/reference/js/remote-config.customsignals.md
- title: FetchResponse
path: /docs/reference/js/remote-config.fetchresponse.md
- title: FirebaseRemoteConfigObject
path: /docs/reference/js/remote-config.firebaseremoteconfigobject.md
- title: RemoteConfig
path: /docs/reference/js/remote-config.remoteconfig.md
- title: RemoteConfigOptions
path: /docs/reference/js/remote-config.remoteconfigoptions.md
- title: RemoteConfigSettings
path: /docs/reference/js/remote-config.remoteconfigsettings.md
- title: Value
Expand Down
67 changes: 67 additions & 0 deletions docs-devsite/remote-config.fetchresponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# FetchResponse interface
Defines a successful response (200 or 304).

<p>Modeled after the native `Response` interface, but simplified for Remote Config's use case.

<b>Signature:</b>

```typescript
export interface FetchResponse
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [config](./remote-config.fetchresponse.md#fetchresponseconfig) | [FirebaseRemoteConfigObject](./remote-config.firebaseremoteconfigobject.md#firebaseremoteconfigobject_interface) | Defines the map of parameters returned as "entries" in the fetch response body.<p>Only defined for 200 responses. |
| [eTag](./remote-config.fetchresponse.md#fetchresponseetag) | string | Defines the ETag response header value.<p>Only defined for 200 and 304 responses. |
| [status](./remote-config.fetchresponse.md#fetchresponsestatus) | number | The HTTP status, which is useful for differentiating success responses with data from those without.<p>The Remote Config client is modeled after the native <code>Fetch</code> interface, so HTTP status is first-class.<p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the HTTP status code. The former is normalized into the latter. |

## FetchResponse.config

Defines the map of parameters returned as "entries" in the fetch response body.

<p>Only defined for 200 responses.

<b>Signature:</b>

```typescript
config?: FirebaseRemoteConfigObject;
```

## FetchResponse.eTag

Defines the ETag response header value.

<p>Only defined for 200 and 304 responses.

<b>Signature:</b>

```typescript
eTag?: string;
```

## FetchResponse.status

The HTTP status, which is useful for differentiating success responses with data from those without.

<p>The Remote Config client is modeled after the native `Fetch` interface, so HTTP status is first-class.

<p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the HTTP status code. The former is normalized into the latter.

<b>Signature:</b>

```typescript
status: number;
```
19 changes: 19 additions & 0 deletions docs-devsite/remote-config.firebaseremoteconfigobject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# FirebaseRemoteConfigObject interface
Defines a self-descriptive reference for config key-value pairs.

<b>Signature:</b>

```typescript
export interface FirebaseRemoteConfigObject
```
10 changes: 7 additions & 3 deletions docs-devsite/remote-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environm
| Function | Description |
| --- | --- |
| <b>function(app, ...)</b> |
| [getRemoteConfig(app)](./remote-config.md#getremoteconfig_cf608e1) | |
| [getRemoteConfig(app, options)](./remote-config.md#getremoteconfig_61d368f) | |
| <b>function(remoteConfig, ...)</b> |
| [activate(remoteConfig)](./remote-config.md#activate_722a192) | Makes the last fetched config available to the getters. |
| [ensureInitialized(remoteConfig)](./remote-config.md#ensureinitialized_722a192) | Ensures the last activated config are available to the getters. |
Expand All @@ -38,7 +38,10 @@ The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environm
| Interface | Description |
| --- | --- |
| [CustomSignals](./remote-config.customsignals.md#customsignals_interface) | Defines the type for representing custom signals and their values.<p>The values in CustomSignals must be one of the following types:<ul> <li><code>string</code> <li><code>number</code> <li><code>null</code> </ul> |
| [FetchResponse](./remote-config.fetchresponse.md#fetchresponse_interface) | Defines a successful response (200 or 304).<p>Modeled after the native <code>Response</code> interface, but simplified for Remote Config's use case. |
| [FirebaseRemoteConfigObject](./remote-config.firebaseremoteconfigobject.md#firebaseremoteconfigobject_interface) | Defines a self-descriptive reference for config key-value pairs. |
| [RemoteConfig](./remote-config.remoteconfig.md#remoteconfig_interface) | The Firebase Remote Config service interface. |
| [RemoteConfigOptions](./remote-config.remoteconfigoptions.md#remoteconfigoptions_interface) | Options for Remote Config initialization. |
| [RemoteConfigSettings](./remote-config.remoteconfigsettings.md#remoteconfigsettings_interface) | Defines configuration options for the Remote Config SDK. |
| [Value](./remote-config.value.md#value_interface) | Wraps a value with metadata and type-safe getters. |

Expand All @@ -52,19 +55,20 @@ The Firebase Remote Config Web SDK. This SDK does not work in a Node.js environm

## function(app, ...)

### getRemoteConfig(app) {:#getremoteconfig_cf608e1}
### getRemoteConfig(app, options) {:#getremoteconfig_61d368f}

<b>Signature:</b>

```typescript
export declare function getRemoteConfig(app?: FirebaseApp): RemoteConfig;
export declare function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| app | [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) | The [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface) instance. |
| options | [RemoteConfigOptions](./remote-config.remoteconfigoptions.md#remoteconfigoptions_interface) | Optional. The [RemoteConfigOptions](./remote-config.remoteconfigoptions.md#remoteconfigoptions_interface) with which to instantiate the Remote Config instance. |

<b>Returns:</b>

Expand Down
46 changes: 46 additions & 0 deletions docs-devsite/remote-config.remoteconfigoptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Project: /docs/reference/js/_project.yaml
Book: /docs/reference/_book.yaml
page_type: reference

{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# RemoteConfigOptions interface
Options for Remote Config initialization.

<b>Signature:</b>

```typescript
export interface RemoteConfigOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [initialFetchResponse](./remote-config.remoteconfigoptions.md#remoteconfigoptionsinitialfetchresponse) | [FetchResponse](./remote-config.fetchresponse.md#fetchresponse_interface) | Hydrates the state with an initial fetch response. |
| [templateId](./remote-config.remoteconfigoptions.md#remoteconfigoptionstemplateid) | string | The ID of the template to use. If not provided, defaults to "firebase". |

## RemoteConfigOptions.initialFetchResponse

Hydrates the state with an initial fetch response.

<b>Signature:</b>

```typescript
initialFetchResponse?: FetchResponse;
```

## RemoteConfigOptions.templateId

The ID of the template to use. If not provided, defaults to "firebase".

<b>Signature:</b>

```typescript
templateId?: string;
```
9 changes: 6 additions & 3 deletions e2e/fix-jsdom-environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@
import JSDOMEnvironment from 'jest-environment-jsdom';

/**
* JSDOMEnvironment patch to polyfill missing fetch with native
* Node fetch
* JSDOMEnvironment patch to polyfill missing APIs with Node APIs.
*/
// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
export default class FixJSDOMEnvironment extends JSDOMEnvironment {
constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
super(...args);

// FIXME https://github.com/jsdom/jsdom/issues/1724
// Fetch
// FIXME: https://github.com/jsdom/jsdom/issues/1724
this.global.fetch = fetch;
this.global.Headers = Headers;
this.global.Request = Request;
this.global.Response = Response;

// Util
this.global.TextEncoder = TextEncoder;
}
}
11 changes: 5 additions & 6 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "index.js",
"scripts": {
"setup": "node test-setup.js",
"test": "yarn jest",
"test:compat": "yarn jest tests/compat.test.ts",
"test:modular": "yarn jest tests/modular.test.ts",
Expand All @@ -18,22 +17,22 @@
"author": "",
"license": "ISC",
"dependencies": {
"firebase": "11.0.2"
"firebase": "11.3.0"
},
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/preset-env": "7.26.0",
"@babel/core": "7.26.8",
"@babel/preset-env": "7.26.8",
"@babel/preset-typescript": "7.26.0",
"@types/jest": "29.5.14",
"babel-jest": "29.7.0",
"babel-loader": "8.3.0",
"babel-loader": "8.4.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"ts-node": "10.9.2",
"typescript": "5.5.4",
"webpack": "5.76.0",
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.1.0"
"webpack-dev-server": "5.2.0"
},
"engines": {
"node": ">=18.0.0"
Expand Down
Loading

0 comments on commit a33e819

Please sign in to comment.