Skip to content

Commit df31def

Browse files
committed
Merge branch 'main' into dl/optimize-ci
2 parents cc9bcf4 + c19a051 commit df31def

File tree

17 files changed

+54
-86
lines changed

17 files changed

+54
-86
lines changed

.changeset/fluffy-rules-pretend.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/app-check': patch
3+
'@firebase/util': patch
4+
---
5+
6+
Generate UUIDs with `crypto.randomUUID()` instead of custom uuidv4 function that uses `Math.random()`.

.changeset/tame-tigers-approve.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@firebase/data-connect": minor
3+
"firebase": minor
4+
---
5+
6+
Updated to include promise instead of promiselike

.github/CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages/messaging-interop-types @zwu52 @firebase/jssdk-global-approvers
3737
integration/messaging @zwu52 @firebase/jssdk-global-approvers
3838

3939
# Auth Code
40-
packages/auth @lisajian @Xiaoshouzi-gh @sam-gc @firebase/jssdk-global-approvers
41-
packages/auth-compat @lisajian @Xiaoshouzi-gh @sam-gc @firebase/jssdk-global-approvers
42-
packages/auth-types @lisajian @Xiaoshouzi-gh @sam-gc @firebase/jssdk-global-approvers
43-
packages/auth-interop-types @lisajian @Xiaoshouzi-gh @sam-gc @firebase/jssdk-global-approvers
40+
packages/auth @lisajian @Xiaoshouzi-gh @sam-gc @pashanka @mansisampat @nhienlam @firebase/jssdk-global-approvers
41+
packages/auth-compat @lisajian @Xiaoshouzi-gh @sam-gc @pashanka @mansisampat @nhienlam @firebase/jssdk-global-approvers
42+
packages/auth-types @lisajian @Xiaoshouzi-gh @sam-gc @pashanka @mansisampat @nhienlam @firebase/jssdk-global-approvers
43+
packages/auth-interop-types @lisajian @Xiaoshouzi-gh @sam-gc @pashanka @mansisampat @nhienlam @firebase/jssdk-global-approvers
4444

4545
# Testing Code
4646
packages/rules-unit-testing @avolkovi @sam-gc @yuchenshi @firebase/jssdk-global-approvers

common/api-review/data-connect.api.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ import { FirebaseError } from '@firebase/util';
1111
import { LogLevelString } from '@firebase/logger';
1212
import { Provider } from '@firebase/component';
1313

14-
// @public (undocumented)
15-
export interface CancellableOperation<T> extends PromiseLike<{
16-
data: T;
17-
}> {
18-
// (undocumented)
19-
cancel: () => void;
20-
}
21-
2214
// @public
2315
export function connectDataConnectEmulator(dc: DataConnect, host: string, port?: number, sslEnabled?: boolean): void;
2416

@@ -88,7 +80,7 @@ export function getDataConnect(app: FirebaseApp, options: ConnectorConfig): Data
8880
export const MUTATION_STR = "mutation";
8981

9082
// @public
91-
export interface MutationPromise<Data, Variables> extends PromiseLike<MutationResult<Data, Variables>> {
83+
export interface MutationPromise<Data, Variables> extends Promise<MutationResult<Data, Variables>> {
9284
}
9385

9486
// @public (undocumented)
@@ -144,7 +136,7 @@ export interface OpResult<Data> {
144136
export const QUERY_STR = "query";
145137

146138
// @public
147-
export interface QueryPromise<Data, Variables> extends PromiseLike<QueryResult<Data, Variables>> {
139+
export interface QueryPromise<Data, Variables> extends Promise<QueryResult<Data, Variables>> {
148140
}
149141

150142
// @public

common/api-review/util.api.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ export interface Subscribe<T> {
476476
// @public (undocumented)
477477
export type Unsubscribe = () => void;
478478

479-
// @public
480-
export const uuidv4: () => string;
481-
482479
// Warning: (ae-missing-release-tag) "validateArgCount" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
483480
//
484481
// @public

packages/app-check/src/storage.ts

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

1818
import { FirebaseApp } from '@firebase/app';
19-
import { isIndexedDBAvailable, uuidv4 } from '@firebase/util';
19+
import { isIndexedDBAvailable } from '@firebase/util';
2020
import {
2121
readDebugTokenFromIndexedDB,
2222
readTokenFromIndexedDB,
@@ -77,7 +77,8 @@ export async function readOrCreateDebugTokenFromStorage(): Promise<string> {
7777

7878
if (!existingDebugToken) {
7979
// create a new debug token
80-
const newToken = uuidv4();
80+
// This function is only available in secure contexts. See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
81+
const newToken = crypto.randomUUID();
8182
// We don't need to block on writing to indexeddb
8283
// In case persistence failed, a new debug token will be generated every time the page is refreshed.
8384
// It renders the debug token useless because you have to manually register(whitelist) the new token in the firebase console again and again.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function mutationRef<Data, Variables>(
7676
* @internal
7777
*/
7878
export class MutationManager {
79-
private _inflight: Array<PromiseLike<unknown>> = [];
79+
private _inflight: Array<Promise<unknown>> = [];
8080
constructor(private _transport: DataConnectTransport) {}
8181
executeMutation<Data, Variables>(
8282
mutationRef: MutationRef<Data, Variables>
@@ -95,7 +95,7 @@ export class MutationManager {
9595
return obj;
9696
});
9797
this._inflight.push(result);
98-
const removePromise = (): Array<PromiseLike<unknown>> =>
98+
const removePromise = (): Array<Promise<unknown>> =>
9999
(this._inflight = this._inflight.filter(promise => promise !== result));
100100
result.then(removePromise, removePromise);
101101
return withRefPromise;
@@ -113,7 +113,7 @@ export interface MutationResult<Data, Variables>
113113
* Mutation return value from `executeMutation`
114114
*/
115115
export interface MutationPromise<Data, Variables>
116-
extends PromiseLike<MutationResult<Data, Variables>> {
116+
extends Promise<MutationResult<Data, Variables>> {
117117
// reserved for special actions like cancellation
118118
}
119119

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface QueryResult<Data, Variables>
6767
* Promise returned from `executeQuery`
6868
*/
6969
export interface QueryPromise<Data, Variables>
70-
extends PromiseLike<QueryResult<Data, Variables>> {
70+
extends Promise<QueryResult<Data, Variables>> {
7171
// reserved for special actions like cancellation
7272
}
7373

@@ -124,7 +124,7 @@ export function queryRef<Data, Variables>(
124124
dataConnect: dcInstance,
125125
refType: QUERY_STR,
126126
name: queryName,
127-
variables: variables as Variables
127+
variables: variables
128128
};
129129
}
130130
/**

packages/data-connect/src/network/fetch.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,14 @@ function getGoogApiClientValue(_isUsingGen: boolean): string {
3030
}
3131
return str;
3232
}
33+
export interface DataConnectFetchBody<T> {
34+
name: string;
35+
operationName: string;
36+
variables: T;
37+
}
3338
export function dcFetch<T, U>(
3439
url: string,
35-
body: U,
40+
body: DataConnectFetchBody<U>,
3641
{ signal }: AbortController,
3742
appId: string | null,
3843
accessToken: string | null,
@@ -95,7 +100,7 @@ export function dcFetch<T, U>(
95100
logError('DataConnect error while performing request: ' + stringified);
96101
throw new DataConnectError(Code.OTHER, stringified);
97102
}
98-
return res as { data: T; errors: Error[] };
103+
return res;
99104
});
100105
}
101106
interface MessageObject {

packages/data-connect/src/network/transport/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ export interface DataConnectTransport {
2626
invokeQuery<T, U>(
2727
queryName: string,
2828
body?: U
29-
): PromiseLike<{ data: T; errors: Error[] }>;
29+
): Promise<{ data: T; errors: Error[] }>;
3030
invokeMutation<T, U>(
3131
queryName: string,
3232
body?: U
33-
): PromiseLike<{ data: T; errors: Error[] }>;
33+
): Promise<{ data: T; errors: Error[] }>;
3434
useEmulator(host: string, port?: number, sslEnabled?: boolean): void;
3535
onTokenChanged: (token: string | null) => void;
3636
}
3737

38-
export interface CancellableOperation<T> extends PromiseLike<{ data: T }> {
39-
cancel: () => void;
40-
}
41-
4238
/**
4339
* @internal
4440
*/

0 commit comments

Comments
 (0)