@firebase/firestore 3.7.1 → 3.7.2
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/CHANGELOG.md +12 -0
- package/dist/index.esm2017.js +234 -231
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +622 -621
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +36 -35
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +3 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +234 -231
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/index.browser.esm2017.js +134 -134
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +257 -257
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +134 -134
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +17 -17
- package/dist/packages/firestore/dist/index.esm2017.d.ts +1 -1
- package/package.json +10 -10
- package/dist/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/lite/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
- package/dist/packages/firestore/test/integration/api_internal/aggregation.test.d.ts +0 -17
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ P.MOCK_USER = new P("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let v = "9.
|
|
69
|
+
let v = "9.13.0";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -12883,14 +12883,14 @@ class tu {
|
|
|
12883
12883
|
*/
|
|
12884
12884
|
class eu {
|
|
12885
12885
|
constructor(t, e, n, s, i, r, o, u) {
|
|
12886
|
-
this.Hs = t, this.vo = n, this.Vo = s, this.
|
|
12886
|
+
this.Hs = t, this.vo = n, this.Vo = s, this.connection = i, this.authCredentialsProvider = r,
|
|
12887
12887
|
this.appCheckCredentialsProvider = o, this.listener = u, this.state = 0 /* Initial */ ,
|
|
12888
12888
|
/**
|
|
12889
12889
|
* A close count that's incremented every time the stream is closed; used by
|
|
12890
12890
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
12891
12891
|
* close.
|
|
12892
12892
|
*/
|
|
12893
|
-
this.
|
|
12893
|
+
this.So = 0, this.Do = null, this.Co = null, this.stream = null, this.xo = new tu(t, e);
|
|
12894
12894
|
}
|
|
12895
12895
|
/**
|
|
12896
12896
|
* Returns true if start() has been called and no error has occurred. True
|
|
@@ -12898,13 +12898,13 @@ class eu {
|
|
|
12898
12898
|
* encompasses respecting backoff, getting auth tokens, and starting the
|
|
12899
12899
|
* actual RPC). Use isOpen() to determine if the stream is open and ready for
|
|
12900
12900
|
* outbound requests.
|
|
12901
|
-
*/
|
|
12902
|
-
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.
|
|
12901
|
+
*/ No() {
|
|
12902
|
+
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.ko();
|
|
12903
12903
|
}
|
|
12904
12904
|
/**
|
|
12905
12905
|
* Returns true if the underlying RPC is open (the onOpen() listener has been
|
|
12906
12906
|
* called) and the stream is ready for outbound requests.
|
|
12907
|
-
*/
|
|
12907
|
+
*/ ko() {
|
|
12908
12908
|
return 2 /* Open */ === this.state || 3 /* Healthy */ === this.state;
|
|
12909
12909
|
}
|
|
12910
12910
|
/**
|
|
@@ -12914,7 +12914,7 @@ class eu {
|
|
|
12914
12914
|
*
|
|
12915
12915
|
* When start returns, isStarted() will return true.
|
|
12916
12916
|
*/ start() {
|
|
12917
|
-
4 /* Error */ !== this.state ? this.auth() : this.
|
|
12917
|
+
4 /* Error */ !== this.state ? this.auth() : this.Oo();
|
|
12918
12918
|
}
|
|
12919
12919
|
/**
|
|
12920
12920
|
* Stops the RPC. This call is idempotent and allowed regardless of the
|
|
@@ -12922,7 +12922,7 @@ class eu {
|
|
|
12922
12922
|
*
|
|
12923
12923
|
* When stop returns, isStarted() and isOpen() will both return false.
|
|
12924
12924
|
*/ async stop() {
|
|
12925
|
-
this.
|
|
12925
|
+
this.No() && await this.close(0 /* Initial */);
|
|
12926
12926
|
}
|
|
12927
12927
|
/**
|
|
12928
12928
|
* After an error the stream will usually back off on the next attempt to
|
|
@@ -12931,8 +12931,8 @@ class eu {
|
|
|
12931
12931
|
*
|
|
12932
12932
|
* Each error will call the onClose() listener. That function can decide to
|
|
12933
12933
|
* inhibit backoff if required.
|
|
12934
|
-
*/
|
|
12935
|
-
this.state = 0 /* Initial */ , this.
|
|
12934
|
+
*/ Mo() {
|
|
12935
|
+
this.state = 0 /* Initial */ , this.xo.reset();
|
|
12936
12936
|
}
|
|
12937
12937
|
/**
|
|
12938
12938
|
* Marks this stream as idle. If no further actions are performed on the
|
|
@@ -12943,25 +12943,25 @@ class eu {
|
|
|
12943
12943
|
*
|
|
12944
12944
|
* Only streams that are in state 'Open' can be marked idle, as all other
|
|
12945
12945
|
* states imply pending network operations.
|
|
12946
|
-
*/
|
|
12946
|
+
*/ Fo() {
|
|
12947
12947
|
// Starts the idle time if we are in state 'Open' and are not yet already
|
|
12948
12948
|
// running a timer (in which case the previous idle timeout still applies).
|
|
12949
|
-
this.
|
|
12949
|
+
this.ko() && null === this.Do && (this.Do = this.Hs.enqueueAfterDelay(this.vo, 6e4, (() => this.$o())));
|
|
12950
12950
|
}
|
|
12951
|
-
/** Sends a message to the underlying stream. */
|
|
12952
|
-
this.
|
|
12951
|
+
/** Sends a message to the underlying stream. */ Bo(t) {
|
|
12952
|
+
this.Lo(), this.stream.send(t);
|
|
12953
12953
|
}
|
|
12954
|
-
/** Called by the idle timer when the stream should close due to inactivity. */ async
|
|
12955
|
-
if (this.
|
|
12954
|
+
/** Called by the idle timer when the stream should close due to inactivity. */ async $o() {
|
|
12955
|
+
if (this.ko())
|
|
12956
12956
|
// When timing out an idle stream there's no reason to force the stream into backoff when
|
|
12957
12957
|
// it restarts so set the stream state to Initial instead of Error.
|
|
12958
12958
|
return this.close(0 /* Initial */);
|
|
12959
12959
|
}
|
|
12960
|
-
/** Marks the stream as active again. */
|
|
12961
|
-
this.
|
|
12960
|
+
/** Marks the stream as active again. */ Lo() {
|
|
12961
|
+
this.Do && (this.Do.cancel(), this.Do = null);
|
|
12962
12962
|
}
|
|
12963
|
-
/** Cancels the health check delayed operation. */
|
|
12964
|
-
this.
|
|
12963
|
+
/** Cancels the health check delayed operation. */ Uo() {
|
|
12964
|
+
this.Co && (this.Co.cancel(), this.Co = null);
|
|
12965
12965
|
}
|
|
12966
12966
|
/**
|
|
12967
12967
|
* Closes the stream and cleans up as necessary:
|
|
@@ -12977,15 +12977,15 @@ class eu {
|
|
|
12977
12977
|
* @param error - the error the connection was closed with.
|
|
12978
12978
|
*/ async close(t, e) {
|
|
12979
12979
|
// Cancel any outstanding timers (they're guaranteed not to execute).
|
|
12980
|
-
this.
|
|
12980
|
+
this.Lo(), this.Uo(), this.xo.cancel(),
|
|
12981
12981
|
// Invalidates any stream-related callbacks (e.g. from auth or the
|
|
12982
12982
|
// underlying stream), guaranteeing they won't execute.
|
|
12983
|
-
this.
|
|
12983
|
+
this.So++, 4 /* Error */ !== t ?
|
|
12984
12984
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
12985
|
-
this.
|
|
12985
|
+
this.xo.reset() : e && e.code === B.RESOURCE_EXHAUSTED ? (
|
|
12986
12986
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
12987
12987
|
x(e.toString()), x("Using maximum backoff delay to prevent overloading the backend."),
|
|
12988
|
-
this.
|
|
12988
|
+
this.xo.Ao()) : e && e.code === B.UNAUTHENTICATED && 3 /* Healthy */ !== this.state && (
|
|
12989
12989
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
12990
12990
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
12991
12991
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -12994,7 +12994,7 @@ class eu {
|
|
|
12994
12994
|
// to ensure that we fetch a new token.
|
|
12995
12995
|
this.authCredentialsProvider.invalidateToken(), this.appCheckCredentialsProvider.invalidateToken()),
|
|
12996
12996
|
// Clean up the underlying stream because we are no longer interested in events.
|
|
12997
|
-
null !== this.stream && (this.
|
|
12997
|
+
null !== this.stream && (this.qo(), this.stream.close(), this.stream = null),
|
|
12998
12998
|
// This state must be assigned before calling onClose() to allow the callback to
|
|
12999
12999
|
// inhibit backoff or otherwise manipulate the state in its non-started state.
|
|
13000
13000
|
this.state = t,
|
|
@@ -13004,46 +13004,46 @@ class eu {
|
|
|
13004
13004
|
/**
|
|
13005
13005
|
* Can be overridden to perform additional cleanup before the stream is closed.
|
|
13006
13006
|
* Calling super.tearDown() is not required.
|
|
13007
|
-
*/
|
|
13007
|
+
*/ qo() {}
|
|
13008
13008
|
auth() {
|
|
13009
13009
|
this.state = 1 /* Starting */;
|
|
13010
|
-
const t = this.
|
|
13010
|
+
const t = this.Ko(this.So), e = this.So;
|
|
13011
13011
|
// TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
|
|
13012
13012
|
Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((([t, n]) => {
|
|
13013
13013
|
// Stream can be stopped while waiting for authentication.
|
|
13014
13014
|
// TODO(mikelehen): We really should just use dispatchIfNotClosed
|
|
13015
13015
|
// and let this dispatch onto the queue, but that opened a spec test can
|
|
13016
13016
|
// of worms that I don't want to deal with in this PR.
|
|
13017
|
-
this.
|
|
13017
|
+
this.So === e &&
|
|
13018
13018
|
// Normally we'd have to schedule the callback on the AsyncQueue.
|
|
13019
13019
|
// However, the following calls are safe to be called outside the
|
|
13020
13020
|
// AsyncQueue since they don't chain asynchronous calls
|
|
13021
|
-
this.
|
|
13021
|
+
this.Go(t, n);
|
|
13022
13022
|
}), (e => {
|
|
13023
13023
|
t((() => {
|
|
13024
13024
|
const t = new L(B.UNKNOWN, "Fetching auth token failed: " + e.message);
|
|
13025
|
-
return this.
|
|
13025
|
+
return this.Qo(t);
|
|
13026
13026
|
}));
|
|
13027
13027
|
}));
|
|
13028
13028
|
}
|
|
13029
|
-
|
|
13030
|
-
const n = this.
|
|
13031
|
-
this.stream = this.
|
|
13032
|
-
n((() => (this.state = 2 /* Open */ , this.
|
|
13029
|
+
Go(t, e) {
|
|
13030
|
+
const n = this.Ko(this.So);
|
|
13031
|
+
this.stream = this.jo(t, e), this.stream.Yr((() => {
|
|
13032
|
+
n((() => (this.state = 2 /* Open */ , this.Co = this.Hs.enqueueAfterDelay(this.Vo, 1e4, (() => (this.ko() && (this.state = 3 /* Healthy */),
|
|
13033
13033
|
Promise.resolve()))), this.listener.Yr())));
|
|
13034
13034
|
})), this.stream.Zr((t => {
|
|
13035
|
-
n((() => this.
|
|
13035
|
+
n((() => this.Qo(t)));
|
|
13036
13036
|
})), this.stream.onMessage((t => {
|
|
13037
13037
|
n((() => this.onMessage(t)));
|
|
13038
13038
|
}));
|
|
13039
13039
|
}
|
|
13040
|
-
|
|
13041
|
-
this.state = 5 /* Backoff */ , this.
|
|
13040
|
+
Oo() {
|
|
13041
|
+
this.state = 5 /* Backoff */ , this.xo.Ro((async () => {
|
|
13042
13042
|
this.state = 0 /* Initial */ , this.start();
|
|
13043
13043
|
}));
|
|
13044
13044
|
}
|
|
13045
13045
|
// Visible for tests
|
|
13046
|
-
|
|
13046
|
+
Qo(t) {
|
|
13047
13047
|
// In theory the stream could close cleanly, however, in our current model
|
|
13048
13048
|
// we never expect this to happen because if we stop a stream ourselves,
|
|
13049
13049
|
// this callback will never be called. To prevent cases where we retry
|
|
@@ -13055,9 +13055,9 @@ class eu {
|
|
|
13055
13055
|
* AsyncQueue but only runs them if closeCount remains unchanged. This allows
|
|
13056
13056
|
* us to turn auth / stream callbacks into no-ops if the stream is closed /
|
|
13057
13057
|
* re-opened, etc.
|
|
13058
|
-
*/
|
|
13058
|
+
*/ Ko(t) {
|
|
13059
13059
|
return e => {
|
|
13060
|
-
this.Hs.enqueueAndForget((() => this.
|
|
13060
|
+
this.Hs.enqueueAndForget((() => this.So === t ? e() : (C("PersistentStream", "stream callback skipped by getCloseGuardedDispatcher."),
|
|
13061
13061
|
Promise.resolve())));
|
|
13062
13062
|
};
|
|
13063
13063
|
}
|
|
@@ -13074,12 +13074,12 @@ class eu {
|
|
|
13074
13074
|
super(t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , e, n, s, r),
|
|
13075
13075
|
this.It = i;
|
|
13076
13076
|
}
|
|
13077
|
-
|
|
13078
|
-
return this.
|
|
13077
|
+
jo(t, e) {
|
|
13078
|
+
return this.connection.wo("Listen", t, e);
|
|
13079
13079
|
}
|
|
13080
13080
|
onMessage(t) {
|
|
13081
13081
|
// A successful response means the stream is healthy
|
|
13082
|
-
this.
|
|
13082
|
+
this.xo.reset();
|
|
13083
13083
|
const e = qs(this.It, t), n = function(t) {
|
|
13084
13084
|
// We have only reached a consistent snapshot for the entire stream if there
|
|
13085
13085
|
// is a read_time set and it applies to all targets (i.e. the list of
|
|
@@ -13088,14 +13088,14 @@ class eu {
|
|
|
13088
13088
|
const e = t.targetChange;
|
|
13089
13089
|
return e.targetIds && e.targetIds.length ? st.min() : e.readTime ? Ds(e.readTime) : st.min();
|
|
13090
13090
|
}(t);
|
|
13091
|
-
return this.listener.
|
|
13091
|
+
return this.listener.Wo(e, n);
|
|
13092
13092
|
}
|
|
13093
13093
|
/**
|
|
13094
13094
|
* Registers interest in the results of the given target. If the target
|
|
13095
13095
|
* includes a resumeToken it will be included in the request. Results that
|
|
13096
13096
|
* affect the target will be streamed back as WatchChange messages that
|
|
13097
13097
|
* reference the targetId.
|
|
13098
|
-
*/
|
|
13098
|
+
*/ zo(t) {
|
|
13099
13099
|
const e = {};
|
|
13100
13100
|
e.database = Fs(this.It), e.addTarget = function(t, e) {
|
|
13101
13101
|
let n;
|
|
@@ -13111,14 +13111,14 @@ class eu {
|
|
|
13111
13111
|
n.readTime = vs(t, e.snapshotVersion.toTimestamp())), n;
|
|
13112
13112
|
}(this.It, t);
|
|
13113
13113
|
const n = Hs(this.It, t);
|
|
13114
|
-
n && (e.labels = n), this.
|
|
13114
|
+
n && (e.labels = n), this.Bo(e);
|
|
13115
13115
|
}
|
|
13116
13116
|
/**
|
|
13117
13117
|
* Unregisters interest in the results of the target associated with the
|
|
13118
13118
|
* given targetId.
|
|
13119
|
-
*/
|
|
13119
|
+
*/ Ho(t) {
|
|
13120
13120
|
const e = {};
|
|
13121
|
-
e.database = Fs(this.It), e.removeTarget = t, this.
|
|
13121
|
+
e.database = Fs(this.It), e.removeTarget = t, this.Bo(e);
|
|
13122
13122
|
}
|
|
13123
13123
|
}
|
|
13124
13124
|
|
|
@@ -13141,54 +13141,54 @@ class eu {
|
|
|
13141
13141
|
*/ class su extends eu {
|
|
13142
13142
|
constructor(t, e, n, s, i, r) {
|
|
13143
13143
|
super(t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , e, n, s, r),
|
|
13144
|
-
this.It = i, this.
|
|
13144
|
+
this.It = i, this.Jo = !1;
|
|
13145
13145
|
}
|
|
13146
13146
|
/**
|
|
13147
13147
|
* Tracks whether or not a handshake has been successfully exchanged and
|
|
13148
13148
|
* the stream is ready to accept mutations.
|
|
13149
|
-
*/ get
|
|
13150
|
-
return this.
|
|
13149
|
+
*/ get Yo() {
|
|
13150
|
+
return this.Jo;
|
|
13151
13151
|
}
|
|
13152
13152
|
// Override of PersistentStream.start
|
|
13153
13153
|
start() {
|
|
13154
|
-
this.
|
|
13154
|
+
this.Jo = !1, this.lastStreamToken = void 0, super.start();
|
|
13155
13155
|
}
|
|
13156
|
-
|
|
13157
|
-
this.
|
|
13156
|
+
qo() {
|
|
13157
|
+
this.Jo && this.Xo([]);
|
|
13158
13158
|
}
|
|
13159
|
-
|
|
13160
|
-
return this.
|
|
13159
|
+
jo(t, e) {
|
|
13160
|
+
return this.connection.wo("Write", t, e);
|
|
13161
13161
|
}
|
|
13162
13162
|
onMessage(t) {
|
|
13163
13163
|
if (
|
|
13164
13164
|
// Always capture the last stream token.
|
|
13165
|
-
M(!!t.streamToken), this.lastStreamToken = t.streamToken, this.
|
|
13165
|
+
M(!!t.streamToken), this.lastStreamToken = t.streamToken, this.Jo) {
|
|
13166
13166
|
// A successful first write response means the stream is healthy,
|
|
13167
13167
|
// Note, that we could consider a successful handshake healthy, however,
|
|
13168
13168
|
// the write itself might be causing an error we want to back off from.
|
|
13169
|
-
this.
|
|
13169
|
+
this.xo.reset();
|
|
13170
13170
|
const e = Qs(t.writeResults, t.commitTime), n = Ds(t.commitTime);
|
|
13171
|
-
return this.listener.
|
|
13171
|
+
return this.listener.Zo(n, e);
|
|
13172
13172
|
}
|
|
13173
13173
|
// The first response is always the handshake response
|
|
13174
|
-
return M(!t.writeResults || 0 === t.writeResults.length), this.
|
|
13174
|
+
return M(!t.writeResults || 0 === t.writeResults.length), this.Jo = !0, this.listener.tu();
|
|
13175
13175
|
}
|
|
13176
13176
|
/**
|
|
13177
13177
|
* Sends an initial streamToken to the server, performing the handshake
|
|
13178
13178
|
* required to make the StreamingWrite RPC work. Subsequent
|
|
13179
13179
|
* calls should wait until onHandshakeComplete was called.
|
|
13180
|
-
*/
|
|
13180
|
+
*/ eu() {
|
|
13181
13181
|
// TODO(dimond): Support stream resumption. We intentionally do not set the
|
|
13182
13182
|
// stream token on the handshake, ignoring any stream token we might have.
|
|
13183
13183
|
const t = {};
|
|
13184
|
-
t.database = Fs(this.It), this.
|
|
13184
|
+
t.database = Fs(this.It), this.Bo(t);
|
|
13185
13185
|
}
|
|
13186
|
-
/** Sends a group of mutations to the Firestore backend to apply. */
|
|
13186
|
+
/** Sends a group of mutations to the Firestore backend to apply. */ Xo(t) {
|
|
13187
13187
|
const e = {
|
|
13188
13188
|
streamToken: this.lastStreamToken,
|
|
13189
13189
|
writes: t.map((t => Ks(this.It, t)))
|
|
13190
13190
|
};
|
|
13191
|
-
this.
|
|
13191
|
+
this.Bo(e);
|
|
13192
13192
|
}
|
|
13193
13193
|
}
|
|
13194
13194
|
|
|
@@ -13219,26 +13219,26 @@ class eu {
|
|
|
13219
13219
|
*/
|
|
13220
13220
|
class iu extends class {} {
|
|
13221
13221
|
constructor(t, e, n, s) {
|
|
13222
|
-
super(), this.authCredentials = t, this.appCheckCredentials = e, this.
|
|
13223
|
-
this.
|
|
13222
|
+
super(), this.authCredentials = t, this.appCheckCredentials = e, this.connection = n,
|
|
13223
|
+
this.It = s, this.nu = !1;
|
|
13224
13224
|
}
|
|
13225
|
-
|
|
13226
|
-
if (this.
|
|
13225
|
+
su() {
|
|
13226
|
+
if (this.nu) throw new L(B.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
13227
13227
|
}
|
|
13228
13228
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ ao(t, e, n) {
|
|
13229
|
-
return this.
|
|
13229
|
+
return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.connection.ao(t, e, n, s, i))).catch((t => {
|
|
13230
13230
|
throw "FirebaseError" === t.name ? (t.code === B.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
13231
13231
|
this.appCheckCredentials.invalidateToken()), t) : new L(B.UNKNOWN, t.toString());
|
|
13232
13232
|
}));
|
|
13233
13233
|
}
|
|
13234
13234
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ _o(t, e, n, s) {
|
|
13235
|
-
return this.
|
|
13235
|
+
return this.su(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([i, r]) => this.connection._o(t, e, n, i, r, s))).catch((t => {
|
|
13236
13236
|
throw "FirebaseError" === t.name ? (t.code === B.UNAUTHENTICATED && (this.authCredentials.invalidateToken(),
|
|
13237
13237
|
this.appCheckCredentials.invalidateToken()), t) : new L(B.UNKNOWN, t.toString());
|
|
13238
13238
|
}));
|
|
13239
13239
|
}
|
|
13240
13240
|
terminate() {
|
|
13241
|
-
this.
|
|
13241
|
+
this.nu = !0;
|
|
13242
13242
|
}
|
|
13243
13243
|
}
|
|
13244
13244
|
|
|
@@ -13258,7 +13258,7 @@ async function ru(t, e) {
|
|
|
13258
13258
|
parent: n.parent
|
|
13259
13259
|
};
|
|
13260
13260
|
}(n.It, cn(e)), i = s.parent;
|
|
13261
|
-
n.
|
|
13261
|
+
n.connection.co || delete s.parent;
|
|
13262
13262
|
return (await n._o("RunAggregationQuery", i, s, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
|
|
13263
13263
|
}
|
|
13264
13264
|
|
|
@@ -13283,19 +13283,19 @@ class ou {
|
|
|
13283
13283
|
* maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
|
|
13284
13284
|
* Offline.
|
|
13285
13285
|
*/
|
|
13286
|
-
this.
|
|
13286
|
+
this.iu = 0,
|
|
13287
13287
|
/**
|
|
13288
13288
|
* A timer that elapses after ONLINE_STATE_TIMEOUT_MS, at which point we
|
|
13289
13289
|
* transition from OnlineState.Unknown to OnlineState.Offline without waiting
|
|
13290
13290
|
* for the stream to actually fail (MAX_WATCH_STREAM_FAILURES times).
|
|
13291
13291
|
*/
|
|
13292
|
-
this.
|
|
13292
|
+
this.ru = null,
|
|
13293
13293
|
/**
|
|
13294
13294
|
* Whether the client should log a warning message if it fails to connect to
|
|
13295
13295
|
* the backend (initially true, cleared after a successful stream, or if we've
|
|
13296
13296
|
* logged the message already).
|
|
13297
13297
|
*/
|
|
13298
|
-
this.
|
|
13298
|
+
this.ou = !0;
|
|
13299
13299
|
}
|
|
13300
13300
|
/**
|
|
13301
13301
|
* Called by RemoteStore when a watch stream is started (including on each
|
|
@@ -13303,9 +13303,9 @@ class ou {
|
|
|
13303
13303
|
*
|
|
13304
13304
|
* If this is the first attempt, it sets the OnlineState to Unknown and starts
|
|
13305
13305
|
* the onlineStateTimer.
|
|
13306
|
-
*/
|
|
13307
|
-
0 === this.
|
|
13308
|
-
this.
|
|
13306
|
+
*/ uu() {
|
|
13307
|
+
0 === this.iu && (this.cu("Unknown" /* Unknown */), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (() => (this.ru = null,
|
|
13308
|
+
this.au("Backend didn't respond within 10 seconds."), this.cu("Offline" /* Offline */),
|
|
13309
13309
|
Promise.resolve()))));
|
|
13310
13310
|
}
|
|
13311
13311
|
/**
|
|
@@ -13313,10 +13313,10 @@ class ou {
|
|
|
13313
13313
|
* failure. The first failure moves us to the 'Unknown' state. We then may
|
|
13314
13314
|
* allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
|
|
13315
13315
|
* actually transition to the 'Offline' state.
|
|
13316
|
-
*/
|
|
13317
|
-
"Online" /* Online */ === this.state ? this.
|
|
13318
|
-
this.
|
|
13319
|
-
this.
|
|
13316
|
+
*/ hu(t) {
|
|
13317
|
+
"Online" /* Online */ === this.state ? this.cu("Unknown" /* Unknown */) : (this.iu++,
|
|
13318
|
+
this.iu >= 1 && (this.lu(), this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),
|
|
13319
|
+
this.cu("Offline" /* Offline */)));
|
|
13320
13320
|
}
|
|
13321
13321
|
/**
|
|
13322
13322
|
* Explicitly sets the OnlineState to the specified state.
|
|
@@ -13325,20 +13325,20 @@ class ou {
|
|
|
13325
13325
|
* Offline heuristics, so must not be used in place of
|
|
13326
13326
|
* handleWatchStreamStart() and handleWatchStreamFailure().
|
|
13327
13327
|
*/ set(t) {
|
|
13328
|
-
this.
|
|
13328
|
+
this.lu(), this.iu = 0, "Online" /* Online */ === t && (
|
|
13329
13329
|
// We've connected to watch at least once. Don't warn the developer
|
|
13330
13330
|
// about being offline going forward.
|
|
13331
|
-
this.
|
|
13331
|
+
this.ou = !1), this.cu(t);
|
|
13332
13332
|
}
|
|
13333
|
-
|
|
13333
|
+
cu(t) {
|
|
13334
13334
|
t !== this.state && (this.state = t, this.onlineStateHandler(t));
|
|
13335
13335
|
}
|
|
13336
|
-
|
|
13336
|
+
au(t) {
|
|
13337
13337
|
const e = `Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;
|
|
13338
|
-
this.
|
|
13338
|
+
this.ou ? (x(e), this.ou = !1) : C("OnlineStateTracker", e);
|
|
13339
13339
|
}
|
|
13340
|
-
|
|
13341
|
-
null !== this.
|
|
13340
|
+
lu() {
|
|
13341
|
+
null !== this.ru && (this.ru.cancel(), this.ru = null);
|
|
13342
13342
|
}
|
|
13343
13343
|
}
|
|
13344
13344
|
|
|
@@ -13383,7 +13383,7 @@ class ou {
|
|
|
13383
13383
|
* purely based on order, and so we can just shift() writes from the front of
|
|
13384
13384
|
* the writePipeline as we receive responses.
|
|
13385
13385
|
*/
|
|
13386
|
-
this.
|
|
13386
|
+
this.fu = [],
|
|
13387
13387
|
/**
|
|
13388
13388
|
* A mapping of watched targets that the client cares about tracking and the
|
|
13389
13389
|
* user has explicitly called a 'listen' for this target.
|
|
@@ -13393,12 +13393,12 @@ class ou {
|
|
|
13393
13393
|
* to the server. The targets removed with unlistens are removed eagerly
|
|
13394
13394
|
* without waiting for confirmation from the listen stream.
|
|
13395
13395
|
*/
|
|
13396
|
-
this.
|
|
13396
|
+
this.du = new Map,
|
|
13397
13397
|
/**
|
|
13398
13398
|
* A set of reasons for why the RemoteStore may be offline. If empty, the
|
|
13399
13399
|
* RemoteStore may start its network connections.
|
|
13400
13400
|
*/
|
|
13401
|
-
this.
|
|
13401
|
+
this._u = new Set,
|
|
13402
13402
|
/**
|
|
13403
13403
|
* Event handlers that get called when the network is disabled or enabled.
|
|
13404
13404
|
*
|
|
@@ -13406,7 +13406,7 @@ class ou {
|
|
|
13406
13406
|
* underlying streams (to support tree-shakeable streams). On Android and iOS,
|
|
13407
13407
|
* the streams are created during construction of RemoteStore.
|
|
13408
13408
|
*/
|
|
13409
|
-
this.
|
|
13409
|
+
this.wu = [], this.mu = i, this.mu.qr((t => {
|
|
13410
13410
|
n.enqueueAndForget((async () => {
|
|
13411
13411
|
// Porting Note: Unlike iOS, `restartNetwork()` is called even when the
|
|
13412
13412
|
// network becomes unreachable as we don't have any other way to tear
|
|
@@ -13414,23 +13414,23 @@ class ou {
|
|
|
13414
13414
|
mu(this) && (C("RemoteStore", "Restarting streams for network reachability change."),
|
|
13415
13415
|
await async function(t) {
|
|
13416
13416
|
const e = $(t);
|
|
13417
|
-
e.
|
|
13418
|
-
e.
|
|
13417
|
+
e._u.add(4 /* ConnectivityChange */), await au(e), e.gu.set("Unknown" /* Unknown */),
|
|
13418
|
+
e._u.delete(4 /* ConnectivityChange */), await cu(e);
|
|
13419
13419
|
}(this));
|
|
13420
13420
|
}));
|
|
13421
|
-
})), this.
|
|
13421
|
+
})), this.gu = new ou(n, s);
|
|
13422
13422
|
}
|
|
13423
13423
|
}
|
|
13424
13424
|
|
|
13425
13425
|
async function cu(t) {
|
|
13426
|
-
if (mu(t)) for (const e of t.
|
|
13426
|
+
if (mu(t)) for (const e of t.wu) await e(/* enabled= */ !0);
|
|
13427
13427
|
}
|
|
13428
13428
|
|
|
13429
13429
|
/**
|
|
13430
13430
|
* Temporarily disables the network. The network can be re-enabled using
|
|
13431
13431
|
* enableNetwork().
|
|
13432
13432
|
*/ async function au(t) {
|
|
13433
|
-
for (const e of t.
|
|
13433
|
+
for (const e of t.wu) await e(/* enabled= */ !1);
|
|
13434
13434
|
}
|
|
13435
13435
|
|
|
13436
13436
|
/**
|
|
@@ -13439,11 +13439,11 @@ async function cu(t) {
|
|
|
13439
13439
|
*/
|
|
13440
13440
|
function hu(t, e) {
|
|
13441
13441
|
const n = $(t);
|
|
13442
|
-
n.
|
|
13442
|
+
n.du.has(e.targetId) || (
|
|
13443
13443
|
// Mark this as something the client is currently listening for.
|
|
13444
|
-
n.
|
|
13444
|
+
n.du.set(e.targetId, e), wu(n) ?
|
|
13445
13445
|
// The listen will be sent in onWatchStreamOpen
|
|
13446
|
-
_u(n) : ku(n).
|
|
13446
|
+
_u(n) : ku(n).ko() && fu(n, e));
|
|
13447
13447
|
}
|
|
13448
13448
|
|
|
13449
13449
|
/**
|
|
@@ -13451,18 +13451,18 @@ function hu(t, e) {
|
|
|
13451
13451
|
* not being listened to.
|
|
13452
13452
|
*/ function lu(t, e) {
|
|
13453
13453
|
const n = $(t), s = ku(n);
|
|
13454
|
-
n.
|
|
13454
|
+
n.du.delete(e), s.ko() && du(n, e), 0 === n.du.size && (s.ko() ? s.Fo() : mu(n) &&
|
|
13455
13455
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
13456
13456
|
// have no listeners, since without any listens to send we cannot
|
|
13457
13457
|
// confirm if the stream is healthy and upgrade to OnlineState.Online.
|
|
13458
|
-
n.
|
|
13458
|
+
n.gu.set("Unknown" /* Unknown */));
|
|
13459
13459
|
}
|
|
13460
13460
|
|
|
13461
13461
|
/**
|
|
13462
13462
|
* We need to increment the the expected number of pending responses we're due
|
|
13463
13463
|
* from watch so we wait for the ack to process any messages from this target.
|
|
13464
13464
|
*/ function fu(t, e) {
|
|
13465
|
-
t.
|
|
13465
|
+
t.yu.Mt(e.targetId), ku(t).zo(e);
|
|
13466
13466
|
}
|
|
13467
13467
|
|
|
13468
13468
|
/**
|
|
@@ -13470,33 +13470,33 @@ function hu(t, e) {
|
|
|
13470
13470
|
* from watch so we wait for the removal on the server before we process any
|
|
13471
13471
|
* messages from this target.
|
|
13472
13472
|
*/ function du(t, e) {
|
|
13473
|
-
t.
|
|
13473
|
+
t.yu.Mt(e), ku(t).Ho(e);
|
|
13474
13474
|
}
|
|
13475
13475
|
|
|
13476
13476
|
function _u(t) {
|
|
13477
|
-
t.
|
|
13477
|
+
t.yu = new Ts({
|
|
13478
13478
|
getRemoteKeysForTarget: e => t.remoteSyncer.getRemoteKeysForTarget(e),
|
|
13479
|
-
se: e => t.
|
|
13480
|
-
}), ku(t).start(), t.
|
|
13479
|
+
se: e => t.du.get(e) || null
|
|
13480
|
+
}), ku(t).start(), t.gu.uu();
|
|
13481
13481
|
}
|
|
13482
13482
|
|
|
13483
13483
|
/**
|
|
13484
13484
|
* Returns whether the watch stream should be started because it's necessary
|
|
13485
13485
|
* and has not yet been started.
|
|
13486
13486
|
*/ function wu(t) {
|
|
13487
|
-
return mu(t) && !ku(t).
|
|
13487
|
+
return mu(t) && !ku(t).No() && t.du.size > 0;
|
|
13488
13488
|
}
|
|
13489
13489
|
|
|
13490
13490
|
function mu(t) {
|
|
13491
|
-
return 0 === $(t).
|
|
13491
|
+
return 0 === $(t)._u.size;
|
|
13492
13492
|
}
|
|
13493
13493
|
|
|
13494
13494
|
function gu(t) {
|
|
13495
|
-
t.
|
|
13495
|
+
t.yu = void 0;
|
|
13496
13496
|
}
|
|
13497
13497
|
|
|
13498
13498
|
async function yu(t) {
|
|
13499
|
-
t.
|
|
13499
|
+
t.du.forEach(((e, n) => {
|
|
13500
13500
|
fu(t, e);
|
|
13501
13501
|
}));
|
|
13502
13502
|
}
|
|
@@ -13504,17 +13504,17 @@ async function yu(t) {
|
|
|
13504
13504
|
async function pu(t, e) {
|
|
13505
13505
|
gu(t),
|
|
13506
13506
|
// If we still need the watch stream, retry the connection.
|
|
13507
|
-
wu(t) ? (t.
|
|
13507
|
+
wu(t) ? (t.gu.hu(e), _u(t)) :
|
|
13508
13508
|
// No need to restart watch stream because there are no active targets.
|
|
13509
13509
|
// The online state is set to unknown because there is no active attempt
|
|
13510
13510
|
// at establishing a connection
|
|
13511
|
-
t.
|
|
13511
|
+
t.gu.set("Unknown" /* Unknown */);
|
|
13512
13512
|
}
|
|
13513
13513
|
|
|
13514
13514
|
async function Iu(t, e, n) {
|
|
13515
13515
|
if (
|
|
13516
13516
|
// Mark the client as online since we got a message from the server
|
|
13517
|
-
t.
|
|
13517
|
+
t.gu.set("Online" /* Online */), e instanceof ps && 2 /* Removed */ === e.state && e.cause)
|
|
13518
13518
|
// There was an error on a target, don't wait for a consistent snapshot
|
|
13519
13519
|
// to raise events
|
|
13520
13520
|
try {
|
|
@@ -13524,7 +13524,7 @@ async function Iu(t, e, n) {
|
|
|
13524
13524
|
const n = e.cause;
|
|
13525
13525
|
for (const s of e.targetIds)
|
|
13526
13526
|
// A watched target might have been removed already.
|
|
13527
|
-
t.
|
|
13527
|
+
t.du.has(s) && (await t.remoteSyncer.rejectListen(s, n), t.du.delete(s), t.yu.removeTarget(s));
|
|
13528
13528
|
}
|
|
13529
13529
|
/**
|
|
13530
13530
|
* Attempts to fill our write pipeline with writes from the LocalStore.
|
|
@@ -13537,7 +13537,7 @@ async function Iu(t, e, n) {
|
|
|
13537
13537
|
} catch (n) {
|
|
13538
13538
|
C("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n),
|
|
13539
13539
|
await Tu(t, n);
|
|
13540
|
-
} else if (e instanceof gs ? t.
|
|
13540
|
+
} else if (e instanceof gs ? t.yu.Gt(e) : e instanceof ys ? t.yu.Yt(e) : t.yu.Wt(e),
|
|
13541
13541
|
!n.isEqual(st.min())) try {
|
|
13542
13542
|
const e = await Ro(t.localStore);
|
|
13543
13543
|
n.compareTo(e) >= 0 &&
|
|
@@ -13550,26 +13550,26 @@ async function Iu(t, e, n) {
|
|
|
13550
13550
|
* SyncEngine.
|
|
13551
13551
|
*/
|
|
13552
13552
|
function(t, e) {
|
|
13553
|
-
const n = t.
|
|
13553
|
+
const n = t.yu.te(e);
|
|
13554
13554
|
// Update in-memory resume tokens. LocalStore will update the
|
|
13555
13555
|
// persistent view of these when applying the completed RemoteEvent.
|
|
13556
13556
|
return n.targetChanges.forEach(((n, s) => {
|
|
13557
13557
|
if (n.resumeToken.approximateByteSize() > 0) {
|
|
13558
|
-
const i = t.
|
|
13558
|
+
const i = t.du.get(s);
|
|
13559
13559
|
// A watched target might have been removed already.
|
|
13560
|
-
i && t.
|
|
13560
|
+
i && t.du.set(s, i.withResumeToken(n.resumeToken, e));
|
|
13561
13561
|
}
|
|
13562
13562
|
})),
|
|
13563
13563
|
// Re-establish listens for the targets that have been invalidated by
|
|
13564
13564
|
// existence filter mismatches.
|
|
13565
13565
|
n.targetMismatches.forEach((e => {
|
|
13566
|
-
const n = t.
|
|
13566
|
+
const n = t.du.get(e);
|
|
13567
13567
|
if (!n)
|
|
13568
13568
|
// A watched target might have been removed already.
|
|
13569
13569
|
return;
|
|
13570
13570
|
// Clear the resume token for the target, since we're in a known mismatch
|
|
13571
13571
|
// state.
|
|
13572
|
-
t.
|
|
13572
|
+
t.du.set(e, n.withResumeToken(Wt.EMPTY_BYTE_STRING, n.snapshotVersion)),
|
|
13573
13573
|
// Cause a hard reset by unwatching and rewatching immediately, but
|
|
13574
13574
|
// deliberately don't send a resume token so that we get a full update.
|
|
13575
13575
|
du(t, e);
|
|
@@ -13596,16 +13596,16 @@ async function Iu(t, e, n) {
|
|
|
13596
13596
|
* any retry attempt.
|
|
13597
13597
|
*/ async function Tu(t, e, n) {
|
|
13598
13598
|
if (!Vt(e)) throw e;
|
|
13599
|
-
t.
|
|
13599
|
+
t._u.add(1 /* IndexedDbFailed */),
|
|
13600
13600
|
// Disable network and raise offline snapshots
|
|
13601
|
-
await au(t), t.
|
|
13601
|
+
await au(t), t.gu.set("Offline" /* Offline */), n || (
|
|
13602
13602
|
// Use a simple read operation to determine if IndexedDB recovered.
|
|
13603
13603
|
// Ideally, we would expose a health check directly on SimpleDb, but
|
|
13604
13604
|
// RemoteStore only has access to persistence through LocalStore.
|
|
13605
13605
|
n = () => Ro(t.localStore)),
|
|
13606
13606
|
// Probe IndexedDB periodically and re-enable network
|
|
13607
13607
|
t.asyncQueue.enqueueRetryable((async () => {
|
|
13608
|
-
C("RemoteStore", "Retrying IndexedDB access"), await n(), t.
|
|
13608
|
+
C("RemoteStore", "Retrying IndexedDB access"), await n(), t._u.delete(1 /* IndexedDbFailed */),
|
|
13609
13609
|
await cu(t);
|
|
13610
13610
|
}));
|
|
13611
13611
|
}
|
|
@@ -13619,11 +13619,11 @@ async function Iu(t, e, n) {
|
|
|
13619
13619
|
|
|
13620
13620
|
async function Au(t) {
|
|
13621
13621
|
const e = $(t), n = Ou(e);
|
|
13622
|
-
let s = e.
|
|
13622
|
+
let s = e.fu.length > 0 ? e.fu[e.fu.length - 1].batchId : -1;
|
|
13623
13623
|
for (;Ru(e); ) try {
|
|
13624
13624
|
const t = await vo(e.localStore, s);
|
|
13625
13625
|
if (null === t) {
|
|
13626
|
-
0 === e.
|
|
13626
|
+
0 === e.fu.length && n.Fo();
|
|
13627
13627
|
break;
|
|
13628
13628
|
}
|
|
13629
13629
|
s = t.batchId, bu(e, t);
|
|
@@ -13637,20 +13637,20 @@ async function Au(t) {
|
|
|
13637
13637
|
* Returns true if we can add to the write pipeline (i.e. the network is
|
|
13638
13638
|
* enabled and the write pipeline is not full).
|
|
13639
13639
|
*/ function Ru(t) {
|
|
13640
|
-
return mu(t) && t.
|
|
13640
|
+
return mu(t) && t.fu.length < 10;
|
|
13641
13641
|
}
|
|
13642
13642
|
|
|
13643
13643
|
/**
|
|
13644
13644
|
* Queues additional writes to be sent to the write stream, sending them
|
|
13645
13645
|
* immediately if the write stream is established.
|
|
13646
13646
|
*/ function bu(t, e) {
|
|
13647
|
-
t.
|
|
13647
|
+
t.fu.push(e);
|
|
13648
13648
|
const n = Ou(t);
|
|
13649
|
-
n.
|
|
13649
|
+
n.ko() && n.Yo && n.Xo(e.mutations);
|
|
13650
13650
|
}
|
|
13651
13651
|
|
|
13652
13652
|
function Pu(t) {
|
|
13653
|
-
return mu(t) && !Ou(t).
|
|
13653
|
+
return mu(t) && !Ou(t).No() && t.fu.length > 0;
|
|
13654
13654
|
}
|
|
13655
13655
|
|
|
13656
13656
|
function vu(t) {
|
|
@@ -13658,17 +13658,17 @@ function vu(t) {
|
|
|
13658
13658
|
}
|
|
13659
13659
|
|
|
13660
13660
|
async function Vu(t) {
|
|
13661
|
-
Ou(t).
|
|
13661
|
+
Ou(t).eu();
|
|
13662
13662
|
}
|
|
13663
13663
|
|
|
13664
13664
|
async function Su(t) {
|
|
13665
13665
|
const e = Ou(t);
|
|
13666
13666
|
// Send the write pipeline now that the stream is established.
|
|
13667
|
-
for (const n of t.
|
|
13667
|
+
for (const n of t.fu) e.Xo(n.mutations);
|
|
13668
13668
|
}
|
|
13669
13669
|
|
|
13670
13670
|
async function Du(t, e, n) {
|
|
13671
|
-
const s = t.
|
|
13671
|
+
const s = t.fu.shift(), i = Oi.from(s, e, n);
|
|
13672
13672
|
await Eu(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
|
|
13673
13673
|
// It's possible that with the completion of this mutation another
|
|
13674
13674
|
// slot has freed up.
|
|
@@ -13678,7 +13678,7 @@ async function Du(t, e, n) {
|
|
|
13678
13678
|
async function Cu(t, e) {
|
|
13679
13679
|
// If the write stream closed after the write handshake completes, a write
|
|
13680
13680
|
// operation failed and we fail the pending operation.
|
|
13681
|
-
e && Ou(t).
|
|
13681
|
+
e && Ou(t).Yo &&
|
|
13682
13682
|
// This error affects the actual write.
|
|
13683
13683
|
await async function(t, e) {
|
|
13684
13684
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
@@ -13686,11 +13686,11 @@ async function Cu(t, e) {
|
|
|
13686
13686
|
if (n = e.code, Zn(n) && n !== B.ABORTED) {
|
|
13687
13687
|
// This was a permanent error, the request itself was the problem
|
|
13688
13688
|
// so it's not going to succeed if we resend it.
|
|
13689
|
-
const n = t.
|
|
13689
|
+
const n = t.fu.shift();
|
|
13690
13690
|
// In this case it's also unlikely that the server itself is melting
|
|
13691
13691
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
13692
13692
|
// restart.
|
|
13693
|
-
Ou(t).
|
|
13693
|
+
Ou(t).Mo(), await Eu(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
|
|
13694
13694
|
// It's possible that with the completion of this mutation
|
|
13695
13695
|
// another slot has freed up.
|
|
13696
13696
|
await Au(t);
|
|
@@ -13709,18 +13709,18 @@ async function xu(t, e) {
|
|
|
13709
13709
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
13710
13710
|
// fresh auth token for the new user and re-fill the write pipeline with
|
|
13711
13711
|
// new mutations from the LocalStore (since mutations are per-user).
|
|
13712
|
-
n.
|
|
13712
|
+
n._u.add(3 /* CredentialChange */), await au(n), s &&
|
|
13713
13713
|
// Don't set the network status to Unknown if we are offline.
|
|
13714
|
-
n.
|
|
13715
|
-
n.
|
|
13714
|
+
n.gu.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
13715
|
+
n._u.delete(3 /* CredentialChange */), await cu(n);
|
|
13716
13716
|
}
|
|
13717
13717
|
|
|
13718
13718
|
/**
|
|
13719
13719
|
* Toggles the network state when the client gains or loses its primary lease.
|
|
13720
13720
|
*/ async function Nu(t, e) {
|
|
13721
13721
|
const n = $(t);
|
|
13722
|
-
e ? (n.
|
|
13723
|
-
await au(n), n.
|
|
13722
|
+
e ? (n._u.delete(2 /* IsSecondary */), await cu(n)) : e || (n._u.add(2 /* IsSecondary */),
|
|
13723
|
+
await au(n), n.gu.set("Unknown" /* Unknown */));
|
|
13724
13724
|
}
|
|
13725
13725
|
|
|
13726
13726
|
/**
|
|
@@ -13731,11 +13731,11 @@ async function xu(t, e) {
|
|
|
13731
13731
|
* PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
|
|
13732
13732
|
* This is not done on Web to allow it to be tree-shaken.
|
|
13733
13733
|
*/ function ku(t) {
|
|
13734
|
-
return t.
|
|
13734
|
+
return t.pu || (
|
|
13735
13735
|
// Create stream (but note that it is not started yet).
|
|
13736
|
-
t.
|
|
13736
|
+
t.pu = function(t, e, n) {
|
|
13737
13737
|
const s = $(t);
|
|
13738
|
-
return s.
|
|
13738
|
+
return s.su(), new nu(e, s.connection, s.authCredentials, s.appCheckCredentials, s.It, n);
|
|
13739
13739
|
}
|
|
13740
13740
|
/**
|
|
13741
13741
|
* @license
|
|
@@ -13755,11 +13755,11 @@ async function xu(t, e) {
|
|
|
13755
13755
|
*/ (t.datastore, t.asyncQueue, {
|
|
13756
13756
|
Yr: yu.bind(null, t),
|
|
13757
13757
|
Zr: pu.bind(null, t),
|
|
13758
|
-
|
|
13759
|
-
}), t.
|
|
13760
|
-
e ? (t.
|
|
13758
|
+
Wo: Iu.bind(null, t)
|
|
13759
|
+
}), t.wu.push((async e => {
|
|
13760
|
+
e ? (t.pu.Mo(), wu(t) ? _u(t) : t.gu.set("Unknown" /* Unknown */)) : (await t.pu.stop(),
|
|
13761
13761
|
gu(t));
|
|
13762
|
-
}))), t.
|
|
13762
|
+
}))), t.pu;
|
|
13763
13763
|
}
|
|
13764
13764
|
|
|
13765
13765
|
/**
|
|
@@ -13770,22 +13770,22 @@ async function xu(t, e) {
|
|
|
13770
13770
|
* PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.
|
|
13771
13771
|
* This is not done on Web to allow it to be tree-shaken.
|
|
13772
13772
|
*/ function Ou(t) {
|
|
13773
|
-
return t.
|
|
13773
|
+
return t.Iu || (
|
|
13774
13774
|
// Create stream (but note that it is not started yet).
|
|
13775
|
-
t.
|
|
13775
|
+
t.Iu = function(t, e, n) {
|
|
13776
13776
|
const s = $(t);
|
|
13777
|
-
return s.
|
|
13777
|
+
return s.su(), new su(e, s.connection, s.authCredentials, s.appCheckCredentials, s.It, n);
|
|
13778
13778
|
}(t.datastore, t.asyncQueue, {
|
|
13779
13779
|
Yr: Vu.bind(null, t),
|
|
13780
13780
|
Zr: Cu.bind(null, t),
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
}), t.
|
|
13784
|
-
e ? (t.
|
|
13781
|
+
tu: Su.bind(null, t),
|
|
13782
|
+
Zo: Du.bind(null, t)
|
|
13783
|
+
}), t.wu.push((async e => {
|
|
13784
|
+
e ? (t.Iu.Mo(),
|
|
13785
13785
|
// This will start the write stream if necessary.
|
|
13786
|
-
await Au(t)) : (await t.
|
|
13787
|
-
t.
|
|
13788
|
-
}))), t.
|
|
13786
|
+
await Au(t)) : (await t.Iu.stop(), t.fu.length > 0 && (C("RemoteStore", `Stopping write stream with ${t.fu.length} pending writes`),
|
|
13787
|
+
t.fu = []));
|
|
13788
|
+
}))), t.Iu;
|
|
13789
13789
|
}
|
|
13790
13790
|
|
|
13791
13791
|
/**
|
|
@@ -13995,25 +13995,25 @@ class Mu {
|
|
|
13995
13995
|
* duplicate events for the same doc.
|
|
13996
13996
|
*/ class Bu {
|
|
13997
13997
|
constructor() {
|
|
13998
|
-
this.
|
|
13998
|
+
this.Tu = new Bt(ct.comparator);
|
|
13999
13999
|
}
|
|
14000
14000
|
track(t) {
|
|
14001
|
-
const e = t.doc.key, n = this.
|
|
14001
|
+
const e = t.doc.key, n = this.Tu.get(e);
|
|
14002
14002
|
n ?
|
|
14003
14003
|
// Merge the new change with the existing change.
|
|
14004
|
-
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.
|
|
14004
|
+
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Tu = this.Tu.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Tu = this.Tu.insert(e, {
|
|
14005
14005
|
type: n.type,
|
|
14006
14006
|
doc: t.doc
|
|
14007
|
-
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.
|
|
14007
|
+
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14008
14008
|
type: 2 /* Modified */ ,
|
|
14009
14009
|
doc: t.doc
|
|
14010
|
-
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.
|
|
14010
|
+
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14011
14011
|
type: 0 /* Added */ ,
|
|
14012
14012
|
doc: t.doc
|
|
14013
|
-
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.
|
|
14013
|
+
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14014
14014
|
type: 1 /* Removed */ ,
|
|
14015
14015
|
doc: n.doc
|
|
14016
|
-
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.
|
|
14016
|
+
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14017
14017
|
type: 2 /* Modified */ ,
|
|
14018
14018
|
doc: t.doc
|
|
14019
14019
|
}) :
|
|
@@ -14024,11 +14024,11 @@ class Mu {
|
|
|
14024
14024
|
// Removed->Modified
|
|
14025
14025
|
// Metadata->Added
|
|
14026
14026
|
// Removed->Metadata
|
|
14027
|
-
O() : this.
|
|
14027
|
+
O() : this.Tu = this.Tu.insert(e, t);
|
|
14028
14028
|
}
|
|
14029
|
-
|
|
14029
|
+
Eu() {
|
|
14030
14030
|
const t = [];
|
|
14031
|
-
return this.
|
|
14031
|
+
return this.Tu.inorderTraversal(((e, n) => {
|
|
14032
14032
|
t.push(n);
|
|
14033
14033
|
})), t;
|
|
14034
14034
|
}
|
|
@@ -14084,14 +14084,14 @@ class Lu {
|
|
|
14084
14084
|
* tracked by EventManager.
|
|
14085
14085
|
*/ class Uu {
|
|
14086
14086
|
constructor() {
|
|
14087
|
-
this.
|
|
14087
|
+
this.Au = void 0, this.listeners = [];
|
|
14088
14088
|
}
|
|
14089
14089
|
}
|
|
14090
14090
|
|
|
14091
14091
|
class qu {
|
|
14092
14092
|
constructor() {
|
|
14093
14093
|
this.queries = new es((t => ln(t)), hn), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14094
|
-
this.
|
|
14094
|
+
this.Ru = new Set;
|
|
14095
14095
|
}
|
|
14096
14096
|
}
|
|
14097
14097
|
|
|
@@ -14099,15 +14099,15 @@ async function Ku(t, e) {
|
|
|
14099
14099
|
const n = $(t), s = e.query;
|
|
14100
14100
|
let i = !1, r = n.queries.get(s);
|
|
14101
14101
|
if (r || (i = !0, r = new Uu), i) try {
|
|
14102
|
-
r.
|
|
14102
|
+
r.Au = await n.onListen(s);
|
|
14103
14103
|
} catch (t) {
|
|
14104
14104
|
const n = Fu(t, `Initialization of query '${fn(e.query)}' failed`);
|
|
14105
14105
|
return void e.onError(n);
|
|
14106
14106
|
}
|
|
14107
14107
|
if (n.queries.set(s, r), r.listeners.push(e),
|
|
14108
14108
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
14109
|
-
e.
|
|
14110
|
-
e.
|
|
14109
|
+
e.bu(n.onlineState), r.Au) {
|
|
14110
|
+
e.Pu(r.Au) && Wu(n);
|
|
14111
14111
|
}
|
|
14112
14112
|
}
|
|
14113
14113
|
|
|
@@ -14128,8 +14128,8 @@ function Qu(t, e) {
|
|
|
14128
14128
|
for (const t of e) {
|
|
14129
14129
|
const e = t.query, i = n.queries.get(e);
|
|
14130
14130
|
if (i) {
|
|
14131
|
-
for (const e of i.listeners) e.
|
|
14132
|
-
i.
|
|
14131
|
+
for (const e of i.listeners) e.Pu(t) && (s = !0);
|
|
14132
|
+
i.Au = t;
|
|
14133
14133
|
}
|
|
14134
14134
|
}
|
|
14135
14135
|
s && Wu(n);
|
|
@@ -14145,7 +14145,7 @@ function ju(t, e, n) {
|
|
|
14145
14145
|
|
|
14146
14146
|
// Call all global snapshot listeners that have been set.
|
|
14147
14147
|
function Wu(t) {
|
|
14148
|
-
t.
|
|
14148
|
+
t.Ru.forEach((t => {
|
|
14149
14149
|
t.next();
|
|
14150
14150
|
}));
|
|
14151
14151
|
}
|
|
@@ -14157,19 +14157,19 @@ function Wu(t) {
|
|
|
14157
14157
|
* It uses an Observer to dispatch events.
|
|
14158
14158
|
*/ class zu {
|
|
14159
14159
|
constructor(t, e, n) {
|
|
14160
|
-
this.query = t, this.
|
|
14160
|
+
this.query = t, this.vu = e,
|
|
14161
14161
|
/**
|
|
14162
14162
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
14163
14163
|
* observer. This flag is set to true once we've actually raised an event.
|
|
14164
14164
|
*/
|
|
14165
|
-
this.
|
|
14165
|
+
this.Vu = !1, this.Su = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
|
|
14166
14166
|
}
|
|
14167
14167
|
/**
|
|
14168
14168
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
14169
14169
|
* if applicable (depending on what changed, whether the user has opted into
|
|
14170
14170
|
* metadata-only changes, etc.). Returns true if a user-facing event was
|
|
14171
14171
|
* indeed raised.
|
|
14172
|
-
*/
|
|
14172
|
+
*/ Pu(t) {
|
|
14173
14173
|
if (!this.options.includeMetadataChanges) {
|
|
14174
14174
|
// Remove the metadata only changes.
|
|
14175
14175
|
const e = [];
|
|
@@ -14178,19 +14178,19 @@ function Wu(t) {
|
|
|
14178
14178
|
/* excludesMetadataChanges= */ !0, t.hasCachedResults);
|
|
14179
14179
|
}
|
|
14180
14180
|
let e = !1;
|
|
14181
|
-
return this.
|
|
14182
|
-
e = !0), this.
|
|
14181
|
+
return this.Vu ? this.Du(t) && (this.vu.next(t), e = !0) : this.Cu(t, this.onlineState) && (this.xu(t),
|
|
14182
|
+
e = !0), this.Su = t, e;
|
|
14183
14183
|
}
|
|
14184
14184
|
onError(t) {
|
|
14185
|
-
this.
|
|
14185
|
+
this.vu.error(t);
|
|
14186
14186
|
}
|
|
14187
|
-
/** Returns whether a snapshot was raised. */
|
|
14187
|
+
/** Returns whether a snapshot was raised. */ bu(t) {
|
|
14188
14188
|
this.onlineState = t;
|
|
14189
14189
|
let e = !1;
|
|
14190
|
-
return this.
|
|
14190
|
+
return this.Su && !this.Vu && this.Cu(this.Su, t) && (this.xu(this.Su), e = !0),
|
|
14191
14191
|
e;
|
|
14192
14192
|
}
|
|
14193
|
-
|
|
14193
|
+
Cu(t, e) {
|
|
14194
14194
|
// Always raise the first event when we're synced
|
|
14195
14195
|
if (!t.fromCache) return !0;
|
|
14196
14196
|
// NOTE: We consider OnlineState.Unknown as online (it should become Offline
|
|
@@ -14198,25 +14198,25 @@ function Wu(t) {
|
|
|
14198
14198
|
const n = "Offline" /* Offline */ !== e;
|
|
14199
14199
|
// Don't raise the event if we're online, aren't synced yet (checked
|
|
14200
14200
|
// above) and are waiting for a sync.
|
|
14201
|
-
return (!this.options.
|
|
14201
|
+
return (!this.options.Nu || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
|
|
14202
14202
|
// Raise data from cache if we have any documents, have cached results before,
|
|
14203
14203
|
// or we are offline.
|
|
14204
14204
|
}
|
|
14205
|
-
|
|
14205
|
+
Du(t) {
|
|
14206
14206
|
// We don't need to handle includeDocumentMetadataChanges here because
|
|
14207
14207
|
// the Metadata only changes have already been stripped out if needed.
|
|
14208
14208
|
// At this point the only changes we will see are the ones we should
|
|
14209
14209
|
// propagate.
|
|
14210
14210
|
if (t.docChanges.length > 0) return !0;
|
|
14211
|
-
const e = this.
|
|
14211
|
+
const e = this.Su && this.Su.hasPendingWrites !== t.hasPendingWrites;
|
|
14212
14212
|
return !(!t.syncStateChanged && !e) && !0 === this.options.includeMetadataChanges;
|
|
14213
14213
|
// Generally we should have hit one of the cases above, but it's possible
|
|
14214
14214
|
// to get here if there were only metadata docChanges and they got
|
|
14215
14215
|
// stripped out.
|
|
14216
14216
|
}
|
|
14217
|
-
|
|
14217
|
+
xu(t) {
|
|
14218
14218
|
t = Lu.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache, t.hasCachedResults),
|
|
14219
|
-
this.
|
|
14219
|
+
this.Vu = !0, this.vu.next(t);
|
|
14220
14220
|
}
|
|
14221
14221
|
}
|
|
14222
14222
|
|
|
@@ -14243,10 +14243,10 @@ function Wu(t) {
|
|
|
14243
14243
|
constructor(t,
|
|
14244
14244
|
// How many bytes this element takes to store in the bundle.
|
|
14245
14245
|
e) {
|
|
14246
|
-
this.
|
|
14246
|
+
this.ku = t, this.byteLength = e;
|
|
14247
14247
|
}
|
|
14248
14248
|
Ou() {
|
|
14249
|
-
return "metadata" in this.
|
|
14249
|
+
return "metadata" in this.ku;
|
|
14250
14250
|
}
|
|
14251
14251
|
}
|
|
14252
14252
|
|
|
@@ -14306,13 +14306,13 @@ function Wu(t) {
|
|
|
14306
14306
|
*/ Fu(t) {
|
|
14307
14307
|
this.progress.bytesLoaded += t.byteLength;
|
|
14308
14308
|
let e = this.progress.documentsLoaded;
|
|
14309
|
-
if (t.
|
|
14309
|
+
if (t.ku.namedQuery) this.queries.push(t.ku.namedQuery); else if (t.ku.documentMetadata) {
|
|
14310
14310
|
this.documents.push({
|
|
14311
|
-
metadata: t.
|
|
14312
|
-
}), t.
|
|
14313
|
-
const n = rt.fromString(t.
|
|
14311
|
+
metadata: t.ku.documentMetadata
|
|
14312
|
+
}), t.ku.documentMetadata.exists || ++e;
|
|
14313
|
+
const n = rt.fromString(t.ku.documentMetadata.name);
|
|
14314
14314
|
this.collectionGroups.add(n.get(n.length - 2));
|
|
14315
|
-
} else t.
|
|
14315
|
+
} else t.ku.document && (this.documents[this.documents.length - 1].document = t.ku.document,
|
|
14316
14316
|
++e);
|
|
14317
14317
|
return e !== this.progress.documentsLoaded ? (this.progress.documentsLoaded = e,
|
|
14318
14318
|
Object.assign({}, this.progress)) : null;
|
|
@@ -14505,7 +14505,7 @@ class tc {
|
|
|
14505
14505
|
const s = this.Qu;
|
|
14506
14506
|
this.Qu = t.Qu, this.mutatedKeys = t.mutatedKeys;
|
|
14507
14507
|
// Sort changes based on type and query comparator
|
|
14508
|
-
const i = t.zu.
|
|
14508
|
+
const i = t.zu.Eu();
|
|
14509
14509
|
i.sort(((t, e) => function(t, e) {
|
|
14510
14510
|
const n = t => {
|
|
14511
14511
|
switch (t) {
|
|
@@ -14560,7 +14560,7 @@ class tc {
|
|
|
14560
14560
|
/**
|
|
14561
14561
|
* Applies an OnlineState change to the view, potentially generating a
|
|
14562
14562
|
* ViewChange if the view's syncState changes as a result.
|
|
14563
|
-
*/
|
|
14563
|
+
*/ bu(t) {
|
|
14564
14564
|
return this.current && "Offline" /* Offline */ === t ? (
|
|
14565
14565
|
// If we're offline, set `current` to false and then call applyChanges()
|
|
14566
14566
|
// to refresh our syncState and generate a ViewChange as appropriate. We
|
|
@@ -14911,7 +14911,7 @@ async function rc(t, e) {
|
|
|
14911
14911
|
if (s.isPrimaryClient && 0 /* RemoteStore */ === n || !s.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14912
14912
|
const t = [];
|
|
14913
14913
|
s.ic.forEach(((n, s) => {
|
|
14914
|
-
const i = s.view.
|
|
14914
|
+
const i = s.view.bu(e);
|
|
14915
14915
|
i.snapshot && t.push(i.snapshot);
|
|
14916
14916
|
})), function(t, e) {
|
|
14917
14917
|
const n = $(t);
|
|
@@ -14920,9 +14920,9 @@ async function rc(t, e) {
|
|
|
14920
14920
|
n.queries.forEach(((t, n) => {
|
|
14921
14921
|
for (const t of n.listeners)
|
|
14922
14922
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
14923
|
-
t.
|
|
14923
|
+
t.bu(e) && (s = !0);
|
|
14924
14924
|
})), s && Wu(n);
|
|
14925
|
-
}(s.eventManager, e), t.length && s.sc.
|
|
14925
|
+
}(s.eventManager, e), t.length && s.sc.Wo(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
14926
14926
|
}
|
|
14927
14927
|
}
|
|
14928
14928
|
|
|
@@ -15118,7 +15118,7 @@ async function Ec(t, e, n) {
|
|
|
15118
15118
|
r.push(e);
|
|
15119
15119
|
}
|
|
15120
15120
|
})));
|
|
15121
|
-
})), await Promise.all(o), s.sc.
|
|
15121
|
+
})), await Promise.all(o), s.sc.Wo(i), await async function(t, e) {
|
|
15122
15122
|
const n = $(t);
|
|
15123
15123
|
try {
|
|
15124
15124
|
await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => At.forEach(e, (e => At.forEach(e.Si, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => At.forEach(e.Di, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
|
|
@@ -15293,7 +15293,7 @@ async function Sc(t, e, n) {
|
|
|
15293
15293
|
}
|
|
15294
15294
|
i.push(e);
|
|
15295
15295
|
}
|
|
15296
|
-
return s.sc.
|
|
15296
|
+
return s.sc.Wo(r), i;
|
|
15297
15297
|
}
|
|
15298
15298
|
|
|
15299
15299
|
/**
|
|
@@ -15374,7 +15374,7 @@ async function xc(t, e, n, s) {
|
|
|
15374
15374
|
function kc(t) {
|
|
15375
15375
|
const e = $(t);
|
|
15376
15376
|
return e.remoteStore.remoteSyncer.applyRemoteEvent = ac.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Rc.bind(null, e),
|
|
15377
|
-
e.remoteStore.remoteSyncer.rejectListen = lc.bind(null, e), e.sc.
|
|
15377
|
+
e.remoteStore.remoteSyncer.rejectListen = lc.bind(null, e), e.sc.Wo = Qu.bind(null, e.eventManager),
|
|
15378
15378
|
e.sc.wc = ju.bind(null, e.eventManager), e;
|
|
15379
15379
|
}
|
|
15380
15380
|
|
|
@@ -15601,11 +15601,11 @@ class Fc {
|
|
|
15601
15601
|
terminate() {
|
|
15602
15602
|
return async function(t) {
|
|
15603
15603
|
const e = $(t);
|
|
15604
|
-
C("RemoteStore", "RemoteStore shutting down."), e.
|
|
15605
|
-
e.
|
|
15604
|
+
C("RemoteStore", "RemoteStore shutting down."), e._u.add(5 /* Shutdown */), await au(e),
|
|
15605
|
+
e.mu.shutdown(),
|
|
15606
15606
|
// Set the OnlineState to Unknown (rather than Offline) to avoid potentially
|
|
15607
15607
|
// triggering spurious listener events with cached data, etc.
|
|
15608
|
-
e.
|
|
15608
|
+
e.gu.set("Unknown" /* Unknown */);
|
|
15609
15609
|
}(this.remoteStore);
|
|
15610
15610
|
}
|
|
15611
15611
|
}
|
|
@@ -16215,7 +16215,7 @@ class ua {
|
|
|
16215
16215
|
this.buffer = new Uint8Array, this.vc = new TextDecoder("utf-8"),
|
|
16216
16216
|
// Read the metadata (which is the first element).
|
|
16217
16217
|
this.Vc().then((t => {
|
|
16218
|
-
t && t.Ou() ? this.metadata.resolve(t.
|
|
16218
|
+
t && t.Ou() ? this.metadata.resolve(t.ku.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == t ? void 0 : t.ku)}`));
|
|
16219
16219
|
}), (t => this.metadata.reject(t)));
|
|
16220
16220
|
}
|
|
16221
16221
|
close() {
|
|
@@ -16545,13 +16545,13 @@ class aa {
|
|
|
16545
16545
|
*/ class da {
|
|
16546
16546
|
constructor(t, e, n, s, i) {
|
|
16547
16547
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s,
|
|
16548
|
-
this.deferred = i, this.kc = n.maxAttempts, this.
|
|
16548
|
+
this.deferred = i, this.kc = n.maxAttempts, this.xo = new tu(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
16549
16549
|
}
|
|
16550
16550
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
16551
16551
|
this.kc -= 1, this.Oc();
|
|
16552
16552
|
}
|
|
16553
16553
|
Oc() {
|
|
16554
|
-
this.
|
|
16554
|
+
this.xo.Ro((async () => {
|
|
16555
16555
|
const t = new fa(this.datastore), e = this.Mc(t);
|
|
16556
16556
|
e && e.then((e => {
|
|
16557
16557
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
@@ -16736,7 +16736,7 @@ async function Ra(t) {
|
|
|
16736
16736
|
const e = await pa(t), n = await Ta(t);
|
|
16737
16737
|
return e.setNetworkEnabled(!0), function(t) {
|
|
16738
16738
|
const e = $(t);
|
|
16739
|
-
return e.
|
|
16739
|
+
return e._u.delete(0 /* UserDisabled */), cu(e);
|
|
16740
16740
|
}(n);
|
|
16741
16741
|
}));
|
|
16742
16742
|
}
|
|
@@ -16746,9 +16746,9 @@ async function Ra(t) {
|
|
|
16746
16746
|
const e = await pa(t), n = await Ta(t);
|
|
16747
16747
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
16748
16748
|
const e = $(t);
|
|
16749
|
-
e.
|
|
16749
|
+
e._u.add(0 /* UserDisabled */), await au(e),
|
|
16750
16750
|
// Set the OnlineState to Offline so get()s return from cache, etc.
|
|
16751
|
-
e.
|
|
16751
|
+
e.gu.set("Offline" /* Offline */);
|
|
16752
16752
|
}(n);
|
|
16753
16753
|
}));
|
|
16754
16754
|
}
|
|
@@ -16799,7 +16799,7 @@ function Va(t, e, n = {}) {
|
|
|
16799
16799
|
error: t => i.reject(t)
|
|
16800
16800
|
}), o = new zu(en(n.path), r, {
|
|
16801
16801
|
includeMetadataChanges: !0,
|
|
16802
|
-
|
|
16802
|
+
Nu: !0
|
|
16803
16803
|
});
|
|
16804
16804
|
return Ku(t, o);
|
|
16805
16805
|
}(await Ra(t), t.asyncQueue, e, n, s))), s.promise;
|
|
@@ -16836,7 +16836,7 @@ function Da(t, e, n = {}) {
|
|
|
16836
16836
|
error: t => i.reject(t)
|
|
16837
16837
|
}), o = new zu(n, r, {
|
|
16838
16838
|
includeMetadataChanges: !0,
|
|
16839
|
-
|
|
16839
|
+
Nu: !0
|
|
16840
16840
|
});
|
|
16841
16841
|
return Ku(t, o);
|
|
16842
16842
|
}(await Ra(t), t.asyncQueue, e, n, s))), s.promise;
|
|
@@ -16845,13 +16845,13 @@ function Da(t, e, n = {}) {
|
|
|
16845
16845
|
function Ca(t, e) {
|
|
16846
16846
|
const n = new ua(e);
|
|
16847
16847
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16848
|
-
$(t).
|
|
16848
|
+
$(t).Ru.add(e),
|
|
16849
16849
|
// Immediately fire an initial event, indicating all existing listeners
|
|
16850
16850
|
// are in-sync.
|
|
16851
16851
|
e.next();
|
|
16852
16852
|
}(await Ra(t), n))), () => {
|
|
16853
16853
|
n.bc(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
16854
|
-
$(t).
|
|
16854
|
+
$(t).Ru.delete(e);
|
|
16855
16855
|
}(await Ra(t), n)));
|
|
16856
16856
|
};
|
|
16857
16857
|
}
|
|
@@ -16934,13 +16934,13 @@ class ka {
|
|
|
16934
16934
|
// List of TimerIds to fast-forward delays for.
|
|
16935
16935
|
this.jc = [],
|
|
16936
16936
|
// Backoff timer used to schedule retries for retryable operations
|
|
16937
|
-
this.
|
|
16937
|
+
this.xo = new tu(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
16938
16938
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
16939
16939
|
// operations. Meant to speed up recovery when we regain file system access
|
|
16940
16940
|
// after page comes into foreground.
|
|
16941
16941
|
this.Wc = () => {
|
|
16942
16942
|
const t = Xo();
|
|
16943
|
-
t && C("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.
|
|
16943
|
+
t && C("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.xo.Po();
|
|
16944
16944
|
};
|
|
16945
16945
|
const t = Xo();
|
|
16946
16946
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Wc);
|
|
@@ -16987,7 +16987,7 @@ class ka {
|
|
|
16987
16987
|
*/ async Jc() {
|
|
16988
16988
|
if (0 !== this.Lc.length) {
|
|
16989
16989
|
try {
|
|
16990
|
-
await this.Lc[0](), this.Lc.shift(), this.
|
|
16990
|
+
await this.Lc[0](), this.Lc.shift(), this.xo.reset();
|
|
16991
16991
|
} catch (t) {
|
|
16992
16992
|
if (!Vt(t)) throw t;
|
|
16993
16993
|
// Failure will be handled by AsyncQueue
|
|
@@ -17004,7 +17004,7 @@ class ka {
|
|
|
17004
17004
|
// Since `backoffAndRun()` cancels an existing backoff and schedules a
|
|
17005
17005
|
// new backoff on every call, there is only ever a single additional
|
|
17006
17006
|
// operation in the queue.
|
|
17007
|
-
this.
|
|
17007
|
+
this.xo.Ro((() => this.Jc()));
|
|
17008
17008
|
}
|
|
17009
17009
|
}
|
|
17010
17010
|
Hc(t) {
|
|
@@ -19117,12 +19117,15 @@ class nl extends tl {
|
|
|
19117
19117
|
function(t, e) {
|
|
19118
19118
|
if (t._snapshot.oldDocs.isEmpty()) {
|
|
19119
19119
|
let e = 0;
|
|
19120
|
-
return t._snapshot.docChanges.map((n =>
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19120
|
+
return t._snapshot.docChanges.map((n => {
|
|
19121
|
+
const s = new rl(t._firestore, t._userDataWriter, n.doc.key, n.doc, new sl(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
19122
|
+
return n.doc, {
|
|
19123
|
+
type: "added",
|
|
19124
|
+
doc: s,
|
|
19125
|
+
oldIndex: -1,
|
|
19126
|
+
newIndex: e++
|
|
19127
|
+
};
|
|
19128
|
+
}));
|
|
19126
19129
|
}
|
|
19127
19130
|
{
|
|
19128
19131
|
// A `DocumentSet` that is updated incrementally as changes are applied to use
|
|
@@ -19953,9 +19956,9 @@ function $l(t, e) {
|
|
|
19953
19956
|
return s = Object.assign({
|
|
19954
19957
|
useFetchStreams: e
|
|
19955
19958
|
}, s), r._setSettings(s), r;
|
|
19956
|
-
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.7.
|
|
19959
|
+
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.7.2", t),
|
|
19957
19960
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19958
|
-
registerVersion(b, "3.7.
|
|
19961
|
+
registerVersion(b, "3.7.2", "esm2017");
|
|
19959
19962
|
}();
|
|
19960
19963
|
|
|
19961
19964
|
export { tl as AbstractUserDataWriter, aa as AggregateField, ha as AggregateQuerySnapshot, th as Bytes, Fa as CACHE_SIZE_UNLIMITED, ta as CollectionReference, Xc as DocumentReference, il as DocumentSnapshot, eh as FieldPath, sh as FieldValue, $a as Firestore, L as FirestoreError, ih as GeoPoint, Ma as LoadBundleTask, Zc as Query, Oh as QueryConstraint, rl as QueryDocumentSnapshot, ol as QuerySnapshot, sl as SnapshotMetadata, nt as Timestamp, Sl as Transaction, vl as WriteBatch, ne as _DatabaseId, ct as _DocumentKey, J as _EmptyAppCheckTokenProvider, K as _EmptyAuthCredentialsProvider, ut as _FieldPath, jc as _cast, F as _debugAssert, jt as _isBase64Available, N as _logWarn, qc as _validateIsNotUsedTogether, pl as addDoc, Rl as aggregateQuerySnapshotEqual, kl as arrayRemove, Nl as arrayUnion, ja as clearIndexedDbPersistence, ea as collection, na as collectionGroup, Yc as connectFirestoreEmulator, yl as deleteDoc, Cl as deleteField, Ha as disableNetwork, sa as doc, nh as documentId, Ka as enableIndexedDbPersistence, Ga as enableMultiTabIndexedDbPersistence, za as enableNetwork, Hh as endAt, zh as endBefore, Ua as ensureFirestoreConfigured, El as executeWrite, bl as getCountFromServer, al as getDoc, ll as getDocFromCache, fl as getDocFromServer, dl as getDocs, _l as getDocsFromCache, wl as getDocsFromServer, La as getFirestore, Ol as increment, Ba as initializeFirestore, qh as limit, Kh as limitToLast, Ya as loadBundle, Xa as namedQuery, Il as onSnapshot, Tl as onSnapshotsInSync, Lh as orderBy, Mh as query, ra as queryEqual, ia as refEqual, Dl as runTransaction, xl as serverTimestamp, ml as setDoc, Fl as setIndexConfiguration, D as setLogLevel, cl as snapshotEqual, jh as startAfter, Qh as startAt, Ja as terminate, gl as updateDoc, Wa as waitForPendingWrites, $h as where, Ml as writeBatch };
|