@firebase/database 0.8.3-canary.f7e30543a → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -16
- package/dist/index.esm.js +34 -163
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm2017.js +34 -161
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +34 -163
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/api/Query.d.ts +0 -2
- package/dist/src/core/AuthTokenProvider.d.ts +2 -2
- package/dist/src/core/Repo.d.ts +21 -10
- package/dist/src/core/RepoManager.d.ts +2 -8
- package/dist/src/core/util/NextPushId.d.ts +0 -2
- package/dist/src/core/util/util.d.ts +0 -8
- package/dist/src/core/view/QueryParams.d.ts +0 -6
- package/package.json +13 -16
- package/dist/exp/exp/index.d.ts +0 -29
- package/dist/exp/index.d.ts +0 -29
- package/dist/exp/index.esm.js +0 -14942
- package/dist/exp/index.esm.js.map +0 -1
- package/dist/exp/index.esm2017.js +0 -14358
- package/dist/exp/index.esm2017.js.map +0 -1
- package/dist/exp/index.node.cjs.js +0 -14953
- package/dist/exp/index.node.cjs.js.map +0 -1
- package/dist/exp/index.node.d.ts +0 -83
- package/dist/exp/src/api/DataSnapshot.d.ts +0 -99
- package/dist/exp/src/api/Database.d.ts +0 -87
- package/dist/exp/src/api/Query.d.ts +0 -193
- package/dist/exp/src/api/Reference.d.ts +0 -106
- package/dist/exp/src/api/TransactionResult.d.ts +0 -30
- package/dist/exp/src/api/internal.d.ts +0 -55
- package/dist/exp/src/api/onDisconnect.d.ts +0 -60
- package/dist/exp/src/api/test_access.d.ts +0 -42
- package/dist/exp/src/core/AuthTokenProvider.d.ts +0 -50
- package/dist/exp/src/core/CompoundWrite.d.ts +0 -77
- package/dist/exp/src/core/PersistentConnection.d.ts +0 -148
- package/dist/exp/src/core/ReadonlyRestClient.d.ts +0 -73
- package/dist/exp/src/core/Repo.d.ts +0 -121
- package/dist/exp/src/core/RepoInfo.d.ts +0 -59
- package/dist/exp/src/core/RepoManager.d.ts +0 -78
- package/dist/exp/src/core/Repo_transaction.d.ts +0 -33
- package/dist/exp/src/core/ServerActions.d.ts +0 -85
- package/dist/exp/src/core/SnapshotHolder.d.ts +0 -28
- package/dist/exp/src/core/SparseSnapshotTree.d.ts +0 -61
- package/dist/exp/src/core/SyncPoint.d.ts +0 -84
- package/dist/exp/src/core/SyncTree.d.ts +0 -236
- package/dist/exp/src/core/WriteTree.d.ts +0 -295
- package/dist/exp/src/core/operation/AckUserWrite.d.ts +0 -42
- package/dist/exp/src/core/operation/ListenComplete.d.ts +0 -32
- package/dist/exp/src/core/operation/Merge.d.ts +0 -46
- package/dist/exp/src/core/operation/Operation.d.ts +0 -78
- package/dist/exp/src/core/operation/Overwrite.d.ts +0 -35
- package/dist/exp/src/core/snap/ChildrenNode.d.ts +0 -180
- package/dist/exp/src/core/snap/IndexMap.d.ts +0 -43
- package/dist/exp/src/core/snap/LeafNode.d.ts +0 -107
- package/dist/exp/src/core/snap/Node.d.ts +0 -148
- package/dist/exp/src/core/snap/childSet.d.ts +0 -34
- package/dist/exp/src/core/snap/comparators.d.ts +0 -19
- package/dist/exp/src/core/snap/indexes/Index.d.ts +0 -69
- package/dist/exp/src/core/snap/indexes/KeyIndex.d.ts +0 -54
- package/dist/exp/src/core/snap/indexes/PathIndex.d.ts +0 -54
- package/dist/exp/src/core/snap/indexes/PriorityIndex.d.ts +0 -58
- package/dist/exp/src/core/snap/indexes/ValueIndex.d.ts +0 -56
- package/dist/exp/src/core/snap/nodeFromJSON.d.ts +0 -25
- package/dist/exp/src/core/snap/snap.d.ts +0 -29
- package/dist/exp/src/core/stats/StatsCollection.d.ts +0 -28
- package/dist/exp/src/core/stats/StatsListener.d.ts +0 -31
- package/dist/exp/src/core/stats/StatsManager.d.ts +0 -24
- package/dist/exp/src/core/stats/StatsReporter.d.ts +0 -33
- package/dist/exp/src/core/storage/DOMStorageWrapper.d.ts +0 -55
- package/dist/exp/src/core/storage/MemoryStorage.d.ts +0 -29
- package/dist/exp/src/core/storage/storage.d.ts +0 -22
- package/dist/exp/src/core/util/EventEmitter.d.ts +0 -45
- package/dist/exp/src/core/util/ImmutableTree.d.ts +0 -157
- package/dist/exp/src/core/util/NextPushId.d.ts +0 -33
- package/dist/exp/src/core/util/OnlineMonitor.d.ts +0 -40
- package/dist/exp/src/core/util/Path.d.ts +0 -132
- package/dist/exp/src/core/util/ServerValues.d.ts +0 -66
- package/dist/exp/src/core/util/SortedMap.d.ts +0 -362
- package/dist/exp/src/core/util/Tree.d.ts +0 -134
- package/dist/exp/src/core/util/VisibilityMonitor.d.ts +0 -30
- package/dist/exp/src/core/util/libs/parser.d.ts +0 -37
- package/dist/exp/src/core/util/misc.d.ts +0 -19
- package/dist/exp/src/core/util/util.d.ts +0 -232
- package/dist/exp/src/core/util/validation.d.ts +0 -108
- package/dist/exp/src/core/version.d.ts +0 -19
- package/dist/exp/src/core/view/CacheNode.d.ts +0 -59
- package/dist/exp/src/core/view/Change.d.ts +0 -74
- package/dist/exp/src/core/view/ChildChangeAccumulator.d.ts +0 -22
- package/dist/exp/src/core/view/CompleteChildSource.d.ts +0 -91
- package/dist/exp/src/core/view/Event.d.ts +0 -102
- package/dist/exp/src/core/view/EventGenerator.d.ts +0 -77
- package/dist/exp/src/core/view/EventQueue.d.ts +0 -99
- package/dist/exp/src/core/view/EventRegistration.d.ts +0 -154
- package/dist/exp/src/core/view/QueryParams.d.ts +0 -176
- package/dist/exp/src/core/view/View.d.ts +0 -97
- package/dist/exp/src/core/view/ViewCache.d.ts +0 -70
- package/dist/exp/src/core/view/ViewProcessor.d.ts +0 -166
- package/dist/exp/src/core/view/filter/IndexedFilter.d.ts +0 -54
- package/dist/exp/src/core/view/filter/LimitedFilter.d.ts +0 -94
- package/dist/exp/src/core/view/filter/NodeFilter.d.ts +0 -75
- package/dist/exp/src/core/view/filter/RangedFilter.d.ts +0 -109
- package/dist/exp/src/exp/Database.d.ts +0 -95
- package/dist/exp/src/realtime/BrowserPollConnection.d.ts +0 -208
- package/dist/exp/src/realtime/Connection.d.ts +0 -119
- package/dist/exp/src/realtime/Constants.d.ts +0 -26
- package/dist/exp/src/realtime/Transport.d.ts +0 -62
- package/dist/exp/src/realtime/TransportManager.d.ts +0 -55
- package/dist/exp/src/realtime/WebSocketConnection.d.ts +0 -133
- package/dist/exp/src/realtime/polling/PacketReceiver.d.ts +0 -41
- package/dist/exp/test/browser/crawler_support.test.d.ts +0 -17
- package/dist/exp/test/compound_write.test.d.ts +0 -17
- package/dist/exp/test/connection.test.d.ts +0 -17
- package/dist/exp/test/database.test.d.ts +0 -17
- package/dist/exp/test/datasnapshot.test.d.ts +0 -17
- package/dist/exp/test/exp/integration.test.d.ts +0 -17
- package/dist/exp/test/helpers/EventAccumulator.d.ts +0 -34
- package/dist/exp/test/helpers/events.d.ts +0 -37
- package/dist/exp/test/helpers/util.d.ts +0 -50
- package/dist/exp/test/info.test.d.ts +0 -17
- package/dist/exp/test/node.test.d.ts +0 -17
- package/dist/exp/test/order.test.d.ts +0 -17
- package/dist/exp/test/order_by.test.d.ts +0 -17
- package/dist/exp/test/path.test.d.ts +0 -17
- package/dist/exp/test/promise.test.d.ts +0 -17
- package/dist/exp/test/pushid.test.d.ts +0 -17
- package/dist/exp/test/query.test.d.ts +0 -17
- package/dist/exp/test/repoinfo.test.d.ts +0 -17
- package/dist/exp/test/servervalues.test.d.ts +0 -17
- package/dist/exp/test/sortedmap.test.d.ts +0 -17
- package/dist/exp/test/sparsesnapshottree.test.d.ts +0 -17
- package/dist/exp/test/transaction.test.d.ts +0 -17
- package/dist/src/exp/Database.d.ts +0 -95
- package/dist/test/exp/integration.test.d.ts +0 -17
- package/dist/test/pushid.test.d.ts +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
1
|
import { FirebaseNamespace } from '@firebase/app-types';
|
|
18
2
|
import { Database } from './src/api/Database';
|
|
19
3
|
import { Query } from './src/api/Query';
|
package/dist/index.esm.js
CHANGED
|
@@ -658,14 +658,6 @@ var errorForServerCode = function (code, query) {
|
|
|
658
658
|
* @private
|
|
659
659
|
*/
|
|
660
660
|
var INTEGER_REGEXP_ = new RegExp('^-?(0*)\\d{1,10}$');
|
|
661
|
-
/**
|
|
662
|
-
* For use in keys, the minimum possible 32-bit integer.
|
|
663
|
-
*/
|
|
664
|
-
var INTEGER_32_MIN = -2147483648;
|
|
665
|
-
/**
|
|
666
|
-
* For use in kyes, the maximum possible 32-bit integer.
|
|
667
|
-
*/
|
|
668
|
-
var INTEGER_32_MAX = 2147483647;
|
|
669
661
|
/**
|
|
670
662
|
* If the string contains a 32-bit integer, return it. Else return null.
|
|
671
663
|
* @param {!string} str
|
|
@@ -674,7 +666,7 @@ var INTEGER_32_MAX = 2147483647;
|
|
|
674
666
|
var tryParseInt = function (str) {
|
|
675
667
|
if (INTEGER_REGEXP_.test(str)) {
|
|
676
668
|
var intVal = Number(str);
|
|
677
|
-
if (intVal >=
|
|
669
|
+
if (intVal >= -2147483648 && intVal <= 2147483647) {
|
|
678
670
|
return intVal;
|
|
679
671
|
}
|
|
680
672
|
}
|
|
@@ -1875,11 +1867,6 @@ var TransactionResult = /** @class */ (function () {
|
|
|
1875
1867
|
* See the License for the specific language governing permissions and
|
|
1876
1868
|
* limitations under the License.
|
|
1877
1869
|
*/
|
|
1878
|
-
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
1879
|
-
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
1880
|
-
var MIN_PUSH_CHAR = '-';
|
|
1881
|
-
var MAX_PUSH_CHAR = 'z';
|
|
1882
|
-
var MAX_KEY_LEN = 786;
|
|
1883
1870
|
/**
|
|
1884
1871
|
* Fancy ID generator that creates 20-character string identifiers with the
|
|
1885
1872
|
* following properties:
|
|
@@ -1895,6 +1882,8 @@ var MAX_KEY_LEN = 786;
|
|
|
1895
1882
|
* in the case of a timestamp collision).
|
|
1896
1883
|
*/
|
|
1897
1884
|
var nextPushId = (function () {
|
|
1885
|
+
// Modeled after base64 web-safe chars, but ordered by ASCII.
|
|
1886
|
+
var PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
|
|
1898
1887
|
// Timestamp of last push, used to prevent local collisions if you push twice
|
|
1899
1888
|
// in one ms.
|
|
1900
1889
|
var lastPushTime = 0;
|
|
@@ -1935,76 +1924,7 @@ var nextPushId = (function () {
|
|
|
1935
1924
|
assert(id.length === 20, 'nextPushId: Length should be 20.');
|
|
1936
1925
|
return id;
|
|
1937
1926
|
};
|
|
1938
|
-
})();
|
|
1939
|
-
var successor = function (key) {
|
|
1940
|
-
if (key === '' + INTEGER_32_MAX) {
|
|
1941
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#data-order
|
|
1942
|
-
return MIN_PUSH_CHAR;
|
|
1943
|
-
}
|
|
1944
|
-
var keyAsInt = tryParseInt(key);
|
|
1945
|
-
if (keyAsInt != null) {
|
|
1946
|
-
return '' + (keyAsInt + 1);
|
|
1947
|
-
}
|
|
1948
|
-
var next = new Array(key.length);
|
|
1949
|
-
for (var i_1 = 0; i_1 < next.length; i_1++) {
|
|
1950
|
-
next[i_1] = key.charAt(i_1);
|
|
1951
|
-
}
|
|
1952
|
-
if (next.length < MAX_KEY_LEN) {
|
|
1953
|
-
next.push(MIN_PUSH_CHAR);
|
|
1954
|
-
return next.join('');
|
|
1955
|
-
}
|
|
1956
|
-
var i = next.length - 1;
|
|
1957
|
-
while (i >= 0 && next[i] === MAX_PUSH_CHAR) {
|
|
1958
|
-
i--;
|
|
1959
|
-
}
|
|
1960
|
-
// `successor` was called on the largest possible key, so return the
|
|
1961
|
-
// MAX_NAME, which sorts larger than all keys.
|
|
1962
|
-
if (i === -1) {
|
|
1963
|
-
return MAX_NAME;
|
|
1964
|
-
}
|
|
1965
|
-
var source = next[i];
|
|
1966
|
-
var sourcePlusOne = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(source) + 1);
|
|
1967
|
-
next[i] = sourcePlusOne;
|
|
1968
|
-
return next.slice(0, i + 1).join('');
|
|
1969
|
-
};
|
|
1970
|
-
// `key` is assumed to be non-empty.
|
|
1971
|
-
var predecessor = function (key) {
|
|
1972
|
-
if (key === '' + INTEGER_32_MIN) {
|
|
1973
|
-
return MIN_NAME;
|
|
1974
|
-
}
|
|
1975
|
-
var keyAsInt = tryParseInt(key);
|
|
1976
|
-
if (keyAsInt != null) {
|
|
1977
|
-
return '' + (keyAsInt - 1);
|
|
1978
|
-
}
|
|
1979
|
-
var next = new Array(key.length);
|
|
1980
|
-
for (var i = 0; i < next.length; i++) {
|
|
1981
|
-
next[i] = key.charAt(i);
|
|
1982
|
-
}
|
|
1983
|
-
// If `key` ends in `MIN_PUSH_CHAR`, the largest key lexicographically
|
|
1984
|
-
// smaller than `key`, is `key[0:key.length - 1]`. The next key smaller
|
|
1985
|
-
// than that, `predecessor(predecessor(key))`, is
|
|
1986
|
-
//
|
|
1987
|
-
// `key[0:key.length - 2] + (key[key.length - 1] - 1) + \
|
|
1988
|
-
// { MAX_PUSH_CHAR repeated MAX_KEY_LEN - (key.length - 1) times }
|
|
1989
|
-
//
|
|
1990
|
-
// analogous to increment/decrement for base-10 integers.
|
|
1991
|
-
//
|
|
1992
|
-
// This works because lexigographic comparison works character-by-character,
|
|
1993
|
-
// using length as a tie-breaker if one key is a prefix of the other.
|
|
1994
|
-
if (next[next.length - 1] === MIN_PUSH_CHAR) {
|
|
1995
|
-
if (next.length === 1) {
|
|
1996
|
-
// See https://firebase.google.com/docs/database/web/lists-of-data#orderbykey
|
|
1997
|
-
return '' + INTEGER_32_MAX;
|
|
1998
|
-
}
|
|
1999
|
-
delete next[next.length - 1];
|
|
2000
|
-
return next.join('');
|
|
2001
|
-
}
|
|
2002
|
-
// Replace the last character with it's immediate predecessor, and
|
|
2003
|
-
// fill the suffix of the key with MAX_PUSH_CHAR. This is the
|
|
2004
|
-
// lexicographically largest possible key smaller than `key`.
|
|
2005
|
-
next[next.length - 1] = PUSH_CHARS.charAt(PUSH_CHARS.indexOf(next[next.length - 1]) - 1);
|
|
2006
|
-
return next.join('') + MAX_PUSH_CHAR.repeat(MAX_KEY_LEN - next.length);
|
|
2007
|
-
};
|
|
1927
|
+
})();
|
|
2008
1928
|
|
|
2009
1929
|
/**
|
|
2010
1930
|
* @license
|
|
@@ -4843,8 +4763,7 @@ var Query = /** @class */ (function () {
|
|
|
4843
4763
|
'or equalTo() must be a string.';
|
|
4844
4764
|
if (params.hasStart()) {
|
|
4845
4765
|
var startName = params.getIndexStartName();
|
|
4846
|
-
if (startName !== MIN_NAME
|
|
4847
|
-
!(params.hasStartAfter() && startName === MAX_NAME)) {
|
|
4766
|
+
if (startName !== MIN_NAME) {
|
|
4848
4767
|
throw new Error(tooManyArgsError);
|
|
4849
4768
|
}
|
|
4850
4769
|
else if (typeof startNode !== 'string') {
|
|
@@ -4853,8 +4772,7 @@ var Query = /** @class */ (function () {
|
|
|
4853
4772
|
}
|
|
4854
4773
|
if (params.hasEnd()) {
|
|
4855
4774
|
var endName = params.getIndexEndName();
|
|
4856
|
-
if (endName !== MAX_NAME
|
|
4857
|
-
!(params.hasEndBefore() && endName === MIN_NAME)) {
|
|
4775
|
+
if (endName !== MAX_NAME) {
|
|
4858
4776
|
throw new Error(tooManyArgsError);
|
|
4859
4777
|
}
|
|
4860
4778
|
else if (typeof endNode !== 'string') {
|
|
@@ -5155,20 +5073,6 @@ var Query = /** @class */ (function () {
|
|
|
5155
5073
|
}
|
|
5156
5074
|
return new Query(this.repo, this.path, newParams, this.orderByCalled_);
|
|
5157
5075
|
};
|
|
5158
|
-
Query.prototype.startAfter = function (value, name) {
|
|
5159
|
-
if (value === void 0) { value = null; }
|
|
5160
|
-
validateArgCount('Query.startAfter', 0, 2, arguments.length);
|
|
5161
|
-
validateFirebaseDataArg('Query.startAfter', 1, value, this.path, false);
|
|
5162
|
-
validateKey('Query.startAfter', 2, name, true);
|
|
5163
|
-
var newParams = this.queryParams_.startAfter(value, name);
|
|
5164
|
-
Query.validateLimit_(newParams);
|
|
5165
|
-
Query.validateQueryEndpoints_(newParams);
|
|
5166
|
-
if (this.queryParams_.hasStart()) {
|
|
5167
|
-
throw new Error('Query.startAfter: Starting point was already set (by another call to startAt, startAfter ' +
|
|
5168
|
-
'or equalTo).');
|
|
5169
|
-
}
|
|
5170
|
-
return new Query(this.repo, this.path, newParams, this.orderByCalled_);
|
|
5171
|
-
};
|
|
5172
5076
|
/**
|
|
5173
5077
|
* @param {number|string|boolean|null} value
|
|
5174
5078
|
* @param {?string=} name
|
|
@@ -5183,21 +5087,7 @@ var Query = /** @class */ (function () {
|
|
|
5183
5087
|
Query.validateLimit_(newParams);
|
|
5184
5088
|
Query.validateQueryEndpoints_(newParams);
|
|
5185
5089
|
if (this.queryParams_.hasEnd()) {
|
|
5186
|
-
throw new Error('Query.endAt: Ending point was already set (by another call to endAt
|
|
5187
|
-
'equalTo).');
|
|
5188
|
-
}
|
|
5189
|
-
return new Query(this.repo, this.path, newParams, this.orderByCalled_);
|
|
5190
|
-
};
|
|
5191
|
-
Query.prototype.endBefore = function (value, name) {
|
|
5192
|
-
if (value === void 0) { value = null; }
|
|
5193
|
-
validateArgCount('Query.endBefore', 0, 2, arguments.length);
|
|
5194
|
-
validateFirebaseDataArg('Query.endBefore', 1, value, this.path, false);
|
|
5195
|
-
validateKey('Query.endBefore', 2, name, true);
|
|
5196
|
-
var newParams = this.queryParams_.endBefore(value, name);
|
|
5197
|
-
Query.validateLimit_(newParams);
|
|
5198
|
-
Query.validateQueryEndpoints_(newParams);
|
|
5199
|
-
if (this.queryParams_.hasEnd()) {
|
|
5200
|
-
throw new Error('Query.endBefore: Ending point was already set (by another call to endAt, endBefore, or ' +
|
|
5090
|
+
throw new Error('Query.endAt: Ending point was already set (by another call to endAt or ' +
|
|
5201
5091
|
'equalTo).');
|
|
5202
5092
|
}
|
|
5203
5093
|
return new Query(this.repo, this.path, newParams, this.orderByCalled_);
|
|
@@ -12875,31 +12765,44 @@ var Repo = /** @class */ (function () {
|
|
|
12875
12765
|
* The purpose of `getValue` is to return the latest known value
|
|
12876
12766
|
* satisfying `query`.
|
|
12877
12767
|
*
|
|
12878
|
-
*
|
|
12879
|
-
*
|
|
12880
|
-
*
|
|
12768
|
+
* If the client is connected, this method will send a request
|
|
12769
|
+
* to the server. If the client is not connected, then either:
|
|
12770
|
+
*
|
|
12771
|
+
* 1. The client was once connected, but not anymore.
|
|
12772
|
+
* 2. The client has never connected, this is the first operation
|
|
12773
|
+
* this repo is handling.
|
|
12881
12774
|
*
|
|
12882
|
-
*
|
|
12883
|
-
*
|
|
12884
|
-
*
|
|
12885
|
-
* an
|
|
12775
|
+
* In case (1), it's possible that the client still has an active
|
|
12776
|
+
* listener, with cached data. Since this is the latest known
|
|
12777
|
+
* value satisfying the query, that's what getValue will return.
|
|
12778
|
+
* If there is no cached data, `getValue` surfaces an "offline"
|
|
12779
|
+
* error.
|
|
12780
|
+
*
|
|
12781
|
+
* In case (2), `getValue` will trigger a time-limited connection
|
|
12782
|
+
* attempt. If the client is unable to connect to the server, it
|
|
12783
|
+
* will surface an "offline" error because there cannot be any
|
|
12784
|
+
* cached data. On the other hand, if the client is able to connect,
|
|
12785
|
+
* `getValue` will return the server's value for the query, if one
|
|
12786
|
+
* exists.
|
|
12886
12787
|
*
|
|
12887
12788
|
* @param query - The query to surface a value for.
|
|
12888
12789
|
*/
|
|
12889
12790
|
Repo.prototype.getValue = function (query) {
|
|
12890
12791
|
var _this = this;
|
|
12891
|
-
// Only active queries are cached. There is no persisted cache.
|
|
12892
|
-
var cached = this.serverSyncTree_.calcCompleteEventCache(query.path);
|
|
12893
|
-
if (!cached.isEmpty()) {
|
|
12894
|
-
return Promise.resolve(new DataSnapshot(cached, query.getRef(), query.getQueryParams().getIndex()));
|
|
12895
|
-
}
|
|
12896
12792
|
return this.server_.get(query).then(function (payload) {
|
|
12897
12793
|
var node = nodeFromJSON$1(payload);
|
|
12898
12794
|
var events = _this.serverSyncTree_.applyServerOverwrite(query.path, node);
|
|
12899
12795
|
_this.eventQueue_.raiseEventsAtPath(query.path, events);
|
|
12900
12796
|
return Promise.resolve(new DataSnapshot(node, query.getRef(), query.getQueryParams().getIndex()));
|
|
12901
12797
|
}, function (err) {
|
|
12902
|
-
_this.log_('get for query ' +
|
|
12798
|
+
_this.log_('get for query ' +
|
|
12799
|
+
stringify(query) +
|
|
12800
|
+
' falling back to cache after error: ' +
|
|
12801
|
+
err);
|
|
12802
|
+
var cached = _this.serverSyncTree_.calcCompleteEventCache(query.path);
|
|
12803
|
+
if (!cached.isEmpty()) {
|
|
12804
|
+
return Promise.resolve(new DataSnapshot(cached, query.getRef(), query.getQueryParams().getIndex()));
|
|
12805
|
+
}
|
|
12903
12806
|
return Promise.reject(new Error(err));
|
|
12904
12807
|
});
|
|
12905
12808
|
};
|
|
@@ -13555,10 +13458,8 @@ var QueryParams = /** @class */ (function () {
|
|
|
13555
13458
|
this.limitSet_ = false;
|
|
13556
13459
|
this.startSet_ = false;
|
|
13557
13460
|
this.startNameSet_ = false;
|
|
13558
|
-
this.startAfterSet_ = false;
|
|
13559
13461
|
this.endSet_ = false;
|
|
13560
13462
|
this.endNameSet_ = false;
|
|
13561
|
-
this.endBeforeSet_ = false;
|
|
13562
13463
|
this.limit_ = 0;
|
|
13563
13464
|
this.viewFrom_ = '';
|
|
13564
13465
|
this.indexStartValue_ = null;
|
|
@@ -13573,12 +13474,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
13573
13474
|
QueryParams.prototype.hasStart = function () {
|
|
13574
13475
|
return this.startSet_;
|
|
13575
13476
|
};
|
|
13576
|
-
QueryParams.prototype.hasStartAfter = function () {
|
|
13577
|
-
return this.startAfterSet_;
|
|
13578
|
-
};
|
|
13579
|
-
QueryParams.prototype.hasEndBefore = function () {
|
|
13580
|
-
return this.endBeforeSet_;
|
|
13581
|
-
};
|
|
13582
13477
|
/**
|
|
13583
13478
|
* @return {boolean} True if it would return from left.
|
|
13584
13479
|
*/
|
|
@@ -13745,18 +13640,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
13745
13640
|
}
|
|
13746
13641
|
return newParams;
|
|
13747
13642
|
};
|
|
13748
|
-
QueryParams.prototype.startAfter = function (indexValue, key) {
|
|
13749
|
-
var childKey;
|
|
13750
|
-
if (key == null) {
|
|
13751
|
-
childKey = MAX_NAME;
|
|
13752
|
-
}
|
|
13753
|
-
else {
|
|
13754
|
-
childKey = successor(key);
|
|
13755
|
-
}
|
|
13756
|
-
var params = this.startAt(indexValue, childKey);
|
|
13757
|
-
params.startAfterSet_ = true;
|
|
13758
|
-
return params;
|
|
13759
|
-
};
|
|
13760
13643
|
/**
|
|
13761
13644
|
* @param {*} indexValue
|
|
13762
13645
|
* @param {?string=} key
|
|
@@ -13779,18 +13662,6 @@ var QueryParams = /** @class */ (function () {
|
|
|
13779
13662
|
}
|
|
13780
13663
|
return newParams;
|
|
13781
13664
|
};
|
|
13782
|
-
QueryParams.prototype.endBefore = function (indexValue, key) {
|
|
13783
|
-
var childKey;
|
|
13784
|
-
if (key == null) {
|
|
13785
|
-
childKey = MIN_NAME;
|
|
13786
|
-
}
|
|
13787
|
-
else {
|
|
13788
|
-
childKey = predecessor(key);
|
|
13789
|
-
}
|
|
13790
|
-
var params = this.endAt(indexValue, childKey);
|
|
13791
|
-
params.endBeforeSet_ = true;
|
|
13792
|
-
return params;
|
|
13793
|
-
};
|
|
13794
13665
|
/**
|
|
13795
13666
|
* @param {!Index} index
|
|
13796
13667
|
* @return {!QueryParams}
|
|
@@ -15681,7 +15552,7 @@ var TEST_ACCESS = /*#__PURE__*/Object.freeze({
|
|
|
15681
15552
|
});
|
|
15682
15553
|
|
|
15683
15554
|
var name = "@firebase/database";
|
|
15684
|
-
var version = "0.8.3
|
|
15555
|
+
var version = "0.8.3";
|
|
15685
15556
|
|
|
15686
15557
|
/**
|
|
15687
15558
|
* @license
|