Skip to content

Final fixes for 5.2.0 release #2085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1f1c69c
More changelog
jamesdaniels May 24, 2019
caac210
Reworking performance a bit more
jamesdaniels May 24, 2019
a2f3f44
Drop the until on orUntilComplete, cleaner
jamesdaniels May 24, 2019
3584063
Perf docs and traceWhile should trace multiple times
jamesdaniels May 24, 2019
19b97c5
Work on traceWhile description a bit more
jamesdaniels May 24, 2019
1ca00ca
Support the 8.0 rc
jamesdaniels May 24, 2019
c2354f8
Doc path should be optional
jamesdaniels May 24, 2019
2794512
Derp, need carrots on the versions
jamesdaniels May 24, 2019
faa5bd2
Changelog entry
jamesdaniels May 24, 2019
32d2bf9
traceComplete has to be after .first
jamesdaniels May 25, 2019
634a94a
Your operators were bad and you should feel bad
jamesdaniels May 25, 2019
8c8cb92
DI inject the default app, incase something is up
jamesdaniels May 25, 2019
46d7622
Initialize perf monitoring to get auto-collection
jamesdaniels May 25, 2019
273afe2
orComplete should be optional
jamesdaniels May 25, 2019
b46350b
Build tests hit ng 7 & 8
jamesdaniels May 29, 2019
224eeed
Handle different formats for .firebaserc and firebase.json
jamesdaniels May 30, 2019
4ed421c
Make schematic deps peers by install deps and devDeps in ngAdd
jamesdaniels May 30, 2019
cb160fd
Cleaning up
jamesdaniels May 30, 2019
6bfe7b1
Perf docs feedback
jamesdaniels May 30, 2019
b31b8f7
Upgrading typescript
jamesdaniels May 30, 2019
50b31f9
Angular Package Manager changes and more
jamesdaniels May 30, 2019
b06fb3c
Doc headers
jamesdaniels May 30, 2019
523127a
yarn.lock
jamesdaniels May 30, 2019
f299135
Removing the node tests for the moment
jamesdaniels May 30, 2019
fb53d76
Derp, still running on travis
jamesdaniels May 30, 2019
bc2a669
Node test didn't work cause I hadn't saved my buffer...
jamesdaniels May 30, 2019
9b870a9
Make perf lazy and fix both perf & messaging on Node
jamesdaniels May 30, 2019
7c6e088
Cleaning up versions a bit
jamesdaniels May 30, 2019
bf0aeed
Changelog entry for messaging
jamesdaniels May 31, 2019
e9a1893
Merge branch 'master' into 5.2-beta-fixes
jamesdaniels May 31, 2019
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ script:
./node_modules/.bin/karma start --single-run --browsers ChromeHeadlessTravis --reporters mocha &&
yarn test:node &&
node tools/run-typings-test.js &&
cd test/ng-build/ng6 &&
yarn && yarn build:prod
bash ./test/ng-build/build.sh
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<a name="5.2.0"></a>
# [5.2.0](https://github.com/angular/angularfire2/compare/5.1.3...5.2.0) (2019-05-24)

AngularFire 5.2 introduces support for Angular 8 and version 6 of the Firebase SDK.

### Bug Fixes

* **firestore:** Fix for builds targeting Node ([#2079](https://github.com/angular/angularfire2/issues/2079)) ([8a33826](https://github.com/angular/angularfire2/commit/8a33826))
* **storage:** Typo in updateMetadata method ([#2029](https://github.com/angular/angularfire2/issues/2029)) ([6133296](https://github.com/angular/angularfire2/commit/6133296))

### Features

* **performance:** AngularFire Performance Monitoring ([#2064](https://github.com/angular/angularfire2/issues/2064))
* **performance:** AngularFire Performance Monitoring ([#2064](https://github.com/angular/angularfire2/issues/2064)) ([2469e77](https://github.com/angular/angularfire2/commit/2469e7721ffaea755ab6b95b66610e1495692342))
* **auth-guard:** AngularFire Auth Guards ([#2016](https://github.com/angular/angularfire2/issues/2016)) ([e32164d](https://github.com/angular/angularfire2/commit/e32164d))
* **firestore:** Added option to include document IDs on valueChanges() ([#1976](https://github.com/angular/angularfire2/issues/1976)) ([7108875](https://github.com/angular/angularfire2/commit/7108875))
* **firestore:** Support Firestore Collection Group Queries ([#2066](https://github.com/angular/angularfire2/issues/2066)) ([c34c0f3](https://github.com/angular/angularfire2/commit/c34c0f3))
* **functions:** Allow configuration of Functions Emulator Origin ([#2017](https://github.com/angular/angularfire2/issues/2017)) ([d12b4c5](https://github.com/angular/angularfire2/commit/d12b4c5))
* **schematics:** ng deploy schematic ([#2046](https://github.com/angular/angularfire2/issues/2046)) ([be0a1fb](https://github.com/angular/angularfire2/commit/be0a1fb))

* **firestore:** path on `AngularFirestoreCollection`'s `.doc` is optional ([#1974](https://github.com/angular/angularfire2/issues/1974)) ([c2354f8](https://github.com/angular/angularfire2/commit/c2354f8))


<a name="5.1.2"></a>
Expand Down
16 changes: 10 additions & 6 deletions docs/performance/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,27 @@ ngOnInit() {
}
```

### `trace(name:string)`
### `trace(name, options?)`

The most basic operator, `trace` will measure the amount of time it takes for your observable to either complete or emit its first value. Beyond the basic trace there are several other operators:

### `traceUntil(name:string, test: (T) => Boolean)`
### `traceUntil(name, test: (T) => Boolean, options?)`

Trace the observable until the first emission that passes the provided test.

### `traceWhile(name:string, test: (T) => Boolean)`
If the `orComplete` option is passed it will complete the trace when the observable completes, even if an emission never passed the provided test.

Trace the observable until the first emission that fails the provided test.
### `traceWhile(name, test: (T) => Boolean, options?)`

### `traceUntilLast(name:string)`
Starting with an emission that passes the provided test, trace until an emission fails the test.

If the `orComplete` option is passed it will complete any existing trace when the observable completes.

### `traceUntilLast(name, options?)`

Trace the observable until completion.

### `traceUntilFirst(name: string)`
### `traceUntilFirst(name, options?)`

Traces the observable until the first emission.

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
},
"homepage": "https://github.com/angular/angularfire2#readme",
"dependencies": {
"@angular-devkit/architect": "^0.800.0-rc.4 || >=8.0.0 <9 || 9.0.0-0",
"@angular-devkit/core": ">=6.0.0 <9 || 9.0.0-0",
"@angular-devkit/schematics": ">=6.0.0 <9 || 9.0.0-0",
"@angular/common": ">=6.0.0 <9 || 9.0.0-0",
"@angular/compiler": ">=6.0.0 <9 || 9.0.0-0",
"@angular/core": ">=6.0.0 <9 || 9.0.0-0",
"@angular/platform-browser": ">=6.0.0 <9 || 9.0.0-0",
"@angular/platform-browser-dynamic": ">=6.0.0 <9 || 9.0.0-0",
"@angular/router": ">=6.0.0 <9 || 9.0.0-0",
"@angular-devkit/architect": "^0.800.0-rc.4 || >=8.0.0 <9 || ^9.0.0-0",
"@angular-devkit/core": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular-devkit/schematics": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/common": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/compiler": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/core": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/platform-browser": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/platform-browser-dynamic": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/router": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"firebase": ">= 5.5.7 <7",
"firebase-tools": "^6.10.0",
"fuzzy": "^0.1.3",
Expand All @@ -57,9 +57,9 @@
"utf-8-validate": "~4.0.0"
},
"devDependencies": {
"@angular/animations": ">=6.0.0 <9 || 9.0.0-0",
"@angular/compiler-cli": ">=6.0.0 <9 || 9.0.0-0",
"@angular/platform-server": ">=6.0.0 <9 || 9.0.0-0",
"@angular/animations": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/compiler-cli": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@angular/platform-server": ">=6.0.0 <9 || ^8.0.0-0 || ^9.0.0-0",
"@types/inquirer": "^0.0.44",
"@types/jasmine": "^2.5.36",
"@types/request": "0.0.30",
Expand Down
2 changes: 1 addition & 1 deletion src/firestore/collection/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class AngularFirestoreCollection<T=DocumentData> {
* Create a reference to a single document in a collection.
* @param path
*/
doc<T>(path: string): AngularFirestoreDocument<T> {
doc<T>(path?: string): AngularFirestoreDocument<T> {
return new AngularFirestoreDocument<T>(this.ref.doc(path), this.afs);
}
}
6 changes: 5 additions & 1 deletion src/performance/performance.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ import 'firebase/performance';
@NgModule({
providers: [ AngularFirePerformance ]
})
export class AngularFirePerformanceModule { }
export class AngularFirePerformanceModule {
constructor(_: AngularFirePerformance) {
// DI inject AFP here for the automatic data collection
}
}
61 changes: 39 additions & 22 deletions src/performance/performance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Injectable, NgZone, ApplicationRef, InjectionToken, Inject, Optional } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable, Subscription } from 'rxjs';
import { first, tap } from 'rxjs/operators';
import { performance } from 'firebase/app';
import { FirebaseApp } from '@angular/fire';

export const AUTOMATICALLY_TRACE_CORE_NG_METRICS = new InjectionToken<boolean>('angularfire2.performance.auto_trace');
export const INSTRUMENTATION_ENABLED = new InjectionToken<boolean>('angularfire2.performance.instrumentationEnabled');
Expand All @@ -21,14 +22,15 @@ export class AngularFirePerformance {
performance: performance.Performance;

constructor(
app: FirebaseApp,
@Optional() @Inject(AUTOMATICALLY_TRACE_CORE_NG_METRICS) automaticallyTraceCoreNgMetrics:boolean|null,
@Optional() @Inject(INSTRUMENTATION_ENABLED) instrumentationEnabled:boolean|null,
@Optional() @Inject(DATA_COLLECTION_ENABLED) dataCollectionEnabled:boolean|null,
appRef: ApplicationRef,
private zone: NgZone
) {

this.performance = zone.runOutsideAngular(() => performance());
this.performance = zone.runOutsideAngular(() => app.performance());

if (instrumentationEnabled == false) { this.performance.instrumentationEnabled = false }
if (dataCollectionEnabled == false) { this.performance.dataCollectionEnabled = false }
Expand All @@ -37,8 +39,8 @@ export class AngularFirePerformance {

// TODO determine more built in metrics
appRef.isStable.pipe(
this.traceUntilLast('isStable'),
first(it => it)
first(it => it),
this.traceUntilComplete('isStable')
).subscribe();

}
Expand Down Expand Up @@ -73,51 +75,66 @@ export class AngularFirePerformance {
})
);

traceUntil = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions) => (source$: Observable<T>) => {
traceUntil = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete?: boolean }) => (source$: Observable<T>) => new Observable<T>(subscriber => {
const traceSubscription = this.trace$(name, options).subscribe();
return source$.pipe(
tap(a => { if (test(a)) { traceSubscription.unsubscribe() }})
)
};
tap(
a => test(a) && traceSubscription.unsubscribe(),
() => {},
() => options && options.orComplete && traceSubscription.unsubscribe()
)
).subscribe(subscriber);
});

traceWhile = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions) => (source$: Observable<T>) => {
const traceSubscription = this.trace$(name, options).subscribe();
traceWhile = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete?: boolean}) => (source$: Observable<T>) => new Observable<T>(subscriber => {
let traceSubscription: Subscription|undefined;
return source$.pipe(
tap(a => { if (!test(a)) { traceSubscription.unsubscribe() }})
)
};
tap(
a => {
if (test(a)) {
traceSubscription = traceSubscription || this.trace$(name, options).subscribe();
} else {
traceSubscription && traceSubscription.unsubscribe();
traceSubscription = undefined;
}
},
() => {},
() => options && options.orComplete && traceSubscription && traceSubscription.unsubscribe()
)
).subscribe(subscriber);
});

traceUntilLast= <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
traceUntilComplete = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
const traceSubscription = this.trace$(name, options).subscribe();
return source$.pipe(
tap(
() => {},
() => {},
() => traceSubscription.unsubscribe()
)
)
};
).subscribe(subscriber);
});

traceUntilFirst = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
traceUntilFirst = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
const traceSubscription = this.trace$(name, options).subscribe();
return source$.pipe(
tap(
() => traceSubscription.unsubscribe(),
() => {},
() => {}
)
)
};
).subscribe(subscriber);
});

trace = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
trace = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
const traceSubscription = this.trace$(name, options).subscribe();
return source$.pipe(
tap(
() => traceSubscription.unsubscribe(),
() => {},
() => traceSubscription.unsubscribe()
)
)
};
).subscribe(subscriber);
});

}
4 changes: 3 additions & 1 deletion test/ng-build/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
cd ng6 && ng build --prod
cd ./test/ng-build/ng6 && yarn && npx ng build --prod &&
cd ../ng7 && yarn && npx ng build --prod &&
cd ../ng8 && yarn && npx ng build --prod
45 changes: 0 additions & 45 deletions test/ng-build/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/ng-build/ng6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@angular/common": "6.0.1",
"@angular/compiler": "6.0.1",
"@angular/core": "6.0.1",
"@angular/fire": "../../../dist/packages-dist",
"@angular/forms": "6.0.1",
"@angular/http": "6.0.1",
"@angular/platform-browser": "6.0.1",
"@angular/platform-browser-dynamic": "6.0.1",
"@angular/router": "6.0.1",
"@angular/fire": "../../../dist/packages-dist",
"core-js": "^2.4.1",
"rxjs": "^6.0.0",
"zone.js": "^0.8.14"
Expand Down
10 changes: 8 additions & 2 deletions test/ng-build/ng6/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { FirebaseApp } from '@angular/fire';
import { AngularFireDatabase } from '@angular/fire/database';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore } from '@angular/fire/firestore';
import { AngularFireStorage } from '@angular/fire/storage';
import { AngularFireMessaging } from '@angular/fire/messaging';
import { AngularFireFunctions } from '@angular/fire/functions';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -32,8 +35,11 @@ export class AppComponent {
private readonly app: FirebaseApp,
private readonly db: AngularFireDatabase,
private readonly auth: AngularFireAuth,
private readonly afStore: AngularFirestore
private readonly afStore: AngularFirestore,
private readonly storage: AngularFireStorage,
private readonly messaging: AngularFireMessaging,
private readonly functions: AngularFireFunctions
) {
console.log(app, db, auth, afStore);
console.log(app, db, auth, afStore, storage, messaging, functions);
}
}
8 changes: 7 additions & 1 deletion test/ng-build/ng6/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { FirebaseOptionsToken, AngularFireModule } from '@angular/fire';
import { AngularFireDatabaseModule } from '@angular/fire/database';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { AngularFireFunctionsModule } from '@angular/fire/functions';
import { AngularFireMessagingModule } from '@angular/fire/messaging';

import { AppComponent } from './app.component';

Expand All @@ -23,7 +26,10 @@ import { AppComponent } from './app.component';
}),
AngularFireAuthModule,
AngularFireDatabaseModule,
AngularFirestoreModule
AngularFirestoreModule,
AngularFireStorageModule,
AngularFireMessagingModule,
AngularFireFunctionsModule
],
bootstrap: [AppComponent]
})
Expand Down
Loading