@firebase/firestore 3.4.3 → 3.4.4-202202622812
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 +10 -0
- package/dist/firestore/src/api/database.d.ts +14 -9
- package/dist/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/firestore/src/model/field_index.d.ts +76 -0
- package/dist/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.esm2017.js +663 -602
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +680 -617
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +100 -13
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +100 -14
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +705 -602
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +120 -9
- package/dist/lite/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/lite/index.browser.esm2017.js +2 -2
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +2 -2
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +2 -2
- package/dist/lite/index.node.mjs +2 -2
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +2 -2
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/lite/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +152 -131
- package/dist/packages/firestore/src/api/database.d.ts +14 -9
- package/dist/packages/firestore/src/api/index_configuration.d.ts +117 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -0
- package/dist/packages/firestore/src/model/field_index.d.ts +76 -0
- package/dist/packages/firestore/test/integration/api/index_configuration.test.d.ts +17 -0
- package/dist/private.d.ts +24 -9
- package/package.json +5 -5
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ C.MOCK_USER = new C("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let N = "9.6.
|
|
69
|
+
let N = "9.6.5-202202622812";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -11673,14 +11673,14 @@ function lo(t, e) {
|
|
|
11673
11673
|
// Mark this as something the client is currently listening for.
|
|
11674
11674
|
n.Wr.set(e.targetId, e), go(n) ?
|
|
11675
11675
|
// The listen will be sent in onWatchStreamOpen
|
|
11676
|
-
mo(n) :
|
|
11676
|
+
mo(n) : Oo(n).lr() && wo(n, e));
|
|
11677
11677
|
}
|
|
11678
11678
|
|
|
11679
11679
|
/**
|
|
11680
11680
|
* Removes the listen from server. It is a no-op if the given target id is
|
|
11681
11681
|
* not being listened to.
|
|
11682
11682
|
*/ function fo(t, e) {
|
|
11683
|
-
const n = K(t), s =
|
|
11683
|
+
const n = K(t), s = Oo(n);
|
|
11684
11684
|
n.Wr.delete(e), s.lr() && _o(n, e), 0 === n.Wr.size && (s.lr() ? s._r() : yo(n) &&
|
|
11685
11685
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
11686
11686
|
// have no listeners, since without any listens to send we cannot
|
|
@@ -11692,7 +11692,7 @@ function lo(t, e) {
|
|
|
11692
11692
|
* We need to increment the the expected number of pending responses we're due
|
|
11693
11693
|
* from watch so we wait for the ack to process any messages from this target.
|
|
11694
11694
|
*/ function wo(t, e) {
|
|
11695
|
-
t.Yr.X(e.targetId),
|
|
11695
|
+
t.Yr.X(e.targetId), Oo(t).Pr(e);
|
|
11696
11696
|
}
|
|
11697
11697
|
|
|
11698
11698
|
/**
|
|
@@ -11700,21 +11700,21 @@ function lo(t, e) {
|
|
|
11700
11700
|
* from watch so we wait for the removal on the server before we process any
|
|
11701
11701
|
* messages from this target.
|
|
11702
11702
|
*/ function _o(t, e) {
|
|
11703
|
-
t.Yr.X(e),
|
|
11703
|
+
t.Yr.X(e), Oo(t).vr(e);
|
|
11704
11704
|
}
|
|
11705
11705
|
|
|
11706
11706
|
function mo(t) {
|
|
11707
11707
|
t.Yr = new Ln({
|
|
11708
11708
|
getRemoteKeysForTarget: e => t.remoteSyncer.getRemoteKeysForTarget(e),
|
|
11709
11709
|
Et: e => t.Wr.get(e) || null
|
|
11710
|
-
}),
|
|
11710
|
+
}), Oo(t).start(), t.Jr.Br();
|
|
11711
11711
|
}
|
|
11712
11712
|
|
|
11713
11713
|
/**
|
|
11714
11714
|
* Returns whether the watch stream should be started because it's necessary
|
|
11715
11715
|
* and has not yet been started.
|
|
11716
11716
|
*/ function go(t) {
|
|
11717
|
-
return yo(t) &&
|
|
11717
|
+
return yo(t) && !Oo(t).hr() && t.Wr.size > 0;
|
|
11718
11718
|
}
|
|
11719
11719
|
|
|
11720
11720
|
function yo(t) {
|
|
@@ -11848,7 +11848,7 @@ async function Io(t, e, n) {
|
|
|
11848
11848
|
}
|
|
11849
11849
|
|
|
11850
11850
|
async function bo(t) {
|
|
11851
|
-
const e = K(t), n =
|
|
11851
|
+
const e = K(t), n = Mo(e);
|
|
11852
11852
|
let s = e.Qr.length > 0 ? e.Qr[e.Qr.length - 1].batchId : -1;
|
|
11853
11853
|
for (;Po(e); ) try {
|
|
11854
11854
|
const t = await pr(e.localStore, s);
|
|
@@ -11875,24 +11875,24 @@ async function bo(t) {
|
|
|
11875
11875
|
* immediately if the write stream is established.
|
|
11876
11876
|
*/ function vo(t, e) {
|
|
11877
11877
|
t.Qr.push(e);
|
|
11878
|
-
const n =
|
|
11878
|
+
const n = Mo(t);
|
|
11879
11879
|
n.lr() && n.Sr && n.Dr(e.mutations);
|
|
11880
11880
|
}
|
|
11881
11881
|
|
|
11882
11882
|
function Vo(t) {
|
|
11883
|
-
return yo(t) && !
|
|
11883
|
+
return yo(t) && !Mo(t).hr() && t.Qr.length > 0;
|
|
11884
11884
|
}
|
|
11885
11885
|
|
|
11886
11886
|
function So(t) {
|
|
11887
|
-
|
|
11887
|
+
Mo(t).start();
|
|
11888
11888
|
}
|
|
11889
11889
|
|
|
11890
11890
|
async function Do(t) {
|
|
11891
|
-
|
|
11891
|
+
Mo(t).kr();
|
|
11892
11892
|
}
|
|
11893
11893
|
|
|
11894
11894
|
async function Co(t) {
|
|
11895
|
-
const e =
|
|
11895
|
+
const e = Mo(t);
|
|
11896
11896
|
// Send the write pipeline now that the stream is established.
|
|
11897
11897
|
for (const n of t.Qr) e.Dr(n.mutations);
|
|
11898
11898
|
}
|
|
@@ -11908,7 +11908,7 @@ async function No(t, e, n) {
|
|
|
11908
11908
|
async function ko(t, e) {
|
|
11909
11909
|
// If the write stream closed after the write handshake completes, a write
|
|
11910
11910
|
// operation failed and we fail the pending operation.
|
|
11911
|
-
e &&
|
|
11911
|
+
e && Mo(t).Sr &&
|
|
11912
11912
|
// This error affects the actual write.
|
|
11913
11913
|
await async function(t, e) {
|
|
11914
11914
|
// Only handle permanent errors here. If it's transient, just let the retry
|
|
@@ -11920,7 +11920,7 @@ async function ko(t, e) {
|
|
|
11920
11920
|
// In this case it's also unlikely that the server itself is melting
|
|
11921
11921
|
// down -- this was just a bad request so inhibit backoff on the next
|
|
11922
11922
|
// restart.
|
|
11923
|
-
|
|
11923
|
+
Mo(t).wr(), await Ro(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
|
|
11924
11924
|
// It's possible that with the completion of this mutation
|
|
11925
11925
|
// another slot has freed up.
|
|
11926
11926
|
await bo(t);
|
|
@@ -11932,10 +11932,22 @@ async function ko(t, e) {
|
|
|
11932
11932
|
Vo(t) && So(t);
|
|
11933
11933
|
}
|
|
11934
11934
|
|
|
11935
|
+
async function xo(t, e) {
|
|
11936
|
+
const n = K(t);
|
|
11937
|
+
n.asyncQueue.verifyOperationInProgress(), O("RemoteStore", "RemoteStore received new credentials");
|
|
11938
|
+
const s = yo(n);
|
|
11939
|
+
// Tear down and re-create our network streams. This will ensure we get a
|
|
11940
|
+
// fresh auth token for the new user and re-fill the write pipeline with
|
|
11941
|
+
// new mutations from the LocalStore (since mutations are per-user).
|
|
11942
|
+
n.Gr.add(3 /* CredentialChange */), await ho(n), s &&
|
|
11943
|
+
// Don't set the network status to Unknown if we are offline.
|
|
11944
|
+
n.Jr.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
11945
|
+
n.Gr.delete(3 /* CredentialChange */), await uo(n);
|
|
11946
|
+
}
|
|
11947
|
+
|
|
11935
11948
|
/**
|
|
11936
11949
|
* Toggles the network state when the client gains or loses its primary lease.
|
|
11937
|
-
*/
|
|
11938
|
-
async function xo(t, e) {
|
|
11950
|
+
*/ async function $o(t, e) {
|
|
11939
11951
|
const n = K(t);
|
|
11940
11952
|
e ? (n.Gr.delete(2 /* IsSecondary */), await uo(n)) : e || (n.Gr.add(2 /* IsSecondary */),
|
|
11941
11953
|
await ho(n), n.Jr.set("Unknown" /* Unknown */));
|
|
@@ -11948,7 +11960,7 @@ async function xo(t, e) {
|
|
|
11948
11960
|
*
|
|
11949
11961
|
* PORTING NOTE: On iOS and Android, the WatchStream gets registered on startup.
|
|
11950
11962
|
* This is not done on Web to allow it to be tree-shaken.
|
|
11951
|
-
*/ function
|
|
11963
|
+
*/ function Oo(t) {
|
|
11952
11964
|
return t.Xr || (
|
|
11953
11965
|
// Create stream (but note that it is not started yet).
|
|
11954
11966
|
t.Xr = function(t, e, n) {
|
|
@@ -11987,7 +11999,7 @@ async function xo(t, e) {
|
|
|
11987
11999
|
*
|
|
11988
12000
|
* PORTING NOTE: On iOS and Android, the WriteStream gets registered on startup.
|
|
11989
12001
|
* This is not done on Web to allow it to be tree-shaken.
|
|
11990
|
-
*/ function
|
|
12002
|
+
*/ function Mo(t) {
|
|
11991
12003
|
return t.Zr || (
|
|
11992
12004
|
// Create stream (but note that it is not started yet).
|
|
11993
12005
|
t.Zr = function(t, e, n) {
|
|
@@ -12033,7 +12045,7 @@ async function xo(t, e) {
|
|
|
12033
12045
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
12034
12046
|
* IE.
|
|
12035
12047
|
*/
|
|
12036
|
-
class
|
|
12048
|
+
class Fo {
|
|
12037
12049
|
constructor(t, e, n, s, i) {
|
|
12038
12050
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = s, this.removalCallback = i,
|
|
12039
12051
|
this.deferred = new W, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -12056,7 +12068,7 @@ class Mo {
|
|
|
12056
12068
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
12057
12069
|
* the DelayedOperation class public.
|
|
12058
12070
|
*/ static createAndSchedule(t, e, n, s, i) {
|
|
12059
|
-
const r = Date.now() + n, o = new
|
|
12071
|
+
const r = Date.now() + n, o = new Fo(t, e, r, s, i);
|
|
12060
12072
|
return o.start(n), o;
|
|
12061
12073
|
}
|
|
12062
12074
|
/**
|
|
@@ -12093,7 +12105,7 @@ class Mo {
|
|
|
12093
12105
|
/**
|
|
12094
12106
|
* Returns a FirestoreError that can be surfaced to the user if the provided
|
|
12095
12107
|
* error is an IndexedDbTransactionError. Re-throws the error otherwise.
|
|
12096
|
-
*/ function
|
|
12108
|
+
*/ function Lo(t, e) {
|
|
12097
12109
|
if (M("AsyncQueue", `${e}: ${t}`), Zs(t)) return new Q(j.UNAVAILABLE, `${e}: ${t}`);
|
|
12098
12110
|
throw t;
|
|
12099
12111
|
}
|
|
@@ -12119,7 +12131,7 @@ class Mo {
|
|
|
12119
12131
|
* in order specified by the provided comparator. We always add a document key
|
|
12120
12132
|
* comparator on top of what is provided to guarantee document equality based on
|
|
12121
12133
|
* the key.
|
|
12122
|
-
*/ class
|
|
12134
|
+
*/ class Bo {
|
|
12123
12135
|
/** The default ordering is by key if the comparator is omitted */
|
|
12124
12136
|
constructor(t) {
|
|
12125
12137
|
// We are adding document key comparator to the end as it's the only
|
|
@@ -12131,7 +12143,7 @@ class Mo {
|
|
|
12131
12143
|
* Returns an empty copy of the existing DocumentSet, using the same
|
|
12132
12144
|
* comparator.
|
|
12133
12145
|
*/ static emptySet(t) {
|
|
12134
|
-
return new
|
|
12146
|
+
return new Bo(t.comparator);
|
|
12135
12147
|
}
|
|
12136
12148
|
has(t) {
|
|
12137
12149
|
return null != this.keyedMap.get(t);
|
|
@@ -12171,7 +12183,7 @@ class Mo {
|
|
|
12171
12183
|
return e ? this.copy(this.keyedMap.remove(t), this.sortedSet.remove(e)) : this;
|
|
12172
12184
|
}
|
|
12173
12185
|
isEqual(t) {
|
|
12174
|
-
if (!(t instanceof
|
|
12186
|
+
if (!(t instanceof Bo)) return !1;
|
|
12175
12187
|
if (this.size !== t.size) return !1;
|
|
12176
12188
|
const e = this.sortedSet.getIterator(), n = t.sortedSet.getIterator();
|
|
12177
12189
|
for (;e.hasNext(); ) {
|
|
@@ -12187,7 +12199,7 @@ class Mo {
|
|
|
12187
12199
|
})), 0 === t.length ? "DocumentSet ()" : "DocumentSet (\n " + t.join(" \n") + "\n)";
|
|
12188
12200
|
}
|
|
12189
12201
|
copy(t, e) {
|
|
12190
|
-
const n = new
|
|
12202
|
+
const n = new Bo;
|
|
12191
12203
|
return n.comparator = this.comparator, n.keyedMap = t, n.sortedSet = e, n;
|
|
12192
12204
|
}
|
|
12193
12205
|
}
|
|
@@ -12211,7 +12223,7 @@ class Mo {
|
|
|
12211
12223
|
/**
|
|
12212
12224
|
* DocumentChangeSet keeps track of a set of changes to docs in a query, merging
|
|
12213
12225
|
* duplicate events for the same doc.
|
|
12214
|
-
*/ class
|
|
12226
|
+
*/ class Uo {
|
|
12215
12227
|
constructor() {
|
|
12216
12228
|
this.eo = new yn(Dt.comparator);
|
|
12217
12229
|
}
|
|
@@ -12252,7 +12264,7 @@ class Mo {
|
|
|
12252
12264
|
}
|
|
12253
12265
|
}
|
|
12254
12266
|
|
|
12255
|
-
class
|
|
12267
|
+
class qo {
|
|
12256
12268
|
constructor(t, e, n, s, i, r, o, c) {
|
|
12257
12269
|
this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
|
|
12258
12270
|
this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = c;
|
|
@@ -12264,7 +12276,7 @@ class Uo {
|
|
|
12264
12276
|
type: 0 /* Added */ ,
|
|
12265
12277
|
doc: t
|
|
12266
12278
|
});
|
|
12267
|
-
})), new
|
|
12279
|
+
})), new qo(t, e, Bo.emptySet(e), i, n, s,
|
|
12268
12280
|
/* syncStateChanged= */ !0,
|
|
12269
12281
|
/* excludesMetadataChanges= */ !1);
|
|
12270
12282
|
}
|
|
@@ -12299,36 +12311,36 @@ class Uo {
|
|
|
12299
12311
|
/**
|
|
12300
12312
|
* Holds the listeners and the last received ViewSnapshot for a query being
|
|
12301
12313
|
* tracked by EventManager.
|
|
12302
|
-
*/ class
|
|
12314
|
+
*/ class Ko {
|
|
12303
12315
|
constructor() {
|
|
12304
12316
|
this.so = void 0, this.listeners = [];
|
|
12305
12317
|
}
|
|
12306
12318
|
}
|
|
12307
12319
|
|
|
12308
|
-
class
|
|
12320
|
+
class jo {
|
|
12309
12321
|
constructor() {
|
|
12310
12322
|
this.queries = new zi((t => Ve(t)), ve), this.onlineState = "Unknown" /* Unknown */ ,
|
|
12311
12323
|
this.io = new Set;
|
|
12312
12324
|
}
|
|
12313
12325
|
}
|
|
12314
12326
|
|
|
12315
|
-
async function
|
|
12327
|
+
async function Qo(t, e) {
|
|
12316
12328
|
const n = K(t), s = e.query;
|
|
12317
12329
|
let i = !1, r = n.queries.get(s);
|
|
12318
|
-
if (r || (i = !0, r = new
|
|
12330
|
+
if (r || (i = !0, r = new Ko), i) try {
|
|
12319
12331
|
r.so = await n.onListen(s);
|
|
12320
12332
|
} catch (t) {
|
|
12321
|
-
const n =
|
|
12333
|
+
const n = Lo(t, `Initialization of query '${Se(e.query)}' failed`);
|
|
12322
12334
|
return void e.onError(n);
|
|
12323
12335
|
}
|
|
12324
12336
|
if (n.queries.set(s, r), r.listeners.push(e),
|
|
12325
12337
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
12326
12338
|
e.ro(n.onlineState), r.so) {
|
|
12327
|
-
e.oo(r.so) &&
|
|
12339
|
+
e.oo(r.so) && Ho(n);
|
|
12328
12340
|
}
|
|
12329
12341
|
}
|
|
12330
12342
|
|
|
12331
|
-
async function
|
|
12343
|
+
async function Wo(t, e) {
|
|
12332
12344
|
const n = K(t), s = e.query;
|
|
12333
12345
|
let i = !1;
|
|
12334
12346
|
const r = n.queries.get(s);
|
|
@@ -12339,7 +12351,7 @@ async function Qo(t, e) {
|
|
|
12339
12351
|
if (i) return n.queries.delete(s), n.onUnlisten(s);
|
|
12340
12352
|
}
|
|
12341
12353
|
|
|
12342
|
-
function
|
|
12354
|
+
function Go(t, e) {
|
|
12343
12355
|
const n = K(t);
|
|
12344
12356
|
let s = !1;
|
|
12345
12357
|
for (const t of e) {
|
|
@@ -12349,10 +12361,10 @@ function Wo(t, e) {
|
|
|
12349
12361
|
i.so = t;
|
|
12350
12362
|
}
|
|
12351
12363
|
}
|
|
12352
|
-
s &&
|
|
12364
|
+
s && Ho(n);
|
|
12353
12365
|
}
|
|
12354
12366
|
|
|
12355
|
-
function
|
|
12367
|
+
function zo(t, e, n) {
|
|
12356
12368
|
const s = K(t), i = s.queries.get(e);
|
|
12357
12369
|
if (i) for (const t of i.listeners) t.onError(n);
|
|
12358
12370
|
// Remove all listeners. NOTE: We don't need to call syncEngine.unlisten()
|
|
@@ -12361,7 +12373,7 @@ function Go(t, e, n) {
|
|
|
12361
12373
|
}
|
|
12362
12374
|
|
|
12363
12375
|
// Call all global snapshot listeners that have been set.
|
|
12364
|
-
function
|
|
12376
|
+
function Ho(t) {
|
|
12365
12377
|
t.io.forEach((t => {
|
|
12366
12378
|
t.next();
|
|
12367
12379
|
}));
|
|
@@ -12372,7 +12384,7 @@ function zo(t) {
|
|
|
12372
12384
|
* when to raise the event.
|
|
12373
12385
|
*
|
|
12374
12386
|
* It uses an Observer to dispatch events.
|
|
12375
|
-
*/ class
|
|
12387
|
+
*/ class Jo {
|
|
12376
12388
|
constructor(t, e, n) {
|
|
12377
12389
|
this.query = t, this.co = e,
|
|
12378
12390
|
/**
|
|
@@ -12391,7 +12403,7 @@ function zo(t) {
|
|
|
12391
12403
|
// Remove the metadata only changes.
|
|
12392
12404
|
const e = [];
|
|
12393
12405
|
for (const n of t.docChanges) 3 /* Metadata */ !== n.type && e.push(n);
|
|
12394
|
-
t = new
|
|
12406
|
+
t = new qo(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
|
|
12395
12407
|
/* excludesMetadataChanges= */ !0);
|
|
12396
12408
|
}
|
|
12397
12409
|
let e = !1;
|
|
@@ -12431,7 +12443,7 @@ function zo(t) {
|
|
|
12431
12443
|
// stripped out.
|
|
12432
12444
|
}
|
|
12433
12445
|
fo(t) {
|
|
12434
|
-
t =
|
|
12446
|
+
t = qo.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
|
|
12435
12447
|
this.co.next(t);
|
|
12436
12448
|
}
|
|
12437
12449
|
}
|
|
@@ -12455,7 +12467,7 @@ function zo(t) {
|
|
|
12455
12467
|
/**
|
|
12456
12468
|
* A complete element in the bundle stream, together with the byte length it
|
|
12457
12469
|
* occupies in the stream.
|
|
12458
|
-
*/ class
|
|
12470
|
+
*/ class Yo {
|
|
12459
12471
|
constructor(t,
|
|
12460
12472
|
// How many bytes this element takes to store in the bundle.
|
|
12461
12473
|
e) {
|
|
@@ -12484,7 +12496,7 @@ function zo(t) {
|
|
|
12484
12496
|
*/
|
|
12485
12497
|
/**
|
|
12486
12498
|
* Helper to convert objects from bundles to model objects in the SDK.
|
|
12487
|
-
*/ class
|
|
12499
|
+
*/ class Xo {
|
|
12488
12500
|
constructor(t) {
|
|
12489
12501
|
this.k = t;
|
|
12490
12502
|
}
|
|
@@ -12504,13 +12516,13 @@ function zo(t) {
|
|
|
12504
12516
|
/**
|
|
12505
12517
|
* A class to process the elements from a bundle, load them into local
|
|
12506
12518
|
* storage and provide progress update while loading.
|
|
12507
|
-
*/ class
|
|
12519
|
+
*/ class Zo {
|
|
12508
12520
|
constructor(t, e, n) {
|
|
12509
12521
|
this.mo = t, this.localStore = e, this.k = n,
|
|
12510
12522
|
/** Batched queries to be saved into storage */
|
|
12511
12523
|
this.queries = [],
|
|
12512
12524
|
/** Batched documents to be saved into storage */
|
|
12513
|
-
this.documents = [], this.progress =
|
|
12525
|
+
this.documents = [], this.progress = tc(t);
|
|
12514
12526
|
}
|
|
12515
12527
|
/**
|
|
12516
12528
|
* Adds an element from the bundle to the loader.
|
|
@@ -12527,7 +12539,7 @@ function zo(t) {
|
|
|
12527
12539
|
Object.assign({}, this.progress)) : null;
|
|
12528
12540
|
}
|
|
12529
12541
|
po(t) {
|
|
12530
|
-
const e = new Map, n = new
|
|
12542
|
+
const e = new Map, n = new Xo(this.k);
|
|
12531
12543
|
for (const s of t) if (s.metadata.queries) {
|
|
12532
12544
|
const t = n.Hn(s.metadata.name);
|
|
12533
12545
|
for (const n of s.metadata.queries) {
|
|
@@ -12540,7 +12552,7 @@ function zo(t) {
|
|
|
12540
12552
|
/**
|
|
12541
12553
|
* Update the progress to 'Success' and return the updated progress.
|
|
12542
12554
|
*/ async complete() {
|
|
12543
|
-
const t = await Pr(this.localStore, new
|
|
12555
|
+
const t = await Pr(this.localStore, new Xo(this.k), this.documents, this.mo.id), e = this.po(this.documents);
|
|
12544
12556
|
for (const t of this.queries) await vr(this.localStore, t, e.get(t.name));
|
|
12545
12557
|
return this.progress.taskState = "Success", new ar(Object.assign({}, this.progress), t);
|
|
12546
12558
|
}
|
|
@@ -12549,7 +12561,7 @@ function zo(t) {
|
|
|
12549
12561
|
/**
|
|
12550
12562
|
* Returns a `LoadBundleTaskProgress` representing the initial progress of
|
|
12551
12563
|
* loading a bundle.
|
|
12552
|
-
*/ function
|
|
12564
|
+
*/ function tc(t) {
|
|
12553
12565
|
return {
|
|
12554
12566
|
taskState: "Running",
|
|
12555
12567
|
documentsLoaded: 0,
|
|
@@ -12579,13 +12591,13 @@ function zo(t) {
|
|
|
12579
12591
|
* See the License for the specific language governing permissions and
|
|
12580
12592
|
* limitations under the License.
|
|
12581
12593
|
*/
|
|
12582
|
-
class
|
|
12594
|
+
class ec {
|
|
12583
12595
|
constructor(t) {
|
|
12584
12596
|
this.key = t;
|
|
12585
12597
|
}
|
|
12586
12598
|
}
|
|
12587
12599
|
|
|
12588
|
-
class
|
|
12600
|
+
class nc {
|
|
12589
12601
|
constructor(t) {
|
|
12590
12602
|
this.key = t;
|
|
12591
12603
|
}
|
|
@@ -12595,7 +12607,7 @@ class ec {
|
|
|
12595
12607
|
* View is responsible for computing the final merged truth of what docs are in
|
|
12596
12608
|
* a query. It gets notified of local and remote changes to docs, and applies
|
|
12597
12609
|
* the query filters and limits to determine the most correct possible results.
|
|
12598
|
-
*/ class
|
|
12610
|
+
*/ class sc {
|
|
12599
12611
|
constructor(t,
|
|
12600
12612
|
/** Documents included in the remote target */
|
|
12601
12613
|
e) {
|
|
@@ -12610,7 +12622,7 @@ class ec {
|
|
|
12610
12622
|
/** Documents in the view but not in the remote target */
|
|
12611
12623
|
this.Io = Dn(),
|
|
12612
12624
|
/** Document Keys that have local changes */
|
|
12613
|
-
this.mutatedKeys = Dn(), this.Ao = Ce(t), this.Ro = new
|
|
12625
|
+
this.mutatedKeys = Dn(), this.Ao = Ce(t), this.Ro = new Bo(this.Ao);
|
|
12614
12626
|
}
|
|
12615
12627
|
/**
|
|
12616
12628
|
* The set of remote documents that the server has told us belongs to the target associated with
|
|
@@ -12628,7 +12640,7 @@ class ec {
|
|
|
12628
12640
|
* with this set of docs and changes instead of the current view.
|
|
12629
12641
|
* @returns a new set of docs, changes, and refill flag.
|
|
12630
12642
|
*/ Po(t, e) {
|
|
12631
|
-
const n = e ? e.vo : new
|
|
12643
|
+
const n = e ? e.vo : new Uo, s = e ? e.Ro : this.Ro;
|
|
12632
12644
|
let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
|
|
12633
12645
|
// Track the last doc in a (full) limit. This is necessary, because some
|
|
12634
12646
|
// update (a delete, or an update moving a doc past the old limit) might
|
|
@@ -12752,7 +12764,7 @@ class ec {
|
|
|
12752
12764
|
const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , c = o !== this.Eo;
|
|
12753
12765
|
if (this.Eo = o, 0 !== i.length || c) {
|
|
12754
12766
|
return {
|
|
12755
|
-
snapshot: new
|
|
12767
|
+
snapshot: new qo(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
|
|
12756
12768
|
/* excludesMetadataChanges= */ !1),
|
|
12757
12769
|
Co: r
|
|
12758
12770
|
};
|
|
@@ -12773,7 +12785,7 @@ class ec {
|
|
|
12773
12785
|
// true once the client is back online.
|
|
12774
12786
|
this.current = !1, this.applyChanges({
|
|
12775
12787
|
Ro: this.Ro,
|
|
12776
|
-
vo: new
|
|
12788
|
+
vo: new Uo,
|
|
12777
12789
|
mutatedKeys: this.mutatedKeys,
|
|
12778
12790
|
Bn: !1
|
|
12779
12791
|
},
|
|
@@ -12808,9 +12820,9 @@ class ec {
|
|
|
12808
12820
|
// Diff the new limbo docs with the old limbo docs.
|
|
12809
12821
|
const e = [];
|
|
12810
12822
|
return t.forEach((t => {
|
|
12811
|
-
this.Io.has(t) || e.push(new
|
|
12823
|
+
this.Io.has(t) || e.push(new nc(t));
|
|
12812
12824
|
})), this.Io.forEach((n => {
|
|
12813
|
-
t.has(n) || e.push(new
|
|
12825
|
+
t.has(n) || e.push(new ec(n));
|
|
12814
12826
|
})), e;
|
|
12815
12827
|
}
|
|
12816
12828
|
/**
|
|
@@ -12845,7 +12857,7 @@ class ec {
|
|
|
12845
12857
|
*/
|
|
12846
12858
|
// PORTING NOTE: Multi-tab only.
|
|
12847
12859
|
xo() {
|
|
12848
|
-
return
|
|
12860
|
+
return qo.fromInitialDocuments(this.query, this.Ro, this.mutatedKeys, 0 /* Local */ === this.Eo);
|
|
12849
12861
|
}
|
|
12850
12862
|
}
|
|
12851
12863
|
|
|
@@ -12853,7 +12865,7 @@ class ec {
|
|
|
12853
12865
|
* QueryView contains all of the data that SyncEngine needs to keep track of for
|
|
12854
12866
|
* a particular query.
|
|
12855
12867
|
*/
|
|
12856
|
-
class
|
|
12868
|
+
class ic {
|
|
12857
12869
|
constructor(
|
|
12858
12870
|
/**
|
|
12859
12871
|
* The query itself.
|
|
@@ -12875,7 +12887,7 @@ class sc {
|
|
|
12875
12887
|
}
|
|
12876
12888
|
}
|
|
12877
12889
|
|
|
12878
|
-
/** Tracks a limbo resolution. */ class
|
|
12890
|
+
/** Tracks a limbo resolution. */ class rc {
|
|
12879
12891
|
constructor(t) {
|
|
12880
12892
|
this.key = t,
|
|
12881
12893
|
/**
|
|
@@ -12900,7 +12912,7 @@ class sc {
|
|
|
12900
12912
|
* the class is not exported so they are only accessible from this module.
|
|
12901
12913
|
* This is useful to implement optional features (like bundles) in free
|
|
12902
12914
|
* functions, such that they are tree-shakeable.
|
|
12903
|
-
*/ class
|
|
12915
|
+
*/ class oc {
|
|
12904
12916
|
constructor(t, e, n,
|
|
12905
12917
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
12906
12918
|
s, i, r) {
|
|
@@ -12946,8 +12958,8 @@ class sc {
|
|
|
12946
12958
|
* server. All the subsequent view snapshots or errors are sent to the
|
|
12947
12959
|
* subscribed handlers. Returns the initial snapshot.
|
|
12948
12960
|
*/
|
|
12949
|
-
async function
|
|
12950
|
-
const n =
|
|
12961
|
+
async function cc(t, e) {
|
|
12962
|
+
const n = Oc(t);
|
|
12951
12963
|
let s, i;
|
|
12952
12964
|
const r = n.Mo.get(e);
|
|
12953
12965
|
if (r)
|
|
@@ -12959,7 +12971,7 @@ async function oc(t, e) {
|
|
|
12959
12971
|
// case and calls `listen` to obtain this ID.
|
|
12960
12972
|
s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
|
|
12961
12973
|
const t = await Tr(n.localStore, be(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
|
|
12962
|
-
s = t.targetId, i = await
|
|
12974
|
+
s = t.targetId, i = await ac(n, e, s, "current" === r), n.isPrimaryClient && lo(n.remoteStore, t);
|
|
12963
12975
|
}
|
|
12964
12976
|
return i;
|
|
12965
12977
|
}
|
|
@@ -12967,7 +12979,7 @@ async function oc(t, e) {
|
|
|
12967
12979
|
/**
|
|
12968
12980
|
* Registers a view for a previously unknown query and computes its initial
|
|
12969
12981
|
* snapshot.
|
|
12970
|
-
*/ async function
|
|
12982
|
+
*/ async function ac(t, e, n, s) {
|
|
12971
12983
|
// PORTING NOTE: On Web only, we inject the code that registers new Limbo
|
|
12972
12984
|
// targets based on view changes. This allows us to only depend on Limbo
|
|
12973
12985
|
// changes when user code includes queries.
|
|
@@ -12981,17 +12993,17 @@ async function oc(t, e) {
|
|
|
12981
12993
|
/* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
|
|
12982
12994
|
const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
|
|
12983
12995
|
/* updateLimboDocuments= */ t.isPrimaryClient, r);
|
|
12984
|
-
return
|
|
12996
|
+
return Ec(t, e.targetId, o.Co), o.snapshot;
|
|
12985
12997
|
}(t, e, n, s);
|
|
12986
12998
|
const i = await Ir(t.localStore, e,
|
|
12987
|
-
/* usePreviousResults= */ !0), r = new
|
|
12999
|
+
/* usePreviousResults= */ !0), r = new sc(e, i.zn), o = r.Po(i.documents), c = xn.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
|
|
12988
13000
|
/* updateLimboDocuments= */ t.isPrimaryClient, c);
|
|
12989
|
-
|
|
12990
|
-
const u = new
|
|
13001
|
+
Ec(t, n, a.Co);
|
|
13002
|
+
const u = new ic(e, n, r);
|
|
12991
13003
|
return t.Mo.set(e, u), t.Fo.has(n) ? t.Fo.get(n).push(e) : t.Fo.set(n, [ e ]), a.snapshot;
|
|
12992
13004
|
}
|
|
12993
13005
|
|
|
12994
|
-
/** Stops listening to the query. */ async function
|
|
13006
|
+
/** Stops listening to the query. */ async function uc(t, e) {
|
|
12995
13007
|
const n = K(t), s = n.Mo.get(e), i = n.Fo.get(s.targetId);
|
|
12996
13008
|
if (i.length > 1) return n.Fo.set(s.targetId, i.filter((t => !ve(t, e)))), void n.Mo.delete(e);
|
|
12997
13009
|
// No other queries are mapped to the target, clean up the query and the target.
|
|
@@ -13002,9 +13014,9 @@ async function oc(t, e) {
|
|
|
13002
13014
|
n.sharedClientState.isActiveQueryTarget(s.targetId) || await Er(n.localStore, s.targetId,
|
|
13003
13015
|
/*keepPersistedTargetData=*/ !1).then((() => {
|
|
13004
13016
|
n.sharedClientState.clearQueryState(s.targetId), fo(n.remoteStore, s.targetId),
|
|
13005
|
-
|
|
13017
|
+
pc(n, s.targetId);
|
|
13006
13018
|
})).catch(Ui);
|
|
13007
|
-
} else
|
|
13019
|
+
} else pc(n, s.targetId), await Er(n.localStore, s.targetId,
|
|
13008
13020
|
/*keepPersistedTargetData=*/ !0);
|
|
13009
13021
|
}
|
|
13010
13022
|
|
|
@@ -13017,8 +13029,8 @@ async function oc(t, e) {
|
|
|
13017
13029
|
* have completed, *not* when the write was acked by the backend. The
|
|
13018
13030
|
* userCallback is resolved once the write was acked/rejected by the
|
|
13019
13031
|
* backend (or failed locally for any other reason).
|
|
13020
|
-
*/ async function
|
|
13021
|
-
const s =
|
|
13032
|
+
*/ async function hc(t, e, n) {
|
|
13033
|
+
const s = Mc(t);
|
|
13022
13034
|
try {
|
|
13023
13035
|
const t = await function(t, e) {
|
|
13024
13036
|
const n = K(t), s = at.now(), i = e.reduce(((t, e) => t.add(e.key)), Dn());
|
|
@@ -13053,11 +13065,11 @@ async function oc(t, e) {
|
|
|
13053
13065
|
/**
|
|
13054
13066
|
* Resolves or rejects the user callback for the given batch and then discards
|
|
13055
13067
|
* it.
|
|
13056
|
-
*/ (s, t.batchId, n), await
|
|
13068
|
+
*/ (s, t.batchId, n), await Rc(s, t.changes), await bo(s.remoteStore);
|
|
13057
13069
|
} catch (t) {
|
|
13058
13070
|
// If we can't persist the mutation, we reject the user callback and
|
|
13059
13071
|
// don't send the mutation. The user can then retry the write.
|
|
13060
|
-
const e =
|
|
13072
|
+
const e = Lo(t, "Failed to persist write");
|
|
13061
13073
|
n.reject(e);
|
|
13062
13074
|
}
|
|
13063
13075
|
}
|
|
@@ -13066,7 +13078,7 @@ async function oc(t, e) {
|
|
|
13066
13078
|
* Applies one remote event to the sync engine, notifying any views of the
|
|
13067
13079
|
* changes, and releasing any pending mutation batches that would become
|
|
13068
13080
|
* visible because of the snapshot version the remote event contains.
|
|
13069
|
-
*/ async function
|
|
13081
|
+
*/ async function lc(t, e) {
|
|
13070
13082
|
const n = K(t);
|
|
13071
13083
|
try {
|
|
13072
13084
|
const t = await gr(n.localStore, e);
|
|
@@ -13079,7 +13091,7 @@ async function oc(t, e) {
|
|
|
13079
13091
|
U(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
|
|
13080
13092
|
t.addedDocuments.size > 0 ? s.$o = !0 : t.modifiedDocuments.size > 0 ? U(s.$o) : t.removedDocuments.size > 0 && (U(s.$o),
|
|
13081
13093
|
s.$o = !1));
|
|
13082
|
-
})), await
|
|
13094
|
+
})), await Rc(n, t, e);
|
|
13083
13095
|
} catch (t) {
|
|
13084
13096
|
await Ui(t);
|
|
13085
13097
|
}
|
|
@@ -13088,7 +13100,7 @@ async function oc(t, e) {
|
|
|
13088
13100
|
/**
|
|
13089
13101
|
* Applies an OnlineState change to the sync engine and notifies any views of
|
|
13090
13102
|
* the change.
|
|
13091
|
-
*/ function
|
|
13103
|
+
*/ function fc(t, e, n) {
|
|
13092
13104
|
const s = K(t);
|
|
13093
13105
|
// If we are the secondary client, we explicitly ignore the remote store's
|
|
13094
13106
|
// online state (the local client may go offline, even though the primary
|
|
@@ -13107,7 +13119,7 @@ async function oc(t, e) {
|
|
|
13107
13119
|
for (const t of n.listeners)
|
|
13108
13120
|
// Run global snapshot listeners if a consistent snapshot has been emitted.
|
|
13109
13121
|
t.ro(e) && (s = !0);
|
|
13110
|
-
})), s &&
|
|
13122
|
+
})), s && Ho(n);
|
|
13111
13123
|
}(s.eventManager, e), t.length && s.Oo.br(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
|
|
13112
13124
|
}
|
|
13113
13125
|
}
|
|
@@ -13122,7 +13134,7 @@ async function oc(t, e) {
|
|
|
13122
13134
|
* @param err - A description of the condition that has forced the rejection.
|
|
13123
13135
|
* Nearly always this will be an indication that the user is no longer
|
|
13124
13136
|
* authorized to see the data matching the target.
|
|
13125
|
-
*/ async function
|
|
13137
|
+
*/ async function dc(t, e, n) {
|
|
13126
13138
|
const s = K(t);
|
|
13127
13139
|
// PORTING NOTE: Multi-tab only.
|
|
13128
13140
|
s.sharedClientState.updateQueryState(e, "rejected", n);
|
|
@@ -13139,18 +13151,18 @@ async function oc(t, e) {
|
|
|
13139
13151
|
const n = Dn().add(r), i = new kn(ut.min(),
|
|
13140
13152
|
/* targetChanges= */ new Map,
|
|
13141
13153
|
/* targetMismatches= */ new En(rt), t, n);
|
|
13142
|
-
await
|
|
13154
|
+
await lc(s, i),
|
|
13143
13155
|
// Since this query failed, we won't want to manually unlisten to it.
|
|
13144
13156
|
// We only remove it from bookkeeping after we successfully applied the
|
|
13145
13157
|
// RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
|
|
13146
13158
|
// this query when the RemoteStore restarts the Watch stream, which should
|
|
13147
13159
|
// re-trigger the target failure.
|
|
13148
|
-
s.Bo = s.Bo.remove(r), s.Uo.delete(e),
|
|
13160
|
+
s.Bo = s.Bo.remove(r), s.Uo.delete(e), Ac(s);
|
|
13149
13161
|
} else await Er(s.localStore, e,
|
|
13150
|
-
/* keepPersistedTargetData */ !1).then((() =>
|
|
13162
|
+
/* keepPersistedTargetData */ !1).then((() => pc(s, e, n))).catch(Ui);
|
|
13151
13163
|
}
|
|
13152
13164
|
|
|
13153
|
-
async function
|
|
13165
|
+
async function wc(t, e) {
|
|
13154
13166
|
const n = K(t), s = e.batch.batchId;
|
|
13155
13167
|
try {
|
|
13156
13168
|
const t = await _r(n.localStore, e);
|
|
@@ -13158,14 +13170,14 @@ async function dc(t, e) {
|
|
|
13158
13170
|
// raise events immediately (depending on whether the watcher is caught
|
|
13159
13171
|
// up), so we raise user callbacks first so that they consistently happen
|
|
13160
13172
|
// before listen events.
|
|
13161
|
-
|
|
13162
|
-
await
|
|
13173
|
+
yc(n, s, /*error=*/ null), gc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
|
|
13174
|
+
await Rc(n, t);
|
|
13163
13175
|
} catch (t) {
|
|
13164
13176
|
await Ui(t);
|
|
13165
13177
|
}
|
|
13166
13178
|
}
|
|
13167
13179
|
|
|
13168
|
-
async function
|
|
13180
|
+
async function _c(t, e, n) {
|
|
13169
13181
|
const s = K(t);
|
|
13170
13182
|
try {
|
|
13171
13183
|
const t = await function(t, e) {
|
|
@@ -13185,8 +13197,8 @@ async function wc(t, e, n) {
|
|
|
13185
13197
|
// raise events immediately (depending on whether the watcher is caught up),
|
|
13186
13198
|
// so we raise user callbacks first so that they consistently happen before
|
|
13187
13199
|
// listen events.
|
|
13188
|
-
|
|
13189
|
-
await
|
|
13200
|
+
yc(s, e, n), gc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
|
|
13201
|
+
await Rc(s, t);
|
|
13190
13202
|
} catch (n) {
|
|
13191
13203
|
await Ui(n);
|
|
13192
13204
|
}
|
|
@@ -13195,7 +13207,7 @@ async function wc(t, e, n) {
|
|
|
13195
13207
|
/**
|
|
13196
13208
|
* Registers a user callback that resolves when all pending mutations at the moment of calling
|
|
13197
13209
|
* are acknowledged .
|
|
13198
|
-
*/ async function
|
|
13210
|
+
*/ async function mc(t, e) {
|
|
13199
13211
|
const n = K(t);
|
|
13200
13212
|
yo(n.remoteStore) || O("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
|
|
13201
13213
|
try {
|
|
@@ -13209,7 +13221,7 @@ async function wc(t, e, n) {
|
|
|
13209
13221
|
const s = n.jo.get(t) || [];
|
|
13210
13222
|
s.push(e), n.jo.set(t, s);
|
|
13211
13223
|
} catch (t) {
|
|
13212
|
-
const n =
|
|
13224
|
+
const n = Lo(t, "Initialization of waitForPendingWrites() operation failed");
|
|
13213
13225
|
e.reject(n);
|
|
13214
13226
|
}
|
|
13215
13227
|
}
|
|
@@ -13217,13 +13229,13 @@ async function wc(t, e, n) {
|
|
|
13217
13229
|
/**
|
|
13218
13230
|
* Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
|
|
13219
13231
|
* if there are any.
|
|
13220
|
-
*/ function
|
|
13232
|
+
*/ function gc(t, e) {
|
|
13221
13233
|
(t.jo.get(e) || []).forEach((t => {
|
|
13222
13234
|
t.resolve();
|
|
13223
13235
|
})), t.jo.delete(e);
|
|
13224
13236
|
}
|
|
13225
13237
|
|
|
13226
|
-
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function
|
|
13238
|
+
/** Reject all outstanding callbacks waiting for pending writes to complete. */ function yc(t, e, n) {
|
|
13227
13239
|
const s = K(t);
|
|
13228
13240
|
let i = s.Ko[s.currentUser.toKey()];
|
|
13229
13241
|
// NOTE: Mutations restored from persistence won't have callbacks, so it's
|
|
@@ -13234,39 +13246,39 @@ async function wc(t, e, n) {
|
|
|
13234
13246
|
}
|
|
13235
13247
|
}
|
|
13236
13248
|
|
|
13237
|
-
function
|
|
13249
|
+
function pc(t, e, n = null) {
|
|
13238
13250
|
t.sharedClientState.removeLocalQueryTarget(e);
|
|
13239
13251
|
for (const s of t.Fo.get(e)) t.Mo.delete(s), n && t.Oo.zo(s, n);
|
|
13240
13252
|
if (t.Fo.delete(e), t.isPrimaryClient) {
|
|
13241
13253
|
t.qo.us(e).forEach((e => {
|
|
13242
13254
|
t.qo.containsKey(e) ||
|
|
13243
13255
|
// We removed the last reference for this key
|
|
13244
|
-
|
|
13256
|
+
Tc(t, e);
|
|
13245
13257
|
}));
|
|
13246
13258
|
}
|
|
13247
13259
|
}
|
|
13248
13260
|
|
|
13249
|
-
function
|
|
13261
|
+
function Tc(t, e) {
|
|
13250
13262
|
t.Lo.delete(e.path.canonicalString());
|
|
13251
13263
|
// It's possible that the target already got removed because the query failed. In that case,
|
|
13252
13264
|
// the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
|
|
13253
13265
|
const n = t.Bo.get(e);
|
|
13254
|
-
null !== n && (fo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n),
|
|
13266
|
+
null !== n && (fo(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Ac(t));
|
|
13255
13267
|
}
|
|
13256
13268
|
|
|
13257
|
-
function
|
|
13258
|
-
for (const s of n) if (s instanceof
|
|
13269
|
+
function Ec(t, e, n) {
|
|
13270
|
+
for (const s of n) if (s instanceof ec) t.qo.addReference(s.key, e), Ic(t, s); else if (s instanceof nc) {
|
|
13259
13271
|
O("SyncEngine", "Document no longer in limbo: " + s.key), t.qo.removeReference(s.key, e);
|
|
13260
13272
|
t.qo.containsKey(s.key) ||
|
|
13261
13273
|
// We removed the last reference for this key
|
|
13262
|
-
|
|
13274
|
+
Tc(t, s.key);
|
|
13263
13275
|
} else B();
|
|
13264
13276
|
}
|
|
13265
13277
|
|
|
13266
|
-
function
|
|
13278
|
+
function Ic(t, e) {
|
|
13267
13279
|
const n = e.key, s = n.path.canonicalString();
|
|
13268
13280
|
t.Bo.get(n) || t.Lo.has(s) || (O("SyncEngine", "New document in limbo: " + n), t.Lo.add(s),
|
|
13269
|
-
|
|
13281
|
+
Ac(t));
|
|
13270
13282
|
}
|
|
13271
13283
|
|
|
13272
13284
|
/**
|
|
@@ -13276,16 +13288,16 @@ function Ec(t, e) {
|
|
|
13276
13288
|
* Without bounding the number of concurrent resolutions, the server can fail
|
|
13277
13289
|
* with "resource exhausted" errors which can lead to pathological client
|
|
13278
13290
|
* behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
|
|
13279
|
-
*/ function
|
|
13291
|
+
*/ function Ac(t) {
|
|
13280
13292
|
for (;t.Lo.size > 0 && t.Bo.size < t.maxConcurrentLimboResolutions; ) {
|
|
13281
13293
|
const e = t.Lo.values().next().value;
|
|
13282
13294
|
t.Lo.delete(e);
|
|
13283
13295
|
const n = new Dt(wt.fromString(e)), s = t.Qo.next();
|
|
13284
|
-
t.Uo.set(s, new
|
|
13296
|
+
t.Uo.set(s, new rc(n)), t.Bo = t.Bo.insert(n, s), lo(t.remoteStore, new ai(be(ye(n.path)), s, 2 /* LimboResolution */ , nt.I));
|
|
13285
13297
|
}
|
|
13286
13298
|
}
|
|
13287
13299
|
|
|
13288
|
-
async function
|
|
13300
|
+
async function Rc(t, e, n) {
|
|
13289
13301
|
const s = K(t), i = [], r = [], o = [];
|
|
13290
13302
|
s.Mo.isEmpty() || (s.Mo.forEach(((t, c) => {
|
|
13291
13303
|
o.push(s.Go(c, e, n).then((t => {
|
|
@@ -13319,7 +13331,7 @@ async function Ac(t, e, n) {
|
|
|
13319
13331
|
}(s.localStore, r));
|
|
13320
13332
|
}
|
|
13321
13333
|
|
|
13322
|
-
async function
|
|
13334
|
+
async function bc(t, e) {
|
|
13323
13335
|
const n = K(t);
|
|
13324
13336
|
if (!n.currentUser.isEqual(e)) {
|
|
13325
13337
|
O("SyncEngine", "User change. New user:", e.toKey());
|
|
@@ -13334,11 +13346,11 @@ async function Rc(t, e) {
|
|
|
13334
13346
|
})), t.jo.clear();
|
|
13335
13347
|
}(n, "'waitForPendingWrites' promise is rejected due to a user change."),
|
|
13336
13348
|
// TODO(b/114226417): Consider calling this only in the primary tab.
|
|
13337
|
-
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await
|
|
13349
|
+
n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Rc(n, t.Gn);
|
|
13338
13350
|
}
|
|
13339
13351
|
}
|
|
13340
13352
|
|
|
13341
|
-
function
|
|
13353
|
+
function Pc(t, e) {
|
|
13342
13354
|
const n = K(t), s = n.Uo.get(e);
|
|
13343
13355
|
if (s && s.$o) return Dn().add(s.key);
|
|
13344
13356
|
{
|
|
@@ -13356,10 +13368,10 @@ function bc(t, e) {
|
|
|
13356
13368
|
/**
|
|
13357
13369
|
* Reconcile the list of synced documents in an existing view with those
|
|
13358
13370
|
* from persistence.
|
|
13359
|
-
*/ async function
|
|
13371
|
+
*/ async function vc(t, e) {
|
|
13360
13372
|
const n = K(t), s = await Ir(n.localStore, e.query,
|
|
13361
13373
|
/* usePreviousResults= */ !0), i = e.view.ko(s);
|
|
13362
|
-
return n.isPrimaryClient &&
|
|
13374
|
+
return n.isPrimaryClient && Ec(n, e.targetId, i.Co), i;
|
|
13363
13375
|
}
|
|
13364
13376
|
|
|
13365
13377
|
/**
|
|
@@ -13367,14 +13379,14 @@ function bc(t, e) {
|
|
|
13367
13379
|
* snapshots if needed.
|
|
13368
13380
|
*/
|
|
13369
13381
|
// PORTING NOTE: Multi-Tab only.
|
|
13370
|
-
async function
|
|
13382
|
+
async function Vc(t) {
|
|
13371
13383
|
const e = K(t);
|
|
13372
|
-
return Rr(e.localStore).then((t =>
|
|
13384
|
+
return Rr(e.localStore).then((t => Rc(e, t)));
|
|
13373
13385
|
}
|
|
13374
13386
|
|
|
13375
13387
|
/** Applies a mutation state to an existing batch. */
|
|
13376
13388
|
// PORTING NOTE: Multi-Tab only.
|
|
13377
|
-
async function
|
|
13389
|
+
async function Sc(t, e, n, s) {
|
|
13378
13390
|
const i = K(t), r = await function(t, e) {
|
|
13379
13391
|
const n = K(t), s = K(n.An);
|
|
13380
13392
|
return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Zt(t, e).next((e => e ? n.Wn.vn(t, e) : zs.resolve(null)))));
|
|
@@ -13388,11 +13400,11 @@ async function Vc(t, e, n, s) {
|
|
|
13388
13400
|
await bo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
|
|
13389
13401
|
// NOTE: Both these methods are no-ops for batches that originated from
|
|
13390
13402
|
// other clients.
|
|
13391
|
-
|
|
13403
|
+
yc(i, e, s || null), gc(i, e), function(t, e) {
|
|
13392
13404
|
K(K(t).An).ee(e);
|
|
13393
13405
|
}
|
|
13394
13406
|
// PORTING NOTE: Multi-Tab only.
|
|
13395
|
-
(i.localStore, e)) : B(), await
|
|
13407
|
+
(i.localStore, e)) : B(), await Rc(i, r)) :
|
|
13396
13408
|
// A throttled tab may not have seen the mutation before it was completed
|
|
13397
13409
|
// and removed from the mutation queue, in which case we won't have cached
|
|
13398
13410
|
// the affected documents. In this case we can safely ignore the update
|
|
@@ -13405,26 +13417,26 @@ async function Vc(t, e, n, s) {
|
|
|
13405
13417
|
|
|
13406
13418
|
/** Applies a query target change from a different tab. */
|
|
13407
13419
|
// PORTING NOTE: Multi-Tab only.
|
|
13408
|
-
async function
|
|
13420
|
+
async function Dc(t, e) {
|
|
13409
13421
|
const n = K(t);
|
|
13410
|
-
if (
|
|
13422
|
+
if (Oc(n), Mc(n), !0 === e && !0 !== n.Wo) {
|
|
13411
13423
|
// Secondary tabs only maintain Views for their local listeners and the
|
|
13412
13424
|
// Views internal state may not be 100% populated (in particular
|
|
13413
13425
|
// secondary tabs don't track syncedDocuments, the set of documents the
|
|
13414
13426
|
// server considers to be in the target). So when a secondary becomes
|
|
13415
13427
|
// primary, we need to need to make sure that all views for all targets
|
|
13416
13428
|
// match the state on disk.
|
|
13417
|
-
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await
|
|
13418
|
-
n.Wo = !0, await
|
|
13429
|
+
const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Cc(n, t.toArray());
|
|
13430
|
+
n.Wo = !0, await $o(n.remoteStore, !0);
|
|
13419
13431
|
for (const t of e) lo(n.remoteStore, t);
|
|
13420
13432
|
} else if (!1 === e && !1 !== n.Wo) {
|
|
13421
13433
|
const t = [];
|
|
13422
13434
|
let e = Promise.resolve();
|
|
13423
13435
|
n.Fo.forEach(((s, i) => {
|
|
13424
|
-
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (
|
|
13436
|
+
n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (pc(n, i),
|
|
13425
13437
|
Er(n.localStore, i,
|
|
13426
13438
|
/*keepPersistedTargetData=*/ !0)))), fo(n.remoteStore, i);
|
|
13427
|
-
})), await e, await
|
|
13439
|
+
})), await e, await Cc(n, t),
|
|
13428
13440
|
// PORTING NOTE: Multi-Tab only.
|
|
13429
13441
|
function(t) {
|
|
13430
13442
|
const e = K(t);
|
|
@@ -13443,11 +13455,11 @@ async function Sc(t, e) {
|
|
|
13443
13455
|
* tab to a primary tab
|
|
13444
13456
|
*/
|
|
13445
13457
|
// PORTING NOTE: Multi-Tab only.
|
|
13446
|
-
(n), n.Wo = !1, await
|
|
13458
|
+
(n), n.Wo = !1, await $o(n.remoteStore, !1);
|
|
13447
13459
|
}
|
|
13448
13460
|
}
|
|
13449
13461
|
|
|
13450
|
-
async function
|
|
13462
|
+
async function Cc(t, e, n) {
|
|
13451
13463
|
const s = K(t), i = [], r = [];
|
|
13452
13464
|
for (const t of e) {
|
|
13453
13465
|
let e;
|
|
@@ -13459,14 +13471,14 @@ async function Dc(t, e, n) {
|
|
|
13459
13471
|
// state (the list of syncedDocuments may have gotten out of sync).
|
|
13460
13472
|
e = await Tr(s.localStore, be(n[0]));
|
|
13461
13473
|
for (const t of n) {
|
|
13462
|
-
const e = s.Mo.get(t), n = await
|
|
13474
|
+
const e = s.Mo.get(t), n = await vc(s, e);
|
|
13463
13475
|
n.snapshot && r.push(n.snapshot);
|
|
13464
13476
|
}
|
|
13465
13477
|
} else {
|
|
13466
13478
|
// For queries that never executed on this client, we need to
|
|
13467
13479
|
// allocate the target in LocalStore and initialize a new View.
|
|
13468
13480
|
const n = await Ar(s.localStore, t);
|
|
13469
|
-
e = await Tr(s.localStore, n), await
|
|
13481
|
+
e = await Tr(s.localStore, n), await ac(s, Nc(n), t,
|
|
13470
13482
|
/*current=*/ !1);
|
|
13471
13483
|
}
|
|
13472
13484
|
i.push(e);
|
|
@@ -13485,20 +13497,20 @@ async function Dc(t, e, n) {
|
|
|
13485
13497
|
* difference will not cause issues.
|
|
13486
13498
|
*/
|
|
13487
13499
|
// PORTING NOTE: Multi-Tab only.
|
|
13488
|
-
function
|
|
13500
|
+
function Nc(t) {
|
|
13489
13501
|
return ge(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
13490
13502
|
}
|
|
13491
13503
|
|
|
13492
13504
|
/** Returns the IDs of the clients that are currently active. */
|
|
13493
13505
|
// PORTING NOTE: Multi-Tab only.
|
|
13494
|
-
function
|
|
13506
|
+
function kc(t) {
|
|
13495
13507
|
const e = K(t);
|
|
13496
13508
|
return K(K(e.localStore).persistence).Tn();
|
|
13497
13509
|
}
|
|
13498
13510
|
|
|
13499
13511
|
/** Applies a query target change from a different tab. */
|
|
13500
13512
|
// PORTING NOTE: Multi-Tab only.
|
|
13501
|
-
async function
|
|
13513
|
+
async function xc(t, e, n, s) {
|
|
13502
13514
|
const i = K(t);
|
|
13503
13515
|
if (i.Wo)
|
|
13504
13516
|
// If we receive a target state notification via WebStorage, we are
|
|
@@ -13508,13 +13520,13 @@ async function kc(t, e, n, s) {
|
|
|
13508
13520
|
case "not-current":
|
|
13509
13521
|
{
|
|
13510
13522
|
const t = await Rr(i.localStore), s = kn.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
|
|
13511
|
-
await
|
|
13523
|
+
await Rc(i, t, s);
|
|
13512
13524
|
break;
|
|
13513
13525
|
}
|
|
13514
13526
|
|
|
13515
13527
|
case "rejected":
|
|
13516
13528
|
await Er(i.localStore, e,
|
|
13517
|
-
/* keepPersistedTargetData */ !0),
|
|
13529
|
+
/* keepPersistedTargetData */ !0), pc(i, e, s);
|
|
13518
13530
|
break;
|
|
13519
13531
|
|
|
13520
13532
|
default:
|
|
@@ -13522,8 +13534,8 @@ async function kc(t, e, n, s) {
|
|
|
13522
13534
|
}
|
|
13523
13535
|
}
|
|
13524
13536
|
|
|
13525
|
-
/** Adds or removes Watch targets for queries from different tabs. */ async function
|
|
13526
|
-
const s =
|
|
13537
|
+
/** Adds or removes Watch targets for queries from different tabs. */ async function $c(t, e, n) {
|
|
13538
|
+
const s = Oc(t);
|
|
13527
13539
|
if (s.Wo) {
|
|
13528
13540
|
for (const t of e) {
|
|
13529
13541
|
if (s.Fo.has(t)) {
|
|
@@ -13532,7 +13544,7 @@ async function kc(t, e, n, s) {
|
|
|
13532
13544
|
continue;
|
|
13533
13545
|
}
|
|
13534
13546
|
const e = await Ar(s.localStore, t), n = await Tr(s.localStore, e);
|
|
13535
|
-
await
|
|
13547
|
+
await ac(s, Nc(e), n.targetId,
|
|
13536
13548
|
/*current=*/ !1), lo(s.remoteStore, n);
|
|
13537
13549
|
}
|
|
13538
13550
|
for (const t of n)
|
|
@@ -13542,21 +13554,21 @@ async function kc(t, e, n, s) {
|
|
|
13542
13554
|
// Release queries that are still active.
|
|
13543
13555
|
await Er(s.localStore, t,
|
|
13544
13556
|
/* keepPersistedTargetData */ !1).then((() => {
|
|
13545
|
-
fo(s.remoteStore, t),
|
|
13557
|
+
fo(s.remoteStore, t), pc(s, t);
|
|
13546
13558
|
})).catch(Ui);
|
|
13547
13559
|
}
|
|
13548
13560
|
}
|
|
13549
13561
|
|
|
13550
|
-
function
|
|
13562
|
+
function Oc(t) {
|
|
13551
13563
|
const e = K(t);
|
|
13552
|
-
return e.remoteStore.remoteSyncer.applyRemoteEvent =
|
|
13553
|
-
e.remoteStore.remoteSyncer.rejectListen =
|
|
13554
|
-
e.Oo.zo =
|
|
13564
|
+
return e.remoteStore.remoteSyncer.applyRemoteEvent = lc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = Pc.bind(null, e),
|
|
13565
|
+
e.remoteStore.remoteSyncer.rejectListen = dc.bind(null, e), e.Oo.br = Go.bind(null, e.eventManager),
|
|
13566
|
+
e.Oo.zo = zo.bind(null, e.eventManager), e;
|
|
13555
13567
|
}
|
|
13556
13568
|
|
|
13557
|
-
function
|
|
13569
|
+
function Mc(t) {
|
|
13558
13570
|
const e = K(t);
|
|
13559
|
-
return e.remoteStore.remoteSyncer.applySuccessfulWrite =
|
|
13571
|
+
return e.remoteStore.remoteSyncer.applySuccessfulWrite = wc.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = _c.bind(null, e),
|
|
13560
13572
|
e;
|
|
13561
13573
|
}
|
|
13562
13574
|
|
|
@@ -13567,7 +13579,7 @@ function Oc(t) {
|
|
|
13567
13579
|
* @param syncEngine - SyncEngine to use.
|
|
13568
13580
|
* @param bundleReader - Bundle to load into the SDK.
|
|
13569
13581
|
* @param task - LoadBundleTask used to update the loading progress to public API.
|
|
13570
|
-
*/ function
|
|
13582
|
+
*/ function Fc(t, e, n) {
|
|
13571
13583
|
const s = K(t);
|
|
13572
13584
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
13573
13585
|
(async function(t, e, n) {
|
|
@@ -13588,8 +13600,8 @@ function Oc(t) {
|
|
|
13588
13600
|
totalBytes: t.totalBytes
|
|
13589
13601
|
};
|
|
13590
13602
|
}(s));
|
|
13591
|
-
n._updateProgress(
|
|
13592
|
-
const i = new
|
|
13603
|
+
n._updateProgress(tc(s));
|
|
13604
|
+
const i = new Zo(s, t.localStore, e.k);
|
|
13593
13605
|
let r = await e.Ho();
|
|
13594
13606
|
for (;r; ) {
|
|
13595
13607
|
const t = await i.yo(r);
|
|
@@ -13599,7 +13611,7 @@ function Oc(t) {
|
|
|
13599
13611
|
// TODO(b/160876443): This currently raises snapshots with
|
|
13600
13612
|
// `fromCache=false` if users already listen to some queries and bundles
|
|
13601
13613
|
// has newer version.
|
|
13602
|
-
await
|
|
13614
|
+
await Rc(t, o.In,
|
|
13603
13615
|
/* remoteEvent */ void 0),
|
|
13604
13616
|
// Save metadata, so loading the same bundle will skip.
|
|
13605
13617
|
await function(t, e) {
|
|
@@ -13638,7 +13650,7 @@ function Oc(t) {
|
|
|
13638
13650
|
}));
|
|
13639
13651
|
}
|
|
13640
13652
|
|
|
13641
|
-
class
|
|
13653
|
+
class Lc {
|
|
13642
13654
|
constructor() {
|
|
13643
13655
|
this.synchronizeTabs = !1;
|
|
13644
13656
|
}
|
|
@@ -13666,14 +13678,14 @@ class Fc {
|
|
|
13666
13678
|
|
|
13667
13679
|
/**
|
|
13668
13680
|
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
13669
|
-
*/ class
|
|
13681
|
+
*/ class Bc extends Lc {
|
|
13670
13682
|
constructor(t, e, n) {
|
|
13671
13683
|
super(), this.tc = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
|
|
13672
13684
|
}
|
|
13673
13685
|
async initialize(t) {
|
|
13674
13686
|
await super.initialize(t), await br(this.localStore), await this.tc.initialize(this, t),
|
|
13675
13687
|
// Enqueue writes from a previous session
|
|
13676
|
-
await
|
|
13688
|
+
await Mc(this.tc.syncEngine), await bo(this.tc.remoteStore),
|
|
13677
13689
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13678
13690
|
// set it after localStore / remoteStore are started.
|
|
13679
13691
|
await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
|
|
@@ -13702,7 +13714,7 @@ class Fc {
|
|
|
13702
13714
|
* In the legacy client, this provider is used to provide both multi-tab and
|
|
13703
13715
|
* non-multi-tab persistence since we cannot tell at build time whether
|
|
13704
13716
|
* `synchronizeTabs` will be enabled.
|
|
13705
|
-
*/ class
|
|
13717
|
+
*/ class Uc extends Bc {
|
|
13706
13718
|
constructor(t, e) {
|
|
13707
13719
|
super(t, e, /* forceOwnership= */ !1), this.tc = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
|
|
13708
13720
|
}
|
|
@@ -13710,16 +13722,16 @@ class Fc {
|
|
|
13710
13722
|
await super.initialize(t);
|
|
13711
13723
|
const e = this.tc.syncEngine;
|
|
13712
13724
|
this.sharedClientState instanceof Wr && (this.sharedClientState.syncEngine = {
|
|
13713
|
-
mi:
|
|
13714
|
-
gi:
|
|
13715
|
-
yi:
|
|
13716
|
-
Tn:
|
|
13717
|
-
_i:
|
|
13725
|
+
mi: Sc.bind(null, e),
|
|
13726
|
+
gi: xc.bind(null, e),
|
|
13727
|
+
yi: $c.bind(null, e),
|
|
13728
|
+
Tn: kc.bind(null, e),
|
|
13729
|
+
_i: Vc.bind(null, e)
|
|
13718
13730
|
}, await this.sharedClientState.start()),
|
|
13719
13731
|
// NOTE: This will immediately call the listener, so we make sure to
|
|
13720
13732
|
// set it after localStore / remoteStore are started.
|
|
13721
13733
|
await this.persistence.sn((async t => {
|
|
13722
|
-
await
|
|
13734
|
+
await Dc(this.tc.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
|
|
13723
13735
|
}));
|
|
13724
13736
|
}
|
|
13725
13737
|
Jo(t) {
|
|
@@ -13733,17 +13745,17 @@ class Fc {
|
|
|
13733
13745
|
/**
|
|
13734
13746
|
* Initializes and wires the components that are needed to interface with the
|
|
13735
13747
|
* network.
|
|
13736
|
-
*/ class
|
|
13748
|
+
*/ class qc {
|
|
13737
13749
|
async initialize(t, e) {
|
|
13738
13750
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
13739
13751
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
13740
13752
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
13741
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t =>
|
|
13742
|
-
this.remoteStore.remoteSyncer.handleCredentialChange =
|
|
13743
|
-
await
|
|
13753
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => fc(this.syncEngine, t, 1 /* SharedClientState */),
|
|
13754
|
+
this.remoteStore.remoteSyncer.handleCredentialChange = bc.bind(null, this.syncEngine),
|
|
13755
|
+
await $o(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
13744
13756
|
}
|
|
13745
13757
|
createEventManager(t) {
|
|
13746
|
-
return new
|
|
13758
|
+
return new jo;
|
|
13747
13759
|
}
|
|
13748
13760
|
createDatastore(t) {
|
|
13749
13761
|
const e = eo(t.databaseInfo.databaseId), n = (s = t.databaseInfo, new Xr(s));
|
|
@@ -13753,7 +13765,7 @@ class Fc {
|
|
|
13753
13765
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
13754
13766
|
}
|
|
13755
13767
|
createRemoteStore(t) {
|
|
13756
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t =>
|
|
13768
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => fc(this.syncEngine, t, 0 /* RemoteStore */),
|
|
13757
13769
|
r = Hr.Pt() ? new Hr : new zr, new ao(e, n, s, i, r);
|
|
13758
13770
|
var e, n, s, i, r;
|
|
13759
13771
|
/** Re-enables the network. Idempotent. */ }
|
|
@@ -13761,7 +13773,7 @@ class Fc {
|
|
|
13761
13773
|
return function(t, e, n,
|
|
13762
13774
|
// PORTING NOTE: Manages state synchronization in multi-tab environments.
|
|
13763
13775
|
s, i, r, o) {
|
|
13764
|
-
const c = new
|
|
13776
|
+
const c = new oc(t, e, n, s, i, r);
|
|
13765
13777
|
return o && (c.Wo = !0), c;
|
|
13766
13778
|
}(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
|
|
13767
13779
|
}
|
|
@@ -13804,7 +13816,7 @@ class Fc {
|
|
|
13804
13816
|
* @param bytesPerRead - How many bytes each `read()` from the returned reader
|
|
13805
13817
|
* will read.
|
|
13806
13818
|
*/
|
|
13807
|
-
function
|
|
13819
|
+
function Kc(t, e = 10240) {
|
|
13808
13820
|
let n = 0;
|
|
13809
13821
|
// The TypeScript definition for ReadableStreamReader changed. We use
|
|
13810
13822
|
// `any` here to allow this code to compile with different versions.
|
|
@@ -13870,7 +13882,7 @@ function qc(t, e = 10240) {
|
|
|
13870
13882
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
13871
13883
|
* causes events scheduled to no longer be raised.
|
|
13872
13884
|
*/
|
|
13873
|
-
class
|
|
13885
|
+
class jc {
|
|
13874
13886
|
constructor(t) {
|
|
13875
13887
|
this.observer = t,
|
|
13876
13888
|
/**
|
|
@@ -13916,7 +13928,7 @@ class Kc {
|
|
|
13916
13928
|
*
|
|
13917
13929
|
* Takes a bundle stream or buffer, and presents abstractions to read bundled
|
|
13918
13930
|
* elements out of the underlying content.
|
|
13919
|
-
*/ class
|
|
13931
|
+
*/ class Qc {
|
|
13920
13932
|
constructor(
|
|
13921
13933
|
/** The reader to read from underlying binary bundle data source. */
|
|
13922
13934
|
t, e) {
|
|
@@ -13958,7 +13970,7 @@ class Kc {
|
|
|
13958
13970
|
const e = this.ic.decode(t), n = Number(e);
|
|
13959
13971
|
isNaN(n) && this.cc(`length string (${e}) is not valid number`);
|
|
13960
13972
|
const s = await this.ac(n);
|
|
13961
|
-
return new
|
|
13973
|
+
return new Yo(JSON.parse(s), t.length + n);
|
|
13962
13974
|
}
|
|
13963
13975
|
/** First index of '{' from the underlying buffer. */ uc() {
|
|
13964
13976
|
return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
|
|
@@ -14033,7 +14045,7 @@ class Kc {
|
|
|
14033
14045
|
* Internal transaction object responsible for accumulating the mutations to
|
|
14034
14046
|
* perform and the base versions for any documents read.
|
|
14035
14047
|
*/
|
|
14036
|
-
class
|
|
14048
|
+
class Wc {
|
|
14037
14049
|
constructor(t) {
|
|
14038
14050
|
this.datastore = t,
|
|
14039
14051
|
// The version of each document that was read during this transaction.
|
|
@@ -14174,7 +14186,7 @@ class Qc {
|
|
|
14174
14186
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
14175
14187
|
* with backoff.
|
|
14176
14188
|
*/
|
|
14177
|
-
class
|
|
14189
|
+
class Gc {
|
|
14178
14190
|
constructor(t, e, n, s) {
|
|
14179
14191
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
|
|
14180
14192
|
this.lc = 5, this.ur = new no(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
@@ -14184,7 +14196,7 @@ class Wc {
|
|
|
14184
14196
|
}
|
|
14185
14197
|
fc() {
|
|
14186
14198
|
this.ur.Zi((async () => {
|
|
14187
|
-
const t = new
|
|
14199
|
+
const t = new Wc(this.datastore), e = this.dc(t);
|
|
14188
14200
|
e && e.then((e => {
|
|
14189
14201
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
14190
14202
|
this.deferred.resolve(e);
|
|
@@ -14242,7 +14254,7 @@ class Wc {
|
|
|
14242
14254
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
14243
14255
|
* async queue that is shared by all of the other components in the system.
|
|
14244
14256
|
*/
|
|
14245
|
-
class
|
|
14257
|
+
class zc {
|
|
14246
14258
|
constructor(t, e,
|
|
14247
14259
|
/**
|
|
14248
14260
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -14255,12 +14267,11 @@ class Gc {
|
|
|
14255
14267
|
n, s) {
|
|
14256
14268
|
this.authCredentials = t, this.appCheckCredentials = e, this.asyncQueue = n, this.databaseInfo = s,
|
|
14257
14269
|
this.user = C.UNAUTHENTICATED, this.clientId = it.A(), this.authCredentialListener = () => Promise.resolve(),
|
|
14258
|
-
this.authCredentials.start(n, (async t => {
|
|
14270
|
+
this.appCheckCredentialListener = () => Promise.resolve(), this.authCredentials.start(n, (async t => {
|
|
14259
14271
|
O("FirestoreClient", "Received user=", t.uid), await this.authCredentialListener(t),
|
|
14260
14272
|
this.user = t;
|
|
14261
|
-
})),
|
|
14262
|
-
|
|
14263
|
-
this.appCheckCredentials.start(n, (() => Promise.resolve()));
|
|
14273
|
+
})), this.appCheckCredentials.start(n, (t => (O("FirestoreClient", "Received new app check token=", t),
|
|
14274
|
+
this.appCheckCredentialListener(t, this.user))));
|
|
14264
14275
|
}
|
|
14265
14276
|
async getConfiguration() {
|
|
14266
14277
|
return {
|
|
@@ -14276,6 +14287,9 @@ class Gc {
|
|
|
14276
14287
|
setCredentialChangeListener(t) {
|
|
14277
14288
|
this.authCredentialListener = t;
|
|
14278
14289
|
}
|
|
14290
|
+
setAppCheckTokenChangeListener(t) {
|
|
14291
|
+
this.appCheckCredentialListener = t;
|
|
14292
|
+
}
|
|
14279
14293
|
/**
|
|
14280
14294
|
* Checks that the client has not been terminated. Ensures that other methods on
|
|
14281
14295
|
* this class cannot be called after the client is terminated.
|
|
@@ -14293,14 +14307,14 @@ class Gc {
|
|
|
14293
14307
|
// tokens.
|
|
14294
14308
|
this.authCredentials.shutdown(), this.appCheckCredentials.shutdown(), t.resolve();
|
|
14295
14309
|
} catch (e) {
|
|
14296
|
-
const n =
|
|
14310
|
+
const n = Lo(e, "Failed to shutdown persistence");
|
|
14297
14311
|
t.reject(n);
|
|
14298
14312
|
}
|
|
14299
14313
|
})), t.promise;
|
|
14300
14314
|
}
|
|
14301
14315
|
}
|
|
14302
14316
|
|
|
14303
|
-
async function
|
|
14317
|
+
async function Hc(t, e) {
|
|
14304
14318
|
t.asyncQueue.verifyOperationInProgress(), O("FirestoreClient", "Initializing OfflineComponentProvider");
|
|
14305
14319
|
const n = await t.getConfiguration();
|
|
14306
14320
|
await e.initialize(n);
|
|
@@ -14313,63 +14327,53 @@ async function zc(t, e) {
|
|
|
14313
14327
|
e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
|
|
14314
14328
|
}
|
|
14315
14329
|
|
|
14316
|
-
async function
|
|
14330
|
+
async function Jc(t, e) {
|
|
14317
14331
|
t.asyncQueue.verifyOperationInProgress();
|
|
14318
|
-
const n = await
|
|
14332
|
+
const n = await Yc(t);
|
|
14319
14333
|
O("FirestoreClient", "Initializing OnlineComponentProvider");
|
|
14320
14334
|
const s = await t.getConfiguration();
|
|
14321
14335
|
await e.initialize(n, s),
|
|
14322
14336
|
// The CredentialChangeListener of the online component provider takes
|
|
14323
14337
|
// precedence over the offline component provider.
|
|
14324
|
-
t.setCredentialChangeListener((t =>
|
|
14325
|
-
|
|
14326
|
-
n.asyncQueue.verifyOperationInProgress(), O("RemoteStore", "RemoteStore received new credentials");
|
|
14327
|
-
const s = yo(n);
|
|
14328
|
-
// Tear down and re-create our network streams. This will ensure we get a
|
|
14329
|
-
// fresh auth token for the new user and re-fill the write pipeline with
|
|
14330
|
-
// new mutations from the LocalStore (since mutations are per-user).
|
|
14331
|
-
n.Gr.add(3 /* CredentialChange */), await ho(n), s &&
|
|
14332
|
-
// Don't set the network status to Unknown if we are offline.
|
|
14333
|
-
n.Jr.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
14334
|
-
n.Gr.delete(3 /* CredentialChange */), await uo(n);
|
|
14335
|
-
}(e.remoteStore, t))), t.onlineComponents = e;
|
|
14336
|
-
}
|
|
14337
|
-
|
|
14338
|
-
async function Jc(t) {
|
|
14339
|
-
return t.offlineComponents || (O("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
14340
|
-
await zc(t, new Fc)), t.offlineComponents;
|
|
14338
|
+
t.setCredentialChangeListener((t => xo(e.remoteStore, t))), t.setAppCheckTokenChangeListener(((t, n) => xo(e.remoteStore, n))),
|
|
14339
|
+
t.onlineComponents = e;
|
|
14341
14340
|
}
|
|
14342
14341
|
|
|
14343
14342
|
async function Yc(t) {
|
|
14344
|
-
return t.
|
|
14345
|
-
await Hc(t, new
|
|
14343
|
+
return t.offlineComponents || (O("FirestoreClient", "Using default OfflineComponentProvider"),
|
|
14344
|
+
await Hc(t, new Lc)), t.offlineComponents;
|
|
14346
14345
|
}
|
|
14347
14346
|
|
|
14348
|
-
function Xc(t) {
|
|
14349
|
-
return
|
|
14347
|
+
async function Xc(t) {
|
|
14348
|
+
return t.onlineComponents || (O("FirestoreClient", "Using default OnlineComponentProvider"),
|
|
14349
|
+
await Jc(t, new qc)), t.onlineComponents;
|
|
14350
14350
|
}
|
|
14351
14351
|
|
|
14352
14352
|
function Zc(t) {
|
|
14353
|
-
return
|
|
14353
|
+
return Yc(t).then((t => t.persistence));
|
|
14354
14354
|
}
|
|
14355
14355
|
|
|
14356
14356
|
function ta(t) {
|
|
14357
|
-
return Yc(t).then((t => t.
|
|
14357
|
+
return Yc(t).then((t => t.localStore));
|
|
14358
14358
|
}
|
|
14359
14359
|
|
|
14360
14360
|
function ea(t) {
|
|
14361
|
-
return
|
|
14361
|
+
return Xc(t).then((t => t.remoteStore));
|
|
14362
|
+
}
|
|
14363
|
+
|
|
14364
|
+
function na(t) {
|
|
14365
|
+
return Xc(t).then((t => t.syncEngine));
|
|
14362
14366
|
}
|
|
14363
14367
|
|
|
14364
|
-
async function
|
|
14365
|
-
const e = await
|
|
14366
|
-
return n.onListen =
|
|
14368
|
+
async function sa(t) {
|
|
14369
|
+
const e = await Xc(t), n = e.eventManager;
|
|
14370
|
+
return n.onListen = cc.bind(null, e.syncEngine), n.onUnlisten = uc.bind(null, e.syncEngine),
|
|
14367
14371
|
n;
|
|
14368
14372
|
}
|
|
14369
14373
|
|
|
14370
|
-
/** Enables the network connection and re-enqueues all pending operations. */ function
|
|
14374
|
+
/** Enables the network connection and re-enqueues all pending operations. */ function ia(t) {
|
|
14371
14375
|
return t.asyncQueue.enqueue((async () => {
|
|
14372
|
-
const e = await
|
|
14376
|
+
const e = await Zc(t), n = await ea(t);
|
|
14373
14377
|
return e.setNetworkEnabled(!0), function(t) {
|
|
14374
14378
|
const e = K(t);
|
|
14375
14379
|
return e.Gr.delete(0 /* UserDisabled */), uo(e);
|
|
@@ -14377,9 +14381,9 @@ async function na(t) {
|
|
|
14377
14381
|
}));
|
|
14378
14382
|
}
|
|
14379
14383
|
|
|
14380
|
-
/** Disables the network connection. Pending operations will not complete. */ function
|
|
14384
|
+
/** Disables the network connection. Pending operations will not complete. */ function ra(t) {
|
|
14381
14385
|
return t.asyncQueue.enqueue((async () => {
|
|
14382
|
-
const e = await
|
|
14386
|
+
const e = await Zc(t), n = await ea(t);
|
|
14383
14387
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
14384
14388
|
const e = K(t);
|
|
14385
14389
|
e.Gr.add(0 /* UserDisabled */), await ho(e),
|
|
@@ -14393,7 +14397,7 @@ async function na(t) {
|
|
|
14393
14397
|
* Returns a Promise that resolves when all writes that were pending at the time
|
|
14394
14398
|
* this method was called received server acknowledgement. An acknowledgement
|
|
14395
14399
|
* can be either acceptance or rejection.
|
|
14396
|
-
*/ function
|
|
14400
|
+
*/ function oa(t, e) {
|
|
14397
14401
|
const n = new W;
|
|
14398
14402
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14399
14403
|
try {
|
|
@@ -14403,24 +14407,24 @@ async function na(t) {
|
|
|
14403
14407
|
}(t, e);
|
|
14404
14408
|
s.isFoundDocument() ? n.resolve(s) : s.isNoDocument() ? n.resolve(null) : n.reject(new Q(j.UNAVAILABLE, "Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)"));
|
|
14405
14409
|
} catch (t) {
|
|
14406
|
-
const s =
|
|
14410
|
+
const s = Lo(t, `Failed to get document '${e} from cache`);
|
|
14407
14411
|
n.reject(s);
|
|
14408
14412
|
}
|
|
14409
14413
|
}
|
|
14410
14414
|
/**
|
|
14411
14415
|
* Retrieves a latency-compensated document from the backend via a
|
|
14412
14416
|
* SnapshotListener.
|
|
14413
|
-
*/ (await
|
|
14417
|
+
*/ (await ta(t), e, n))), n.promise;
|
|
14414
14418
|
}
|
|
14415
14419
|
|
|
14416
|
-
function
|
|
14420
|
+
function ca(t, e, n = {}) {
|
|
14417
14421
|
const s = new W;
|
|
14418
14422
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14419
|
-
const r = new
|
|
14423
|
+
const r = new jc({
|
|
14420
14424
|
next: r => {
|
|
14421
14425
|
// Remove query first before passing event to user to avoid
|
|
14422
14426
|
// user actions affecting the now stale query.
|
|
14423
|
-
e.enqueueAndForget((() =>
|
|
14427
|
+
e.enqueueAndForget((() => Wo(t, o)));
|
|
14424
14428
|
const c = r.docs.has(n);
|
|
14425
14429
|
!c && r.fromCache ?
|
|
14426
14430
|
// TODO(dimond): If we're online and the document doesn't
|
|
@@ -14433,62 +14437,62 @@ function oa(t, e, n = {}) {
|
|
|
14433
14437
|
i.reject(new Q(j.UNAVAILABLE, "Failed to get document because the client is offline.")) : c && r.fromCache && s && "server" === s.source ? i.reject(new Q(j.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
|
|
14434
14438
|
},
|
|
14435
14439
|
error: t => i.reject(t)
|
|
14436
|
-
}), o = new
|
|
14440
|
+
}), o = new Jo(ye(n.path), r, {
|
|
14437
14441
|
includeMetadataChanges: !0,
|
|
14438
14442
|
wo: !0
|
|
14439
14443
|
});
|
|
14440
|
-
return
|
|
14441
|
-
}(await
|
|
14444
|
+
return Qo(t, o);
|
|
14445
|
+
}(await sa(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14442
14446
|
}
|
|
14443
14447
|
|
|
14444
|
-
function
|
|
14448
|
+
function aa(t, e) {
|
|
14445
14449
|
const n = new W;
|
|
14446
14450
|
return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
|
|
14447
14451
|
try {
|
|
14448
14452
|
const s = await Ir(t, e,
|
|
14449
|
-
/* usePreviousResults= */ !0), i = new
|
|
14453
|
+
/* usePreviousResults= */ !0), i = new sc(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
|
|
14450
14454
|
/* updateLimboDocuments= */ !1);
|
|
14451
14455
|
n.resolve(o.snapshot);
|
|
14452
14456
|
} catch (t) {
|
|
14453
|
-
const s =
|
|
14457
|
+
const s = Lo(t, `Failed to execute query '${e} against cache`);
|
|
14454
14458
|
n.reject(s);
|
|
14455
14459
|
}
|
|
14456
14460
|
}
|
|
14457
14461
|
/**
|
|
14458
14462
|
* Retrieves a latency-compensated query snapshot from the backend via a
|
|
14459
14463
|
* SnapshotListener.
|
|
14460
|
-
*/ (await
|
|
14464
|
+
*/ (await ta(t), e, n))), n.promise;
|
|
14461
14465
|
}
|
|
14462
14466
|
|
|
14463
|
-
function
|
|
14467
|
+
function ua(t, e, n = {}) {
|
|
14464
14468
|
const s = new W;
|
|
14465
14469
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
|
|
14466
|
-
const r = new
|
|
14470
|
+
const r = new jc({
|
|
14467
14471
|
next: n => {
|
|
14468
14472
|
// Remove query first before passing event to user to avoid
|
|
14469
14473
|
// user actions affecting the now stale query.
|
|
14470
|
-
e.enqueueAndForget((() =>
|
|
14474
|
+
e.enqueueAndForget((() => Wo(t, o))), n.fromCache && "server" === s.source ? i.reject(new Q(j.UNAVAILABLE, 'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')) : i.resolve(n);
|
|
14471
14475
|
},
|
|
14472
14476
|
error: t => i.reject(t)
|
|
14473
|
-
}), o = new
|
|
14477
|
+
}), o = new Jo(n, r, {
|
|
14474
14478
|
includeMetadataChanges: !0,
|
|
14475
14479
|
wo: !0
|
|
14476
14480
|
});
|
|
14477
|
-
return
|
|
14478
|
-
}(await
|
|
14481
|
+
return Qo(t, o);
|
|
14482
|
+
}(await sa(t), t.asyncQueue, e, n, s))), s.promise;
|
|
14479
14483
|
}
|
|
14480
14484
|
|
|
14481
|
-
function
|
|
14482
|
-
const n = new
|
|
14485
|
+
function ha(t, e) {
|
|
14486
|
+
const n = new jc(e);
|
|
14483
14487
|
return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14484
14488
|
K(t).io.add(e),
|
|
14485
14489
|
// Immediately fire an initial event, indicating all existing listeners
|
|
14486
14490
|
// are in-sync.
|
|
14487
14491
|
e.next();
|
|
14488
|
-
}(await
|
|
14492
|
+
}(await sa(t), n))), () => {
|
|
14489
14493
|
n.nc(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
|
|
14490
14494
|
K(t).io.delete(e);
|
|
14491
|
-
}(await
|
|
14495
|
+
}(await sa(t), n)));
|
|
14492
14496
|
};
|
|
14493
14497
|
}
|
|
14494
14498
|
|
|
@@ -14506,25 +14510,25 @@ function ua(t, e) {
|
|
|
14506
14510
|
* accessed with the transaction will not reflect local changes that have not
|
|
14507
14511
|
* been committed. For this reason, it is required that all reads are
|
|
14508
14512
|
* performed before any writes. Transactions must be performed while online.
|
|
14509
|
-
*/ function
|
|
14513
|
+
*/ function la(t, e) {
|
|
14510
14514
|
const n = new W;
|
|
14511
14515
|
return t.asyncQueue.enqueueAndForget((async () => {
|
|
14512
14516
|
const s = await function(t) {
|
|
14513
|
-
return
|
|
14517
|
+
return Xc(t).then((t => t.datastore));
|
|
14514
14518
|
}(t);
|
|
14515
|
-
new
|
|
14519
|
+
new Gc(t.asyncQueue, s, e, n).run();
|
|
14516
14520
|
})), n.promise;
|
|
14517
14521
|
}
|
|
14518
14522
|
|
|
14519
|
-
function
|
|
14523
|
+
function fa(t, e, n, s) {
|
|
14520
14524
|
const i = function(t, e) {
|
|
14521
14525
|
let n;
|
|
14522
14526
|
n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
|
|
14523
14527
|
return function(t, e) {
|
|
14524
|
-
return new
|
|
14528
|
+
return new Qc(t, e);
|
|
14525
14529
|
}(function(t, e) {
|
|
14526
|
-
if (t instanceof Uint8Array) return
|
|
14527
|
-
if (t instanceof ArrayBuffer) return
|
|
14530
|
+
if (t instanceof Uint8Array) return Kc(t, e);
|
|
14531
|
+
if (t instanceof ArrayBuffer) return Kc(new Uint8Array(t), e);
|
|
14528
14532
|
if (t instanceof ReadableStream) return t.getReader();
|
|
14529
14533
|
throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
|
|
14530
14534
|
}(n), e);
|
|
@@ -14546,18 +14550,18 @@ function la(t, e, n, s) {
|
|
|
14546
14550
|
* limitations under the License.
|
|
14547
14551
|
*/ (n, eo(e));
|
|
14548
14552
|
t.asyncQueue.enqueueAndForget((async () => {
|
|
14549
|
-
|
|
14553
|
+
Fc(await na(t), i, s);
|
|
14550
14554
|
}));
|
|
14551
14555
|
}
|
|
14552
14556
|
|
|
14553
|
-
function
|
|
14557
|
+
function da(t, e) {
|
|
14554
14558
|
return t.asyncQueue.enqueue((async () => function(t, e) {
|
|
14555
14559
|
const n = K(t);
|
|
14556
14560
|
return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ye.getNamedQuery(t, e)));
|
|
14557
|
-
}(await
|
|
14561
|
+
}(await ta(t), e)));
|
|
14558
14562
|
}
|
|
14559
14563
|
|
|
14560
|
-
class
|
|
14564
|
+
class wa {
|
|
14561
14565
|
/**
|
|
14562
14566
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
14563
14567
|
* persistenceKey.
|
|
@@ -14586,7 +14590,7 @@ class da {
|
|
|
14586
14590
|
* Represents the database ID a Firestore client is associated with.
|
|
14587
14591
|
* @internal
|
|
14588
14592
|
*/
|
|
14589
|
-
class
|
|
14593
|
+
class _a {
|
|
14590
14594
|
constructor(t, e) {
|
|
14591
14595
|
this.projectId = t, this.database = e || "(default)";
|
|
14592
14596
|
}
|
|
@@ -14594,7 +14598,7 @@ class wa {
|
|
|
14594
14598
|
return "(default)" === this.database;
|
|
14595
14599
|
}
|
|
14596
14600
|
isEqual(t) {
|
|
14597
|
-
return t instanceof
|
|
14601
|
+
return t instanceof _a && t.projectId === this.projectId && t.database === this.database;
|
|
14598
14602
|
}
|
|
14599
14603
|
}
|
|
14600
14604
|
|
|
@@ -14613,7 +14617,7 @@ class wa {
|
|
|
14613
14617
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14614
14618
|
* See the License for the specific language governing permissions and
|
|
14615
14619
|
* limitations under the License.
|
|
14616
|
-
*/ const
|
|
14620
|
+
*/ const ma = new Map;
|
|
14617
14621
|
|
|
14618
14622
|
/**
|
|
14619
14623
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -14635,28 +14639,28 @@ class wa {
|
|
|
14635
14639
|
* See the License for the specific language governing permissions and
|
|
14636
14640
|
* limitations under the License.
|
|
14637
14641
|
*/
|
|
14638
|
-
function
|
|
14642
|
+
function ga(t, e, n) {
|
|
14639
14643
|
if (!n) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
|
|
14640
14644
|
}
|
|
14641
14645
|
|
|
14642
14646
|
/**
|
|
14643
14647
|
* Validates that two boolean options are not set at the same time.
|
|
14644
14648
|
* @internal
|
|
14645
|
-
*/ function
|
|
14649
|
+
*/ function ya(t, e, n, s) {
|
|
14646
14650
|
if (!0 === e && !0 === s) throw new Q(j.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
|
|
14647
14651
|
}
|
|
14648
14652
|
|
|
14649
14653
|
/**
|
|
14650
14654
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
14651
14655
|
* an even numbers of segments).
|
|
14652
|
-
*/ function
|
|
14656
|
+
*/ function pa(t) {
|
|
14653
14657
|
if (!Dt.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
|
|
14654
14658
|
}
|
|
14655
14659
|
|
|
14656
14660
|
/**
|
|
14657
14661
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
14658
14662
|
* contains an odd numbers of segments).
|
|
14659
|
-
*/ function
|
|
14663
|
+
*/ function Ta(t) {
|
|
14660
14664
|
if (Dt.isDocumentKey(t)) throw new Q(j.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
|
|
14661
14665
|
}
|
|
14662
14666
|
|
|
@@ -14665,7 +14669,7 @@ function ma(t, e, n) {
|
|
|
14665
14669
|
* (i.e. excludes Array, Date, etc.).
|
|
14666
14670
|
*/
|
|
14667
14671
|
/** Returns a string describing the type / value of the provided input. */
|
|
14668
|
-
function
|
|
14672
|
+
function Ea(t) {
|
|
14669
14673
|
if (void 0 === t) return "undefined";
|
|
14670
14674
|
if (null === t) return "null";
|
|
14671
14675
|
if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
|
|
@@ -14694,7 +14698,7 @@ function Ta(t) {
|
|
|
14694
14698
|
return "function" == typeof t ? "a function" : B();
|
|
14695
14699
|
}
|
|
14696
14700
|
|
|
14697
|
-
function
|
|
14701
|
+
function Ia(t,
|
|
14698
14702
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14699
14703
|
e) {
|
|
14700
14704
|
if ("_delegate" in t && (
|
|
@@ -14703,14 +14707,14 @@ e) {
|
|
|
14703
14707
|
t = t._delegate), !(t instanceof e)) {
|
|
14704
14708
|
if (e.name === t.constructor.name) throw new Q(j.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
14705
14709
|
{
|
|
14706
|
-
const n =
|
|
14710
|
+
const n = Ea(t);
|
|
14707
14711
|
throw new Q(j.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
|
|
14708
14712
|
}
|
|
14709
14713
|
}
|
|
14710
14714
|
return t;
|
|
14711
14715
|
}
|
|
14712
14716
|
|
|
14713
|
-
function
|
|
14717
|
+
function Aa(t, e) {
|
|
14714
14718
|
if (e <= 0) throw new Q(j.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
|
|
14715
14719
|
}
|
|
14716
14720
|
|
|
@@ -14736,7 +14740,7 @@ function Ia(t, e) {
|
|
|
14736
14740
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
14737
14741
|
* defaults can be supplied and the value can be checked for equality.
|
|
14738
14742
|
*/
|
|
14739
|
-
class
|
|
14743
|
+
class Ra {
|
|
14740
14744
|
constructor(t) {
|
|
14741
14745
|
var e;
|
|
14742
14746
|
if (void 0 === t.host) {
|
|
@@ -14749,7 +14753,7 @@ class Aa {
|
|
|
14749
14753
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
14750
14754
|
}
|
|
14751
14755
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
14752
|
-
this.useFetchStreams = !!t.useFetchStreams,
|
|
14756
|
+
this.useFetchStreams = !!t.useFetchStreams, ya("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
|
|
14753
14757
|
}
|
|
14754
14758
|
isEqual(t) {
|
|
14755
14759
|
return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
|
|
@@ -14776,18 +14780,18 @@ class Aa {
|
|
|
14776
14780
|
* The Cloud Firestore service interface.
|
|
14777
14781
|
*
|
|
14778
14782
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
14779
|
-
*/ class
|
|
14783
|
+
*/ class ba {
|
|
14780
14784
|
/** @hideconstructor */
|
|
14781
14785
|
constructor(t, e, n) {
|
|
14782
14786
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
14783
14787
|
/**
|
|
14784
14788
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
14785
14789
|
*/
|
|
14786
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
14787
|
-
this._settingsFrozen = !1, t instanceof
|
|
14790
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ra({}),
|
|
14791
|
+
this._settingsFrozen = !1, t instanceof _a ? this._databaseId = t : (this._app = t,
|
|
14788
14792
|
this._databaseId = function(t) {
|
|
14789
14793
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new Q(j.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
14790
|
-
return new
|
|
14794
|
+
return new _a(t.options.projectId);
|
|
14791
14795
|
}
|
|
14792
14796
|
/**
|
|
14793
14797
|
* Modify this instance to communicate with the Cloud Firestore emulator.
|
|
@@ -14818,7 +14822,7 @@ class Aa {
|
|
|
14818
14822
|
}
|
|
14819
14823
|
_setSettings(t) {
|
|
14820
14824
|
if (this._settingsFrozen) throw new Q(j.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
|
|
14821
|
-
this._settings = new
|
|
14825
|
+
this._settings = new Ra(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
14822
14826
|
if (!t) return new z;
|
|
14823
14827
|
switch (t.type) {
|
|
14824
14828
|
case "gapi":
|
|
@@ -14863,15 +14867,15 @@ class Aa {
|
|
|
14863
14867
|
* when the `Firestore` instance is terminated.
|
|
14864
14868
|
*/
|
|
14865
14869
|
return function(t) {
|
|
14866
|
-
const e =
|
|
14867
|
-
e && (O("ComponentProvider", "Removing Datastore"),
|
|
14870
|
+
const e = ma.get(t);
|
|
14871
|
+
e && (O("ComponentProvider", "Removing Datastore"), ma.delete(t), e.terminate());
|
|
14868
14872
|
}(this), Promise.resolve();
|
|
14869
14873
|
}
|
|
14870
14874
|
}
|
|
14871
14875
|
|
|
14872
|
-
function
|
|
14876
|
+
function Pa(t, e, n, s = {}) {
|
|
14873
14877
|
var i;
|
|
14874
|
-
const r = (t =
|
|
14878
|
+
const r = (t = Ia(t, ba))._getSettings();
|
|
14875
14879
|
if ("firestore.googleapis.com" !== r.host && r.host !== e && F("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
14876
14880
|
t._setSettings(Object.assign(Object.assign({}, r), {
|
|
14877
14881
|
host: `${e}:${n}`,
|
|
@@ -14910,7 +14914,7 @@ function ba(t, e, n, s = {}) {
|
|
|
14910
14914
|
* A `DocumentReference` refers to a document location in a Firestore database
|
|
14911
14915
|
* and can be used to write, read, or listen to the location. The document at
|
|
14912
14916
|
* the referenced location may or may not exist.
|
|
14913
|
-
*/ class
|
|
14917
|
+
*/ class va {
|
|
14914
14918
|
/** @hideconstructor */
|
|
14915
14919
|
constructor(t,
|
|
14916
14920
|
/**
|
|
@@ -14938,17 +14942,17 @@ function ba(t, e, n, s = {}) {
|
|
|
14938
14942
|
/**
|
|
14939
14943
|
* The collection this `DocumentReference` belongs to.
|
|
14940
14944
|
*/ get parent() {
|
|
14941
|
-
return new
|
|
14945
|
+
return new Sa(this.firestore, this.converter, this._key.path.popLast());
|
|
14942
14946
|
}
|
|
14943
14947
|
withConverter(t) {
|
|
14944
|
-
return new
|
|
14948
|
+
return new va(this.firestore, t, this._key);
|
|
14945
14949
|
}
|
|
14946
14950
|
}
|
|
14947
14951
|
|
|
14948
14952
|
/**
|
|
14949
14953
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
14950
14954
|
* construct refined `Query` objects by adding filters and ordering.
|
|
14951
|
-
*/ class
|
|
14955
|
+
*/ class Va {
|
|
14952
14956
|
// This is the lite version of the Query class in the main SDK.
|
|
14953
14957
|
/** @hideconstructor protected */
|
|
14954
14958
|
constructor(t,
|
|
@@ -14961,14 +14965,14 @@ function ba(t, e, n, s = {}) {
|
|
|
14961
14965
|
this.type = "query", this.firestore = t;
|
|
14962
14966
|
}
|
|
14963
14967
|
withConverter(t) {
|
|
14964
|
-
return new
|
|
14968
|
+
return new Va(this.firestore, t, this._query);
|
|
14965
14969
|
}
|
|
14966
14970
|
}
|
|
14967
14971
|
|
|
14968
14972
|
/**
|
|
14969
14973
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
14970
14974
|
* document references, and querying for documents (using {@link query}).
|
|
14971
|
-
*/ class
|
|
14975
|
+
*/ class Sa extends Va {
|
|
14972
14976
|
/** @hideconstructor */
|
|
14973
14977
|
constructor(t, e, n) {
|
|
14974
14978
|
super(t, e, ye(n)), this._path = n,
|
|
@@ -14989,23 +14993,23 @@ function ba(t, e, n, s = {}) {
|
|
|
14989
14993
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
14990
14994
|
*/ get parent() {
|
|
14991
14995
|
const t = this._path.popLast();
|
|
14992
|
-
return t.isEmpty() ? null : new
|
|
14996
|
+
return t.isEmpty() ? null : new va(this.firestore,
|
|
14993
14997
|
/* converter= */ null, new Dt(t));
|
|
14994
14998
|
}
|
|
14995
14999
|
withConverter(t) {
|
|
14996
|
-
return new
|
|
15000
|
+
return new Sa(this.firestore, t, this._path);
|
|
14997
15001
|
}
|
|
14998
15002
|
}
|
|
14999
15003
|
|
|
15000
|
-
function
|
|
15001
|
-
if (t = getModularInstance(t),
|
|
15004
|
+
function Da(t, e, ...n) {
|
|
15005
|
+
if (t = getModularInstance(t), ga("collection", "path", e), t instanceof ba) {
|
|
15002
15006
|
const s = wt.fromString(e, ...n);
|
|
15003
|
-
return
|
|
15007
|
+
return Ta(s), new Sa(t, /* converter= */ null, s);
|
|
15004
15008
|
}
|
|
15005
15009
|
{
|
|
15006
|
-
if (!(t instanceof
|
|
15010
|
+
if (!(t instanceof va || t instanceof Sa)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15007
15011
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15008
|
-
return
|
|
15012
|
+
return Ta(s), new Sa(t.firestore,
|
|
15009
15013
|
/* converter= */ null, s);
|
|
15010
15014
|
}
|
|
15011
15015
|
}
|
|
@@ -15022,9 +15026,9 @@ function Sa(t, e, ...n) {
|
|
|
15022
15026
|
* collection or subcollection with this ID as the last segment of its path
|
|
15023
15027
|
* will be included. Cannot contain a slash.
|
|
15024
15028
|
* @returns The created `Query`.
|
|
15025
|
-
*/ function
|
|
15026
|
-
if (t =
|
|
15027
|
-
return new
|
|
15029
|
+
*/ function Ca(t, e) {
|
|
15030
|
+
if (t = Ia(t, ba), ga("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new Q(j.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
15031
|
+
return new Va(t,
|
|
15028
15032
|
/* converter= */ null,
|
|
15029
15033
|
/**
|
|
15030
15034
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -15035,19 +15039,19 @@ function Sa(t, e, ...n) {
|
|
|
15035
15039
|
}(e));
|
|
15036
15040
|
}
|
|
15037
15041
|
|
|
15038
|
-
function
|
|
15042
|
+
function Na(t, e, ...n) {
|
|
15039
15043
|
if (t = getModularInstance(t),
|
|
15040
15044
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
15041
15045
|
// 'undefined' and 'null'.
|
|
15042
|
-
1 === arguments.length && (e = it.A()),
|
|
15046
|
+
1 === arguments.length && (e = it.A()), ga("doc", "path", e), t instanceof ba) {
|
|
15043
15047
|
const s = wt.fromString(e, ...n);
|
|
15044
|
-
return
|
|
15048
|
+
return pa(s), new va(t,
|
|
15045
15049
|
/* converter= */ null, new Dt(s));
|
|
15046
15050
|
}
|
|
15047
15051
|
{
|
|
15048
|
-
if (!(t instanceof
|
|
15052
|
+
if (!(t instanceof va || t instanceof Sa)) throw new Q(j.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
15049
15053
|
const s = t._path.child(wt.fromString(e, ...n));
|
|
15050
|
-
return
|
|
15054
|
+
return pa(s), new va(t.firestore, t instanceof Sa ? t.converter : null, new Dt(s));
|
|
15051
15055
|
}
|
|
15052
15056
|
}
|
|
15053
15057
|
|
|
@@ -15058,8 +15062,8 @@ function Ca(t, e, ...n) {
|
|
|
15058
15062
|
* @param right - A reference to compare.
|
|
15059
15063
|
* @returns true if the references point to the same location in the same
|
|
15060
15064
|
* Firestore database.
|
|
15061
|
-
*/ function
|
|
15062
|
-
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof
|
|
15065
|
+
*/ function ka(t, e) {
|
|
15066
|
+
return t = getModularInstance(t), e = getModularInstance(e), (t instanceof va || t instanceof Sa) && (e instanceof va || e instanceof Sa) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
|
|
15063
15067
|
}
|
|
15064
15068
|
|
|
15065
15069
|
/**
|
|
@@ -15070,8 +15074,8 @@ function Ca(t, e, ...n) {
|
|
|
15070
15074
|
* @param right - A `Query` to compare.
|
|
15071
15075
|
* @returns true if the references point to the same location in the same
|
|
15072
15076
|
* Firestore database.
|
|
15073
|
-
*/ function
|
|
15074
|
-
return t = getModularInstance(t), e = getModularInstance(e), t instanceof
|
|
15077
|
+
*/ function xa(t, e) {
|
|
15078
|
+
return t = getModularInstance(t), e = getModularInstance(e), t instanceof Va && e instanceof Va && (t.firestore === e.firestore && ve(t._query, e._query) && t.converter === e.converter);
|
|
15075
15079
|
}
|
|
15076
15080
|
|
|
15077
15081
|
/**
|
|
@@ -15089,7 +15093,7 @@ function Ca(t, e, ...n) {
|
|
|
15089
15093
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15090
15094
|
* See the License for the specific language governing permissions and
|
|
15091
15095
|
* limitations under the License.
|
|
15092
|
-
*/ class
|
|
15096
|
+
*/ class $a {
|
|
15093
15097
|
constructor() {
|
|
15094
15098
|
// The last promise in the queue.
|
|
15095
15099
|
this.mc = Promise.resolve(),
|
|
@@ -15226,7 +15230,7 @@ function Ca(t, e, ...n) {
|
|
|
15226
15230
|
this.Pc(),
|
|
15227
15231
|
// Fast-forward delays for timerIds that have been overriden.
|
|
15228
15232
|
this.Rc.indexOf(t) > -1 && (e = 0);
|
|
15229
|
-
const s =
|
|
15233
|
+
const s = Fo.createAndSchedule(this, t, e, n, (t => this.Sc(t)));
|
|
15230
15234
|
return this.Tc.push(s), s;
|
|
15231
15235
|
}
|
|
15232
15236
|
Pc() {
|
|
@@ -15280,7 +15284,7 @@ function Ca(t, e, ...n) {
|
|
|
15280
15284
|
}
|
|
15281
15285
|
}
|
|
15282
15286
|
|
|
15283
|
-
function
|
|
15287
|
+
function Oa(t) {
|
|
15284
15288
|
/**
|
|
15285
15289
|
* Returns true if obj is an object and contains at least one of the specified
|
|
15286
15290
|
* methods.
|
|
@@ -15315,7 +15319,7 @@ function $a(t) {
|
|
|
15315
15319
|
*/ (t, [ "next", "error", "complete" ]);
|
|
15316
15320
|
}
|
|
15317
15321
|
|
|
15318
|
-
class
|
|
15322
|
+
class Ma {
|
|
15319
15323
|
constructor() {
|
|
15320
15324
|
this._progressObserver = {}, this._taskCompletionResolver = new W, this._lastProgress = {
|
|
15321
15325
|
taskState: "Running",
|
|
@@ -15399,27 +15403,27 @@ class Oa {
|
|
|
15399
15403
|
* See the License for the specific language governing permissions and
|
|
15400
15404
|
* limitations under the License.
|
|
15401
15405
|
*/
|
|
15402
|
-
/** DOMException error code constants. */ const
|
|
15406
|
+
/** DOMException error code constants. */ const Fa = -1;
|
|
15403
15407
|
|
|
15404
15408
|
/**
|
|
15405
15409
|
* The Cloud Firestore service interface.
|
|
15406
15410
|
*
|
|
15407
15411
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
15408
15412
|
*/
|
|
15409
|
-
class
|
|
15413
|
+
class La extends ba {
|
|
15410
15414
|
/** @hideconstructor */
|
|
15411
15415
|
constructor(t, e, n) {
|
|
15412
15416
|
super(t, e, n),
|
|
15413
15417
|
/**
|
|
15414
15418
|
* Whether it's a {@link Firestore} or Firestore Lite instance.
|
|
15415
15419
|
*/
|
|
15416
|
-
this.type = "firestore", this._queue = new
|
|
15420
|
+
this.type = "firestore", this._queue = new $a, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
|
|
15417
15421
|
}
|
|
15418
15422
|
_terminate() {
|
|
15419
15423
|
return this._firestoreClient ||
|
|
15420
15424
|
// The client must be initialized to ensure that all subsequent API
|
|
15421
15425
|
// usage throws an exception.
|
|
15422
|
-
|
|
15426
|
+
Ka(this), this._firestoreClient.terminate();
|
|
15423
15427
|
}
|
|
15424
15428
|
}
|
|
15425
15429
|
|
|
@@ -15433,7 +15437,7 @@ class Fa extends Ra {
|
|
|
15433
15437
|
* be associated.
|
|
15434
15438
|
* @param settings - A settings object to configure the {@link Firestore} instance.
|
|
15435
15439
|
* @returns A newly initialized {@link Firestore} instance.
|
|
15436
|
-
*/ function
|
|
15440
|
+
*/ function Ba(t, e) {
|
|
15437
15441
|
const n = _getProvider(t, "firestore");
|
|
15438
15442
|
if (n.isInitialized()) {
|
|
15439
15443
|
const t = n.getImmediate(), s = n.getOptions();
|
|
@@ -15454,22 +15458,22 @@ class Fa extends Ra {
|
|
|
15454
15458
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
|
|
15455
15459
|
* instance is associated with.
|
|
15456
15460
|
* @returns The {@link Firestore} instance of the provided app.
|
|
15457
|
-
*/ function
|
|
15461
|
+
*/ function Ua(e = getApp()) {
|
|
15458
15462
|
return _getProvider(e, "firestore").getImmediate();
|
|
15459
15463
|
}
|
|
15460
15464
|
|
|
15461
15465
|
/**
|
|
15462
15466
|
* @internal
|
|
15463
|
-
*/ function
|
|
15464
|
-
return t._firestoreClient ||
|
|
15467
|
+
*/ function qa(t) {
|
|
15468
|
+
return t._firestoreClient || Ka(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
|
|
15465
15469
|
}
|
|
15466
15470
|
|
|
15467
|
-
function
|
|
15471
|
+
function Ka(t) {
|
|
15468
15472
|
var e;
|
|
15469
15473
|
const n = t._freezeSettings(), s = function(t, e, n, s) {
|
|
15470
|
-
return new
|
|
15474
|
+
return new wa(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
|
|
15471
15475
|
}(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
|
|
15472
|
-
t._firestoreClient = new
|
|
15476
|
+
t._firestoreClient = new zc(t._authCredentials, t._appCheckCredentials, t._queue, s);
|
|
15473
15477
|
}
|
|
15474
15478
|
|
|
15475
15479
|
/**
|
|
@@ -15494,10 +15498,10 @@ function qa(t) {
|
|
|
15494
15498
|
* @param persistenceSettings - Optional settings object to configure
|
|
15495
15499
|
* persistence.
|
|
15496
15500
|
* @returns A `Promise` that represents successfully enabling persistent storage.
|
|
15497
|
-
*/ function
|
|
15498
|
-
|
|
15499
|
-
const n =
|
|
15500
|
-
return
|
|
15501
|
+
*/ function ja(t, e) {
|
|
15502
|
+
tu(t = Ia(t, La));
|
|
15503
|
+
const n = qa(t), s = t._freezeSettings(), i = new qc;
|
|
15504
|
+
return Wa(n, i, new Bc(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
|
|
15501
15505
|
}
|
|
15502
15506
|
|
|
15503
15507
|
/**
|
|
@@ -15521,10 +15525,10 @@ function qa(t) {
|
|
|
15521
15525
|
* @param firestore - The {@link Firestore} instance to enable persistence for.
|
|
15522
15526
|
* @returns A `Promise` that represents successfully enabling persistent
|
|
15523
15527
|
* storage.
|
|
15524
|
-
*/ function
|
|
15525
|
-
|
|
15526
|
-
const e =
|
|
15527
|
-
return
|
|
15528
|
+
*/ function Qa(t) {
|
|
15529
|
+
tu(t = Ia(t, La));
|
|
15530
|
+
const e = qa(t), n = t._freezeSettings(), s = new qc;
|
|
15531
|
+
return Wa(e, s, new Uc(s, n.cacheSizeBytes));
|
|
15528
15532
|
}
|
|
15529
15533
|
|
|
15530
15534
|
/**
|
|
@@ -15532,11 +15536,11 @@ function qa(t) {
|
|
|
15532
15536
|
* If the operation fails with a recoverable error (see
|
|
15533
15537
|
* `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
|
|
15534
15538
|
* but the client remains usable.
|
|
15535
|
-
*/ function
|
|
15539
|
+
*/ function Wa(t, e, n) {
|
|
15536
15540
|
const s = new W;
|
|
15537
15541
|
return t.asyncQueue.enqueue((async () => {
|
|
15538
15542
|
try {
|
|
15539
|
-
await
|
|
15543
|
+
await Hc(t, n), await Jc(t, e), s.resolve();
|
|
15540
15544
|
} catch (t) {
|
|
15541
15545
|
if (!
|
|
15542
15546
|
/**
|
|
@@ -15590,7 +15594,7 @@ function qa(t) {
|
|
|
15590
15594
|
})).then((() => s.promise));
|
|
15591
15595
|
}
|
|
15592
15596
|
|
|
15593
|
-
function
|
|
15597
|
+
function Ga(t) {
|
|
15594
15598
|
if (t._initialized && !t._terminated) throw new Q(j.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
|
|
15595
15599
|
const e = new W;
|
|
15596
15600
|
return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
|
|
@@ -15621,11 +15625,11 @@ function Wa(t) {
|
|
|
15621
15625
|
*
|
|
15622
15626
|
* @returns A `Promise` which resolves when all currently pending writes have been
|
|
15623
15627
|
* acknowledged by the backend.
|
|
15624
|
-
*/ function
|
|
15628
|
+
*/ function za(t) {
|
|
15625
15629
|
return function(t) {
|
|
15626
15630
|
const e = new W;
|
|
15627
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
15628
|
-
}(
|
|
15631
|
+
return t.asyncQueue.enqueueAndForget((async () => mc(await na(t), e))), e.promise;
|
|
15632
|
+
}(qa(t = Ia(t, La)));
|
|
15629
15633
|
}
|
|
15630
15634
|
|
|
15631
15635
|
/**
|
|
@@ -15633,8 +15637,8 @@ function Wa(t) {
|
|
|
15633
15637
|
* call to {@link disableNetwork}.
|
|
15634
15638
|
*
|
|
15635
15639
|
* @returns A `Promise` that is resolved once the network has been enabled.
|
|
15636
|
-
*/ function
|
|
15637
|
-
return
|
|
15640
|
+
*/ function Ha(t) {
|
|
15641
|
+
return ia(qa(t = Ia(t, La)));
|
|
15638
15642
|
}
|
|
15639
15643
|
|
|
15640
15644
|
/**
|
|
@@ -15644,8 +15648,8 @@ function Wa(t) {
|
|
|
15644
15648
|
* operations will be queued until the network is restored.
|
|
15645
15649
|
*
|
|
15646
15650
|
* @returns A `Promise` that is resolved once the network has been disabled.
|
|
15647
|
-
*/ function
|
|
15648
|
-
return
|
|
15651
|
+
*/ function Ja(t) {
|
|
15652
|
+
return ra(qa(t = Ia(t, La)));
|
|
15649
15653
|
}
|
|
15650
15654
|
|
|
15651
15655
|
/**
|
|
@@ -15669,36 +15673,41 @@ function Wa(t) {
|
|
|
15669
15673
|
*
|
|
15670
15674
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
15671
15675
|
* terminated.
|
|
15672
|
-
*/ function
|
|
15676
|
+
*/ function Ya(t) {
|
|
15673
15677
|
return _removeServiceInstance(t.app, "firestore"), t._delete();
|
|
15674
15678
|
}
|
|
15675
15679
|
|
|
15676
15680
|
/**
|
|
15677
15681
|
* Loads a Firestore bundle into the local cache.
|
|
15678
15682
|
*
|
|
15679
|
-
* @param firestore - The {@link Firestore} instance to load bundles for
|
|
15680
|
-
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
15681
|
-
*
|
|
15683
|
+
* @param firestore - The {@link Firestore} instance to load bundles for.
|
|
15684
|
+
* @param bundleData - An object representing the bundle to be loaded. Valid
|
|
15685
|
+
* objects are `ArrayBuffer`, `ReadableStream<Uint8Array>` or `string`.
|
|
15682
15686
|
*
|
|
15683
|
-
* @returns
|
|
15684
|
-
*
|
|
15685
|
-
*
|
|
15686
|
-
*/ function
|
|
15687
|
-
const n =
|
|
15688
|
-
return
|
|
15687
|
+
* @returns A `LoadBundleTask` object, which notifies callers with progress
|
|
15688
|
+
* updates, and completion or error events. It can be used as a
|
|
15689
|
+
* `Promise<LoadBundleTaskProgress>`.
|
|
15690
|
+
*/ function Xa(t, e) {
|
|
15691
|
+
const n = qa(t = Ia(t, La)), s = new Ma;
|
|
15692
|
+
return fa(n, t._databaseId, e, s), s;
|
|
15689
15693
|
}
|
|
15690
15694
|
|
|
15691
15695
|
/**
|
|
15692
|
-
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
15696
|
+
* Reads a Firestore {@link Query} from local cache, identified by the given
|
|
15697
|
+
* name.
|
|
15693
15698
|
*
|
|
15694
15699
|
* The named queries are packaged into bundles on the server side (along
|
|
15695
|
-
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
15696
|
-
* cache, use this method to extract a {@link Query} by name.
|
|
15697
|
-
|
|
15698
|
-
|
|
15700
|
+
* with resulting documents), and loaded to local cache using `loadBundle`. Once
|
|
15701
|
+
* in local cache, use this method to extract a {@link Query} by name.
|
|
15702
|
+
*
|
|
15703
|
+
* @param firestore - The {@link Firestore} instance to read the query from.
|
|
15704
|
+
* @param name - The name of the query.
|
|
15705
|
+
* @returns A `Promise` that is resolved with the Query or `null`.
|
|
15706
|
+
*/ function Za(t, e) {
|
|
15707
|
+
return da(qa(t = Ia(t, La)), e).then((e => e ? new Va(t, null, e.query) : null));
|
|
15699
15708
|
}
|
|
15700
15709
|
|
|
15701
|
-
function
|
|
15710
|
+
function tu(t) {
|
|
15702
15711
|
if (t._initialized || t._terminated) throw new Q(j.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only enable persistence before calling any other methods on a Firestore object.");
|
|
15703
15712
|
}
|
|
15704
15713
|
|
|
@@ -15742,7 +15751,7 @@ function Za(t) {
|
|
|
15742
15751
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
15743
15752
|
* name is provided, the path will point to a nested field in a document.
|
|
15744
15753
|
*/
|
|
15745
|
-
class
|
|
15754
|
+
class eu {
|
|
15746
15755
|
/**
|
|
15747
15756
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
15748
15757
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -15766,8 +15775,8 @@ class tu {
|
|
|
15766
15775
|
/**
|
|
15767
15776
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
15768
15777
|
* It can be used in queries to sort or filter by the document ID.
|
|
15769
|
-
*/ function
|
|
15770
|
-
return new
|
|
15778
|
+
*/ function nu() {
|
|
15779
|
+
return new eu("__name__");
|
|
15771
15780
|
}
|
|
15772
15781
|
|
|
15773
15782
|
/**
|
|
@@ -15788,7 +15797,7 @@ class tu {
|
|
|
15788
15797
|
*/
|
|
15789
15798
|
/**
|
|
15790
15799
|
* An immutable object representing an array of bytes.
|
|
15791
|
-
*/ class
|
|
15800
|
+
*/ class su {
|
|
15792
15801
|
/** @hideconstructor */
|
|
15793
15802
|
constructor(t) {
|
|
15794
15803
|
this._byteString = t;
|
|
@@ -15800,7 +15809,7 @@ class tu {
|
|
|
15800
15809
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
15801
15810
|
*/ static fromBase64String(t) {
|
|
15802
15811
|
try {
|
|
15803
|
-
return new
|
|
15812
|
+
return new su(pt.fromBase64String(t));
|
|
15804
15813
|
} catch (t) {
|
|
15805
15814
|
throw new Q(j.INVALID_ARGUMENT, "Failed to construct data from Base64 string: " + t);
|
|
15806
15815
|
}
|
|
@@ -15810,7 +15819,7 @@ class tu {
|
|
|
15810
15819
|
*
|
|
15811
15820
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
15812
15821
|
*/ static fromUint8Array(t) {
|
|
15813
|
-
return new
|
|
15822
|
+
return new su(pt.fromUint8Array(t));
|
|
15814
15823
|
}
|
|
15815
15824
|
/**
|
|
15816
15825
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -15862,7 +15871,7 @@ class tu {
|
|
|
15862
15871
|
/**
|
|
15863
15872
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
15864
15873
|
* or `update()`.
|
|
15865
|
-
*/ class
|
|
15874
|
+
*/ class iu {
|
|
15866
15875
|
/**
|
|
15867
15876
|
* @param _methodName - The public API endpoint that returns this class.
|
|
15868
15877
|
* @hideconstructor
|
|
@@ -15894,7 +15903,7 @@ class tu {
|
|
|
15894
15903
|
*
|
|
15895
15904
|
* Latitude values are in the range of [-90, 90].
|
|
15896
15905
|
* Longitude values are in the range of [-180, 180].
|
|
15897
|
-
*/ class
|
|
15906
|
+
*/ class ru {
|
|
15898
15907
|
/**
|
|
15899
15908
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
15900
15909
|
* longitude values.
|
|
@@ -15953,9 +15962,9 @@ class tu {
|
|
|
15953
15962
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15954
15963
|
* See the License for the specific language governing permissions and
|
|
15955
15964
|
* limitations under the License.
|
|
15956
|
-
*/ const
|
|
15965
|
+
*/ const ou = /^__.*__$/;
|
|
15957
15966
|
|
|
15958
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
15967
|
+
/** The result of parsing document data (e.g. for a setData call). */ class cu {
|
|
15959
15968
|
constructor(t, e, n) {
|
|
15960
15969
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
15961
15970
|
}
|
|
@@ -15964,7 +15973,7 @@ class tu {
|
|
|
15964
15973
|
}
|
|
15965
15974
|
}
|
|
15966
15975
|
|
|
15967
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
15976
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class au {
|
|
15968
15977
|
constructor(t,
|
|
15969
15978
|
// The fieldMask does not include document transforms.
|
|
15970
15979
|
e, n) {
|
|
@@ -15975,7 +15984,7 @@ class tu {
|
|
|
15975
15984
|
}
|
|
15976
15985
|
}
|
|
15977
15986
|
|
|
15978
|
-
function
|
|
15987
|
+
function uu(t) {
|
|
15979
15988
|
switch (t) {
|
|
15980
15989
|
case 0 /* Set */ :
|
|
15981
15990
|
// fall through
|
|
@@ -15993,7 +16002,7 @@ function au(t) {
|
|
|
15993
16002
|
}
|
|
15994
16003
|
}
|
|
15995
16004
|
|
|
15996
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
16005
|
+
/** A "context" object passed around while parsing user data. */ class hu {
|
|
15997
16006
|
/**
|
|
15998
16007
|
* Initializes a ParseContext with the given source and path.
|
|
15999
16008
|
*
|
|
@@ -16025,7 +16034,7 @@ function au(t) {
|
|
|
16025
16034
|
return this.settings.$c;
|
|
16026
16035
|
}
|
|
16027
16036
|
/** Returns a new context with the specified settings overwritten. */ Oc(t) {
|
|
16028
|
-
return new
|
|
16037
|
+
return new hu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
16029
16038
|
}
|
|
16030
16039
|
Mc(t) {
|
|
16031
16040
|
var e;
|
|
@@ -16052,7 +16061,7 @@ function au(t) {
|
|
|
16052
16061
|
});
|
|
16053
16062
|
}
|
|
16054
16063
|
qc(t) {
|
|
16055
|
-
return
|
|
16064
|
+
return Du(t, this.settings.methodName, this.settings.Kc || !1, this.path, this.settings.jc);
|
|
16056
16065
|
}
|
|
16057
16066
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
16058
16067
|
return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
|
|
@@ -16064,19 +16073,19 @@ function au(t) {
|
|
|
16064
16073
|
}
|
|
16065
16074
|
Lc(t) {
|
|
16066
16075
|
if (0 === t.length) throw this.qc("Document fields must not be empty");
|
|
16067
|
-
if (
|
|
16076
|
+
if (uu(this.$c) && ou.test(t)) throw this.qc('Document fields cannot begin and end with "__"');
|
|
16068
16077
|
}
|
|
16069
16078
|
}
|
|
16070
16079
|
|
|
16071
16080
|
/**
|
|
16072
16081
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
16073
16082
|
* classes.
|
|
16074
|
-
*/ class
|
|
16083
|
+
*/ class lu {
|
|
16075
16084
|
constructor(t, e, n) {
|
|
16076
16085
|
this.databaseId = t, this.ignoreUndefinedProperties = e, this.k = n || eo(t);
|
|
16077
16086
|
}
|
|
16078
16087
|
/** Creates a new top-level parse context. */ Qc(t, e, n, s = !1) {
|
|
16079
|
-
return new
|
|
16088
|
+
return new hu({
|
|
16080
16089
|
$c: t,
|
|
16081
16090
|
methodName: e,
|
|
16082
16091
|
jc: n,
|
|
@@ -16087,29 +16096,29 @@ function au(t) {
|
|
|
16087
16096
|
}
|
|
16088
16097
|
}
|
|
16089
16098
|
|
|
16090
|
-
function
|
|
16099
|
+
function fu(t) {
|
|
16091
16100
|
const e = t._freezeSettings(), n = eo(t._databaseId);
|
|
16092
|
-
return new
|
|
16101
|
+
return new lu(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
16093
16102
|
}
|
|
16094
16103
|
|
|
16095
|
-
/** Parse document data from a set() call. */ function
|
|
16104
|
+
/** Parse document data from a set() call. */ function du(t, e, n, s, i, r = {}) {
|
|
16096
16105
|
const o = t.Qc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
16097
|
-
|
|
16098
|
-
const c =
|
|
16106
|
+
Pu("Data must be an object, but it was:", o, s);
|
|
16107
|
+
const c = Ru(s, o);
|
|
16099
16108
|
let a, u;
|
|
16100
16109
|
if (r.merge) a = new gt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
|
|
16101
16110
|
const t = [];
|
|
16102
16111
|
for (const s of r.mergeFields) {
|
|
16103
|
-
const i =
|
|
16112
|
+
const i = vu(e, s, n);
|
|
16104
16113
|
if (!o.contains(i)) throw new Q(j.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
|
|
16105
|
-
|
|
16114
|
+
Cu(t, i) || t.push(i);
|
|
16106
16115
|
}
|
|
16107
16116
|
a = new gt(t), u = o.fieldTransforms.filter((t => a.covers(t.field)));
|
|
16108
16117
|
} else a = null, u = o.fieldTransforms;
|
|
16109
|
-
return new
|
|
16118
|
+
return new cu(new Qt(c), a, u);
|
|
16110
16119
|
}
|
|
16111
16120
|
|
|
16112
|
-
class
|
|
16121
|
+
class wu extends iu {
|
|
16113
16122
|
_toFieldTransform(t) {
|
|
16114
16123
|
if (2 /* MergeSet */ !== t.$c) throw 1 /* Update */ === t.$c ? t.qc(`${this._methodName}() can only appear at the top level of your update data`) : t.qc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
16115
16124
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -16117,7 +16126,7 @@ class du extends su {
|
|
|
16117
16126
|
return t.fieldMask.push(t.path), null;
|
|
16118
16127
|
}
|
|
16119
16128
|
isEqual(t) {
|
|
16120
|
-
return t instanceof
|
|
16129
|
+
return t instanceof wu;
|
|
16121
16130
|
}
|
|
16122
16131
|
}
|
|
16123
16132
|
|
|
@@ -16136,8 +16145,8 @@ class du extends su {
|
|
|
16136
16145
|
* context.
|
|
16137
16146
|
* @param context - The parent context.
|
|
16138
16147
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
16139
|
-
*/ function
|
|
16140
|
-
return new
|
|
16148
|
+
*/ function _u(t, e, n) {
|
|
16149
|
+
return new hu({
|
|
16141
16150
|
$c: 3 /* Argument */ ,
|
|
16142
16151
|
jc: e.settings.jc,
|
|
16143
16152
|
methodName: t._methodName,
|
|
@@ -16145,22 +16154,22 @@ class du extends su {
|
|
|
16145
16154
|
}, e.databaseId, e.k, e.ignoreUndefinedProperties);
|
|
16146
16155
|
}
|
|
16147
16156
|
|
|
16148
|
-
class
|
|
16157
|
+
class mu extends iu {
|
|
16149
16158
|
_toFieldTransform(t) {
|
|
16150
16159
|
return new ze(t.path, new Be);
|
|
16151
16160
|
}
|
|
16152
16161
|
isEqual(t) {
|
|
16153
|
-
return t instanceof
|
|
16162
|
+
return t instanceof mu;
|
|
16154
16163
|
}
|
|
16155
16164
|
}
|
|
16156
16165
|
|
|
16157
|
-
class
|
|
16166
|
+
class gu extends iu {
|
|
16158
16167
|
constructor(t, e) {
|
|
16159
16168
|
super(t), this.Wc = e;
|
|
16160
16169
|
}
|
|
16161
16170
|
_toFieldTransform(t) {
|
|
16162
|
-
const e =
|
|
16163
|
-
/*array=*/ !0), n = this.Wc.map((t =>
|
|
16171
|
+
const e = _u(this, t,
|
|
16172
|
+
/*array=*/ !0), n = this.Wc.map((t => Au(t, e))), s = new Ue(n);
|
|
16164
16173
|
return new ze(t.path, s);
|
|
16165
16174
|
}
|
|
16166
16175
|
isEqual(t) {
|
|
@@ -16169,13 +16178,13 @@ class mu extends su {
|
|
|
16169
16178
|
}
|
|
16170
16179
|
}
|
|
16171
16180
|
|
|
16172
|
-
class
|
|
16181
|
+
class yu extends iu {
|
|
16173
16182
|
constructor(t, e) {
|
|
16174
16183
|
super(t), this.Wc = e;
|
|
16175
16184
|
}
|
|
16176
16185
|
_toFieldTransform(t) {
|
|
16177
|
-
const e =
|
|
16178
|
-
/*array=*/ !0), n = this.Wc.map((t =>
|
|
16186
|
+
const e = _u(this, t,
|
|
16187
|
+
/*array=*/ !0), n = this.Wc.map((t => Au(t, e))), s = new Ke(n);
|
|
16179
16188
|
return new ze(t.path, s);
|
|
16180
16189
|
}
|
|
16181
16190
|
isEqual(t) {
|
|
@@ -16184,7 +16193,7 @@ class gu extends su {
|
|
|
16184
16193
|
}
|
|
16185
16194
|
}
|
|
16186
16195
|
|
|
16187
|
-
class
|
|
16196
|
+
class pu extends iu {
|
|
16188
16197
|
constructor(t, e) {
|
|
16189
16198
|
super(t), this.Gc = e;
|
|
16190
16199
|
}
|
|
@@ -16198,50 +16207,50 @@ class yu extends su {
|
|
|
16198
16207
|
}
|
|
16199
16208
|
}
|
|
16200
16209
|
|
|
16201
|
-
/** Parse update data from an update() call. */ function
|
|
16210
|
+
/** Parse update data from an update() call. */ function Tu(t, e, n, s) {
|
|
16202
16211
|
const i = t.Qc(1 /* Update */ , e, n);
|
|
16203
|
-
|
|
16212
|
+
Pu("Data must be an object, but it was:", i, s);
|
|
16204
16213
|
const r = [], o = Qt.empty();
|
|
16205
16214
|
lt(s, ((t, s) => {
|
|
16206
|
-
const c =
|
|
16215
|
+
const c = Su(e, t, n);
|
|
16207
16216
|
// For Compat types, we have to "extract" the underlying types before
|
|
16208
16217
|
// performing validation.
|
|
16209
16218
|
s = getModularInstance(s);
|
|
16210
16219
|
const a = i.Bc(c);
|
|
16211
|
-
if (s instanceof
|
|
16220
|
+
if (s instanceof wu)
|
|
16212
16221
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16213
16222
|
r.push(c); else {
|
|
16214
|
-
const t =
|
|
16223
|
+
const t = Au(s, a);
|
|
16215
16224
|
null != t && (r.push(c), o.set(c, t));
|
|
16216
16225
|
}
|
|
16217
16226
|
}));
|
|
16218
16227
|
const c = new gt(r);
|
|
16219
|
-
return new
|
|
16228
|
+
return new au(o, c, i.fieldTransforms);
|
|
16220
16229
|
}
|
|
16221
16230
|
|
|
16222
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
16223
|
-
const o = t.Qc(1 /* Update */ , e, n), c = [
|
|
16231
|
+
/** Parse update data from a list of field/value arguments. */ function Eu(t, e, n, s, i, r) {
|
|
16232
|
+
const o = t.Qc(1 /* Update */ , e, n), c = [ vu(e, s, n) ], a = [ i ];
|
|
16224
16233
|
if (r.length % 2 != 0) throw new Q(j.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
16225
|
-
for (let t = 0; t < r.length; t += 2) c.push(
|
|
16234
|
+
for (let t = 0; t < r.length; t += 2) c.push(vu(e, r[t])), a.push(r[t + 1]);
|
|
16226
16235
|
const u = [], h = Qt.empty();
|
|
16227
16236
|
// We iterate in reverse order to pick the last value for a field if the
|
|
16228
16237
|
// user specified the field multiple times.
|
|
16229
|
-
for (let t = c.length - 1; t >= 0; --t) if (!
|
|
16238
|
+
for (let t = c.length - 1; t >= 0; --t) if (!Cu(u, c[t])) {
|
|
16230
16239
|
const e = c[t];
|
|
16231
16240
|
let n = a[t];
|
|
16232
16241
|
// For Compat types, we have to "extract" the underlying types before
|
|
16233
16242
|
// performing validation.
|
|
16234
16243
|
n = getModularInstance(n);
|
|
16235
16244
|
const s = o.Bc(e);
|
|
16236
|
-
if (n instanceof
|
|
16245
|
+
if (n instanceof wu)
|
|
16237
16246
|
// Add it to the field mask, but don't add anything to updateData.
|
|
16238
16247
|
u.push(e); else {
|
|
16239
|
-
const t =
|
|
16248
|
+
const t = Au(n, s);
|
|
16240
16249
|
null != t && (u.push(e), h.set(e, t));
|
|
16241
16250
|
}
|
|
16242
16251
|
}
|
|
16243
16252
|
const l = new gt(u);
|
|
16244
|
-
return new
|
|
16253
|
+
return new au(h, l, o.fieldTransforms);
|
|
16245
16254
|
}
|
|
16246
16255
|
|
|
16247
16256
|
/**
|
|
@@ -16250,8 +16259,8 @@ class yu extends su {
|
|
|
16250
16259
|
*
|
|
16251
16260
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
16252
16261
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
16253
|
-
*/ function
|
|
16254
|
-
return
|
|
16262
|
+
*/ function Iu(t, e, n, s = !1) {
|
|
16263
|
+
return Au(n, t.Qc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
16255
16264
|
}
|
|
16256
16265
|
|
|
16257
16266
|
/**
|
|
@@ -16262,12 +16271,12 @@ class yu extends su {
|
|
|
16262
16271
|
* the source of the data being parsed, etc.
|
|
16263
16272
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
16264
16273
|
* that should not be included in the resulting parsed data.
|
|
16265
|
-
*/ function
|
|
16266
|
-
if (
|
|
16274
|
+
*/ function Au(t, e) {
|
|
16275
|
+
if (bu(
|
|
16267
16276
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
16268
16277
|
// from firestore-exp.
|
|
16269
|
-
t = getModularInstance(t))) return
|
|
16270
|
-
if (t instanceof
|
|
16278
|
+
t = getModularInstance(t))) return Pu("Unsupported field value:", e, t), Ru(t, e);
|
|
16279
|
+
if (t instanceof iu)
|
|
16271
16280
|
// FieldValues usually parse into transforms (except deleteField())
|
|
16272
16281
|
// in which case we do not want to include this field in our parsed data
|
|
16273
16282
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -16279,7 +16288,7 @@ class yu extends su {
|
|
|
16279
16288
|
*/
|
|
16280
16289
|
return function(t, e) {
|
|
16281
16290
|
// Sentinels are only supported with writes, and not within arrays.
|
|
16282
|
-
if (!
|
|
16291
|
+
if (!uu(e.$c)) throw e.qc(`${t._methodName}() can only be used with update() and set()`);
|
|
16283
16292
|
if (!e.path) throw e.qc(`${t._methodName}() is not currently supported inside arrays`);
|
|
16284
16293
|
const n = t._toFieldTransform(e);
|
|
16285
16294
|
n && e.fieldTransforms.push(n);
|
|
@@ -16309,7 +16318,7 @@ class yu extends su {
|
|
|
16309
16318
|
const n = [];
|
|
16310
16319
|
let s = 0;
|
|
16311
16320
|
for (const i of t) {
|
|
16312
|
-
let t =
|
|
16321
|
+
let t = Au(i, e.Uc(s));
|
|
16313
16322
|
null == t && (
|
|
16314
16323
|
// Just include nulls in the array for fields being replaced with a
|
|
16315
16324
|
// sentinel.
|
|
@@ -16350,23 +16359,23 @@ class yu extends su {
|
|
|
16350
16359
|
timestampValue: Qn(e.k, n)
|
|
16351
16360
|
};
|
|
16352
16361
|
}
|
|
16353
|
-
if (t instanceof
|
|
16362
|
+
if (t instanceof ru) return {
|
|
16354
16363
|
geoPointValue: {
|
|
16355
16364
|
latitude: t.latitude,
|
|
16356
16365
|
longitude: t.longitude
|
|
16357
16366
|
}
|
|
16358
16367
|
};
|
|
16359
|
-
if (t instanceof
|
|
16368
|
+
if (t instanceof su) return {
|
|
16360
16369
|
bytesValue: Wn(e.k, t._byteString)
|
|
16361
16370
|
};
|
|
16362
|
-
if (t instanceof
|
|
16371
|
+
if (t instanceof va) {
|
|
16363
16372
|
const n = e.databaseId, s = t.firestore._databaseId;
|
|
16364
16373
|
if (!s.isEqual(n)) throw e.qc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
|
|
16365
16374
|
return {
|
|
16366
16375
|
referenceValue: Hn(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
16367
16376
|
};
|
|
16368
16377
|
}
|
|
16369
|
-
throw e.qc(`Unsupported field value: ${
|
|
16378
|
+
throw e.qc(`Unsupported field value: ${Ea(t)}`);
|
|
16370
16379
|
}
|
|
16371
16380
|
/**
|
|
16372
16381
|
* Checks whether an object looks like a JSON object that should be converted
|
|
@@ -16377,13 +16386,13 @@ class yu extends su {
|
|
|
16377
16386
|
*/ (t, e);
|
|
16378
16387
|
}
|
|
16379
16388
|
|
|
16380
|
-
function
|
|
16389
|
+
function Ru(t, e) {
|
|
16381
16390
|
const n = {};
|
|
16382
16391
|
return ft(t) ?
|
|
16383
16392
|
// If we encounter an empty object, we explicitly add it to the update
|
|
16384
16393
|
// mask to ensure that the server creates a map entry.
|
|
16385
16394
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : lt(t, ((t, s) => {
|
|
16386
|
-
const i =
|
|
16395
|
+
const i = Au(s, e.Mc(t));
|
|
16387
16396
|
null != i && (n[t] = i);
|
|
16388
16397
|
})), {
|
|
16389
16398
|
mapValue: {
|
|
@@ -16392,35 +16401,35 @@ function Au(t, e) {
|
|
|
16392
16401
|
};
|
|
16393
16402
|
}
|
|
16394
16403
|
|
|
16395
|
-
function
|
|
16396
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof at || t instanceof
|
|
16404
|
+
function bu(t) {
|
|
16405
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof at || t instanceof ru || t instanceof su || t instanceof va || t instanceof iu);
|
|
16397
16406
|
}
|
|
16398
16407
|
|
|
16399
|
-
function
|
|
16400
|
-
if (!
|
|
16408
|
+
function Pu(t, e, n) {
|
|
16409
|
+
if (!bu(n) || !function(t) {
|
|
16401
16410
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
16402
16411
|
}(n)) {
|
|
16403
|
-
const s =
|
|
16412
|
+
const s = Ea(n);
|
|
16404
16413
|
throw "an object" === s ? e.qc(t + " a custom object") : e.qc(t + " " + s);
|
|
16405
16414
|
}
|
|
16406
16415
|
}
|
|
16407
16416
|
|
|
16408
16417
|
/**
|
|
16409
16418
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
16410
|
-
*/ function
|
|
16419
|
+
*/ function vu(t, e, n) {
|
|
16411
16420
|
if ((
|
|
16412
16421
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
16413
16422
|
// FieldPath.
|
|
16414
|
-
e = getModularInstance(e)) instanceof
|
|
16415
|
-
if ("string" == typeof e) return
|
|
16416
|
-
throw
|
|
16423
|
+
e = getModularInstance(e)) instanceof eu) return e._internalPath;
|
|
16424
|
+
if ("string" == typeof e) return Su(t, e);
|
|
16425
|
+
throw Du("Field path arguments must be of type string or ", t,
|
|
16417
16426
|
/* hasConverter= */ !1,
|
|
16418
16427
|
/* path= */ void 0, n);
|
|
16419
16428
|
}
|
|
16420
16429
|
|
|
16421
16430
|
/**
|
|
16422
16431
|
* Matches any characters in a field path string that are reserved.
|
|
16423
|
-
*/ const
|
|
16432
|
+
*/ const Vu = new RegExp("[~\\*/\\[\\]]");
|
|
16424
16433
|
|
|
16425
16434
|
/**
|
|
16426
16435
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -16430,20 +16439,20 @@ function bu(t, e, n) {
|
|
|
16430
16439
|
* split on dots.
|
|
16431
16440
|
* @param targetDoc - The document against which the field path will be
|
|
16432
16441
|
* evaluated.
|
|
16433
|
-
*/ function
|
|
16434
|
-
if (e.search(
|
|
16442
|
+
*/ function Su(t, e, n) {
|
|
16443
|
+
if (e.search(Vu) >= 0) throw Du(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
16435
16444
|
/* hasConverter= */ !1,
|
|
16436
16445
|
/* path= */ void 0, n);
|
|
16437
16446
|
try {
|
|
16438
|
-
return new
|
|
16447
|
+
return new eu(...e.split("."))._internalPath;
|
|
16439
16448
|
} catch (s) {
|
|
16440
|
-
throw
|
|
16449
|
+
throw Du(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
16441
16450
|
/* hasConverter= */ !1,
|
|
16442
16451
|
/* path= */ void 0, n);
|
|
16443
16452
|
}
|
|
16444
16453
|
}
|
|
16445
16454
|
|
|
16446
|
-
function
|
|
16455
|
+
function Du(t, e, n, s, i) {
|
|
16447
16456
|
const r = s && !s.isEmpty(), o = void 0 !== i;
|
|
16448
16457
|
let c = `Function ${e}() called with invalid data`;
|
|
16449
16458
|
n && (c += " (via `toFirestore()`)"), c += ". ";
|
|
@@ -16452,7 +16461,7 @@ function Su(t, e, n, s, i) {
|
|
|
16452
16461
|
a += ")"), new Q(j.INVALID_ARGUMENT, c + t + a);
|
|
16453
16462
|
}
|
|
16454
16463
|
|
|
16455
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
16464
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Cu(t, e) {
|
|
16456
16465
|
return t.some((t => t.isEqual(e)));
|
|
16457
16466
|
}
|
|
16458
16467
|
|
|
@@ -16480,7 +16489,7 @@ function Su(t, e, n, s, i) {
|
|
|
16480
16489
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
16481
16490
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
16482
16491
|
* explicitly verify a document's existence.
|
|
16483
|
-
*/ class
|
|
16492
|
+
*/ class Nu {
|
|
16484
16493
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
16485
16494
|
// the legacy SDK. The changes are:
|
|
16486
16495
|
// - No support for SnapshotMetadata.
|
|
@@ -16496,7 +16505,7 @@ function Su(t, e, n, s, i) {
|
|
|
16496
16505
|
/**
|
|
16497
16506
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
16498
16507
|
*/ get ref() {
|
|
16499
|
-
return new
|
|
16508
|
+
return new va(this._firestore, this._converter, this._key);
|
|
16500
16509
|
}
|
|
16501
16510
|
/**
|
|
16502
16511
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -16516,7 +16525,7 @@ function Su(t, e, n, s, i) {
|
|
|
16516
16525
|
if (this._converter) {
|
|
16517
16526
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
16518
16527
|
// if a converter has been provided.
|
|
16519
|
-
const t = new
|
|
16528
|
+
const t = new ku(this._firestore, this._userDataWriter, this._key, this._document,
|
|
16520
16529
|
/* converter= */ null);
|
|
16521
16530
|
return this._converter.fromFirestore(t);
|
|
16522
16531
|
}
|
|
@@ -16536,7 +16545,7 @@ function Su(t, e, n, s, i) {
|
|
|
16536
16545
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16537
16546
|
get(t) {
|
|
16538
16547
|
if (this._document) {
|
|
16539
|
-
const e = this._document.data.field(
|
|
16548
|
+
const e = this._document.data.field(xu("DocumentSnapshot.get", t));
|
|
16540
16549
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
16541
16550
|
}
|
|
16542
16551
|
}
|
|
@@ -16552,7 +16561,7 @@ function Su(t, e, n, s, i) {
|
|
|
16552
16561
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
16553
16562
|
* `exists` property will always be true and `data()` will never return
|
|
16554
16563
|
* 'undefined'.
|
|
16555
|
-
*/ class
|
|
16564
|
+
*/ class ku extends Nu {
|
|
16556
16565
|
/**
|
|
16557
16566
|
* Retrieves all fields in the document as an `Object`.
|
|
16558
16567
|
*
|
|
@@ -16566,8 +16575,8 @@ function Su(t, e, n, s, i) {
|
|
|
16566
16575
|
|
|
16567
16576
|
/**
|
|
16568
16577
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
16569
|
-
*/ function
|
|
16570
|
-
return "string" == typeof e ?
|
|
16578
|
+
*/ function xu(t, e) {
|
|
16579
|
+
return "string" == typeof e ? Su(t, e) : e instanceof eu ? e._internalPath : e._delegate._internalPath;
|
|
16571
16580
|
}
|
|
16572
16581
|
|
|
16573
16582
|
/**
|
|
@@ -16588,7 +16597,7 @@ function Su(t, e, n, s, i) {
|
|
|
16588
16597
|
*/
|
|
16589
16598
|
/**
|
|
16590
16599
|
* Metadata about a snapshot, describing the state of the snapshot.
|
|
16591
|
-
*/ class
|
|
16600
|
+
*/ class $u {
|
|
16592
16601
|
/** @hideconstructor */
|
|
16593
16602
|
constructor(t, e) {
|
|
16594
16603
|
this.hasPendingWrites = t, this.fromCache = e;
|
|
@@ -16611,7 +16620,7 @@ function Su(t, e, n, s, i) {
|
|
|
16611
16620
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
16612
16621
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
16613
16622
|
* explicitly verify a document's existence.
|
|
16614
|
-
*/ class
|
|
16623
|
+
*/ class Ou extends Nu {
|
|
16615
16624
|
/** @hideconstructor protected */
|
|
16616
16625
|
constructor(t, e, n, s, i, r) {
|
|
16617
16626
|
super(t, e, n, s, r), this._firestore = t, this._firestoreImpl = t, this.metadata = i;
|
|
@@ -16640,7 +16649,7 @@ function Su(t, e, n, s, i) {
|
|
|
16640
16649
|
if (this._converter) {
|
|
16641
16650
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
16642
16651
|
// if a converter has been provided.
|
|
16643
|
-
const e = new
|
|
16652
|
+
const e = new Mu(this._firestore, this._userDataWriter, this._key, this._document, this.metadata,
|
|
16644
16653
|
/* converter= */ null);
|
|
16645
16654
|
return this._converter.fromFirestore(e, t);
|
|
16646
16655
|
}
|
|
@@ -16667,7 +16676,7 @@ function Su(t, e, n, s, i) {
|
|
|
16667
16676
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16668
16677
|
get(t, e = {}) {
|
|
16669
16678
|
if (this._document) {
|
|
16670
|
-
const n = this._document.data.field(
|
|
16679
|
+
const n = this._document.data.field(xu("DocumentSnapshot.get", t));
|
|
16671
16680
|
if (null !== n) return this._userDataWriter.convertValue(n, e.serverTimestamps);
|
|
16672
16681
|
}
|
|
16673
16682
|
}
|
|
@@ -16683,7 +16692,7 @@ function Su(t, e, n, s, i) {
|
|
|
16683
16692
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
16684
16693
|
* `exists` property will always be true and `data()` will never return
|
|
16685
16694
|
* 'undefined'.
|
|
16686
|
-
*/ class
|
|
16695
|
+
*/ class Mu extends Ou {
|
|
16687
16696
|
/**
|
|
16688
16697
|
* Retrieves all fields in the document as an `Object`.
|
|
16689
16698
|
*
|
|
@@ -16708,10 +16717,10 @@ function Su(t, e, n, s, i) {
|
|
|
16708
16717
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
16709
16718
|
* number of documents can be determined via the `empty` and `size`
|
|
16710
16719
|
* properties.
|
|
16711
|
-
*/ class
|
|
16720
|
+
*/ class Fu {
|
|
16712
16721
|
/** @hideconstructor */
|
|
16713
16722
|
constructor(t, e, n, s) {
|
|
16714
|
-
this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new
|
|
16723
|
+
this._firestore = t, this._userDataWriter = e, this._snapshot = s, this.metadata = new $u(s.hasPendingWrites, s.fromCache),
|
|
16715
16724
|
this.query = n;
|
|
16716
16725
|
}
|
|
16717
16726
|
/** An array of all the documents in the `QuerySnapshot`. */ get docs() {
|
|
@@ -16732,7 +16741,7 @@ function Su(t, e, n, s, i) {
|
|
|
16732
16741
|
* @param thisArg - The `this` binding for the callback.
|
|
16733
16742
|
*/ forEach(t, e) {
|
|
16734
16743
|
this._snapshot.docs.forEach((n => {
|
|
16735
|
-
t.call(e, new
|
|
16744
|
+
t.call(e, new Mu(this._firestore, this._userDataWriter, n.key, n, new $u(this._snapshot.mutatedKeys.has(n.key), this._snapshot.fromCache), this.query.converter));
|
|
16736
16745
|
}));
|
|
16737
16746
|
}
|
|
16738
16747
|
/**
|
|
@@ -16753,7 +16762,7 @@ function Su(t, e, n, s, i) {
|
|
|
16753
16762
|
let e = 0;
|
|
16754
16763
|
return t._snapshot.docChanges.map((n => ({
|
|
16755
16764
|
type: "added",
|
|
16756
|
-
doc: new
|
|
16765
|
+
doc: new Mu(t._firestore, t._userDataWriter, n.doc.key, n.doc, new $u(t._snapshot.mutatedKeys.has(n.doc.key), t._snapshot.fromCache), t.query.converter),
|
|
16757
16766
|
oldIndex: -1,
|
|
16758
16767
|
newIndex: e++
|
|
16759
16768
|
})));
|
|
@@ -16763,11 +16772,11 @@ function Su(t, e, n, s, i) {
|
|
|
16763
16772
|
// to lookup the index of a document.
|
|
16764
16773
|
let n = t._snapshot.oldDocs;
|
|
16765
16774
|
return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
|
|
16766
|
-
const s = new
|
|
16775
|
+
const s = new Mu(t._firestore, t._userDataWriter, e.doc.key, e.doc, new $u(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
16767
16776
|
let i = -1, r = -1;
|
|
16768
16777
|
return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
16769
16778
|
1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)), {
|
|
16770
|
-
type:
|
|
16779
|
+
type: Lu(e.type),
|
|
16771
16780
|
doc: s,
|
|
16772
16781
|
oldIndex: i,
|
|
16773
16782
|
newIndex: r
|
|
@@ -16778,7 +16787,7 @@ function Su(t, e, n, s, i) {
|
|
|
16778
16787
|
}
|
|
16779
16788
|
}
|
|
16780
16789
|
|
|
16781
|
-
function
|
|
16790
|
+
function Lu(t) {
|
|
16782
16791
|
switch (t) {
|
|
16783
16792
|
case 0 /* Added */ :
|
|
16784
16793
|
return "added";
|
|
@@ -16803,8 +16812,8 @@ function Fu(t) {
|
|
|
16803
16812
|
* @param left - A snapshot to compare.
|
|
16804
16813
|
* @param right - A snapshot to compare.
|
|
16805
16814
|
* @returns true if the snapshots are equal.
|
|
16806
|
-
*/ function
|
|
16807
|
-
return t instanceof
|
|
16815
|
+
*/ function Bu(t, e) {
|
|
16816
|
+
return t instanceof Ou && e instanceof Ou ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Fu && e instanceof Fu && (t._firestore === e._firestore && xa(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
|
|
16808
16817
|
}
|
|
16809
16818
|
|
|
16810
16819
|
/**
|
|
@@ -16822,7 +16831,7 @@ function Fu(t) {
|
|
|
16822
16831
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16823
16832
|
* See the License for the specific language governing permissions and
|
|
16824
16833
|
* limitations under the License.
|
|
16825
|
-
*/ function
|
|
16834
|
+
*/ function Uu(t) {
|
|
16826
16835
|
if (Te(t) && 0 === t.explicitOrderBy.length) throw new Q(j.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
16827
16836
|
}
|
|
16828
16837
|
|
|
@@ -16833,7 +16842,7 @@ function Fu(t) {
|
|
|
16833
16842
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
16834
16843
|
* can then be passed to {@link query} to create a new query instance that
|
|
16835
16844
|
* also contains this `QueryConstraint`.
|
|
16836
|
-
*/ class
|
|
16845
|
+
*/ class qu {}
|
|
16837
16846
|
|
|
16838
16847
|
/**
|
|
16839
16848
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -16843,32 +16852,32 @@ function Fu(t) {
|
|
|
16843
16852
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
16844
16853
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
16845
16854
|
* existing or new constraints.
|
|
16846
|
-
*/ function
|
|
16855
|
+
*/ function Ku(t, ...e) {
|
|
16847
16856
|
for (const n of e) t = n._apply(t);
|
|
16848
16857
|
return t;
|
|
16849
16858
|
}
|
|
16850
16859
|
|
|
16851
|
-
class
|
|
16860
|
+
class ju extends qu {
|
|
16852
16861
|
constructor(t, e, n) {
|
|
16853
16862
|
super(), this.zc = t, this.Hc = e, this.Jc = n, this.type = "where";
|
|
16854
16863
|
}
|
|
16855
16864
|
_apply(t) {
|
|
16856
|
-
const e =
|
|
16865
|
+
const e = fu(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
16857
16866
|
let c;
|
|
16858
16867
|
if (i.isKeyField()) {
|
|
16859
16868
|
if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new Q(j.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`);
|
|
16860
16869
|
if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
|
|
16861
|
-
|
|
16870
|
+
rh(o, r);
|
|
16862
16871
|
const e = [];
|
|
16863
|
-
for (const n of o) e.push(
|
|
16872
|
+
for (const n of o) e.push(ih(s, t, n));
|
|
16864
16873
|
c = {
|
|
16865
16874
|
arrayValue: {
|
|
16866
16875
|
values: e
|
|
16867
16876
|
}
|
|
16868
16877
|
};
|
|
16869
|
-
} else c =
|
|
16870
|
-
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r ||
|
|
16871
|
-
c =
|
|
16878
|
+
} else c = ih(s, t, o);
|
|
16879
|
+
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || rh(o, r),
|
|
16880
|
+
c = Iu(n, e, o,
|
|
16872
16881
|
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
16873
16882
|
const a = te.create(i, r, c);
|
|
16874
16883
|
return function(t, e) {
|
|
@@ -16876,7 +16885,7 @@ class Ku extends Uu {
|
|
|
16876
16885
|
const n = Ie(t);
|
|
16877
16886
|
if (null !== n && !n.isEqual(e.field)) throw new Q(j.INVALID_ARGUMENT, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
|
|
16878
16887
|
const s = Ee(t);
|
|
16879
|
-
null !== s &&
|
|
16888
|
+
null !== s && oh(t, e.field, s);
|
|
16880
16889
|
}
|
|
16881
16890
|
const n = function(t, e) {
|
|
16882
16891
|
for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
|
|
@@ -16920,7 +16929,7 @@ class Ku extends Uu {
|
|
|
16920
16929
|
throw n === e.op ? new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new Q(j.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
|
|
16921
16930
|
}(t, a), a;
|
|
16922
16931
|
}(t._query, "where", e, t.firestore._databaseId, this.zc, this.Hc, this.Jc);
|
|
16923
|
-
return new
|
|
16932
|
+
return new Va(t.firestore, t.converter, function(t, e) {
|
|
16924
16933
|
const n = t.filters.concat([ e ]);
|
|
16925
16934
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
16926
16935
|
}(t._query, n));
|
|
@@ -16937,12 +16946,12 @@ class Ku extends Uu {
|
|
|
16937
16946
|
* "<=", "!=").
|
|
16938
16947
|
* @param value - The value for comparison
|
|
16939
16948
|
* @returns The created {@link Query}.
|
|
16940
|
-
*/ function
|
|
16941
|
-
const s = e, i =
|
|
16942
|
-
return new
|
|
16949
|
+
*/ function Qu(t, e, n) {
|
|
16950
|
+
const s = e, i = xu("where", t);
|
|
16951
|
+
return new ju(i, s, n);
|
|
16943
16952
|
}
|
|
16944
16953
|
|
|
16945
|
-
class
|
|
16954
|
+
class Wu extends qu {
|
|
16946
16955
|
constructor(t, e) {
|
|
16947
16956
|
super(), this.zc = t, this.Yc = e, this.type = "orderBy";
|
|
16948
16957
|
}
|
|
@@ -16955,7 +16964,7 @@ class Qu extends Uu {
|
|
|
16955
16964
|
if (null === Ee(t)) {
|
|
16956
16965
|
// This is the first order by. It must match any inequality.
|
|
16957
16966
|
const n = Ie(t);
|
|
16958
|
-
null !== n &&
|
|
16967
|
+
null !== n && oh(t, n, e.field);
|
|
16959
16968
|
}
|
|
16960
16969
|
}(t, s), s;
|
|
16961
16970
|
}
|
|
@@ -16970,7 +16979,7 @@ class Qu extends Uu {
|
|
|
16970
16979
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
16971
16980
|
* server timestamp.
|
|
16972
16981
|
*/ (t._query, this.zc, this.Yc);
|
|
16973
|
-
return new
|
|
16982
|
+
return new Va(t.firestore, t.converter, function(t, e) {
|
|
16974
16983
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
16975
16984
|
const n = t.explicitOrderBy.concat([ e ]);
|
|
16976
16985
|
return new me(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -16986,17 +16995,17 @@ class Qu extends Uu {
|
|
|
16986
16995
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
16987
16996
|
* not specified, order will be ascending.
|
|
16988
16997
|
* @returns The created {@link Query}.
|
|
16989
|
-
*/ function
|
|
16990
|
-
const n = e, s =
|
|
16991
|
-
return new
|
|
16998
|
+
*/ function Gu(t, e = "asc") {
|
|
16999
|
+
const n = e, s = xu("orderBy", t);
|
|
17000
|
+
return new Wu(s, n);
|
|
16992
17001
|
}
|
|
16993
17002
|
|
|
16994
|
-
class
|
|
17003
|
+
class zu extends qu {
|
|
16995
17004
|
constructor(t, e, n) {
|
|
16996
17005
|
super(), this.type = t, this.Xc = e, this.Zc = n;
|
|
16997
17006
|
}
|
|
16998
17007
|
_apply(t) {
|
|
16999
|
-
return new
|
|
17008
|
+
return new Va(t.firestore, t.converter, Pe(t._query, this.Xc, this.Zc));
|
|
17000
17009
|
}
|
|
17001
17010
|
}
|
|
17002
17011
|
|
|
@@ -17005,8 +17014,8 @@ class Gu extends Uu {
|
|
|
17005
17014
|
*
|
|
17006
17015
|
* @param limit - The maximum number of items to return.
|
|
17007
17016
|
* @returns The created {@link Query}.
|
|
17008
|
-
*/ function
|
|
17009
|
-
return
|
|
17017
|
+
*/ function Hu(t) {
|
|
17018
|
+
return Aa("limit", t), new zu("limit", t, "F" /* First */);
|
|
17010
17019
|
}
|
|
17011
17020
|
|
|
17012
17021
|
/**
|
|
@@ -17017,53 +17026,53 @@ class Gu extends Uu {
|
|
|
17017
17026
|
*
|
|
17018
17027
|
* @param limit - The maximum number of items to return.
|
|
17019
17028
|
* @returns The created {@link Query}.
|
|
17020
|
-
*/ function
|
|
17021
|
-
return
|
|
17029
|
+
*/ function Ju(t) {
|
|
17030
|
+
return Aa("limitToLast", t), new zu("limitToLast", t, "L" /* Last */);
|
|
17022
17031
|
}
|
|
17023
17032
|
|
|
17024
|
-
class
|
|
17033
|
+
class Yu extends qu {
|
|
17025
17034
|
constructor(t, e, n) {
|
|
17026
17035
|
super(), this.type = t, this.ta = e, this.ea = n;
|
|
17027
17036
|
}
|
|
17028
17037
|
_apply(t) {
|
|
17029
|
-
const e =
|
|
17030
|
-
return new
|
|
17038
|
+
const e = sh(t, this.type, this.ta, this.ea);
|
|
17039
|
+
return new Va(t.firestore, t.converter, function(t, e) {
|
|
17031
17040
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
17032
17041
|
}(t._query, e));
|
|
17033
17042
|
}
|
|
17034
17043
|
}
|
|
17035
17044
|
|
|
17036
|
-
function
|
|
17037
|
-
return new
|
|
17045
|
+
function Xu(...t) {
|
|
17046
|
+
return new Yu("startAt", t, /*before=*/ !0);
|
|
17038
17047
|
}
|
|
17039
17048
|
|
|
17040
|
-
function
|
|
17041
|
-
return new
|
|
17049
|
+
function Zu(...t) {
|
|
17050
|
+
return new Yu("startAfter", t,
|
|
17042
17051
|
/*before=*/ !1);
|
|
17043
17052
|
}
|
|
17044
17053
|
|
|
17045
|
-
class
|
|
17054
|
+
class th extends qu {
|
|
17046
17055
|
constructor(t, e, n) {
|
|
17047
17056
|
super(), this.type = t, this.ta = e, this.ea = n;
|
|
17048
17057
|
}
|
|
17049
17058
|
_apply(t) {
|
|
17050
|
-
const e =
|
|
17051
|
-
return new
|
|
17059
|
+
const e = sh(t, this.type, this.ta, this.ea);
|
|
17060
|
+
return new Va(t.firestore, t.converter, function(t, e) {
|
|
17052
17061
|
return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
17053
17062
|
}(t._query, e));
|
|
17054
17063
|
}
|
|
17055
17064
|
}
|
|
17056
17065
|
|
|
17057
|
-
function
|
|
17058
|
-
return new
|
|
17066
|
+
function eh(...t) {
|
|
17067
|
+
return new th("endBefore", t, /*before=*/ !0);
|
|
17059
17068
|
}
|
|
17060
17069
|
|
|
17061
|
-
function
|
|
17062
|
-
return new
|
|
17070
|
+
function nh(...t) {
|
|
17071
|
+
return new th("endAt", t, /*before=*/ !1);
|
|
17063
17072
|
}
|
|
17064
17073
|
|
|
17065
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
17066
|
-
if (n[0] = getModularInstance(n[0]), n[0] instanceof
|
|
17074
|
+
/** Helper function to create a bound from a document or fields */ function sh(t, e, n, s) {
|
|
17075
|
+
if (n[0] = getModularInstance(n[0]), n[0] instanceof Nu) return function(t, e, n, s, i) {
|
|
17067
17076
|
if (!s) throw new Q(j.NOT_FOUND, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
|
|
17068
17077
|
const r = [];
|
|
17069
17078
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -17088,7 +17097,7 @@ function eh(...t) {
|
|
|
17088
17097
|
* Converts a list of field values to a `Bound` for the given query.
|
|
17089
17098
|
*/ (t._query, t.firestore._databaseId, e, n[0]._document, s);
|
|
17090
17099
|
{
|
|
17091
|
-
const i =
|
|
17100
|
+
const i = fu(t.firestore);
|
|
17092
17101
|
return function(t, e, n, s, i, r) {
|
|
17093
17102
|
// Use explicit order by's because it has to match the query the user made
|
|
17094
17103
|
const o = t.explicitOrderBy;
|
|
@@ -17104,7 +17113,7 @@ function eh(...t) {
|
|
|
17104
17113
|
const i = new Dt(n);
|
|
17105
17114
|
c.push(Ft(e, i));
|
|
17106
17115
|
} else {
|
|
17107
|
-
const t =
|
|
17116
|
+
const t = Iu(n, s, a);
|
|
17108
17117
|
c.push(t);
|
|
17109
17118
|
}
|
|
17110
17119
|
}
|
|
@@ -17118,7 +17127,7 @@ function eh(...t) {
|
|
|
17118
17127
|
}
|
|
17119
17128
|
}
|
|
17120
17129
|
|
|
17121
|
-
function
|
|
17130
|
+
function ih(t, e, n) {
|
|
17122
17131
|
if ("string" == typeof (n = getModularInstance(n))) {
|
|
17123
17132
|
if ("" === n) throw new Q(j.INVALID_ARGUMENT, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
17124
17133
|
if (!Ae(e) && -1 !== n.indexOf("/")) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
|
|
@@ -17126,19 +17135,19 @@ function sh(t, e, n) {
|
|
|
17126
17135
|
if (!Dt.isDocumentKey(s)) throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
|
|
17127
17136
|
return Ft(t, new Dt(s));
|
|
17128
17137
|
}
|
|
17129
|
-
if (n instanceof
|
|
17130
|
-
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${
|
|
17138
|
+
if (n instanceof va) return Ft(t, n._key);
|
|
17139
|
+
throw new Q(j.INVALID_ARGUMENT, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ea(n)}.`);
|
|
17131
17140
|
}
|
|
17132
17141
|
|
|
17133
17142
|
/**
|
|
17134
17143
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
17135
17144
|
* array requirements.
|
|
17136
|
-
*/ function
|
|
17145
|
+
*/ function rh(t, e) {
|
|
17137
17146
|
if (!Array.isArray(t) || 0 === t.length) throw new Q(j.INVALID_ARGUMENT, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
|
|
17138
17147
|
if (t.length > 10) throw new Q(j.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
17139
17148
|
}
|
|
17140
17149
|
|
|
17141
|
-
function
|
|
17150
|
+
function oh(t, e, n) {
|
|
17142
17151
|
if (!n.isEqual(e)) throw new Q(j.INVALID_ARGUMENT, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
|
|
17143
17152
|
}
|
|
17144
17153
|
|
|
@@ -17163,7 +17172,7 @@ function rh(t, e, n) {
|
|
|
17163
17172
|
* to the user.
|
|
17164
17173
|
*
|
|
17165
17174
|
* @internal
|
|
17166
|
-
*/ class
|
|
17175
|
+
*/ class ch {
|
|
17167
17176
|
convertValue(t, e = "none") {
|
|
17168
17177
|
switch (Ct(t)) {
|
|
17169
17178
|
case 0 /* NullValue */ :
|
|
@@ -17210,7 +17219,7 @@ function rh(t, e, n) {
|
|
|
17210
17219
|
})), n;
|
|
17211
17220
|
}
|
|
17212
17221
|
convertGeoPoint(t) {
|
|
17213
|
-
return new
|
|
17222
|
+
return new ru(It(t.latitude), It(t.longitude));
|
|
17214
17223
|
}
|
|
17215
17224
|
convertArray(t, e) {
|
|
17216
17225
|
return (t.values || []).map((t => this.convertValue(t, e)));
|
|
@@ -17235,7 +17244,7 @@ function rh(t, e, n) {
|
|
|
17235
17244
|
convertDocumentKey(t, e) {
|
|
17236
17245
|
const n = wt.fromString(t);
|
|
17237
17246
|
U(Rs(n));
|
|
17238
|
-
const s = new
|
|
17247
|
+
const s = new _a(n.get(1), n.get(3)), i = new Dt(n.popFirst(5));
|
|
17239
17248
|
return s.isEqual(e) ||
|
|
17240
17249
|
// TODO(b/64130202): Somehow support foreign references.
|
|
17241
17250
|
M(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
|
|
@@ -17267,7 +17276,7 @@ function rh(t, e, n) {
|
|
|
17267
17276
|
* because we want to provide the user with a more specific error message if
|
|
17268
17277
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
17269
17278
|
* call.
|
|
17270
|
-
*/ function
|
|
17279
|
+
*/ function ah(t, e, n) {
|
|
17271
17280
|
let s;
|
|
17272
17281
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
17273
17282
|
// toFirestore().
|
|
@@ -17276,16 +17285,16 @@ function rh(t, e, n) {
|
|
|
17276
17285
|
s;
|
|
17277
17286
|
}
|
|
17278
17287
|
|
|
17279
|
-
class
|
|
17288
|
+
class uh extends ch {
|
|
17280
17289
|
constructor(t) {
|
|
17281
17290
|
super(), this.firestore = t;
|
|
17282
17291
|
}
|
|
17283
17292
|
convertBytes(t) {
|
|
17284
|
-
return new
|
|
17293
|
+
return new su(t);
|
|
17285
17294
|
}
|
|
17286
17295
|
convertReference(t) {
|
|
17287
17296
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17288
|
-
return new
|
|
17297
|
+
return new va(this.firestore, /* converter= */ null, e);
|
|
17289
17298
|
}
|
|
17290
17299
|
}
|
|
17291
17300
|
|
|
@@ -17312,24 +17321,24 @@ class ah extends oh {
|
|
|
17312
17321
|
* provides methods for adding writes to the write batch. None of the writes
|
|
17313
17322
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
17314
17323
|
* called.
|
|
17315
|
-
*/ class
|
|
17324
|
+
*/ class hh {
|
|
17316
17325
|
/** @hideconstructor */
|
|
17317
17326
|
constructor(t, e) {
|
|
17318
17327
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
17319
|
-
this._dataReader =
|
|
17328
|
+
this._dataReader = fu(t);
|
|
17320
17329
|
}
|
|
17321
17330
|
set(t, e, n) {
|
|
17322
17331
|
this._verifyNotCommitted();
|
|
17323
|
-
const s =
|
|
17332
|
+
const s = lh(t, this._firestore), i = ah(s.converter, e, n), r = du(this._dataReader, "WriteBatch.set", s._key, i, null !== s.converter, n);
|
|
17324
17333
|
return this._mutations.push(r.toMutation(s._key, Ye.none())), this;
|
|
17325
17334
|
}
|
|
17326
17335
|
update(t, e, n, ...s) {
|
|
17327
17336
|
this._verifyNotCommitted();
|
|
17328
|
-
const i =
|
|
17337
|
+
const i = lh(t, this._firestore);
|
|
17329
17338
|
// For Compat types, we have to "extract" the underlying types before
|
|
17330
17339
|
// performing validation.
|
|
17331
17340
|
let r;
|
|
17332
|
-
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
17341
|
+
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof eu ? Eu(this._dataReader, "WriteBatch.update", i._key, e, n, s) : Tu(this._dataReader, "WriteBatch.update", i._key, e),
|
|
17333
17342
|
this._mutations.push(r.toMutation(i._key, Ye.exists(!0))), this;
|
|
17334
17343
|
}
|
|
17335
17344
|
/**
|
|
@@ -17339,7 +17348,7 @@ class ah extends oh {
|
|
|
17339
17348
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
17340
17349
|
*/ delete(t) {
|
|
17341
17350
|
this._verifyNotCommitted();
|
|
17342
|
-
const e =
|
|
17351
|
+
const e = lh(t, this._firestore);
|
|
17343
17352
|
return this._mutations = this._mutations.concat(new ln(e._key, Ye.none())), this;
|
|
17344
17353
|
}
|
|
17345
17354
|
/**
|
|
@@ -17361,7 +17370,7 @@ class ah extends oh {
|
|
|
17361
17370
|
}
|
|
17362
17371
|
}
|
|
17363
17372
|
|
|
17364
|
-
function
|
|
17373
|
+
function lh(t, e) {
|
|
17365
17374
|
if ((t = getModularInstance(t)).firestore !== e) throw new Q(j.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
17366
17375
|
return t;
|
|
17367
17376
|
}
|
|
@@ -17419,22 +17428,22 @@ function hh(t, e) {
|
|
|
17419
17428
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the
|
|
17420
17429
|
* current document contents.
|
|
17421
17430
|
*/
|
|
17422
|
-
function
|
|
17423
|
-
t =
|
|
17424
|
-
const e =
|
|
17425
|
-
return
|
|
17431
|
+
function fh(t) {
|
|
17432
|
+
t = Ia(t, va);
|
|
17433
|
+
const e = Ia(t.firestore, La);
|
|
17434
|
+
return ca(qa(e), t._key).then((n => Ph(e, t, n)));
|
|
17426
17435
|
}
|
|
17427
17436
|
|
|
17428
|
-
class
|
|
17437
|
+
class dh extends ch {
|
|
17429
17438
|
constructor(t) {
|
|
17430
17439
|
super(), this.firestore = t;
|
|
17431
17440
|
}
|
|
17432
17441
|
convertBytes(t) {
|
|
17433
|
-
return new
|
|
17442
|
+
return new su(t);
|
|
17434
17443
|
}
|
|
17435
17444
|
convertReference(t) {
|
|
17436
17445
|
const e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
17437
|
-
return new
|
|
17446
|
+
return new va(this.firestore, /* converter= */ null, e);
|
|
17438
17447
|
}
|
|
17439
17448
|
}
|
|
17440
17449
|
|
|
@@ -17444,10 +17453,10 @@ class fh extends oh {
|
|
|
17444
17453
|
*
|
|
17445
17454
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17446
17455
|
* current document contents.
|
|
17447
|
-
*/ function
|
|
17448
|
-
t =
|
|
17449
|
-
const e =
|
|
17450
|
-
return
|
|
17456
|
+
*/ function wh(t) {
|
|
17457
|
+
t = Ia(t, va);
|
|
17458
|
+
const e = Ia(t.firestore, La), n = qa(e), s = new dh(e);
|
|
17459
|
+
return oa(n, t._key).then((n => new Ou(e, s, t._key, n, new $u(null !== n && n.hasLocalMutations,
|
|
17451
17460
|
/* fromCache= */ !0), t.converter)));
|
|
17452
17461
|
}
|
|
17453
17462
|
|
|
@@ -17457,12 +17466,12 @@ class fh extends oh {
|
|
|
17457
17466
|
*
|
|
17458
17467
|
* @returns A `Promise` resolved with a `DocumentSnapshot` containing the
|
|
17459
17468
|
* current document contents.
|
|
17460
|
-
*/ function
|
|
17461
|
-
t =
|
|
17462
|
-
const e =
|
|
17463
|
-
return
|
|
17469
|
+
*/ function _h(t) {
|
|
17470
|
+
t = Ia(t, va);
|
|
17471
|
+
const e = Ia(t.firestore, La);
|
|
17472
|
+
return ca(qa(e), t._key, {
|
|
17464
17473
|
source: "server"
|
|
17465
|
-
}).then((n =>
|
|
17474
|
+
}).then((n => Ph(e, t, n)));
|
|
17466
17475
|
}
|
|
17467
17476
|
|
|
17468
17477
|
/**
|
|
@@ -17474,10 +17483,10 @@ class fh extends oh {
|
|
|
17474
17483
|
* invoke {@link getDocsFromCache} or {@link getDocsFromServer}.
|
|
17475
17484
|
*
|
|
17476
17485
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17477
|
-
*/ function
|
|
17478
|
-
t =
|
|
17479
|
-
const e =
|
|
17480
|
-
return
|
|
17486
|
+
*/ function mh(t) {
|
|
17487
|
+
t = Ia(t, Va);
|
|
17488
|
+
const e = Ia(t.firestore, La), n = qa(e), s = new dh(e);
|
|
17489
|
+
return Uu(t._query), ua(n, t._query).then((n => new Fu(e, s, t, n)));
|
|
17481
17490
|
}
|
|
17482
17491
|
|
|
17483
17492
|
/**
|
|
@@ -17485,10 +17494,10 @@ class fh extends oh {
|
|
|
17485
17494
|
* Returns an error if the document is not currently cached.
|
|
17486
17495
|
*
|
|
17487
17496
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17488
|
-
*/ function
|
|
17489
|
-
t =
|
|
17490
|
-
const e =
|
|
17491
|
-
return
|
|
17497
|
+
*/ function gh(t) {
|
|
17498
|
+
t = Ia(t, Va);
|
|
17499
|
+
const e = Ia(t.firestore, La), n = qa(e), s = new dh(e);
|
|
17500
|
+
return aa(n, t._query).then((n => new Fu(e, s, t, n)));
|
|
17492
17501
|
}
|
|
17493
17502
|
|
|
17494
17503
|
/**
|
|
@@ -17496,29 +17505,29 @@ class fh extends oh {
|
|
|
17496
17505
|
* server. Returns an error if the network is not available.
|
|
17497
17506
|
*
|
|
17498
17507
|
* @returns A `Promise` that will be resolved with the results of the query.
|
|
17499
|
-
*/ function
|
|
17500
|
-
t =
|
|
17501
|
-
const e =
|
|
17502
|
-
return
|
|
17508
|
+
*/ function yh(t) {
|
|
17509
|
+
t = Ia(t, Va);
|
|
17510
|
+
const e = Ia(t.firestore, La), n = qa(e), s = new dh(e);
|
|
17511
|
+
return ua(n, t._query, {
|
|
17503
17512
|
source: "server"
|
|
17504
|
-
}).then((n => new
|
|
17513
|
+
}).then((n => new Fu(e, s, t, n)));
|
|
17505
17514
|
}
|
|
17506
17515
|
|
|
17507
|
-
function
|
|
17508
|
-
t =
|
|
17509
|
-
const s =
|
|
17510
|
-
return
|
|
17516
|
+
function ph(t, e, n) {
|
|
17517
|
+
t = Ia(t, va);
|
|
17518
|
+
const s = Ia(t.firestore, La), i = ah(t.converter, e, n);
|
|
17519
|
+
return bh(s, [ du(fu(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ye.none()) ]);
|
|
17511
17520
|
}
|
|
17512
17521
|
|
|
17513
|
-
function
|
|
17514
|
-
t =
|
|
17515
|
-
const i =
|
|
17522
|
+
function Th(t, e, n, ...s) {
|
|
17523
|
+
t = Ia(t, va);
|
|
17524
|
+
const i = Ia(t.firestore, La), r = fu(i);
|
|
17516
17525
|
let o;
|
|
17517
17526
|
o = "string" == typeof (
|
|
17518
17527
|
// For Compat types, we have to "extract" the underlying types before
|
|
17519
17528
|
// performing validation.
|
|
17520
|
-
e = getModularInstance(e)) || e instanceof
|
|
17521
|
-
return
|
|
17529
|
+
e = getModularInstance(e)) || e instanceof eu ? Eu(r, "updateDoc", t._key, e, n, s) : Tu(r, "updateDoc", t._key, e);
|
|
17530
|
+
return bh(i, [ o.toMutation(t._key, Ye.exists(!0)) ]);
|
|
17522
17531
|
}
|
|
17523
17532
|
|
|
17524
17533
|
/**
|
|
@@ -17527,8 +17536,8 @@ function ph(t, e, n, ...s) {
|
|
|
17527
17536
|
* @param reference - A reference to the document to delete.
|
|
17528
17537
|
* @returns A Promise resolved once the document has been successfully
|
|
17529
17538
|
* deleted from the backend (note that it won't resolve while you're offline).
|
|
17530
|
-
*/ function
|
|
17531
|
-
return
|
|
17539
|
+
*/ function Eh(t) {
|
|
17540
|
+
return bh(Ia(t.firestore, La), [ new ln(t._key, Ye.none()) ]);
|
|
17532
17541
|
}
|
|
17533
17542
|
|
|
17534
17543
|
/**
|
|
@@ -17540,55 +17549,55 @@ function ph(t, e, n, ...s) {
|
|
|
17540
17549
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
17541
17550
|
* newly created document after it has been written to the backend (Note that it
|
|
17542
17551
|
* won't resolve while you're offline).
|
|
17543
|
-
*/ function
|
|
17544
|
-
const n =
|
|
17545
|
-
return
|
|
17552
|
+
*/ function Ih(t, e) {
|
|
17553
|
+
const n = Ia(t.firestore, La), s = Na(t), i = ah(t.converter, e);
|
|
17554
|
+
return bh(n, [ du(fu(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ye.exists(!1)) ]).then((() => s));
|
|
17546
17555
|
}
|
|
17547
17556
|
|
|
17548
|
-
function
|
|
17557
|
+
function Ah(t, ...e) {
|
|
17549
17558
|
var n, s, i;
|
|
17550
17559
|
t = getModularInstance(t);
|
|
17551
17560
|
let r = {
|
|
17552
17561
|
includeMetadataChanges: !1
|
|
17553
17562
|
}, o = 0;
|
|
17554
|
-
"object" != typeof e[o] ||
|
|
17563
|
+
"object" != typeof e[o] || Oa(e[o]) || (r = e[o], o++);
|
|
17555
17564
|
const c = {
|
|
17556
17565
|
includeMetadataChanges: r.includeMetadataChanges
|
|
17557
17566
|
};
|
|
17558
|
-
if (
|
|
17567
|
+
if (Oa(e[o])) {
|
|
17559
17568
|
const t = e[o];
|
|
17560
17569
|
e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
|
|
17561
17570
|
e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
|
|
17562
17571
|
}
|
|
17563
17572
|
let a, u, h;
|
|
17564
|
-
if (t instanceof
|
|
17573
|
+
if (t instanceof va) u = Ia(t.firestore, La), h = ye(t._key.path), a = {
|
|
17565
17574
|
next: n => {
|
|
17566
|
-
e[o] && e[o](
|
|
17575
|
+
e[o] && e[o](Ph(u, t, n));
|
|
17567
17576
|
},
|
|
17568
17577
|
error: e[o + 1],
|
|
17569
17578
|
complete: e[o + 2]
|
|
17570
17579
|
}; else {
|
|
17571
|
-
const n =
|
|
17572
|
-
u =
|
|
17573
|
-
const s = new
|
|
17580
|
+
const n = Ia(t, Va);
|
|
17581
|
+
u = Ia(n.firestore, La), h = n._query;
|
|
17582
|
+
const s = new dh(u);
|
|
17574
17583
|
a = {
|
|
17575
17584
|
next: t => {
|
|
17576
|
-
e[o] && e[o](new
|
|
17585
|
+
e[o] && e[o](new Fu(u, s, n, t));
|
|
17577
17586
|
},
|
|
17578
17587
|
error: e[o + 1],
|
|
17579
17588
|
complete: e[o + 2]
|
|
17580
|
-
},
|
|
17589
|
+
}, Uu(t._query);
|
|
17581
17590
|
}
|
|
17582
17591
|
return function(t, e, n, s) {
|
|
17583
|
-
const i = new
|
|
17584
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17585
|
-
i.nc(), t.asyncQueue.enqueueAndForget((async () =>
|
|
17592
|
+
const i = new jc(s), r = new Jo(e, i, n);
|
|
17593
|
+
return t.asyncQueue.enqueueAndForget((async () => Qo(await sa(t), r))), () => {
|
|
17594
|
+
i.nc(), t.asyncQueue.enqueueAndForget((async () => Wo(await sa(t), r)));
|
|
17586
17595
|
};
|
|
17587
|
-
}(
|
|
17596
|
+
}(qa(u), h, c, a);
|
|
17588
17597
|
}
|
|
17589
17598
|
|
|
17590
|
-
function
|
|
17591
|
-
return
|
|
17599
|
+
function Rh(t, e) {
|
|
17600
|
+
return ha(qa(t = Ia(t, La)), Oa(e) ? e : {
|
|
17592
17601
|
next: e
|
|
17593
17602
|
});
|
|
17594
17603
|
}
|
|
@@ -17596,19 +17605,19 @@ function Ah(t, e) {
|
|
|
17596
17605
|
/**
|
|
17597
17606
|
* Locally writes `mutations` on the async queue.
|
|
17598
17607
|
* @internal
|
|
17599
|
-
*/ function
|
|
17608
|
+
*/ function bh(t, e) {
|
|
17600
17609
|
return function(t, e) {
|
|
17601
17610
|
const n = new W;
|
|
17602
|
-
return t.asyncQueue.enqueueAndForget((async () =>
|
|
17603
|
-
}(
|
|
17611
|
+
return t.asyncQueue.enqueueAndForget((async () => hc(await na(t), e, n))), n.promise;
|
|
17612
|
+
}(qa(t), e);
|
|
17604
17613
|
}
|
|
17605
17614
|
|
|
17606
17615
|
/**
|
|
17607
17616
|
* Converts a {@link ViewSnapshot} that contains the single document specified by `ref`
|
|
17608
17617
|
* to a {@link DocumentSnapshot}.
|
|
17609
|
-
*/ function
|
|
17610
|
-
const s = n.docs.get(e._key), i = new
|
|
17611
|
-
return new
|
|
17618
|
+
*/ function Ph(t, e, n) {
|
|
17619
|
+
const s = n.docs.get(e._key), i = new dh(t);
|
|
17620
|
+
return new Ou(t, i, e._key, s, new $u(n.hasPendingWrites, n.fromCache), e.converter);
|
|
17612
17621
|
}
|
|
17613
17622
|
|
|
17614
17623
|
/**
|
|
@@ -17633,10 +17642,10 @@ function Ah(t, e) {
|
|
|
17633
17642
|
* The `Transaction` object passed to a transaction's `updateFunction` provides
|
|
17634
17643
|
* the methods to read and write data within the transaction context. See
|
|
17635
17644
|
* {@link runTransaction}.
|
|
17636
|
-
*/ class
|
|
17645
|
+
*/ class vh extends class {
|
|
17637
17646
|
/** @hideconstructor */
|
|
17638
17647
|
constructor(t, e) {
|
|
17639
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
17648
|
+
this._firestore = t, this._transaction = e, this._dataReader = fu(t);
|
|
17640
17649
|
}
|
|
17641
17650
|
/**
|
|
17642
17651
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -17644,25 +17653,25 @@ function Ah(t, e) {
|
|
|
17644
17653
|
* @param documentRef - A reference to the document to be read.
|
|
17645
17654
|
* @returns A `DocumentSnapshot` with the read data.
|
|
17646
17655
|
*/ get(t) {
|
|
17647
|
-
const e =
|
|
17656
|
+
const e = lh(t, this._firestore), n = new uh(this._firestore);
|
|
17648
17657
|
return this._transaction.lookup([ e._key ]).then((t => {
|
|
17649
17658
|
if (!t || 1 !== t.length) return B();
|
|
17650
17659
|
const s = t[0];
|
|
17651
|
-
if (s.isFoundDocument()) return new
|
|
17652
|
-
if (s.isNoDocument()) return new
|
|
17660
|
+
if (s.isFoundDocument()) return new Nu(this._firestore, n, s.key, s, e.converter);
|
|
17661
|
+
if (s.isNoDocument()) return new Nu(this._firestore, n, e._key, null, e.converter);
|
|
17653
17662
|
throw B();
|
|
17654
17663
|
}));
|
|
17655
17664
|
}
|
|
17656
17665
|
set(t, e, n) {
|
|
17657
|
-
const s =
|
|
17666
|
+
const s = lh(t, this._firestore), i = ah(s.converter, e, n), r = du(this._dataReader, "Transaction.set", s._key, i, null !== s.converter, n);
|
|
17658
17667
|
return this._transaction.set(s._key, r), this;
|
|
17659
17668
|
}
|
|
17660
17669
|
update(t, e, n, ...s) {
|
|
17661
|
-
const i =
|
|
17670
|
+
const i = lh(t, this._firestore);
|
|
17662
17671
|
// For Compat types, we have to "extract" the underlying types before
|
|
17663
17672
|
// performing validation.
|
|
17664
17673
|
let r;
|
|
17665
|
-
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof
|
|
17674
|
+
return r = "string" == typeof (e = getModularInstance(e)) || e instanceof eu ? Eu(this._dataReader, "Transaction.update", i._key, e, n, s) : Tu(this._dataReader, "Transaction.update", i._key, e),
|
|
17666
17675
|
this._transaction.update(i._key, r), this;
|
|
17667
17676
|
}
|
|
17668
17677
|
/**
|
|
@@ -17671,7 +17680,7 @@ function Ah(t, e) {
|
|
|
17671
17680
|
* @param documentRef - A reference to the document to be deleted.
|
|
17672
17681
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
17673
17682
|
*/ delete(t) {
|
|
17674
|
-
const e =
|
|
17683
|
+
const e = lh(t, this._firestore);
|
|
17675
17684
|
return this._transaction.delete(e._key), this;
|
|
17676
17685
|
}
|
|
17677
17686
|
} {
|
|
@@ -17687,8 +17696,8 @@ function Ah(t, e) {
|
|
|
17687
17696
|
* @param documentRef - A reference to the document to be read.
|
|
17688
17697
|
* @returns A `DocumentSnapshot` with the read data.
|
|
17689
17698
|
*/ get(t) {
|
|
17690
|
-
const e =
|
|
17691
|
-
return super.get(t).then((t => new
|
|
17699
|
+
const e = lh(t, this._firestore), n = new dh(this._firestore);
|
|
17700
|
+
return super.get(t).then((t => new Ou(this._firestore, n, e._key, t._document, new $u(
|
|
17692
17701
|
/* hasPendingWrites= */ !1,
|
|
17693
17702
|
/* fromCache= */ !1), e.converter)));
|
|
17694
17703
|
}
|
|
@@ -17710,8 +17719,8 @@ function Ah(t, e) {
|
|
|
17710
17719
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
17711
17720
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
17712
17721
|
* rejected promise with the corresponding failure error is returned.
|
|
17713
|
-
*/ function
|
|
17714
|
-
return
|
|
17722
|
+
*/ function Vh(t, e) {
|
|
17723
|
+
return la(qa(t = Ia(t, La)), (n => e(new vh(t, n))));
|
|
17715
17724
|
}
|
|
17716
17725
|
|
|
17717
17726
|
/**
|
|
@@ -17733,15 +17742,15 @@ function Ah(t, e) {
|
|
|
17733
17742
|
/**
|
|
17734
17743
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
17735
17744
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
17736
|
-
*/ function
|
|
17737
|
-
return new
|
|
17745
|
+
*/ function Sh() {
|
|
17746
|
+
return new wu("deleteField");
|
|
17738
17747
|
}
|
|
17739
17748
|
|
|
17740
17749
|
/**
|
|
17741
17750
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
17742
17751
|
* include a server-generated timestamp in the written data.
|
|
17743
|
-
*/ function
|
|
17744
|
-
return new
|
|
17752
|
+
*/ function Dh() {
|
|
17753
|
+
return new mu("serverTimestamp");
|
|
17745
17754
|
}
|
|
17746
17755
|
|
|
17747
17756
|
/**
|
|
@@ -17755,10 +17764,10 @@ function Ah(t, e) {
|
|
|
17755
17764
|
* @param elements - The elements to union into the array.
|
|
17756
17765
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
17757
17766
|
* `updateDoc()`.
|
|
17758
|
-
*/ function
|
|
17767
|
+
*/ function Ch(...t) {
|
|
17759
17768
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
17760
17769
|
// update() since we'd need the Firestore instance to do this.
|
|
17761
|
-
return new
|
|
17770
|
+
return new gu("arrayUnion", t);
|
|
17762
17771
|
}
|
|
17763
17772
|
|
|
17764
17773
|
/**
|
|
@@ -17771,10 +17780,10 @@ function Ah(t, e) {
|
|
|
17771
17780
|
* @param elements - The elements to remove from the array.
|
|
17772
17781
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
17773
17782
|
* `updateDoc()`
|
|
17774
|
-
*/ function
|
|
17783
|
+
*/ function Nh(...t) {
|
|
17775
17784
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
17776
17785
|
// update() since we'd need the Firestore instance to do this.
|
|
17777
|
-
return new
|
|
17786
|
+
return new yu("arrayRemove", t);
|
|
17778
17787
|
}
|
|
17779
17788
|
|
|
17780
17789
|
/**
|
|
@@ -17795,8 +17804,8 @@ function Ah(t, e) {
|
|
|
17795
17804
|
* @param n - The value to increment by.
|
|
17796
17805
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
17797
17806
|
* `updateDoc()`
|
|
17798
|
-
*/ function
|
|
17799
|
-
return new
|
|
17807
|
+
*/ function kh(t) {
|
|
17808
|
+
return new pu("increment", t);
|
|
17800
17809
|
}
|
|
17801
17810
|
|
|
17802
17811
|
/**
|
|
@@ -17825,8 +17834,60 @@ function Ah(t, e) {
|
|
|
17825
17834
|
*
|
|
17826
17835
|
* @returns A {@link WriteBatch} that can be used to atomically execute multiple
|
|
17827
17836
|
* writes.
|
|
17828
|
-
*/ function
|
|
17829
|
-
return
|
|
17837
|
+
*/ function xh(t) {
|
|
17838
|
+
return qa(t = Ia(t, La)), new hh(t, (e => bh(t, e)));
|
|
17839
|
+
}
|
|
17840
|
+
|
|
17841
|
+
/** An index component consisting of field path and index type. */ class Oh {
|
|
17842
|
+
constructor(
|
|
17843
|
+
/** The field path of the component. */
|
|
17844
|
+
t,
|
|
17845
|
+
/** The fields sorting order. */
|
|
17846
|
+
e) {
|
|
17847
|
+
this.fieldPath = t, this.kind = e;
|
|
17848
|
+
}
|
|
17849
|
+
}
|
|
17850
|
+
|
|
17851
|
+
/**
|
|
17852
|
+
* @license
|
|
17853
|
+
* Copyright 2021 Google LLC
|
|
17854
|
+
*
|
|
17855
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17856
|
+
* you may not use this file except in compliance with the License.
|
|
17857
|
+
* You may obtain a copy of the License at
|
|
17858
|
+
*
|
|
17859
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17860
|
+
*
|
|
17861
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17862
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17863
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17864
|
+
* See the License for the specific language governing permissions and
|
|
17865
|
+
* limitations under the License.
|
|
17866
|
+
*/ function Mh(t, e) {
|
|
17867
|
+
qa(t = Ia(t, La));
|
|
17868
|
+
const n = "string" == typeof e ? function(t) {
|
|
17869
|
+
try {
|
|
17870
|
+
return JSON.parse(t);
|
|
17871
|
+
} catch (t) {
|
|
17872
|
+
throw new Q(j.INVALID_ARGUMENT, "Failed to parse JSON:" + t.message);
|
|
17873
|
+
}
|
|
17874
|
+
}(e) : e;
|
|
17875
|
+
// PORTING NOTE: We don't return an error if the user has not enabled
|
|
17876
|
+
// persistence since `enableIndexeddbPersistence()` can fail on the Web.
|
|
17877
|
+
if (Array.isArray(n.indexes)) for (const t of n.indexes) {
|
|
17878
|
+
Fh(t, "collectionGroup"); const n = [];
|
|
17879
|
+
if (Array.isArray(t.fields)) for (const e of t.fields) {
|
|
17880
|
+
const t = Su("setIndexConfiguration", Fh(e, "fieldPath"));
|
|
17881
|
+
"CONTAINS" === e.arrayConfig ? n.push(new Oh(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? n.push(new Oh(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && n.push(new Oh(t, 1 /* DESCENDING */));
|
|
17882
|
+
}
|
|
17883
|
+
}
|
|
17884
|
+
// TODO(indexing): Configure indexes
|
|
17885
|
+
return Promise.resolve();
|
|
17886
|
+
}
|
|
17887
|
+
|
|
17888
|
+
function Fh(t, e) {
|
|
17889
|
+
if ("string" != typeof t[e]) throw new Q(j.INVALID_ARGUMENT, "Missing string value for: " + e);
|
|
17890
|
+
return t[e];
|
|
17830
17891
|
}
|
|
17831
17892
|
|
|
17832
17893
|
/**
|
|
@@ -17837,14 +17898,14 @@ function Ah(t, e) {
|
|
|
17837
17898
|
!function(t) {
|
|
17838
17899
|
N = t;
|
|
17839
17900
|
}(SDK_VERSION), _registerComponent(new Component("firestore", ((t, {options: n}) => {
|
|
17840
|
-
const s = t.getProvider("app").getImmediate(), i = new
|
|
17901
|
+
const s = t.getProvider("app").getImmediate(), i = new La(s, new J(t.getProvider("auth-internal")), new tt(t.getProvider("app-check-internal")));
|
|
17841
17902
|
return n = Object.assign({
|
|
17842
17903
|
useFetchStreams: e
|
|
17843
17904
|
}, n), i._setSettings(n), i;
|
|
17844
|
-
}), "PUBLIC")), registerVersion(D, "3.4.
|
|
17905
|
+
}), "PUBLIC")), registerVersion(D, "3.4.4-202202622812", t),
|
|
17845
17906
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
17846
|
-
registerVersion(D, "3.4.
|
|
17907
|
+
registerVersion(D, "3.4.4-202202622812", "esm2017");
|
|
17847
17908
|
}();
|
|
17848
17909
|
|
|
17849
|
-
export {
|
|
17910
|
+
export { ch as AbstractUserDataWriter, su as Bytes, Fa as CACHE_SIZE_UNLIMITED, Sa as CollectionReference, va as DocumentReference, Ou as DocumentSnapshot, eu as FieldPath, iu as FieldValue, La as Firestore, Q as FirestoreError, ru as GeoPoint, Ma as LoadBundleTask, Va as Query, qu as QueryConstraint, Mu as QueryDocumentSnapshot, Fu as QuerySnapshot, $u as SnapshotMetadata, at as Timestamp, vh as Transaction, hh as WriteBatch, _a as _DatabaseId, Dt as _DocumentKey, et as _EmptyAppCheckTokenProvider, z as _EmptyAuthCredentialsProvider, mt as _FieldPath, Ia as _cast, q as _debugAssert, yt as _isBase64Available, F as _logWarn, Mh as _setIndexConfiguration, ya as _validateIsNotUsedTogether, Ih as addDoc, Nh as arrayRemove, Ch as arrayUnion, Ga as clearIndexedDbPersistence, Da as collection, Ca as collectionGroup, Pa as connectFirestoreEmulator, Eh as deleteDoc, Sh as deleteField, Ja as disableNetwork, Na as doc, nu as documentId, ja as enableIndexedDbPersistence, Qa as enableMultiTabIndexedDbPersistence, Ha as enableNetwork, nh as endAt, eh as endBefore, qa as ensureFirestoreConfigured, bh as executeWrite, fh as getDoc, wh as getDocFromCache, _h as getDocFromServer, mh as getDocs, gh as getDocsFromCache, yh as getDocsFromServer, Ua as getFirestore, kh as increment, Ba as initializeFirestore, Hu as limit, Ju as limitToLast, Xa as loadBundle, Za as namedQuery, Ah as onSnapshot, Rh as onSnapshotsInSync, Gu as orderBy, Ku as query, xa as queryEqual, ka as refEqual, Vh as runTransaction, Dh as serverTimestamp, ph as setDoc, $ as setLogLevel, Bu as snapshotEqual, Zu as startAfter, Xu as startAt, Ya as terminate, Th as updateDoc, za as waitForPendingWrites, Qu as where, xh as writeBatch };
|
|
17850
17911
|
//# sourceMappingURL=index.esm2017.js.map
|