Skip to content

Remove RepoManager #4520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 3 additions & 7 deletions packages/database/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

import { FirebaseNamespace, FirebaseApp } from '@firebase/app-types';
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
import { _FirebaseNamespace } from '@firebase/app-types/private';
import { Database } from './src/api/Database';
import { DataSnapshot } from './src/api/DataSnapshot';
import { Query } from './src/api/Query';
import { Reference } from './src/api/Reference';
import { enableLogging } from './src/core/util/util';
import { RepoManager } from './src/core/RepoManager';
import { repoManagerDatabaseFromApp } from './src/core/RepoManager';
import * as INTERNAL from './src/api/internal';
import * as TEST_ACCESS from './src/api/test_access';
import * as types from '@firebase/database-types';
Expand Down Expand Up @@ -90,11 +90,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
const app = container.getProvider('app').getImmediate();
const authProvider = container.getProvider('auth-internal');

return RepoManager.getInstance().databaseFromApp(
app,
authProvider,
url
);
return repoManagerDatabaseFromApp(app, authProvider, url, undefined);
},
ComponentType.PUBLIC
)
Expand Down
8 changes: 2 additions & 6 deletions packages/database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { DataSnapshot } from './src/api/DataSnapshot';
import { Query } from './src/api/Query';
import { Reference } from './src/api/Reference';
import { enableLogging } from './src/core/util/util';
import { RepoManager } from './src/core/RepoManager';
import { repoManagerDatabaseFromApp } from './src/core/RepoManager';
import * as INTERNAL from './src/api/internal';
import * as TEST_ACCESS from './src/api/test_access';
import { isNodeSdk } from '@firebase/util';
Expand All @@ -50,11 +50,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
const app = container.getProvider('app').getImmediate();
const authProvider = container.getProvider('auth-internal');

return RepoManager.getInstance().databaseFromApp(
app,
authProvider,
url
);
return repoManagerDatabaseFromApp(app, authProvider, url, undefined);
},
ComponentType.PUBLIC
)
Expand Down
13 changes: 6 additions & 7 deletions packages/database/src/api/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { parseRepoInfo } from '../core/util/libs/parser';
import { newEmptyPath } from '../core/util/Path';
import { Reference } from './Reference';
import { Repo, repoInterrupt, repoResume, repoStart } from '../core/Repo';
import { RepoManager } from '../core/RepoManager';
import {
repoManagerApplyEmulatorSettings,
repoManagerDeleteRepo
} from '../core/RepoManager';
import { validateArgCount } from '@firebase/util';
import { validateUrl } from '../core/util/validation';
import { FirebaseApp } from '@firebase/app-types';
Expand Down Expand Up @@ -63,7 +66,7 @@ export class Database implements FirebaseService {
INTERNAL = {
delete: async () => {
this.checkDeleted_('delete');
RepoManager.getInstance().deleteRepo(this.repo_);
repoManagerDeleteRepo(this.repo_);
this.repoInternal_ = null;
this.rootInternal_ = null;
}
Expand Down Expand Up @@ -107,11 +110,7 @@ export class Database implements FirebaseService {
}

// Modify the repo to apply emulator settings
RepoManager.getInstance().applyEmulatorSettings(
this.repoInternal_,
host,
port
);
repoManagerApplyEmulatorSettings(this.repoInternal_, host, port);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions packages/database/src/api/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { WebSocketConnection } from '../realtime/WebSocketConnection';
import { BrowserPollConnection } from '../realtime/BrowserPollConnection';
import { Reference } from './Reference';
import { RepoManager } from '../core/RepoManager';
import { repoManagerDatabaseFromApp } from '../core/RepoManager';
import { setSDKVersion } from '../core/version';
import { FirebaseApp } from '@firebase/app-types';
import {
Expand All @@ -27,10 +27,10 @@ import {
} from '@firebase/auth-interop-types';
import * as types from '@firebase/database-types';
import {
Provider,
ComponentContainer,
Component,
ComponentType
ComponentContainer,
ComponentType,
Provider
} from '@firebase/component';
import {
repoInterceptServerData,
Expand Down Expand Up @@ -127,7 +127,7 @@ export function initStandalone<T>({
);

return {
instance: RepoManager.getInstance().databaseFromApp(
instance: repoManagerDatabaseFromApp(
app,
authProvider,
url,
Expand Down
4 changes: 2 additions & 2 deletions packages/database/src/api/test_access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { RepoInfo } from '../core/RepoInfo';
import { PersistentConnection } from '../core/PersistentConnection';
import { RepoManager } from '../core/RepoManager';
import { repoManagerForceRestClient } from '../core/RepoManager';
import { Connection } from '../realtime/Connection';
import { Query } from './Query';

Expand Down Expand Up @@ -70,5 +70,5 @@ export const queryIdentifier = function (query: Query) {
* Forces the RepoManager to create Repos that use ReadonlyRestClient instead of PersistentConnection.
*/
export const forceRestClient = function (forceRestClient: boolean) {
RepoManager.getInstance().forceRestClient(forceRestClient);
repoManagerForceRestClient(forceRestClient);
};
Loading