@angular/fire 19.0.0-canary.45ccd39 → 19.0.0-canary.8ce95bf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -28
- package/compat/auth/auth.d.ts +1 -0
- package/compat/database/database.d.ts +1 -0
- package/compat/database/list/create-reference.d.ts +2 -1
- package/compat/database/object/create-reference.d.ts +2 -1
- package/compat/firestore/collection/collection.d.ts +1 -0
- package/compat/firestore/collection-group/collection-group.d.ts +1 -0
- package/compat/firestore/document/document.d.ts +1 -0
- package/compat/firestore/firestore.d.ts +1 -0
- package/compat/remote-config/remote-config.d.ts +1 -0
- package/compat/storage/ref.d.ts +2 -1
- package/compat/storage/storage.d.ts +1 -0
- package/docs/zones.md +21 -0
- package/fesm2022/angular-fire-compat-auth.mjs +3 -2
- package/fesm2022/angular-fire-compat-auth.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-database.mjs +12 -11
- package/fesm2022/angular-fire-compat-database.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-firestore.mjs +18 -14
- package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-remote-config.mjs +3 -2
- package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -1
- package/fesm2022/angular-fire-compat-storage.mjs +9 -8
- package/fesm2022/angular-fire-compat-storage.mjs.map +1 -1
- package/fesm2022/angular-fire.mjs +2 -2
- package/fesm2022/angular-fire.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPlatformServer } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { inject, EnvironmentInjector, InjectionToken, NgZone, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/fire';
|
|
5
5
|
import { VERSION } from '@angular/fire';
|
|
6
6
|
import * as i3 from '@angular/fire/app-check';
|
|
@@ -77,6 +77,7 @@ function fromCollectionRef(ref, scheduler) {
|
|
|
77
77
|
class AngularFirestoreDocument {
|
|
78
78
|
ref;
|
|
79
79
|
afs;
|
|
80
|
+
injector = inject(EnvironmentInjector);
|
|
80
81
|
/**
|
|
81
82
|
* The constructor takes in a DocumentReference to provide wrapper methods
|
|
82
83
|
* for data operations, data streaming, and Symbol.observable.
|
|
@@ -117,7 +118,7 @@ class AngularFirestoreDocument {
|
|
|
117
118
|
*/
|
|
118
119
|
snapshotChanges() {
|
|
119
120
|
const scheduledFromDocRef$ = fromDocRef(this.ref, this.afs.schedulers.outsideAngular);
|
|
120
|
-
return scheduledFromDocRef$.pipe(pendingUntilEvent());
|
|
121
|
+
return scheduledFromDocRef$.pipe(pendingUntilEvent(this.injector));
|
|
121
122
|
}
|
|
122
123
|
valueChanges(options = {}) {
|
|
123
124
|
return this.snapshotChanges().pipe(map(({ payload }) => options.idField ? {
|
|
@@ -129,7 +130,7 @@ class AngularFirestoreDocument {
|
|
|
129
130
|
* Retrieve the document once.
|
|
130
131
|
*/
|
|
131
132
|
get(options) {
|
|
132
|
-
return from(this.ref.get(options)).pipe(pendingUntilEvent());
|
|
133
|
+
return from(this.ref.get(options)).pipe(pendingUntilEvent(this.injector));
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -272,6 +273,7 @@ class AngularFirestoreCollection {
|
|
|
272
273
|
ref;
|
|
273
274
|
query;
|
|
274
275
|
afs;
|
|
276
|
+
injector = inject(EnvironmentInjector);
|
|
275
277
|
/**
|
|
276
278
|
* The constructor takes in a CollectionReference and Query to provide wrapper methods
|
|
277
279
|
* for data operations and data streaming.
|
|
@@ -299,7 +301,7 @@ class AngularFirestoreCollection {
|
|
|
299
301
|
return source.pipe(
|
|
300
302
|
// We want to filter out empty arrays, but always emit at first, so the developer knows
|
|
301
303
|
// that the collection has been resolve; even if it's empty
|
|
302
|
-
startWith(undefined), pairwise(), filter(([prior, current]) => current.length > 0 || !prior), map(([, current]) => current), pendingUntilEvent());
|
|
304
|
+
startWith(undefined), pairwise(), filter(([prior, current]) => current.length > 0 || !prior), map(([, current]) => current), pendingUntilEvent(this.injector));
|
|
303
305
|
}
|
|
304
306
|
/**
|
|
305
307
|
* Create a stream of changes as they occur it time. This method is similar to stateChanges()
|
|
@@ -315,7 +317,7 @@ class AngularFirestoreCollection {
|
|
|
315
317
|
snapshotChanges(events) {
|
|
316
318
|
const validatedEvents = validateEventsArray(events);
|
|
317
319
|
const scheduledSortedChanges$ = sortedChanges(this.query, validatedEvents, this.afs.schedulers.outsideAngular);
|
|
318
|
-
return scheduledSortedChanges$.pipe(pendingUntilEvent());
|
|
320
|
+
return scheduledSortedChanges$.pipe(pendingUntilEvent(this.injector));
|
|
319
321
|
}
|
|
320
322
|
valueChanges(options = {}) {
|
|
321
323
|
return fromCollectionRef(this.query, this.afs.schedulers.outsideAngular)
|
|
@@ -329,13 +331,13 @@ class AngularFirestoreCollection {
|
|
|
329
331
|
else {
|
|
330
332
|
return a.data();
|
|
331
333
|
}
|
|
332
|
-
})), pendingUntilEvent());
|
|
334
|
+
})), pendingUntilEvent(this.injector));
|
|
333
335
|
}
|
|
334
336
|
/**
|
|
335
337
|
* Retrieve the results of the query once.
|
|
336
338
|
*/
|
|
337
339
|
get(options) {
|
|
338
|
-
return from(this.query.get(options)).pipe(pendingUntilEvent());
|
|
340
|
+
return from(this.query.get(options)).pipe(pendingUntilEvent(this.injector));
|
|
339
341
|
}
|
|
340
342
|
/**
|
|
341
343
|
* Add data to a collection reference.
|
|
@@ -377,6 +379,7 @@ class AngularFirestoreCollection {
|
|
|
377
379
|
class AngularFirestoreCollectionGroup {
|
|
378
380
|
query;
|
|
379
381
|
afs;
|
|
382
|
+
injector = inject(EnvironmentInjector);
|
|
380
383
|
/**
|
|
381
384
|
* The constructor takes in a CollectionGroupQuery to provide wrapper methods
|
|
382
385
|
* for data operations and data streaming.
|
|
@@ -392,10 +395,10 @@ class AngularFirestoreCollectionGroup {
|
|
|
392
395
|
*/
|
|
393
396
|
stateChanges(events) {
|
|
394
397
|
if (!events || events.length === 0) {
|
|
395
|
-
return docChanges(this.query, this.afs.schedulers.outsideAngular).pipe(pendingUntilEvent());
|
|
398
|
+
return docChanges(this.query, this.afs.schedulers.outsideAngular).pipe(pendingUntilEvent(this.injector));
|
|
396
399
|
}
|
|
397
400
|
return docChanges(this.query, this.afs.schedulers.outsideAngular)
|
|
398
|
-
.pipe(map(actions => actions.filter(change => events.indexOf(change.type) > -1)), filter(changes => changes.length > 0), pendingUntilEvent());
|
|
401
|
+
.pipe(map(actions => actions.filter(change => events.indexOf(change.type) > -1)), filter(changes => changes.length > 0), pendingUntilEvent(this.injector));
|
|
399
402
|
}
|
|
400
403
|
/**
|
|
401
404
|
* Create a stream of changes as they occur it time. This method is similar to stateChanges()
|
|
@@ -411,7 +414,7 @@ class AngularFirestoreCollectionGroup {
|
|
|
411
414
|
snapshotChanges(events) {
|
|
412
415
|
const validatedEvents = validateEventsArray(events);
|
|
413
416
|
const scheduledSortedChanges$ = sortedChanges(this.query, validatedEvents, this.afs.schedulers.outsideAngular);
|
|
414
|
-
return scheduledSortedChanges$.pipe(pendingUntilEvent());
|
|
417
|
+
return scheduledSortedChanges$.pipe(pendingUntilEvent(this.injector));
|
|
415
418
|
}
|
|
416
419
|
valueChanges(options = {}) {
|
|
417
420
|
const fromCollectionRefScheduled$ = fromCollectionRef(this.query, this.afs.schedulers.outsideAngular);
|
|
@@ -426,13 +429,13 @@ class AngularFirestoreCollectionGroup {
|
|
|
426
429
|
else {
|
|
427
430
|
return a.data();
|
|
428
431
|
}
|
|
429
|
-
})), pendingUntilEvent());
|
|
432
|
+
})), pendingUntilEvent(this.injector));
|
|
430
433
|
}
|
|
431
434
|
/**
|
|
432
435
|
* Retrieve the results of the query once.
|
|
433
436
|
*/
|
|
434
437
|
get(options) {
|
|
435
|
-
return from(this.query.get(options)).pipe(pendingUntilEvent());
|
|
438
|
+
return from(this.query.get(options)).pipe(pendingUntilEvent(this.injector));
|
|
436
439
|
}
|
|
437
440
|
}
|
|
438
441
|
|
|
@@ -519,6 +522,7 @@ class AngularFirestore {
|
|
|
519
522
|
schedulers;
|
|
520
523
|
firestore;
|
|
521
524
|
persistenceEnabled$;
|
|
525
|
+
ngZone = inject(NgZone);
|
|
522
526
|
/**
|
|
523
527
|
* Each Feature of AngularFire has a FirebaseApp injected. This way we
|
|
524
528
|
* don't rely on the main Firebase App instance and we can create named
|
|
@@ -572,7 +576,7 @@ class AngularFirestore {
|
|
|
572
576
|
collectionRef = pathOrRef;
|
|
573
577
|
}
|
|
574
578
|
const { ref, query } = associateQuery(collectionRef, queryFn);
|
|
575
|
-
const refInZone =
|
|
579
|
+
const refInZone = this.ngZone.run(() => ref);
|
|
576
580
|
return new AngularFirestoreCollection(refInZone, query, this);
|
|
577
581
|
}
|
|
578
582
|
/**
|
|
@@ -593,7 +597,7 @@ class AngularFirestore {
|
|
|
593
597
|
else {
|
|
594
598
|
ref = pathOrRef;
|
|
595
599
|
}
|
|
596
|
-
const refInZone =
|
|
600
|
+
const refInZone = this.ngZone.run(() => ref);
|
|
597
601
|
return new AngularFirestoreDocument(refInZone, this);
|
|
598
602
|
}
|
|
599
603
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fire-compat-firestore.mjs","sources":["../../../src/compat/firestore/observable/fromRef.ts","../../../src/compat/firestore/document/document.ts","../../../src/compat/firestore/collection/changes.ts","../../../src/compat/firestore/collection/collection.ts","../../../src/compat/firestore/collection-group/collection-group.ts","../../../src/compat/firestore/firestore.ts","../../../src/compat/firestore/firestore.module.ts","../../../src/compat/firestore/angular-fire-compat-firestore.ts"],"sourcesContent":["import { Observable, SchedulerLike, asyncScheduler } from 'rxjs';\nimport { map, pairwise, startWith } from 'rxjs/operators';\nimport { Action, DocumentReference, DocumentSnapshot, Query, QuerySnapshot, Reference } from '../interfaces';\n\nfunction _fromRef<R>(ref: Reference, scheduler: SchedulerLike = asyncScheduler): Observable<R> {\n return new Observable(subscriber => {\n let unsubscribe: () => void;\n if (scheduler != null) {\n scheduler.schedule(() => {\n unsubscribe = ref.onSnapshot({ includeMetadataChanges: true }, subscriber);\n });\n } else {\n unsubscribe = ref.onSnapshot({ includeMetadataChanges: true }, subscriber);\n }\n\n return () => {\n if (unsubscribe != null) {\n unsubscribe();\n }\n };\n });\n}\n\nexport function fromRef<R, T>(ref: DocumentReference<T> | Query<T>, scheduler?: SchedulerLike) {\n return _fromRef<R>(ref, scheduler);\n}\n\nexport function fromDocRef<T>(ref: DocumentReference<T>, scheduler?: SchedulerLike): Observable<Action<DocumentSnapshot<T>>> {\n return fromRef<DocumentSnapshot<T>, T>(ref, scheduler)\n .pipe(\n startWith<DocumentSnapshot<T>, undefined>(undefined),\n pairwise(),\n map((snapshots: [DocumentSnapshot<T>, DocumentSnapshot<T>]) => {\n const [priorPayload, payload] = snapshots;\n if (!payload.exists) {\n return { payload, type: 'removed' };\n }\n if (!priorPayload?.exists) {\n return { payload, type: 'added' };\n }\n return { payload, type: 'modified' };\n })\n );\n}\n\nexport function fromCollectionRef<T>(ref: Query<T>, scheduler?: SchedulerLike): Observable<Action<QuerySnapshot<T>>> {\n return fromRef<QuerySnapshot<T>, T>(ref, scheduler).pipe(map(payload => ({ payload, type: 'query' })));\n}\n","import { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { AngularFirestoreCollection } from '../collection/collection';\nimport { AngularFirestore, associateQuery } from '../firestore';\nimport { Action, DocumentData, DocumentReference, DocumentSnapshot, QueryFn, SetOptions } from '../interfaces';\nimport { fromDocRef } from '../observable/fromRef';\n\n/**\n * AngularFirestoreDocument service\n *\n * This class creates a reference to a Firestore Document. A reference is provided in\n * in the constructor. The class is generic which gives you type safety for data update\n * methods and data streaming.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const fakeStock = new AngularFirestoreDocument<Stock>(doc('stocks/FAKE'));\n * await fakeStock.set({ name: 'FAKE', price: 0.01 });\n * fakeStock.valueChanges().map(snap => {\n * if(snap.exists) return snap.data();\n * return null;\n * }).subscribe(value => console.log(value));\n * // OR! Transform using Observable.from() and the data is unwrapped for you\n * Observable.from(fakeStock).subscribe(value => console.log(value));\n */\nexport class AngularFirestoreDocument<T = DocumentData> {\n\n /**\n * The constructor takes in a DocumentReference to provide wrapper methods\n * for data operations, data streaming, and Symbol.observable.\n */\n constructor(public ref: DocumentReference<T>, private afs: AngularFirestore) { }\n\n /**\n * Create or overwrite a single document.\n */\n set(data: T, options?: SetOptions): Promise<void> {\n return this.ref.set(data, options);\n }\n\n /**\n * Update some fields of a document without overwriting the entire document.\n */\n update(data: Partial<T>): Promise<void> {\n return this.ref.update(data);\n }\n\n /**\n * Delete a document.\n */\n delete(): Promise<void> {\n return this.ref.delete();\n }\n\n /**\n * Create a reference to a sub-collection given a path and an optional query\n * function.\n */\n collection<R = DocumentData>(path: string, queryFn?: QueryFn): AngularFirestoreCollection<R> {\n const collectionRef = this.ref.collection(path) as firebase.firestore.CollectionReference<R>;\n const { ref, query } = associateQuery(collectionRef, queryFn);\n return new AngularFirestoreCollection(ref, query, this.afs);\n }\n\n /**\n * Listen to snapshot updates from the document.\n */\n snapshotChanges(): Observable<Action<DocumentSnapshot<T>>> {\n const scheduledFromDocRef$ = fromDocRef<T>(this.ref, this.afs.schedulers.outsideAngular);\n return scheduledFromDocRef$.pipe(\n pendingUntilEvent()\n );\n }\n\n /**\n * Listen to unwrapped snapshot updates from the document.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(options?: unknown): Observable<T | undefined>;\n valueChanges<K extends string>(options: { idField: K }): Observable<(T & { [T in K]: string }) | undefined>;\n valueChanges<K extends string>(options: { idField?: K } = {}): Observable<T | undefined> {\n return this.snapshotChanges().pipe(\n map(({ payload }) =>\n options.idField ? {\n ...payload.data(),\n ...{ [options.idField]: payload.id }\n } as T & { [T in K]: string } : payload.data()\n )\n );\n }\n\n /**\n * Retrieve the document once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.ref.get(options)).pipe(\n pendingUntilEvent(),\n );\n }\n}\n","import firebase from 'firebase/compat/app';\nimport { Observable, SchedulerLike } from 'rxjs';\nimport { distinctUntilChanged, map, pairwise, scan, startWith } from 'rxjs/operators';\nimport { Action, DocumentChange, DocumentChangeAction, DocumentChangeType, Query, QuerySnapshot } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\n\n\ntype ActionTupe = [Action<QuerySnapshot<firebase.firestore.DocumentData>>, Action<QuerySnapshot<firebase.firestore.DocumentData>>]\n/**\n * Return a stream of document changes on a query. These results are not in sort order but in\n * order of occurence.\n */\nexport function docChanges<T>(query: Query, scheduler?: SchedulerLike): Observable<DocumentChangeAction<T>[]> {\n return fromCollectionRef(query, scheduler)\n .pipe(\n startWith<Action<QuerySnapshot<firebase.firestore.DocumentData>>, undefined>(undefined),\n pairwise(),\n map((actionTuple: ActionTupe) => {\n const [priorAction, action] = actionTuple;\n const docChanges = action.payload.docChanges();\n const actions = docChanges.map(change => ({ type: change.type, payload: change }));\n // the metadata has changed from the prior emission\n if (priorAction && JSON.stringify(priorAction.payload.metadata) !== JSON.stringify(action.payload.metadata)) {\n // go through all the docs in payload and figure out which ones changed\n action.payload.docs.forEach((currentDoc, currentIndex) => {\n const docChange = docChanges.find(d => d.doc.ref.isEqual(currentDoc.ref));\n const priorDoc = priorAction?.payload.docs.find(d => d.ref.isEqual(currentDoc.ref));\n if (docChange && JSON.stringify(docChange.doc.metadata) === JSON.stringify(currentDoc.metadata) ||\n !docChange && priorDoc && JSON.stringify(priorDoc.metadata) === JSON.stringify(currentDoc.metadata)) {\n // document doesn't appear to have changed, don't log another action\n } else {\n // since the actions are processed in order just push onto the array\n actions.push({\n type: 'modified',\n payload: {\n oldIndex: currentIndex,\n newIndex: currentIndex,\n type: 'modified',\n doc: currentDoc\n }\n });\n }\n });\n }\n return actions as DocumentChangeAction<T>[];\n }),\n );\n}\n\n/**\n * Return a stream of document changes on a query. These results are in sort order.\n */\nexport function sortedChanges<T>(\n query: Query,\n events: DocumentChangeType[],\n scheduler?: SchedulerLike): Observable<DocumentChangeAction<T>[]> {\n return docChanges<T>(query, scheduler)\n .pipe(\n scan((current, changes) => combineChanges<T>(current, changes.map(it => it.payload), events), []),\n distinctUntilChanged(), // cut down on unneed change cycles\n map(changes => changes.map(c => ({ type: c.type, payload: c } as DocumentChangeAction<T>))));\n}\n\n/**\n * Combines the total result set from the current set of changes from an incoming set\n * of changes.\n */\nexport function combineChanges<T>(current: DocumentChange<T>[], changes: DocumentChange<T>[], events: DocumentChangeType[]) {\n changes.forEach(change => {\n // skip unwanted change types\n if (events.indexOf(change.type) > -1) {\n current = combineChange(current, change);\n }\n });\n return current;\n}\n\n/**\n * Splice arguments on top of a sliced array, to break top-level ===\n * this is useful for change-detection\n */\nfunction sliceAndSplice<T>(\n original: T[],\n start: number,\n deleteCount: number,\n ...args: T[]\n): T[] {\n const returnArray = original.slice();\n returnArray.splice(start, deleteCount, ...args);\n return returnArray;\n}\n\n/**\n * Creates a new sorted array from a new change.\n * Build our own because we allow filtering of action types ('added', 'removed', 'modified') before scanning\n * and so we have greater control over change detection (by breaking ===)\n */\nexport function combineChange<T>(combined: DocumentChange<T>[], change: DocumentChange<T>): DocumentChange<T>[] {\n switch (change.type) {\n case 'added':\n if (combined[change.newIndex]?.doc.ref.isEqual(change.doc.ref)) {\n // Not sure why the duplicates are getting fired\n } else {\n return sliceAndSplice(combined, change.newIndex, 0, change);\n }\n break;\n case 'modified':\n if (combined[change.oldIndex] == null || combined[change.oldIndex].doc.ref.isEqual(change.doc.ref)) {\n // When an item changes position we first remove it\n // and then add it's new position\n if (change.oldIndex !== change.newIndex) {\n const copiedArray = combined.slice();\n copiedArray.splice(change.oldIndex, 1);\n copiedArray.splice(change.newIndex, 0, change);\n return copiedArray;\n } else {\n return sliceAndSplice(combined, change.newIndex, 1, change);\n }\n }\n break;\n case 'removed':\n if (combined[change.oldIndex]?.doc.ref.isEqual(change.doc.ref)) {\n return sliceAndSplice(combined, change.oldIndex, 1);\n }\n break;\n }\n return combined;\n}\n","import { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { filter, map, pairwise, scan, startWith } from 'rxjs/operators';\nimport { AngularFirestoreDocument } from '../document/document';\nimport { AngularFirestore } from '../firestore';\nimport { CollectionReference, DocumentChangeAction, DocumentChangeType, DocumentData, DocumentReference, Query } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\nimport { docChanges, sortedChanges } from './changes';\n\ntype DocumentChangeTuple<T> = [DocumentChangeAction<T>[], DocumentChangeAction<T>[]];\n\nexport function validateEventsArray(events?: DocumentChangeType[]) {\n if (!events || events.length === 0) {\n events = ['added', 'removed', 'modified'];\n }\n return events;\n}\n\n/**\n * AngularFirestoreCollection service\n *\n * This class creates a reference to a Firestore Collection. A reference and a query are provided in\n * in the constructor. The query can be the unqueried reference if no query is desired.The class\n * is generic which gives you type safety for data update methods and data streaming.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const collectionRef = firebase.firestore.collection('stocks');\n * const query = collectionRef.where('price', '>', '0.01');\n * const fakeStock = new AngularFirestoreCollection<Stock>(collectionRef, query);\n *\n * // NOTE!: the updates are performed on the reference not the query\n * await fakeStock.add({ name: 'FAKE', price: 0.01 });\n *\n * // Subscribe to changes as snapshots. This provides you data updates as well as delta updates.\n * fakeStock.valueChanges().subscribe(value => console.log(value));\n */\nexport class AngularFirestoreCollection<T = DocumentData> {\n /**\n * The constructor takes in a CollectionReference and Query to provide wrapper methods\n * for data operations and data streaming.\n *\n * Note: Data operation methods are done on the reference not the query. This means\n * when you update data it is not updating data to the window of your query unless\n * the data fits the criteria of the query. See the AssociatedRefence type for details\n * on this implication.\n */\n constructor(\n public readonly ref: CollectionReference<T>,\n private readonly query: Query<T>,\n private readonly afs: AngularFirestore) { }\n\n /**\n * Listen to the latest change in the stream. This method returns changes\n * as they occur and they are not sorted by query order. This allows you to construct\n * your own data structure.\n */\n stateChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n let source = docChanges<T>(this.query, this.afs.schedulers.outsideAngular);\n if (events && events.length > 0) {\n source = source.pipe(\n map(actions => actions.filter(change => events.indexOf(change.type) > -1))\n );\n }\n return source.pipe(\n // We want to filter out empty arrays, but always emit at first, so the developer knows\n // that the collection has been resolve; even if it's empty\n startWith<DocumentChangeAction<T>[], undefined>(undefined),\n pairwise(),\n filter(([prior, current]: DocumentChangeTuple<T>) => current.length > 0 || !prior),\n map(([, current]) => current),\n pendingUntilEvent()\n );\n }\n\n /**\n * Create a stream of changes as they occur it time. This method is similar to stateChanges()\n * but it collects each event in an array over time.\n */\n auditTrail(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n return this.stateChanges(events).pipe(scan((current, action) => [...current, ...action], []));\n }\n\n /**\n * Create a stream of synchronized changes. This method keeps the local array in sorted\n * query order.\n */\n snapshotChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges<T>(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(\n pendingUntilEvent()\n );\n }\n\n /**\n * Listen to all documents in the collection and its possible query as an Observable.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(): Observable<T[]>;\n // eslint-disable-next-line no-empty-pattern\n valueChanges({}): Observable<T[]>;\n valueChanges<K extends string>(options: {idField: K}): Observable<(T & { [T in K]: string })[]>;\n valueChanges<K extends string>(options: {idField?: K} = {}): Observable<T[]> {\n return fromCollectionRef<T>(this.query, this.afs.schedulers.outsideAngular)\n .pipe(\n map(actions => actions.payload.docs.map(a => {\n if (options.idField) {\n return {\n ...a.data() as any,\n ...{ [options.idField]: a.id }\n } as T & { [T in K]: string };\n } else {\n return a.data();\n }\n })),\n pendingUntilEvent()\n );\n }\n\n /**\n * Retrieve the results of the query once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.query.get(options)).pipe(\n pendingUntilEvent(),\n );\n }\n\n /**\n * Add data to a collection reference.\n *\n * Note: Data operation methods are done on the reference not the query. This means\n * when you update data it is not updating data to the window of your query unless\n * the data fits the criteria of the query.\n */\n add(data: T): Promise<DocumentReference<T>> {\n return this.ref.add(data);\n }\n\n /**\n * Create a reference to a single document in a collection.\n */\n doc<T2 = T>(path?: string): AngularFirestoreDocument<T2> {\n // TODO is there a better way to solve this type issue\n return new AngularFirestoreDocument(this.ref.doc(path) as any, this.afs);\n }\n}\n","import { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { filter, map, scan } from 'rxjs/operators';\nimport { docChanges, sortedChanges } from '../collection/changes';\nimport { validateEventsArray } from '../collection/collection';\nimport { AngularFirestore } from '../firestore';\nimport { DocumentChangeAction, DocumentChangeType, DocumentData, Query } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\n\n/**\n * AngularFirestoreCollectionGroup service\n *\n * This class holds a reference to a Firestore Collection Group Query.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const collectionGroup = firebase.firestore.collectionGroup('stocks');\n * const query = collectionRef.where('price', '>', '0.01');\n * const fakeStock = new AngularFirestoreCollectionGroup<Stock>(query, afs);\n *\n * // Subscribe to changes as snapshots. This provides you data updates as well as delta updates.\n * fakeStock.valueChanges().subscribe(value => console.log(value));\n */\nexport class AngularFirestoreCollectionGroup<T = DocumentData> {\n /**\n * The constructor takes in a CollectionGroupQuery to provide wrapper methods\n * for data operations and data streaming.\n */\n constructor(\n private readonly query: Query<T>,\n private readonly afs: AngularFirestore) { }\n\n /**\n * Listen to the latest change in the stream. This method returns changes\n * as they occur and they are not sorted by query order. This allows you to construct\n * your own data structure.\n */\n stateChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n if (!events || events.length === 0) {\n return docChanges<T>(this.query, this.afs.schedulers.outsideAngular).pipe(\n pendingUntilEvent()\n );\n }\n return docChanges<T>(this.query, this.afs.schedulers.outsideAngular)\n .pipe(\n map(actions => actions.filter(change => events.indexOf(change.type) > -1)),\n filter(changes => changes.length > 0),\n pendingUntilEvent()\n );\n }\n\n /**\n * Create a stream of changes as they occur it time. This method is similar to stateChanges()\n * but it collects each event in an array over time.\n */\n auditTrail(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n return this.stateChanges(events).pipe(scan((current, action) => [...current, ...action], []));\n }\n\n /**\n * Create a stream of synchronized changes. This method keeps the local array in sorted\n * query order.\n */\n snapshotChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges<T>(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(\n pendingUntilEvent()\n );\n }\n\n /**\n * Listen to all documents in the collection and its possible query as an Observable.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(): Observable<T[]>;\n // eslint-disable-next-line no-empty-pattern\n valueChanges({}): Observable<T[]>;\n valueChanges<K extends string>(options: {idField: K}): Observable<(T & { [T in K]: string })[]>;\n valueChanges<K extends string>(options: {idField?: K} = {}): Observable<T[]> {\n const fromCollectionRefScheduled$ = fromCollectionRef<T>(this.query, this.afs.schedulers.outsideAngular);\n return fromCollectionRefScheduled$\n .pipe(\n map(actions => actions.payload.docs.map(a => {\n if (options.idField) {\n return {\n [options.idField]: a.id,\n ...a.data()\n } as T & { [T in K]: string };\n } else {\n return a.data();\n }\n })),\n pendingUntilEvent()\n );\n }\n\n /**\n * Retrieve the results of the query once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.query.get(options)).pipe(\n pendingUntilEvent()\n );\n }\n\n}\n","import { isPlatformServer } from '@angular/common';\nimport { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';\nimport { ɵAngularFireSchedulers } from '@angular/fire';\nimport { AppCheckInstances } from '@angular/fire/app-check';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport {\n SETTINGS as AUTH_SETTINGS,\n AngularFireAuth,\n LANGUAGE_CODE,\n PERSISTENCE,\n TENANT_ID,\n USE_EMULATOR as USE_AUTH_EMULATOR,\n USE_DEVICE_LANGUAGE,\n ɵauthFactory,\n} from '@angular/fire/compat/auth';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from, of } from 'rxjs';\nimport { AngularFirestoreCollection } from './collection/collection';\nimport { AngularFirestoreCollectionGroup } from './collection-group/collection-group';\nimport { AngularFirestoreDocument } from './document/document';\nimport {\n AssociatedReference,\n CollectionReference,\n DocumentReference,\n PersistenceSettings,\n Query,\n QueryFn,\n QueryGroupFn,\n Settings\n} from './interfaces';\nimport 'firebase/compat/auth';\nimport 'firebase/compat/firestore';\n\n/**\n * The value of this token determines whether or not the firestore will have persistance enabled\n */\nexport const ENABLE_PERSISTENCE = new InjectionToken<boolean>('angularfire2.enableFirestorePersistence');\nexport const PERSISTENCE_SETTINGS = new InjectionToken<PersistenceSettings | undefined>('angularfire2.firestore.persistenceSettings');\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.firestore.settings');\n\ntype UseEmulatorArguments = Parameters<firebase.firestore.Firestore['useEmulator']>;\nexport const USE_EMULATOR = new InjectionToken<UseEmulatorArguments>('angularfire2.firestore.use-emulator');\n\n/**\n * A utility methods for associating a collection reference with\n * a query.\n *\n * @param collectionRef - A collection reference to query\n * @param queryFn - The callback to create a query\n *\n * Example:\n * const { query, ref } = associateQuery(docRef.collection('items'), ref => {\n * return ref.where('age', '<', 200);\n * });\n */\nexport function associateQuery<T>(collectionRef: CollectionReference<T>, queryFn = ref => ref): AssociatedReference<T> {\n const query = queryFn(collectionRef);\n const ref = collectionRef;\n return { query, ref };\n}\n\n/**\n * AngularFirestore Service\n *\n * This service is the main entry point for this feature module. It provides\n * an API for creating Collection and Reference services. These services can\n * then be used to do data updates and observable streams of the data.\n *\n * Example:\n *\n * import { Component } from '@angular/core';\n * import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from '@angular/fire/firestore';\n * import { Observable } from 'rxjs/Observable';\n * import { from } from 'rxjs/observable';\n *\n * @Component({\n * selector: 'app-my-component',\n * template: `\n * <h2>Items for {{ (profile | async)?.name }}\n * <ul>\n * <li *ngFor=\"let item of items | async\">{{ item.name }}</li>\n * </ul>\n * <div class=\"control-input\">\n * <input type=\"text\" #itemname />\n * <button (click)=\"addItem(itemname.value)\">Add Item</button>\n * </div>\n * `\n * })\n * export class MyComponent implements OnInit {\n *\n * // services for data operations and data streaming\n * private readonly itemsRef: AngularFirestoreCollection<Item>;\n * private readonly profileRef: AngularFirestoreDocument<Profile>;\n *\n * // observables for template\n * items: Observable<Item[]>;\n * profile: Observable<Profile>;\n *\n * // inject main service\n * constructor(private readonly afs: AngularFirestore) {}\n *\n * ngOnInit() {\n * this.itemsRef = afs.collection('items', ref => ref.where('user', '==', 'davideast').limit(10));\n * this.items = this.itemsRef.valueChanges().map(snap => snap.docs.map(data => doc.data()));\n * // this.items = from(this.itemsRef); // you can also do this with no mapping\n *\n * this.profileRef = afs.doc('users/davideast');\n * this.profile = this.profileRef.valueChanges();\n * }\n *\n * addItem(name: string) {\n * const user = 'davideast';\n * this.itemsRef.add({ name, user });\n * }\n * }\n */\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFirestore {\n public readonly firestore: firebase.firestore.Firestore;\n public readonly persistenceEnabled$: Observable<boolean>;\n\n /**\n * Each Feature of AngularFire has a FirebaseApp injected. This way we\n * don't rely on the main Firebase App instance and we can create named\n * apps and use multiple apps.\n */\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(ENABLE_PERSISTENCE) shouldEnablePersistence: boolean | null,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n // eslint-disable-next-line @typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object,\n zone: NgZone,\n public schedulers: ɵAngularFireSchedulers,\n @Optional() @Inject(PERSISTENCE_SETTINGS) persistenceSettings: PersistenceSettings | null,\n @Optional() @Inject(USE_EMULATOR) _useEmulator: any,\n @Optional() auth: AngularFireAuth,\n @Optional() @Inject(USE_AUTH_EMULATOR) useAuthEmulator: any,\n @Optional() @Inject(AUTH_SETTINGS) authSettings: any, // can't use firebase.auth.AuthSettings here\n @Optional() @Inject(TENANT_ID) tenantId: string | null,\n @Optional() @Inject(LANGUAGE_CODE) languageCode: string | null,\n @Optional() @Inject(USE_DEVICE_LANGUAGE) useDeviceLanguage: boolean | null,\n @Optional() @Inject(PERSISTENCE) persistence: string | null,\n @Optional() _appCheckInstances: AppCheckInstances,\n ) {\n const app = ɵfirebaseAppFactory(options, zone, name);\n const useEmulator: UseEmulatorArguments | null = _useEmulator;\n\n if (auth) {\n ɵauthFactory(app, zone, useAuthEmulator, tenantId, languageCode, useDeviceLanguage, authSettings, persistence);\n }\n\n [this.firestore, this.persistenceEnabled$] = ɵcacheInstance(`${app.name}.firestore`, 'AngularFirestore', app.name, () => {\n const firestore = zone.runOutsideAngular(() => app.firestore());\n if (settings) {\n firestore.settings(settings);\n }\n if (useEmulator) {\n firestore.useEmulator(...useEmulator);\n }\n\n if (shouldEnablePersistence && !isPlatformServer(platformId)) {\n // We need to try/catch here because not all enablePersistence() failures are caught\n // https://github.com/firebase/firebase-js-sdk/issues/608\n const enablePersistence = () => {\n try {\n return from(firestore.enablePersistence(persistenceSettings || undefined).then(() => true, () => false));\n } catch (e) {\n if (typeof console !== 'undefined') { console.warn(e); }\n return of(false);\n }\n };\n return [firestore, zone.runOutsideAngular(enablePersistence)];\n } else {\n return [firestore, of(false)];\n }\n\n }, [settings, useEmulator, shouldEnablePersistence]);\n }\n\n /**\n * Create a reference to a Firestore Collection based on a path or\n * CollectionReference and an optional query function to narrow the result\n * set.\n */\n collection<T>(path: string, queryFn?: QueryFn): AngularFirestoreCollection<T>;\n collection<T>(ref: CollectionReference, queryFn?: QueryFn): AngularFirestoreCollection<T>;\n collection<T>(pathOrRef: string | CollectionReference<T>, queryFn?: QueryFn): AngularFirestoreCollection<T> {\n let collectionRef: CollectionReference<T>;\n if (typeof pathOrRef === 'string') {\n collectionRef = this.firestore.collection(pathOrRef) as firebase.firestore.CollectionReference<T>;\n } else {\n collectionRef = pathOrRef;\n }\n const { ref, query } = associateQuery<T>(collectionRef, queryFn);\n const refInZone = inject(NgZone).run(() => ref);\n return new AngularFirestoreCollection<T>(refInZone, query, this);\n }\n\n /**\n * Create a reference to a Firestore Collection Group based on a collectionId\n * and an optional query function to narrow the result\n * set.\n */\n collectionGroup<T>(collectionId: string, queryGroupFn?: QueryGroupFn<T>): AngularFirestoreCollectionGroup<T> {\n const queryFn = queryGroupFn || (ref => ref);\n const collectionGroup: Query<T> = this.firestore.collectionGroup(collectionId) as firebase.firestore.Query<T>;\n return new AngularFirestoreCollectionGroup<T>(queryFn(collectionGroup), this);\n }\n\n /**\n * Create a reference to a Firestore Document based on a path or\n * DocumentReference. Note that documents are not queryable because they are\n * simply objects. However, documents have sub-collections that return a\n * Collection reference and can be queried.\n */\n doc<T>(path: string): AngularFirestoreDocument<T>;\n doc<T>(ref: DocumentReference): AngularFirestoreDocument<T>;\n doc<T>(pathOrRef: string | DocumentReference<T>): AngularFirestoreDocument<T> {\n let ref: DocumentReference<T>;\n if (typeof pathOrRef === 'string') {\n ref = this.firestore.doc(pathOrRef) as firebase.firestore.DocumentReference<T>;\n } else {\n ref = pathOrRef;\n }\n const refInZone = inject(NgZone).run(() => ref);\n return new AngularFirestoreDocument<T>(refInZone, this);\n }\n\n /**\n * Returns a generated Firestore Document Id.\n */\n createId() {\n return this.firestore.collection('_').doc().id;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFirestore, ENABLE_PERSISTENCE, PERSISTENCE_SETTINGS } from './firestore';\nimport { PersistenceSettings } from './interfaces';\n\n@NgModule({\n providers: [ AngularFirestore ]\n})\nexport class AngularFirestoreModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'fst-compat');\n }\n /**\n * Attempt to enable persistent storage, if possible\n */\n static enablePersistence(persistenceSettings?: PersistenceSettings): ModuleWithProviders<AngularFirestoreModule> {\n return {\n ngModule: AngularFirestoreModule,\n providers: [\n { provide: ENABLE_PERSISTENCE, useValue: true },\n { provide: PERSISTENCE_SETTINGS, useValue: persistenceSettings },\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵfirebaseAppFactory","ɵauthFactory","ɵcacheInstance","USE_AUTH_EMULATOR","AUTH_SETTINGS"],"mappings":";;;;;;;;;;;;;;;;AAIA,SAAS,QAAQ,CAAI,GAAc,EAAE,YAA2B,cAAc,EAAA;AAC5E,IAAA,OAAO,IAAI,UAAU,CAAC,UAAU,IAAG;AACjC,QAAA,IAAI,WAAuB;AAC3B,QAAA,IAAI,SAAS,IAAI,IAAI,EAAE;AACrB,YAAA,SAAS,CAAC,QAAQ,CAAC,MAAK;AACtB,gBAAA,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC;AAC5E,aAAC,CAAC;;aACG;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AA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAtB,sBAAsB,EAAA,CAAA;wGAAtB,sBAAsB,EAAA,SAAA,EAFtB,CAAE,gBAAgB,CAAE,EAAA,CAAA;;2FAEpB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,SAAS,EAAE,CAAE,gBAAgB;AAC9B,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-fire-compat-firestore.mjs","sources":["../../../src/compat/firestore/observable/fromRef.ts","../../../src/compat/firestore/document/document.ts","../../../src/compat/firestore/collection/changes.ts","../../../src/compat/firestore/collection/collection.ts","../../../src/compat/firestore/collection-group/collection-group.ts","../../../src/compat/firestore/firestore.ts","../../../src/compat/firestore/firestore.module.ts","../../../src/compat/firestore/angular-fire-compat-firestore.ts"],"sourcesContent":["import { Observable, SchedulerLike, asyncScheduler } from 'rxjs';\nimport { map, pairwise, startWith } from 'rxjs/operators';\nimport { Action, DocumentReference, DocumentSnapshot, Query, QuerySnapshot, Reference } from '../interfaces';\n\nfunction _fromRef<R>(ref: Reference, scheduler: SchedulerLike = asyncScheduler): Observable<R> {\n return new Observable(subscriber => {\n let unsubscribe: () => void;\n if (scheduler != null) {\n scheduler.schedule(() => {\n unsubscribe = ref.onSnapshot({ includeMetadataChanges: true }, subscriber);\n });\n } else {\n unsubscribe = ref.onSnapshot({ includeMetadataChanges: true }, subscriber);\n }\n\n return () => {\n if (unsubscribe != null) {\n unsubscribe();\n }\n };\n });\n}\n\nexport function fromRef<R, T>(ref: DocumentReference<T> | Query<T>, scheduler?: SchedulerLike) {\n return _fromRef<R>(ref, scheduler);\n}\n\nexport function fromDocRef<T>(ref: DocumentReference<T>, scheduler?: SchedulerLike): Observable<Action<DocumentSnapshot<T>>> {\n return fromRef<DocumentSnapshot<T>, T>(ref, scheduler)\n .pipe(\n startWith<DocumentSnapshot<T>, undefined>(undefined),\n pairwise(),\n map((snapshots: [DocumentSnapshot<T>, DocumentSnapshot<T>]) => {\n const [priorPayload, payload] = snapshots;\n if (!payload.exists) {\n return { payload, type: 'removed' };\n }\n if (!priorPayload?.exists) {\n return { payload, type: 'added' };\n }\n return { payload, type: 'modified' };\n })\n );\n}\n\nexport function fromCollectionRef<T>(ref: Query<T>, scheduler?: SchedulerLike): Observable<Action<QuerySnapshot<T>>> {\n return fromRef<QuerySnapshot<T>, T>(ref, scheduler).pipe(map(payload => ({ payload, type: 'query' })));\n}\n","import { EnvironmentInjector, inject } from '@angular/core';\nimport { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { AngularFirestoreCollection } from '../collection/collection';\nimport { AngularFirestore, associateQuery } from '../firestore';\nimport { Action, DocumentData, DocumentReference, DocumentSnapshot, QueryFn, SetOptions } from '../interfaces';\nimport { fromDocRef } from '../observable/fromRef';\n\n/**\n * AngularFirestoreDocument service\n *\n * This class creates a reference to a Firestore Document. A reference is provided in\n * in the constructor. The class is generic which gives you type safety for data update\n * methods and data streaming.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const fakeStock = new AngularFirestoreDocument<Stock>(doc('stocks/FAKE'));\n * await fakeStock.set({ name: 'FAKE', price: 0.01 });\n * fakeStock.valueChanges().map(snap => {\n * if(snap.exists) return snap.data();\n * return null;\n * }).subscribe(value => console.log(value));\n * // OR! Transform using Observable.from() and the data is unwrapped for you\n * Observable.from(fakeStock).subscribe(value => console.log(value));\n */\nexport class AngularFirestoreDocument<T = DocumentData> {\n private readonly injector = inject(EnvironmentInjector);\n\n /**\n * The constructor takes in a DocumentReference to provide wrapper methods\n * for data operations, data streaming, and Symbol.observable.\n */\n constructor(public ref: DocumentReference<T>, private afs: AngularFirestore) { }\n\n /**\n * Create or overwrite a single document.\n */\n set(data: T, options?: SetOptions): Promise<void> {\n return this.ref.set(data, options);\n }\n\n /**\n * Update some fields of a document without overwriting the entire document.\n */\n update(data: Partial<T>): Promise<void> {\n return this.ref.update(data);\n }\n\n /**\n * Delete a document.\n */\n delete(): Promise<void> {\n return this.ref.delete();\n }\n\n /**\n * Create a reference to a sub-collection given a path and an optional query\n * function.\n */\n collection<R = DocumentData>(path: string, queryFn?: QueryFn): AngularFirestoreCollection<R> {\n const collectionRef = this.ref.collection(path) as firebase.firestore.CollectionReference<R>;\n const { ref, query } = associateQuery(collectionRef, queryFn);\n return new AngularFirestoreCollection(ref, query, this.afs);\n }\n\n /**\n * Listen to snapshot updates from the document.\n */\n snapshotChanges(): Observable<Action<DocumentSnapshot<T>>> {\n const scheduledFromDocRef$ = fromDocRef<T>(this.ref, this.afs.schedulers.outsideAngular);\n return scheduledFromDocRef$.pipe(\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Listen to unwrapped snapshot updates from the document.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(options?: unknown): Observable<T | undefined>;\n valueChanges<K extends string>(options: { idField: K }): Observable<(T & { [T in K]: string }) | undefined>;\n valueChanges<K extends string>(options: { idField?: K } = {}): Observable<T | undefined> {\n return this.snapshotChanges().pipe(\n map(({ payload }) =>\n options.idField ? {\n ...payload.data(),\n ...{ [options.idField]: payload.id }\n } as T & { [T in K]: string } : payload.data()\n )\n );\n }\n\n /**\n * Retrieve the document once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.ref.get(options)).pipe(\n pendingUntilEvent(this.injector)\n );\n }\n}\n","import firebase from 'firebase/compat/app';\nimport { Observable, SchedulerLike } from 'rxjs';\nimport { distinctUntilChanged, map, pairwise, scan, startWith } from 'rxjs/operators';\nimport { Action, DocumentChange, DocumentChangeAction, DocumentChangeType, Query, QuerySnapshot } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\n\n\ntype ActionTupe = [Action<QuerySnapshot<firebase.firestore.DocumentData>>, Action<QuerySnapshot<firebase.firestore.DocumentData>>]\n/**\n * Return a stream of document changes on a query. These results are not in sort order but in\n * order of occurence.\n */\nexport function docChanges<T>(query: Query, scheduler?: SchedulerLike): Observable<DocumentChangeAction<T>[]> {\n return fromCollectionRef(query, scheduler)\n .pipe(\n startWith<Action<QuerySnapshot<firebase.firestore.DocumentData>>, undefined>(undefined),\n pairwise(),\n map((actionTuple: ActionTupe) => {\n const [priorAction, action] = actionTuple;\n const docChanges = action.payload.docChanges();\n const actions = docChanges.map(change => ({ type: change.type, payload: change }));\n // the metadata has changed from the prior emission\n if (priorAction && JSON.stringify(priorAction.payload.metadata) !== JSON.stringify(action.payload.metadata)) {\n // go through all the docs in payload and figure out which ones changed\n action.payload.docs.forEach((currentDoc, currentIndex) => {\n const docChange = docChanges.find(d => d.doc.ref.isEqual(currentDoc.ref));\n const priorDoc = priorAction?.payload.docs.find(d => d.ref.isEqual(currentDoc.ref));\n if (docChange && JSON.stringify(docChange.doc.metadata) === JSON.stringify(currentDoc.metadata) ||\n !docChange && priorDoc && JSON.stringify(priorDoc.metadata) === JSON.stringify(currentDoc.metadata)) {\n // document doesn't appear to have changed, don't log another action\n } else {\n // since the actions are processed in order just push onto the array\n actions.push({\n type: 'modified',\n payload: {\n oldIndex: currentIndex,\n newIndex: currentIndex,\n type: 'modified',\n doc: currentDoc\n }\n });\n }\n });\n }\n return actions as DocumentChangeAction<T>[];\n }),\n );\n}\n\n/**\n * Return a stream of document changes on a query. These results are in sort order.\n */\nexport function sortedChanges<T>(\n query: Query,\n events: DocumentChangeType[],\n scheduler?: SchedulerLike): Observable<DocumentChangeAction<T>[]> {\n return docChanges<T>(query, scheduler)\n .pipe(\n scan((current, changes) => combineChanges<T>(current, changes.map(it => it.payload), events), []),\n distinctUntilChanged(), // cut down on unneed change cycles\n map(changes => changes.map(c => ({ type: c.type, payload: c } as DocumentChangeAction<T>))));\n}\n\n/**\n * Combines the total result set from the current set of changes from an incoming set\n * of changes.\n */\nexport function combineChanges<T>(current: DocumentChange<T>[], changes: DocumentChange<T>[], events: DocumentChangeType[]) {\n changes.forEach(change => {\n // skip unwanted change types\n if (events.indexOf(change.type) > -1) {\n current = combineChange(current, change);\n }\n });\n return current;\n}\n\n/**\n * Splice arguments on top of a sliced array, to break top-level ===\n * this is useful for change-detection\n */\nfunction sliceAndSplice<T>(\n original: T[],\n start: number,\n deleteCount: number,\n ...args: T[]\n): T[] {\n const returnArray = original.slice();\n returnArray.splice(start, deleteCount, ...args);\n return returnArray;\n}\n\n/**\n * Creates a new sorted array from a new change.\n * Build our own because we allow filtering of action types ('added', 'removed', 'modified') before scanning\n * and so we have greater control over change detection (by breaking ===)\n */\nexport function combineChange<T>(combined: DocumentChange<T>[], change: DocumentChange<T>): DocumentChange<T>[] {\n switch (change.type) {\n case 'added':\n if (combined[change.newIndex]?.doc.ref.isEqual(change.doc.ref)) {\n // Not sure why the duplicates are getting fired\n } else {\n return sliceAndSplice(combined, change.newIndex, 0, change);\n }\n break;\n case 'modified':\n if (combined[change.oldIndex] == null || combined[change.oldIndex].doc.ref.isEqual(change.doc.ref)) {\n // When an item changes position we first remove it\n // and then add it's new position\n if (change.oldIndex !== change.newIndex) {\n const copiedArray = combined.slice();\n copiedArray.splice(change.oldIndex, 1);\n copiedArray.splice(change.newIndex, 0, change);\n return copiedArray;\n } else {\n return sliceAndSplice(combined, change.newIndex, 1, change);\n }\n }\n break;\n case 'removed':\n if (combined[change.oldIndex]?.doc.ref.isEqual(change.doc.ref)) {\n return sliceAndSplice(combined, change.oldIndex, 1);\n }\n break;\n }\n return combined;\n}\n","import { EnvironmentInjector, inject } from '@angular/core';\nimport { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { filter, map, pairwise, scan, startWith } from 'rxjs/operators';\nimport { AngularFirestoreDocument } from '../document/document';\nimport { AngularFirestore } from '../firestore';\nimport { CollectionReference, DocumentChangeAction, DocumentChangeType, DocumentData, DocumentReference, Query } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\nimport { docChanges, sortedChanges } from './changes';\n\ntype DocumentChangeTuple<T> = [DocumentChangeAction<T>[], DocumentChangeAction<T>[]];\n\nexport function validateEventsArray(events?: DocumentChangeType[]) {\n if (!events || events.length === 0) {\n events = ['added', 'removed', 'modified'];\n }\n return events;\n}\n\n/**\n * AngularFirestoreCollection service\n *\n * This class creates a reference to a Firestore Collection. A reference and a query are provided in\n * in the constructor. The query can be the unqueried reference if no query is desired.The class\n * is generic which gives you type safety for data update methods and data streaming.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const collectionRef = firebase.firestore.collection('stocks');\n * const query = collectionRef.where('price', '>', '0.01');\n * const fakeStock = new AngularFirestoreCollection<Stock>(collectionRef, query);\n *\n * // NOTE!: the updates are performed on the reference not the query\n * await fakeStock.add({ name: 'FAKE', price: 0.01 });\n *\n * // Subscribe to changes as snapshots. This provides you data updates as well as delta updates.\n * fakeStock.valueChanges().subscribe(value => console.log(value));\n */\nexport class AngularFirestoreCollection<T = DocumentData> {\n private readonly injector = inject(EnvironmentInjector);\n\n /**\n * The constructor takes in a CollectionReference and Query to provide wrapper methods\n * for data operations and data streaming.\n *\n * Note: Data operation methods are done on the reference not the query. This means\n * when you update data it is not updating data to the window of your query unless\n * the data fits the criteria of the query. See the AssociatedRefence type for details\n * on this implication.\n */\n constructor(\n public readonly ref: CollectionReference<T>,\n private readonly query: Query<T>,\n private readonly afs: AngularFirestore) { }\n\n /**\n * Listen to the latest change in the stream. This method returns changes\n * as they occur and they are not sorted by query order. This allows you to construct\n * your own data structure.\n */\n stateChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n let source = docChanges<T>(this.query, this.afs.schedulers.outsideAngular);\n if (events && events.length > 0) {\n source = source.pipe(\n map(actions => actions.filter(change => events.indexOf(change.type) > -1))\n );\n }\n return source.pipe(\n // We want to filter out empty arrays, but always emit at first, so the developer knows\n // that the collection has been resolve; even if it's empty\n startWith<DocumentChangeAction<T>[], undefined>(undefined),\n pairwise(),\n filter(([prior, current]: DocumentChangeTuple<T>) => current.length > 0 || !prior),\n map(([, current]) => current),\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Create a stream of changes as they occur it time. This method is similar to stateChanges()\n * but it collects each event in an array over time.\n */\n auditTrail(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n return this.stateChanges(events).pipe(scan((current, action) => [...current, ...action], []));\n }\n\n /**\n * Create a stream of synchronized changes. This method keeps the local array in sorted\n * query order.\n */\n snapshotChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges<T>(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Listen to all documents in the collection and its possible query as an Observable.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(): Observable<T[]>;\n // eslint-disable-next-line no-empty-pattern\n valueChanges({}): Observable<T[]>;\n valueChanges<K extends string>(options: {idField: K}): Observable<(T & { [T in K]: string })[]>;\n valueChanges<K extends string>(options: {idField?: K} = {}): Observable<T[]> {\n return fromCollectionRef<T>(this.query, this.afs.schedulers.outsideAngular)\n .pipe(\n map(actions => actions.payload.docs.map(a => {\n if (options.idField) {\n return {\n ...a.data() as any,\n ...{ [options.idField]: a.id }\n } as T & { [T in K]: string };\n } else {\n return a.data();\n }\n })),\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Retrieve the results of the query once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.query.get(options)).pipe(\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Add data to a collection reference.\n *\n * Note: Data operation methods are done on the reference not the query. This means\n * when you update data it is not updating data to the window of your query unless\n * the data fits the criteria of the query.\n */\n add(data: T): Promise<DocumentReference<T>> {\n return this.ref.add(data);\n }\n\n /**\n * Create a reference to a single document in a collection.\n */\n doc<T2 = T>(path?: string): AngularFirestoreDocument<T2> {\n // TODO is there a better way to solve this type issue\n return new AngularFirestoreDocument(this.ref.doc(path) as any, this.afs);\n }\n}\n","import { EnvironmentInjector, inject } from '@angular/core';\nimport { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from } from 'rxjs';\nimport { filter, map, scan } from 'rxjs/operators';\nimport { docChanges, sortedChanges } from '../collection/changes';\nimport { validateEventsArray } from '../collection/collection';\nimport { AngularFirestore } from '../firestore';\nimport { DocumentChangeAction, DocumentChangeType, DocumentData, Query } from '../interfaces';\nimport { fromCollectionRef } from '../observable/fromRef';\n\n/**\n * AngularFirestoreCollectionGroup service\n *\n * This class holds a reference to a Firestore Collection Group Query.\n *\n * This class uses Symbol.observable to transform into Observable using Observable.from().\n *\n * This class is rarely used directly and should be created from the AngularFirestore service.\n *\n * Example:\n *\n * const collectionGroup = firebase.firestore.collectionGroup('stocks');\n * const query = collectionRef.where('price', '>', '0.01');\n * const fakeStock = new AngularFirestoreCollectionGroup<Stock>(query, afs);\n *\n * // Subscribe to changes as snapshots. This provides you data updates as well as delta updates.\n * fakeStock.valueChanges().subscribe(value => console.log(value));\n */\nexport class AngularFirestoreCollectionGroup<T = DocumentData> {\n private readonly injector = inject(EnvironmentInjector);\n\n /**\n * The constructor takes in a CollectionGroupQuery to provide wrapper methods\n * for data operations and data streaming.\n */\n constructor(\n private readonly query: Query<T>,\n private readonly afs: AngularFirestore) { }\n\n /**\n * Listen to the latest change in the stream. This method returns changes\n * as they occur and they are not sorted by query order. This allows you to construct\n * your own data structure.\n */\n stateChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n if (!events || events.length === 0) {\n return docChanges<T>(this.query, this.afs.schedulers.outsideAngular).pipe(\n pendingUntilEvent(this.injector)\n );\n }\n return docChanges<T>(this.query, this.afs.schedulers.outsideAngular)\n .pipe(\n map(actions => actions.filter(change => events.indexOf(change.type) > -1)),\n filter(changes => changes.length > 0),\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Create a stream of changes as they occur it time. This method is similar to stateChanges()\n * but it collects each event in an array over time.\n */\n auditTrail(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n return this.stateChanges(events).pipe(scan((current, action) => [...current, ...action], []));\n }\n\n /**\n * Create a stream of synchronized changes. This method keeps the local array in sorted\n * query order.\n */\n snapshotChanges(events?: DocumentChangeType[]): Observable<DocumentChangeAction<T>[]> {\n const validatedEvents = validateEventsArray(events);\n const scheduledSortedChanges$ = sortedChanges<T>(this.query, validatedEvents, this.afs.schedulers.outsideAngular);\n return scheduledSortedChanges$.pipe(\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Listen to all documents in the collection and its possible query as an Observable.\n *\n * If the `idField` option is provided, document IDs are included and mapped to the\n * provided `idField` property name.\n */\n valueChanges(): Observable<T[]>;\n // eslint-disable-next-line no-empty-pattern\n valueChanges({}): Observable<T[]>;\n valueChanges<K extends string>(options: {idField: K}): Observable<(T & { [T in K]: string })[]>;\n valueChanges<K extends string>(options: {idField?: K} = {}): Observable<T[]> {\n const fromCollectionRefScheduled$ = fromCollectionRef<T>(this.query, this.afs.schedulers.outsideAngular);\n return fromCollectionRefScheduled$\n .pipe(\n map(actions => actions.payload.docs.map(a => {\n if (options.idField) {\n return {\n [options.idField]: a.id,\n ...a.data()\n } as T & { [T in K]: string };\n } else {\n return a.data();\n }\n })),\n pendingUntilEvent(this.injector)\n );\n }\n\n /**\n * Retrieve the results of the query once.\n */\n get(options?: firebase.firestore.GetOptions) {\n return from(this.query.get(options)).pipe(\n pendingUntilEvent(this.injector)\n );\n }\n\n}\n","import { isPlatformServer } from '@angular/common';\nimport { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';\nimport { ɵAngularFireSchedulers } from '@angular/fire';\nimport { AppCheckInstances } from '@angular/fire/app-check';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport {\n SETTINGS as AUTH_SETTINGS,\n AngularFireAuth,\n LANGUAGE_CODE,\n PERSISTENCE,\n TENANT_ID,\n USE_EMULATOR as USE_AUTH_EMULATOR,\n USE_DEVICE_LANGUAGE,\n ɵauthFactory,\n} from '@angular/fire/compat/auth';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { Observable, from, of } from 'rxjs';\nimport { AngularFirestoreCollection } from './collection/collection';\nimport { AngularFirestoreCollectionGroup } from './collection-group/collection-group';\nimport { AngularFirestoreDocument } from './document/document';\nimport {\n AssociatedReference,\n CollectionReference,\n DocumentReference,\n PersistenceSettings,\n Query,\n QueryFn,\n QueryGroupFn,\n Settings\n} from './interfaces';\nimport 'firebase/compat/auth';\nimport 'firebase/compat/firestore';\n\n/**\n * The value of this token determines whether or not the firestore will have persistance enabled\n */\nexport const ENABLE_PERSISTENCE = new InjectionToken<boolean>('angularfire2.enableFirestorePersistence');\nexport const PERSISTENCE_SETTINGS = new InjectionToken<PersistenceSettings | undefined>('angularfire2.firestore.persistenceSettings');\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.firestore.settings');\n\ntype UseEmulatorArguments = Parameters<firebase.firestore.Firestore['useEmulator']>;\nexport const USE_EMULATOR = new InjectionToken<UseEmulatorArguments>('angularfire2.firestore.use-emulator');\n\n/**\n * A utility methods for associating a collection reference with\n * a query.\n *\n * @param collectionRef - A collection reference to query\n * @param queryFn - The callback to create a query\n *\n * Example:\n * const { query, ref } = associateQuery(docRef.collection('items'), ref => {\n * return ref.where('age', '<', 200);\n * });\n */\nexport function associateQuery<T>(collectionRef: CollectionReference<T>, queryFn = ref => ref): AssociatedReference<T> {\n const query = queryFn(collectionRef);\n const ref = collectionRef;\n return { query, ref };\n}\n\n/**\n * AngularFirestore Service\n *\n * This service is the main entry point for this feature module. It provides\n * an API for creating Collection and Reference services. These services can\n * then be used to do data updates and observable streams of the data.\n *\n * Example:\n *\n * import { Component } from '@angular/core';\n * import { AngularFirestore, AngularFirestoreCollection, AngularFirestoreDocument } from '@angular/fire/firestore';\n * import { Observable } from 'rxjs/Observable';\n * import { from } from 'rxjs/observable';\n *\n * @Component({\n * selector: 'app-my-component',\n * template: `\n * <h2>Items for {{ (profile | async)?.name }}\n * <ul>\n * <li *ngFor=\"let item of items | async\">{{ item.name }}</li>\n * </ul>\n * <div class=\"control-input\">\n * <input type=\"text\" #itemname />\n * <button (click)=\"addItem(itemname.value)\">Add Item</button>\n * </div>\n * `\n * })\n * export class MyComponent implements OnInit {\n *\n * // services for data operations and data streaming\n * private readonly itemsRef: AngularFirestoreCollection<Item>;\n * private readonly profileRef: AngularFirestoreDocument<Profile>;\n *\n * // observables for template\n * items: Observable<Item[]>;\n * profile: Observable<Profile>;\n *\n * // inject main service\n * constructor(private readonly afs: AngularFirestore) {}\n *\n * ngOnInit() {\n * this.itemsRef = afs.collection('items', ref => ref.where('user', '==', 'davideast').limit(10));\n * this.items = this.itemsRef.valueChanges().map(snap => snap.docs.map(data => doc.data()));\n * // this.items = from(this.itemsRef); // you can also do this with no mapping\n *\n * this.profileRef = afs.doc('users/davideast');\n * this.profile = this.profileRef.valueChanges();\n * }\n *\n * addItem(name: string) {\n * const user = 'davideast';\n * this.itemsRef.add({ name, user });\n * }\n * }\n */\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFirestore {\n public readonly firestore: firebase.firestore.Firestore;\n public readonly persistenceEnabled$: Observable<boolean>;\n private readonly ngZone = inject(NgZone);\n\n /**\n * Each Feature of AngularFire has a FirebaseApp injected. This way we\n * don't rely on the main Firebase App instance and we can create named\n * apps and use multiple apps.\n */\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(ENABLE_PERSISTENCE) shouldEnablePersistence: boolean | null,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n // eslint-disable-next-line @typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object,\n zone: NgZone,\n public schedulers: ɵAngularFireSchedulers,\n @Optional() @Inject(PERSISTENCE_SETTINGS) persistenceSettings: PersistenceSettings | null,\n @Optional() @Inject(USE_EMULATOR) _useEmulator: any,\n @Optional() auth: AngularFireAuth,\n @Optional() @Inject(USE_AUTH_EMULATOR) useAuthEmulator: any,\n @Optional() @Inject(AUTH_SETTINGS) authSettings: any, // can't use firebase.auth.AuthSettings here\n @Optional() @Inject(TENANT_ID) tenantId: string | null,\n @Optional() @Inject(LANGUAGE_CODE) languageCode: string | null,\n @Optional() @Inject(USE_DEVICE_LANGUAGE) useDeviceLanguage: boolean | null,\n @Optional() @Inject(PERSISTENCE) persistence: string | null,\n @Optional() _appCheckInstances: AppCheckInstances,\n ) {\n const app = ɵfirebaseAppFactory(options, zone, name);\n const useEmulator: UseEmulatorArguments | null = _useEmulator;\n\n if (auth) {\n ɵauthFactory(app, zone, useAuthEmulator, tenantId, languageCode, useDeviceLanguage, authSettings, persistence);\n }\n\n [this.firestore, this.persistenceEnabled$] = ɵcacheInstance(`${app.name}.firestore`, 'AngularFirestore', app.name, () => {\n const firestore = zone.runOutsideAngular(() => app.firestore());\n if (settings) {\n firestore.settings(settings);\n }\n if (useEmulator) {\n firestore.useEmulator(...useEmulator);\n }\n\n if (shouldEnablePersistence && !isPlatformServer(platformId)) {\n // We need to try/catch here because not all enablePersistence() failures are caught\n // https://github.com/firebase/firebase-js-sdk/issues/608\n const enablePersistence = () => {\n try {\n return from(firestore.enablePersistence(persistenceSettings || undefined).then(() => true, () => false));\n } catch (e) {\n if (typeof console !== 'undefined') { console.warn(e); }\n return of(false);\n }\n };\n return [firestore, zone.runOutsideAngular(enablePersistence)];\n } else {\n return [firestore, of(false)];\n }\n\n }, [settings, useEmulator, shouldEnablePersistence]);\n }\n\n /**\n * Create a reference to a Firestore Collection based on a path or\n * CollectionReference and an optional query function to narrow the result\n * set.\n */\n collection<T>(path: string, queryFn?: QueryFn): AngularFirestoreCollection<T>;\n collection<T>(ref: CollectionReference, queryFn?: QueryFn): AngularFirestoreCollection<T>;\n collection<T>(pathOrRef: string | CollectionReference<T>, queryFn?: QueryFn): AngularFirestoreCollection<T> {\n let collectionRef: CollectionReference<T>;\n if (typeof pathOrRef === 'string') {\n collectionRef = this.firestore.collection(pathOrRef) as firebase.firestore.CollectionReference<T>;\n } else {\n collectionRef = pathOrRef;\n }\n const { ref, query } = associateQuery<T>(collectionRef, queryFn);\n const refInZone = this.ngZone.run(() => ref);\n return new AngularFirestoreCollection<T>(refInZone, query, this);\n }\n\n /**\n * Create a reference to a Firestore Collection Group based on a collectionId\n * and an optional query function to narrow the result\n * set.\n */\n collectionGroup<T>(collectionId: string, queryGroupFn?: QueryGroupFn<T>): AngularFirestoreCollectionGroup<T> {\n const queryFn = queryGroupFn || (ref => ref);\n const collectionGroup: Query<T> = this.firestore.collectionGroup(collectionId) as firebase.firestore.Query<T>;\n return new AngularFirestoreCollectionGroup<T>(queryFn(collectionGroup), this);\n }\n\n /**\n * Create a reference to a Firestore Document based on a path or\n * DocumentReference. Note that documents are not queryable because they are\n * simply objects. However, documents have sub-collections that return a\n * Collection reference and can be queried.\n */\n doc<T>(path: string): AngularFirestoreDocument<T>;\n doc<T>(ref: DocumentReference): AngularFirestoreDocument<T>;\n doc<T>(pathOrRef: string | DocumentReference<T>): AngularFirestoreDocument<T> {\n let ref: DocumentReference<T>;\n if (typeof pathOrRef === 'string') {\n ref = this.firestore.doc(pathOrRef) as firebase.firestore.DocumentReference<T>;\n } else {\n ref = pathOrRef;\n }\n const refInZone = this.ngZone.run(() => ref);\n return new AngularFirestoreDocument<T>(refInZone, this);\n }\n\n /**\n * Returns a generated Firestore Document Id.\n */\n createId() {\n return this.firestore.collection('_').doc().id;\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFirestore, ENABLE_PERSISTENCE, PERSISTENCE_SETTINGS } from './firestore';\nimport { PersistenceSettings } from './interfaces';\n\n@NgModule({\n providers: [ AngularFirestore ]\n})\nexport class AngularFirestoreModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'fst-compat');\n }\n /**\n * Attempt to enable persistent storage, if possible\n */\n static enablePersistence(persistenceSettings?: PersistenceSettings): ModuleWithProviders<AngularFirestoreModule> {\n return {\n ngModule: AngularFirestoreModule,\n providers: [\n { provide: ENABLE_PERSISTENCE, useValue: true },\n { provide: PERSISTENCE_SETTINGS, useValue: persistenceSettings },\n ]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵfirebaseAppFactory","ɵauthFactory","ɵcacheInstance","USE_AUTH_EMULATOR","AUTH_SETTINGS"],"mappings":";;;;;;;;;;;;;;;;AAIA,SAAS,QAAQ,CAAI,GAAc,EAAE,YAA2B,cAAc,EAAA;AAC5E,IAAA,OAAO,IAAI,UAAU,CAAC,UAAU,IAAG;AACjC,QAAA,IAAI,WAAuB;AAC3B,QAAA,IAAI,SAAS,IAAI,IAAI,EAAE;AACrB,YAAA,SAAS,CAAC,QAAQ,CAAC,MAAK;AACtB,gBAAA,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC;AAC5E,aAAC,CAAC;;aACG;AACL,YAAA,WAAW,GAAG,GAAG,CAAC,UAAU,CAAC,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC;;AAG5E,QAAA,OAAO,MAAK;AACV,YAAA,IAAI,WAAW,IAAI,IAAI,EAAE;AACvB,gBAAA,WAAW,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ACL,YAAA,QAAQ,EAAE,sBAAsB;AAChC,YAAA,SAAS,EAAE;AACT,gBAAA,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE;AAC/C,gBAAA,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB,EAAE;AACjE;SACF;;uGAdQ,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAtB,sBAAsB,EAAA,CAAA;wGAAtB,sBAAsB,EAAA,SAAA,EAFtB,CAAE,gBAAgB,CAAE,EAAA,CAAA;;2FAEpB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAHlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,SAAS,EAAE,CAAE,gBAAgB;AAC9B,iBAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, EnvironmentInjector, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
|
|
3
3
|
import { pendingUntilEvent } from '@angular/core/rxjs-interop';
|
|
4
4
|
import * as i1 from '@angular/fire';
|
|
5
5
|
import { VERSION } from '@angular/fire';
|
|
@@ -98,6 +98,7 @@ class AngularFireRemoteConfig {
|
|
|
98
98
|
numbers;
|
|
99
99
|
booleans;
|
|
100
100
|
strings;
|
|
101
|
+
injector = inject(EnvironmentInjector);
|
|
101
102
|
constructor(options, name, settings, defaultConfig, zone, schedulers,
|
|
102
103
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types
|
|
103
104
|
platformId) {
|
|
@@ -125,7 +126,7 @@ class AngularFireRemoteConfig {
|
|
|
125
126
|
const fresh$ = loadedRemoteConfig$.pipe(switchMap(rc => zone.runOutsideAngular(() => rc.fetchAndActivate()
|
|
126
127
|
.then(() => rc.ensureInitialized())
|
|
127
128
|
.then(() => rc.getAll()))), filterOutDefaults);
|
|
128
|
-
this.parameters = concat(default$, existing$, fresh$).pipe(scanToParametersArray(remoteConfig$), pendingUntilEvent(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
129
|
+
this.parameters = concat(default$, existing$, fresh$).pipe(scanToParametersArray(remoteConfig$), pendingUntilEvent(this.injector), shareReplay({ bufferSize: 1, refCount: true }));
|
|
129
130
|
this.changes = this.parameters.pipe(switchMap(params => of(...params)), groupBy(param => param.key), mergeMap(group => group.pipe(distinctUntilChanged())));
|
|
130
131
|
this.strings = proxyAll(this.parameters, 'strings');
|
|
131
132
|
this.booleans = proxyAll(this.parameters, 'booleans');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-fire-compat-remote-config.mjs","sources":["../../../src/compat/remote-config/base.ts","../../../src/compat/remote-config/remote-config.ts","../../../src/compat/remote-config/remote-config.module.ts","../../../src/compat/remote-config/angular-fire-compat-remote-config.ts"],"sourcesContent":["// DO NOT MODIFY, this file is autogenerated by tools/build.ts\n// Export a null object with the same keys as firebase/compat/remote-config, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n app: null,\n settings: null,\n defaultConfig: null,\n fetchTimeMillis: null,\n lastFetchStatus: null,\n activate: null,\n ensureInitialized: null,\n fetch: null,\n fetchAndActivate: null,\n getAll: null,\n getBoolean: null,\n getNumber: null,\n getString: null,\n getValue: null,\n setLogLevel: null,\n};\n","import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from '@angular/core';\nimport { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport { ɵAngularFireSchedulers } from '@angular/fire';\nimport { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { isSupported } from 'firebase/remote-config';\nimport { EMPTY, MonoTypeOperatorFunction, Observable, OperatorFunction, concat, of, pipe } from 'rxjs';\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n groupBy,\n map,\n mergeMap,\n observeOn,\n scan,\n shareReplay,\n startWith,\n switchMap,\n withLatestFrom\n} from 'rxjs/operators';\nimport { proxyPolyfillCompat } from './base';\nimport { Settings } from './interfaces';\n\nexport type ConfigTemplate = Record<string, string | number | boolean>;\n\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.remoteConfig.settings');\nexport const DEFAULTS = new InjectionToken<ConfigTemplate>('angularfire2.remoteConfig.defaultConfig');\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AngularFireRemoteConfig extends ɵPromiseProxy<firebase.remoteConfig.RemoteConfig> {\n}\n\nconst AS_TO_FN = { strings: 'asString', numbers: 'asNumber', booleans: 'asBoolean' };\nconst STATIC_VALUES = { numbers: 0, booleans: false, strings: undefined };\n\n// TODO look into the types here, I don't like the anys\nconst proxyAll = (observable: Observable<Parameter[]>, as: 'numbers' | 'booleans' | 'strings') => new Proxy(\n observable.pipe(mapToObject(as as any)), {\n get: (self, name: string) => self[name] || observable.pipe(\n map(all => all.find(p => p.key === name)),\n map(param => param ? param[AS_TO_FN[as]]() : STATIC_VALUES[as]),\n distinctUntilChanged()\n )\n }\n) as any;\n\n// TODO export as implements Partial<...> so minor doesn't break us\nexport class Value implements firebase.remoteConfig.Value {\n asBoolean() {\n return ['1', 'true', 't', 'y', 'yes', 'on'].indexOf(this._value.toLowerCase()) > -1;\n }\n\n asString() {\n return this._value;\n }\n\n asNumber() {\n return Number(this._value) || 0;\n }\n\n getSource() {\n return this._source;\n }\n\n constructor(public _source: firebase.remoteConfig.ValueSource, public _value: string) {\n }\n}\n\n// SEMVER use ConstructorParameters when we can support Typescript 3.6\nexport class Parameter extends Value {\n constructor(public key: string, public fetchTimeMillis: number, source: firebase.remoteConfig.ValueSource, value: string) {\n super(source, value);\n }\n}\n\n// If it's a Parameter array, test any, else test the individual Parameter\nconst filterTest = (fn: (param: Parameter) => boolean) => filter<Parameter | Parameter[]>(it => Array.isArray(it) ? it.some(fn) : fn(it));\n\n// Allow the user to bypass the default values and wait till they get something from the server, even if it's a cached copy;\n// if used in conjuntion with first() it will only fetch RC values from the server if they aren't cached locally\nexport const filterRemote = () => filterTest(p => p.getSource() === 'remote');\n\n// filterFresh allows the developer to effectively set up a maximum cache time\nexport const filterFresh = (howRecentInMillis: number) => filterTest(p => p.fetchTimeMillis + howRecentInMillis >= new Date().getTime());\n\n\n// I ditched loading the defaults into RC and a simple map for scan since we already have our own defaults implementation.\n// The idea here being that if they have a default that never loads from the server, they will be able to tell via fetchTimeMillis\n// on the Parameter. Also if it doesn't come from the server it won't emit again in .changes, due to the distinctUntilChanged,\n// which we can simplify to === rather than deep comparison\nconst scanToParametersArray = (\n remoteConfig: Observable<firebase.remoteConfig.RemoteConfig | undefined>\n): OperatorFunction<Record<string, firebase.remoteConfig.Value>, Parameter[]> => pipe(\n withLatestFrom(remoteConfig),\n scan((existing, [all, rc]) => {\n // SEMVER use \"new Set\" to unique once we're only targeting es6\n // at the scale we expect remote config to be at, we probably won't see a performance hit from this unoptimized uniqueness\n // implementation.\n // const allKeys = [...new Set([...existing.map(p => p.key), ...Object.keys(all)])];\n const allKeys = [...existing.map(p => p.key), ...Object.keys(all)].filter((v, i, a) => a.indexOf(v) === i);\n return allKeys.map(key => {\n const updatedValue = all[key];\n return updatedValue ? new Parameter(key, rc ? rc.fetchTimeMillis : -1, updatedValue.getSource(), updatedValue.asString())\n : existing.find(p => p.key === key);\n });\n }, [] as Parameter[])\n);\n\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFireRemoteConfig {\n\n readonly changes: Observable<Parameter>;\n readonly parameters: Observable<Parameter[]>;\n readonly numbers: Observable<Record<string, number | undefined>> & Record<string, Observable<number>>;\n readonly booleans: Observable<Record<string, boolean | undefined>> & Record<string, Observable<boolean>>;\n readonly strings: Observable<Record<string, string | undefined>> & Record<string, Observable<string | undefined>>;\n\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n @Optional() @Inject(DEFAULTS) defaultConfig: ConfigTemplate | null,\n private zone: NgZone,\n schedulers: ɵAngularFireSchedulers,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object\n ) {\n const remoteConfig$ = of(undefined).pipe(\n observeOn(schedulers.outsideAngular),\n switchMap(() => isSupported()),\n switchMap(isSupported => isSupported ? import('firebase/compat/remote-config') : EMPTY),\n map(() => ɵfirebaseAppFactory(options, zone, name)),\n map(app => ɵcacheInstance(`${app.name}.remote-config`, 'AngularFireRemoteConfig', app.name, () => {\n const rc = app.remoteConfig();\n if (settings) {\n rc.settings = settings;\n }\n if (defaultConfig) {\n rc.defaultConfig = defaultConfig;\n }\n return rc;\n }, [settings, defaultConfig])),\n startWith<firebase.remoteConfig.RemoteConfig, undefined>(undefined),\n shareReplay({ bufferSize: 1, refCount: false })\n ) as Observable<any>;\n\n const loadedRemoteConfig$ = remoteConfig$.pipe(\n filter<firebase.remoteConfig.RemoteConfig>(rc => !!rc)\n );\n\n const default$: Observable<Record<string, firebase.remoteConfig.Value>> = of(Object.keys(defaultConfig || {}).reduce(\n (c, k) => ({ ...c, [k]: new Value('default', defaultConfig[k].toString()) }), {}\n ));\n\n // we should filter out the defaults we provided to RC, since we have our own implementation\n // that gives us a -1 for fetchTimeMillis (so filterFresh can filter them out)\n const filterOutDefaults = map<Record<string, firebase.remoteConfig.Value>, Record<string, firebase.remoteConfig.Value>>(all =>\n Object.keys(all)\n .filter(key => all[key].getSource() !== 'default')\n .reduce((acc, key) => ({ ...acc, [key]: all[key] }), {})\n );\n\n const existing$ = loadedRemoteConfig$.pipe(\n switchMap(rc =>\n rc.activate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n ),\n filterOutDefaults\n );\n\n const fresh$ = loadedRemoteConfig$.pipe(\n switchMap(rc => zone.runOutsideAngular(() =>\n rc.fetchAndActivate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n )),\n filterOutDefaults\n );\n\n this.parameters = concat(default$, existing$, fresh$).pipe(\n scanToParametersArray(remoteConfig$),\n pendingUntilEvent(),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n this.changes = this.parameters.pipe(\n switchMap(params => of(...params)),\n groupBy(param => param.key),\n mergeMap(group => group.pipe(\n distinctUntilChanged()\n ))\n );\n\n this.strings = proxyAll(this.parameters, 'strings');\n this.booleans = proxyAll(this.parameters, 'booleans');\n this.numbers = proxyAll(this.parameters, 'numbers');\n\n return ɵlazySDKProxy(this, loadedRemoteConfig$, zone);\n }\n\n}\n\n\nexport const budget = <T>(interval: number): MonoTypeOperatorFunction<T> => (source: Observable<T>) => new Observable<T>(observer => {\n let timedOut = false;\n // TODO use scheduler task rather than settimeout\n const timeout = setTimeout(() => {\n observer.complete();\n timedOut = true;\n }, interval);\n return source.subscribe({\n next(val) {\n if (!timedOut) {\n observer.next(val);\n }\n },\n error(err) {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.error(err);\n }\n },\n complete() {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.complete();\n }\n }\n });\n});\n\nconst typedMethod = (it: any) => {\n switch (typeof it) {\n case 'string':\n return 'asString';\n case 'boolean':\n return 'asBoolean';\n case 'number':\n return 'asNumber';\n default:\n return 'asString';\n }\n};\n\n\nexport function scanToObject(): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject(to: 'numbers'): OperatorFunction<Parameter, Record<string, number | undefined>>;\nexport function scanToObject(to: 'booleans'): OperatorFunction<Parameter, Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function scanToObject(to: 'strings'): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(template: T): OperatorFunction<Parameter, T & Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO cleanup\n scan(\n (c, p: Parameter) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n ),\n debounceTime(1),\n budget(10),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nexport function mapToObject(): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject(to: 'numbers'): OperatorFunction<Parameter[], Record<string, number | undefined>>;\nexport function mapToObject(to: 'booleans'): OperatorFunction<Parameter[], Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function mapToObject(to: 'strings'): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(template: T):\n OperatorFunction<Parameter[], T & Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO this is getting a little long, cleanup\n map((params: Parameter[]) => params.reduce(\n (c, p) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n )),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nɵapplyMixins(AngularFireRemoteConfig, [proxyPolyfillCompat]);\n","import { NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFireRemoteConfig } from './remote-config';\n\n@NgModule({\n providers: [ AngularFireRemoteConfig ]\n})\nexport class AngularFireRemoteConfigModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'rc-compat');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵfirebaseAppFactory","ɵcacheInstance","ɵlazySDKProxy","ɵapplyMixins"],"mappings":";;;;;;;;;;;AAAA;AACA;AACO,MAAM,mBAAmB,GAAG;AACjC,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,WAAW,EAAE,IAAI;CAClB;;MCUY,QAAQ,GAAG,IAAI,cAAc,CAAW,oCAAoC;MAC5E,QAAQ,GAAG,IAAI,cAAc,CAAiB,yCAAyC;AAMpG,MAAM,QAAQ,GAAG,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE;AACpF,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE;AAEzE;AACA,MAAM,QAAQ,GAAG,CAAC,UAAmC,EAAE,EAAsC,KAAK,IAAI,KAAK,CACzG,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,EAAS,CAAC,CAAC,EAAE;AAC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ClB,KAAA,CAAC,EACF,OAAO,EAAE,KAAK,QAAQ;AACpB,QAAA,EAA4C;QAC5C,EAA+C,CAClD,CAAC,EACF,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CACxE;AACH;AAEAC,YAAY,CAAC,uBAAuB,EAAE,CAAC,mBAAmB,CAAC,CAAC;;MCrS/C,6BAA6B,CAAA;AACtC,IAAA,WAAA,GAAA;QACI,QAAQ,CAAC,eAAe,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC;;uGAF7D,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAA7B,6BAA6B,EAAA,CAAA;wGAA7B,6BAA6B,EAAA,SAAA,EAF7B,CAAE,uBAAuB,CAAE,EAAA,CAAA;;2FAE3B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAHzC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,SAAS,EAAE,CAAE,uBAAuB;AACrC,iBAAA;;;ACPD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"angular-fire-compat-remote-config.mjs","sources":["../../../src/compat/remote-config/base.ts","../../../src/compat/remote-config/remote-config.ts","../../../src/compat/remote-config/remote-config.module.ts","../../../src/compat/remote-config/angular-fire-compat-remote-config.ts"],"sourcesContent":["// DO NOT MODIFY, this file is autogenerated by tools/build.ts\n// Export a null object with the same keys as firebase/compat/remote-config, so Proxy can work with proxy-polyfill in Internet Explorer\nexport const proxyPolyfillCompat = {\n app: null,\n settings: null,\n defaultConfig: null,\n fetchTimeMillis: null,\n lastFetchStatus: null,\n activate: null,\n ensureInitialized: null,\n fetch: null,\n fetchAndActivate: null,\n getAll: null,\n getBoolean: null,\n getNumber: null,\n getString: null,\n getValue: null,\n setLogLevel: null,\n};\n","import { EnvironmentInjector, Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID, inject } from '@angular/core';\nimport { pendingUntilEvent } from '@angular/core/rxjs-interop';\nimport { ɵAngularFireSchedulers } from '@angular/fire';\nimport { ɵPromiseProxy, ɵapplyMixins, ɵlazySDKProxy } from '@angular/fire/compat';\nimport { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from '@angular/fire/compat';\nimport { FirebaseOptions } from 'firebase/app';\nimport firebase from 'firebase/compat/app';\nimport { isSupported } from 'firebase/remote-config';\nimport { EMPTY, MonoTypeOperatorFunction, Observable, OperatorFunction, concat, of, pipe } from 'rxjs';\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n groupBy,\n map,\n mergeMap,\n observeOn,\n scan,\n shareReplay,\n startWith,\n switchMap,\n withLatestFrom\n} from 'rxjs/operators';\nimport { proxyPolyfillCompat } from './base';\nimport { Settings } from './interfaces';\n\nexport type ConfigTemplate = Record<string, string | number | boolean>;\n\nexport const SETTINGS = new InjectionToken<Settings>('angularfire2.remoteConfig.settings');\nexport const DEFAULTS = new InjectionToken<ConfigTemplate>('angularfire2.remoteConfig.defaultConfig');\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AngularFireRemoteConfig extends ɵPromiseProxy<firebase.remoteConfig.RemoteConfig> {\n}\n\nconst AS_TO_FN = { strings: 'asString', numbers: 'asNumber', booleans: 'asBoolean' };\nconst STATIC_VALUES = { numbers: 0, booleans: false, strings: undefined };\n\n// TODO look into the types here, I don't like the anys\nconst proxyAll = (observable: Observable<Parameter[]>, as: 'numbers' | 'booleans' | 'strings') => new Proxy(\n observable.pipe(mapToObject(as as any)), {\n get: (self, name: string) => self[name] || observable.pipe(\n map(all => all.find(p => p.key === name)),\n map(param => param ? param[AS_TO_FN[as]]() : STATIC_VALUES[as]),\n distinctUntilChanged()\n )\n }\n) as any;\n\n// TODO export as implements Partial<...> so minor doesn't break us\nexport class Value implements firebase.remoteConfig.Value {\n asBoolean() {\n return ['1', 'true', 't', 'y', 'yes', 'on'].indexOf(this._value.toLowerCase()) > -1;\n }\n\n asString() {\n return this._value;\n }\n\n asNumber() {\n return Number(this._value) || 0;\n }\n\n getSource() {\n return this._source;\n }\n\n constructor(public _source: firebase.remoteConfig.ValueSource, public _value: string) {\n }\n}\n\n// SEMVER use ConstructorParameters when we can support Typescript 3.6\nexport class Parameter extends Value {\n constructor(public key: string, public fetchTimeMillis: number, source: firebase.remoteConfig.ValueSource, value: string) {\n super(source, value);\n }\n}\n\n// If it's a Parameter array, test any, else test the individual Parameter\nconst filterTest = (fn: (param: Parameter) => boolean) => filter<Parameter | Parameter[]>(it => Array.isArray(it) ? it.some(fn) : fn(it));\n\n// Allow the user to bypass the default values and wait till they get something from the server, even if it's a cached copy;\n// if used in conjuntion with first() it will only fetch RC values from the server if they aren't cached locally\nexport const filterRemote = () => filterTest(p => p.getSource() === 'remote');\n\n// filterFresh allows the developer to effectively set up a maximum cache time\nexport const filterFresh = (howRecentInMillis: number) => filterTest(p => p.fetchTimeMillis + howRecentInMillis >= new Date().getTime());\n\n\n// I ditched loading the defaults into RC and a simple map for scan since we already have our own defaults implementation.\n// The idea here being that if they have a default that never loads from the server, they will be able to tell via fetchTimeMillis\n// on the Parameter. Also if it doesn't come from the server it won't emit again in .changes, due to the distinctUntilChanged,\n// which we can simplify to === rather than deep comparison\nconst scanToParametersArray = (\n remoteConfig: Observable<firebase.remoteConfig.RemoteConfig | undefined>\n): OperatorFunction<Record<string, firebase.remoteConfig.Value>, Parameter[]> => pipe(\n withLatestFrom(remoteConfig),\n scan((existing, [all, rc]) => {\n // SEMVER use \"new Set\" to unique once we're only targeting es6\n // at the scale we expect remote config to be at, we probably won't see a performance hit from this unoptimized uniqueness\n // implementation.\n // const allKeys = [...new Set([...existing.map(p => p.key), ...Object.keys(all)])];\n const allKeys = [...existing.map(p => p.key), ...Object.keys(all)].filter((v, i, a) => a.indexOf(v) === i);\n return allKeys.map(key => {\n const updatedValue = all[key];\n return updatedValue ? new Parameter(key, rc ? rc.fetchTimeMillis : -1, updatedValue.getSource(), updatedValue.asString())\n : existing.find(p => p.key === key);\n });\n }, [] as Parameter[])\n);\n\n\n@Injectable({\n providedIn: 'any'\n})\nexport class AngularFireRemoteConfig {\n\n readonly changes: Observable<Parameter>;\n readonly parameters: Observable<Parameter[]>;\n readonly numbers: Observable<Record<string, number | undefined>> & Record<string, Observable<number>>;\n readonly booleans: Observable<Record<string, boolean | undefined>> & Record<string, Observable<boolean>>;\n readonly strings: Observable<Record<string, string | undefined>> & Record<string, Observable<string | undefined>>;\n\n private readonly injector = inject(EnvironmentInjector);\n\n constructor(\n @Inject(FIREBASE_OPTIONS) options: FirebaseOptions,\n @Optional() @Inject(FIREBASE_APP_NAME) name: string | null | undefined,\n @Optional() @Inject(SETTINGS) settings: Settings | null,\n @Optional() @Inject(DEFAULTS) defaultConfig: ConfigTemplate | null,\n private zone: NgZone,\n schedulers: ɵAngularFireSchedulers,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-types\n @Inject(PLATFORM_ID) platformId: Object\n ) {\n const remoteConfig$ = of(undefined).pipe(\n observeOn(schedulers.outsideAngular),\n switchMap(() => isSupported()),\n switchMap(isSupported => isSupported ? import('firebase/compat/remote-config') : EMPTY),\n map(() => ɵfirebaseAppFactory(options, zone, name)),\n map(app => ɵcacheInstance(`${app.name}.remote-config`, 'AngularFireRemoteConfig', app.name, () => {\n const rc = app.remoteConfig();\n if (settings) {\n rc.settings = settings;\n }\n if (defaultConfig) {\n rc.defaultConfig = defaultConfig;\n }\n return rc;\n }, [settings, defaultConfig])),\n startWith<firebase.remoteConfig.RemoteConfig, undefined>(undefined),\n shareReplay({ bufferSize: 1, refCount: false })\n ) as Observable<any>;\n\n const loadedRemoteConfig$ = remoteConfig$.pipe(\n filter<firebase.remoteConfig.RemoteConfig>(rc => !!rc)\n );\n\n const default$: Observable<Record<string, firebase.remoteConfig.Value>> = of(Object.keys(defaultConfig || {}).reduce(\n (c, k) => ({ ...c, [k]: new Value('default', defaultConfig[k].toString()) }), {}\n ));\n\n // we should filter out the defaults we provided to RC, since we have our own implementation\n // that gives us a -1 for fetchTimeMillis (so filterFresh can filter them out)\n const filterOutDefaults = map<Record<string, firebase.remoteConfig.Value>, Record<string, firebase.remoteConfig.Value>>(all =>\n Object.keys(all)\n .filter(key => all[key].getSource() !== 'default')\n .reduce((acc, key) => ({ ...acc, [key]: all[key] }), {})\n );\n\n const existing$ = loadedRemoteConfig$.pipe(\n switchMap(rc =>\n rc.activate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n ),\n filterOutDefaults\n );\n\n const fresh$ = loadedRemoteConfig$.pipe(\n switchMap(rc => zone.runOutsideAngular(() =>\n rc.fetchAndActivate()\n .then(() => rc.ensureInitialized())\n .then(() => rc.getAll())\n )),\n filterOutDefaults\n );\n\n this.parameters = concat(default$, existing$, fresh$).pipe(\n scanToParametersArray(remoteConfig$),\n pendingUntilEvent(this.injector),\n shareReplay({ bufferSize: 1, refCount: true })\n );\n\n this.changes = this.parameters.pipe(\n switchMap(params => of(...params)),\n groupBy(param => param.key),\n mergeMap(group => group.pipe(\n distinctUntilChanged()\n ))\n );\n\n this.strings = proxyAll(this.parameters, 'strings');\n this.booleans = proxyAll(this.parameters, 'booleans');\n this.numbers = proxyAll(this.parameters, 'numbers');\n\n return ɵlazySDKProxy(this, loadedRemoteConfig$, zone);\n }\n\n}\n\n\nexport const budget = <T>(interval: number): MonoTypeOperatorFunction<T> => (source: Observable<T>) => new Observable<T>(observer => {\n let timedOut = false;\n // TODO use scheduler task rather than settimeout\n const timeout = setTimeout(() => {\n observer.complete();\n timedOut = true;\n }, interval);\n return source.subscribe({\n next(val) {\n if (!timedOut) {\n observer.next(val);\n }\n },\n error(err) {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.error(err);\n }\n },\n complete() {\n if (!timedOut) {\n clearTimeout(timeout);\n observer.complete();\n }\n }\n });\n});\n\nconst typedMethod = (it: any) => {\n switch (typeof it) {\n case 'string':\n return 'asString';\n case 'boolean':\n return 'asBoolean';\n case 'number':\n return 'asNumber';\n default:\n return 'asString';\n }\n};\n\n\nexport function scanToObject(): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject(to: 'numbers'): OperatorFunction<Parameter, Record<string, number | undefined>>;\nexport function scanToObject(to: 'booleans'): OperatorFunction<Parameter, Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function scanToObject(to: 'strings'): OperatorFunction<Parameter, Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(template: T): OperatorFunction<Parameter, T & Record<string, string | undefined>>;\nexport function scanToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO cleanup\n scan(\n (c, p: Parameter) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n ),\n debounceTime(1),\n budget(10),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nexport function mapToObject(): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject(to: 'numbers'): OperatorFunction<Parameter[], Record<string, number | undefined>>;\nexport function mapToObject(to: 'booleans'): OperatorFunction<Parameter[], Record<string, boolean | undefined>>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport function mapToObject(to: 'strings'): OperatorFunction<Parameter[], Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(template: T):\n OperatorFunction<Parameter[], T & Record<string, string | undefined>>;\nexport function mapToObject<T extends ConfigTemplate>(to: 'numbers' | 'booleans' | 'strings' | T = 'strings') {\n return pipe(\n // TODO this is getting a little long, cleanup\n map((params: Parameter[]) => params.reduce(\n (c, p) => ({\n ...c, [p.key]: typeof to === 'object' ?\n p[typedMethod(to[p.key])]() :\n p[AS_TO_FN[to]]()\n }),\n typeof to === 'object' ?\n to as T & Record<string, string | undefined> :\n {} as Record<string, number | boolean | string>\n )),\n distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b))\n );\n}\n\nɵapplyMixins(AngularFireRemoteConfig, [proxyPolyfillCompat]);\n","import { NgModule } from '@angular/core';\nimport { VERSION } from '@angular/fire';\nimport firebase from 'firebase/compat/app';\nimport { AngularFireRemoteConfig } from './remote-config';\n\n@NgModule({\n providers: [ AngularFireRemoteConfig ]\n})\nexport class AngularFireRemoteConfigModule {\n constructor() {\n firebase.registerVersion('angularfire', VERSION.full, 'rc-compat');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["ɵfirebaseAppFactory","ɵcacheInstance","ɵlazySDKProxy","ɵapplyMixins"],"mappings":";;;;;;;;;;;AAAA;AACA;AACO,MAAM,mBAAmB,GAAG;AACjC,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,WAAW,EAAE,IAAI;CAClB;;MCUY,QAAQ,GAAG,IAAI,cAAc,CAAW,oCAAoC;MAC5E,QAAQ,GAAG,IAAI,cAAc,CAAiB,yCAAyC;AAMpG,MAAM,QAAQ,GAAG,EAAE,OAAO,EAAE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4
|
import { Observable, of, from } from 'rxjs';
|
|
5
5
|
import { debounceTime, map, switchMap, tap } from 'rxjs/operators';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, makeStateKey, Pipe, NgModule } from '@angular/core';
|
|
7
|
+
import { InjectionToken, inject, EnvironmentInjector, PLATFORM_ID, Injectable, Inject, Optional, makeStateKey, Pipe, NgModule } from '@angular/core';
|
|
8
8
|
import * as i2 from '@angular/fire/app-check';
|
|
9
9
|
import { ɵfirebaseAppFactory as _firebaseAppFactory, ɵcacheInstance as _cacheInstance, FIREBASE_OPTIONS, FIREBASE_APP_NAME } from '@angular/fire/compat';
|
|
10
10
|
import 'firebase/compat/storage';
|
|
@@ -68,12 +68,12 @@ function createUploadTask(task) {
|
|
|
68
68
|
* Create an AngularFire wrapped Storage Reference. This object
|
|
69
69
|
* creates observable methods from promise based methods.
|
|
70
70
|
*/
|
|
71
|
-
function createStorageRef(ref) {
|
|
71
|
+
function createStorageRef(ref, injector) {
|
|
72
72
|
return {
|
|
73
|
-
getDownloadURL: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getDownloadURL()), pendingUntilEvent()),
|
|
74
|
-
getMetadata: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getMetadata()), pendingUntilEvent()),
|
|
73
|
+
getDownloadURL: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getDownloadURL()), pendingUntilEvent(injector)),
|
|
74
|
+
getMetadata: () => of(undefined).pipe(observeOutsideAngular, switchMap(() => ref.getMetadata()), pendingUntilEvent(injector)),
|
|
75
75
|
delete: () => from(ref.delete()),
|
|
76
|
-
child: (path) => createStorageRef(ref.child(path)),
|
|
76
|
+
child: (path) => createStorageRef(ref.child(path), injector),
|
|
77
77
|
updateMetadata: (meta) => from(ref.updateMetadata(meta)),
|
|
78
78
|
put: (data, metadata) => {
|
|
79
79
|
const task = ref.put(data, metadata);
|
|
@@ -101,6 +101,7 @@ const USE_EMULATOR = new InjectionToken('angularfire2.storage.use-emulator');
|
|
|
101
101
|
*/
|
|
102
102
|
class AngularFireStorage {
|
|
103
103
|
storage;
|
|
104
|
+
injector = inject(EnvironmentInjector);
|
|
104
105
|
constructor(options, name, storageBucket,
|
|
105
106
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
106
107
|
platformId, zone, schedulers, maxUploadRetryTime, maxOperationRetryTime, _useEmulator, _appCheckInstances) {
|
|
@@ -121,14 +122,14 @@ class AngularFireStorage {
|
|
|
121
122
|
}, [maxUploadRetryTime, maxOperationRetryTime]);
|
|
122
123
|
}
|
|
123
124
|
ref(path) {
|
|
124
|
-
return createStorageRef(this.storage.ref(path));
|
|
125
|
+
return createStorageRef(this.storage.ref(path), this.injector);
|
|
125
126
|
}
|
|
126
127
|
refFromURL(path) {
|
|
127
|
-
return createStorageRef(this.storage.refFromURL(path));
|
|
128
|
+
return createStorageRef(this.storage.refFromURL(path), this.injector);
|
|
128
129
|
}
|
|
129
130
|
upload(path, data, metadata) {
|
|
130
131
|
const storageRef = this.storage.ref(path);
|
|
131
|
-
const ref = createStorageRef(storageRef);
|
|
132
|
+
const ref = createStorageRef(storageRef, this.injector);
|
|
132
133
|
return ref.put(data, metadata);
|
|
133
134
|
}
|
|
134
135
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AngularFireStorage, deps: [{ token: FIREBASE_OPTIONS }, { token: FIREBASE_APP_NAME, optional: true }, { token: BUCKET, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i1.ɵAngularFireSchedulers }, { token: MAX_UPLOAD_RETRY_TIME, optional: true }, { token: MAX_OPERATION_RETRY_TIME, optional: true }, { token: USE_EMULATOR, optional: true }, { token: i2.AppCheckInstances, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|