Skip to content

Commit 9f17eac

Browse files
committed
Fixed formatting
1 parent 7472d5d commit 9f17eac

File tree

14 files changed

+191
-77
lines changed

14 files changed

+191
-77
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/src/api.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
*/
1717

1818
export * from './core/query/subscribe';
19-
export { IndexedDBStub, MemoryStub as PersistentStub } from './cache/Cache';
19+
export { IndexedDBStub, MemoryStub as PersistentStub } from './cache/Cache';
2020
export { makeMemoryCacheProvider } from './api/DataConnect';

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

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

33-
import {
34-
DataConnectCache,
35-
IndexedDBStub,
36-
MemoryStub,
37-
} from '../cache/Cache';
33+
import { DataConnectCache, IndexedDBStub, MemoryStub } from '../cache/Cache';
3834
import { AppCheckTokenProvider } from '../core/AppCheckTokenProvider';
3935
import { Code, DataConnectError } from '../core/error';
4036
import {
@@ -54,8 +50,6 @@ import { PROD_HOST } from '../util/url';
5450

5551
import { MutationManager } from './Mutation';
5652

57-
58-
5953
/**
6054
* Connector Config for calling Data Connect backend.
6155
*/
@@ -391,12 +385,11 @@ export const StorageType = {
391385

392386
export type StorageType = (typeof StorageType)[keyof typeof StorageType];
393387

394-
395388
export interface CacheSettings {
396389
cacheProvider?: CacheProvider<StorageType>;
397390
}
398391
export interface CacheProvider<T extends StorageType> {
399-
type: T
392+
type: T;
400393
}
401394

402395
export function makePersistentCacheProvider(): CacheProvider<'PERSISTENT'> {
@@ -405,4 +398,3 @@ export function makePersistentCacheProvider(): CacheProvider<'PERSISTENT'> {
405398
export function makeMemoryCacheProvider(): CacheProvider<'MEMORY'> {
406399
return new MemoryStub();
407400
}
408-

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@
1818
export * from '../network';
1919
export {
2020
ExecuteQueryOptions,
21-
QueryFetchPolicy,
21+
QueryFetchPolicy
2222
} from '../core/query/queryOptions';
23-
export { CacheSettings, validateDCOptions, ConnectorConfig, DataConnect, DataConnectOptions, DataConnectSettings, StorageType, TransportOptions, areTransportOptionsEqual, connectDataConnectEmulator, getDataConnect, parseOptions, terminate } from './DataConnect';
23+
export {
24+
CacheSettings,
25+
validateDCOptions,
26+
ConnectorConfig,
27+
DataConnect,
28+
DataConnectOptions,
29+
DataConnectSettings,
30+
StorageType,
31+
TransportOptions,
32+
areTransportOptionsEqual,
33+
connectDataConnectEmulator,
34+
getDataConnect,
35+
parseOptions,
36+
terminate
37+
} from './DataConnect';
2438
export * from './Reference';
2539
export * from './Mutation';
2640
export * from './query';

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

Lines changed: 0 additions & 1 deletion
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
*/

packages/data-connect/src/cache/Cache.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const Persistent = 'persistent';
4141

4242
export type DataConnectStorage = typeof Memory | typeof Persistent;
4343

44-
4544
/**
4645
* ServerValues
4746
*/
@@ -62,7 +61,7 @@ export class DataConnectCache {
6261
this.authProvider.addTokenChangeListener(async _ => {
6362
const newUid = this.authProvider.getAuth().getUid();
6463
// We should only close if the token changes and so does the new UID
65-
if(this.uid !== newUid) {
64+
if (this.uid !== newUid) {
6665
await this.cacheProvider?.close();
6766
this.uid = newUid;
6867
const identifier = await this.getIdentifier(this.uid);
@@ -93,7 +92,11 @@ export class DataConnectCache {
9392
initializeNewProviders(identifier: string): InternalCacheProvider {
9493
let cacheProvider: InternalCacheProvider;
9594
if (this.cacheSettings) {
96-
cacheProvider = (this.cacheSettings.cacheProvider?.type === 'MEMORY' || !isIndexedDBAvailable()) ? new InMemoryCacheProvider(identifier) : new IndexedDBCacheProvider(identifier);
95+
cacheProvider =
96+
this.cacheSettings.cacheProvider?.type === 'MEMORY' ||
97+
!isIndexedDBAvailable()
98+
? new InMemoryCacheProvider(identifier)
99+
: new IndexedDBCacheProvider(identifier);
97100
} else {
98101
logDebug(
99102
'IndexedDB is not available. Using In-Memory Cache Provider instead.'
@@ -153,4 +156,4 @@ export class IndexedDBStub implements CacheProvider<'PERSISTENT'> {
153156

154157
export class MemoryStub implements CacheProvider<'MEMORY'> {
155158
type: 'MEMORY' = 'MEMORY';
156-
}
159+
}

packages/data-connect/src/cache/EntityDataObject.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type FDCScalarValue =
2626

2727
export interface BackingDataObjectJson {
2828
map: {
29-
[key: string]: FDCScalarValue
29+
[key: string]: FDCScalarValue;
3030
};
3131
queriesReferenced: Set<string>;
3232
globalID: string;
@@ -39,8 +39,7 @@ export class EntityDataObject {
3939
getStorableMap(map: { [key: string]: FDCScalarValue }): {
4040
[key: string]: FDCScalarValue;
4141
} {
42-
const newMap: { [key: string]: FDCScalarValue } =
43-
{};
42+
const newMap: { [key: string]: FDCScalarValue } = {};
4443
for (const key in map) {
4544
if (map.hasOwnProperty(key)) {
4645
newMap[key] = map[key];
@@ -61,10 +60,14 @@ export class EntityDataObject {
6160
bdo.queriesReferenced = json.queriesReferenced;
6261
return bdo;
6362
}
64-
private map: {[key:string]: FDCScalarValue} = {};
63+
private map: { [key: string]: FDCScalarValue } = {};
6564
private queriesReferenced = new Set<string>();
6665
constructor(public readonly globalID: string) {}
67-
updateServerValue(key: string, value: FDCScalarValue, requestedFrom: string): string[] {
66+
updateServerValue(
67+
key: string,
68+
value: FDCScalarValue,
69+
requestedFrom: string
70+
): string[] {
6871
this.map[key] = value;
6972
this.queriesReferenced.add(requestedFrom);
7073
return Array.from(this.queriesReferenced);

0 commit comments

Comments
 (0)