Skip to content

chore: update CHANGELOG#187

Merged
demolaf merged 2 commits intonextfrom
update-changelog
Mar 12, 2026
Merged

chore: update CHANGELOG#187
demolaf merged 2 commits intonextfrom
update-changelog

Conversation

@demolaf
Copy link
Member

@demolaf demolaf commented Mar 11, 2026

No description provided.

@demolaf demolaf marked this pull request as draft March 11, 2026 09:52
@demolaf demolaf changed the title wip changelog update chore: update CHANGELOG Mar 11, 2026
@demolaf demolaf marked this pull request as ready for review March 11, 2026 15:58
@demolaf demolaf merged commit 0237e18 into next Mar 12, 2026
3 checks passed
@demolaf demolaf deleted the update-changelog branch March 12, 2026 14:10
demolaf added a commit that referenced this pull request Mar 18, 2026
* refactor: initializeApp() with optional params, add multi-app support, service caching, and auto project ID discovery (#106)

* wip refactor FirebaseApp initialization logic

* fix: incorrect metadata url

* feat: add getOrInitService to each service for caching and cleanup

* fix: doc comments

* fix: tests errors

* fix: tests errors, skip flaky tests

* fix: lint errors

* fix: ensure emulator is running for e2e tests

* add run scripts to example

* fix: lint errors

* fix: lint errors

* chore: cleanup main.dart, add comments to script on how to test example

* chore: better test description

* fix: services with emulator capabilities should use unauthenticated client

* refactor: All services now use FirebaseServiceType for registration, replacing magic strings.

* feat: added convenience instance methods for each service

* fix: lint errors

* refactor: separate HTTP clients and request handlers

- Splits API handling into HttpClient (low-level HTTP, emulator config, googleapis) and RequestHandler (business logic, transformations, validation).

- Improves separation of concerns across App Check, Auth, Firestore, Messaging, and Security Rules.

* test: add firebase_app tests

* feat(*): Add version generation to workspace packages

* feat: googleapis_auth_utils package, refactor: http.Client to AuthClient (#107)

* refactor: use AuthClient instead of http.Client

* refactor: replace ProjectIdProvider with googleapis_auth_utils

This commit replaces the internal `ProjectIdProvider` with a new, reusable package `googleapis_auth_utils`. This new package introduces an extension on `AuthClient` to handle project ID discovery and caching.

Key changes:
- A new local package `googleapis_auth_utils` is created.
- An extension `AuthClientX` provides `getProjectId()` for project ID discovery.
- The now-redundant `ProjectIdProvider` class in `dart_firebase_admin` has been removed.
- All services (Auth, Firestore, AppCheck, etc.) now use `(await app.client).getProjectId()` to discover the project ID.
- The project ID discovery logic is now more robust, checking environment variables, credential files, gcloud config, and the metadata service.
- The `getProjectId()` and `getServiceAccountEmail()` methods on `ApplicationDefaultCredential` have been removed in favor of the new extension methods.

* fix: lint errors

* fix: cache project ID in http client

* fix CI

* fix CI

* fix CI

* fix CI

* refactor: implement singleton pattern for AppRegistry and update internal visibility

* feat: enhance Google Cloud project ID discovery and caching mechanism

* feat(auth): add support for tenants (#103)

* feat(auth): add support for tenants

* add e2e tests

* more

* more

* fixes

* fix conflicts

* refactor: update terminology from 'whitelisted' to 'allowed' for consistency

---------

Co-authored-by: Ademola Fadumo <demolafadumo@gmail.com>

* refactor: HTTP clients and add AppRegistry tests (#108)

* refactor(dart): apply DRY pattern to HTTP clients for consistent client/projectId handling

Add `_run` helper method to MessagingHttpClient, SecurityRulesHttpClient, and AppCheckHttpClient that accepts both client and projectId as callback parameters. This eliminates redundant `await app.client` calls and centralizes client/projectId retrieval logic.

* refactor: update exception constructors to use FirebaseServiceType for consistency

* test: add AppRegistry tests for singleton behavior and environment options

* refactor: update pubspec.yaml for workspace resolution and dependency management

* feat: sign() on AuthClient (#109)

* refactor(dart): apply DRY pattern to HTTP clients for consistent client/projectId handling

Add `_run` helper method to MessagingHttpClient, SecurityRulesHttpClient, and AppCheckHttpClient that accepts both client and projectId as callback parameters. This eliminates redundant `await app.client` calls and centralizes client/projectId retrieval logic.

* refactor: update exception constructors to use FirebaseServiceType for consistency

* test: add AppRegistry tests for singleton behavior and environment options

* feat: implement sign() extension on AuthClient with IAM Credentials API, local RSA signing, and service account impersonation

* refactor: delegate credential implementation to googleapis_auth_utils

* refactor: use GoogleCredential to parse service account files

* refactor(auth): use Expando to associate credentials with AuthClient

* feat(auth): add getAccessToken() method to GoogleCredential for OAuth2 token retrieval

* chore: update googleapis dependency to version 15.0.0 and add coverage.lcov to .gitignore

* refactor: sign method to use CryptoSigner with custom endpoint.

* feat: add universeDomain support for GoogleCredential and improve IAM endpoint handling

* feat(auth): add getAccessToken() method to Credential, AppCheck tests (#110)

* feat(exception): enhance FirebaseAppException with JSON serialization and update error codes

* refactor(app-check): improve testability and add more tests

* feat: added ProjectConfigManager, removed dynamicLinkDomain, missing error codes for Auth exceptions and tests (#111)

* feat: add missing error codes for invalid hosting link domain and service account

* feat: handle empty server error messages and add tests for FirebaseAuthAdminException

* feat: update JSON serialization methods to public and improve consistency

* feat: add ProjectConfigManager and related methods for project configuration management

* test: includes comprehensive unit and integration tests for project config features

- Adds detailed examples for project configuration and tenant management to the example application.

- Renames the service account key file in examples to `service-account-key.json` for consistency.

* refactor: remove unused UserMetadata.toJson export for testing

* test: add comprehensive tests for UserMetadata and UserInfo response handling

* feat: deprecate dynamicLinkDomain in ActionCodeSettings and introduce linkDomain

* test: add tests for email action links for password reset, email verification, sign-in, and change email functions

* refactor: remove deprecated dynamicLinkDomain in ActionCodeSettings

* fix: update Java setup in build configuration to use version 21

* fix ci

* feat: add TOTP MFA support and improve Auth test coverage (#114)

* refactor(auth_config): toGoogleCloudIdentitytoolkitV1MfaFactor methods for better readability

* refactor: update createSessionCookie method to use SessionCookieOptions

* feat(auth): add TOTP multi-factor authentication support with configuration and serialization

* fix(auth): handle JWT decode exceptions in verifySessionCookie

* fix: use AuthProviderConfig sealed classes to fix casting errors

* fix: session cookie JWT exceptions and integer division

* test: add unit tests for auth methods

* test: add emulator safety to prevent production writes

* test: add production-safe helpers and integration tests for tenant and project configurations

* fix failing tests

* test: add more auth tests

* feat(auth): add support for reCAPTCHA managed rules, key types, and toll fraud protection in tenant config

- Introduce RecaptchaAction, RecaptchaKeyClientType enums, RecaptchaManagedRule, RecaptchaTollFraudManagedRule, and RecaptchaKey classes
- Extend RecaptchaConfig to support managedRules, recaptchaKeys, useSmsBotScore, useSmsTollFraudProtection, and smsTollFraudManagedRules
- Update serialization, deserialization, and validation logic for new fields
- Enhance tests to cover new reCAPTCHA config features
- Update request handler to map new reCAPTCHA config fields

* test: improve TenantAwareAuth tests and add internal constructors for testing

* test: add comprehensive TenantManager unit tests

* test: add Tenant.toJson tests

* docs: clarify parameter type in TenantManager.internal constructor

* feat: adds missing apis for firebase Messaging service and tests (#115)

* refactor(messaging): rename _toProto methods to _toRequest for message serialization

* feat(messaging): add topic subscription and unsubscription APIs with validation and tests

* wip: add Cloud Run example server with messaging and token verification APIs

* feat(messaging): complete implementation with tests and bug fixes

* chore: lint errors

* chore: fix lint errors

* feat: add Functions Task Queue API with emulator support and tests (#116)

* refactor(messaging): rename _toProto methods to _toRequest for message serialization

* feat(messaging): add topic subscription and unsubscription APIs with validation and tests

* wip: add Cloud Run example server with messaging and token verification APIs

* feat(messaging): complete implementation with tests and bug fixes

* chore: lint errors

* chore: fix lint errors

* feat(functions): add Cloud Functions Task Queue admin API with validation and error handling

* refactor: rename client param to api x_http_client.dart

* wip: add Cloud Tasks emulator support with URL rewriting and env detection

* test: add integration and unit tests for Task Queue, enqueue, delete

* test: add comprehensive unit tests for Functions TaskQueue, validation, and error handling

* fix: use existing test service account credentials

- add functions ts example project for functionsExample method in example/main.dart

* chore: add package-lock.json to .gitignore

* refactor: update taskQueue to use named extensionId parameter and update tests

* chore: add doc/api to .gitignore

* feat: add automated documentation generation and GitHub Pages deployment (#117)

* refactor(messaging): rename _toProto methods to _toRequest for message serialization

* feat(messaging): add topic subscription and unsubscription APIs with validation and tests

* wip: add Cloud Run example server with messaging and token verification APIs

* feat(messaging): complete implementation with tests and bug fixes

* chore: lint errors

* chore: fix lint errors

* feat(functions): add Cloud Functions Task Queue admin API with validation and error handling

* refactor: rename client param to api x_http_client.dart

* wip: add Cloud Tasks emulator support with URL rewriting and env detection

* test: add integration and unit tests for Task Queue, enqueue, delete

* test: add comprehensive unit tests for Functions TaskQueue, validation, and error handling

* fix: use existing test service account credentials

- add functions ts example project for functionsExample method in example/main.dart

* chore: add package-lock.json to .gitignore

* refactor: update taskQueue to use named extensionId parameter and update tests

* chore: add documentation generation and deployment workflow

- Add docs.yml GitHub Actions workflow for building and deploying documentation to GitHub Pages
- Add generate-docs.sh script for generating package documentation
- Update .gitignore to exclude generated docs
- Add index.html landing page for documentation
- Update melos scripts in pubspec.yaml to support docs generation

* Update docs workflow to allow manual deployment

* fix: update to latest GitHub Pages actions

* fix: update flutter-action to latest v2 to resolve set-output deprecation warnings

* temp: allow deployment on PRs for testing

* temp: remove environment protection for testing

* chore: restore production docs deployment configuration

* refactor: Security Rules - use the default storage bucket from AppOptions and tests (#119)

* refactor(messaging): rename _toProto methods to _toRequest for message serialization

* feat(messaging): add topic subscription and unsubscription APIs with validation and tests

* wip: add Cloud Run example server with messaging and token verification APIs

* feat(messaging): complete implementation with tests and bug fixes

* chore: lint errors

* chore: fix lint errors

* feat(functions): add Cloud Functions Task Queue admin API with validation and error handling

* refactor: rename client param to api x_http_client.dart

* wip: add Cloud Tasks emulator support with URL rewriting and env detection

* test: add integration and unit tests for Task Queue, enqueue, delete

* test: add comprehensive unit tests for Functions TaskQueue, validation, and error handling

* fix: use existing test service account credentials

- add functions ts example project for functionsExample method in example/main.dart

* chore: add package-lock.json to .gitignore

* refactor: update taskQueue to use named extensionId parameter and update tests

* chore: add documentation generation and deployment workflow

- Add docs.yml GitHub Actions workflow for building and deploying documentation to GitHub Pages
- Add generate-docs.sh script for generating package documentation
- Update .gitignore to exclude generated docs
- Add index.html landing page for documentation
- Update melos scripts in pubspec.yaml to support docs generation

* Update docs workflow to allow manual deployment

* fix: update to latest GitHub Pages actions

* fix: update flutter-action to latest v2 to resolve set-output deprecation warnings

* temp: allow deployment on PRs for testing

* temp: remove environment protection for testing

* chore: restore production docs deployment configuration

* refactor: use the default storage bucket from `AppOptions` if no bucket name is provided.

* fix: add mapping for 'INVALID_ARGUMENT' to FirebaseSecurityRulesErrorCode

* test: add tests for SecurityRules functionality

* test: enhance SecurityRules tests with cleanup and ruleset tracking

* fix: lint errors

* chore: improve READMEs

* chore: improve README readability

* chore: improve README readability

* refactor: remove public API constructors for Firebase services (#120)

* docs: update documentation link for sending messages to topic conditions

* refactor: update constructors to use internal factory methods for AppCheck, Auth, Firestore, Messaging, and SecurityRules

* update README

* refactor(firestore): standalone googleapis_firestore package and multi-db support for firestore (#121)

* docs: update documentation link for sending messages to topic conditions

* refactor: update constructors to use internal factory methods for AppCheck, Auth, Firestore, Messaging, and SecurityRules

* update README

* wip refactor google_cloud_firestore into its own package

* wip refactor google_cloud_firestore files to streamline package structure

* refactor: rename files and update imports for googleapis_firestore package

* docs: add googleapis_firestore package documentation section to index.html

* feat: add multi-database support to Firestore

This change refactors the Firestore integration to support multiple databases within a single `FirebaseApp`, similar to the Node.js Admin SDK.

Key changes:
- `app.firestore()` now accepts an optional `databaseId` to get or create a named database instance.
- Database instances are cached per `databaseId` to ensure the same instance is returned on subsequent calls.
- The `Firestore` service wrapper now manages multiple `googleapis_firestore.Firestore` delegates, one for each database ID.
- Settings are now passed during initialization via `app.firestore(settings: ...)`, and re-initialization with different settings is prevented.
- Added comprehensive unit and integration tests for multi-database functionality, CRUD operations, and emulator support.
- Refactored `EmulatorClient` into the `googleapis_firestore` package and removed redundant exception handling code.

* docs: update README.md with Firestore usage examples and corrections

* chore: fix lint errors

* feat: enhance Firestore example with multi-database support and usage scenarios

* feat: add googleapis_firestore dependency to pubspec.yaml

* feat: add failedPrecondition error code and update error messages in Firestore

* chore: comment out local Firestore emulator configuration in coverage script

* refactor(firestore): simplify and improve firestore tests

* refactor(firestore): update Firestore initialization to use settings and support emulator

* chore: cleanup

* test(firebase_app): update tests to use MockAuthClient and run in zoned environments

* remove TODOs

* feat: add `getQuery` method to Firestore transactions for transaction… (#113)

* feat: add `getQuery` method to Firestore transactions for transactional query execution.

* chore: revert version and changelog per reviewer feedback

* fix: use FirestoreException instead of generic Exception for read-after-write error

* feat(firestore): BulkWriter apis and tests (#123)

* feat: add BulkWriter for high-throughput writes

Adds a `BulkWriter` class to the Firestore client, enabling a large number of write operations to be performed in parallel.

Key features include:
- Automatic batching of writes (up to 20 operations per request).
- Built-in rate limiting (500 ops/sec, ramping up to 10,000 ops/sec) to avoid server hotspots, which can be configured or disabled.
- Automatic retry logic for transient server errors.
- Individual `Future` resolution for each write operation.
- `onWriteResult` and `onWriteError` callbacks for monitoring operation outcomes.
- `flush()` and `close()` methods for managing the write queue.

Additionally, this change introduces `SetOptions` to support merging data for `set()` operations across `DocumentReference`, `WriteBatch`, `Transaction`, and the new `BulkWriter`.

* feat: add support for Firestore data bundles (#124)

This commit introduces the `BundleBuilder` class, which allows for the creation of Firestore data bundles. Bundles can include document snapshots and named query snapshots.

The `BundleBuilder` serializes these elements into a length-prefixed JSON format that can be served to clients for pre-loading data, enabling faster initial load times and offline access.

The implementation includes:
- `BundleBuilder` to add documents and queries.
- `build()` method to generate the final `Uint8List` bundle.
- Internal models for bundle elements (`BundleMetadata`, `BundledDocumentMetadata`, `NamedQuery`, etc.).
- Helper methods for JSON serialization of Firestore types.
- New unit and integration tests for the bundling functionality.

* feat: add support for vector search and query explain

This commit introduces two major features: Firestore Vector Search and Query Explain functionality.

**Vector Search:**
- Adds `FieldValue.vector()` to create `VectorValue` objects for storing vector embeddings in documents.
- Introduces `query.findNearest()` to perform vector similarity searches. This returns a `VectorQuery` which can be executed with `.get()`.
- Adds `VectorQuerySnapshot` to represent the results of a vector search.
- New types `VectorQueryOptions` and `DistanceMeasure` are added to configure vector queries.

**Query Explain:**
- Adds `query.explain(options)` and `vectorQuery.explain(options)` methods.
- These methods return an `ExplainResults` object containing `ExplainMetrics` with plan summaries and optional execution statistics.
- New types `ExplainOptions`, `ExplainResults`, `ExplainMetrics`, `PlanSummary`, and `ExecutionStats` are introduced.

**Other Changes:**
- Adds `size` and `empty` getters to `QuerySnapshot`.
- Extends the internal testing helper `firestore.snapshot_()` to support creating snapshots for missing documents.

* feat(firestore): add query partitioning support with QueryPartition API and tests

- Implement CollectionGroup.getPartitions() to partition queries for parallel execution
- Add QueryPartition class for partition cursors and toQuery() method
- Provide sorting and comparison utilities for partition cursors
- Add unit and production tests for query partitioning

* refactor(firestore): update getPartitions to handle paginated API responses and ensure partition sorting across pages

- Add and enhance unit and production tests for partition pagination and edge cases

* feat: add support for vector search and query explain (#125)

This commit introduces two major features: Firestore Vector Search and Query Explain functionality.

**Vector Search:**
- Adds `FieldValue.vector()` to create `VectorValue` objects for storing vector embeddings in documents.
- Introduces `query.findNearest()` to perform vector similarity searches. This returns a `VectorQuery` which can be executed with `.get()`.
- Adds `VectorQuerySnapshot` to represent the results of a vector search.
- New types `VectorQueryOptions` and `DistanceMeasure` are added to configure vector queries.

**Query Explain:**
- Adds `query.explain(options)` and `vectorQuery.explain(options)` methods.
- These methods return an `ExplainResults` object containing `ExplainMetrics` with plan summaries and optional execution statistics.
- New types `ExplainOptions`, `ExplainResults`, `ExplainMetrics`, `PlanSummary`, and `ExecutionStats` are introduced.

**Other Changes:**
- Adds `size` and `empty` getters to `QuerySnapshot`.
- Extends the internal testing helper `firestore.snapshot_()` to support creating snapshots for missing documents.

* fix: merge conflicts

* feat(firestore): add query partitioning support with QueryPartition API  (#126)

* feat: add support for vector search and query explain

This commit introduces two major features: Firestore Vector Search and Query Explain functionality.

**Vector Search:**
- Adds `FieldValue.vector()` to create `VectorValue` objects for storing vector embeddings in documents.
- Introduces `query.findNearest()` to perform vector similarity searches. This returns a `VectorQuery` which can be executed with `.get()`.
- Adds `VectorQuerySnapshot` to represent the results of a vector search.
- New types `VectorQueryOptions` and `DistanceMeasure` are added to configure vector queries.

**Query Explain:**
- Adds `query.explain(options)` and `vectorQuery.explain(options)` methods.
- These methods return an `ExplainResults` object containing `ExplainMetrics` with plan summaries and optional execution statistics.
- New types `ExplainOptions`, `ExplainResults`, `ExplainMetrics`, `PlanSummary`, and `ExecutionStats` are introduced.

**Other Changes:**
- Adds `size` and `empty` getters to `QuerySnapshot`.
- Extends the internal testing helper `firestore.snapshot_()` to support creating snapshots for missing documents.

* feat(firestore): add query partitioning support with QueryPartition API and tests

- Implement CollectionGroup.getPartitions() to partition queries for parallel execution
- Add QueryPartition class for partition cursors and toQuery() method
- Provide sorting and comparison utilities for partition cursors
- Add unit and production tests for query partitioning

* refactor(firestore): update getPartitions to handle paginated API responses and ensure partition sorting across pages

- Add and enhance unit and production tests for partition pagination and edge cases

* fix: merge conflicts

* feat: add `getQuery` method to Firestore transactions for transaction… (#113)

* feat: add `getQuery` method to Firestore transactions for transactional query execution.

* chore: revert version and changelog per reviewer feedback

* fix: use FirestoreException instead of generic Exception for read-after-write error

* restore: mock tests changes

* feat: add `getQuery` method to Firestore transactions for transaction… (#113)

* feat: add `getQuery` method to Firestore transactions for transactional query execution.

* chore: revert version and changelog per reviewer feedback

* fix: use FirestoreException instead of generic Exception for read-after-write error

* refactor: update tests to use `runZoned` for environment mocking

Introduces a new mechanism for overriding environment variables using `runZoned` and a dedicated `envSymbol`. This allows for more robust and isolated testing by controlling the environment within a specific test zone.

The `Environment.getFirestoreEmulatorHost` method now prioritizes environment variables in the following order:
1. `Zone.current`
2. `environmentOverride` map
3. `Platform.environment`

All relevant tests have been refactored to use `runZoned` for setting up test environments, replacing the previous `environmentOverride` map approach. This improves test reliability, especially for production tests that need to unset emulator variables.

* feat(storage): add signed URL generation support (#128)

* wip implement signed URL generation with V2 and V4 support

* feat: add support for `credentials` and `keyFilename` in `StorageOptions`

This commit introduces two new properties to `StorageOptions`:
- `credentials`: Allows passing service account credentials directly as an object.
- `keyFilename`: Allows specifying a path to a service account JSON key file.

This provides more explicit ways to configure authentication, alongside the existing `authClient` option and Application Default Credentials (ADC). The authentication client initialization logic has been updated to prioritize credentials in the following order: `authClient`, `credentials`, `keyFilename`, and finally ADC.

* feat: implement signed URL generation with V2 and V4 support

* test: add unit and integration tests for Bucket and File signed URL generation

* chore: cleanup comments

* lint fixes

* chore: add Firebase emulator config and storage coverage integration

* test: improve test coverage and error handling for HmacKey and hash stream validation

- Refactor HmacKey tests to allow null and empty projectId, and verify correct metadata assignment
- Update error expectations to use ArgumentError and consistent error messages
- Enhance hash_stream_validator tests to use stream.drain and explicit error assertions
- Wrap integration and endpoint tests in runZoned to isolate environment variables

* chore: update .gitignore to exclude service-account-key.json

* docs: add googleapis_storage package to documentation index

* feat(storage): add storage example and e2e tests for signed URL functionality

- Add `storage_example.dart` demonstrating basic usage and signed URL generation
- Update `main.dart` to include storage example
- Add end-to-end tests for signed URL upload, download, and expiration in `file_integration_test.dart`
- Update integration tests to use production bucket name

* test(storage): add E2E tests for Bucket.getSignedUrl with list action

* refactor(storage): use intl package for UTC date formatting in signer

* refactor: remove firebase emulator configurations for googleapis_storage

* refactor(storage): simplify credential handling and remove Credentials class

- Replace custom Credentials class with GoogleCredential from googleapis_auth_utils
- Update StorageOptions to accept GoogleCredential directly
- Remove keyFilename and related logic in favor of unified credential handling
- Refactor integration and unit tests to use GoogleCredential.fromServiceAccount
- Update imports to use package aliases for clarity
- Increase delay in integration tests to improve consistency

* refactor(tests): update integration tests to use simplified credential initialization

* docs(storage): update credential documentation to include fromServiceAccountParams method

* feat(storage): storage service integration with FirebaseApp and emulator support (#129)

* wip implement signed URL generation with V2 and V4 support

* feat: add support for `credentials` and `keyFilename` in `StorageOptions`

This commit introduces two new properties to `StorageOptions`:
- `credentials`: Allows passing service account credentials directly as an object.
- `keyFilename`: Allows specifying a path to a service account JSON key file.

This provides more explicit ways to configure authentication, alongside the existing `authClient` option and Application Default Credentials (ADC). The authentication client initialization logic has been updated to prioritize credentials in the following order: `authClient`, `credentials`, `keyFilename`, and finally ADC.

* feat: implement signed URL generation with V2 and V4 support

* test: add unit and integration tests for Bucket and File signed URL generation

* chore: cleanup comments

* lint fixes

* chore: add Firebase emulator config and storage coverage integration

* test: improve test coverage and error handling for HmacKey and hash stream validation

- Refactor HmacKey tests to allow null and empty projectId, and verify correct metadata assignment
- Update error expectations to use ArgumentError and consistent error messages
- Enhance hash_stream_validator tests to use stream.drain and explicit error assertions
- Wrap integration and endpoint tests in runZoned to isolate environment variables

* chore: update .gitignore to exclude service-account-key.json

* docs: add googleapis_storage package to documentation index

* feat(storage): add storage example and e2e tests for signed URL functionality

- Add `storage_example.dart` demonstrating basic usage and signed URL generation
- Update `main.dart` to include storage example
- Add end-to-end tests for signed URL upload, download, and expiration in `file_integration_test.dart`
- Update integration tests to use production bucket name

* test(storage): add E2E tests for Bucket.getSignedUrl with list action

* feat(storage): add Storage service integration with emulator support

- Implement Storage service with singleton pattern and FirebaseApp integration
- Add support for Firebase Storage emulator via FIREBASE_STORAGE_EMULATOR_HOST
- Introduce EmulatorClient to handle emulator authentication
- Update environment utilities for Storage emulator detection and configuration
- Enhance Service class to manage emulator and production clients, including proper termination
- Refactor storage example to use new Storage service API
- Update exports and imports for new storage structure
- Add emulator configuration to run_with_emulator.sh
- Improve resumable upload handling for emulator compatibility

* feat: add storage service with emulator support

Adds a new `Storage` service to the Firebase Admin SDK. This service provides an interface to Google Cloud Storage.

Key features:
- Integration with the Firebase Storage emulator via `FIREBASE_STORAGE_EMULATOR_HOST`.
- `app.storage()` method to access the storage service.
- Unit and integration tests for the new service.

* test: remove emulator env vars from prod tests

* refactor(storage): use intl package for UTC date formatting in signer

* fix: CI update env variable types to allow nullable values and improve emulator bucket test docs

* refactor: remove firebase emulator configurations for googleapis_storage

* refactor(storage): simplify credential handling and remove Credentials class

- Replace custom Credentials class with GoogleCredential from googleapis_auth_utils
- Update StorageOptions to accept GoogleCredential directly
- Remove keyFilename and related logic in favor of unified credential handling
- Refactor integration and unit tests to use GoogleCredential.fromServiceAccount
- Update imports to use package aliases for clarity
- Increase delay in integration tests to improve consistency

* refactor(tests): update integration tests to use simplified credential initialization

* docs(storage): update credential documentation to include fromServiceAccountParams method

* fix lint errors

* feat(environment): add unified emulator host access for storage, auth, and cloud tasks

- Introduce Environment class for type-safe emulator host retrieval
- Refactor storage, auth, and cloud tasks clients to use Environment methods
- Update tests to use Environment constants for emulator host

* fix: always use rethrow (#131)

Ensures that the stack comes along!

* test(storage): add comprehensive file operation tests (#130)

* wip implement signed URL generation with V2 and V4 support

* feat: add support for `credentials` and `keyFilename` in `StorageOptions`

This commit introduces two new properties to `StorageOptions`:
- `credentials`: Allows passing service account credentials directly as an object.
- `keyFilename`: Allows specifying a path to a service account JSON key file.

This provides more explicit ways to configure authentication, alongside the existing `authClient` option and Application Default Credentials (ADC). The authentication client initialization logic has been updated to prioritize credentials in the following order: `authClient`, `credentials`, `keyFilename`, and finally ADC.

* feat: implement signed URL generation with V2 and V4 support

* test: add unit and integration tests for Bucket and File signed URL generation

* chore: cleanup comments

* lint fixes

* chore: add Firebase emulator config and storage coverage integration

* test: improve test coverage and error handling for HmacKey and hash stream validation

- Refactor HmacKey tests to allow null and empty projectId, and verify correct metadata assignment
- Update error expectations to use ArgumentError and consistent error messages
- Enhance hash_stream_validator tests to use stream.drain and explicit error assertions
- Wrap integration and endpoint tests in runZoned to isolate environment variables

* chore: update .gitignore to exclude service-account-key.json

* docs: add googleapis_storage package to documentation index

* feat(storage): add storage example and e2e tests for signed URL functionality

- Add `storage_example.dart` demonstrating basic usage and signed URL generation
- Update `main.dart` to include storage example
- Add end-to-end tests for signed URL upload, download, and expiration in `file_integration_test.dart`
- Update integration tests to use production bucket name

* test(storage): add E2E tests for Bucket.getSignedUrl with list action

* feat(storage): add Storage service integration with emulator support

- Implement Storage service with singleton pattern and FirebaseApp integration
- Add support for Firebase Storage emulator via FIREBASE_STORAGE_EMULATOR_HOST
- Introduce EmulatorClient to handle emulator authentication
- Update environment utilities for Storage emulator detection and configuration
- Enhance Service class to manage emulator and production clients, including proper termination
- Refactor storage example to use new Storage service API
- Update exports and imports for new storage structure
- Add emulator configuration to run_with_emulator.sh
- Improve resumable upload handling for emulator compatibility

* feat: add storage service with emulator support

Adds a new `Storage` service to the Firebase Admin SDK. This service provides an interface to Google Cloud Storage.

Key features:
- Integration with the Firebase Storage emulator via `FIREBASE_STORAGE_EMULATOR_HOST`.
- `app.storage()` method to access the storage service.
- Unit and integration tests for the new service.

* test: remove emulator env vars from prod tests

* refactor(storage): use intl package for UTC date formatting in signer

* fix: CI update env variable types to allow nullable values and improve emulator bucket test docs

* refactor: remove firebase emulator configurations for googleapis_storage

* refactor(storage): simplify credential handling and remove Credentials class

- Replace custom Credentials class with GoogleCredential from googleapis_auth_utils
- Update StorageOptions to accept GoogleCredential directly
- Remove keyFilename and related logic in favor of unified credential handling
- Refactor integration and unit tests to use GoogleCredential.fromServiceAccount
- Update imports to use package aliases for clarity
- Increase delay in integration tests to improve consistency

* refactor(tests): update integration tests to use simplified credential initialization

* docs(storage): update credential documentation to include fromServiceAccountParams method

* feat: add comprehensive unit tests for File methods

Adds a full suite of unit tests for the `File` class, covering core operations, metadata handling, and access control.

This includes tests for:
- `getMetadata`
- `setMetadata`
- `delete`
- `exists`
- `get`
- `copy`
- `move`
- `rename`
- `makePublic`
- `makePrivate`
- `publicUrl`
- `getSignedUrl`

The tests use a mock-based setup to verify API interactions, option passing (like `userProject` and preconditions), and correct handling of both success and error responses from the underlying storage API.

* wip e2e test for File operations

* feat: add custom HTTP client to manage decompression

Introduces `StorageHttpClient`, a custom `http.BaseClient` that directs traffic to one of two underlying clients based on the request URL.

This change is necessary because:
- OAuth and token requests require automatic decompression to handle JSON responses.
- Google Cloud Storage API requests need decompression disabled to allow for manual data integrity checks (like CRC32C).

The new client is now used as the base client for authentication and subsequent API calls.

* feat: add HTTP-level tests for `createReadStream` to validate checksums and gzip decompression

* fix: prevent adding errors to closed sink in upload stream completion

* test(storage): add integration and unit tests for file operations

- Add integration tests for `makePublic`, `makePrivate`, `publicUrl`, and `get` methods on `BucketFile`
- Add comprehensive unit tests for `createWriteStream` covering:
    - Resumable and simple upload configurations
    - Content-type detection and manual overrides
    - Gzip compression logic (auto-detection and explicit settings)
    - Precondition and validation options (CRC32C, MD5)
    - Metadata and ACL handling (`private`, `public`, `predefinedAcl`)
    - HTTP-level behavior including progress reporting, metadata updates, and error handling
- Improve test coverage for upload URI handling and project-based billing options

* refactor(storage): invert decompression logic in `StorageHttpClient`

* test(storage): replace fixed delays with file existence checks in integration tests

* test(storage): add integration tests for setStorageClass, rotateEncryptionKey, and createResumableUpload methods

* fix lint errors

* feat(environment): add unified emulator host access for storage, auth, and cloud tasks

- Introduce Environment class for type-safe emulator host retrieval
- Refactor storage, auth, and cloud tasks clients to use Environment methods
- Update tests to use Environment constants for emulator host

* feat(storage): add V2 and V4 signed POST policy generation for file uploads

- Implement File.generateSignedPostPolicyV2 and File.generateSignedPostPolicyV4 methods
- Add types for signed POST policy options and outputs
- Provide argument validation and error handling for policy generation
- Add integration and unit tests for signed POST policy methods

* fix: handle custom endpoints for StorageHttpClient compression routing

* chore: cleanup lint errors

* test(storage): add integration and unit tests for moveFileAtomic, restore, isPublic, and getExpirationDate methods

* chore: fix lint errors

* refactor: sign method to use IAMCredentialsApi for signing blobs

* refactor(tests): remove redundant project ID tests and streamline IAM signing mocks

* feat(firestore): add aggregation query support in transactions (#127)

* feat(firestore): add aggregation query support in transactions

- Add Transaction.getAggregation() method for executing count, sum, and average queries within transactions
- Create _AggregationReader class following same pattern as _QueryReader
- Add AggregateQuery._toProto() with transaction parameter support (transactionId, readTime, transactionOptions)
- Comprehensive test suite with 14 tests covering all scenarios
- All tests passing (14/14 new + 20/20 transaction + 59/59 aggregation = 93/93 total)
- No analyzer errors

Follows the same implementation pattern as query transactions for consistency.

* test(firestore): add comprehensive tests for Transaction.getQuery()

- Add 14 test cases covering all query scenarios in transactions
- Tests include: basic queries, orderBy, limit, offset, cursors
- Tests error handling: read-after-write prevention
- Tests combining get() and getQuery() in same transaction
- Tests read-only transactions, converters, conflict detection
- All tests pass with Firebase emulator

* refactor: remove unused helper functions for AuthClient impersonation

* chore: lint errors

* refactor: remove googleapis_auth_utils dependency (#165)

* refactor: remove googleapis_auth_utils deps

* fix ci

* refactor: add projectIdOverride to HMAC key operations

* chore: bump version to 1.0.0-beta.1

* chore: update changelog

* feat: added recursiveDelete(), withConverter(null) and tests (#164)

* feat(firestore): allow resetting converters by passing null to `withConverter`

* feat(firestore): implement recursiveDelete method for bulk document deletion

* chore: fix lint errors

* chore: code cleanup

* feat(firestore): add JSON serialization and timestamp conversion methods

* test(firestore): add unit tests for Firestore.getAll() method

* test: unit test firestore apis

* test: unit test firestore apis

* test: add integration tests for Firestore.getAll()

* fix: wrap prod tests in runZoned

* chore: update README

* chore: update README and examples for Firebase services (#166)

* chore: update README

* feat: add examples for App Check, Auth, Functions, Messaging, and Security Rules

* test: firebase app tests and fixes (#168)

* test: firebase app tests and fixes

* chore: code cleanup

* Update packages for googleapis_auth breaking changes (#170)

* Update packages for googleapis_auth breaking changes

Accommodate breaking changes from googleapis_auth, specifically the removal of the
`serviceAccountCredentials` getter and the refactoring of cryptographic signing.
- Update `AuthClient.sign()` usages across dart_firebase_admin and googleapis_storage.
  The method now returns a `Future<String>` (base64-encoded signature) instead of
  an object with a `signedBlob` property.
- Explicitly pass `serviceAccountCredentials` into `sign()` invocations where available
  to maintain local RSA signing capabilities.
- Remove `serviceAccountCredentials` overrides from EmulatorClient implementations
  in dart_firebase_admin, googleapis_storage, and googleapis_firestore.
- Update Compute Engine environment detection in FunctionsRequestHandler to check
  internal credential options instead of the removed AuthClient.serviceAccountCredentials.
- Delete local AuthExtension helpers in dart_firebase_admin and googleapis_storage,
  migrating to the newly provided AuthClientSigningExtension methods.
- Update authClient.getServiceAccountEmail usages from a getter to a method invocation.

* OVERRIDES for in-flight PR

Will replace when google/googleapis.dart#717 lands

* test: fix functions test mock for metadata server email resolution

---------

Co-authored-by: Ademola Fadumo <48495111+demolaf@users.noreply.github.com>

* feat: extension on FirebaseApp for serviceAccountEmail() and sign() apis (#171)

* Update packages for googleapis_auth breaking changes

Accommodate breaking changes from googleapis_auth, specifically the removal of the
`serviceAccountCredentials` getter and the refactoring of cryptographic signing.
- Update `AuthClient.sign()` usages across dart_firebase_admin and googleapis_storage.
  The method now returns a `Future<String>` (base64-encoded signature) instead of
  an object with a `signedBlob` property.
- Explicitly pass `serviceAccountCredentials` into `sign()` invocations where available
  to maintain local RSA signing capabilities.
- Remove `serviceAccountCredentials` overrides from EmulatorClient implementations
  in dart_firebase_admin, googleapis_storage, and googleapis_firestore.
- Update Compute Engine environment detection in FunctionsRequestHandler to check
  internal credential options instead of the removed AuthClient.serviceAccountCredentials.
- Delete local AuthExtension helpers in dart_firebase_admin and googleapis_storage,
  migrating to the newly provided AuthClientSigningExtension methods.
- Update authClient.getServiceAccountEmail usages from a getter to a method invocation.

* OVERRIDES for in-flight PR

Will replace when google/googleapis.dart#717 lands

* test: fix functions test mock for metadata server email resolution

* feat: add extension methods for FirebaseApp to handle service account email and signing

* chore: bump dart_firebase_admin to 0.5.0 and googleapis_auth dependency to 2.1.0

* chore: update changelog

---------

Co-authored-by: Kevin Moore <kevmoo@google.com>

* feat: add X-Firebase-Client usage tracking header to all outgoing SDK requests   (#169)

* test: firebase app tests and fixes

* chore: code cleanup

* feat: add FirebaseUserAgentClient to track SDK usage

* Update packages for googleapis_auth breaking changes

Accommodate breaking changes from googleapis_auth, specifically the removal of the
`serviceAccountCredentials` getter and the refactoring of cryptographic signing.
- Update `AuthClient.sign()` usages across dart_firebase_admin and googleapis_storage.
  The method now returns a `Future<String>` (base64-encoded signature) instead of
  an object with a `signedBlob` property.
- Explicitly pass `serviceAccountCredentials` into `sign()` invocations where available
  to maintain local RSA signing capabilities.
- Remove `serviceAccountCredentials` overrides from EmulatorClient implementations
  in dart_firebase_admin, googleapis_storage, and googleapis_firestore.
- Update Compute Engine environment detection in FunctionsRequestHandler to check
  internal credential options instead of the removed AuthClient.serviceAccountCredentials.
- Delete local AuthExtension helpers in dart_firebase_admin and googleapis_storage,
  migrating to the newly provided AuthClientSigningExtension methods.
- Update authClient.getServiceAccountEmail usages from a getter to a method invocation.

* OVERRIDES for in-flight PR

Will replace when google/googleapis.dart#717 lands

* test: fix functions test mock for metadata server email resolution

* feat: add extension methods for FirebaseApp to handle service account email and signing

* chore: bump dart_firebase_admin to 0.5.0 and googleapis_auth dependency to 2.1.0

* chore: update changelog

* chore: code cleanup

* fix ci

* feat: add X-Goog-Api-Client header

---------

Co-authored-by: Kevin Moore <kevmoo@google.com>

* test: add WriteBatch tests for create and update operations (#177)

* refactor: rename to google_cloud_firestore (#180)

* test(firestore): add unit tests for core internals (#183)

* fix: track backoff completion state in `ExponentialBackoff`

* test: add tests for ExponentialBackoff in google_cloud_firestore

* test: add unit tests for RateLimiter

* test: add unit tests for Firestore Transaction guards and retry logic

* test: add tests for empty batch commits, batch resets, and field path validation

* refactor: migrate from googleapis_storage to google_cloud_storage (#182)

* refactor: migrate from googleapis_storage to google_cloud_storage package

* feat: implement getDownloadURL method for retrieving signed download URLs

* chore: update README docs

* feat: add example for retrieving download URL from Firebase Storage

* chore: fix lint

* chore: code cleanup

* chore: update google_cloud_storage dependency to version 0.5.1

* chore: remove deps override

* refactor: remove googleapis_storage documentation from index.html

* test: add Workload Identity Federation tests for Firebase app initialization and authentication (#185)

* chore: update CHANGELOG (#187)

* wip changelog update

* chore: cleanup changelog

* refactor: update build.yml to add integration testing and clean up authentication steps

* fix: coverage condition in build.yml

* refactor: use environment variables to communicate `gcs.Storage` config (#186)

* Make server work with google_cloud_storage

* Use pub version

* Update storage.dart

* Env var

* Reverts

* Update storage.dart

* Update storage.dart

* Fix diff a bit

* Update pubspec.yaml

---------

Co-authored-by: Ademola Fadumo <48495111+demolaf@users.noreply.github.com>

* refactor: remove duplicate test for create custom token

* chore: add license headers (#190)

* chore: add license headers

* chore: update google_cloud_storage dependency version

* chore: update license header management and add new templates

* chore: add scripts for license headers

* chore: update contributing guidelines and license year

* Revert "chore: add license headers (#190)"

This reverts commit 3bcb849.

* chore: update contributing guidelines and google_cloud_storage dependency version

---------

Co-authored-by: Elliot Hesp <elliot.hesp@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Kartikey Mahawar <kartikeymahawar1234@gmail.com>
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
Co-authored-by: Kevin Moore <kevmoo@google.com>
Co-authored-by: Brian Quinlan <bquinlan@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants