Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e0a1861
First pass
maneesht Sep 30, 2025
32facb6
Added caching support
maneesht Oct 3, 2025
0229168
WIP
maneesht Oct 20, 2025
bcd9ebe
Done with first pass
maneesht Oct 28, 2025
764d4ee
Fixed test
maneesht Oct 29, 2025
e476774
WIP
maneesht Oct 29, 2025
b079c53
Renamed files
maneesht Oct 29, 2025
189833b
Final indexeddb pass
maneesht Nov 10, 2025
c83b140
Fixed temp
maneesht Nov 10, 2025
a5b8fe6
WIP
maneesht Nov 11, 2025
78c71fc
Fix build
maneesht Nov 11, 2025
4058d93
WIP
maneesht Nov 11, 2025
3eae4e3
Fixed bdo parsing
maneesht Nov 17, 2025
d86e71f
InMemoryCacheProvider added
maneesht Nov 18, 2025
fcd22d5
Second pass
maneesht Dec 9, 2025
7472d5d
Completed first pass of caching
maneesht Dec 16, 2025
9f17eac
Fixed formatting
maneesht Dec 16, 2025
4a8c6fd
Added todo
maneesht Dec 17, 2025
a94c607
Added entity id tracking
maneesht Dec 23, 2025
beaaa5c
Added todo for later
maneesht Dec 23, 2025
69bc0ec
Completed most todos
maneesht Dec 29, 2025
79a4031
Wrote unit test for caching
maneesht Dec 29, 2025
019b4a7
Added maxAge
maneesht Dec 29, 2025
0b8523b
Removed unnecessary types
maneesht Dec 30, 2025
15faa32
Fixed onComplete issue
maneesht Dec 30, 2025
223a1fa
Got all tests to pass
maneesht Dec 30, 2025
e338976
Fixed extensions parsing algorithm
maneesht Jan 3, 2026
7e86e48
Added SSR
maneesht Jan 6, 2026
1c189df
Cleaned up api
maneesht Jan 7, 2026
c50f7a8
Addressed gemini comment for register.ts
maneesht Jan 7, 2026
baba5c0
Fixed formatting
maneesht Jan 7, 2026
e9fbf67
Removed unnecessary file
maneesht Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 101 additions & 3 deletions common/api-review/data-connect.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import { FirebaseError } from '@firebase/util';
import { LogLevelString } from '@firebase/logger';
import { Provider } from '@firebase/component';

// @public (undocumented)
export interface CacheSettings {
// (undocumented)
cacheProvider: MemoryStub<StorageType>;
// (undocumented)
maxAge?: number;
}

// @public
export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';

Expand Down Expand Up @@ -66,6 +74,12 @@ export class DataConnect {
setInitialized(): void;
}

// @public (undocumented)
export interface DataConnectEntityArray {
// (undocumented)
entityIds: string[];
}

// @public
export class DataConnectError extends FirebaseError {
/* Excluded from this release type: name */
Expand All @@ -75,6 +89,17 @@ export class DataConnectError extends FirebaseError {
// @public (undocumented)
export type DataConnectErrorCode = 'other' | 'already-initialized' | 'not-initialized' | 'not-supported' | 'invalid-argument' | 'partial-error' | 'unauthorized';

// @public (undocumented)
export type DataConnectExtension = {
path: Array<string | number>;
} & (DataConnectEntityArray | DataConnectSingleEntity);

// @public (undocumented)
export interface DataConnectExtensions {
// (undocumented)
dataConnect?: DataConnectExtension[];
}

// @public
export class DataConnectOperationError extends DataConnectError {
/* Excluded from this release type: name */
Expand All @@ -98,31 +123,84 @@ export interface DataConnectOperationFailureResponseErrorInfo {
}

// @public
export interface DataConnectOptions extends ConnectorConfig {
export interface DataConnectOptions extends ConnectorConfig, DataConnectSettings {
// (undocumented)
projectId: string;
}

// @public (undocumented)
export interface DataConnectResponse<T> {
// (undocumented)
data: T;
// (undocumented)
errors: Error[];
// (undocumented)
extensions: DataConnectExtensions;
}

// @public (undocumented)
export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
// (undocumented)
ref: OperationRef<Data, Variables>;
}

// @public (undocumented)
export interface DataConnectSettings {
// (undocumented)
cacheSettings?: CacheSettings;
}

// @public (undocumented)
export interface DataConnectSingleEntity {
// (undocumented)
entityId: string;
}

// @public
export interface DataConnectSubscription<Data, Variables> {
// (undocumented)
errCallback?: (e?: DataConnectError) => void;
// (undocumented)
unsubscribe: () => void;
// (undocumented)
userCallback: OnResultSubscription<Data, Variables>;
}

// @public (undocumented)
export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;

// @public
export function executeMutation<Data, Variables>(mutationRef: MutationRef<Data, Variables>): MutationPromise<Data, Variables>;

// @public
export function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>): QueryPromise<Data, Variables>;
export function executeQuery<Data, Variables>(queryRef: QueryRef<Data, Variables>, options?: ExecuteQueryOptions): QueryPromise<Data, Variables>;

// @public (undocumented)
export interface ExecuteQueryOptions {
// (undocumented)
fetchPolicy: QueryFetchPolicy;
}

// @public
export function getDataConnect(options: ConnectorConfig, settings?: DataConnectSettings): DataConnect;

// @public (undocumented)
export function getDataConnect(options: ConnectorConfig): DataConnect;

// @public
export function getDataConnect(app: FirebaseApp, options: ConnectorConfig): DataConnect;
export function getDataConnect(app: FirebaseApp, connectorConfig: ConnectorConfig): DataConnect;

// @public
export function getDataConnect(app: FirebaseApp, connectorConfig: ConnectorConfig, settings: DataConnectSettings): DataConnect;

// @public (undocumented)
export function makeMemoryCacheProvider(): MemoryStub<'MEMORY'>;

// @public (undocumented)
export class MemoryStub {
// (undocumented)
type: 'MEMORY';
}

// @public (undocumented)
export const MUTATION_STR = "mutation";
Expand Down Expand Up @@ -175,6 +253,8 @@ export interface OpResult<Data> {
// (undocumented)
data: Data;
// (undocumented)
extensions?: DataConnectExtensions;
// (undocumented)
fetchTime: string;
// (undocumented)
source: DataSource;
Expand All @@ -183,6 +263,16 @@ export interface OpResult<Data> {
// @public (undocumented)
export const QUERY_STR = "query";

// @public
export const QueryFetchPolicy: {
readonly PREFER_CACHE: "PREFER_CACHE";
readonly CACHE_ONLY: "CACHE_ONLY";
readonly SERVER_ONLY: "SERVER_ONLY";
};

// @public (undocumented)
export type QueryFetchPolicy = (typeof QueryFetchPolicy)[keyof typeof QueryFetchPolicy];

// @public
export interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
}
Expand Down Expand Up @@ -238,6 +328,14 @@ export const SOURCE_CACHE = "CACHE";
// @public (undocumented)
export const SOURCE_SERVER = "SERVER";

// @public (undocumented)
export const StorageType: {
MEMORY: string;
};

// @public (undocumented)
export type StorageType = (typeof StorageType)[keyof typeof StorageType];

// @public
export function subscribe<Data, Variables>(queryRefOrSerializedResult: QueryRef<Data, Variables> | SerializedRef<Data, Variables>, observer: SubscriptionOptions<Data, Variables>): QueryUnsubscribe;

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 @@ -221,6 +221,11 @@ export class FirebaseError extends Error {
// @public
export type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';

// Warning: (ae-missing-release-tag) "generateSHA256HashBrowser" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function generateSHA256HashBrowser(input: string): Promise<string>;

// @public
export const getDefaultAppConfig: () => Record<string, string> | undefined;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Setup

If the user hasn't already installed the SDK, always run the user's node package manager of choice, and install the package in the directory ../package.json.
For more information on where the library is located, look at the connector.yaml file.

```ts
import { initializeApp } from 'firebase/app';

initializeApp({
// fill in your project config here using the values from your Firebase project or from the `firebase_get_sdk_config` tool from the Firebase MCP server.
});
```

Then, you can run the SDK as needed.
```ts
import { ... } from '@firebasegen/default-connector';
```



Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Basic Usage

Always prioritize using a supported framework over using the generated SDK
directly. Supported frameworks simplify the developer experience and help ensure
best practices are followed.





## Advanced Usage
If a user is not using a supported framework, they can use the generated SDK directly.

Here's an example of how to use it with the first 5 operations:

```js
import { createMovie, listMovies } from '@firebasegen/default-connector';


// Operation CreateMovie: For variables, look at type CreateMovieVars in ../index.d.ts
const { data } = await CreateMovie(dataConnect, createMovieVars);

// Operation ListMovies:
const { data } = await ListMovies(dataConnect);


```
Loading
Loading