Skip to content

Commit 9db873e

Browse files
committed
chore(build): database build
1 parent 2e175b7 commit 9db873e

23 files changed

+130
-34
lines changed

src/auth/auth.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { TestBed, inject } from '@angular/core/testing';
77
import { _do } from 'rxjs/operator/do';
88
import { take } from 'rxjs/operator/take';
99
import { skip } from 'rxjs/operator/skip';
10-
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from '../core';
10+
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from 'angularfire2';
1111
import { AngularFireAuth } from './auth';
1212
import { AngularFireAuthModule } from './auth.module';
13-
import { COMMON_CONFIG } from '../test-config';
13+
import { COMMON_CONFIG } from './test-config';
1414

1515
function authTake(auth: Observable<any>, count: number): Observable<any> {
1616
return take.call(auth, 1);
File renamed without changes.

src/core/angularfire2.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TestBed, inject, withModule, async } from '@angular/core/testing';
33
import { ReflectiveInjector, Provider, PlatformRef, NgModule, Compiler, ApplicationRef, CompilerFactory } from '@angular/core';
44
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from './angularfire2';
55
import { Subscription } from 'rxjs/Subscription';
6-
import { COMMON_CONFIG } from '../test-config';
6+
import { COMMON_CONFIG } from './test-config';
77
import { BrowserModule } from '@angular/platform-browser';
88

99
describe('angularfire', () => {

src/core/test-config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export const COMMON_CONFIG = {
3+
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
4+
authDomain: "angularfire2-test.firebaseapp.com",
5+
databaseURL: "https://angularfire2-test.firebaseio.com",
6+
storageBucket: "angularfire2-test.appspot.com",
7+
};

src/database/database.module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NgModule } from '@angular/core';
22
import * as firebase from 'firebase/app';
33
import 'firebase/database';
4-
import { AngularFireModule, FirebaseApp } from '../core';
4+
import { AngularFireModule, FirebaseApp } from 'angularfire2';
55
import { AngularFireDatabase } from './database';
66

77
export function _getAngularFireDatabase(app: FirebaseApp) {

src/database/database.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as firebase from 'firebase/app';
22
import 'firebase/database';
33
import { Inject, Injectable } from '@angular/core';
4-
import { FirebaseAppConfigToken, FirebaseAppConfig, FirebaseApp } from '../core';
4+
import { FirebaseAppConfigToken, FirebaseAppConfig, FirebaseApp } from 'angularfire2';
55
import { FirebaseListFactory } from './firebase_list_factory';
66
import { FirebaseListObservable } from './firebase_list_observable';
7-
import { FirebaseListFactoryOpts, FirebaseObjectFactoryOpts, PathReference } from '../interfaces';
7+
import { FirebaseListFactoryOpts, FirebaseObjectFactoryOpts, PathReference } from './interfaces';
88
import { FirebaseObjectFactory } from './firebase_object_factory';
99
import { FirebaseObjectObservable } from './firebase_object_observable';
10-
import * as utils from '../utils';
10+
import * as utils from './utils';
1111

1212
@Injectable()
1313
export class AngularFireDatabase {

src/database/firebase_list_factory.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { AngularFireDatabaseModule } from './database.module';
44
import { FirebaseListObservable } from './firebase_list_observable';
55
import { FirebaseListFactory, onChildAdded, onChildChanged, onChildRemoved, onChildUpdated } from './firebase_list_factory';
66
import { FirebaseObjectFactory } from './firebase_object_factory';
7-
import { FirebaseApp, FirebaseAppConfig, AngularFireModule} from '../angularfire2';
7+
import { FirebaseApp, FirebaseAppConfig, AngularFireModule} from 'angularfire2';
88
import { TestBed, inject } from '@angular/core/testing';
9-
import * as utils from '../utils';
10-
import { Query, AFUnwrappedDataSnapshot } from '../interfaces';
9+
import * as utils from './utils';
10+
import { Query, AFUnwrappedDataSnapshot } from './interfaces';
1111
import { Subscription, Observable, Subject } from 'rxjs';
12-
import { COMMON_CONFIG } from '../test-config';
12+
import { COMMON_CONFIG } from './test-config';
1313
import { _do } from 'rxjs/operator/do';
1414
import { map } from 'rxjs/operator/map';
1515
import { skip } from 'rxjs/operator/skip';

src/database/firebase_list_factory.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as firebase from 'firebase/app';
2-
import * as utils from '../utils';
2+
import { ZoneScheduler } from 'angularfire2';
3+
import * as utils from './utils';
34
import 'firebase/database';
4-
import { AFUnwrappedDataSnapshot } from '../interfaces';
5+
import { AFUnwrappedDataSnapshot } from './interfaces';
56
import { FirebaseListObservable } from './firebase_list_observable';
67
import { Observer } from 'rxjs/Observer';
78
import { observeOn } from 'rxjs/operator/observeOn';
89
import { observeQuery } from './query_observable';
9-
import { Query, FirebaseListFactoryOpts, DatabaseReference, DatabaseQuery, DatabaseSnapshot } from '../interfaces';
10+
import { Query, FirebaseListFactoryOpts, DatabaseReference, DatabaseQuery, DatabaseSnapshot } from './interfaces';
1011
import { switchMap } from 'rxjs/operator/switchMap';
1112
import { map } from 'rxjs/operator/map';
1213

@@ -186,7 +187,7 @@ function firebaseListObservable(ref: firebase.database.Reference | DatabaseQuery
186187
});
187188

188189
// TODO: should be in the subscription zone instead
189-
return observeOn.call(listObs, new utils.ZoneScheduler(Zone.current));
190+
return observeOn.call(listObs, new ZoneScheduler(Zone.current));
190191
}
191192

192193
export function onChildAdded(arr:any[], child:any, toKey:(element:any)=>string, prevKey:string): any[] {

src/database/firebase_list_observable.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { FirebaseObjectFactory } from './firebase_object_factory';
55
import { Observer } from 'rxjs/Observer';
66
import { map } from 'rxjs/operator/map';
77
import * as firebase from 'firebase/app';
8-
import { unwrapMapFn } from '../utils';
9-
import { FirebaseApp, FirebaseAppConfig, AngularFireModule} from '../angularfire2';
8+
import { unwrapMapFn } from './utils';
9+
import { FirebaseApp, FirebaseAppConfig, AngularFireModule} from 'angularfire2';
1010
import { TestBed, inject } from '@angular/core/testing';
11-
import { COMMON_CONFIG } from '../test-config';
11+
import { COMMON_CONFIG } from './test-config';
1212

1313
describe('FirebaseListObservable', () => {
1414
let O: FirebaseListObservable<any>;

src/database/firebase_list_observable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { Subscriber } from 'rxjs/Subscriber';
44
import { Subscription } from 'rxjs/Subscription';
55
import * as firebase from 'firebase/app';
66
import 'firebase/database';
7-
import * as utils from '../utils';
8-
import { AFUnwrappedDataSnapshot, FirebaseOperationCases, QueryReference, DatabaseSnapshot, DatabaseReference } from '../interfaces';
7+
import * as utils from './utils';
8+
import { AFUnwrappedDataSnapshot, FirebaseOperationCases, QueryReference, DatabaseSnapshot, DatabaseReference } from './interfaces';
99

1010
export type FirebaseOperation = string | firebase.database.Reference | firebase.database.DataSnapshot | AFUnwrappedDataSnapshot;
1111

src/database/firebase_object_factory.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { AngularFireDatabaseModule } from './database.module';
55
import { FirebaseObjectObservable } from './firebase_object_observable';
66
import { FirebaseObjectFactory } from './firebase_object_factory';
77
import { TestBed, inject } from '@angular/core/testing';
8-
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from '../angularfire2';
9-
import { COMMON_CONFIG } from '../test-config';
8+
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from 'angularfire2';
9+
import { COMMON_CONFIG } from './test-config';
1010

1111
describe('FirebaseObjectFactory', () => {
1212
let i = 0;

src/database/firebase_object_factory.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { FirebaseObjectObservable } from './firebase_object_observable';
2+
import { ZoneScheduler } from 'angularfire2';
23
import { Observer } from 'rxjs/Observer';
34
import { observeOn } from 'rxjs/operator/observeOn';
45
import * as firebase from 'firebase/app';
56
import 'firebase/database';
6-
import * as utils from '../utils';
7-
import { FirebaseObjectFactoryOpts, DatabaseReference } from '../interfaces';
7+
import * as utils from './utils';
8+
import { FirebaseObjectFactoryOpts, DatabaseReference } from './interfaces';
89

910
export function FirebaseObjectFactory (
1011
ref: DatabaseReference,
@@ -21,5 +22,5 @@ export function FirebaseObjectFactory (
2122
}, ref);
2223

2324
// TODO: should be in the subscription zone instead
24-
return observeOn.call(objectObservable, new utils.ZoneScheduler(Zone.current));
25+
return observeOn.call(objectObservable, new ZoneScheduler(Zone.current));
2526
}

src/database/firebase_object_observable.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { TestBed, inject } from '@angular/core/testing';
2-
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from '../angularfire2';
3-
import { COMMON_CONFIG } from '../test-config';
2+
import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from 'angularfire2';
3+
import { COMMON_CONFIG } from './test-config';
44
import { AngularFireDatabase } from './database';
55
import { AngularFireDatabaseModule } from './database.module';
66
import { FirebaseObjectObservable } from './firebase_object_observable';
File renamed without changes.

src/database/package.json

+30-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
{ "main": "../bundles/angularfire2.umd.js" }
1+
{
2+
"name": "angularfire2/database",
3+
"version": "ANGULARFIRE2_VERSION",
4+
"description": "The database module",
5+
"main": "../bundles/database.umd.js",
6+
"module": "index.js",
7+
"es2015": "./es2015/index.js",
8+
"keywords": [
9+
"angular",
10+
"firebase",
11+
"rxjs"
12+
],
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/angular/angularfire2.git"
16+
},
17+
"author": "angular,firebase",
18+
"license": "MIT",
19+
"peerDependencies": {
20+
"angularfire2": "ANGULARFIRE2_VERSION",
21+
"@angular/common": "ANGULAR_VERSION",
22+
"@angular/core": "ANGULAR_VERSION",
23+
"@angular/platform-browser": "ANGULAR_VERSION",
24+
"@angular/platform-browser-dynamic": "ANGULAR_VERSION",
25+
"firebase": "FIREBASE_VERSION",
26+
"rxjs": "RXJS_VERSION",
27+
"zone.js": "ZONEJS_VERSION"
28+
},
29+
"typings": "index.d.ts"
30+
}

src/database/query_observable.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Observable } from 'rxjs/Observable';
22
import { Observer } from 'rxjs/Observer';
33
import { Subject } from 'rxjs/Subject';
4-
import { Query, ScalarQuery } from '../interfaces';
4+
import { Query, ScalarQuery } from './interfaces';
55
import { getOrderObservables, observeQuery } from './query_observable';
66

77
function scalarQueryTest(query: ScalarQuery, done: any) {

src/database/query_observable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { combineLatest } from 'rxjs/operator/combineLatest';
66
import { merge } from 'rxjs/operator/merge';
77
import { map } from 'rxjs/operator/map';
88
import { auditTime } from 'rxjs/operator/auditTime';
9-
import { Query, ScalarQuery, OrderByOptions, OrderBySelection, LimitToOptions, LimitToSelection, Primitive } from '../interfaces';
10-
import { hasKey, isNil } from '../utils';
9+
import { Query, ScalarQuery, OrderByOptions, OrderBySelection, LimitToOptions, LimitToSelection, Primitive } from './interfaces';
10+
import { hasKey, isNil } from './utils';
1111

1212
export function observeQuery(query: Query, audit: boolean = true): Observable<ScalarQuery> {
1313
if (isNil(query)) {

src/database/test-config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export const COMMON_CONFIG = {
3+
apiKey: "AIzaSyBVSy3YpkVGiKXbbxeK0qBnu3-MNZ9UIjA",
4+
authDomain: "angularfire2-test.firebaseapp.com",
5+
databaseURL: "https://angularfire2-test.firebaseio.com",
6+
storageBucket: "angularfire2-test.appspot.com",
7+
};

src/database/tsconfig-build.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"experimentalDecorators": true,
5+
"emitDecoratorMetadata": true,
6+
"module": "es2015",
7+
"target": "es2015",
8+
"noImplicitAny": false,
9+
"outDir": "../../dist/packages-dist/database/es2015",
10+
"rootDir": ".",
11+
"sourceMap": true,
12+
"inlineSources": true,
13+
"declaration": false,
14+
"removeComments": true,
15+
"strictNullChecks": true,
16+
"lib": [
17+
"es2015",
18+
"dom"
19+
],
20+
"skipLibCheck": true,
21+
"moduleResolution": "node",
22+
"paths": {
23+
"angularfire2": ["../../dist/packages-dist"]
24+
}
25+
},
26+
"files": [
27+
"index.ts",
28+
"../../node_modules/zone.js/dist/zone.js.d.ts"
29+
],
30+
"angularCompilerOptions": {
31+
"skipTemplateCodegen": true,
32+
"strictMetadataEmit": true,
33+
"enableSummariesForJit": false
34+
}
35+
}
36+

src/database/tsconfig-esm.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig-build.json",
3+
"compilerOptions": {
4+
"target": "es5",
5+
"outDir": "../../dist/packages-dist/database",
6+
"declaration": true
7+
}
8+
}

src/utils.ts renamed to src/database/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Subscription } from 'rxjs/Subscription';
33
import { Scheduler } from 'rxjs/Scheduler';
44
import { queue } from 'rxjs/scheduler/queue';
55
import { AFUnwrappedDataSnapshot, PathReference, DatabaseReference } from './interfaces';
6-
import { FirebaseApp } from './app/index';
6+
import { FirebaseApp } from 'angularfire2';
77

88
const REGEX_ABSOLUTE_URL = /^[a-z]+:\/\/.*/;
99

src/test-root.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ import './database/firebase_list_observable.spec';
55
import './database/firebase_object_observable.spec';
66
import './database/query_observable.spec';
77
import './auth/auth.spec';
8-

tools/build.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const GLOBALS = {
1212
'rxjs/observable/merge': 'Rx.Observable',
1313
'rxjs/operator/share': 'Rx.Observable.prototype',
1414
'rxjs/operator/observeOn': 'Rx.Observable.prototype',
15+
'rxjs/observable/of': 'Rx.Observable.prototype',
16+
'rxjs/operator/combineLatest': 'Rx.Observable.prototype',
17+
'rxjs/operator/merge': 'Rx.Observable.prototype',
18+
'rxjs/operator/map': 'Rx.Observable.prototype',
19+
'rxjs/operator/auditTime': 'Rx.Observable.prototype',
20+
'rxjs/operator/switchMap': 'Rx.Observable.prototype',
1521
'rxjs/operator': 'Rx.Observable.prototype',
1622
'@angular/core': 'ng.core',
1723
'@angular/compiler': 'ng.compiler',
@@ -102,9 +108,11 @@ function buildModule(name, globals) {
102108
function buildLibrary(globals) {
103109
const core$ = buildModule('core', globals);
104110
const auth$ = buildModule('auth', globals);
111+
const db$ = buildModule('database', globals);
105112
return Observable
106113
.forkJoin(core$)
107-
.switchMapTo(auth$);
114+
.switchMapTo(auth$)
115+
.switchMapTo(db$);
108116
}
109117

110118
const $lib = buildLibrary(GLOBALS).subscribe(

0 commit comments

Comments
 (0)