@firebase/database-compat 1.0.10 → 2.0.0-canary.a75082f06

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.
@@ -5,7 +5,7 @@ import { errorPrefix, validateArgCount, validateCallback, validateContextObject,
5
5
  import { Logger } from '@firebase/logger';
6
6
 
7
7
  const name = "@firebase/database-compat";
8
- const version = "1.0.10";
8
+ const version = "2.0.0-canary.a75082f06";
9
9
 
10
10
  /**
11
11
  * @license
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
12
12
 
13
13
  const name = "@firebase/database-compat";
14
- const version = "1.0.10";
14
+ const version = "2.0.0-canary.a75082f06";
15
15
 
16
16
  /**
17
17
  * @license
@@ -5,7 +5,7 @@ import { errorPrefix, validateArgCount, validateCallback, validateContextObject,
5
5
  import { Logger } from '@firebase/logger';
6
6
 
7
7
  const name = "@firebase/database-compat";
8
- const version = "1.0.10";
8
+ const version = "2.0.0-canary.a75082f06";
9
9
 
10
10
  /**
11
11
  * @license
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/database-compat",
3
- "version": "1.0.10",
3
+ "version": "2.0.0-canary.a75082f06",
4
4
  "description": "The Realtime Database component of the Firebase JS SDK.",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.js",
@@ -49,15 +49,15 @@
49
49
  "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r Database:types.FirebaseDatabase -r Query:types.Query -r DatabaseReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database"
50
50
  },
51
51
  "dependencies": {
52
- "@firebase/database": "1.0.9",
53
- "@firebase/database-types": "1.0.6",
54
- "@firebase/logger": "0.4.3",
55
- "@firebase/util": "1.10.1",
56
- "@firebase/component": "0.6.10",
52
+ "@firebase/database": "1.0.9-canary.a75082f06",
53
+ "@firebase/database-types": "1.0.6-canary.a75082f06",
54
+ "@firebase/logger": "0.4.3-canary.a75082f06",
55
+ "@firebase/util": "1.10.1-canary.a75082f06",
56
+ "@firebase/component": "0.6.10-canary.a75082f06",
57
57
  "tslib": "^2.1.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@firebase/app-compat": "0.2.44",
60
+ "@firebase/app-compat": "0.2.45-canary.a75082f06",
61
61
  "typescript": "4.7.4"
62
62
  },
63
63
  "repository": {
@@ -67,5 +67,8 @@
67
67
  },
68
68
  "bugs": {
69
69
  "url": "https://github.com/firebase/firebase-js-sdk/issues"
70
+ },
71
+ "engines": {
72
+ "node": ">=18.0.0"
70
73
  }
71
74
  }
@@ -1,914 +0,0 @@
1
- import firebase from '@firebase/app-compat';
2
- import { ComponentContainer, Provider, Component } from '@firebase/component';
3
- import { _validatePathString, onChildMoved, onChildChanged, onChildRemoved, onChildAdded, onValue, off, get, query, limitToFirst, limitToLast, orderByChild, orderByKey, orderByPriority, orderByValue, startAt, startAfter, endAt, endBefore, equalTo, _ReferenceImpl, _QueryImpl, _QueryParams, child, set, _validateWritablePath, update, setWithPriority, remove, runTransaction, setPriority, push, OnDisconnect as OnDisconnect$1, connectDatabaseEmulator, refFromURL, ref, goOffline, goOnline, serverTimestamp, increment, forceWebSockets, forceLongPolling, _setSDKVersion, _repoManagerDatabaseFromApp, enableLogging } from '@firebase/database';
4
- import { errorPrefix, validateArgCount, validateCallback, validateContextObject, Deferred } from '@firebase/util';
5
- import { __extends } from 'tslib';
6
- import { Logger } from '@firebase/logger';
7
-
8
- var name = "@firebase/database-compat";
9
- var version = "1.0.7";
10
-
11
- /**
12
- * @license
13
- * Copyright 2021 Google LLC
14
- *
15
- * Licensed under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License.
17
- * You may obtain a copy of the License at
18
- *
19
- * http://www.apache.org/licenses/LICENSE-2.0
20
- *
21
- * Unless required by applicable law or agreed to in writing, software
22
- * distributed under the License is distributed on an "AS IS" BASIS,
23
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- * See the License for the specific language governing permissions and
25
- * limitations under the License.
26
- */
27
- var logClient = new Logger('@firebase/database-compat');
28
- var warn = function (msg) {
29
- var message = 'FIREBASE WARNING: ' + msg;
30
- logClient.warn(message);
31
- };
32
-
33
- /**
34
- * @license
35
- * Copyright 2021 Google LLC
36
- *
37
- * Licensed under the Apache License, Version 2.0 (the "License");
38
- * you may not use this file except in compliance with the License.
39
- * You may obtain a copy of the License at
40
- *
41
- * http://www.apache.org/licenses/LICENSE-2.0
42
- *
43
- * Unless required by applicable law or agreed to in writing, software
44
- * distributed under the License is distributed on an "AS IS" BASIS,
45
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46
- * See the License for the specific language governing permissions and
47
- * limitations under the License.
48
- */
49
- var validateBoolean = function (fnName, argumentName, bool, optional) {
50
- if (optional && bool === undefined) {
51
- return;
52
- }
53
- if (typeof bool !== 'boolean') {
54
- throw new Error(errorPrefix(fnName, argumentName) + 'must be a boolean.');
55
- }
56
- };
57
- var validateEventType = function (fnName, eventType, optional) {
58
- if (optional && eventType === undefined) {
59
- return;
60
- }
61
- switch (eventType) {
62
- case 'value':
63
- case 'child_added':
64
- case 'child_removed':
65
- case 'child_changed':
66
- case 'child_moved':
67
- break;
68
- default:
69
- throw new Error(errorPrefix(fnName, 'eventType') +
70
- 'must be a valid event type = "value", "child_added", "child_removed", ' +
71
- '"child_changed", or "child_moved".');
72
- }
73
- };
74
-
75
- /**
76
- * @license
77
- * Copyright 2017 Google LLC
78
- *
79
- * Licensed under the Apache License, Version 2.0 (the "License");
80
- * you may not use this file except in compliance with the License.
81
- * You may obtain a copy of the License at
82
- *
83
- * http://www.apache.org/licenses/LICENSE-2.0
84
- *
85
- * Unless required by applicable law or agreed to in writing, software
86
- * distributed under the License is distributed on an "AS IS" BASIS,
87
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
88
- * See the License for the specific language governing permissions and
89
- * limitations under the License.
90
- */
91
- var OnDisconnect = /** @class */ (function () {
92
- function OnDisconnect(_delegate) {
93
- this._delegate = _delegate;
94
- }
95
- OnDisconnect.prototype.cancel = function (onComplete) {
96
- validateArgCount('OnDisconnect.cancel', 0, 1, arguments.length);
97
- validateCallback('OnDisconnect.cancel', 'onComplete', onComplete, true);
98
- var result = this._delegate.cancel();
99
- if (onComplete) {
100
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
101
- }
102
- return result;
103
- };
104
- OnDisconnect.prototype.remove = function (onComplete) {
105
- validateArgCount('OnDisconnect.remove', 0, 1, arguments.length);
106
- validateCallback('OnDisconnect.remove', 'onComplete', onComplete, true);
107
- var result = this._delegate.remove();
108
- if (onComplete) {
109
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
110
- }
111
- return result;
112
- };
113
- OnDisconnect.prototype.set = function (value, onComplete) {
114
- validateArgCount('OnDisconnect.set', 1, 2, arguments.length);
115
- validateCallback('OnDisconnect.set', 'onComplete', onComplete, true);
116
- var result = this._delegate.set(value);
117
- if (onComplete) {
118
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
119
- }
120
- return result;
121
- };
122
- OnDisconnect.prototype.setWithPriority = function (value, priority, onComplete) {
123
- validateArgCount('OnDisconnect.setWithPriority', 2, 3, arguments.length);
124
- validateCallback('OnDisconnect.setWithPriority', 'onComplete', onComplete, true);
125
- var result = this._delegate.setWithPriority(value, priority);
126
- if (onComplete) {
127
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
128
- }
129
- return result;
130
- };
131
- OnDisconnect.prototype.update = function (objectToMerge, onComplete) {
132
- validateArgCount('OnDisconnect.update', 1, 2, arguments.length);
133
- if (Array.isArray(objectToMerge)) {
134
- var newObjectToMerge = {};
135
- for (var i = 0; i < objectToMerge.length; ++i) {
136
- newObjectToMerge['' + i] = objectToMerge[i];
137
- }
138
- objectToMerge = newObjectToMerge;
139
- warn('Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the ' +
140
- 'existing data, or an Object with integer keys if you really do want to only update some of the children.');
141
- }
142
- validateCallback('OnDisconnect.update', 'onComplete', onComplete, true);
143
- var result = this._delegate.update(objectToMerge);
144
- if (onComplete) {
145
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
146
- }
147
- return result;
148
- };
149
- return OnDisconnect;
150
- }());
151
-
152
- /**
153
- * @license
154
- * Copyright 2017 Google LLC
155
- *
156
- * Licensed under the Apache License, Version 2.0 (the "License");
157
- * you may not use this file except in compliance with the License.
158
- * You may obtain a copy of the License at
159
- *
160
- * http://www.apache.org/licenses/LICENSE-2.0
161
- *
162
- * Unless required by applicable law or agreed to in writing, software
163
- * distributed under the License is distributed on an "AS IS" BASIS,
164
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
165
- * See the License for the specific language governing permissions and
166
- * limitations under the License.
167
- */
168
- var TransactionResult = /** @class */ (function () {
169
- /**
170
- * A type for the resolve value of Firebase.transaction.
171
- */
172
- function TransactionResult(committed, snapshot) {
173
- this.committed = committed;
174
- this.snapshot = snapshot;
175
- }
176
- // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary
177
- // for end-users
178
- TransactionResult.prototype.toJSON = function () {
179
- validateArgCount('TransactionResult.toJSON', 0, 1, arguments.length);
180
- return { committed: this.committed, snapshot: this.snapshot.toJSON() };
181
- };
182
- return TransactionResult;
183
- }());
184
-
185
- /**
186
- * @license
187
- * Copyright 2017 Google LLC
188
- *
189
- * Licensed under the Apache License, Version 2.0 (the "License");
190
- * you may not use this file except in compliance with the License.
191
- * You may obtain a copy of the License at
192
- *
193
- * http://www.apache.org/licenses/LICENSE-2.0
194
- *
195
- * Unless required by applicable law or agreed to in writing, software
196
- * distributed under the License is distributed on an "AS IS" BASIS,
197
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
- * See the License for the specific language governing permissions and
199
- * limitations under the License.
200
- */
201
- /**
202
- * Class representing a firebase data snapshot. It wraps a SnapshotNode and
203
- * surfaces the public methods (val, forEach, etc.) we want to expose.
204
- */
205
- var DataSnapshot = /** @class */ (function () {
206
- function DataSnapshot(_database, _delegate) {
207
- this._database = _database;
208
- this._delegate = _delegate;
209
- }
210
- /**
211
- * Retrieves the snapshot contents as JSON. Returns null if the snapshot is
212
- * empty.
213
- *
214
- * @returns JSON representation of the DataSnapshot contents, or null if empty.
215
- */
216
- DataSnapshot.prototype.val = function () {
217
- validateArgCount('DataSnapshot.val', 0, 0, arguments.length);
218
- return this._delegate.val();
219
- };
220
- /**
221
- * Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting
222
- * the entire node contents.
223
- * @returns JSON representation of the DataSnapshot contents, or null if empty.
224
- */
225
- DataSnapshot.prototype.exportVal = function () {
226
- validateArgCount('DataSnapshot.exportVal', 0, 0, arguments.length);
227
- return this._delegate.exportVal();
228
- };
229
- // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary
230
- // for end-users
231
- DataSnapshot.prototype.toJSON = function () {
232
- // Optional spacer argument is unnecessary because we're depending on recursion rather than stringifying the content
233
- validateArgCount('DataSnapshot.toJSON', 0, 1, arguments.length);
234
- return this._delegate.toJSON();
235
- };
236
- /**
237
- * Returns whether the snapshot contains a non-null value.
238
- *
239
- * @returns Whether the snapshot contains a non-null value, or is empty.
240
- */
241
- DataSnapshot.prototype.exists = function () {
242
- validateArgCount('DataSnapshot.exists', 0, 0, arguments.length);
243
- return this._delegate.exists();
244
- };
245
- /**
246
- * Returns a DataSnapshot of the specified child node's contents.
247
- *
248
- * @param path - Path to a child.
249
- * @returns DataSnapshot for child node.
250
- */
251
- DataSnapshot.prototype.child = function (path) {
252
- validateArgCount('DataSnapshot.child', 0, 1, arguments.length);
253
- // Ensure the childPath is a string (can be a number)
254
- path = String(path);
255
- _validatePathString('DataSnapshot.child', 'path', path, false);
256
- return new DataSnapshot(this._database, this._delegate.child(path));
257
- };
258
- /**
259
- * Returns whether the snapshot contains a child at the specified path.
260
- *
261
- * @param path - Path to a child.
262
- * @returns Whether the child exists.
263
- */
264
- DataSnapshot.prototype.hasChild = function (path) {
265
- validateArgCount('DataSnapshot.hasChild', 1, 1, arguments.length);
266
- _validatePathString('DataSnapshot.hasChild', 'path', path, false);
267
- return this._delegate.hasChild(path);
268
- };
269
- /**
270
- * Returns the priority of the object, or null if no priority was set.
271
- *
272
- * @returns The priority.
273
- */
274
- DataSnapshot.prototype.getPriority = function () {
275
- validateArgCount('DataSnapshot.getPriority', 0, 0, arguments.length);
276
- return this._delegate.priority;
277
- };
278
- /**
279
- * Iterates through child nodes and calls the specified action for each one.
280
- *
281
- * @param action - Callback function to be called
282
- * for each child.
283
- * @returns True if forEach was canceled by action returning true for
284
- * one of the child nodes.
285
- */
286
- DataSnapshot.prototype.forEach = function (action) {
287
- var _this = this;
288
- validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length);
289
- validateCallback('DataSnapshot.forEach', 'action', action, false);
290
- return this._delegate.forEach(function (expDataSnapshot) {
291
- return action(new DataSnapshot(_this._database, expDataSnapshot));
292
- });
293
- };
294
- /**
295
- * Returns whether this DataSnapshot has children.
296
- * @returns True if the DataSnapshot contains 1 or more child nodes.
297
- */
298
- DataSnapshot.prototype.hasChildren = function () {
299
- validateArgCount('DataSnapshot.hasChildren', 0, 0, arguments.length);
300
- return this._delegate.hasChildren();
301
- };
302
- Object.defineProperty(DataSnapshot.prototype, "key", {
303
- get: function () {
304
- return this._delegate.key;
305
- },
306
- enumerable: false,
307
- configurable: true
308
- });
309
- /**
310
- * Returns the number of children for this DataSnapshot.
311
- * @returns The number of children that this DataSnapshot contains.
312
- */
313
- DataSnapshot.prototype.numChildren = function () {
314
- validateArgCount('DataSnapshot.numChildren', 0, 0, arguments.length);
315
- return this._delegate.size;
316
- };
317
- /**
318
- * @returns The Firebase reference for the location this snapshot's data came
319
- * from.
320
- */
321
- DataSnapshot.prototype.getRef = function () {
322
- validateArgCount('DataSnapshot.ref', 0, 0, arguments.length);
323
- return new Reference(this._database, this._delegate.ref);
324
- };
325
- Object.defineProperty(DataSnapshot.prototype, "ref", {
326
- get: function () {
327
- return this.getRef();
328
- },
329
- enumerable: false,
330
- configurable: true
331
- });
332
- return DataSnapshot;
333
- }());
334
- /**
335
- * A Query represents a filter to be applied to a firebase location. This object purely represents the
336
- * query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js.
337
- *
338
- * Since every Firebase reference is a query, Firebase inherits from this object.
339
- */
340
- var Query = /** @class */ (function () {
341
- function Query(database, _delegate) {
342
- this.database = database;
343
- this._delegate = _delegate;
344
- }
345
- Query.prototype.on = function (eventType, callback, cancelCallbackOrContext, context) {
346
- var _this = this;
347
- var _a;
348
- validateArgCount('Query.on', 2, 4, arguments.length);
349
- validateCallback('Query.on', 'callback', callback, false);
350
- var ret = Query.getCancelAndContextArgs_('Query.on', cancelCallbackOrContext, context);
351
- var valueCallback = function (expSnapshot, previousChildName) {
352
- callback.call(ret.context, new DataSnapshot(_this.database, expSnapshot), previousChildName);
353
- };
354
- valueCallback.userCallback = callback;
355
- valueCallback.context = ret.context;
356
- var cancelCallback = (_a = ret.cancel) === null || _a === void 0 ? void 0 : _a.bind(ret.context);
357
- switch (eventType) {
358
- case 'value':
359
- onValue(this._delegate, valueCallback, cancelCallback);
360
- return callback;
361
- case 'child_added':
362
- onChildAdded(this._delegate, valueCallback, cancelCallback);
363
- return callback;
364
- case 'child_removed':
365
- onChildRemoved(this._delegate, valueCallback, cancelCallback);
366
- return callback;
367
- case 'child_changed':
368
- onChildChanged(this._delegate, valueCallback, cancelCallback);
369
- return callback;
370
- case 'child_moved':
371
- onChildMoved(this._delegate, valueCallback, cancelCallback);
372
- return callback;
373
- default:
374
- throw new Error(errorPrefix('Query.on', 'eventType') +
375
- 'must be a valid event type = "value", "child_added", "child_removed", ' +
376
- '"child_changed", or "child_moved".');
377
- }
378
- };
379
- Query.prototype.off = function (eventType, callback, context) {
380
- validateArgCount('Query.off', 0, 3, arguments.length);
381
- validateEventType('Query.off', eventType, true);
382
- validateCallback('Query.off', 'callback', callback, true);
383
- validateContextObject('Query.off', 'context', context, true);
384
- if (callback) {
385
- var valueCallback = function () { };
386
- valueCallback.userCallback = callback;
387
- valueCallback.context = context;
388
- off(this._delegate, eventType, valueCallback);
389
- }
390
- else {
391
- off(this._delegate, eventType);
392
- }
393
- };
394
- /**
395
- * Get the server-value for this query, or return a cached value if not connected.
396
- */
397
- Query.prototype.get = function () {
398
- var _this = this;
399
- return get(this._delegate).then(function (expSnapshot) {
400
- return new DataSnapshot(_this.database, expSnapshot);
401
- });
402
- };
403
- /**
404
- * Attaches a listener, waits for the first event, and then removes the listener
405
- */
406
- Query.prototype.once = function (eventType, callback, failureCallbackOrContext, context) {
407
- var _this = this;
408
- validateArgCount('Query.once', 1, 4, arguments.length);
409
- validateCallback('Query.once', 'callback', callback, true);
410
- var ret = Query.getCancelAndContextArgs_('Query.once', failureCallbackOrContext, context);
411
- var deferred = new Deferred();
412
- var valueCallback = function (expSnapshot, previousChildName) {
413
- var result = new DataSnapshot(_this.database, expSnapshot);
414
- if (callback) {
415
- callback.call(ret.context, result, previousChildName);
416
- }
417
- deferred.resolve(result);
418
- };
419
- valueCallback.userCallback = callback;
420
- valueCallback.context = ret.context;
421
- var cancelCallback = function (error) {
422
- if (ret.cancel) {
423
- ret.cancel.call(ret.context, error);
424
- }
425
- deferred.reject(error);
426
- };
427
- switch (eventType) {
428
- case 'value':
429
- onValue(this._delegate, valueCallback, cancelCallback, {
430
- onlyOnce: true
431
- });
432
- break;
433
- case 'child_added':
434
- onChildAdded(this._delegate, valueCallback, cancelCallback, {
435
- onlyOnce: true
436
- });
437
- break;
438
- case 'child_removed':
439
- onChildRemoved(this._delegate, valueCallback, cancelCallback, {
440
- onlyOnce: true
441
- });
442
- break;
443
- case 'child_changed':
444
- onChildChanged(this._delegate, valueCallback, cancelCallback, {
445
- onlyOnce: true
446
- });
447
- break;
448
- case 'child_moved':
449
- onChildMoved(this._delegate, valueCallback, cancelCallback, {
450
- onlyOnce: true
451
- });
452
- break;
453
- default:
454
- throw new Error(errorPrefix('Query.once', 'eventType') +
455
- 'must be a valid event type = "value", "child_added", "child_removed", ' +
456
- '"child_changed", or "child_moved".');
457
- }
458
- return deferred.promise;
459
- };
460
- /**
461
- * Set a limit and anchor it to the start of the window.
462
- */
463
- Query.prototype.limitToFirst = function (limit) {
464
- validateArgCount('Query.limitToFirst', 1, 1, arguments.length);
465
- return new Query(this.database, query(this._delegate, limitToFirst(limit)));
466
- };
467
- /**
468
- * Set a limit and anchor it to the end of the window.
469
- */
470
- Query.prototype.limitToLast = function (limit) {
471
- validateArgCount('Query.limitToLast', 1, 1, arguments.length);
472
- return new Query(this.database, query(this._delegate, limitToLast(limit)));
473
- };
474
- /**
475
- * Given a child path, return a new query ordered by the specified grandchild path.
476
- */
477
- Query.prototype.orderByChild = function (path) {
478
- validateArgCount('Query.orderByChild', 1, 1, arguments.length);
479
- return new Query(this.database, query(this._delegate, orderByChild(path)));
480
- };
481
- /**
482
- * Return a new query ordered by the KeyIndex
483
- */
484
- Query.prototype.orderByKey = function () {
485
- validateArgCount('Query.orderByKey', 0, 0, arguments.length);
486
- return new Query(this.database, query(this._delegate, orderByKey()));
487
- };
488
- /**
489
- * Return a new query ordered by the PriorityIndex
490
- */
491
- Query.prototype.orderByPriority = function () {
492
- validateArgCount('Query.orderByPriority', 0, 0, arguments.length);
493
- return new Query(this.database, query(this._delegate, orderByPriority()));
494
- };
495
- /**
496
- * Return a new query ordered by the ValueIndex
497
- */
498
- Query.prototype.orderByValue = function () {
499
- validateArgCount('Query.orderByValue', 0, 0, arguments.length);
500
- return new Query(this.database, query(this._delegate, orderByValue()));
501
- };
502
- Query.prototype.startAt = function (value, name) {
503
- if (value === void 0) { value = null; }
504
- validateArgCount('Query.startAt', 0, 2, arguments.length);
505
- return new Query(this.database, query(this._delegate, startAt(value, name)));
506
- };
507
- Query.prototype.startAfter = function (value, name) {
508
- if (value === void 0) { value = null; }
509
- validateArgCount('Query.startAfter', 0, 2, arguments.length);
510
- return new Query(this.database, query(this._delegate, startAfter(value, name)));
511
- };
512
- Query.prototype.endAt = function (value, name) {
513
- if (value === void 0) { value = null; }
514
- validateArgCount('Query.endAt', 0, 2, arguments.length);
515
- return new Query(this.database, query(this._delegate, endAt(value, name)));
516
- };
517
- Query.prototype.endBefore = function (value, name) {
518
- if (value === void 0) { value = null; }
519
- validateArgCount('Query.endBefore', 0, 2, arguments.length);
520
- return new Query(this.database, query(this._delegate, endBefore(value, name)));
521
- };
522
- /**
523
- * Load the selection of children with exactly the specified value, and, optionally,
524
- * the specified name.
525
- */
526
- Query.prototype.equalTo = function (value, name) {
527
- validateArgCount('Query.equalTo', 1, 2, arguments.length);
528
- return new Query(this.database, query(this._delegate, equalTo(value, name)));
529
- };
530
- /**
531
- * @returns URL for this location.
532
- */
533
- Query.prototype.toString = function () {
534
- validateArgCount('Query.toString', 0, 0, arguments.length);
535
- return this._delegate.toString();
536
- };
537
- // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary
538
- // for end-users.
539
- Query.prototype.toJSON = function () {
540
- // An optional spacer argument is unnecessary for a string.
541
- validateArgCount('Query.toJSON', 0, 1, arguments.length);
542
- return this._delegate.toJSON();
543
- };
544
- /**
545
- * Return true if this query and the provided query are equivalent; otherwise, return false.
546
- */
547
- Query.prototype.isEqual = function (other) {
548
- validateArgCount('Query.isEqual', 1, 1, arguments.length);
549
- if (!(other instanceof Query)) {
550
- var error = 'Query.isEqual failed: First argument must be an instance of firebase.database.Query.';
551
- throw new Error(error);
552
- }
553
- return this._delegate.isEqual(other._delegate);
554
- };
555
- /**
556
- * Helper used by .on and .once to extract the context and or cancel arguments.
557
- * @param fnName - The function name (on or once)
558
- *
559
- */
560
- Query.getCancelAndContextArgs_ = function (fnName, cancelOrContext, context) {
561
- var ret = { cancel: undefined, context: undefined };
562
- if (cancelOrContext && context) {
563
- ret.cancel = cancelOrContext;
564
- validateCallback(fnName, 'cancel', ret.cancel, true);
565
- ret.context = context;
566
- validateContextObject(fnName, 'context', ret.context, true);
567
- }
568
- else if (cancelOrContext) {
569
- // we have either a cancel callback or a context.
570
- if (typeof cancelOrContext === 'object' && cancelOrContext !== null) {
571
- // it's a context!
572
- ret.context = cancelOrContext;
573
- }
574
- else if (typeof cancelOrContext === 'function') {
575
- ret.cancel = cancelOrContext;
576
- }
577
- else {
578
- throw new Error(errorPrefix(fnName, 'cancelOrContext') +
579
- ' must either be a cancel callback or a context object.');
580
- }
581
- }
582
- return ret;
583
- };
584
- Object.defineProperty(Query.prototype, "ref", {
585
- get: function () {
586
- return new Reference(this.database, new _ReferenceImpl(this._delegate._repo, this._delegate._path));
587
- },
588
- enumerable: false,
589
- configurable: true
590
- });
591
- return Query;
592
- }());
593
- var Reference = /** @class */ (function (_super) {
594
- __extends(Reference, _super);
595
- /**
596
- * Call options:
597
- * new Reference(Repo, Path) or
598
- * new Reference(url: string, string|RepoManager)
599
- *
600
- * Externally - this is the firebase.database.Reference type.
601
- */
602
- function Reference(database, _delegate) {
603
- var _this = _super.call(this, database, new _QueryImpl(_delegate._repo, _delegate._path, new _QueryParams(), false)) || this;
604
- _this.database = database;
605
- _this._delegate = _delegate;
606
- return _this;
607
- }
608
- /** @returns {?string} */
609
- Reference.prototype.getKey = function () {
610
- validateArgCount('Reference.key', 0, 0, arguments.length);
611
- return this._delegate.key;
612
- };
613
- Reference.prototype.child = function (pathString) {
614
- validateArgCount('Reference.child', 1, 1, arguments.length);
615
- if (typeof pathString === 'number') {
616
- pathString = String(pathString);
617
- }
618
- return new Reference(this.database, child(this._delegate, pathString));
619
- };
620
- /** @returns {?Reference} */
621
- Reference.prototype.getParent = function () {
622
- validateArgCount('Reference.parent', 0, 0, arguments.length);
623
- var parent = this._delegate.parent;
624
- return parent ? new Reference(this.database, parent) : null;
625
- };
626
- /** @returns {!Reference} */
627
- Reference.prototype.getRoot = function () {
628
- validateArgCount('Reference.root', 0, 0, arguments.length);
629
- return new Reference(this.database, this._delegate.root);
630
- };
631
- Reference.prototype.set = function (newVal, onComplete) {
632
- validateArgCount('Reference.set', 1, 2, arguments.length);
633
- validateCallback('Reference.set', 'onComplete', onComplete, true);
634
- var result = set(this._delegate, newVal);
635
- if (onComplete) {
636
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
637
- }
638
- return result;
639
- };
640
- Reference.prototype.update = function (values, onComplete) {
641
- validateArgCount('Reference.update', 1, 2, arguments.length);
642
- if (Array.isArray(values)) {
643
- var newObjectToMerge = {};
644
- for (var i = 0; i < values.length; ++i) {
645
- newObjectToMerge['' + i] = values[i];
646
- }
647
- values = newObjectToMerge;
648
- warn('Passing an Array to Firebase.update() is deprecated. ' +
649
- 'Use set() if you want to overwrite the existing data, or ' +
650
- 'an Object with integer keys if you really do want to ' +
651
- 'only update some of the children.');
652
- }
653
- _validateWritablePath('Reference.update', this._delegate._path);
654
- validateCallback('Reference.update', 'onComplete', onComplete, true);
655
- var result = update(this._delegate, values);
656
- if (onComplete) {
657
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
658
- }
659
- return result;
660
- };
661
- Reference.prototype.setWithPriority = function (newVal, newPriority, onComplete) {
662
- validateArgCount('Reference.setWithPriority', 2, 3, arguments.length);
663
- validateCallback('Reference.setWithPriority', 'onComplete', onComplete, true);
664
- var result = setWithPriority(this._delegate, newVal, newPriority);
665
- if (onComplete) {
666
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
667
- }
668
- return result;
669
- };
670
- Reference.prototype.remove = function (onComplete) {
671
- validateArgCount('Reference.remove', 0, 1, arguments.length);
672
- validateCallback('Reference.remove', 'onComplete', onComplete, true);
673
- var result = remove(this._delegate);
674
- if (onComplete) {
675
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
676
- }
677
- return result;
678
- };
679
- Reference.prototype.transaction = function (transactionUpdate, onComplete, applyLocally) {
680
- var _this = this;
681
- validateArgCount('Reference.transaction', 1, 3, arguments.length);
682
- validateCallback('Reference.transaction', 'transactionUpdate', transactionUpdate, false);
683
- validateCallback('Reference.transaction', 'onComplete', onComplete, true);
684
- validateBoolean('Reference.transaction', 'applyLocally', applyLocally, true);
685
- var result = runTransaction(this._delegate, transactionUpdate, {
686
- applyLocally: applyLocally
687
- }).then(function (transactionResult) {
688
- return new TransactionResult(transactionResult.committed, new DataSnapshot(_this.database, transactionResult.snapshot));
689
- });
690
- if (onComplete) {
691
- result.then(function (transactionResult) {
692
- return onComplete(null, transactionResult.committed, transactionResult.snapshot);
693
- }, function (error) { return onComplete(error, false, null); });
694
- }
695
- return result;
696
- };
697
- Reference.prototype.setPriority = function (priority, onComplete) {
698
- validateArgCount('Reference.setPriority', 1, 2, arguments.length);
699
- validateCallback('Reference.setPriority', 'onComplete', onComplete, true);
700
- var result = setPriority(this._delegate, priority);
701
- if (onComplete) {
702
- result.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
703
- }
704
- return result;
705
- };
706
- Reference.prototype.push = function (value, onComplete) {
707
- var _this = this;
708
- validateArgCount('Reference.push', 0, 2, arguments.length);
709
- validateCallback('Reference.push', 'onComplete', onComplete, true);
710
- var expPromise = push(this._delegate, value);
711
- var promise = expPromise.then(function (expRef) { return new Reference(_this.database, expRef); });
712
- if (onComplete) {
713
- promise.then(function () { return onComplete(null); }, function (error) { return onComplete(error); });
714
- }
715
- var result = new Reference(this.database, expPromise);
716
- result.then = promise.then.bind(promise);
717
- result.catch = promise.catch.bind(promise, undefined);
718
- return result;
719
- };
720
- Reference.prototype.onDisconnect = function () {
721
- _validateWritablePath('Reference.onDisconnect', this._delegate._path);
722
- return new OnDisconnect(new OnDisconnect$1(this._delegate._repo, this._delegate._path));
723
- };
724
- Object.defineProperty(Reference.prototype, "key", {
725
- get: function () {
726
- return this.getKey();
727
- },
728
- enumerable: false,
729
- configurable: true
730
- });
731
- Object.defineProperty(Reference.prototype, "parent", {
732
- get: function () {
733
- return this.getParent();
734
- },
735
- enumerable: false,
736
- configurable: true
737
- });
738
- Object.defineProperty(Reference.prototype, "root", {
739
- get: function () {
740
- return this.getRoot();
741
- },
742
- enumerable: false,
743
- configurable: true
744
- });
745
- return Reference;
746
- }(Query));
747
-
748
- /**
749
- * @license
750
- * Copyright 2017 Google LLC
751
- *
752
- * Licensed under the Apache License, Version 2.0 (the "License");
753
- * you may not use this file except in compliance with the License.
754
- * You may obtain a copy of the License at
755
- *
756
- * http://www.apache.org/licenses/LICENSE-2.0
757
- *
758
- * Unless required by applicable law or agreed to in writing, software
759
- * distributed under the License is distributed on an "AS IS" BASIS,
760
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
761
- * See the License for the specific language governing permissions and
762
- * limitations under the License.
763
- */
764
- /**
765
- * Class representing a firebase database.
766
- */
767
- var Database = /** @class */ (function () {
768
- /**
769
- * The constructor should not be called by users of our public API.
770
- */
771
- function Database(_delegate, app) {
772
- var _this = this;
773
- this._delegate = _delegate;
774
- this.app = app;
775
- this.INTERNAL = {
776
- delete: function () { return _this._delegate._delete(); },
777
- forceWebSockets: forceWebSockets,
778
- forceLongPolling: forceLongPolling
779
- };
780
- }
781
- /**
782
- * Modify this instance to communicate with the Realtime Database emulator.
783
- *
784
- * <p>Note: This method must be called before performing any other operation.
785
- *
786
- * @param host - the emulator host (ex: localhost)
787
- * @param port - the emulator port (ex: 8080)
788
- * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
789
- */
790
- Database.prototype.useEmulator = function (host, port, options) {
791
- if (options === void 0) { options = {}; }
792
- connectDatabaseEmulator(this._delegate, host, port, options);
793
- };
794
- Database.prototype.ref = function (path) {
795
- validateArgCount('database.ref', 0, 1, arguments.length);
796
- if (path instanceof Reference) {
797
- var childRef = refFromURL(this._delegate, path.toString());
798
- return new Reference(this, childRef);
799
- }
800
- else {
801
- var childRef = ref(this._delegate, path);
802
- return new Reference(this, childRef);
803
- }
804
- };
805
- /**
806
- * Returns a reference to the root or the path specified in url.
807
- * We throw a exception if the url is not in the same domain as the
808
- * current repo.
809
- * @returns Firebase reference.
810
- */
811
- Database.prototype.refFromURL = function (url) {
812
- var apiName = 'database.refFromURL';
813
- validateArgCount(apiName, 1, 1, arguments.length);
814
- var childRef = refFromURL(this._delegate, url);
815
- return new Reference(this, childRef);
816
- };
817
- // Make individual repo go offline.
818
- Database.prototype.goOffline = function () {
819
- validateArgCount('database.goOffline', 0, 0, arguments.length);
820
- return goOffline(this._delegate);
821
- };
822
- Database.prototype.goOnline = function () {
823
- validateArgCount('database.goOnline', 0, 0, arguments.length);
824
- return goOnline(this._delegate);
825
- };
826
- Database.ServerValue = {
827
- TIMESTAMP: serverTimestamp(),
828
- increment: function (delta) { return increment(delta); }
829
- };
830
- return Database;
831
- }());
832
-
833
- /**
834
- * Used by console to create a database based on the app,
835
- * passed database URL and a custom auth implementation.
836
- *
837
- * @param app - A valid FirebaseApp-like object
838
- * @param url - A valid Firebase databaseURL
839
- * @param version - custom version e.g. firebase-admin version
840
- * @param customAuthImpl - custom auth implementation
841
- */
842
- function initStandalone(_a) {
843
- var app = _a.app, url = _a.url, version = _a.version, customAuthImpl = _a.customAuthImpl, customAppCheckImpl = _a.customAppCheckImpl, namespace = _a.namespace, _b = _a.nodeAdmin, nodeAdmin = _b === void 0 ? false : _b;
844
- _setSDKVersion(version);
845
- var container = new ComponentContainer('database-standalone');
846
- /**
847
- * ComponentContainer('database-standalone') is just a placeholder that doesn't perform
848
- * any actual function.
849
- */
850
- var authProvider = new Provider('auth-internal', container);
851
- authProvider.setComponent(new Component('auth-internal', function () { return customAuthImpl; }, "PRIVATE" /* ComponentType.PRIVATE */));
852
- var appCheckProvider = undefined;
853
- if (customAppCheckImpl) {
854
- appCheckProvider = new Provider('app-check-internal', container);
855
- appCheckProvider.setComponent(new Component('app-check-internal', function () { return customAppCheckImpl; }, "PRIVATE" /* ComponentType.PRIVATE */));
856
- }
857
- return {
858
- instance: new Database(_repoManagerDatabaseFromApp(app, authProvider, appCheckProvider, url, nodeAdmin), app),
859
- namespace: namespace
860
- };
861
- }
862
-
863
- var INTERNAL = /*#__PURE__*/Object.freeze({
864
- __proto__: null,
865
- initStandalone: initStandalone
866
- });
867
-
868
- /**
869
- * @license
870
- * Copyright 2021 Google LLC
871
- *
872
- * Licensed under the Apache License, Version 2.0 (the "License");
873
- * you may not use this file except in compliance with the License.
874
- * You may obtain a copy of the License at
875
- *
876
- * http://www.apache.org/licenses/LICENSE-2.0
877
- *
878
- * Unless required by applicable law or agreed to in writing, software
879
- * distributed under the License is distributed on an "AS IS" BASIS,
880
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
881
- * See the License for the specific language governing permissions and
882
- * limitations under the License.
883
- */
884
- var ServerValue = Database.ServerValue;
885
- function registerDatabase(instance) {
886
- // Register the Database Service with the 'firebase' namespace.
887
- instance.INTERNAL.registerComponent(new Component('database-compat', function (container, _a) {
888
- var url = _a.instanceIdentifier;
889
- /* Dependencies */
890
- // getImmediate for FirebaseApp will always succeed
891
- var app = container.getProvider('app-compat').getImmediate();
892
- var databaseExp = container
893
- .getProvider('database')
894
- .getImmediate({ identifier: url });
895
- return new Database(databaseExp, app);
896
- }, "PUBLIC" /* ComponentType.PUBLIC */)
897
- .setServiceProps(
898
- // firebase.database namespace properties
899
- {
900
- Reference: Reference,
901
- Query: Query,
902
- Database: Database,
903
- DataSnapshot: DataSnapshot,
904
- enableLogging: enableLogging,
905
- INTERNAL: INTERNAL,
906
- ServerValue: ServerValue
907
- })
908
- .setMultipleInstances(true));
909
- instance.registerVersion(name, version);
910
- }
911
- registerDatabase(firebase);
912
-
913
- export { registerDatabase };
914
- //# sourceMappingURL=index.esm5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm5.js","sources":["../src/util/util.ts","../src/util/validation.ts","../src/api/onDisconnect.ts","../src/api/TransactionResult.ts","../src/api/Reference.ts","../src/api/Database.ts","../src/api/internal.ts","../src/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Logger } from '@firebase/logger';\n\nconst logClient = new Logger('@firebase/database-compat');\n\nexport const warn = function (msg: string) {\n const message = 'FIREBASE WARNING: ' + msg;\n logClient.warn(message);\n};\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { errorPrefix as errorPrefixFxn } from '@firebase/util';\n\nexport const validateBoolean = function (\n fnName: string,\n argumentName: string,\n bool: unknown,\n optional: boolean\n) {\n if (optional && bool === undefined) {\n return;\n }\n if (typeof bool !== 'boolean') {\n throw new Error(\n errorPrefixFxn(fnName, argumentName) + 'must be a boolean.'\n );\n }\n};\n\nexport const validateEventType = function (\n fnName: string,\n eventType: string,\n optional: boolean\n) {\n if (optional && eventType === undefined) {\n return;\n }\n\n switch (eventType) {\n case 'value':\n case 'child_added':\n case 'child_removed':\n case 'child_changed':\n case 'child_moved':\n break;\n default:\n throw new Error(\n errorPrefixFxn(fnName, 'eventType') +\n 'must be a valid event type = \"value\", \"child_added\", \"child_removed\", ' +\n '\"child_changed\", or \"child_moved\".'\n );\n }\n};\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { OnDisconnect as ModularOnDisconnect } from '@firebase/database';\nimport { validateArgCount, validateCallback, Compat } from '@firebase/util';\n\nimport { warn } from '../util/util';\nexport class OnDisconnect implements Compat<ModularOnDisconnect> {\n constructor(readonly _delegate: ModularOnDisconnect) {}\n\n cancel(onComplete?: (a: Error | null) => void): Promise<void> {\n validateArgCount('OnDisconnect.cancel', 0, 1, arguments.length);\n validateCallback('OnDisconnect.cancel', 'onComplete', onComplete, true);\n const result = this._delegate.cancel();\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n remove(onComplete?: (a: Error | null) => void): Promise<void> {\n validateArgCount('OnDisconnect.remove', 0, 1, arguments.length);\n validateCallback('OnDisconnect.remove', 'onComplete', onComplete, true);\n const result = this._delegate.remove();\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n set(value: unknown, onComplete?: (a: Error | null) => void): Promise<void> {\n validateArgCount('OnDisconnect.set', 1, 2, arguments.length);\n validateCallback('OnDisconnect.set', 'onComplete', onComplete, true);\n const result = this._delegate.set(value);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n setWithPriority(\n value: unknown,\n priority: number | string | null,\n onComplete?: (a: Error | null) => void\n ): Promise<void> {\n validateArgCount('OnDisconnect.setWithPriority', 2, 3, arguments.length);\n validateCallback(\n 'OnDisconnect.setWithPriority',\n 'onComplete',\n onComplete,\n true\n );\n const result = this._delegate.setWithPriority(value, priority);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n update(\n objectToMerge: Record<string, unknown>,\n onComplete?: (a: Error | null) => void\n ): Promise<void> {\n validateArgCount('OnDisconnect.update', 1, 2, arguments.length);\n if (Array.isArray(objectToMerge)) {\n const newObjectToMerge: { [k: string]: unknown } = {};\n for (let i = 0; i < objectToMerge.length; ++i) {\n newObjectToMerge['' + i] = objectToMerge[i];\n }\n objectToMerge = newObjectToMerge;\n warn(\n 'Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the ' +\n 'existing data, or an Object with integer keys if you really do want to only update some of the children.'\n );\n }\n validateCallback('OnDisconnect.update', 'onComplete', onComplete, true);\n const result = this._delegate.update(objectToMerge);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { validateArgCount } from '@firebase/util';\n\nimport { DataSnapshot } from './Reference';\n\nexport class TransactionResult {\n /**\n * A type for the resolve value of Firebase.transaction.\n */\n constructor(public committed: boolean, public snapshot: DataSnapshot) {}\n\n // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary\n // for end-users\n toJSON(): object {\n validateArgCount('TransactionResult.toJSON', 0, 1, arguments.length);\n return { committed: this.committed, snapshot: this.snapshot.toJSON() };\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n OnDisconnect as ModularOnDisconnect,\n off,\n onChildAdded,\n onChildChanged,\n onChildMoved,\n onChildRemoved,\n onValue,\n EventType,\n limitToFirst,\n query,\n limitToLast,\n orderByChild,\n orderByKey,\n orderByValue,\n orderByPriority,\n startAt,\n startAfter,\n endAt,\n endBefore,\n equalTo,\n get,\n set,\n update,\n setWithPriority,\n remove,\n setPriority,\n push,\n runTransaction,\n child,\n DataSnapshot as ModularDataSnapshot,\n Query as ExpQuery,\n DatabaseReference as ModularReference,\n _QueryImpl,\n _ReferenceImpl,\n _validatePathString,\n _validateWritablePath,\n _UserCallback,\n _QueryParams\n} from '@firebase/database';\nimport {\n Compat,\n Deferred,\n errorPrefix,\n validateArgCount,\n validateCallback,\n validateContextObject\n} from '@firebase/util';\n\nimport { warn } from '../util/util';\nimport { validateBoolean, validateEventType } from '../util/validation';\n\nimport { Database } from './Database';\nimport { OnDisconnect } from './onDisconnect';\nimport { TransactionResult } from './TransactionResult';\n\n/**\n * Class representing a firebase data snapshot. It wraps a SnapshotNode and\n * surfaces the public methods (val, forEach, etc.) we want to expose.\n */\nexport class DataSnapshot implements Compat<ModularDataSnapshot> {\n constructor(\n readonly _database: Database,\n readonly _delegate: ModularDataSnapshot\n ) {}\n\n /**\n * Retrieves the snapshot contents as JSON. Returns null if the snapshot is\n * empty.\n *\n * @returns JSON representation of the DataSnapshot contents, or null if empty.\n */\n val(): unknown {\n validateArgCount('DataSnapshot.val', 0, 0, arguments.length);\n return this._delegate.val();\n }\n\n /**\n * Returns the snapshot contents as JSON, including priorities of node. Suitable for exporting\n * the entire node contents.\n * @returns JSON representation of the DataSnapshot contents, or null if empty.\n */\n exportVal(): unknown {\n validateArgCount('DataSnapshot.exportVal', 0, 0, arguments.length);\n return this._delegate.exportVal();\n }\n\n // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary\n // for end-users\n toJSON(): unknown {\n // Optional spacer argument is unnecessary because we're depending on recursion rather than stringifying the content\n validateArgCount('DataSnapshot.toJSON', 0, 1, arguments.length);\n return this._delegate.toJSON();\n }\n\n /**\n * Returns whether the snapshot contains a non-null value.\n *\n * @returns Whether the snapshot contains a non-null value, or is empty.\n */\n exists(): boolean {\n validateArgCount('DataSnapshot.exists', 0, 0, arguments.length);\n return this._delegate.exists();\n }\n\n /**\n * Returns a DataSnapshot of the specified child node's contents.\n *\n * @param path - Path to a child.\n * @returns DataSnapshot for child node.\n */\n child(path: string): DataSnapshot {\n validateArgCount('DataSnapshot.child', 0, 1, arguments.length);\n // Ensure the childPath is a string (can be a number)\n path = String(path);\n _validatePathString('DataSnapshot.child', 'path', path, false);\n return new DataSnapshot(this._database, this._delegate.child(path));\n }\n\n /**\n * Returns whether the snapshot contains a child at the specified path.\n *\n * @param path - Path to a child.\n * @returns Whether the child exists.\n */\n hasChild(path: string): boolean {\n validateArgCount('DataSnapshot.hasChild', 1, 1, arguments.length);\n _validatePathString('DataSnapshot.hasChild', 'path', path, false);\n return this._delegate.hasChild(path);\n }\n\n /**\n * Returns the priority of the object, or null if no priority was set.\n *\n * @returns The priority.\n */\n getPriority(): string | number | null {\n validateArgCount('DataSnapshot.getPriority', 0, 0, arguments.length);\n return this._delegate.priority;\n }\n\n /**\n * Iterates through child nodes and calls the specified action for each one.\n *\n * @param action - Callback function to be called\n * for each child.\n * @returns True if forEach was canceled by action returning true for\n * one of the child nodes.\n */\n forEach(action: (snapshot: IteratedDataSnapshot) => boolean | void): boolean {\n validateArgCount('DataSnapshot.forEach', 1, 1, arguments.length);\n validateCallback('DataSnapshot.forEach', 'action', action, false);\n return this._delegate.forEach(expDataSnapshot =>\n action(new DataSnapshot(this._database, expDataSnapshot))\n );\n }\n\n /**\n * Returns whether this DataSnapshot has children.\n * @returns True if the DataSnapshot contains 1 or more child nodes.\n */\n hasChildren(): boolean {\n validateArgCount('DataSnapshot.hasChildren', 0, 0, arguments.length);\n return this._delegate.hasChildren();\n }\n\n get key() {\n return this._delegate.key;\n }\n\n /**\n * Returns the number of children for this DataSnapshot.\n * @returns The number of children that this DataSnapshot contains.\n */\n numChildren(): number {\n validateArgCount('DataSnapshot.numChildren', 0, 0, arguments.length);\n return this._delegate.size;\n }\n\n /**\n * @returns The Firebase reference for the location this snapshot's data came\n * from.\n */\n getRef(): Reference {\n validateArgCount('DataSnapshot.ref', 0, 0, arguments.length);\n return new Reference(this._database, this._delegate.ref);\n }\n\n get ref(): Reference {\n return this.getRef();\n }\n}\n\n/**\n * Represents a child snapshot of a `Reference` that is being iterated over. The key will never be undefined.\n */\nexport interface IteratedDataSnapshot extends DataSnapshot {\n key: string; // key of the location of this snapshot.\n}\n\nexport interface SnapshotCallback {\n (dataSnapshot: DataSnapshot, previousChildName?: string | null): unknown;\n}\n\n/**\n * A Query represents a filter to be applied to a firebase location. This object purely represents the\n * query expression (and exposes our public API to build the query). The actual query logic is in ViewBase.js.\n *\n * Since every Firebase reference is a query, Firebase inherits from this object.\n */\nexport class Query implements Compat<ExpQuery> {\n constructor(readonly database: Database, readonly _delegate: ExpQuery) {}\n\n on(\n eventType: string,\n callback: SnapshotCallback,\n cancelCallbackOrContext?: ((a: Error) => unknown) | object | null,\n context?: object | null\n ): SnapshotCallback {\n validateArgCount('Query.on', 2, 4, arguments.length);\n validateCallback('Query.on', 'callback', callback, false);\n\n const ret = Query.getCancelAndContextArgs_(\n 'Query.on',\n cancelCallbackOrContext,\n context\n );\n const valueCallback = (expSnapshot, previousChildName?) => {\n callback.call(\n ret.context,\n new DataSnapshot(this.database, expSnapshot),\n previousChildName\n );\n };\n valueCallback.userCallback = callback;\n valueCallback.context = ret.context;\n const cancelCallback = ret.cancel?.bind(ret.context);\n\n switch (eventType) {\n case 'value':\n onValue(this._delegate, valueCallback, cancelCallback);\n return callback;\n case 'child_added':\n onChildAdded(this._delegate, valueCallback, cancelCallback);\n return callback;\n case 'child_removed':\n onChildRemoved(this._delegate, valueCallback, cancelCallback);\n return callback;\n case 'child_changed':\n onChildChanged(this._delegate, valueCallback, cancelCallback);\n return callback;\n case 'child_moved':\n onChildMoved(this._delegate, valueCallback, cancelCallback);\n return callback;\n default:\n throw new Error(\n errorPrefix('Query.on', 'eventType') +\n 'must be a valid event type = \"value\", \"child_added\", \"child_removed\", ' +\n '\"child_changed\", or \"child_moved\".'\n );\n }\n }\n\n off(\n eventType?: string,\n callback?: SnapshotCallback,\n context?: object | null\n ): void {\n validateArgCount('Query.off', 0, 3, arguments.length);\n validateEventType('Query.off', eventType, true);\n validateCallback('Query.off', 'callback', callback, true);\n validateContextObject('Query.off', 'context', context, true);\n if (callback) {\n const valueCallback: _UserCallback = () => {};\n valueCallback.userCallback = callback;\n valueCallback.context = context;\n off(this._delegate, eventType as EventType, valueCallback);\n } else {\n off(this._delegate, eventType as EventType | undefined);\n }\n }\n\n /**\n * Get the server-value for this query, or return a cached value if not connected.\n */\n get(): Promise<DataSnapshot> {\n return get(this._delegate).then(expSnapshot => {\n return new DataSnapshot(this.database, expSnapshot);\n });\n }\n\n /**\n * Attaches a listener, waits for the first event, and then removes the listener\n */\n once(\n eventType: string,\n callback?: SnapshotCallback,\n failureCallbackOrContext?: ((a: Error) => void) | object | null,\n context?: object | null\n ): Promise<DataSnapshot> {\n validateArgCount('Query.once', 1, 4, arguments.length);\n validateCallback('Query.once', 'callback', callback, true);\n\n const ret = Query.getCancelAndContextArgs_(\n 'Query.once',\n failureCallbackOrContext,\n context\n );\n const deferred = new Deferred<DataSnapshot>();\n const valueCallback: _UserCallback = (expSnapshot, previousChildName?) => {\n const result = new DataSnapshot(this.database, expSnapshot);\n if (callback) {\n callback.call(ret.context, result, previousChildName);\n }\n deferred.resolve(result);\n };\n valueCallback.userCallback = callback;\n valueCallback.context = ret.context;\n const cancelCallback = (error: Error) => {\n if (ret.cancel) {\n ret.cancel.call(ret.context, error);\n }\n deferred.reject(error);\n };\n\n switch (eventType) {\n case 'value':\n onValue(this._delegate, valueCallback, cancelCallback, {\n onlyOnce: true\n });\n break;\n case 'child_added':\n onChildAdded(this._delegate, valueCallback, cancelCallback, {\n onlyOnce: true\n });\n break;\n case 'child_removed':\n onChildRemoved(this._delegate, valueCallback, cancelCallback, {\n onlyOnce: true\n });\n break;\n case 'child_changed':\n onChildChanged(this._delegate, valueCallback, cancelCallback, {\n onlyOnce: true\n });\n break;\n case 'child_moved':\n onChildMoved(this._delegate, valueCallback, cancelCallback, {\n onlyOnce: true\n });\n break;\n default:\n throw new Error(\n errorPrefix('Query.once', 'eventType') +\n 'must be a valid event type = \"value\", \"child_added\", \"child_removed\", ' +\n '\"child_changed\", or \"child_moved\".'\n );\n }\n\n return deferred.promise;\n }\n\n /**\n * Set a limit and anchor it to the start of the window.\n */\n limitToFirst(limit: number): Query {\n validateArgCount('Query.limitToFirst', 1, 1, arguments.length);\n return new Query(this.database, query(this._delegate, limitToFirst(limit)));\n }\n\n /**\n * Set a limit and anchor it to the end of the window.\n */\n limitToLast(limit: number): Query {\n validateArgCount('Query.limitToLast', 1, 1, arguments.length);\n return new Query(this.database, query(this._delegate, limitToLast(limit)));\n }\n\n /**\n * Given a child path, return a new query ordered by the specified grandchild path.\n */\n orderByChild(path: string): Query {\n validateArgCount('Query.orderByChild', 1, 1, arguments.length);\n return new Query(this.database, query(this._delegate, orderByChild(path)));\n }\n\n /**\n * Return a new query ordered by the KeyIndex\n */\n orderByKey(): Query {\n validateArgCount('Query.orderByKey', 0, 0, arguments.length);\n return new Query(this.database, query(this._delegate, orderByKey()));\n }\n\n /**\n * Return a new query ordered by the PriorityIndex\n */\n orderByPriority(): Query {\n validateArgCount('Query.orderByPriority', 0, 0, arguments.length);\n return new Query(this.database, query(this._delegate, orderByPriority()));\n }\n\n /**\n * Return a new query ordered by the ValueIndex\n */\n orderByValue(): Query {\n validateArgCount('Query.orderByValue', 0, 0, arguments.length);\n return new Query(this.database, query(this._delegate, orderByValue()));\n }\n\n startAt(\n value: number | string | boolean | null = null,\n name?: string | null\n ): Query {\n validateArgCount('Query.startAt', 0, 2, arguments.length);\n return new Query(\n this.database,\n query(this._delegate, startAt(value, name))\n );\n }\n\n startAfter(\n value: number | string | boolean | null = null,\n name?: string | null\n ): Query {\n validateArgCount('Query.startAfter', 0, 2, arguments.length);\n return new Query(\n this.database,\n query(this._delegate, startAfter(value, name))\n );\n }\n\n endAt(\n value: number | string | boolean | null = null,\n name?: string | null\n ): Query {\n validateArgCount('Query.endAt', 0, 2, arguments.length);\n return new Query(this.database, query(this._delegate, endAt(value, name)));\n }\n\n endBefore(\n value: number | string | boolean | null = null,\n name?: string | null\n ): Query {\n validateArgCount('Query.endBefore', 0, 2, arguments.length);\n return new Query(\n this.database,\n query(this._delegate, endBefore(value, name))\n );\n }\n\n /**\n * Load the selection of children with exactly the specified value, and, optionally,\n * the specified name.\n */\n equalTo(value: number | string | boolean | null, name?: string) {\n validateArgCount('Query.equalTo', 1, 2, arguments.length);\n return new Query(\n this.database,\n query(this._delegate, equalTo(value, name))\n );\n }\n\n /**\n * @returns URL for this location.\n */\n toString(): string {\n validateArgCount('Query.toString', 0, 0, arguments.length);\n return this._delegate.toString();\n }\n\n // Do not create public documentation. This is intended to make JSON serialization work but is otherwise unnecessary\n // for end-users.\n toJSON() {\n // An optional spacer argument is unnecessary for a string.\n validateArgCount('Query.toJSON', 0, 1, arguments.length);\n return this._delegate.toJSON();\n }\n\n /**\n * Return true if this query and the provided query are equivalent; otherwise, return false.\n */\n isEqual(other: Query): boolean {\n validateArgCount('Query.isEqual', 1, 1, arguments.length);\n if (!(other instanceof Query)) {\n const error =\n 'Query.isEqual failed: First argument must be an instance of firebase.database.Query.';\n throw new Error(error);\n }\n return this._delegate.isEqual(other._delegate);\n }\n\n /**\n * Helper used by .on and .once to extract the context and or cancel arguments.\n * @param fnName - The function name (on or once)\n *\n */\n private static getCancelAndContextArgs_(\n fnName: string,\n cancelOrContext?: ((a: Error) => void) | object | null,\n context?: object | null\n ): { cancel: ((a: Error) => void) | undefined; context: object | undefined } {\n const ret: {\n cancel: ((a: Error) => void) | null;\n context: object | null;\n } = { cancel: undefined, context: undefined };\n if (cancelOrContext && context) {\n ret.cancel = cancelOrContext as (a: Error) => void;\n validateCallback(fnName, 'cancel', ret.cancel, true);\n\n ret.context = context;\n validateContextObject(fnName, 'context', ret.context, true);\n } else if (cancelOrContext) {\n // we have either a cancel callback or a context.\n if (typeof cancelOrContext === 'object' && cancelOrContext !== null) {\n // it's a context!\n ret.context = cancelOrContext;\n } else if (typeof cancelOrContext === 'function') {\n ret.cancel = cancelOrContext as (a: Error) => void;\n } else {\n throw new Error(\n errorPrefix(fnName, 'cancelOrContext') +\n ' must either be a cancel callback or a context object.'\n );\n }\n }\n return ret;\n }\n\n get ref(): Reference {\n return new Reference(\n this.database,\n new _ReferenceImpl(this._delegate._repo, this._delegate._path)\n );\n }\n}\n\nexport class Reference extends Query implements Compat<ModularReference> {\n then: Promise<Reference>['then'];\n catch: Promise<Reference>['catch'];\n\n /**\n * Call options:\n * new Reference(Repo, Path) or\n * new Reference(url: string, string|RepoManager)\n *\n * Externally - this is the firebase.database.Reference type.\n */\n constructor(\n readonly database: Database,\n readonly _delegate: ModularReference\n ) {\n super(\n database,\n new _QueryImpl(\n _delegate._repo,\n _delegate._path,\n new _QueryParams(),\n false\n )\n );\n }\n\n /** @returns {?string} */\n getKey(): string | null {\n validateArgCount('Reference.key', 0, 0, arguments.length);\n return this._delegate.key;\n }\n\n child(pathString: string): Reference {\n validateArgCount('Reference.child', 1, 1, arguments.length);\n if (typeof pathString === 'number') {\n pathString = String(pathString);\n }\n return new Reference(this.database, child(this._delegate, pathString));\n }\n\n /** @returns {?Reference} */\n getParent(): Reference | null {\n validateArgCount('Reference.parent', 0, 0, arguments.length);\n const parent = this._delegate.parent;\n return parent ? new Reference(this.database, parent) : null;\n }\n\n /** @returns {!Reference} */\n getRoot(): Reference {\n validateArgCount('Reference.root', 0, 0, arguments.length);\n return new Reference(this.database, this._delegate.root);\n }\n\n set(\n newVal: unknown,\n onComplete?: (error: Error | null) => void\n ): Promise<void> {\n validateArgCount('Reference.set', 1, 2, arguments.length);\n validateCallback('Reference.set', 'onComplete', onComplete, true);\n const result = set(this._delegate, newVal);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n update(\n values: object,\n onComplete?: (a: Error | null) => void\n ): Promise<void> {\n validateArgCount('Reference.update', 1, 2, arguments.length);\n\n if (Array.isArray(values)) {\n const newObjectToMerge: { [k: string]: unknown } = {};\n for (let i = 0; i < values.length; ++i) {\n newObjectToMerge['' + i] = values[i];\n }\n values = newObjectToMerge;\n warn(\n 'Passing an Array to Firebase.update() is deprecated. ' +\n 'Use set() if you want to overwrite the existing data, or ' +\n 'an Object with integer keys if you really do want to ' +\n 'only update some of the children.'\n );\n }\n _validateWritablePath('Reference.update', this._delegate._path);\n validateCallback('Reference.update', 'onComplete', onComplete, true);\n\n const result = update(this._delegate, values);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n setWithPriority(\n newVal: unknown,\n newPriority: string | number | null,\n onComplete?: (a: Error | null) => void\n ): Promise<void> {\n validateArgCount('Reference.setWithPriority', 2, 3, arguments.length);\n validateCallback(\n 'Reference.setWithPriority',\n 'onComplete',\n onComplete,\n true\n );\n\n const result = setWithPriority(this._delegate, newVal, newPriority);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n remove(onComplete?: (a: Error | null) => void): Promise<void> {\n validateArgCount('Reference.remove', 0, 1, arguments.length);\n validateCallback('Reference.remove', 'onComplete', onComplete, true);\n\n const result = remove(this._delegate);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n transaction(\n transactionUpdate: (currentData: unknown) => unknown,\n onComplete?: (\n error: Error | null,\n committed: boolean,\n dataSnapshot: DataSnapshot | null\n ) => void,\n applyLocally?: boolean\n ): Promise<TransactionResult> {\n validateArgCount('Reference.transaction', 1, 3, arguments.length);\n validateCallback(\n 'Reference.transaction',\n 'transactionUpdate',\n transactionUpdate,\n false\n );\n validateCallback('Reference.transaction', 'onComplete', onComplete, true);\n validateBoolean(\n 'Reference.transaction',\n 'applyLocally',\n applyLocally,\n true\n );\n\n const result = runTransaction(this._delegate, transactionUpdate, {\n applyLocally\n }).then(\n transactionResult =>\n new TransactionResult(\n transactionResult.committed,\n new DataSnapshot(this.database, transactionResult.snapshot)\n )\n );\n if (onComplete) {\n result.then(\n transactionResult =>\n onComplete(\n null,\n transactionResult.committed,\n transactionResult.snapshot\n ),\n error => onComplete(error, false, null)\n );\n }\n return result;\n }\n\n setPriority(\n priority: string | number | null,\n onComplete?: (a: Error | null) => void\n ): Promise<void> {\n validateArgCount('Reference.setPriority', 1, 2, arguments.length);\n validateCallback('Reference.setPriority', 'onComplete', onComplete, true);\n\n const result = setPriority(this._delegate, priority);\n if (onComplete) {\n result.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n return result;\n }\n\n push(value?: unknown, onComplete?: (a: Error | null) => void): Reference {\n validateArgCount('Reference.push', 0, 2, arguments.length);\n validateCallback('Reference.push', 'onComplete', onComplete, true);\n\n const expPromise = push(this._delegate, value);\n const promise = expPromise.then(\n expRef => new Reference(this.database, expRef)\n );\n\n if (onComplete) {\n promise.then(\n () => onComplete(null),\n error => onComplete(error)\n );\n }\n\n const result = new Reference(this.database, expPromise);\n result.then = promise.then.bind(promise);\n result.catch = promise.catch.bind(promise, undefined);\n return result;\n }\n\n onDisconnect(): OnDisconnect {\n _validateWritablePath('Reference.onDisconnect', this._delegate._path);\n return new OnDisconnect(\n new ModularOnDisconnect(this._delegate._repo, this._delegate._path)\n );\n }\n\n get key(): string | null {\n return this.getKey();\n }\n\n get parent(): Reference | null {\n return this.getParent();\n }\n\n get root(): Reference {\n return this.getRoot();\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line import/no-extraneous-dependencies\n\nimport { FirebaseApp } from '@firebase/app-types';\nimport { FirebaseService } from '@firebase/app-types/private';\nimport {\n forceLongPolling,\n forceWebSockets,\n goOnline,\n connectDatabaseEmulator,\n goOffline,\n ref,\n refFromURL,\n increment,\n serverTimestamp,\n Database as ModularDatabase\n} from '@firebase/database';\nimport {\n validateArgCount,\n Compat,\n EmulatorMockTokenOptions\n} from '@firebase/util';\n\nimport { Reference } from './Reference';\n\n/**\n * Class representing a firebase database.\n */\nexport class Database implements FirebaseService, Compat<ModularDatabase> {\n static readonly ServerValue = {\n TIMESTAMP: serverTimestamp(),\n increment: (delta: number) => increment(delta)\n };\n\n /**\n * The constructor should not be called by users of our public API.\n */\n constructor(readonly _delegate: ModularDatabase, readonly app: FirebaseApp) {}\n\n INTERNAL = {\n delete: () => this._delegate._delete(),\n forceWebSockets,\n forceLongPolling\n };\n\n /**\n * Modify this instance to communicate with the Realtime Database emulator.\n *\n * <p>Note: This method must be called before performing any other operation.\n *\n * @param host - the emulator host (ex: localhost)\n * @param port - the emulator port (ex: 8080)\n * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules\n */\n useEmulator(\n host: string,\n port: number,\n options: {\n mockUserToken?: EmulatorMockTokenOptions;\n } = {}\n ): void {\n connectDatabaseEmulator(this._delegate, host, port, options);\n }\n\n /**\n * Returns a reference to the root or to the path specified in the provided\n * argument.\n *\n * @param path - The relative string path or an existing Reference to a database\n * location.\n * @throws If a Reference is provided, throws if it does not belong to the\n * same project.\n * @returns Firebase reference.\n */\n ref(path?: string): Reference;\n ref(path?: Reference): Reference;\n ref(path?: string | Reference): Reference {\n validateArgCount('database.ref', 0, 1, arguments.length);\n if (path instanceof Reference) {\n const childRef = refFromURL(this._delegate, path.toString());\n return new Reference(this, childRef);\n } else {\n const childRef = ref(this._delegate, path);\n return new Reference(this, childRef);\n }\n }\n\n /**\n * Returns a reference to the root or the path specified in url.\n * We throw a exception if the url is not in the same domain as the\n * current repo.\n * @returns Firebase reference.\n */\n refFromURL(url: string): Reference {\n const apiName = 'database.refFromURL';\n validateArgCount(apiName, 1, 1, arguments.length);\n const childRef = refFromURL(this._delegate, url);\n return new Reference(this, childRef);\n }\n\n // Make individual repo go offline.\n goOffline(): void {\n validateArgCount('database.goOffline', 0, 0, arguments.length);\n return goOffline(this._delegate);\n }\n\n goOnline(): void {\n validateArgCount('database.goOnline', 0, 0, arguments.length);\n return goOnline(this._delegate);\n }\n}\n","/**\n * @license\n * Copyright 2017 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n AppCheckInternalComponentName,\n FirebaseAppCheckInternal\n} from '@firebase/app-check-interop-types';\nimport { FirebaseApp } from '@firebase/app-types';\nimport {\n FirebaseAuthInternal,\n FirebaseAuthInternalName\n} from '@firebase/auth-interop-types';\nimport {\n Component,\n ComponentContainer,\n ComponentType,\n Provider\n} from '@firebase/component';\nimport {\n _repoManagerDatabaseFromApp,\n _setSDKVersion\n} from '@firebase/database';\nimport * as types from '@firebase/database-types';\n\nimport { Database } from './Database';\n\n/**\n * Used by console to create a database based on the app,\n * passed database URL and a custom auth implementation.\n *\n * @param app - A valid FirebaseApp-like object\n * @param url - A valid Firebase databaseURL\n * @param version - custom version e.g. firebase-admin version\n * @param customAuthImpl - custom auth implementation\n */\nexport function initStandalone<T>({\n app,\n url,\n version,\n customAuthImpl,\n customAppCheckImpl,\n namespace,\n nodeAdmin = false\n}: {\n app: FirebaseApp;\n url: string;\n version: string;\n customAuthImpl: FirebaseAuthInternal;\n customAppCheckImpl?: FirebaseAppCheckInternal;\n namespace: T;\n nodeAdmin?: boolean;\n}): {\n instance: types.Database;\n namespace: T;\n} {\n _setSDKVersion(version);\n\n const container = new ComponentContainer('database-standalone');\n /**\n * ComponentContainer('database-standalone') is just a placeholder that doesn't perform\n * any actual function.\n */\n const authProvider = new Provider<FirebaseAuthInternalName>(\n 'auth-internal',\n container\n );\n authProvider.setComponent(\n new Component('auth-internal', () => customAuthImpl, ComponentType.PRIVATE)\n );\n\n let appCheckProvider: Provider<AppCheckInternalComponentName> = undefined;\n if (customAppCheckImpl) {\n appCheckProvider = new Provider<AppCheckInternalComponentName>(\n 'app-check-internal',\n container\n );\n appCheckProvider.setComponent(\n new Component(\n 'app-check-internal',\n () => customAppCheckImpl,\n ComponentType.PRIVATE\n )\n );\n }\n\n return {\n instance: new Database(\n _repoManagerDatabaseFromApp(\n app,\n authProvider,\n appCheckProvider,\n url,\n nodeAdmin\n ),\n app\n ) as types.Database,\n namespace\n };\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport firebase, { FirebaseNamespace } from '@firebase/app-compat';\nimport { _FirebaseNamespace } from '@firebase/app-types/private';\nimport { Component, ComponentType } from '@firebase/component';\nimport { enableLogging } from '@firebase/database';\nimport * as types from '@firebase/database-types';\n\nimport { name, version } from '../package.json';\nimport { Database } from '../src/api/Database';\nimport * as INTERNAL from '../src/api/internal';\nimport { DataSnapshot, Query, Reference } from '../src/api/Reference';\n\nconst ServerValue = Database.ServerValue;\n\nexport function registerDatabase(instance: FirebaseNamespace) {\n // Register the Database Service with the 'firebase' namespace.\n (instance as unknown as _FirebaseNamespace).INTERNAL.registerComponent(\n new Component(\n 'database-compat',\n (container, { instanceIdentifier: url }) => {\n /* Dependencies */\n // getImmediate for FirebaseApp will always succeed\n const app = container.getProvider('app-compat').getImmediate();\n const databaseExp = container\n .getProvider('database')\n .getImmediate({ identifier: url });\n return new Database(databaseExp, app);\n },\n ComponentType.PUBLIC\n )\n .setServiceProps(\n // firebase.database namespace properties\n {\n Reference,\n Query,\n Database,\n DataSnapshot,\n enableLogging,\n INTERNAL,\n ServerValue\n }\n )\n .setMultipleInstances(true)\n );\n\n instance.registerVersion(name, version);\n}\n\nregisterDatabase(firebase);\n\ndeclare module '@firebase/app-compat' {\n interface FirebaseNamespace {\n database?: {\n (app?: FirebaseApp): types.FirebaseDatabase;\n enableLogging: typeof types.enableLogging;\n ServerValue: types.ServerValue;\n Database: typeof types.FirebaseDatabase;\n };\n }\n interface FirebaseApp {\n database?(databaseURL?: string): types.FirebaseDatabase;\n }\n}\n"],"names":["errorPrefixFxn","ModularOnDisconnect"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAeG;AAIH,IAAM,SAAS,GAAG,IAAI,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAEnD,IAAM,IAAI,GAAG,UAAU,GAAW,EAAA;AACvC,IAAA,IAAM,OAAO,GAAG,oBAAoB,GAAG,GAAG,CAAC;AAC3C,IAAA,SAAS,CAAC,IAAI,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