Skip to content

Commit 0f1859c

Browse files
Merge pull request #104 from angular/master
Create a new pull request by comparing changes
2 parents 30752a5 + 4c877b1 commit 0f1859c

File tree

8 files changed

+55
-34
lines changed

8 files changed

+55
-34
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
os: [ ubuntu-latest, macos-latest, windows-latest ]
7070
node: ["12", "14", "16"]
7171
firebase: ["9"]
72-
firebaseTools: ["9"]
72+
firebaseTools: ["9", "10"]
7373
rxjs: ["6", "7"]
7474
ng: ["12", "13"]
7575
exclude:
@@ -147,7 +147,7 @@ jobs:
147147
os: [ ubuntu-latest ]
148148
node: ["14"]
149149
firebase: ["9", "canary", "next"]
150-
firebaseTools: ["9"]
150+
firebaseTools: ["9", "10"]
151151
rxjs: ["7"]
152152
ng: ["12", "13", "next"]
153153
exclude:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
<a name="7.2.1"></a>
2+
# [7.2.1](https://github.com/angular/angularfire/compare/7.2.0...7.2.1) (2022-02-10)
3+
4+
### Bug Fixes
5+
6+
* **compat:** Typescript 4.5 inference breaks the PromiseProxy ([#3144](https://github.com/angular/angularfire/issues/3144)) ([f61bc7d](https://github.com/angular/angularfire/commit/f61bc7d)), closes [#3090](https://github.com/angular/angularfire/issues/3090) [#3088](https://github.com/angular/angularfire/issues/3088)
7+
* **core:** Address bad arguments being passed to zone wrapper ([#3127](https://github.com/angular/angularfire/issues/3127)) ([8b693e4](https://github.com/angular/angularfire/commit/8b693e4))
8+
* **core:** Defensively catch Firebase isSupported calls ([#3146](https://github.com/angular/angularfire/issues/3146)) ([520930b](https://github.com/angular/angularfire/commit/520930b))
9+
* **schematic:** use oneOf rather than array types in the deploy schematic ([#3092](https://github.com/angular/angularfire/issues/3092)) ([058d624](https://github.com/angular/angularfire/commit/058d624))
10+
* **schematics:** Address ng add console lock up ([#3151](https://github.com/angular/angularfire/issues/3151)) ([4852c35](https://github.com/angular/angularfire/commit/4852c35)), closes [#3145](https://github.com/angular/angularfire/issues/3145) [#3121](https://github.com/angular/angularfire/issues/3121)
11+
12+
13+
114
<a name="7.2.0"></a>
215
# [7.2.0](https://github.com/angular/angularfire/compare/7.1.1...7.2.0) (2021-11-11)
316

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular/fire",
3-
"version": "7.2.0",
3+
"version": "7.2.1",
44
"description": "The official Angular library for Firebase.",
55
"private": true,
66
"scripts": {

src/compat/proxy.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { NgZone } from '@angular/core';
22
import { Observable } from 'rxjs';
33

4-
// tslint:disable:ban-types
5-
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T];
4+
type MyFunction = (...args: any[]) => any;
5+
type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends MyFunction ? K : never }[keyof T];
6+
type ReturnTypeOrNever<T> = T extends MyFunction ? ReturnType<T> : never;
7+
type ParametersOrNever<T> = T extends MyFunction ? Parameters<T> : never;
68
type PromiseReturningFunctionPropertyNames<T> = {
7-
[K in FunctionPropertyNames<T>]: ReturnType<T[K]> extends Promise<any> ? K : never
9+
[K in FunctionPropertyNames<T>]: ReturnTypeOrNever<T[K]> extends Promise<any> ? K : never
810
}[FunctionPropertyNames<T>];
911
type NonPromiseReturningFunctionPropertyNames<T> = {
10-
[K in FunctionPropertyNames<T>]: ReturnType<T[K]> extends Promise<any> ? never : K
12+
[K in FunctionPropertyNames<T>]: ReturnTypeOrNever<T[K]> extends Promise<any> ? never : K
1113
}[FunctionPropertyNames<T>];
12-
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
13-
// tslint:enable:ban-types
14+
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends MyFunction ? never : K }[keyof T];
1415

1516
export type ɵPromiseProxy<T> = { [K in NonFunctionPropertyNames<T>]: Promise<T[K]> } &
16-
{ [K in NonPromiseReturningFunctionPropertyNames<T>]: (...args: Parameters<T[K]>) => Promise<ReturnType<T[K]>> } &
17-
{ [K in PromiseReturningFunctionPropertyNames<T>]: (...args: Parameters<T[K]>) => ReturnType<T[K]> };
18-
17+
{ [K in NonPromiseReturningFunctionPropertyNames<T>]: (...args: ParametersOrNever<T[K]>) => Promise<ReturnTypeOrNever<T[K]>> } &
18+
{ [K in PromiseReturningFunctionPropertyNames<T>]: T[K] };
1919

2020
// DEBUG quick debugger function for inline logging that typescript doesn't complain about
2121
// wrote it for debugging the ɵlazySDKProxy, commenting out for now; should consider exposing a

src/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ const isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupp
1616

1717
globalThis[isAnalyticsSupportedPromiseSymbol] ||= isAnalyticsSupported().then(it =>
1818
globalThis[isAnalyticsSupportedValueSymbol] = it
19+
).catch(() =>
20+
globalThis[isAnalyticsSupportedValueSymbol] = false
1921
);
2022

2123
globalThis[isMessagingSupportedPromiseSymbol] ||= isMessagingSupported().then(it =>
2224
globalThis[isMessagingSupportedValueSymbol] = it
25+
).catch(() =>
26+
globalThis[isMessagingSupportedValueSymbol] = false
2327
);
2428

2529
globalThis[isRemoteConfigSupportedPromiseSymbol] ||= isRemoteConfigSupported().then(it =>
2630
globalThis[isRemoteConfigSupportedValueSymbol] = it
31+
).catch(() =>
32+
globalThis[isRemoteConfigSupportedValueSymbol] = false
2733
);
2834

2935
const isSupportedError = (module: string) =>

src/schematics/deploy/schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
3131
},
3232
"ssr": {
33-
"type": ["boolean", "string"],
33+
"oneOf": [{ "type": "boolean" }, { "type": "string" }],
3434
"description": "Should we attempt to deploy the function to Cloud Functions (true or 'cloud-functions') / Cloud Run ('cloud-run') or just Hosting (false)"
3535
},
3636
"prerender": {
@@ -54,7 +54,7 @@
5454
"description": "The name of the Cloud Function or Cloud Run serviceId to deploy SSR to"
5555
},
5656
"functionsNodeVersion": {
57-
"type": ["number", "string"],
57+
"oneOf": [{ "type": "number" }, { "type": "string" }],
5858
"description": "Version of Node.js to run Cloud Functions / Run on"
5959
},
6060
"region": {
@@ -82,12 +82,12 @@
8282
"description": "Set a CPU limit in Kubernetes cpu units."
8383
},
8484
"maxConcurrency": {
85-
"type": ["number", "string"],
85+
"oneOf": [{ "type": "number" }, { "type": "string" }],
8686
"pattern": "^(\\d+|default)$",
8787
"description": "Set the maximum number of concurrent requests allowed per container instance. If concurrency is unspecified, any number of concurrent requests are allowed. To unset this field, provide the special value default."
8888
},
8989
"maxInstances": {
90-
"type": ["number", "string"],
90+
"oneOf": [{ "type": "number" }, { "type": "string" }],
9191
"pattern": "^(\\d+|default)$",
9292
"description": "The maximum number of container instances of the Service to run. Use 'default' to unset the limit and use the platform default."
9393
},
@@ -97,7 +97,7 @@
9797
"description": "Set a memory limit. Ex: 1Gi, 512Mi."
9898
},
9999
"minInstances": {
100-
"type": ["number", "string"],
100+
"oneOf": [{ "type": "number" }, { "type": "string" }],
101101
"pattern": "^(\\d+|default)$",
102102
"description": "The minimum number of container instances of the Service to run or 'default' to remove any minimum."
103103
},

src/schematics/setup/prompts.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const isSite = (elem: FirebaseHostingSite | fuzzy.FilterResult<FirebaseHostingSi
2424
return (elem as { original: FirebaseHostingSite }).original === undefined;
2525
};
2626

27-
export const searchProjects = (promise: Promise<FirebaseProject[]>) =>
28-
(_: any, input: string) => promise.then(projects => {
27+
export const searchProjects = (projects: FirebaseProject[]) =>
28+
async (_: any, input: string) => {
2929
projects.unshift({
3030
projectId: NEW_OPTION,
3131
displayName: '[CREATE NEW PROJECT]'
@@ -47,10 +47,10 @@ export const searchProjects = (promise: Promise<FirebaseProject[]>) =>
4747
value: original.projectId
4848
};
4949
});
50-
});
50+
};
5151

52-
export const searchApps = (promise: Promise<FirebaseApp[]>) =>
53-
(_: any, input: string) => promise.then(apps => {
52+
export const searchApps = (apps: FirebaseApp[]) =>
53+
async (_: any, input: string) => {
5454
apps.unshift({
5555
appId: NEW_OPTION,
5656
displayName: '[CREATE NEW APP]',
@@ -72,10 +72,10 @@ export const searchApps = (promise: Promise<FirebaseApp[]>) =>
7272
value: shortAppId(original),
7373
};
7474
});
75-
});
75+
};
7676

77-
export const searchSites = (promise: Promise<FirebaseHostingSite[]>) =>
78-
(_: any, input: string) => promise.then(sites => {
77+
export const searchSites = (sites: FirebaseHostingSite[]) =>
78+
async (_: any, input: string) => {
7979
sites.unshift({
8080
name: NEW_OPTION,
8181
defaultUrl: '[CREATE NEW SITE]',
@@ -97,7 +97,7 @@ export const searchSites = (promise: Promise<FirebaseHostingSite[]>) =>
9797
value: shortSiteName(original),
9898
};
9999
});
100-
});
100+
};
101101

102102

103103
type Prompt = <K extends string, U= unknown>(questions: { name: K, source: (...args) =>
@@ -146,7 +146,7 @@ export const userPrompt = async (options: {}): Promise<Record<string, any>> => {
146146

147147
export const projectPrompt = async (defaultProject: string|undefined, options: {}) => {
148148
const firebaseTools = await getFirebaseTools();
149-
const projects = firebaseTools.projects.list(options);
149+
const projects = await firebaseTools.projects.list(options);
150150
const { projectId } = await autocomplete({
151151
type: 'autocomplete',
152152
name: 'projectId',
@@ -174,7 +174,7 @@ export const projectPrompt = async (defaultProject: string|undefined, options: {
174174

175175
export const appPrompt = async ({ projectId: project }: FirebaseProject, defaultAppId: string|undefined, options: {}) => {
176176
const firebaseTools = await getFirebaseTools();
177-
const apps = firebaseTools.apps.list('web', { ...options, project });
177+
const apps = await firebaseTools.apps.list('web', { ...options, project });
178178
const { appId } = await autocomplete({
179179
type: 'autocomplete',
180180
name: 'appId',
@@ -196,7 +196,7 @@ export const appPrompt = async ({ projectId: project }: FirebaseProject, default
196196

197197
export const sitePrompt = async ({ projectId: project }: FirebaseProject, options: {}) => {
198198
const firebaseTools = await getFirebaseTools();
199-
const sites = firebaseTools.hosting.sites.list({ ...options, project }).then(it => {
199+
const sites = await firebaseTools.hosting.sites.list({ ...options, project }).then(it => {
200200
if (it.sites.length === 0) {
201201
// newly created projects don't return their default site, stub one
202202
return [{
@@ -214,7 +214,7 @@ export const sitePrompt = async ({ projectId: project }: FirebaseProject, option
214214
name: 'siteName',
215215
source: searchSites(sites),
216216
message: 'Please select a hosting site:',
217-
default: _ => sites.then(it => shortSiteName(it.find(it => it.type === DEFAULT_SITE_TYPE))),
217+
default: _ => shortSiteName(sites.find(site => site.type === DEFAULT_SITE_TYPE)),
218218
});
219219
if (siteName === NEW_OPTION) {
220220
const { subdomain } = await inquirer.prompt({

src/zones.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,15 @@ const zoneWrapFn = (it: (...args: any[]) => any, macrotask: MacroTask|undefined)
145145
// function() is needed for the arguments object
146146
// tslint:disable-next-line:only-arrow-functions
147147
return function() {
148+
const _arguments = arguments;
148149
if (macrotask) {
149150
setTimeout(() => {
150151
if (macrotask.state === 'scheduled') {
151152
macrotask.invoke();
152153
}
153154
}, 10);
154155
}
155-
return run(() => it.apply(_this, arguments));
156+
return run(() => it.apply(_this, _arguments));
156157
};
157158
};
158159

@@ -161,18 +162,19 @@ export const ɵzoneWrap = <T= unknown>(it: T, blockUntilFirst: boolean): T => {
161162
// tslint:disable-next-line:only-arrow-functions
162163
return function() {
163164
let macrotask: MacroTask | undefined;
165+
const _arguments = arguments;
164166
// if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it
165167
// only once one of the callback functions is tripped.
166168
for (let i = 0; i < arguments.length; i++) {
167-
if (typeof arguments[i] === 'function') {
169+
if (typeof _arguments[i] === 'function') {
168170
if (blockUntilFirst) {
169171
macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));
170172
}
171173
// TODO create a microtask to track callback functions
172-
arguments[i] = zoneWrapFn(arguments[i], macrotask);
174+
_arguments[i] = zoneWrapFn(_arguments[i], macrotask);
173175
}
174176
}
175-
const ret = runOutsideAngular(() => (it as any).apply(this, arguments));
177+
const ret = runOutsideAngular(() => (it as any).apply(this, _arguments));
176178
if (!blockUntilFirst) {
177179
if (ret instanceof Observable) {
178180
const schedulers = getSchedulers();

0 commit comments

Comments
 (0)