UNPKG

7.98 kBJavaScriptView Raw
1import { ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, VERSION, ɵAngularFireSchedulers, ɵzoneWrap } from '@angular/fire';
2import { timer, from } from 'rxjs';
3import { concatMap, distinct } from 'rxjs/operators';
4import * as i0 from '@angular/core';
5import { InjectionToken, Optional, NgModule, NgZone, Injector } from '@angular/core';
6import { AuthInstances } from '@angular/fire/auth';
7import { FirebaseApp, FirebaseApps } from '@angular/fire/app';
8import { registerVersion } from 'firebase/app';
9import { AppCheckInstances } from '@angular/fire/app-check';
10import { fromRef as fromRef$1, stateChanges as stateChanges$1, list as list$1, listVal as listVal$1, auditTrail as auditTrail$1, object as object$1, objectVal as objectVal$1, changeToData as changeToData$1 } from 'rxfire/database';
11export { ListenEvent, ListenerMethods } from 'rxfire/database';
12import { child as child$1, connectDatabaseEmulator as connectDatabaseEmulator$1, enableLogging as enableLogging$1, endAt as endAt$1, endBefore as endBefore$1, equalTo as equalTo$1, get as get$1, getDatabase as getDatabase$1, goOffline as goOffline$1, goOnline as goOnline$1, increment as increment$1, limitToFirst as limitToFirst$1, limitToLast as limitToLast$1, off as off$1, onChildAdded as onChildAdded$1, onChildChanged as onChildChanged$1, onChildMoved as onChildMoved$1, onChildRemoved as onChildRemoved$1, onDisconnect as onDisconnect$1, onValue as onValue$1, orderByChild as orderByChild$1, orderByKey as orderByKey$1, orderByPriority as orderByPriority$1, orderByValue as orderByValue$1, push as push$1, query as query$1, ref as ref$1, refFromURL as refFromURL$1, remove as remove$1, runTransaction as runTransaction$1, serverTimestamp as serverTimestamp$1, set as set$1, setPriority as setPriority$1, setWithPriority as setWithPriority$1, startAfter as startAfter$1, startAt as startAt$1, update as update$1 } from 'firebase/database';
13export * from 'firebase/database';
14
15class Database {
16 constructor(database) {
17 return database;
18 }
19}
20const DATABASE_PROVIDER_NAME = 'database';
21class DatabaseInstances {
22 constructor() {
23 return ɵgetAllInstancesOf(DATABASE_PROVIDER_NAME);
24 }
25}
26const databaseInstance$ = timer(0, 300).pipe(concatMap(() => from(ɵgetAllInstancesOf(DATABASE_PROVIDER_NAME))), distinct());
27
28const PROVIDED_DATABASE_INSTANCES = new InjectionToken('angularfire2.database-instances');
29function defaultDatabaseInstanceFactory(provided, defaultApp) {
30 const defaultDatabase = ɵgetDefaultInstanceOf(DATABASE_PROVIDER_NAME, provided, defaultApp);
31 return defaultDatabase && new Database(defaultDatabase);
32}
33function databaseInstanceFactory(fn) {
34 return (zone, injector) => {
35 const database = zone.runOutsideAngular(() => fn(injector));
36 return new Database(database);
37 };
38}
39const DATABASE_INSTANCES_PROVIDER = {
40 provide: DatabaseInstances,
41 deps: [
42 [new Optional(), PROVIDED_DATABASE_INSTANCES],
43 ]
44};
45const DEFAULT_DATABASE_INSTANCE_PROVIDER = {
46 provide: Database,
47 useFactory: defaultDatabaseInstanceFactory,
48 deps: [
49 [new Optional(), PROVIDED_DATABASE_INSTANCES],
50 FirebaseApp,
51 ]
52};
53class DatabaseModule {
54 constructor() {
55 registerVersion('angularfire', VERSION.full, 'rtdb');
56 }
57}
58DatabaseModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: DatabaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
59DatabaseModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: DatabaseModule });
60DatabaseModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: DatabaseModule, providers: [
61 DEFAULT_DATABASE_INSTANCE_PROVIDER,
62 DATABASE_INSTANCES_PROVIDER,
63 ] });
64i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.3", ngImport: i0, type: DatabaseModule, decorators: [{
65 type: NgModule,
66 args: [{
67 providers: [
68 DEFAULT_DATABASE_INSTANCE_PROVIDER,
69 DATABASE_INSTANCES_PROVIDER,
70 ]
71 }]
72 }], ctorParameters: function () { return []; } });
73function provideDatabase(fn, ...deps) {
74 return {
75 ngModule: DatabaseModule,
76 providers: [{
77 provide: PROVIDED_DATABASE_INSTANCES,
78 useFactory: databaseInstanceFactory(fn),
79 multi: true,
80 deps: [
81 NgZone,
82 Injector,
83 ɵAngularFireSchedulers,
84 FirebaseApps,
85 // Database+Auth work better if Auth is loaded first
86 [new Optional(), AuthInstances],
87 [new Optional(), AppCheckInstances],
88 ...deps,
89 ]
90 }]
91 };
92}
93
94// DO NOT MODIFY, this file is autogenerated by tools/build.ts
95const fromRef = ɵzoneWrap(fromRef$1, true);
96const stateChanges = ɵzoneWrap(stateChanges$1, true);
97const list = ɵzoneWrap(list$1, true);
98const listVal = ɵzoneWrap(listVal$1, true);
99const auditTrail = ɵzoneWrap(auditTrail$1, true);
100const object = ɵzoneWrap(object$1, true);
101const objectVal = ɵzoneWrap(objectVal$1, true);
102const changeToData = ɵzoneWrap(changeToData$1, true);
103
104// DO NOT MODIFY, this file is autogenerated by tools/build.ts
105const child = ɵzoneWrap(child$1, true);
106const connectDatabaseEmulator = ɵzoneWrap(connectDatabaseEmulator$1, true);
107const enableLogging = ɵzoneWrap(enableLogging$1, true);
108const endAt = ɵzoneWrap(endAt$1, true);
109const endBefore = ɵzoneWrap(endBefore$1, true);
110const equalTo = ɵzoneWrap(equalTo$1, true);
111const get = ɵzoneWrap(get$1, true);
112const getDatabase = ɵzoneWrap(getDatabase$1, true);
113const goOffline = ɵzoneWrap(goOffline$1, true);
114const goOnline = ɵzoneWrap(goOnline$1, true);
115const increment = ɵzoneWrap(increment$1, true);
116const limitToFirst = ɵzoneWrap(limitToFirst$1, true);
117const limitToLast = ɵzoneWrap(limitToLast$1, true);
118const off = ɵzoneWrap(off$1, true);
119const onChildAdded = ɵzoneWrap(onChildAdded$1, true);
120const onChildChanged = ɵzoneWrap(onChildChanged$1, true);
121const onChildMoved = ɵzoneWrap(onChildMoved$1, true);
122const onChildRemoved = ɵzoneWrap(onChildRemoved$1, true);
123const onDisconnect = ɵzoneWrap(onDisconnect$1, true);
124const onValue = ɵzoneWrap(onValue$1, true);
125const orderByChild = ɵzoneWrap(orderByChild$1, true);
126const orderByKey = ɵzoneWrap(orderByKey$1, true);
127const orderByPriority = ɵzoneWrap(orderByPriority$1, true);
128const orderByValue = ɵzoneWrap(orderByValue$1, true);
129const push = ɵzoneWrap(push$1, true);
130const query = ɵzoneWrap(query$1, true);
131const ref = ɵzoneWrap(ref$1, true);
132const refFromURL = ɵzoneWrap(refFromURL$1, true);
133const remove = ɵzoneWrap(remove$1, true);
134const runTransaction = ɵzoneWrap(runTransaction$1, true);
135const serverTimestamp = ɵzoneWrap(serverTimestamp$1, true);
136const set = ɵzoneWrap(set$1, true);
137const setPriority = ɵzoneWrap(setPriority$1, true);
138const setWithPriority = ɵzoneWrap(setWithPriority$1, true);
139const startAfter = ɵzoneWrap(startAfter$1, true);
140const startAt = ɵzoneWrap(startAt$1, true);
141const update = ɵzoneWrap(update$1, true);
142
143/**
144 * Generated bundle index. Do not edit.
145 */
146
147export { Database, DatabaseInstances, DatabaseModule, auditTrail, changeToData, child, connectDatabaseEmulator, databaseInstance$, enableLogging, endAt, endBefore, equalTo, fromRef, get, getDatabase, goOffline, goOnline, increment, limitToFirst, limitToLast, list, listVal, object, objectVal, off, onChildAdded, onChildChanged, onChildMoved, onChildRemoved, onDisconnect, onValue, orderByChild, orderByKey, orderByPriority, orderByValue, provideDatabase, push, query, ref, refFromURL, remove, runTransaction, serverTimestamp, set, setPriority, setWithPriority, startAfter, startAt, stateChanges, update };
148//# sourceMappingURL=angular-fire-database.js.map