Socket
Socket
Sign inDemoInstall

@firebase/database-compat

Package Overview
Dependencies
Maintainers
5
Versions
1048
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/database-compat - npm Package Compare versions

Comparing version 0.0.900-exp.894b5da5a to 0.0.900-exp.8b4d7550f

dist/cjs/src/core/AppCheckTokenProvider.d.ts

4

dist/cjs/exp/api.d.ts

@@ -17,4 +17,4 @@ /**

*/
export { FirebaseDatabase, enableLogging, getDatabase, goOffline, goOnline, useDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, Reference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { Database, enableLogging, getDatabase, goOffline, goOnline, connectDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, DatabaseReference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { OnDisconnect } from '../src/exp/OnDisconnect';

@@ -21,0 +21,0 @@ export { DataSnapshot, EventType, QueryConstraint, QueryConstraintType, endAt, endBefore, equalTo, get, limitToFirst, limitToLast, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, push, query, ref, refFromURL, remove, set, setPriority, setWithPriority, startAfter, startAt, update, child, ReferenceImpl as _ReferenceImpl, QueryImpl as _QueryImpl } from '../src/exp/Reference_impl';

@@ -1,23 +0,7 @@

/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseDatabase } from '../src/exp/Database';
import { Database } from '../src/exp/Database';
declare module '@firebase/component' {
interface NameServiceMapping {
'database-exp': FirebaseDatabase;
'database-exp': Database;
}
}
export declare function registerDatabase(variant?: string): void;

@@ -21,3 +21,3 @@ /**

import { Query, Reference } from './src/api/Reference';
import { enableLogging } from './src/exp/Database';
import { enableLogging } from './src/core/util/util';
declare const ServerValue: {

@@ -24,0 +24,0 @@ TIMESTAMP: object;

@@ -19,6 +19,10 @@ /**

import { FirebaseService } from '@firebase/app-types/private';
import { Compat } from '@firebase/util';
import { FirebaseDatabase as ExpDatabase } from "@firebase/database";
import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
import { Reference } from './Reference';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDatabase = any;
/**
* Class representing a firebase database.

@@ -38,3 +42,3 @@ */

INTERNAL: {
delete: () => Promise<void>;
delete: () => any;
};

@@ -48,4 +52,7 @@ /**

* @param port - the emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
useEmulator(host: string, port: number): void;
useEmulator(host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -73,1 +80,2 @@ * Returns a reference to the root or to the path specified in the provided

}
export {};

@@ -18,4 +18,8 @@ /**

import { Compat } from '@firebase/util';
import { OnDisconnect as ExpOnDisconnect } from "@firebase/database";
import { Indexable } from '../core/util/misc';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpOnDisconnect = any;
export declare class OnDisconnect implements Compat<ExpOnDisconnect> {

@@ -30,1 +34,2 @@ readonly _delegate: ExpOnDisconnect;

}
export {};

@@ -18,3 +18,2 @@ /**

import { Compat } from '@firebase/util';
import { DataSnapshot as ExpDataSnapshot, Query as ExpQuery, Reference as ExpReference } from "@firebase/database";
import { Database } from './Database';

@@ -24,2 +23,9 @@ import { OnDisconnect } from './onDisconnect';

/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDataSnapshot = any;
declare type ExpQuery = any;
declare type ExpReference = any;
/**
* Class representing a firebase data snapshot. It wraps a SnapshotNode and

@@ -86,3 +92,3 @@ * surfaces the public methods (val, forEach, etc.) we want to expose.

hasChildren(): boolean;
get key(): string;
get key(): any;
/**

@@ -160,3 +166,3 @@ * Returns the number of children for this DataSnapshot.

toString(): string;
toJSON(): string;
toJSON(): any;
/**

@@ -206,1 +212,2 @@ * Return true if this query and the provided query are equivalent; otherwise, return false.

}
export {};

@@ -25,3 +25,3 @@ /**

export declare const ConnectionTarget: typeof RepoInfo;
export declare const queryIdentifier: (query: Query) => string;
export declare const queryIdentifier: (query: Query) => any;
/**

@@ -28,0 +28,0 @@ * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.

@@ -40,4 +40,7 @@ /**

}
export declare class EmulatorAdminTokenProvider implements AuthTokenProvider {
private static EMULATOR_AUTH_TOKEN;
export declare class EmulatorTokenProvider implements AuthTokenProvider {
private accessToken;
/** A string that is treated as an admin access token by the RTDB emulator. Used by Admin SDK. */
static OWNER: string;
constructor(accessToken: string);
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;

@@ -44,0 +47,0 @@ addTokenChangeListener(listener: (token: string | null) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -35,2 +36,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
private authOverride_?;

@@ -57,4 +59,6 @@ id: number;

private authToken_;
private appCheckToken_;
private forceTokenRefresh_;
private invalidAuthTokenCount_;
private invalidAppCheckTokenCount_;
private firstConnection_;

@@ -73,3 +77,3 @@ private lastConnectionAttemptTime_;

*/
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, authOverride_?: object | null);
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider, authOverride_?: object | null);
protected sendRequest(action: string, body: unknown, onResponse?: (a: unknown) => void): void;

@@ -83,2 +87,3 @@ get(query: QueryContext): Promise<string>;

private reduceReconnectDelayIfAdminCredential_;
refreshAppCheckToken(token: string | null): void;
/**

@@ -89,2 +94,11 @@ * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like

tryAuth(): void;
/**
* Attempts to authenticate with the given token. If the authentication
* attempt fails, it's triggered like the token was revoked (the connection is
* closed).
*/
tryAppCheck(): void;
/**
* @inheritDoc
*/
unlisten(query: QueryContext, tag: number | null): void;

@@ -107,2 +121,3 @@ private sendUnlisten_;

private scheduleConnect_;
private initConnection_;
private onVisible_;

@@ -119,2 +134,3 @@ private onOnline_;

private onAuthRevoked_;
private onAppCheckRevoked_;
private onSecurityDebugPacket_;

@@ -121,0 +137,0 @@ private restoreState_;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -31,2 +32,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
reportStats(stats: {

@@ -47,3 +49,3 @@ [k: string]: unknown;

*/
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider);
/** @inheritDoc */

@@ -50,0 +52,0 @@ listen(query: QueryContext, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -63,2 +64,3 @@ import { PersistentConnection } from './PersistentConnection';

authTokenProvider_: AuthTokenProvider;
appCheckProvider_: AppCheckTokenProvider;
/** Key for uniquely identifying this repo, used in RepoManager */

@@ -82,3 +84,3 @@ readonly key: string;

persistentConnection_: PersistentConnection | null;
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider, appCheckProvider_: AppCheckTokenProvider);
/**

@@ -85,0 +87,0 @@ * @returns The URL corresponding to the root of this Firebase.

@@ -41,2 +41,7 @@ /**

refreshAuthToken(token: string): void;
/**
* Refreshes the app check token for the current connection.
* @param token The app check token
*/
refreshAppCheckToken(token: string): void;
onDisconnectPut(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -43,0 +48,0 @@ onDisconnectMerge(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -17,4 +17,8 @@ /**

*/
import { QueryContext } from '../view/EventRegistration';
/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type QueryContext = any;
/**
* Returns a locally-unique ID (generated by just incrementing up from 0 each time its called).

@@ -178,1 +182,2 @@ */

export declare const setTimeoutNonBlocking: (fn: () => void, time: number) => number | object;
export {};

@@ -17,5 +17,7 @@ /**

*/
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { _FirebaseService, FirebaseApp } from '@firebase/app-exp';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
import { EmulatorMockTokenOptions } from '@firebase/util';
import { Repo } from '../core/Repo';

@@ -27,3 +29,3 @@ import { ReferenceImpl } from './Reference_impl';

*/
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, url?: string, nodeAdmin?: boolean): FirebaseDatabase;
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, url?: string, nodeAdmin?: boolean): Database;
/**

@@ -36,4 +38,4 @@ * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos.

*/
export declare class FirebaseDatabase implements _FirebaseService {
private _repoInternal;
export declare class Database implements _FirebaseService {
_repoInternal: Repo;
/** The FirebaseApp associated with this Realtime Database instance. */

@@ -68,3 +70,3 @@ readonly app: FirebaseApp;

*/
export declare function getDatabase(app?: FirebaseApp, url?: string): FirebaseDatabase;
export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
/**

@@ -79,4 +81,7 @@ * Modify the provided instance to communicate with the Realtime Database

* @param port - The emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
export declare function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number): void;
export declare function connectDatabaseEmulator(db: Database, host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -103,3 +108,3 @@ * Disconnects from the server (all Database operations will be completed

*/
export declare function goOffline(db: FirebaseDatabase): void;
export declare function goOffline(db: Database): void;
/**

@@ -116,3 +121,3 @@ * Reconnects to the server and synchronizes the offline Database state

*/
export declare function goOnline(db: FirebaseDatabase): void;
export declare function goOnline(db: Database): void;
/**

@@ -119,0 +124,0 @@ * Logs debugging information to the console.

@@ -25,5 +25,5 @@ /**

import { QueryParams } from '../core/view/QueryParams';
import { FirebaseDatabase } from './Database';
import { Database } from './Database';
import { OnDisconnect } from './OnDisconnect';
import { ListenOptions, Query as Query, Reference as Reference, Unsubscribe, ThenableReference } from './Reference';
import { ListenOptions, Query as Query, DatabaseReference, Unsubscribe, ThenableReference } from './Reference';
/**

@@ -42,3 +42,3 @@ * @internal

get key(): string | null;
get ref(): Reference;
get ref(): DatabaseReference;
get _queryIdentifier(): string;

@@ -56,3 +56,3 @@ /**

*/
export declare class ReferenceImpl extends QueryImpl implements Reference {
export declare class ReferenceImpl extends QueryImpl implements DatabaseReference {
/** @hideconstructor */

@@ -82,3 +82,3 @@ constructor(repo: Repo, path: Path);

*/
readonly ref: Reference;
readonly ref: DatabaseReference;
readonly _index: Index;

@@ -95,3 +95,3 @@ /**

*/
ref: Reference, _index: Index);
ref: DatabaseReference, _index: Index);
/**

@@ -217,3 +217,3 @@ * Gets the priority value of the data in this `DataSnapshot`.

*/
export declare function ref(db: FirebaseDatabase, path?: string): Reference;
export declare function ref(db: Database, path?: string): DatabaseReference;
/**

@@ -235,3 +235,3 @@ * Returns a `Reference` representing the location in the Database

*/
export declare function refFromURL(db: FirebaseDatabase, url: string): Reference;
export declare function refFromURL(db: Database, url: string): DatabaseReference;
/**

@@ -248,3 +248,3 @@ * Gets a `Reference` for the location at the specified relative path.

*/
export declare function child(parent: Reference, path: string): Reference;
export declare function child(parent: DatabaseReference, path: string): DatabaseReference;
/**

@@ -257,3 +257,3 @@ * Returns an `OnDisconnect` object - see

*/
export declare function onDisconnect(ref: Reference): OnDisconnect;
export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
export interface ThenableReferenceImpl extends ReferenceImpl, Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {

@@ -284,3 +284,3 @@ }

*/
export declare function push(parent: Reference, value?: unknown): ThenableReference;
export declare function push(parent: DatabaseReference, value?: unknown): ThenableReference;
/**

@@ -300,3 +300,3 @@ * Removes the data at this Database location.

*/
export declare function remove(ref: Reference): Promise<void>;
export declare function remove(ref: DatabaseReference): Promise<void>;
/**

@@ -331,3 +331,3 @@ * Writes data to this Database location.

*/
export declare function set(ref: Reference, value: unknown): Promise<void>;
export declare function set(ref: DatabaseReference, value: unknown): Promise<void>;
/**

@@ -345,3 +345,3 @@ * Sets a priority for the data at this Database location.

*/
export declare function setPriority(ref: Reference, priority: string | number | null): Promise<void>;
export declare function setPriority(ref: DatabaseReference, priority: string | number | null): Promise<void>;
/**

@@ -362,3 +362,3 @@ * Writes data the Database location. Like `set()` but also specifies the

*/
export declare function setWithPriority(ref: Reference, value: unknown, priority: string | number | null): Promise<void>;
export declare function setWithPriority(ref: DatabaseReference, value: unknown, priority: string | number | null): Promise<void>;
/**

@@ -399,3 +399,3 @@ * Writes multiple values to the Database at once.

*/
export declare function update(ref: Reference, values: object): Promise<void>;
export declare function update(ref: DatabaseReference, values: object): Promise<void>;
/**

@@ -424,12 +424,8 @@ * Gets the most up-to-date result for this query.

/**
* Represents the registration of 1 or more child_xxx events.
*
* Currently, it is always exactly 1 child_xxx event, but the idea is we might
* let you register a group of callbacks together in the future.
* Represents the registration of a child_x event.
*/
export declare class ChildEventRegistration implements EventRegistration {
private callbacks;
constructor(callbacks: {
[child: string]: CallbackContext;
} | null);
private eventType;
private callbackContext;
constructor(eventType: string, callbackContext: CallbackContext | null);
respondsTo(eventType: string): boolean;

@@ -436,0 +432,0 @@ createCancelEvent(error: Error, path: Path): CancelEvent | null;

@@ -28,3 +28,3 @@ import { Repo } from '../core/Repo';

*
* Just as with a `Reference`, you can receive data from a `Query` by using the
* Just as with a `DatabaseReference`, you can receive data from a `Query` by using the
* `on*()` methods. You will only receive events and `DataSnapshot`s for the

@@ -37,4 +37,4 @@ * subset of the data that matches your query.

export interface Query extends QueryContext {
/** The `Reference` for the `Query`'s location. */
readonly ref: Reference;
/** The `DatabaseReference` for the `Query`'s location. */
readonly ref: DatabaseReference;
/**

@@ -45,3 +45,3 @@ * Returns whether or not the current and provided queries represent the same

*
* Two `Reference` objects are equivalent if they represent the same location
* Two `DatabaseReference` objects are equivalent if they represent the same location
* and are from the same instance of `FirebaseApp`.

@@ -80,3 +80,3 @@ *

/**
* A `Reference` represents a specific location in your Database and can be used
* A `DatabaseReference` represents a specific location in your Database and can be used
* for reading or writing data to that Database location.

@@ -91,5 +91,5 @@ *

*/
export interface Reference extends Query {
export interface DatabaseReference extends Query {
/**
* The last part of the `Reference`'s path.
* The last part of the `DatabaseReference`'s path.
*

@@ -99,20 +99,20 @@ * For example, `"ada"` is the key for

*
* The key of a root `Reference` is `null`.
* The key of a root `DatabaseReference` is `null`.
*/
readonly key: string | null;
/**
* The parent location of a `Reference`.
* The parent location of a `DatabaseReference`.
*
* The parent of a root `Reference` is `null`.
* The parent of a root `DatabaseReference` is `null`.
*/
readonly parent: Reference | null;
/** The root `Reference` of the Database. */
readonly root: Reference;
readonly parent: DatabaseReference | null;
/** The root `DatabaseReference` of the Database. */
readonly root: DatabaseReference;
}
/**
* A `Promise` that can also act as a `Reference` when returned by
* A `Promise` that can also act as a `DatabaseReference` when returned by
* {@link push}. The reference is available immediately and the Promise resolves
* as the write to the backend completes.
*/
export interface ThenableReference extends Reference, Pick<Promise<Reference>, 'then' | 'catch'> {
export interface ThenableReference extends DatabaseReference, Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
}

@@ -127,3 +127,3 @@ /** A callback that can invoked to remove a listener. */

export interface ReferenceConstructor {
new (repo: Repo, path: Path): Reference;
new (repo: Repo, path: Path): DatabaseReference;
}

@@ -17,3 +17,3 @@ /**

*/
import { Reference } from './Reference';
import { DatabaseReference } from './Reference';
import { DataSnapshot } from './Reference_impl';

@@ -84,2 +84,2 @@ /** An options object to configure transactions. */

*/
export declare function runTransaction(ref: Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
export declare function runTransaction(ref: DatabaseReference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;

@@ -40,2 +40,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
transportSessionId?: string;

@@ -59,11 +61,13 @@ lastSessionId?: string;

/**
* @param connId - An identifier for this connection, used for logging
* @param repoInfo - The info for the endpoint to send data to.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionid if we are reconnecting for an existing
* transport session
* @param lastSessionId - Optional lastSessionId if the PersistentConnection has already created a
* connection previously
* @param connId An identifier for this connection, used for logging
* @param repoInfo The info for the endpoint to send data to.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The AppCheck token for this client.
* @param authToken The AuthToken to use for this connection.
* @param transportSessionId Optional transportSessionid if we are
* reconnecting for an existing transport session
* @param lastSessionId Optional lastSessionId if the PersistentConnection has
* already created a connection previously
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -70,0 +74,0 @@ * @param onMessage - Callback when messages arrive

@@ -26,2 +26,4 @@ /**

private applicationId_;
private appCheckToken_;
private authToken_;
private onMessage_;

@@ -50,2 +52,4 @@ private onReady_;

* @param applicationId_ - the Firebase App ID for this project
* @param appCheckToken_ - The App Check Token for this device.
* @param authToken_ - The auth token for this session.
* @param onMessage_ - the callback to be triggered when a server-push message arrives

@@ -57,3 +61,3 @@ * @param onReady_ - the callback to be triggered when this connection is ready to send messages.

*/
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, appCheckToken_: string | undefined, authToken_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
/**

@@ -60,0 +64,0 @@ * Starts a connection attempt

@@ -25,3 +25,4 @@ /**

export declare const APPLICATION_ID_PARAM = "p";
export declare const APP_CHECK_TOKEN_PARAM = "ac";
export declare const WEBSOCKET = "websocket";
export declare const LONG_POLLING = "long_polling";

@@ -19,3 +19,3 @@ /**

export interface TransportConstructor {
new (connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string): Transport;
new (connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string): Transport;
isAvailable: () => boolean;

@@ -22,0 +22,0 @@ responsesRequiredToBeHealthy?: number;

@@ -26,2 +26,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
keepaliveTimer: number | null;

@@ -42,10 +44,13 @@ frames: string[] | null;

/**
* @param connId - identifier for this transport
* @param repoInfo - The info for the websocket endpoint.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionId if this is connecting to an existing transport
* session
* @param lastSessionId - Optional lastSessionId if there was a previous connection
* @param connId identifier for this transport
* @param repoInfo The info for the websocket endpoint.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The App Check Token for this client.
* @param authToken The Auth Token for this client.
* @param transportSessionId Optional transportSessionId if this is connecting
* to an existing transport session
* @param lastSessionId Optional lastSessionId if there was a previous
* connection
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -52,0 +57,0 @@ * @param repoInfo - The info for the websocket endpoint.

@@ -19,2 +19,3 @@ /**

waitsForCount: (maxCount: any) => EventAccumulator;
waitsForExactCount: (maxCount: any) => EventAccumulator;
};

@@ -21,0 +22,0 @@ export declare class EventAccumulator {

@@ -41,9 +41,6 @@ /**

import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
import { Reference, DataSnapshot, FirebaseDatabase, EventType, Unsubscribe, ListenOptions, OnDisconnect, ThenableReference, QueryConstraint, Query, TransactionOptions, TransactionResult } from "@firebase/database";
import { DataSnapshot, Database, EventType, Unsubscribe, ListenOptions, QueryConstraint, Query } from "@firebase/database";
declare module "@firebase/database" {
function child(parent: types.Reference, path: string): Reference;
function get(query: types.Query): Promise<DataSnapshot>;
function getDatabase(app?: FirebaseAppCompat, url?: string): FirebaseDatabase;
function goOffline(db: types.FirebaseDatabase): void;
function goOnline(db: types.FirebaseDatabase): void;
function getDatabase(app?: FirebaseAppCompat, url?: string): Database;
function off(query: types.Query, eventType?: EventType, callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown): void;

@@ -62,17 +59,6 @@ function onChildAdded(query: types.Query, callback: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;

function onChildRemoved(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
function onDisconnect(ref: types.Reference): OnDisconnect;
function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback?: (error: Error) => unknown): Unsubscribe;
function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, options: ListenOptions): Unsubscribe;
function onValue(query: types.Query, callback: (snapshot: DataSnapshot) => unknown, cancelCallback: (error: Error) => unknown, options: ListenOptions): Unsubscribe;
function push(parent: types.Reference, value?: unknown): ThenableReference;
function query(query: types.Query, ...queryConstraints: QueryConstraint[]): Query;
function ref(db: types.FirebaseDatabase, path?: string): Reference;
function refFromURL(db: types.FirebaseDatabase, url: string): Reference;
function remove(ref: types.Reference): Promise<void>;
function runTransaction(ref: types.Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
function set(ref: types.Reference, value: unknown): Promise<void>;
function setPriority(ref: types.Reference, priority: string | number | null): Promise<void>;
function setWithPriority(ref: types.Reference, value: unknown, priority: string | number | null): Promise<void>;
function update(ref: types.Reference, values: object): Promise<void>;
function useDatabaseEmulator(db: types.FirebaseDatabase, host: string, port: number): void;
}

@@ -17,4 +17,4 @@ /**

*/
export { FirebaseDatabase, enableLogging, getDatabase, goOffline, goOnline, useDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, Reference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { Database, enableLogging, getDatabase, goOffline, goOnline, connectDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, DatabaseReference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { OnDisconnect } from '../src/exp/OnDisconnect';

@@ -21,0 +21,0 @@ export { DataSnapshot, EventType, QueryConstraint, QueryConstraintType, endAt, endBefore, equalTo, get, limitToFirst, limitToLast, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, push, query, ref, refFromURL, remove, set, setPriority, setWithPriority, startAfter, startAt, update, child, ReferenceImpl as _ReferenceImpl, QueryImpl as _QueryImpl } from '../src/exp/Reference_impl';

@@ -1,23 +0,7 @@

/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseDatabase } from '../src/exp/Database';
import { Database } from '../src/exp/Database';
declare module '@firebase/component' {
interface NameServiceMapping {
'database-exp': FirebaseDatabase;
'database-exp': Database;
}
}
export declare function registerDatabase(variant?: string): void;

@@ -21,3 +21,3 @@ /**

import { Query, Reference } from './src/api/Reference';
import { enableLogging } from './src/exp/Database';
import { enableLogging } from './src/core/util/util';
declare const ServerValue: {

@@ -24,0 +24,0 @@ TIMESTAMP: object;

@@ -19,6 +19,10 @@ /**

import { FirebaseService } from '@firebase/app-types/private';
import { Compat } from '@firebase/util';
import { FirebaseDatabase as ExpDatabase } from "@firebase/database";
import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
import { Reference } from './Reference';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDatabase = any;
/**
* Class representing a firebase database.

@@ -38,3 +42,3 @@ */

INTERNAL: {
delete: () => Promise<void>;
delete: () => any;
};

@@ -48,4 +52,7 @@ /**

* @param port - the emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
useEmulator(host: string, port: number): void;
useEmulator(host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -73,1 +80,2 @@ * Returns a reference to the root or to the path specified in the provided

}
export {};

@@ -18,4 +18,8 @@ /**

import { Compat } from '@firebase/util';
import { OnDisconnect as ExpOnDisconnect } from "@firebase/database";
import { Indexable } from '../core/util/misc';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpOnDisconnect = any;
export declare class OnDisconnect implements Compat<ExpOnDisconnect> {

@@ -30,1 +34,2 @@ readonly _delegate: ExpOnDisconnect;

}
export {};

@@ -18,3 +18,2 @@ /**

import { Compat } from '@firebase/util';
import { DataSnapshot as ExpDataSnapshot, Query as ExpQuery, Reference as ExpReference } from "@firebase/database";
import { Database } from './Database';

@@ -24,2 +23,9 @@ import { OnDisconnect } from './onDisconnect';

/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDataSnapshot = any;
declare type ExpQuery = any;
declare type ExpReference = any;
/**
* Class representing a firebase data snapshot. It wraps a SnapshotNode and

@@ -86,3 +92,3 @@ * surfaces the public methods (val, forEach, etc.) we want to expose.

hasChildren(): boolean;
get key(): string;
get key(): any;
/**

@@ -160,3 +166,3 @@ * Returns the number of children for this DataSnapshot.

toString(): string;
toJSON(): string;
toJSON(): any;
/**

@@ -206,1 +212,2 @@ * Return true if this query and the provided query are equivalent; otherwise, return false.

}
export {};

@@ -25,3 +25,3 @@ /**

export declare const ConnectionTarget: typeof RepoInfo;
export declare const queryIdentifier: (query: Query) => string;
export declare const queryIdentifier: (query: Query) => any;
/**

@@ -28,0 +28,0 @@ * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.

@@ -40,4 +40,7 @@ /**

}
export declare class EmulatorAdminTokenProvider implements AuthTokenProvider {
private static EMULATOR_AUTH_TOKEN;
export declare class EmulatorTokenProvider implements AuthTokenProvider {
private accessToken;
/** A string that is treated as an admin access token by the RTDB emulator. Used by Admin SDK. */
static OWNER: string;
constructor(accessToken: string);
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;

@@ -44,0 +47,0 @@ addTokenChangeListener(listener: (token: string | null) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -35,2 +36,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
private authOverride_?;

@@ -57,4 +59,6 @@ id: number;

private authToken_;
private appCheckToken_;
private forceTokenRefresh_;
private invalidAuthTokenCount_;
private invalidAppCheckTokenCount_;
private firstConnection_;

@@ -73,3 +77,3 @@ private lastConnectionAttemptTime_;

*/
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, authOverride_?: object | null);
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider, authOverride_?: object | null);
protected sendRequest(action: string, body: unknown, onResponse?: (a: unknown) => void): void;

@@ -83,2 +87,3 @@ get(query: QueryContext): Promise<string>;

private reduceReconnectDelayIfAdminCredential_;
refreshAppCheckToken(token: string | null): void;
/**

@@ -89,2 +94,11 @@ * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like

tryAuth(): void;
/**
* Attempts to authenticate with the given token. If the authentication
* attempt fails, it's triggered like the token was revoked (the connection is
* closed).
*/
tryAppCheck(): void;
/**
* @inheritDoc
*/
unlisten(query: QueryContext, tag: number | null): void;

@@ -107,2 +121,3 @@ private sendUnlisten_;

private scheduleConnect_;
private initConnection_;
private onVisible_;

@@ -119,2 +134,3 @@ private onOnline_;

private onAuthRevoked_;
private onAppCheckRevoked_;
private onSecurityDebugPacket_;

@@ -121,0 +137,0 @@ private restoreState_;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -31,2 +32,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
reportStats(stats: {

@@ -47,3 +49,3 @@ [k: string]: unknown;

*/
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider);
/** @inheritDoc */

@@ -50,0 +52,0 @@ listen(query: QueryContext, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -63,2 +64,3 @@ import { PersistentConnection } from './PersistentConnection';

authTokenProvider_: AuthTokenProvider;
appCheckProvider_: AppCheckTokenProvider;
/** Key for uniquely identifying this repo, used in RepoManager */

@@ -82,3 +84,3 @@ readonly key: string;

persistentConnection_: PersistentConnection | null;
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider, appCheckProvider_: AppCheckTokenProvider);
/**

@@ -85,0 +87,0 @@ * @returns The URL corresponding to the root of this Firebase.

@@ -41,2 +41,7 @@ /**

refreshAuthToken(token: string): void;
/**
* Refreshes the app check token for the current connection.
* @param token The app check token
*/
refreshAppCheckToken(token: string): void;
onDisconnectPut(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -43,0 +48,0 @@ onDisconnectMerge(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -17,4 +17,8 @@ /**

*/
import { QueryContext } from '../view/EventRegistration';
/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type QueryContext = any;
/**
* Returns a locally-unique ID (generated by just incrementing up from 0 each time its called).

@@ -178,1 +182,2 @@ */

export declare const setTimeoutNonBlocking: (fn: () => void, time: number) => number | object;
export {};

@@ -17,5 +17,7 @@ /**

*/
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { _FirebaseService, FirebaseApp } from '@firebase/app-exp';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
import { EmulatorMockTokenOptions } from '@firebase/util';
import { Repo } from '../core/Repo';

@@ -27,3 +29,3 @@ import { ReferenceImpl } from './Reference_impl';

*/
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, url?: string, nodeAdmin?: boolean): FirebaseDatabase;
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, url?: string, nodeAdmin?: boolean): Database;
/**

@@ -36,4 +38,4 @@ * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos.

*/
export declare class FirebaseDatabase implements _FirebaseService {
private _repoInternal;
export declare class Database implements _FirebaseService {
_repoInternal: Repo;
/** The FirebaseApp associated with this Realtime Database instance. */

@@ -68,3 +70,3 @@ readonly app: FirebaseApp;

*/
export declare function getDatabase(app?: FirebaseApp, url?: string): FirebaseDatabase;
export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
/**

@@ -79,4 +81,7 @@ * Modify the provided instance to communicate with the Realtime Database

* @param port - The emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
export declare function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number): void;
export declare function connectDatabaseEmulator(db: Database, host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -103,3 +108,3 @@ * Disconnects from the server (all Database operations will be completed

*/
export declare function goOffline(db: FirebaseDatabase): void;
export declare function goOffline(db: Database): void;
/**

@@ -116,3 +121,3 @@ * Reconnects to the server and synchronizes the offline Database state

*/
export declare function goOnline(db: FirebaseDatabase): void;
export declare function goOnline(db: Database): void;
/**

@@ -119,0 +124,0 @@ * Logs debugging information to the console.

@@ -25,5 +25,5 @@ /**

import { QueryParams } from '../core/view/QueryParams';
import { FirebaseDatabase } from './Database';
import { Database } from './Database';
import { OnDisconnect } from './OnDisconnect';
import { ListenOptions, Query as Query, Reference as Reference, Unsubscribe, ThenableReference } from './Reference';
import { ListenOptions, Query as Query, DatabaseReference, Unsubscribe, ThenableReference } from './Reference';
/**

@@ -42,3 +42,3 @@ * @internal

get key(): string | null;
get ref(): Reference;
get ref(): DatabaseReference;
get _queryIdentifier(): string;

@@ -56,3 +56,3 @@ /**

*/
export declare class ReferenceImpl extends QueryImpl implements Reference {
export declare class ReferenceImpl extends QueryImpl implements DatabaseReference {
/** @hideconstructor */

@@ -82,3 +82,3 @@ constructor(repo: Repo, path: Path);

*/
readonly ref: Reference;
readonly ref: DatabaseReference;
readonly _index: Index;

@@ -95,3 +95,3 @@ /**

*/
ref: Reference, _index: Index);
ref: DatabaseReference, _index: Index);
/**

@@ -217,3 +217,3 @@ * Gets the priority value of the data in this `DataSnapshot`.

*/
export declare function ref(db: FirebaseDatabase, path?: string): Reference;
export declare function ref(db: Database, path?: string): DatabaseReference;
/**

@@ -235,3 +235,3 @@ * Returns a `Reference` representing the location in the Database

*/
export declare function refFromURL(db: FirebaseDatabase, url: string): Reference;
export declare function refFromURL(db: Database, url: string): DatabaseReference;
/**

@@ -248,3 +248,3 @@ * Gets a `Reference` for the location at the specified relative path.

*/
export declare function child(parent: Reference, path: string): Reference;
export declare function child(parent: DatabaseReference, path: string): DatabaseReference;
/**

@@ -257,3 +257,3 @@ * Returns an `OnDisconnect` object - see

*/
export declare function onDisconnect(ref: Reference): OnDisconnect;
export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
export interface ThenableReferenceImpl extends ReferenceImpl, Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {

@@ -284,3 +284,3 @@ }

*/
export declare function push(parent: Reference, value?: unknown): ThenableReference;
export declare function push(parent: DatabaseReference, value?: unknown): ThenableReference;
/**

@@ -300,3 +300,3 @@ * Removes the data at this Database location.

*/
export declare function remove(ref: Reference): Promise<void>;
export declare function remove(ref: DatabaseReference): Promise<void>;
/**

@@ -331,3 +331,3 @@ * Writes data to this Database location.

*/
export declare function set(ref: Reference, value: unknown): Promise<void>;
export declare function set(ref: DatabaseReference, value: unknown): Promise<void>;
/**

@@ -345,3 +345,3 @@ * Sets a priority for the data at this Database location.

*/
export declare function setPriority(ref: Reference, priority: string | number | null): Promise<void>;
export declare function setPriority(ref: DatabaseReference, priority: string | number | null): Promise<void>;
/**

@@ -362,3 +362,3 @@ * Writes data the Database location. Like `set()` but also specifies the

*/
export declare function setWithPriority(ref: Reference, value: unknown, priority: string | number | null): Promise<void>;
export declare function setWithPriority(ref: DatabaseReference, value: unknown, priority: string | number | null): Promise<void>;
/**

@@ -399,3 +399,3 @@ * Writes multiple values to the Database at once.

*/
export declare function update(ref: Reference, values: object): Promise<void>;
export declare function update(ref: DatabaseReference, values: object): Promise<void>;
/**

@@ -424,12 +424,8 @@ * Gets the most up-to-date result for this query.

/**
* Represents the registration of 1 or more child_xxx events.
*
* Currently, it is always exactly 1 child_xxx event, but the idea is we might
* let you register a group of callbacks together in the future.
* Represents the registration of a child_x event.
*/
export declare class ChildEventRegistration implements EventRegistration {
private callbacks;
constructor(callbacks: {
[child: string]: CallbackContext;
} | null);
private eventType;
private callbackContext;
constructor(eventType: string, callbackContext: CallbackContext | null);
respondsTo(eventType: string): boolean;

@@ -436,0 +432,0 @@ createCancelEvent(error: Error, path: Path): CancelEvent | null;

@@ -28,3 +28,3 @@ import { Repo } from '../core/Repo';

*
* Just as with a `Reference`, you can receive data from a `Query` by using the
* Just as with a `DatabaseReference`, you can receive data from a `Query` by using the
* `on*()` methods. You will only receive events and `DataSnapshot`s for the

@@ -37,4 +37,4 @@ * subset of the data that matches your query.

export interface Query extends QueryContext {
/** The `Reference` for the `Query`'s location. */
readonly ref: Reference;
/** The `DatabaseReference` for the `Query`'s location. */
readonly ref: DatabaseReference;
/**

@@ -45,3 +45,3 @@ * Returns whether or not the current and provided queries represent the same

*
* Two `Reference` objects are equivalent if they represent the same location
* Two `DatabaseReference` objects are equivalent if they represent the same location
* and are from the same instance of `FirebaseApp`.

@@ -80,3 +80,3 @@ *

/**
* A `Reference` represents a specific location in your Database and can be used
* A `DatabaseReference` represents a specific location in your Database and can be used
* for reading or writing data to that Database location.

@@ -91,5 +91,5 @@ *

*/
export interface Reference extends Query {
export interface DatabaseReference extends Query {
/**
* The last part of the `Reference`'s path.
* The last part of the `DatabaseReference`'s path.
*

@@ -99,20 +99,20 @@ * For example, `"ada"` is the key for

*
* The key of a root `Reference` is `null`.
* The key of a root `DatabaseReference` is `null`.
*/
readonly key: string | null;
/**
* The parent location of a `Reference`.
* The parent location of a `DatabaseReference`.
*
* The parent of a root `Reference` is `null`.
* The parent of a root `DatabaseReference` is `null`.
*/
readonly parent: Reference | null;
/** The root `Reference` of the Database. */
readonly root: Reference;
readonly parent: DatabaseReference | null;
/** The root `DatabaseReference` of the Database. */
readonly root: DatabaseReference;
}
/**
* A `Promise` that can also act as a `Reference` when returned by
* A `Promise` that can also act as a `DatabaseReference` when returned by
* {@link push}. The reference is available immediately and the Promise resolves
* as the write to the backend completes.
*/
export interface ThenableReference extends Reference, Pick<Promise<Reference>, 'then' | 'catch'> {
export interface ThenableReference extends DatabaseReference, Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
}

@@ -127,3 +127,3 @@ /** A callback that can invoked to remove a listener. */

export interface ReferenceConstructor {
new (repo: Repo, path: Path): Reference;
new (repo: Repo, path: Path): DatabaseReference;
}

@@ -17,3 +17,3 @@ /**

*/
import { Reference } from './Reference';
import { DatabaseReference } from './Reference';
import { DataSnapshot } from './Reference_impl';

@@ -84,2 +84,2 @@ /** An options object to configure transactions. */

*/
export declare function runTransaction(ref: Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
export declare function runTransaction(ref: DatabaseReference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;

@@ -40,2 +40,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
transportSessionId?: string;

@@ -59,11 +61,13 @@ lastSessionId?: string;

/**
* @param connId - An identifier for this connection, used for logging
* @param repoInfo - The info for the endpoint to send data to.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionid if we are reconnecting for an existing
* transport session
* @param lastSessionId - Optional lastSessionId if the PersistentConnection has already created a
* connection previously
* @param connId An identifier for this connection, used for logging
* @param repoInfo The info for the endpoint to send data to.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The AppCheck token for this client.
* @param authToken The AuthToken to use for this connection.
* @param transportSessionId Optional transportSessionid if we are
* reconnecting for an existing transport session
* @param lastSessionId Optional lastSessionId if the PersistentConnection has
* already created a connection previously
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -70,0 +74,0 @@ * @param onMessage - Callback when messages arrive

@@ -26,2 +26,4 @@ /**

private applicationId_;
private appCheckToken_;
private authToken_;
private onMessage_;

@@ -50,2 +52,4 @@ private onReady_;

* @param applicationId_ - the Firebase App ID for this project
* @param appCheckToken_ - The App Check Token for this device.
* @param authToken_ - The auth token for this session.
* @param onMessage_ - the callback to be triggered when a server-push message arrives

@@ -57,3 +61,3 @@ * @param onReady_ - the callback to be triggered when this connection is ready to send messages.

*/
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, appCheckToken_: string | undefined, authToken_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
/**

@@ -60,0 +64,0 @@ * Starts a connection attempt

@@ -25,3 +25,4 @@ /**

export declare const APPLICATION_ID_PARAM = "p";
export declare const APP_CHECK_TOKEN_PARAM = "ac";
export declare const WEBSOCKET = "websocket";
export declare const LONG_POLLING = "long_polling";

@@ -19,3 +19,3 @@ /**

export interface TransportConstructor {
new (connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string): Transport;
new (connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string): Transport;
isAvailable: () => boolean;

@@ -22,0 +22,0 @@ responsesRequiredToBeHealthy?: number;

@@ -26,2 +26,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
keepaliveTimer: number | null;

@@ -42,10 +44,13 @@ frames: string[] | null;

/**
* @param connId - identifier for this transport
* @param repoInfo - The info for the websocket endpoint.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionId if this is connecting to an existing transport
* session
* @param lastSessionId - Optional lastSessionId if there was a previous connection
* @param connId identifier for this transport
* @param repoInfo The info for the websocket endpoint.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The App Check Token for this client.
* @param authToken The Auth Token for this client.
* @param transportSessionId Optional transportSessionId if this is connecting
* to an existing transport session
* @param lastSessionId Optional lastSessionId if there was a previous
* connection
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -52,0 +57,0 @@ * @param repoInfo - The info for the websocket endpoint.

@@ -19,2 +19,3 @@ /**

waitsForCount: (maxCount: any) => EventAccumulator;
waitsForExactCount: (maxCount: any) => EventAccumulator;
};

@@ -21,0 +22,0 @@ export declare class EventAccumulator {

@@ -17,4 +17,4 @@ /**

*/
export { FirebaseDatabase, enableLogging, getDatabase, goOffline, goOnline, useDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, Reference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { Database, enableLogging, getDatabase, goOffline, goOnline, connectDatabaseEmulator, repoManagerDatabaseFromApp as _repoManagerDatabaseFromApp } from '../src/exp/Database';
export { Query, DatabaseReference, ListenOptions, Unsubscribe, ThenableReference } from '../src/exp/Reference';
export { OnDisconnect } from '../src/exp/OnDisconnect';

@@ -21,0 +21,0 @@ export { DataSnapshot, EventType, QueryConstraint, QueryConstraintType, endAt, endBefore, equalTo, get, limitToFirst, limitToLast, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, push, query, ref, refFromURL, remove, set, setPriority, setWithPriority, startAfter, startAt, update, child, ReferenceImpl as _ReferenceImpl, QueryImpl as _QueryImpl } from '../src/exp/Reference_impl';

@@ -1,23 +0,7 @@

/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseDatabase } from '../src/exp/Database';
import { Database } from '../src/exp/Database';
declare module '@firebase/component' {
interface NameServiceMapping {
'database-exp': FirebaseDatabase;
'database-exp': Database;
}
}
export declare function registerDatabase(variant?: string): void;

@@ -21,3 +21,3 @@ /**

import { Query, Reference } from './src/api/Reference';
import { enableLogging } from './src/exp/Database';
import { enableLogging } from './src/core/util/util';
declare const ServerValue: {

@@ -24,0 +24,0 @@ TIMESTAMP: object;

@@ -19,6 +19,10 @@ /**

import { FirebaseService } from '@firebase/app-types/private';
import { Compat } from '@firebase/util';
import { FirebaseDatabase as ExpDatabase } from "@firebase/database";
import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
import { Reference } from './Reference';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDatabase = any;
/**
* Class representing a firebase database.

@@ -38,3 +42,3 @@ */

INTERNAL: {
delete: () => Promise<void>;
delete: () => any;
};

@@ -48,4 +52,7 @@ /**

* @param port - the emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
useEmulator(host: string, port: number): void;
useEmulator(host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -73,1 +80,2 @@ * Returns a reference to the root or to the path specified in the provided

}
export {};

@@ -18,4 +18,8 @@ /**

import { Compat } from '@firebase/util';
import { OnDisconnect as ExpOnDisconnect } from "@firebase/database";
import { Indexable } from '../core/util/misc';
/**
* This is a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpOnDisconnect = any;
export declare class OnDisconnect implements Compat<ExpOnDisconnect> {

@@ -30,1 +34,2 @@ readonly _delegate: ExpOnDisconnect;

}
export {};

@@ -18,3 +18,2 @@ /**

import { Compat } from '@firebase/util';
import { DataSnapshot as ExpDataSnapshot, Query as ExpQuery, Reference as ExpReference } from "@firebase/database";
import { Database } from './Database';

@@ -24,2 +23,9 @@ import { OnDisconnect } from './onDisconnect';

/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type ExpDataSnapshot = any;
declare type ExpQuery = any;
declare type ExpReference = any;
/**
* Class representing a firebase data snapshot. It wraps a SnapshotNode and

@@ -86,3 +92,3 @@ * surfaces the public methods (val, forEach, etc.) we want to expose.

hasChildren(): boolean;
get key(): string;
get key(): any;
/**

@@ -160,3 +166,3 @@ * Returns the number of children for this DataSnapshot.

toString(): string;
toJSON(): string;
toJSON(): any;
/**

@@ -206,1 +212,2 @@ * Return true if this query and the provided query are equivalent; otherwise, return false.

}
export {};

@@ -25,3 +25,3 @@ /**

export declare const ConnectionTarget: typeof RepoInfo;
export declare const queryIdentifier: (query: Query) => string;
export declare const queryIdentifier: (query: Query) => any;
/**

@@ -28,0 +28,0 @@ * Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.

@@ -40,4 +40,7 @@ /**

}
export declare class EmulatorAdminTokenProvider implements AuthTokenProvider {
private static EMULATOR_AUTH_TOKEN;
export declare class EmulatorTokenProvider implements AuthTokenProvider {
private accessToken;
/** A string that is treated as an admin access token by the RTDB emulator. Used by Admin SDK. */
static OWNER: string;
constructor(accessToken: string);
getToken(forceRefresh: boolean): Promise<FirebaseAuthTokenData>;

@@ -44,0 +47,0 @@ addTokenChangeListener(listener: (token: string | null) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -35,2 +36,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
private authOverride_?;

@@ -57,4 +59,6 @@ id: number;

private authToken_;
private appCheckToken_;
private forceTokenRefresh_;
private invalidAuthTokenCount_;
private invalidAppCheckTokenCount_;
private firstConnection_;

@@ -73,3 +77,3 @@ private lastConnectionAttemptTime_;

*/
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, authOverride_?: object | null);
constructor(repoInfo_: RepoInfo, applicationId_: string, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, onConnectStatus_: (a: boolean) => void, onServerInfoUpdate_: (a: unknown) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider, authOverride_?: object | null);
protected sendRequest(action: string, body: unknown, onResponse?: (a: unknown) => void): void;

@@ -83,2 +87,3 @@ get(query: QueryContext): Promise<string>;

private reduceReconnectDelayIfAdminCredential_;
refreshAppCheckToken(token: string | null): void;
/**

@@ -89,2 +94,11 @@ * Attempts to authenticate with the given credentials. If the authentication attempt fails, it's triggered like

tryAuth(): void;
/**
* Attempts to authenticate with the given token. If the authentication
* attempt fails, it's triggered like the token was revoked (the connection is
* closed).
*/
tryAppCheck(): void;
/**
* @inheritDoc
*/
unlisten(query: QueryContext, tag: number | null): void;

@@ -107,2 +121,3 @@ private sendUnlisten_;

private scheduleConnect_;
private initConnection_;
private onVisible_;

@@ -119,2 +134,3 @@ private onOnline_;

private onAuthRevoked_;
private onAppCheckRevoked_;
private onSecurityDebugPacket_;

@@ -121,0 +137,0 @@ private restoreState_;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -31,2 +32,3 @@ import { RepoInfo } from './RepoInfo';

private authTokenProvider_;
private appCheckTokenProvider_;
reportStats(stats: {

@@ -47,3 +49,3 @@ [k: string]: unknown;

*/
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, onDataUpdate_: (a: string, b: unknown, c: boolean, d: number | null) => void, authTokenProvider_: AuthTokenProvider, appCheckTokenProvider_: AppCheckTokenProvider);
/** @inheritDoc */

@@ -50,0 +52,0 @@ listen(query: QueryContext, currentHashFn: () => string, tag: number | null, onComplete: (a: string, b: unknown) => void): void;

@@ -17,2 +17,3 @@ /**

*/
import { AppCheckTokenProvider } from './AppCheckTokenProvider';
import { AuthTokenProvider } from './AuthTokenProvider';

@@ -63,2 +64,3 @@ import { PersistentConnection } from './PersistentConnection';

authTokenProvider_: AuthTokenProvider;
appCheckProvider_: AppCheckTokenProvider;
/** Key for uniquely identifying this repo, used in RepoManager */

@@ -82,3 +84,3 @@ readonly key: string;

persistentConnection_: PersistentConnection | null;
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider);
constructor(repoInfo_: RepoInfo, forceRestClient_: boolean, authTokenProvider_: AuthTokenProvider, appCheckProvider_: AppCheckTokenProvider);
/**

@@ -85,0 +87,0 @@ * @returns The URL corresponding to the root of this Firebase.

@@ -41,2 +41,7 @@ /**

refreshAuthToken(token: string): void;
/**
* Refreshes the app check token for the current connection.
* @param token The app check token
*/
refreshAppCheckToken(token: string): void;
onDisconnectPut(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -43,0 +48,0 @@ onDisconnectMerge(pathString: string, data: unknown, onComplete?: (a: string, b: string) => void): void;

@@ -17,4 +17,8 @@ /**

*/
import { QueryContext } from '../view/EventRegistration';
/**
* This is part of a workaround for an issue in the no-modular '@firebase/database' where its typings
* reference types from `@firebase/app-exp`.
*/
declare type QueryContext = any;
/**
* Returns a locally-unique ID (generated by just incrementing up from 0 each time its called).

@@ -178,1 +182,2 @@ */

export declare const setTimeoutNonBlocking: (fn: () => void, time: number) => number | object;
export {};

@@ -17,5 +17,7 @@ /**

*/
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { _FirebaseService, FirebaseApp } from '@firebase/app-exp';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { Provider } from '@firebase/component';
import { EmulatorMockTokenOptions } from '@firebase/util';
import { Repo } from '../core/Repo';

@@ -27,3 +29,3 @@ import { ReferenceImpl } from './Reference_impl';

*/
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, url?: string, nodeAdmin?: boolean): FirebaseDatabase;
export declare function repoManagerDatabaseFromApp(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, appCheckProvider?: Provider<AppCheckInternalComponentName>, url?: string, nodeAdmin?: boolean): Database;
/**

@@ -36,4 +38,4 @@ * Forces us to use ReadonlyRestClient instead of PersistentConnection for new Repos.

*/
export declare class FirebaseDatabase implements _FirebaseService {
private _repoInternal;
export declare class Database implements _FirebaseService {
_repoInternal: Repo;
/** The FirebaseApp associated with this Realtime Database instance. */

@@ -68,3 +70,3 @@ readonly app: FirebaseApp;

*/
export declare function getDatabase(app?: FirebaseApp, url?: string): FirebaseDatabase;
export declare function getDatabase(app?: FirebaseApp, url?: string): Database;
/**

@@ -79,4 +81,7 @@ * Modify the provided instance to communicate with the Realtime Database

* @param port - The emulator port (ex: 8080)
* @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
*/
export declare function useDatabaseEmulator(db: FirebaseDatabase, host: string, port: number): void;
export declare function connectDatabaseEmulator(db: Database, host: string, port: number, options?: {
mockUserToken?: EmulatorMockTokenOptions;
}): void;
/**

@@ -103,3 +108,3 @@ * Disconnects from the server (all Database operations will be completed

*/
export declare function goOffline(db: FirebaseDatabase): void;
export declare function goOffline(db: Database): void;
/**

@@ -116,3 +121,3 @@ * Reconnects to the server and synchronizes the offline Database state

*/
export declare function goOnline(db: FirebaseDatabase): void;
export declare function goOnline(db: Database): void;
/**

@@ -119,0 +124,0 @@ * Logs debugging information to the console.

@@ -25,5 +25,5 @@ /**

import { QueryParams } from '../core/view/QueryParams';
import { FirebaseDatabase } from './Database';
import { Database } from './Database';
import { OnDisconnect } from './OnDisconnect';
import { ListenOptions, Query as Query, Reference as Reference, Unsubscribe, ThenableReference } from './Reference';
import { ListenOptions, Query as Query, DatabaseReference, Unsubscribe, ThenableReference } from './Reference';
/**

@@ -42,3 +42,3 @@ * @internal

get key(): string | null;
get ref(): Reference;
get ref(): DatabaseReference;
get _queryIdentifier(): string;

@@ -56,3 +56,3 @@ /**

*/
export declare class ReferenceImpl extends QueryImpl implements Reference {
export declare class ReferenceImpl extends QueryImpl implements DatabaseReference {
/** @hideconstructor */

@@ -82,3 +82,3 @@ constructor(repo: Repo, path: Path);

*/
readonly ref: Reference;
readonly ref: DatabaseReference;
readonly _index: Index;

@@ -95,3 +95,3 @@ /**

*/
ref: Reference, _index: Index);
ref: DatabaseReference, _index: Index);
/**

@@ -217,3 +217,3 @@ * Gets the priority value of the data in this `DataSnapshot`.

*/
export declare function ref(db: FirebaseDatabase, path?: string): Reference;
export declare function ref(db: Database, path?: string): DatabaseReference;
/**

@@ -235,3 +235,3 @@ * Returns a `Reference` representing the location in the Database

*/
export declare function refFromURL(db: FirebaseDatabase, url: string): Reference;
export declare function refFromURL(db: Database, url: string): DatabaseReference;
/**

@@ -248,3 +248,3 @@ * Gets a `Reference` for the location at the specified relative path.

*/
export declare function child(parent: Reference, path: string): Reference;
export declare function child(parent: DatabaseReference, path: string): DatabaseReference;
/**

@@ -257,3 +257,3 @@ * Returns an `OnDisconnect` object - see

*/
export declare function onDisconnect(ref: Reference): OnDisconnect;
export declare function onDisconnect(ref: DatabaseReference): OnDisconnect;
export interface ThenableReferenceImpl extends ReferenceImpl, Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {

@@ -284,3 +284,3 @@ }

*/
export declare function push(parent: Reference, value?: unknown): ThenableReference;
export declare function push(parent: DatabaseReference, value?: unknown): ThenableReference;
/**

@@ -300,3 +300,3 @@ * Removes the data at this Database location.

*/
export declare function remove(ref: Reference): Promise<void>;
export declare function remove(ref: DatabaseReference): Promise<void>;
/**

@@ -331,3 +331,3 @@ * Writes data to this Database location.

*/
export declare function set(ref: Reference, value: unknown): Promise<void>;
export declare function set(ref: DatabaseReference, value: unknown): Promise<void>;
/**

@@ -345,3 +345,3 @@ * Sets a priority for the data at this Database location.

*/
export declare function setPriority(ref: Reference, priority: string | number | null): Promise<void>;
export declare function setPriority(ref: DatabaseReference, priority: string | number | null): Promise<void>;
/**

@@ -362,3 +362,3 @@ * Writes data the Database location. Like `set()` but also specifies the

*/
export declare function setWithPriority(ref: Reference, value: unknown, priority: string | number | null): Promise<void>;
export declare function setWithPriority(ref: DatabaseReference, value: unknown, priority: string | number | null): Promise<void>;
/**

@@ -399,3 +399,3 @@ * Writes multiple values to the Database at once.

*/
export declare function update(ref: Reference, values: object): Promise<void>;
export declare function update(ref: DatabaseReference, values: object): Promise<void>;
/**

@@ -424,12 +424,8 @@ * Gets the most up-to-date result for this query.

/**
* Represents the registration of 1 or more child_xxx events.
*
* Currently, it is always exactly 1 child_xxx event, but the idea is we might
* let you register a group of callbacks together in the future.
* Represents the registration of a child_x event.
*/
export declare class ChildEventRegistration implements EventRegistration {
private callbacks;
constructor(callbacks: {
[child: string]: CallbackContext;
} | null);
private eventType;
private callbackContext;
constructor(eventType: string, callbackContext: CallbackContext | null);
respondsTo(eventType: string): boolean;

@@ -436,0 +432,0 @@ createCancelEvent(error: Error, path: Path): CancelEvent | null;

@@ -28,3 +28,3 @@ import { Repo } from '../core/Repo';

*
* Just as with a `Reference`, you can receive data from a `Query` by using the
* Just as with a `DatabaseReference`, you can receive data from a `Query` by using the
* `on*()` methods. You will only receive events and `DataSnapshot`s for the

@@ -37,4 +37,4 @@ * subset of the data that matches your query.

export interface Query extends QueryContext {
/** The `Reference` for the `Query`'s location. */
readonly ref: Reference;
/** The `DatabaseReference` for the `Query`'s location. */
readonly ref: DatabaseReference;
/**

@@ -45,3 +45,3 @@ * Returns whether or not the current and provided queries represent the same

*
* Two `Reference` objects are equivalent if they represent the same location
* Two `DatabaseReference` objects are equivalent if they represent the same location
* and are from the same instance of `FirebaseApp`.

@@ -80,3 +80,3 @@ *

/**
* A `Reference` represents a specific location in your Database and can be used
* A `DatabaseReference` represents a specific location in your Database and can be used
* for reading or writing data to that Database location.

@@ -91,5 +91,5 @@ *

*/
export interface Reference extends Query {
export interface DatabaseReference extends Query {
/**
* The last part of the `Reference`'s path.
* The last part of the `DatabaseReference`'s path.
*

@@ -99,20 +99,20 @@ * For example, `"ada"` is the key for

*
* The key of a root `Reference` is `null`.
* The key of a root `DatabaseReference` is `null`.
*/
readonly key: string | null;
/**
* The parent location of a `Reference`.
* The parent location of a `DatabaseReference`.
*
* The parent of a root `Reference` is `null`.
* The parent of a root `DatabaseReference` is `null`.
*/
readonly parent: Reference | null;
/** The root `Reference` of the Database. */
readonly root: Reference;
readonly parent: DatabaseReference | null;
/** The root `DatabaseReference` of the Database. */
readonly root: DatabaseReference;
}
/**
* A `Promise` that can also act as a `Reference` when returned by
* A `Promise` that can also act as a `DatabaseReference` when returned by
* {@link push}. The reference is available immediately and the Promise resolves
* as the write to the backend completes.
*/
export interface ThenableReference extends Reference, Pick<Promise<Reference>, 'then' | 'catch'> {
export interface ThenableReference extends DatabaseReference, Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
}

@@ -127,3 +127,3 @@ /** A callback that can invoked to remove a listener. */

export interface ReferenceConstructor {
new (repo: Repo, path: Path): Reference;
new (repo: Repo, path: Path): DatabaseReference;
}

@@ -17,3 +17,3 @@ /**

*/
import { Reference } from './Reference';
import { DatabaseReference } from './Reference';
import { DataSnapshot } from './Reference_impl';

@@ -84,2 +84,2 @@ /** An options object to configure transactions. */

*/
export declare function runTransaction(ref: Reference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;
export declare function runTransaction(ref: DatabaseReference, transactionUpdate: (currentData: any) => unknown, options?: TransactionOptions): Promise<TransactionResult>;

@@ -40,2 +40,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
transportSessionId?: string;

@@ -59,11 +61,13 @@ lastSessionId?: string;

/**
* @param connId - An identifier for this connection, used for logging
* @param repoInfo - The info for the endpoint to send data to.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionid if we are reconnecting for an existing
* transport session
* @param lastSessionId - Optional lastSessionId if the PersistentConnection has already created a
* connection previously
* @param connId An identifier for this connection, used for logging
* @param repoInfo The info for the endpoint to send data to.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The AppCheck token for this client.
* @param authToken The AuthToken to use for this connection.
* @param transportSessionId Optional transportSessionid if we are
* reconnecting for an existing transport session
* @param lastSessionId Optional lastSessionId if the PersistentConnection has
* already created a connection previously
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -70,0 +74,0 @@ * @param onMessage - Callback when messages arrive

@@ -26,2 +26,4 @@ /**

private applicationId_;
private appCheckToken_;
private authToken_;
private onMessage_;

@@ -50,2 +52,4 @@ private onReady_;

* @param applicationId_ - the Firebase App ID for this project
* @param appCheckToken_ - The App Check Token for this device.
* @param authToken_ - The auth token for this session.
* @param onMessage_ - the callback to be triggered when a server-push message arrives

@@ -57,3 +61,3 @@ * @param onReady_ - the callback to be triggered when this connection is ready to send messages.

*/
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, appCheckToken_: string | undefined, authToken_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
/**

@@ -60,0 +64,0 @@ * Starts a connection attempt

@@ -25,3 +25,4 @@ /**

export declare const APPLICATION_ID_PARAM = "p";
export declare const APP_CHECK_TOKEN_PARAM = "ac";
export declare const WEBSOCKET = "websocket";
export declare const LONG_POLLING = "long_polling";

@@ -19,3 +19,3 @@ /**

export interface TransportConstructor {
new (connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string): Transport;
new (connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string): Transport;
isAvailable: () => boolean;

@@ -22,0 +22,0 @@ responsesRequiredToBeHealthy?: number;

@@ -26,2 +26,4 @@ /**

private applicationId?;
private appCheckToken?;
private authToken?;
keepaliveTimer: number | null;

@@ -42,10 +44,13 @@ frames: string[] | null;

/**
* @param connId - identifier for this transport
* @param repoInfo - The info for the websocket endpoint.
* @param applicationId - The Firebase App ID for this project.
* @param transportSessionId - Optional transportSessionId if this is connecting to an existing transport
* session
* @param lastSessionId - Optional lastSessionId if there was a previous connection
* @param connId identifier for this transport
* @param repoInfo The info for the websocket endpoint.
* @param applicationId The Firebase App ID for this project.
* @param appCheckToken The App Check Token for this client.
* @param authToken The Auth Token for this client.
* @param transportSessionId Optional transportSessionId if this is connecting
* to an existing transport session
* @param lastSessionId Optional lastSessionId if there was a previous
* connection
*/
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, transportSessionId?: string, lastSessionId?: string);
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
/**

@@ -52,0 +57,0 @@ * @param repoInfo - The info for the websocket endpoint.

@@ -19,2 +19,3 @@ /**

waitsForCount: (maxCount: any) => EventAccumulator;
waitsForExactCount: (maxCount: any) => EventAccumulator;
};

@@ -21,0 +22,0 @@ export declare class EventAccumulator {

{
"name": "@firebase/database-compat",
"version": "0.0.900-exp.894b5da5a",
"version": "0.0.900-exp.8b4d7550f",
"description": "The Realtime Database component of the Firebase JS SDK.",

@@ -14,14 +14,11 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",

"dependencies": {
"@firebase/database-types": "0.7.2",
"@firebase/database-types": "0.7.3",
"@firebase/logger": "0.2.6",
"@firebase/util": "1.0.0",
"@firebase/component": "0.4.1",
"@firebase/auth-interop-types": "0.1.5",
"@firebase/util": "1.2.0",
"@firebase/component": "0.5.5",
"@firebase/auth-interop-types": "0.1.6",
"faye-websocket": "0.11.3",
"tslib": "^2.1.0",
"@firebase/database": "0.0.900-exp.894b5da5a"
"@firebase/database": "0.0.900-exp.8b4d7550f"
},
"peerDependencies": {
"@firebase/app": "0.x"
},
"files": [

@@ -28,0 +25,0 @@ "dist"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc