Skip to content

Commit c3739f3

Browse files
Remove RepoManager (#4520)
1 parent 636dd78 commit c3739f3

File tree

7 files changed

+148
-180
lines changed

7 files changed

+148
-180
lines changed

packages/database/index.node.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FirebaseNamespace, FirebaseApp } from '@firebase/app-types';
18+
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
1919
import { _FirebaseNamespace } from '@firebase/app-types/private';
2020
import { Database } from './src/api/Database';
2121
import { DataSnapshot } from './src/api/DataSnapshot';
2222
import { Query } from './src/api/Query';
2323
import { Reference } from './src/api/Reference';
2424
import { enableLogging } from './src/core/util/util';
25-
import { RepoManager } from './src/core/RepoManager';
25+
import { repoManagerDatabaseFromApp } from './src/core/RepoManager';
2626
import * as INTERNAL from './src/api/internal';
2727
import * as TEST_ACCESS from './src/api/test_access';
2828
import * as types from '@firebase/database-types';
@@ -90,11 +90,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
9090
const app = container.getProvider('app').getImmediate();
9191
const authProvider = container.getProvider('auth-internal');
9292

93-
return RepoManager.getInstance().databaseFromApp(
94-
app,
95-
authProvider,
96-
url
97-
);
93+
return repoManagerDatabaseFromApp(app, authProvider, url, undefined);
9894
},
9995
ComponentType.PUBLIC
10096
)

packages/database/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { DataSnapshot } from './src/api/DataSnapshot';
2424
import { Query } from './src/api/Query';
2525
import { Reference } from './src/api/Reference';
2626
import { enableLogging } from './src/core/util/util';
27-
import { RepoManager } from './src/core/RepoManager';
27+
import { repoManagerDatabaseFromApp } from './src/core/RepoManager';
2828
import * as INTERNAL from './src/api/internal';
2929
import * as TEST_ACCESS from './src/api/test_access';
3030
import { isNodeSdk } from '@firebase/util';
@@ -50,11 +50,7 @@ export function registerDatabase(instance: FirebaseNamespace) {
5050
const app = container.getProvider('app').getImmediate();
5151
const authProvider = container.getProvider('auth-internal');
5252

53-
return RepoManager.getInstance().databaseFromApp(
54-
app,
55-
authProvider,
56-
url
57-
);
53+
return repoManagerDatabaseFromApp(app, authProvider, url, undefined);
5854
},
5955
ComponentType.PUBLIC
6056
)

packages/database/src/api/Database.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import { parseRepoInfo } from '../core/util/libs/parser';
2020
import { newEmptyPath } from '../core/util/Path';
2121
import { Reference } from './Reference';
2222
import { Repo, repoInterrupt, repoResume, repoStart } from '../core/Repo';
23-
import { RepoManager } from '../core/RepoManager';
23+
import {
24+
repoManagerApplyEmulatorSettings,
25+
repoManagerDeleteRepo
26+
} from '../core/RepoManager';
2427
import { validateArgCount } from '@firebase/util';
2528
import { validateUrl } from '../core/util/validation';
2629
import { FirebaseApp } from '@firebase/app-types';
@@ -63,7 +66,7 @@ export class Database implements FirebaseService {
6366
INTERNAL = {
6467
delete: async () => {
6568
this.checkDeleted_('delete');
66-
RepoManager.getInstance().deleteRepo(this.repo_);
69+
repoManagerDeleteRepo(this.repo_);
6770
this.repoInternal_ = null;
6871
this.rootInternal_ = null;
6972
}
@@ -107,11 +110,7 @@ export class Database implements FirebaseService {
107110
}
108111

109112
// Modify the repo to apply emulator settings
110-
RepoManager.getInstance().applyEmulatorSettings(
111-
this.repoInternal_,
112-
host,
113-
port
114-
);
113+
repoManagerApplyEmulatorSettings(this.repoInternal_, host, port);
115114
}
116115

117116
/**

packages/database/src/api/internal.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { WebSocketConnection } from '../realtime/WebSocketConnection';
1919
import { BrowserPollConnection } from '../realtime/BrowserPollConnection';
2020
import { Reference } from './Reference';
21-
import { RepoManager } from '../core/RepoManager';
21+
import { repoManagerDatabaseFromApp } from '../core/RepoManager';
2222
import { setSDKVersion } from '../core/version';
2323
import { FirebaseApp } from '@firebase/app-types';
2424
import {
@@ -27,10 +27,10 @@ import {
2727
} from '@firebase/auth-interop-types';
2828
import * as types from '@firebase/database-types';
2929
import {
30-
Provider,
31-
ComponentContainer,
3230
Component,
33-
ComponentType
31+
ComponentContainer,
32+
ComponentType,
33+
Provider
3434
} from '@firebase/component';
3535
import {
3636
repoInterceptServerData,
@@ -127,7 +127,7 @@ export function initStandalone<T>({
127127
);
128128

129129
return {
130-
instance: RepoManager.getInstance().databaseFromApp(
130+
instance: repoManagerDatabaseFromApp(
131131
app,
132132
authProvider,
133133
url,

packages/database/src/api/test_access.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import { RepoInfo } from '../core/RepoInfo';
1919
import { PersistentConnection } from '../core/PersistentConnection';
20-
import { RepoManager } from '../core/RepoManager';
20+
import { repoManagerForceRestClient } from '../core/RepoManager';
2121
import { Connection } from '../realtime/Connection';
2222
import { Query } from './Query';
2323

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

0 commit comments

Comments
 (0)