@angular/fire 18.0.0-rc.0 → 18.0.1-canary.3639e41

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.
Files changed (96) hide show
  1. package/esm2022/analytics/analytics.module.mjs +5 -5
  2. package/esm2022/analytics/screen-tracking.service.mjs +4 -4
  3. package/esm2022/analytics/user-tracking.service.mjs +4 -4
  4. package/esm2022/app/app.module.mjs +5 -5
  5. package/esm2022/app-check/app-check.module.mjs +5 -5
  6. package/esm2022/auth/auth.module.mjs +5 -5
  7. package/esm2022/auth-guard/auth-guard.mjs +4 -4
  8. package/esm2022/auth-guard/auth-guard.module.mjs +5 -5
  9. package/esm2022/compat/analytics/analytics.mjs +4 -4
  10. package/esm2022/compat/analytics/analytics.module.mjs +5 -5
  11. package/esm2022/compat/analytics/screen-tracking.service.mjs +4 -4
  12. package/esm2022/compat/analytics/user-tracking.service.mjs +4 -4
  13. package/esm2022/compat/auth/auth.mjs +4 -4
  14. package/esm2022/compat/auth/auth.module.mjs +5 -5
  15. package/esm2022/compat/auth-guard/auth-guard.mjs +4 -4
  16. package/esm2022/compat/auth-guard/auth-guard.module.mjs +5 -5
  17. package/esm2022/compat/database/database.mjs +4 -4
  18. package/esm2022/compat/database/database.module.mjs +5 -5
  19. package/esm2022/compat/firebase.app.module.mjs +5 -5
  20. package/esm2022/compat/firestore/firestore.mjs +4 -4
  21. package/esm2022/compat/firestore/firestore.module.mjs +5 -5
  22. package/esm2022/compat/functions/functions.mjs +4 -4
  23. package/esm2022/compat/functions/functions.module.mjs +5 -5
  24. package/esm2022/compat/messaging/messaging.mjs +4 -4
  25. package/esm2022/compat/messaging/messaging.module.mjs +5 -5
  26. package/esm2022/compat/performance/performance.mjs +4 -4
  27. package/esm2022/compat/performance/performance.module.mjs +5 -5
  28. package/esm2022/compat/performance/performance.service.mjs +4 -4
  29. package/esm2022/compat/remote-config/remote-config.mjs +4 -4
  30. package/esm2022/compat/remote-config/remote-config.module.mjs +5 -5
  31. package/esm2022/compat/storage/pipes/storageUrl.pipe.mjs +8 -8
  32. package/esm2022/compat/storage/storage.mjs +4 -4
  33. package/esm2022/compat/storage/storage.module.mjs +5 -5
  34. package/esm2022/database/database.module.mjs +5 -5
  35. package/esm2022/firestore/firestore.module.mjs +5 -5
  36. package/esm2022/firestore/lite/lite.module.mjs +5 -5
  37. package/esm2022/functions/functions.module.mjs +5 -5
  38. package/esm2022/messaging/messaging.module.mjs +5 -5
  39. package/esm2022/performance/performance.module.mjs +5 -5
  40. package/esm2022/remote-config/remote-config.module.mjs +5 -5
  41. package/esm2022/storage/storage.module.mjs +5 -5
  42. package/esm2022/vertexai-preview/vertexai.module.mjs +5 -5
  43. package/esm2022/zones.mjs +4 -4
  44. package/fesm2022/angular-fire-analytics.mjs +297 -410
  45. package/fesm2022/angular-fire-analytics.mjs.map +1 -7
  46. package/fesm2022/angular-fire-app-check.mjs +91 -162
  47. package/fesm2022/angular-fire-app-check.mjs.map +1 -7
  48. package/fesm2022/angular-fire-app.mjs +108 -181
  49. package/fesm2022/angular-fire-app.mjs.map +1 -7
  50. package/fesm2022/angular-fire-auth-guard.mjs +73 -83
  51. package/fesm2022/angular-fire-auth-guard.mjs.map +1 -7
  52. package/fesm2022/angular-fire-auth.mjs +142 -421
  53. package/fesm2022/angular-fire-auth.mjs.map +1 -7
  54. package/fesm2022/angular-fire-compat-analytics.mjs +271 -262
  55. package/fesm2022/angular-fire-compat-analytics.mjs.map +1 -7
  56. package/fesm2022/angular-fire-compat-auth-guard.mjs +72 -83
  57. package/fesm2022/angular-fire-compat-auth-guard.mjs.map +1 -7
  58. package/fesm2022/angular-fire-compat-auth.mjs +214 -215
  59. package/fesm2022/angular-fire-compat-auth.mjs.map +1 -7
  60. package/fesm2022/angular-fire-compat-database.mjs +378 -375
  61. package/fesm2022/angular-fire-compat-database.mjs.map +1 -7
  62. package/fesm2022/angular-fire-compat-firestore.mjs +677 -537
  63. package/fesm2022/angular-fire-compat-firestore.mjs.map +1 -7
  64. package/fesm2022/angular-fire-compat-functions.mjs +94 -98
  65. package/fesm2022/angular-fire-compat-functions.mjs.map +1 -7
  66. package/fesm2022/angular-fire-compat-messaging.mjs +107 -107
  67. package/fesm2022/angular-fire-compat-messaging.mjs.map +1 -7
  68. package/fesm2022/angular-fire-compat-performance.mjs +152 -158
  69. package/fesm2022/angular-fire-compat-performance.mjs.map +1 -7
  70. package/fesm2022/angular-fire-compat-remote-config.mjs +232 -216
  71. package/fesm2022/angular-fire-compat-remote-config.mjs.map +1 -7
  72. package/fesm2022/angular-fire-compat-storage.mjs +231 -226
  73. package/fesm2022/angular-fire-compat-storage.mjs.map +1 -7
  74. package/fesm2022/angular-fire-compat.mjs +153 -140
  75. package/fesm2022/angular-fire-compat.mjs.map +1 -7
  76. package/fesm2022/angular-fire-database.mjs +136 -376
  77. package/fesm2022/angular-fire-database.mjs.map +1 -7
  78. package/fesm2022/angular-fire-firestore-lite.mjs +139 -388
  79. package/fesm2022/angular-fire-firestore-lite.mjs.map +1 -7
  80. package/fesm2022/angular-fire-firestore.mjs +167 -526
  81. package/fesm2022/angular-fire-firestore.mjs.map +1 -7
  82. package/fesm2022/angular-fire-functions.mjs +93 -166
  83. package/fesm2022/angular-fire-functions.mjs.map +1 -7
  84. package/fesm2022/angular-fire-messaging.mjs +118 -196
  85. package/fesm2022/angular-fire-messaging.mjs.map +1 -7
  86. package/fesm2022/angular-fire-performance.mjs +104 -178
  87. package/fesm2022/angular-fire-performance.mjs.map +1 -7
  88. package/fesm2022/angular-fire-remote-config.mjs +132 -254
  89. package/fesm2022/angular-fire-remote-config.mjs.map +1 -7
  90. package/fesm2022/angular-fire-storage.mjs +105 -225
  91. package/fesm2022/angular-fire-storage.mjs.map +1 -7
  92. package/fesm2022/angular-fire-vertexai-preview.mjs +85 -146
  93. package/fesm2022/angular-fire-vertexai-preview.mjs.map +1 -7
  94. package/fesm2022/angular-fire.mjs +213 -183
  95. package/fesm2022/angular-fire.mjs.map +1 -7
  96. package/package.json +7 -7
@@ -1,446 +1,449 @@
1
- // observable/fromRef.mjs
2
- import { Observable, asyncScheduler } from "rxjs";
3
- import { map, share } from "rxjs/operators";
4
- function fromRef(ref, event, listenType = "on", scheduler = asyncScheduler) {
5
- return new Observable((subscriber) => {
6
- let fn = null;
7
- fn = ref[listenType](event, (snapshot, prevKey) => {
8
- scheduler.schedule(() => {
9
- subscriber.next({ snapshot, prevKey });
10
- });
11
- if (listenType === "once") {
12
- scheduler.schedule(() => subscriber.complete());
13
- }
14
- }, (err) => {
15
- scheduler.schedule(() => subscriber.error(err));
16
- });
17
- if (listenType === "on") {
18
- return {
19
- unsubscribe() {
20
- if (fn != null) {
21
- ref.off(event, fn);
22
- }
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/fire';
4
+ import { keepUnstableUntilFirst, VERSION } from '@angular/fire';
5
+ import * as i3 from '@angular/fire/app-check';
6
+ import { ɵfirebaseAppFactory as _firebaseAppFactory, ɵcacheInstance as _cacheInstance, FIREBASE_OPTIONS, FIREBASE_APP_NAME } from '@angular/fire/compat';
7
+ import * as i2 from '@angular/fire/compat/auth';
8
+ import { ɵauthFactory as _authFactory, USE_EMULATOR as USE_EMULATOR$1, SETTINGS, TENANT_ID, LANGUAGE_CODE, USE_DEVICE_LANGUAGE, PERSISTENCE } from '@angular/fire/compat/auth';
9
+ import { map, share, scan, withLatestFrom, skipWhile, switchMap, distinctUntilChanged } from 'rxjs/operators';
10
+ import { Observable, asyncScheduler, merge, of } from 'rxjs';
11
+ import 'firebase/compat/auth';
12
+ import 'firebase/compat/database';
13
+ import firebase from 'firebase/compat/app';
14
+
15
+ /**
16
+ * Create an observable from a Database Reference or Database Query.
17
+ * @param ref Database Reference
18
+ * @param event Listen event type ('value', 'added', 'changed', 'removed', 'moved')
19
+ * @param listenType 'on' or 'once'
20
+ * @param scheduler - Rxjs scheduler
21
+ */
22
+ function fromRef(ref, event, listenType = 'on', scheduler = asyncScheduler) {
23
+ return new Observable(subscriber => {
24
+ let fn = null;
25
+ fn = ref[listenType](event, (snapshot, prevKey) => {
26
+ scheduler.schedule(() => {
27
+ subscriber.next({ snapshot, prevKey });
28
+ });
29
+ if (listenType === 'once') {
30
+ scheduler.schedule(() => subscriber.complete());
31
+ }
32
+ }, err => {
33
+ scheduler.schedule(() => subscriber.error(err));
34
+ });
35
+ if (listenType === 'on') {
36
+ return {
37
+ unsubscribe() {
38
+ if (fn != null) {
39
+ ref.off(event, fn);
40
+ }
41
+ }
42
+ };
23
43
  }
24
- };
25
- } else {
26
- return {
27
- // eslint-disable-next-line @typescript-eslint/no-empty-function
28
- unsubscribe() {
44
+ else {
45
+ return {
46
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
47
+ unsubscribe() {
48
+ }
49
+ };
29
50
  }
30
- };
31
- }
32
- }).pipe(map((payload) => {
33
- const { snapshot, prevKey } = payload;
34
- let key = null;
35
- if (snapshot.exists()) {
36
- key = snapshot.key;
37
- }
38
- return { type: event, payload: snapshot, prevKey, key };
39
- }), share());
51
+ }).pipe(map(payload => {
52
+ const { snapshot, prevKey } = payload;
53
+ let key = null;
54
+ if (snapshot.exists()) {
55
+ key = snapshot.key;
56
+ }
57
+ return { type: event, payload: snapshot, prevKey, key };
58
+ }), share());
40
59
  }
41
60
 
42
- // utils.mjs
43
61
  function isString(value) {
44
- return typeof value === "string";
62
+ return typeof value === 'string';
45
63
  }
46
64
  function isFirebaseDataSnapshot(value) {
47
- return typeof value.exportVal === "function";
65
+ return typeof value.exportVal === 'function';
48
66
  }
49
67
  function isNil(obj) {
50
- return obj === void 0 || obj === null;
68
+ return obj === undefined || obj === null;
51
69
  }
52
70
  function isFirebaseRef(value) {
53
- return typeof value.set === "function";
71
+ return typeof value.set === 'function';
54
72
  }
73
+ /**
74
+ * Returns a database reference given a Firebase App and an
75
+ * absolute or relative path.
76
+ * @param database - Firebase Database
77
+ * @param pathRef - Database path, relative or absolute
78
+ */
55
79
  function getRef(database, pathRef) {
56
- return isFirebaseRef(pathRef) ? pathRef : database.ref(pathRef);
80
+ // if a db ref was passed in, just return it
81
+ return isFirebaseRef(pathRef) ? pathRef
82
+ : database.ref(pathRef);
57
83
  }
58
84
  function checkOperationCases(item, cases) {
59
- if (isString(item)) {
60
- return cases.stringCase();
61
- } else if (isFirebaseRef(item)) {
62
- return cases.firebaseCase();
63
- } else if (isFirebaseDataSnapshot(item)) {
64
- return cases.snapshotCase();
65
- }
66
- throw new Error(`Expects a string, snapshot, or reference. Got: ${typeof item}`);
85
+ if (isString(item)) {
86
+ return cases.stringCase();
87
+ }
88
+ else if (isFirebaseRef(item)) {
89
+ return cases.firebaseCase();
90
+ }
91
+ else if (isFirebaseDataSnapshot(item)) {
92
+ return cases.snapshotCase();
93
+ }
94
+ throw new Error(`Expects a string, snapshot, or reference. Got: ${typeof item}`);
67
95
  }
68
96
 
69
- // list/utils.mjs
70
97
  function validateEventsArray(events) {
71
- if (isNil(events) || events.length === 0) {
72
- events = ["child_added", "child_removed", "child_changed", "child_moved"];
73
- }
74
- return events;
98
+ if (isNil(events) || events.length === 0) {
99
+ events = ['child_added', 'child_removed', 'child_changed', 'child_moved'];
100
+ }
101
+ return events;
75
102
  }
76
103
 
77
- // list/state-changes.mjs
78
- import { merge } from "rxjs";
79
104
  function stateChanges(query, events, scheduler) {
80
- events = validateEventsArray(events);
81
- const childEvent$ = events.map((event) => fromRef(query, event, "on", scheduler));
82
- return merge(...childEvent$);
105
+ events = validateEventsArray(events);
106
+ const childEvent$ = events.map(event => fromRef(query, event, 'on', scheduler));
107
+ return merge(...childEvent$);
83
108
  }
84
109
 
85
- // list/audit-trail.mjs
86
- import { map as map2, scan, skipWhile, withLatestFrom } from "rxjs/operators";
87
110
  function auditTrail(query, events, scheduler) {
88
- const auditTrail$ = stateChanges(query, events).pipe(scan((current, action) => [...current, action], []));
89
- return waitForLoaded(query, auditTrail$, scheduler);
111
+ const auditTrail$ = stateChanges(query, events)
112
+ .pipe(scan((current, action) => [...current, action], []));
113
+ return waitForLoaded(query, auditTrail$, scheduler);
90
114
  }
91
115
  function loadedData(query, scheduler) {
92
- return fromRef(query, "value", "on", scheduler).pipe(map2((data) => {
93
- let lastKeyToLoad;
94
- data.payload.forEach((child) => {
95
- lastKeyToLoad = child.key;
96
- return false;
97
- });
98
- return { data, lastKeyToLoad };
99
- }));
116
+ // Create an observable of loaded values to retrieve the
117
+ // known dataset. This will allow us to know what key to
118
+ // emit the "whole" array at when listening for child events.
119
+ return fromRef(query, 'value', 'on', scheduler)
120
+ .pipe(map(data => {
121
+ // Store the last key in the data set
122
+ let lastKeyToLoad;
123
+ // Loop through loaded dataset to find the last key
124
+ data.payload.forEach(child => {
125
+ lastKeyToLoad = child.key;
126
+ return false;
127
+ });
128
+ // return data set and the current last key loaded
129
+ return { data, lastKeyToLoad };
130
+ }));
100
131
  }
101
132
  function waitForLoaded(query, action$, scheduler) {
102
- const loaded$ = loadedData(query, scheduler);
103
- return loaded$.pipe(
104
- withLatestFrom(action$),
133
+ const loaded$ = loadedData(query, scheduler);
134
+ return loaded$
135
+ .pipe(withLatestFrom(action$),
105
136
  // Get the latest values from the "loaded" and "child" datasets
106
137
  // We can use both datasets to form an array of the latest values.
107
- map2(([loaded, actions]) => {
108
- const lastKeyToLoad = loaded.lastKeyToLoad;
109
- const loadedKeys = actions.map((snap) => snap.key);
110
- return { actions, lastKeyToLoad, loadedKeys };
111
- }),
138
+ map(([loaded, actions]) => {
139
+ // Store the last key in the data set
140
+ const lastKeyToLoad = loaded.lastKeyToLoad;
141
+ // Store all child keys loaded at this point
142
+ const loadedKeys = actions.map(snap => snap.key);
143
+ return { actions, lastKeyToLoad, loadedKeys };
144
+ }),
112
145
  // This is the magical part, only emit when the last load key
113
146
  // in the dataset has been loaded by a child event. At this point
114
147
  // we can assume the dataset is "whole".
115
- skipWhile((meta) => meta.loadedKeys.indexOf(meta.lastKeyToLoad) === -1),
148
+ skipWhile(meta => meta.loadedKeys.indexOf(meta.lastKeyToLoad) === -1),
116
149
  // Pluck off the meta data because the user only cares
117
150
  // to iterate through the snapshots
118
- map2((meta) => meta.actions)
119
- );
151
+ map(meta => meta.actions));
120
152
  }
121
153
 
122
- // list/data-operation.mjs
123
154
  function createDataOperationMethod(ref, operation) {
124
- return function dataOperation(item, value) {
125
- return checkOperationCases(item, {
126
- stringCase: () => ref.child(item)[operation](value),
127
- firebaseCase: () => item[operation](value),
128
- snapshotCase: () => item.ref[operation](value)
129
- });
130
- };
155
+ return function dataOperation(item, value) {
156
+ return checkOperationCases(item, {
157
+ stringCase: () => ref.child(item)[operation](value),
158
+ firebaseCase: () => item[operation](value),
159
+ snapshotCase: () => item.ref[operation](value)
160
+ });
161
+ };
131
162
  }
132
163
 
133
- // list/remove.mjs
164
+ // TODO(davideast): Find out why TS thinks this returns firebase.Primise
165
+ // instead of Promise.
134
166
  function createRemoveMethod(ref) {
135
- return function remove(item) {
136
- if (!item) {
137
- return ref.remove();
138
- }
139
- return checkOperationCases(item, {
140
- stringCase: () => ref.child(item).remove(),
141
- firebaseCase: () => item.remove(),
142
- snapshotCase: () => item.ref.remove()
143
- });
144
- };
167
+ return function remove(item) {
168
+ if (!item) {
169
+ return ref.remove();
170
+ }
171
+ return checkOperationCases(item, {
172
+ stringCase: () => ref.child(item).remove(),
173
+ firebaseCase: () => item.remove(),
174
+ snapshotCase: () => item.ref.remove()
175
+ });
176
+ };
145
177
  }
146
178
 
147
- // list/changes.mjs
148
- import { merge as merge2, of } from "rxjs";
149
- import { distinctUntilChanged, scan as scan2, switchMap } from "rxjs/operators";
150
179
  function listChanges(ref, events, scheduler) {
151
- return fromRef(ref, "value", "once", scheduler).pipe(switchMap((snapshotAction) => {
152
- const childEvent$ = [of(snapshotAction)];
153
- events.forEach((event) => childEvent$.push(fromRef(ref, event, "on", scheduler)));
154
- return merge2(...childEvent$).pipe(scan2(buildView, []));
155
- }), distinctUntilChanged());
180
+ return fromRef(ref, 'value', 'once', scheduler).pipe(switchMap(snapshotAction => {
181
+ const childEvent$ = [of(snapshotAction)];
182
+ events.forEach(event => childEvent$.push(fromRef(ref, event, 'on', scheduler)));
183
+ return merge(...childEvent$).pipe(scan(buildView, []));
184
+ }), distinctUntilChanged());
156
185
  }
157
186
  function positionFor(changes, key) {
158
- const len = changes.length;
159
- for (let i = 0; i < len; i++) {
160
- if (changes[i].payload.key === key) {
161
- return i;
187
+ const len = changes.length;
188
+ for (let i = 0; i < len; i++) {
189
+ if (changes[i].payload.key === key) {
190
+ return i;
191
+ }
162
192
  }
163
- }
164
- return -1;
193
+ return -1;
165
194
  }
166
195
  function positionAfter(changes, prevKey) {
167
- if (isNil(prevKey)) {
168
- return 0;
169
- } else {
170
- const i = positionFor(changes, prevKey);
171
- if (i === -1) {
172
- return changes.length;
173
- } else {
174
- return i + 1;
196
+ if (isNil(prevKey)) {
197
+ return 0;
198
+ }
199
+ else {
200
+ const i = positionFor(changes, prevKey);
201
+ if (i === -1) {
202
+ return changes.length;
203
+ }
204
+ else {
205
+ return i + 1;
206
+ }
175
207
  }
176
- }
177
208
  }
178
209
  function buildView(current, action) {
179
- const { payload, prevKey, key } = action;
180
- const currentKeyPosition = positionFor(current, key);
181
- const afterPreviousKeyPosition = positionAfter(current, prevKey);
182
- switch (action.type) {
183
- case "value":
184
- if (action.payload?.exists()) {
185
- let prevKey2 = null;
186
- action.payload.forEach((payload2) => {
187
- const action2 = { payload: payload2, type: "value", prevKey: prevKey2, key: payload2.key };
188
- prevKey2 = payload2.key;
189
- current = [...current, action2];
190
- return false;
191
- });
192
- }
193
- return current;
194
- case "child_added":
195
- if (currentKeyPosition > -1) {
196
- const previous = current[currentKeyPosition - 1];
197
- if ((previous?.key || null) !== prevKey) {
198
- current = current.filter((x) => x.payload.key !== payload.key);
199
- current.splice(afterPreviousKeyPosition, 0, action);
200
- }
201
- } else if (prevKey == null) {
202
- return [action, ...current];
203
- } else {
204
- current = current.slice();
205
- current.splice(afterPreviousKeyPosition, 0, action);
206
- }
207
- return current;
208
- case "child_removed":
209
- return current.filter((x) => x.payload.key !== payload.key);
210
- case "child_changed":
211
- return current.map((x) => x.payload.key === key ? action : x);
212
- case "child_moved":
213
- if (currentKeyPosition > -1) {
214
- const data = current.splice(currentKeyPosition, 1)[0];
215
- current = current.slice();
216
- current.splice(afterPreviousKeyPosition, 0, data);
217
- return current;
218
- }
219
- return current;
220
- default:
221
- return current;
222
- }
210
+ const { payload, prevKey, key } = action;
211
+ const currentKeyPosition = positionFor(current, key);
212
+ const afterPreviousKeyPosition = positionAfter(current, prevKey);
213
+ switch (action.type) {
214
+ case 'value':
215
+ if (action.payload?.exists()) {
216
+ let prevKey = null;
217
+ action.payload.forEach(payload => {
218
+ const action = { payload, type: 'value', prevKey, key: payload.key };
219
+ prevKey = payload.key;
220
+ current = [...current, action];
221
+ return false;
222
+ });
223
+ }
224
+ return current;
225
+ case 'child_added':
226
+ if (currentKeyPosition > -1) {
227
+ // check that the previouskey is what we expect, else reorder
228
+ const previous = current[currentKeyPosition - 1];
229
+ if ((previous?.key || null) !== prevKey) {
230
+ current = current.filter(x => x.payload.key !== payload.key);
231
+ current.splice(afterPreviousKeyPosition, 0, action);
232
+ }
233
+ }
234
+ else if (prevKey == null) {
235
+ return [action, ...current];
236
+ }
237
+ else {
238
+ current = current.slice();
239
+ current.splice(afterPreviousKeyPosition, 0, action);
240
+ }
241
+ return current;
242
+ case 'child_removed':
243
+ return current.filter(x => x.payload.key !== payload.key);
244
+ case 'child_changed':
245
+ return current.map(x => x.payload.key === key ? action : x);
246
+ case 'child_moved':
247
+ if (currentKeyPosition > -1) {
248
+ const data = current.splice(currentKeyPosition, 1)[0];
249
+ current = current.slice();
250
+ current.splice(afterPreviousKeyPosition, 0, data);
251
+ return current;
252
+ }
253
+ return current;
254
+ // default will also remove null results
255
+ default:
256
+ return current;
257
+ }
223
258
  }
224
259
 
225
- // list/snapshot-changes.mjs
226
260
  function snapshotChanges(query, events, scheduler) {
227
- events = validateEventsArray(events);
228
- return listChanges(query, events, scheduler);
261
+ events = validateEventsArray(events);
262
+ return listChanges(query, events, scheduler);
229
263
  }
230
264
 
231
- // list/create-reference.mjs
232
- import { keepUnstableUntilFirst } from "@angular/fire";
233
- import { map as map3 } from "rxjs/operators";
234
265
  function createListReference(query, afDatabase) {
235
- const outsideAngularScheduler = afDatabase.schedulers.outsideAngular;
236
- const refInZone = afDatabase.schedulers.ngZone.run(() => query.ref);
237
- return {
238
- query,
239
- update: createDataOperationMethod(refInZone, "update"),
240
- set: createDataOperationMethod(refInZone, "set"),
241
- push: (data) => refInZone.push(data),
242
- remove: createRemoveMethod(refInZone),
243
- snapshotChanges(events) {
244
- return snapshotChanges(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
245
- },
246
- stateChanges(events) {
247
- return stateChanges(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
248
- },
249
- auditTrail(events) {
250
- return auditTrail(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
251
- },
252
- valueChanges(events, options) {
253
- const snapshotChanges$ = snapshotChanges(query, events, outsideAngularScheduler);
254
- return snapshotChanges$.pipe(map3((actions) => actions.map((a) => {
255
- if (options && options.idField) {
256
- return {
257
- ...a.payload.val(),
258
- ...{
259
- [options.idField]: a.key
260
- }
261
- };
262
- } else {
263
- return a.payload.val();
266
+ const outsideAngularScheduler = afDatabase.schedulers.outsideAngular;
267
+ const refInZone = afDatabase.schedulers.ngZone.run(() => query.ref);
268
+ return {
269
+ query,
270
+ update: createDataOperationMethod(refInZone, 'update'),
271
+ set: createDataOperationMethod(refInZone, 'set'),
272
+ push: (data) => refInZone.push(data),
273
+ remove: createRemoveMethod(refInZone),
274
+ snapshotChanges(events) {
275
+ return snapshotChanges(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
276
+ },
277
+ stateChanges(events) {
278
+ return stateChanges(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
279
+ },
280
+ auditTrail(events) {
281
+ return auditTrail(query, events, outsideAngularScheduler).pipe(keepUnstableUntilFirst);
282
+ },
283
+ valueChanges(events, options) {
284
+ const snapshotChanges$ = snapshotChanges(query, events, outsideAngularScheduler);
285
+ return snapshotChanges$.pipe(map(actions => actions.map(a => {
286
+ if (options && options.idField) {
287
+ return {
288
+ ...a.payload.val(),
289
+ ...{
290
+ [options.idField]: a.key
291
+ }
292
+ };
293
+ }
294
+ else {
295
+ return a.payload.val();
296
+ }
297
+ })), keepUnstableUntilFirst);
264
298
  }
265
- })), keepUnstableUntilFirst);
266
- }
267
- };
299
+ };
268
300
  }
269
301
 
270
- // object/snapshot-changes.mjs
271
302
  function createObjectSnapshotChanges(query, scheduler) {
272
- return function snapshotChanges2() {
273
- return fromRef(query, "value", "on", scheduler);
274
- };
303
+ return function snapshotChanges() {
304
+ return fromRef(query, 'value', 'on', scheduler);
305
+ };
275
306
  }
276
307
 
277
- // object/create-reference.mjs
278
- import { keepUnstableUntilFirst as keepUnstableUntilFirst2 } from "@angular/fire";
279
- import { map as map4 } from "rxjs/operators";
280
308
  function createObjectReference(query, afDatabase) {
281
- return {
282
- query,
283
- snapshotChanges() {
284
- return createObjectSnapshotChanges(query, afDatabase.schedulers.outsideAngular)().pipe(keepUnstableUntilFirst2);
285
- },
286
- update(data) {
287
- return query.ref.update(data);
288
- },
289
- set(data) {
290
- return query.ref.set(data);
291
- },
292
- remove() {
293
- return query.ref.remove();
294
- },
295
- valueChanges() {
296
- const snapshotChanges$ = createObjectSnapshotChanges(query, afDatabase.schedulers.outsideAngular)();
297
- return snapshotChanges$.pipe(keepUnstableUntilFirst2, map4((action) => action.payload.exists() ? action.payload.val() : null));
298
- }
299
- };
309
+ return {
310
+ query,
311
+ snapshotChanges() {
312
+ return createObjectSnapshotChanges(query, afDatabase.schedulers.outsideAngular)().pipe(keepUnstableUntilFirst);
313
+ },
314
+ update(data) { return query.ref.update(data); },
315
+ set(data) { return query.ref.set(data); },
316
+ remove() { return query.ref.remove(); },
317
+ valueChanges() {
318
+ const snapshotChanges$ = createObjectSnapshotChanges(query, afDatabase.schedulers.outsideAngular)();
319
+ return snapshotChanges$.pipe(keepUnstableUntilFirst, map(action => action.payload.exists() ? action.payload.val() : null));
320
+ },
321
+ };
300
322
  }
301
323
 
302
- // database.mjs
303
- import { Inject, Injectable, InjectionToken, NgZone, Optional, PLATFORM_ID } from "@angular/core";
304
- import { ɵAngularFireSchedulers } from "@angular/fire";
305
- import { AppCheckInstances } from "@angular/fire/app-check";
306
- import { FIREBASE_APP_NAME, FIREBASE_OPTIONS, ɵcacheInstance, ɵfirebaseAppFactory } from "@angular/fire/compat";
307
- import { SETTINGS as AUTH_SETTINGS, AngularFireAuth, LANGUAGE_CODE, PERSISTENCE, TENANT_ID, USE_EMULATOR as USE_AUTH_EMULATOR, USE_DEVICE_LANGUAGE, ɵauthFactory } from "@angular/fire/compat/auth";
308
- import "firebase/compat/auth";
309
- import "firebase/compat/database";
310
- import * as i0 from "@angular/core";
311
- import * as i1 from "@angular/fire";
312
- import * as i2 from "@angular/fire/compat/auth";
313
- import * as i3 from "@angular/fire/app-check";
314
- var URL = new InjectionToken("angularfire2.realtimeDatabaseURL");
315
- var USE_EMULATOR = new InjectionToken("angularfire2.database.use-emulator");
316
- var AngularFireDatabase = class _AngularFireDatabase {
317
- schedulers;
318
- database;
319
- constructor(options, name, databaseURL, platformId, zone, schedulers, _useEmulator, auth, useAuthEmulator, authSettings, tenantId, languageCode, useDeviceLanguage, persistence, _appCheckInstances) {
320
- this.schedulers = schedulers;
321
- const useEmulator = _useEmulator;
322
- const app = ɵfirebaseAppFactory(options, zone, name);
323
- if (auth) {
324
- ɵauthFactory(app, zone, useAuthEmulator, tenantId, languageCode, useDeviceLanguage, authSettings, persistence);
324
+ const URL = new InjectionToken('angularfire2.realtimeDatabaseURL');
325
+ const USE_EMULATOR = new InjectionToken('angularfire2.database.use-emulator');
326
+ class AngularFireDatabase {
327
+ schedulers;
328
+ database;
329
+ constructor(options, name, databaseURL,
330
+ // eslint-disable-next-line @typescript-eslint/ban-types
331
+ platformId, zone, schedulers, _useEmulator, // tuple isn't working here
332
+ auth, useAuthEmulator, authSettings, // can't use firebase.auth.AuthSettings here
333
+ tenantId, languageCode, useDeviceLanguage, persistence, _appCheckInstances) {
334
+ this.schedulers = schedulers;
335
+ const useEmulator = _useEmulator;
336
+ const app = _firebaseAppFactory(options, zone, name);
337
+ if (auth) {
338
+ _authFactory(app, zone, useAuthEmulator, tenantId, languageCode, useDeviceLanguage, authSettings, persistence);
339
+ }
340
+ this.database = _cacheInstance(`${app.name}.database.${databaseURL}`, 'AngularFireDatabase', app.name, () => {
341
+ const database = zone.runOutsideAngular(() => app.database(databaseURL || undefined));
342
+ if (useEmulator) {
343
+ database.useEmulator(...useEmulator);
344
+ }
345
+ return database;
346
+ }, [useEmulator]);
347
+ }
348
+ list(pathOrRef, queryFn) {
349
+ const ref = this.schedulers.ngZone.runOutsideAngular(() => getRef(this.database, pathOrRef));
350
+ let query = ref;
351
+ if (queryFn) {
352
+ query = queryFn(ref);
353
+ }
354
+ return createListReference(query, this);
355
+ }
356
+ object(pathOrRef) {
357
+ const ref = this.schedulers.ngZone.runOutsideAngular(() => getRef(this.database, pathOrRef));
358
+ return createObjectReference(ref, this);
325
359
  }
326
- this.database = ɵcacheInstance(`${app.name}.database.${databaseURL}`, "AngularFireDatabase", app.name, () => {
327
- const database = zone.runOutsideAngular(() => app.database(databaseURL || void 0));
328
- if (useEmulator) {
329
- database.useEmulator(...useEmulator);
330
- }
331
- return database;
332
- }, [useEmulator]);
333
- }
334
- list(pathOrRef, queryFn) {
335
- const ref = this.schedulers.ngZone.runOutsideAngular(() => getRef(this.database, pathOrRef));
336
- let query = ref;
337
- if (queryFn) {
338
- query = queryFn(ref);
360
+ createPushId() {
361
+ const ref = this.schedulers.ngZone.runOutsideAngular(() => this.database.ref());
362
+ return ref.push().key;
339
363
  }
340
- return createListReference(query, this);
341
- }
342
- object(pathOrRef) {
343
- const ref = this.schedulers.ngZone.runOutsideAngular(() => getRef(this.database, pathOrRef));
344
- return createObjectReference(ref, this);
345
- }
346
- createPushId() {
347
- const ref = this.schedulers.ngZone.runOutsideAngular(() => this.database.ref());
348
- return ref.push().key;
349
- }
350
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireDatabase, deps: [{ token: FIREBASE_OPTIONS }, { token: FIREBASE_APP_NAME, optional: true }, { token: URL, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i1.ɵAngularFireSchedulers }, { token: USE_EMULATOR, optional: true }, { token: i2.AngularFireAuth, optional: true }, { token: USE_AUTH_EMULATOR, optional: true }, { token: AUTH_SETTINGS, optional: true }, { token: TENANT_ID, optional: true }, { token: LANGUAGE_CODE, optional: true }, { token: USE_DEVICE_LANGUAGE, optional: true }, { token: PERSISTENCE, optional: true }, { token: i3.AppCheckInstances, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
351
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: _AngularFireDatabase, providedIn: "any" });
352
- };
353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i0, type: AngularFireDatabase, decorators: [{
354
- type: Injectable,
355
- args: [{
356
- providedIn: "any"
357
- }]
358
- }], ctorParameters: () => [{ type: void 0, decorators: [{
359
- type: Inject,
360
- args: [FIREBASE_OPTIONS]
361
- }] }, { type: void 0, decorators: [{
362
- type: Optional
363
- }, {
364
- type: Inject,
365
- args: [FIREBASE_APP_NAME]
366
- }] }, { type: void 0, decorators: [{
367
- type: Optional
368
- }, {
369
- type: Inject,
370
- args: [URL]
371
- }] }, { type: Object, decorators: [{
372
- type: Inject,
373
- args: [PLATFORM_ID]
374
- }] }, { type: i0.NgZone }, { type: i1.ɵAngularFireSchedulers }, { type: void 0, decorators: [{
375
- type: Optional
376
- }, {
377
- type: Inject,
378
- args: [USE_EMULATOR]
379
- }] }, { type: i2.AngularFireAuth, decorators: [{
380
- type: Optional
381
- }] }, { type: void 0, decorators: [{
382
- type: Optional
383
- }, {
384
- type: Inject,
385
- args: [USE_AUTH_EMULATOR]
386
- }] }, { type: void 0, decorators: [{
387
- type: Optional
388
- }, {
389
- type: Inject,
390
- args: [AUTH_SETTINGS]
391
- }] }, { type: void 0, decorators: [{
392
- type: Optional
393
- }, {
394
- type: Inject,
395
- args: [TENANT_ID]
396
- }] }, { type: void 0, decorators: [{
397
- type: Optional
398
- }, {
399
- type: Inject,
400
- args: [LANGUAGE_CODE]
401
- }] }, { type: void 0, decorators: [{
402
- type: Optional
403
- }, {
404
- type: Inject,
405
- args: [USE_DEVICE_LANGUAGE]
406
- }] }, { type: void 0, decorators: [{
407
- type: Optional
408
- }, {
409
- type: Inject,
410
- args: [PERSISTENCE]
411
- }] }, { type: i3.AppCheckInstances, decorators: [{
412
- type: Optional
413
- }] }] });
364
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabase, deps: [{ token: FIREBASE_OPTIONS }, { token: FIREBASE_APP_NAME, optional: true }, { token: URL, optional: true }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: i1.ɵAngularFireSchedulers }, { token: USE_EMULATOR, optional: true }, { token: i2.AngularFireAuth, optional: true }, { token: USE_EMULATOR$1, optional: true }, { token: SETTINGS, optional: true }, { token: TENANT_ID, optional: true }, { token: LANGUAGE_CODE, optional: true }, { token: USE_DEVICE_LANGUAGE, optional: true }, { token: PERSISTENCE, optional: true }, { token: i3.AppCheckInstances, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
365
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabase, providedIn: 'any' });
366
+ }
367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabase, decorators: [{
368
+ type: Injectable,
369
+ args: [{
370
+ providedIn: 'any'
371
+ }]
372
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
373
+ type: Inject,
374
+ args: [FIREBASE_OPTIONS]
375
+ }] }, { type: undefined, decorators: [{
376
+ type: Optional
377
+ }, {
378
+ type: Inject,
379
+ args: [FIREBASE_APP_NAME]
380
+ }] }, { type: undefined, decorators: [{
381
+ type: Optional
382
+ }, {
383
+ type: Inject,
384
+ args: [URL]
385
+ }] }, { type: Object, decorators: [{
386
+ type: Inject,
387
+ args: [PLATFORM_ID]
388
+ }] }, { type: i0.NgZone }, { type: i1.ɵAngularFireSchedulers }, { type: undefined, decorators: [{
389
+ type: Optional
390
+ }, {
391
+ type: Inject,
392
+ args: [USE_EMULATOR]
393
+ }] }, { type: i2.AngularFireAuth, decorators: [{
394
+ type: Optional
395
+ }] }, { type: undefined, decorators: [{
396
+ type: Optional
397
+ }, {
398
+ type: Inject,
399
+ args: [USE_EMULATOR$1]
400
+ }] }, { type: undefined, decorators: [{
401
+ type: Optional
402
+ }, {
403
+ type: Inject,
404
+ args: [SETTINGS]
405
+ }] }, { type: undefined, decorators: [{
406
+ type: Optional
407
+ }, {
408
+ type: Inject,
409
+ args: [TENANT_ID]
410
+ }] }, { type: undefined, decorators: [{
411
+ type: Optional
412
+ }, {
413
+ type: Inject,
414
+ args: [LANGUAGE_CODE]
415
+ }] }, { type: undefined, decorators: [{
416
+ type: Optional
417
+ }, {
418
+ type: Inject,
419
+ args: [USE_DEVICE_LANGUAGE]
420
+ }] }, { type: undefined, decorators: [{
421
+ type: Optional
422
+ }, {
423
+ type: Inject,
424
+ args: [PERSISTENCE]
425
+ }] }, { type: i3.AppCheckInstances, decorators: [{
426
+ type: Optional
427
+ }] }] });
428
+
429
+ class AngularFireDatabaseModule {
430
+ constructor() {
431
+ firebase.registerVersion('angularfire', VERSION.full, 'rtdb-compat');
432
+ }
433
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
434
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabaseModule });
435
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabaseModule, providers: [AngularFireDatabase] });
436
+ }
437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: AngularFireDatabaseModule, decorators: [{
438
+ type: NgModule,
439
+ args: [{
440
+ providers: [AngularFireDatabase]
441
+ }]
442
+ }], ctorParameters: () => [] });
443
+
444
+ /**
445
+ * Generated bundle index. Do not edit.
446
+ */
414
447
 
415
- // database.module.mjs
416
- import { NgModule } from "@angular/core";
417
- import { VERSION } from "@angular/fire";
418
- import firebase from "firebase/compat/app";
419
- import * as i02 from "@angular/core";
420
- var AngularFireDatabaseModule = class _AngularFireDatabaseModule {
421
- constructor() {
422
- firebase.registerVersion("angularfire", VERSION.full, "rtdb-compat");
423
- }
424
- static ɵfac = i02.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _AngularFireDatabaseModule, deps: [], target: i02.ɵɵFactoryTarget.NgModule });
425
- static ɵmod = i02.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _AngularFireDatabaseModule });
426
- static ɵinj = i02.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: _AngularFireDatabaseModule, providers: [AngularFireDatabase] });
427
- };
428
- i02.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.3", ngImport: i02, type: AngularFireDatabaseModule, decorators: [{
429
- type: NgModule,
430
- args: [{
431
- providers: [AngularFireDatabase]
432
- }]
433
- }], ctorParameters: () => [] });
434
- export {
435
- AngularFireDatabase,
436
- AngularFireDatabaseModule,
437
- URL,
438
- USE_EMULATOR,
439
- auditTrail,
440
- createListReference,
441
- fromRef,
442
- listChanges,
443
- snapshotChanges,
444
- stateChanges
445
- };
448
+ export { AngularFireDatabase, AngularFireDatabaseModule, URL, USE_EMULATOR, auditTrail, createListReference, fromRef, listChanges, snapshotChanges, stateChanges };
446
449
  //# sourceMappingURL=angular-fire-compat-database.mjs.map