Skip to content

Commit

Permalink
Merge master into release
Browse files Browse the repository at this point in the history
  • Loading branch information
google-oss-bot authored Jul 2, 2024
2 parents d92d01e + f018062 commit b73a0cc
Show file tree
Hide file tree
Showing 106 changed files with 1,538 additions and 1,191 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-moons-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/util': patch
---

fix: browser detection (detect either window or web worker)
6 changes: 6 additions & 0 deletions .changeset/clever-dryers-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/app': patch
'firebase': patch
---

Guard the use of `FinalizationRegistry` in `FirebaseServerApp` initialization based on the availability of `FinalizationRegistry` in the runtime.
5 changes: 5 additions & 0 deletions .changeset/fifty-mayflies-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app': patch
---

fix: server app should initialize in web workers
6 changes: 6 additions & 0 deletions .changeset/flat-scissors-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/firestore': patch
'firebase': patch
---

Fix persistence multi-tab snapshot listener metadata sync issue.
5 changes: 5 additions & 0 deletions .changeset/light-cheetahs-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/vertexai-preview': patch
---

Add a publicly exported `VertexAIError` class.
5 changes: 5 additions & 0 deletions .changeset/orange-rings-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/webchannel-wrapper": patch
---

fix: Fix a typo in the webchannel-wrapper's package.json that affected ems5 exports.
8 changes: 8 additions & 0 deletions .changeset/silver-crews-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'firebase': patch
'@firebase/app': patch
---

The `FirebaseServerAppSettings.name` field inherited from `FirebaseAppSettings` is now omitted
instead of overloading the value as `undefined`. This fixes a TypeScript compilation error. For more
information, see [GitHub Issue #8336](https://github.com/firebase/firebase-js-sdk/issues/8336).
4 changes: 0 additions & 4 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,14 @@ jobs:
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
NPM_TOKEN_RULES_UNIT_TESTING: ${{secrets.NPM_TOKEN_RULES_UNIT_TESTING}}
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
NPM_TOKEN_VERTEXAI_PREVIEW: ${{secrets.NPM_TOKEN_VERTEXAI_PREVIEW}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Doc Change Check (Run "yarn docgen devsite" if this fails)
name: Doc Change Check (Run "yarn docgen:all" if this fails)

on: pull_request

Expand All @@ -33,10 +33,10 @@ jobs:
node-version: 20.x
- name: Yarn install
run: yarn
- name: Run doc generation (devsite docs)
run: yarn docgen devsite
- name: Run doc generation
run: yarn docgen:all
- name: Check for changes in docs-devsite dir (fail if so)
run: git diff --exit-code docs-devsite
- name: Reference documentation needs to be updated. See message below.
if: ${{ failure() }}
run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR."
run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen:all\` locally to regenerate docs and add them to this PR."
4 changes: 0 additions & 4 deletions .github/workflows/prerelease-manual-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,14 @@ jobs:
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
NPM_TOKEN_RULES_UNIT_TESTING: ${{secrets.NPM_TOKEN_RULES_UNIT_TESTING}}
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
NPM_TOKEN_VERTEXAI_PREVIEW: ${{secrets.NPM_TOKEN_VERTEXAI_PREVIEW}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,14 @@ jobs:
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
NPM_TOKEN_RULES_UNIT_TESTING: ${{secrets.NPM_TOKEN_RULES_UNIT_TESTING}}
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
NPM_TOKEN_VERTEXAI_PREVIEW: ${{secrets.NPM_TOKEN_VERTEXAI_PREVIEW}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/release-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,14 @@ jobs:
NPM_TOKEN_INSTALLATIONS_TYPES: ${{secrets.NPM_TOKEN_INSTALLATIONS_TYPES}}
NPM_TOKEN_LOGGER: ${{secrets.NPM_TOKEN_LOGGER}}
NPM_TOKEN_MESSAGING: ${{secrets.NPM_TOKEN_MESSAGING}}
NPM_TOKEN_MESSAGING_TYPES: ${{secrets.NPM_TOKEN_MESSAGING_TYPES}}
NPM_TOKEN_PERFORMANCE: ${{secrets.NPM_TOKEN_PERFORMANCE}}
NPM_TOKEN_PERFORMANCE_TYPES: ${{secrets.NPM_TOKEN_PERFORMANCE_TYPES}}
NPM_TOKEN_POLYFILL: ${{secrets.NPM_TOKEN_POLYFILL}}
NPM_TOKEN_REMOTE_CONFIG: ${{secrets.NPM_TOKEN_REMOTE_CONFIG}}
NPM_TOKEN_REMOTE_CONFIG_TYPES: ${{secrets.NPM_TOKEN_REMOTE_CONFIG_TYPES}}
NPM_TOKEN_RULES_UNIT_TESTING: ${{secrets.NPM_TOKEN_RULES_UNIT_TESTING}}
NPM_TOKEN_STORAGE: ${{secrets.NPM_TOKEN_STORAGE}}
NPM_TOKEN_STORAGE_TYPES: ${{secrets.NPM_TOKEN_STORAGE_TYPES}}
NPM_TOKEN_TESTING: ${{secrets.NPM_TOKEN_TESTING}}
NPM_TOKEN_UTIL: ${{secrets.NPM_TOKEN_UTIL}}
NPM_TOKEN_VERTEXAI: ${{secrets.NPM_TOKEN_VERTEXAI}}
NPM_TOKEN_VERTEXAI_PREVIEW: ${{secrets.NPM_TOKEN_VERTEXAI_PREVIEW}}
NPM_TOKEN_WEBCHANNEL_WRAPPER: ${{secrets.NPM_TOKEN_WEBCHANNEL_WRAPPER}}
NPM_TOKEN_FIREBASE: ${{secrets.NPM_TOKEN_FIREBASE}}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

name: Test All Packages

on:
push:
branches: ['**']
on: pull_request

env:
# make chromedriver detect installed Chrome version and download the corresponding driver
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-changed-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

name: Test Auth

on: [push, pull_request]
on: pull_request

env:
# make chromedriver detect installed Chrome version and download the corresponding driver
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ docs/
*.tfstate
*.tfstate.*

# generated test case text data
# vertexai test data
vertexai-sdk-test-data
mocks-lookup.ts
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ than it is today! Here are the guidelines we'd like you to follow:
- [Code of Conduct](#coc)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Updating Documentation](#docs)

Expand All @@ -16,7 +15,7 @@ As contributors and maintainers of the Firebase JS SDK project, we pledge to res
contributes by posting issues, updating documentation, submitting pull requests, providing feedback
in comments, and any other activities.

Communication through any of Firebase's channels (GitHub, StackOverflow, Google+, Twitter, etc.)
Communication through any of Firebase's channels (GitHub, StackOverflow, X, etc.)
must be constructive and never resort to personal attacks, trolling, public or private harassment,
insults, or other unprofessional conduct.

Expand Down Expand Up @@ -228,10 +227,10 @@ root directory to generate the documentation locally:
```
yarn
yarn docgen devsite
yarn docgen:all
```
This will generate reference docs in `docs-devsite/`. Commit and push the generated
This will generate reference docs and the toc in `docs-devsite/`. Commit and push the generated
documentation changes to GitHub following the [PR submission guidelines](#submit). Your push
to the remote repository should force any failing documentation checks to execute again.
Expand Down
3 changes: 1 addition & 2 deletions common/api-review/app.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ export interface FirebaseServerApp extends FirebaseApp {
}

// @public
export interface FirebaseServerAppSettings extends FirebaseAppSettings {
export interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'> {
authIdToken?: string;
name?: undefined;
releaseOnDeref?: object;
}

Expand Down
5 changes: 5 additions & 0 deletions common/api-review/util.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ export const isValidFormat: (token: string) => boolean;
// @public
export const isValidTimestamp: (token: string) => boolean;

// Warning: (ae-missing-release-tag) "isWebWorker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export function isWebWorker(): boolean;

// Warning: (ae-missing-release-tag) "jsonEval" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
Expand Down
43 changes: 43 additions & 0 deletions common/api-review/vertexai-preview.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';

// @public
export interface BaseParams {
Expand Down Expand Up @@ -83,6 +84,14 @@ export interface CountTokensResponse {
totalTokens: number;
}

// @public
export interface CustomErrorData {
errorDetails?: ErrorDetails[];
response?: GenerateContentResponse;
status?: number;
statusText?: string;
}

// @public
interface Date_2 {
// (undocumented)
Expand All @@ -102,6 +111,16 @@ export interface EnhancedGenerateContentResponse extends GenerateContentResponse
text: () => string;
}

// @public
export interface ErrorDetails {
// (undocumented)
'@type'?: string;
[key: string]: unknown;
domain?: string;
metadata?: Record<string, unknown>;
reason?: string;
}

// @public
export interface FileData {
// (undocumented)
Expand Down Expand Up @@ -590,6 +609,30 @@ export interface VertexAI {
location: string;
}

// @public
export class VertexAIError extends FirebaseError {
constructor(code: VertexAIErrorCode, message: string, customErrorData?: CustomErrorData | undefined);
// (undocumented)
readonly code: VertexAIErrorCode;
// (undocumented)
readonly customErrorData?: CustomErrorData | undefined;
// (undocumented)
readonly message: string;
}

// @public
export const enum VertexAIErrorCode {
ERROR = "error",
FETCH_ERROR = "fetch-error",
INVALID_CONTENT = "invalid-content",
NO_API_KEY = "no-api-key",
NO_MODEL = "no-model",
NO_PROJECT_ID = "no-project-id",
PARSE_FAILED = "parse-failed",
REQUEST_ERROR = "request-error",
RESPONSE_ERROR = "response-error"
}

// @public
export interface VertexAIOptions {
// (undocumented)
Expand Down
6 changes: 6 additions & 0 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"plugins": [
{
"name": "tsec",
"reportTsecDiagnosticsOnly": true
}
]
}
}
4 changes: 2 additions & 2 deletions toc/toc.yaml → docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ toc:
path: /docs/reference/js/vertexai-preview.counttokensrequest.md
- title: CountTokensResponse
path: /docs/reference/js/vertexai-preview.counttokensresponse.md
- title: CustomErrorData
path: /docs/reference/js/vertexai-preview.customerrordata.md
- title: Date_2
path: /docs/reference/js/vertexai-preview.date_2.md
- title: EnhancedGenerateContentResponse
Expand Down Expand Up @@ -517,8 +519,6 @@ toc:
path: /docs/reference/js/vertexai-preview.groundingattribution.md
- title: GroundingMetadata
path: /docs/reference/js/vertexai-preview.groundingmetadata.md
- title: HTTPErrorDetails
path: /docs/reference/js/vertexai-preview.httperrordetails.md
- title: InlineDataPart
path: /docs/reference/js/vertexai-preview.inlinedatapart.md
- title: ModelParams
Expand Down
15 changes: 2 additions & 13 deletions docs-devsite/app.firebaseserverappsettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ Configuration options given to [initializeServerApp()](./app.md#initializeserver
<b>Signature:</b>

```typescript
export interface FirebaseServerAppSettings extends FirebaseAppSettings
export interface FirebaseServerAppSettings extends Omit<FirebaseAppSettings, 'name'>
```
<b>Extends:</b> [FirebaseAppSettings](./app.firebaseappsettings.md#firebaseappsettings_interface)
<b>Extends:</b> Omit&lt;[FirebaseAppSettings](./app.firebaseappsettings.md#firebaseappsettings_interface)<!-- -->, 'name'&gt;
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [authIdToken](./app.firebaseserverappsettings.md#firebaseserverappsettingsauthidtoken) | string | An optional Auth ID token used to resume a signed in user session from a client runtime environment.<!-- -->Invoking <code>getAuth</code> with a <code>FirebaseServerApp</code> configured with a validated <code>authIdToken</code> causes an automatic attempt to sign in the user that the <code>authIdToken</code> represents. The token needs to have been recently minted for this operation to succeed.<!-- -->If the token fails local verification, or if the Auth service has failed to validate it when the Auth SDK is initialized, then a warning is logged to the console and the Auth SDK will not sign in a user on initialization.<!-- -->If a user is successfully signed in, then the Auth instance's <code>onAuthStateChanged</code> callback is invoked with the <code>User</code> object as per standard Auth flows. However, <code>User</code> objects created via an <code>authIdToken</code> do not have a refresh token. Attempted <code>refreshToken</code> operations fail. |
| [name](./app.firebaseserverappsettings.md#firebaseserverappsettingsname) | undefined | There is no <code>getApp()</code> operation for <code>FirebaseServerApp</code>, so the name is not relevant for applications. However, it may be used internally, and is declared here so that <code>FirebaseServerApp</code> conforms to the <code>FirebaseApp</code> interface. |
| [releaseOnDeref](./app.firebaseserverappsettings.md#firebaseserverappsettingsreleaseonderef) | object | An optional object. If provided, the Firebase SDK uses a <code>FinalizationRegistry</code> object to monitor the garbage collection status of the provided object. The Firebase SDK releases its reference on the <code>FirebaseServerApp</code> instance when the provided <code>releaseOnDeref</code> object is garbage collected.<!-- -->You can use this field to reduce memory management overhead for your application. If provided, an app running in a SSR pass does not need to perform <code>FirebaseServerApp</code> cleanup, so long as the reference object is deleted (by falling out of SSR scope, for instance.)<!-- -->If an object is not provided then the application must clean up the <code>FirebaseServerApp</code> instance by invoking <code>deleteApp</code>.<!-- -->If the application provides an object in this parameter, but the application is executed in a JavaScript engine that predates the support of <code>FinalizationRegistry</code> (introduced in node v14.6.0, for instance), then an error is thrown at <code>FirebaseServerApp</code> initialization. |
## FirebaseServerAppSettings.authIdToken
Expand All @@ -43,16 +42,6 @@ If a user is successfully signed in, then the Auth instance's `onAuthStateChange
authIdToken?: string;
```
## FirebaseServerAppSettings.name
There is no `getApp()` operation for `FirebaseServerApp`<!-- -->, so the name is not relevant for applications. However, it may be used internally, and is declared here so that `FirebaseServerApp` conforms to the `FirebaseApp` interface.
<b>Signature:</b>
```typescript
name?: undefined;
```
## FirebaseServerAppSettings.releaseOnDeref
An optional object. If provided, the Firebase SDK uses a `FinalizationRegistry` object to monitor the garbage collection status of the provided object. The Firebase SDK releases its reference on the `FirebaseServerApp` instance when the provided `releaseOnDeref` object is garbage collected.
Expand Down
Loading

0 comments on commit b73a0cc

Please sign in to comment.