Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/proud-trainers-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/data-connect": patch
---

Removed exposed internal DataConnect constructor.
12 changes: 1 addition & 11 deletions common/api-review/data-connect.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

```ts

import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
import { FirebaseApp } from '@firebase/app';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { FirebaseError } from '@firebase/util';
import { LogLevelString } from '@firebase/logger';
import { Provider } from '@firebase/component';

// @public
export type CallerSdkType = 'Base' | 'Generated' | 'TanstackReactCore' | 'GeneratedReact' | 'TanstackAngularCore' | 'GeneratedAngular';
Expand Down Expand Up @@ -53,7 +50,6 @@ export interface ConnectorConfig {

// @public
export class DataConnect {
constructor(app: FirebaseApp, dataConnectOptions: DataConnectOptions, _authProvider: Provider<FirebaseAuthInternalName>, _appCheckProvider: Provider<AppCheckInternalComponentName>);
// (undocumented)
readonly app: FirebaseApp;
// (undocumented)
Expand Down Expand Up @@ -97,12 +93,6 @@ export interface DataConnectOperationFailureResponseErrorInfo {
readonly path: Array<string | number>;
}

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

// @public (undocumented)
export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
// (undocumented)
Expand Down Expand Up @@ -216,7 +206,7 @@ export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
// @public
export interface RefInfo<Variables> {
// (undocumented)
connectorConfig: DataConnectOptions;
connectorConfig: ConnectorConfig;
// (undocumented)
name: string;
// (undocumented)
Expand Down
5 changes: 4 additions & 1 deletion packages/data-connect/src/api/DataConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ export class DataConnect {
_isUsingGeneratedSdk: boolean = false;
_callerSdkType: CallerSdkType = CallerSdkTypeEnum.Base;
private _appCheckTokenProvider?: AppCheckTokenProvider;
// @internal
/**
* @hideconstructor
* @internal
*/
constructor(
public readonly app: FirebaseApp,
// TODO(mtewani): Replace with _dataConnectOptions in the future
Expand Down
4 changes: 2 additions & 2 deletions packages/data-connect/src/api/Reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { DataConnect, DataConnectOptions } from './DataConnect';
import { ConnectorConfig, DataConnect } from './DataConnect';
export const QUERY_STR = 'query';
export const MUTATION_STR = 'mutation';
export type ReferenceType = typeof QUERY_STR | typeof MUTATION_STR;
Expand Down Expand Up @@ -48,7 +48,7 @@ export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
export interface RefInfo<Variables> {
name: string;
variables: Variables;
connectorConfig: DataConnectOptions;
connectorConfig: ConnectorConfig;
}
/**
* Serialized Ref as a result of `QueryResult.toJSON()`
Expand Down
12 changes: 11 additions & 1 deletion packages/data-connect/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
*/

export * from '../network';
export * from './DataConnect';
export {
ConnectorConfig,
DataConnect,
TransportOptions,
areTransportOptionsEqual,
connectDataConnectEmulator,
getDataConnect,
parseOptions,
terminate,
validateDCOptions
} from './DataConnect';
export * from './Reference';
export * from './Mutation';
export * from './query';
Expand Down
1 change: 0 additions & 1 deletion packages/data-connect/src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ function getRefSerializer<Data, Variables>(
name: queryRef.name,
variables: queryRef.variables,
connectorConfig: {
projectId: queryRef.dataConnect.app.options.projectId!,
...queryRef.dataConnect.getSettings()
}
},
Expand Down
5 changes: 2 additions & 3 deletions packages/data-connect/test/queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
terminate
} from '../src';

import { getConnectionConfig, initDatabase, PROJECT_ID } from './util';
import { getConnectionConfig, initDatabase } from './util';

use(chaiAsPromised);

Expand Down Expand Up @@ -146,8 +146,7 @@ describe('DataConnect Tests', async () => {
fetchTime: Date.now().toLocaleString(),
refInfo: {
connectorConfig: {
...getConnectionConfig(),
projectId: PROJECT_ID
...getConnectionConfig()
},
name: taskListQuery.name,
variables: { testId: TEST_ID }
Expand Down
3 changes: 2 additions & 1 deletion packages/data-connect/test/unit/queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import chaiAsPromised from 'chai-as-promised';
import * as sinon from 'sinon';
import sinonChai from 'sinon-chai';

import { DataConnectOptions, QueryRef, queryRef, subscribe } from '../../src';
import { QueryRef, queryRef, subscribe } from '../../src';
import { DataConnectOptions } from '../../src/api/DataConnect';
import {
AuthTokenListener,
AuthTokenProvider
Expand Down
Loading