Skip to content

Commit 78c71fc

Browse files
committed
Fix build
1 parent a5b8fe6 commit 78c71fc

File tree

23 files changed

+552
-179
lines changed

23 files changed

+552
-179
lines changed

e2e/data-connect/dataconnect-generated/js/default-connector/esm/index.esm.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
import { queryRef, executeQuery, mutationRef, executeMutation, validateArgs } from 'firebase/data-connect';
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import {
19+
queryRef,
20+
executeQuery,
21+
mutationRef,
22+
executeMutation,
23+
validateArgs
24+
} from 'firebase/data-connect';
225

326
export const connectorConfig = {
427
connector: 'default',
@@ -7,24 +30,28 @@ export const connectorConfig = {
730
};
831

932
export const createMovieRef = (dcOrVars, vars) => {
10-
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
33+
const { dc: dcInstance, vars: inputVars } = validateArgs(
34+
connectorConfig,
35+
dcOrVars,
36+
vars,
37+
true
38+
);
1139
dcInstance._useGeneratedSdk();
1240
return mutationRef(dcInstance, 'CreateMovie', inputVars);
13-
}
41+
};
1442
createMovieRef.operationName = 'CreateMovie';
1543

1644
export function createMovie(dcOrVars, vars) {
1745
return executeMutation(createMovieRef(dcOrVars, vars));
1846
}
1947

20-
export const listMoviesRef = (dc) => {
21-
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
48+
export const listMoviesRef = dc => {
49+
const { dc: dcInstance } = validateArgs(connectorConfig, dc, undefined);
2250
dcInstance._useGeneratedSdk();
2351
return queryRef(dcInstance, 'ListMovies');
24-
}
52+
};
2553
listMoviesRef.operationName = 'ListMovies';
2654

2755
export function listMovies(dc) {
2856
return executeQuery(listMoviesRef(dc));
2957
}
30-

e2e/data-connect/dataconnect-generated/js/default-connector/index.cjs.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
const { queryRef, executeQuery, mutationRef, executeMutation, validateArgs } = require('firebase/data-connect');
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const {
19+
queryRef,
20+
executeQuery,
21+
mutationRef,
22+
executeMutation,
23+
validateArgs
24+
} = require('firebase/data-connect');
225

326
const connectorConfig = {
427
connector: 'default',
@@ -8,22 +31,27 @@ const connectorConfig = {
831
exports.connectorConfig = connectorConfig;
932

1033
const createMovieRef = (dcOrVars, vars) => {
11-
const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true);
34+
const { dc: dcInstance, vars: inputVars } = validateArgs(
35+
connectorConfig,
36+
dcOrVars,
37+
vars,
38+
true
39+
);
1240
dcInstance._useGeneratedSdk();
1341
return mutationRef(dcInstance, 'CreateMovie', inputVars);
14-
}
42+
};
1543
createMovieRef.operationName = 'CreateMovie';
1644
exports.createMovieRef = createMovieRef;
1745

1846
exports.createMovie = function createMovie(dcOrVars, vars) {
1947
return executeMutation(createMovieRef(dcOrVars, vars));
2048
};
2149

22-
const listMoviesRef = (dc) => {
23-
const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined);
50+
const listMoviesRef = dc => {
51+
const { dc: dcInstance } = validateArgs(connectorConfig, dc, undefined);
2452
dcInstance._useGeneratedSdk();
2553
return queryRef(dcInstance, 'ListMovies');
26-
}
54+
};
2755
listMoviesRef.operationName = 'ListMovies';
2856
exports.listMoviesRef = listMoviesRef;
2957

e2e/data-connect/dataconnect-generated/js/default-connector/index.d.ts

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
import { ConnectorConfig, DataConnect, QueryRef, QueryPromise, MutationRef, MutationPromise } from 'firebase/data-connect';
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import {
19+
ConnectorConfig,
20+
DataConnect,
21+
QueryRef,
22+
QueryPromise,
23+
MutationRef,
24+
MutationPromise
25+
} from 'firebase/data-connect';
226

327
export const connectorConfig: ConnectorConfig;
428

@@ -7,9 +31,6 @@ export type UUIDString = string;
731
export type Int64String = string;
832
export type DateString = string;
933

10-
11-
12-
1334
export interface CreateMovieData {
1435
movie_insert: Movie_Key;
1536
}
@@ -36,15 +57,26 @@ export interface Movie_Key {
3657

3758
interface CreateMovieRef {
3859
/* Allow users to create refs without passing in DataConnect */
39-
(vars: CreateMovieVariables): MutationRef<CreateMovieData, CreateMovieVariables>;
60+
(vars: CreateMovieVariables): MutationRef<
61+
CreateMovieData,
62+
CreateMovieVariables
63+
>;
4064
/* Allow users to pass in custom DataConnect instances */
41-
(dc: DataConnect, vars: CreateMovieVariables): MutationRef<CreateMovieData, CreateMovieVariables>;
65+
(dc: DataConnect, vars: CreateMovieVariables): MutationRef<
66+
CreateMovieData,
67+
CreateMovieVariables
68+
>;
4269
operationName: string;
4370
}
4471
export const createMovieRef: CreateMovieRef;
4572

46-
export function createMovie(vars: CreateMovieVariables): MutationPromise<CreateMovieData, CreateMovieVariables>;
47-
export function createMovie(dc: DataConnect, vars: CreateMovieVariables): MutationPromise<CreateMovieData, CreateMovieVariables>;
73+
export function createMovie(
74+
vars: CreateMovieVariables
75+
): MutationPromise<CreateMovieData, CreateMovieVariables>;
76+
export function createMovie(
77+
dc: DataConnect,
78+
vars: CreateMovieVariables
79+
): MutationPromise<CreateMovieData, CreateMovieVariables>;
4880

4981
interface ListMoviesRef {
5082
/* Allow users to create refs without passing in DataConnect */
@@ -56,5 +88,6 @@ interface ListMoviesRef {
5688
export const listMoviesRef: ListMoviesRef;
5789

5890
export function listMovies(): QueryPromise<ListMoviesData, undefined>;
59-
export function listMovies(dc: DataConnect): QueryPromise<ListMoviesData, undefined>;
60-
91+
export function listMovies(
92+
dc: DataConnect
93+
): QueryPromise<ListMoviesData, undefined>;

packages/data-connect/.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ module.exports = {
4949
'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
5050
}
5151
],
52-
'no-restricted-globals': [
53-
'error',
54-
]
52+
'no-restricted-globals': ['error']
5553
},
5654
overrides: [
5755
{

packages/data-connect/src/api.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
* limitations under the License.
1616
*/
1717

18-
export * from './core/query/subscribe';
18+
export * from './core/query/subscribe';

packages/data-connect/src/api/DataConnect.ts

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ import {
3030
updateEmulatorBanner
3131
} from '@firebase/util';
3232

33-
import { DataConnectCache, InMemoryCacheProvider } from '../cache/Cache';
33+
import {
34+
CacheSettings,
35+
DataConnectCache,
36+
InMemoryCacheProvider
37+
} from '../cache/Cache';
3438
import { CacheProvider } from '../cache/CacheProvider';
3539
import { IndexedDBCacheProvider } from '../cache/IndexedDBCacheProvider';
3640
import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
@@ -89,7 +93,9 @@ export function parseOptions(fullHost: string): TransportOptions {
8993
/**
9094
* DataConnectOptions including project id
9195
*/
92-
export interface DataConnectOptions extends ConnectorConfig, DataConnectSettings {
96+
export interface DataConnectOptions
97+
extends ConnectorConfig,
98+
DataConnectSettings {
9399
projectId: string;
94100
}
95101

@@ -170,15 +176,19 @@ export class DataConnect {
170176
this.app.options,
171177
this._authProvider
172178
);
173-
174-
175179
}
176180
const connectorConfig: ConnectorConfig = {
177181
connector: this.dataConnectOptions.connector,
178182
service: this.dataConnectOptions.service,
179183
location: this.dataConnectOptions.location
180184
};
181-
this.cache = new DataConnectCache(this._authTokenProvider, this.app.options.projectId, connectorConfig, this._transportOptions.host || PROD_HOST, this.dataConnectOptions.cacheSettings);
185+
this.cache = new DataConnectCache(
186+
this._authTokenProvider,
187+
this.app.options.projectId,
188+
connectorConfig,
189+
this._transportOptions.host || PROD_HOST,
190+
this.dataConnectOptions.cacheSettings
191+
);
182192
this.cache.setAuthProvider(this._authTokenProvider);
183193
if (this._appCheckProvider) {
184194
this._appCheckTokenProvider = new AppCheckTokenProvider(
@@ -266,10 +276,11 @@ export function connectDataConnectEmulator(
266276
dc.enableEmulator({ host, port, sslEnabled });
267277
}
268278

269-
export type CacheProviderImpl = PublicIndexedDbProvider | PublicEphemeralDbProvider;
279+
export type CacheProviderImpl =
280+
| PublicIndexedDbProvider
281+
| PublicEphemeralDbProvider;
270282

271283
export class PublicIndexedDbProvider {
272-
273284
/**
274285
* @internal
275286
*/
@@ -288,26 +299,29 @@ export class PublicEphemeralDbProvider {
288299
}
289300

290301
export interface DataConnectSettings {
291-
cacheSettings?: CacheProviderImpl;
302+
cacheSettings?: CacheSettings;
292303
}
293304

294305
/**
295306
* Initialize DataConnect instance
296307
* @param options ConnectorConfig
297308
*/
298-
export function getDataConnect(options: ConnectorConfig, settings?: DataConnectSettings): DataConnect;
309+
export function getDataConnect(
310+
options: ConnectorConfig,
311+
settings?: DataConnectSettings
312+
): DataConnect;
299313
export function getDataConnect(options: ConnectorConfig): DataConnect;
300-
/**
314+
/**
301315
* Initialize DataConnect instance
302316
* @param app FirebaseApp to initialize to.
303317
* @param connectorConfig ConnectorConfig
304318
*/
305319
export function getDataConnect(
306320
app: FirebaseApp,
307-
connectorConfig: ConnectorConfig,
321+
connectorConfig: ConnectorConfig
308322
): DataConnect;
309323

310-
/**
324+
/**
311325
* Initialize DataConnect instance
312326
* @param app FirebaseApp to initialize to.
313327
* @param connectorConfig ConnectorConfig
@@ -336,8 +350,6 @@ export function getDataConnect(
336350
realSettings = settings as DataConnectSettings;
337351
}
338352

339-
340-
341353
if (!app || Object.keys(app).length === 0) {
342354
app = getApp();
343355
}

packages/data-connect/src/api/Reference.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
4242
// future metadata
4343
}
4444

45-
4645
/**
4746
* Serialized RefInfo as a result of `QueryResult.toJSON().refInfo`
4847
*/

packages/data-connect/src/api/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,19 @@
1616
*/
1717

1818
export * from '../network';
19-
export { CacheSettings, DataConnectStorage, Memory, Persistent } from '../cache/Cache';
20-
export { ExecuteQueryOptions, QueryFetchPolicy, PreferCache, CacheOnly, ServerOnly } from '../core/query/queryOptions';
19+
export {
20+
CacheSettings,
21+
DataConnectStorage,
22+
Memory,
23+
Persistent
24+
} from '../cache/Cache';
25+
export {
26+
ExecuteQueryOptions,
27+
QueryFetchPolicy,
28+
PreferCache,
29+
CacheOnly,
30+
ServerOnly
31+
} from '../core/query/queryOptions';
2132
export * from './DataConnect';
2233
export * from './Reference';
2334
export * from './Mutation';

packages/data-connect/src/api/query.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
SerializedRef
2626
} from './Reference';
2727

28-
2928
/**
3029
* QueryRef object
3130
*/
@@ -49,8 +48,6 @@ export interface QueryPromise<Data, Variables>
4948
// reserved for special actions like cancellation
5049
}
5150

52-
53-
5451
/**
5552
* Execute Query
5653
* @param queryRef query to execute.
@@ -83,7 +80,7 @@ export function queryRef<Data>(
8380
export function queryRef<Data, Variables>(
8481
dcInstance: DataConnect,
8582
queryName: string,
86-
variables: Variables,
83+
variables: Variables
8784
): QueryRef<Data, Variables>;
8885
/**
8986
* Execute Query
@@ -100,7 +97,7 @@ export function queryRef<Data, Variables>(
10097
initialCache?: QueryResult<Data, Variables>
10198
): QueryRef<Data, Variables> {
10299
dcInstance.setInitialized();
103-
if(initialCache !== undefined) {
100+
if (initialCache !== undefined) {
104101
/**
105102
* TODO(mtewani):
106103
* 1. Check whether the cache should be updated based on when the data was fetched

0 commit comments

Comments
 (0)