@firebase/firestore 1.14.0-canary.daf63c2c → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist/index.esm2017.d.ts +2 -2
- package/dist/dist/index.memory.esm2017.d.ts +2 -2
- package/dist/index.cjs.js +872 -874
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +933 -935
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm2017.js +746 -780
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.memory.cjs.js +604 -651
- package/dist/index.memory.cjs.js.map +1 -1
- package/dist/index.memory.esm.js +882 -929
- package/dist/index.memory.esm.js.map +1 -1
- package/dist/index.memory.esm2017.js +387 -422
- package/dist/index.memory.esm2017.js.map +1 -1
- package/dist/index.memory.node.cjs.js +21 -81
- package/dist/index.memory.node.cjs.js.map +1 -1
- package/dist/index.memory.node.esm2017.js +19 -64
- package/dist/index.memory.node.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +110 -117
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm2017.js +66 -96
- package/dist/index.node.esm2017.js.map +1 -1
- package/dist/lib/src/core/component_provider.d.ts +19 -35
- package/dist/lib/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/lib/src/local/memory_persistence.d.ts +0 -1
- package/dist/lib/src/local/persistence.d.ts +0 -2
- package/dist/src/core/component_provider.d.ts +19 -35
- package/dist/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/src/local/memory_persistence.d.ts +0 -1
- package/dist/src/local/persistence.d.ts +0 -2
- package/package.json +12 -12
|
@@ -10056,9 +10056,6 @@ class wi {
|
|
|
10056
10056
|
this.dh = e(this), this.mh = new fi(this);
|
|
10057
10057
|
this.Jn = new ci, this.Kn = new di(this.Jn, t => this.dh.p_(t));
|
|
10058
10058
|
}
|
|
10059
|
-
start() {
|
|
10060
|
-
return Promise.resolve();
|
|
10061
|
-
}
|
|
10062
10059
|
ku() {
|
|
10063
10060
|
// No durable state to ensure is closed on shutdown.
|
|
10064
10061
|
return this.V_ = !1, Promise.resolve();
|
|
@@ -10199,47 +10196,23 @@ class mi {
|
|
|
10199
10196
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10200
10197
|
* See the License for the specific language governing permissions and
|
|
10201
10198
|
* limitations under the License.
|
|
10202
|
-
*/
|
|
10199
|
+
*/ const Ei = "You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.";
|
|
10200
|
+
|
|
10203
10201
|
/**
|
|
10204
10202
|
* Provides all components needed for Firestore with in-memory persistence.
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
async initialize(t) {
|
|
10209
|
-
this.Qc = this.q_(t), this.persistence = this.B_(t), await this.persistence.start(),
|
|
10210
|
-
this.x_ = this.Q_(t), this._u = this.W_(t), this.Lc = this.j_(t), this.Mu = this.G_(t),
|
|
10211
|
-
this.z_ = this.K_(t), this.Qc.iu = t => this.Mu.Dc(t, 1 /* SharedClientState */),
|
|
10212
|
-
this.Lc.Mu = this.Mu, this.Qc.Mu = this.Mu, await this.Qc.start(), await this.Lc.start(),
|
|
10213
|
-
await this._u.start(),
|
|
10214
|
-
// NOTE: This will immediately call the listener, so we make sure to
|
|
10215
|
-
// set it after localStore / remoteStore are started.
|
|
10216
|
-
await this.persistence.y_(async t => {
|
|
10217
|
-
await this.Mu.Zu(t), this.x_ && (t && !this.x_.g_ ? this.x_.start(this._u) : t || this.x_.stop());
|
|
10218
|
-
});
|
|
10219
|
-
}
|
|
10220
|
-
K_(t) {
|
|
10221
|
-
return new oi(this.Mu);
|
|
10203
|
+
*/ class Ri {
|
|
10204
|
+
constructor(t = mi.O_) {
|
|
10205
|
+
this.q_ = t;
|
|
10222
10206
|
}
|
|
10223
|
-
|
|
10224
|
-
|
|
10207
|
+
async initialize(t, e, s, i, n, r, h, o) {
|
|
10208
|
+
if (o.B_) throw new E(m.FAILED_PRECONDITION, Ei);
|
|
10209
|
+
this.persistence = new wi(n, this.q_), this.x_ = null, this.Qc = new Ys, this._u = new Ke(this.persistence, new ui, r),
|
|
10210
|
+
this.Lc = new Hs(this._u, i, t, t => this.Mu.Dc(t, 0 /* RemoteStore */), s.Q_()),
|
|
10211
|
+
this.Mu = new ri(this._u, this.Lc, this.Qc, r, h), this.W_ = new oi(this.Mu), this.Lc.Mu = this.Mu,
|
|
10212
|
+
await this.Lc.start(), await this.Lc.Zu(!0), await this.Mu.Zu(!0);
|
|
10225
10213
|
}
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
}
|
|
10229
|
-
B_(t) {
|
|
10230
|
-
return new wi(t.clientId, mi.O_);
|
|
10231
|
-
}
|
|
10232
|
-
j_(t) {
|
|
10233
|
-
return new Hs(this._u, t.Ha, t.Ar, t => this.Mu.Dc(t, 0 /* RemoteStore */), t.platform.J_());
|
|
10234
|
-
}
|
|
10235
|
-
q_(t) {
|
|
10236
|
-
return new Ys;
|
|
10237
|
-
}
|
|
10238
|
-
G_(t) {
|
|
10239
|
-
return new ri(this._u, this.Lc, this.Qc, t.H_, t.Wc);
|
|
10240
|
-
}
|
|
10241
|
-
clearPersistence(t) {
|
|
10242
|
-
throw new E(m.FAILED_PRECONDITION, "You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.");
|
|
10214
|
+
clearPersistence() {
|
|
10215
|
+
throw new E(m.FAILED_PRECONDITION, Ei);
|
|
10243
10216
|
}
|
|
10244
10217
|
}
|
|
10245
10218
|
|
|
@@ -10264,7 +10237,7 @@ class Ei {
|
|
|
10264
10237
|
* pieces of the client SDK architecture. It is responsible for creating the
|
|
10265
10238
|
* async queue that is shared by all of the other components in the system.
|
|
10266
10239
|
*/
|
|
10267
|
-
class
|
|
10240
|
+
class Ii {
|
|
10268
10241
|
constructor(t, e, s,
|
|
10269
10242
|
/**
|
|
10270
10243
|
* Asynchronous queue responsible for all of our internal processing. When
|
|
@@ -10275,7 +10248,7 @@ class Ri {
|
|
|
10275
10248
|
* an async I/O to complete).
|
|
10276
10249
|
*/
|
|
10277
10250
|
i) {
|
|
10278
|
-
this.platform = t, this.
|
|
10251
|
+
this.platform = t, this.j_ = e, this.credentials = s, this.Ar = i, this.clientId = Ce.Tn();
|
|
10279
10252
|
}
|
|
10280
10253
|
/**
|
|
10281
10254
|
* Starts up the FirestoreClient, returning only whether or not enabling
|
|
@@ -10313,7 +10286,7 @@ class Ri {
|
|
|
10313
10286
|
* start for any reason. If usePersistence is false this is
|
|
10314
10287
|
* unconditionally resolved.
|
|
10315
10288
|
*/ start(t, e) {
|
|
10316
|
-
this.
|
|
10289
|
+
this.G_();
|
|
10317
10290
|
// We defer our initialization until we get the current user from
|
|
10318
10291
|
// setChangeListener(). We block the async queue until we got the initial
|
|
10319
10292
|
// user and the initialization is completed. This will prevent any scheduled
|
|
@@ -10332,14 +10305,14 @@ class Ri {
|
|
|
10332
10305
|
// need to await the completion of initializationDone because the result of
|
|
10333
10306
|
// this method should not reflect any other kind of failure to start.
|
|
10334
10307
|
return this.credentials._(r => {
|
|
10335
|
-
if (!n) return n = !0, ge("FirestoreClient", "Initializing. user=", r.uid), this.
|
|
10308
|
+
if (!n) return n = !0, ge("FirestoreClient", "Initializing. user=", r.uid), this.z_(t, e, r, i).then(s.resolve, s.reject);
|
|
10336
10309
|
this.Ar.Cr(() => this.Xu(r));
|
|
10337
10310
|
}),
|
|
10338
10311
|
// Block the async queue until initialization is done
|
|
10339
10312
|
this.Ar.Cr(() => s.promise), i.promise;
|
|
10340
10313
|
}
|
|
10341
10314
|
/** Enables the network connection and requeues all pending operations. */ enableNetwork() {
|
|
10342
|
-
return this.
|
|
10315
|
+
return this.G_(), this.Ar.enqueue(() => this.Mu.enableNetwork());
|
|
10343
10316
|
}
|
|
10344
10317
|
/**
|
|
10345
10318
|
* Initializes persistent storage, attempting to use IndexedDB if
|
|
@@ -10360,23 +10333,15 @@ class Ri {
|
|
|
10360
10333
|
* @returns a Promise indicating whether or not initialization should
|
|
10361
10334
|
* continue, i.e. that one of the persistence implementations actually
|
|
10362
10335
|
* succeeded.
|
|
10363
|
-
*/ async
|
|
10336
|
+
*/ async z_(t, e, s, i) {
|
|
10364
10337
|
try {
|
|
10365
10338
|
// TODO(mrschmidt): Ideally, ComponentProvider would also initialize
|
|
10366
10339
|
// Datastore (without duplicating the initializing logic once per
|
|
10367
10340
|
// provider).
|
|
10368
|
-
const n = await this.platform.
|
|
10369
|
-
await t.initialize(
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
platform: this.platform,
|
|
10373
|
-
Ha: h,
|
|
10374
|
-
clientId: this.clientId,
|
|
10375
|
-
H_: s,
|
|
10376
|
-
Wc: 100,
|
|
10377
|
-
sd: e
|
|
10378
|
-
}), this.persistence = t.persistence, this.Qc = t.Qc, this._u = t._u, this.Lc = t.Lc,
|
|
10379
|
-
this.Mu = t.Mu, this.x_ = t.x_, this.nd = t.z_,
|
|
10341
|
+
const n = await this.platform.K_(this.j_), r = this.platform.H_(this.j_.ci), h = new Gs(this.Ar, n, this.credentials, r);
|
|
10342
|
+
await t.initialize(this.Ar, this.j_, this.platform, h, this.clientId, s, 100, e),
|
|
10343
|
+
this.persistence = t.persistence, this.Qc = t.Qc, this._u = t._u, this.Lc = t.Lc,
|
|
10344
|
+
this.Mu = t.Mu, this.x_ = t.x_, this.J_ = t.W_,
|
|
10380
10345
|
// When a user calls clearPersistence() in one client, all other clients
|
|
10381
10346
|
// need to be terminated to allow the delete to succeed.
|
|
10382
10347
|
this.persistence.b_(async () => {
|
|
@@ -10387,17 +10352,17 @@ class Ri {
|
|
|
10387
10352
|
if (
|
|
10388
10353
|
// Regardless of whether or not the retry succeeds, from an user
|
|
10389
10354
|
// perspective, offline persistence has failed.
|
|
10390
|
-
i.reject(t), !this.
|
|
10355
|
+
i.reject(t), !this.Y_(t)) throw t;
|
|
10391
10356
|
return console.warn("Error enabling offline persistence. Falling back to persistence disabled: " + t),
|
|
10392
|
-
this.
|
|
10393
|
-
|
|
10357
|
+
this.z_(new Ri, {
|
|
10358
|
+
B_: !1
|
|
10394
10359
|
}, s, i);
|
|
10395
10360
|
}
|
|
10396
10361
|
}
|
|
10397
10362
|
/**
|
|
10398
10363
|
* Decides whether the provided error allows us to gracefully disable
|
|
10399
10364
|
* persistence (as opposed to crashing the client).
|
|
10400
|
-
*/
|
|
10365
|
+
*/ Y_(t) {
|
|
10401
10366
|
return "FirebaseError" === t.name ? t.code === m.FAILED_PRECONDITION || t.code === m.UNIMPLEMENTED : !("undefined" != typeof DOMException && t instanceof DOMException) || (
|
|
10402
10367
|
// When the browser is out of quota we could get either quota exceeded
|
|
10403
10368
|
// or an aborted error depending on whether the error happened during
|
|
@@ -10410,7 +10375,7 @@ class Ri {
|
|
|
10410
10375
|
/**
|
|
10411
10376
|
* Checks that the client has not been terminated. Ensures that other methods on
|
|
10412
10377
|
* this class cannot be called after the client is terminated.
|
|
10413
|
-
*/
|
|
10378
|
+
*/ G_() {
|
|
10414
10379
|
if (this.Ar.Or) throw new E(m.FAILED_PRECONDITION, "The client has already been terminated.");
|
|
10415
10380
|
}
|
|
10416
10381
|
Xu(t) {
|
|
@@ -10418,7 +10383,7 @@ class Ri {
|
|
|
10418
10383
|
this.Mu.Xu(t);
|
|
10419
10384
|
}
|
|
10420
10385
|
/** Disables the network connection. Pending operations will not complete. */ disableNetwork() {
|
|
10421
|
-
return this.
|
|
10386
|
+
return this.G_(), this.Ar.enqueue(() => this.Mu.disableNetwork());
|
|
10422
10387
|
}
|
|
10423
10388
|
terminate() {
|
|
10424
10389
|
return this.Ar.xr(async () => {
|
|
@@ -10435,29 +10400,29 @@ class Ri {
|
|
|
10435
10400
|
* method was called received server acknowledgement. An acknowledgement can be either acceptance
|
|
10436
10401
|
* or rejection.
|
|
10437
10402
|
*/ waitForPendingWrites() {
|
|
10438
|
-
this.
|
|
10403
|
+
this.G_();
|
|
10439
10404
|
const t = new We;
|
|
10440
10405
|
return this.Ar.Cr(() => this.Mu.fl(t)), t.promise;
|
|
10441
10406
|
}
|
|
10442
10407
|
listen(t, e, s) {
|
|
10443
|
-
this.
|
|
10408
|
+
this.G_();
|
|
10444
10409
|
const i = new ai(t, e, s);
|
|
10445
|
-
return this.Ar.Cr(() => this.
|
|
10410
|
+
return this.Ar.Cr(() => this.J_.listen(i)), i;
|
|
10446
10411
|
}
|
|
10447
10412
|
$u(t) {
|
|
10448
10413
|
// Checks for termination but does not raise error, allowing unlisten after
|
|
10449
10414
|
// termination to be a no-op.
|
|
10450
|
-
this.
|
|
10415
|
+
this.X_ || this.Ar.Cr(() => this.J_.$u(t));
|
|
10451
10416
|
}
|
|
10452
|
-
|
|
10453
|
-
return this.
|
|
10417
|
+
Z_(t) {
|
|
10418
|
+
return this.G_(), this.Ar.enqueue(() => this._u.ro(t)).then(t => {
|
|
10454
10419
|
if (t instanceof gt) return t;
|
|
10455
10420
|
if (t instanceof yt) return null;
|
|
10456
10421
|
throw new E(m.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.)");
|
|
10457
10422
|
});
|
|
10458
10423
|
}
|
|
10459
|
-
|
|
10460
|
-
return this.
|
|
10424
|
+
td(t) {
|
|
10425
|
+
return this.G_(), this.Ar.enqueue(async () => {
|
|
10461
10426
|
const e = await this._u.lo(t,
|
|
10462
10427
|
/* usePreviousResults= */ !0), s = new ei(t, e.do), i = s.Vc(e.documents);
|
|
10463
10428
|
return s.bc(i,
|
|
@@ -10465,29 +10430,29 @@ class Ri {
|
|
|
10465
10430
|
});
|
|
10466
10431
|
}
|
|
10467
10432
|
write(t) {
|
|
10468
|
-
this.
|
|
10433
|
+
this.G_();
|
|
10469
10434
|
const e = new We;
|
|
10470
10435
|
return this.Ar.Cr(() => this.Mu.write(t, e)), e.promise;
|
|
10471
10436
|
}
|
|
10472
10437
|
ci() {
|
|
10473
|
-
return this.
|
|
10438
|
+
return this.j_.ci;
|
|
10474
10439
|
}
|
|
10475
10440
|
Fl(t) {
|
|
10476
|
-
this.
|
|
10441
|
+
this.G_(), this.Ar.Cr(() => (this.J_.Fl(t), Promise.resolve()));
|
|
10477
10442
|
}
|
|
10478
10443
|
Nl(t) {
|
|
10479
10444
|
// Checks for shutdown but does not raise error, allowing remove after
|
|
10480
10445
|
// shutdown to be a no-op.
|
|
10481
|
-
this.
|
|
10446
|
+
this.X_ || this.J_.Nl(t);
|
|
10482
10447
|
}
|
|
10483
|
-
get
|
|
10448
|
+
get X_() {
|
|
10484
10449
|
// Technically, the asyncQueue is still running, but only accepting operations
|
|
10485
10450
|
// related to termination or supposed to be run after termination. It is effectively
|
|
10486
10451
|
// terminated to the eyes of users.
|
|
10487
10452
|
return this.Ar.Or;
|
|
10488
10453
|
}
|
|
10489
10454
|
transaction(t) {
|
|
10490
|
-
this.
|
|
10455
|
+
this.G_();
|
|
10491
10456
|
const e = new We;
|
|
10492
10457
|
return this.Ar.Cr(() => (this.Mu.runTransaction(this.Ar, t, e), Promise.resolve())),
|
|
10493
10458
|
e.promise;
|
|
@@ -10514,7 +10479,7 @@ class Ri {
|
|
|
10514
10479
|
* A wrapper implementation of Observer<T> that will dispatch events
|
|
10515
10480
|
* asynchronously. To allow immediate silencing, a mute call is added which
|
|
10516
10481
|
* causes events scheduled to no longer be raised.
|
|
10517
|
-
*/ class
|
|
10482
|
+
*/ class Ai {
|
|
10518
10483
|
constructor(t) {
|
|
10519
10484
|
this.observer = t,
|
|
10520
10485
|
/**
|
|
@@ -10524,15 +10489,15 @@ class Ri {
|
|
|
10524
10489
|
this.muted = !1;
|
|
10525
10490
|
}
|
|
10526
10491
|
next(t) {
|
|
10527
|
-
this.
|
|
10492
|
+
this.ed(this.observer.next, t);
|
|
10528
10493
|
}
|
|
10529
10494
|
error(t) {
|
|
10530
|
-
this.
|
|
10495
|
+
this.ed(this.observer.error, t);
|
|
10531
10496
|
}
|
|
10532
|
-
|
|
10497
|
+
sd() {
|
|
10533
10498
|
this.muted = !0;
|
|
10534
10499
|
}
|
|
10535
|
-
|
|
10500
|
+
ed(t, e) {
|
|
10536
10501
|
this.muted || setTimeout(() => {
|
|
10537
10502
|
this.muted || t(e);
|
|
10538
10503
|
}, 0);
|
|
@@ -10554,7 +10519,7 @@ class Ri {
|
|
|
10554
10519
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10555
10520
|
* See the License for the specific language governing permissions and
|
|
10556
10521
|
* limitations under the License.
|
|
10557
|
-
*/ function
|
|
10522
|
+
*/ function Pi(t) {
|
|
10558
10523
|
/**
|
|
10559
10524
|
* Returns true if obj is an object and contains at least one of the specified
|
|
10560
10525
|
* methods.
|
|
@@ -10587,11 +10552,11 @@ class Ri {
|
|
|
10587
10552
|
*/ (t, [ "next", "error", "complete" ]);
|
|
10588
10553
|
}
|
|
10589
10554
|
|
|
10590
|
-
class
|
|
10555
|
+
class Vi {
|
|
10591
10556
|
constructor(t, e, s, i) {
|
|
10592
|
-
this.firestore = t, this.timestampsInSnapshots = e, this.
|
|
10557
|
+
this.firestore = t, this.timestampsInSnapshots = e, this.nd = s, this.converter = i;
|
|
10593
10558
|
}
|
|
10594
|
-
|
|
10559
|
+
rd(t) {
|
|
10595
10560
|
switch (j(t)) {
|
|
10596
10561
|
case 0 /* NullValue */ :
|
|
10597
10562
|
return null;
|
|
@@ -10603,10 +10568,10 @@ class Pi {
|
|
|
10603
10568
|
return Z(t.integerValue || t.doubleValue);
|
|
10604
10569
|
|
|
10605
10570
|
case 3 /* TimestampValue */ :
|
|
10606
|
-
return this.
|
|
10571
|
+
return this.hd(t.timestampValue);
|
|
10607
10572
|
|
|
10608
10573
|
case 4 /* ServerTimestampValue */ :
|
|
10609
|
-
return this.
|
|
10574
|
+
return this.od(t);
|
|
10610
10575
|
|
|
10611
10576
|
case 5 /* StringValue */ :
|
|
10612
10577
|
return t.stringValue;
|
|
@@ -10615,58 +10580,58 @@ class Pi {
|
|
|
10615
10580
|
return new Es(tt(t.bytesValue));
|
|
10616
10581
|
|
|
10617
10582
|
case 7 /* RefValue */ :
|
|
10618
|
-
return this.
|
|
10583
|
+
return this.ad(t.referenceValue);
|
|
10619
10584
|
|
|
10620
10585
|
case 8 /* GeoPointValue */ :
|
|
10621
10586
|
return new Ss(t.geoPointValue.latitude, t.geoPointValue.longitude);
|
|
10622
10587
|
|
|
10623
10588
|
case 9 /* ArrayValue */ :
|
|
10624
|
-
return this.
|
|
10589
|
+
return this.ud(t.arrayValue);
|
|
10625
10590
|
|
|
10626
10591
|
case 10 /* ObjectValue */ :
|
|
10627
|
-
return this.
|
|
10592
|
+
return this.ld(t.mapValue);
|
|
10628
10593
|
|
|
10629
10594
|
default:
|
|
10630
10595
|
throw ve("Invalid value type: " + JSON.stringify(t));
|
|
10631
10596
|
}
|
|
10632
10597
|
}
|
|
10633
|
-
|
|
10598
|
+
ld(t) {
|
|
10634
10599
|
const e = {};
|
|
10635
10600
|
return O(t.fields || {}, (t, s) => {
|
|
10636
|
-
e[t] = this.
|
|
10601
|
+
e[t] = this.rd(s);
|
|
10637
10602
|
}), e;
|
|
10638
10603
|
}
|
|
10639
|
-
|
|
10640
|
-
return (t.values || []).map(t => this.
|
|
10604
|
+
ud(t) {
|
|
10605
|
+
return (t.values || []).map(t => this.rd(t));
|
|
10641
10606
|
}
|
|
10642
|
-
|
|
10643
|
-
switch (this.
|
|
10607
|
+
od(t) {
|
|
10608
|
+
switch (this.nd) {
|
|
10644
10609
|
case "previous":
|
|
10645
10610
|
const e = function t(e) {
|
|
10646
10611
|
const s = e.mapValue.fields.__previous_value__;
|
|
10647
10612
|
return x(s) ? t(s) : s;
|
|
10648
10613
|
}(t);
|
|
10649
|
-
return null == e ? null : this.
|
|
10614
|
+
return null == e ? null : this.rd(e);
|
|
10650
10615
|
|
|
10651
10616
|
case "estimate":
|
|
10652
|
-
return this.
|
|
10617
|
+
return this.hd(Q(t));
|
|
10653
10618
|
|
|
10654
10619
|
default:
|
|
10655
10620
|
return null;
|
|
10656
10621
|
}
|
|
10657
10622
|
}
|
|
10658
|
-
|
|
10623
|
+
hd(t) {
|
|
10659
10624
|
const e = X(t), s = new p(e.seconds, e.nanos);
|
|
10660
10625
|
return this.timestampsInSnapshots ? s : s.toDate();
|
|
10661
10626
|
}
|
|
10662
|
-
|
|
10627
|
+
ad(t) {
|
|
10663
10628
|
const e = b.K(t);
|
|
10664
10629
|
Se(Ie(e), "ReferenceValue is not valid " + t);
|
|
10665
10630
|
const s = new ke(e.get(1), e.get(3)), i = new C(e.$(5));
|
|
10666
|
-
return s.isEqual(this.firestore.
|
|
10631
|
+
return s.isEqual(this.firestore._d) ||
|
|
10667
10632
|
// TODO(b/64130202): Somehow support foreign references.
|
|
10668
|
-
ye(`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 (${this.firestore.
|
|
10669
|
-
new
|
|
10633
|
+
ye(`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 (${this.firestore._d.projectId}/${this.firestore._d.database}) ` + "instead."),
|
|
10634
|
+
new Si(i, this.firestore, this.converter);
|
|
10670
10635
|
}
|
|
10671
10636
|
}
|
|
10672
10637
|
|
|
@@ -10687,14 +10652,14 @@ class Pi {
|
|
|
10687
10652
|
* limitations under the License.
|
|
10688
10653
|
*/
|
|
10689
10654
|
// settings() defaults:
|
|
10690
|
-
const
|
|
10655
|
+
const pi = ze.sh;
|
|
10691
10656
|
|
|
10692
10657
|
/**
|
|
10693
10658
|
* A concrete type describing all the values that can be applied via a
|
|
10694
10659
|
* user-supplied firestore.Settings object. This is a separate type so that
|
|
10695
10660
|
* defaults can be supplied and the value can be checked for equality.
|
|
10696
10661
|
*/
|
|
10697
|
-
class
|
|
10662
|
+
class gi {
|
|
10698
10663
|
constructor(t) {
|
|
10699
10664
|
var e, s;
|
|
10700
10665
|
if (void 0 === t.host) {
|
|
@@ -10710,7 +10675,7 @@ class pi {
|
|
|
10710
10675
|
!0 === t.timestampsInSnapshots ? ye("The setting 'timestampsInSnapshots: true' is no longer required and should be removed.") : !1 === t.timestampsInSnapshots && ye("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),
|
|
10711
10676
|
this.timestampsInSnapshots = null === (s = t.timestampsInSnapshots) || void 0 === s || s,
|
|
10712
10677
|
is("settings", "number", "cacheSizeBytes", t.cacheSizeBytes), void 0 === t.cacheSizeBytes) this.cacheSizeBytes = ze.nh; else {
|
|
10713
|
-
if (t.cacheSizeBytes !==
|
|
10678
|
+
if (t.cacheSizeBytes !== pi && t.cacheSizeBytes < ze.ih) throw new E(m.INVALID_ARGUMENT, `cacheSizeBytes must be at least ${ze.ih}`);
|
|
10714
10679
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
10715
10680
|
}
|
|
10716
10681
|
is("settings", "boolean", "experimentalForceLongPolling", t.experimentalForceLongPolling),
|
|
@@ -10723,49 +10688,49 @@ class pi {
|
|
|
10723
10688
|
|
|
10724
10689
|
/**
|
|
10725
10690
|
* The root reference to the database.
|
|
10726
|
-
*/ class
|
|
10691
|
+
*/ class yi {
|
|
10727
10692
|
// Note: We are using `MemoryComponentProvider` as a default
|
|
10728
10693
|
// ComponentProvider to ensure backwards compatibility with the format
|
|
10729
10694
|
// expected by the console build.
|
|
10730
|
-
constructor(t, e, s = new
|
|
10731
|
-
if (this.
|
|
10695
|
+
constructor(t, e, s = new Ri) {
|
|
10696
|
+
if (this.dd = null,
|
|
10732
10697
|
// Public for use in tests.
|
|
10733
10698
|
// TODO(mikelehen): Use modularized initialization instead.
|
|
10734
|
-
this.
|
|
10699
|
+
this.fd = new Ge, this.INTERNAL = {
|
|
10735
10700
|
delete: async () => {
|
|
10736
10701
|
// The client must be initalized to ensure that all subsequent API usage
|
|
10737
10702
|
// throws an exception.
|
|
10738
|
-
this.
|
|
10703
|
+
this.wd(), await this.Td.terminate();
|
|
10739
10704
|
}
|
|
10740
10705
|
}, "object" == typeof t.options) {
|
|
10741
10706
|
// This is very likely a Firebase app object
|
|
10742
10707
|
// TODO(b/34177605): Can we somehow use instanceof?
|
|
10743
10708
|
const s = t;
|
|
10744
|
-
this.
|
|
10709
|
+
this.dd = s, this._d = yi.md(s), this.Ed = s.name, this.Rd = new A(e);
|
|
10745
10710
|
} else {
|
|
10746
10711
|
const e = t;
|
|
10747
10712
|
if (!e.projectId) throw new E(m.INVALID_ARGUMENT, "Must provide projectId");
|
|
10748
|
-
this.
|
|
10713
|
+
this._d = new ke(e.projectId, e.database),
|
|
10749
10714
|
// Use a default persistenceKey that lines up with FirebaseApp.
|
|
10750
|
-
this.
|
|
10715
|
+
this.Ed = "[DEFAULT]", this.Rd = new I;
|
|
10751
10716
|
}
|
|
10752
|
-
this.
|
|
10717
|
+
this.Id = s, this.Ad = new gi({}), this.Pd = this.Vd(this._d);
|
|
10753
10718
|
}
|
|
10754
10719
|
settings(t) {
|
|
10755
10720
|
Ye("Firestore.settings", arguments, 1), ts("Firestore.settings", "object", 1, t);
|
|
10756
|
-
const e = new
|
|
10757
|
-
if (this.
|
|
10758
|
-
this.
|
|
10721
|
+
const e = new gi(t);
|
|
10722
|
+
if (this.Td && !this.Ad.isEqual(e)) throw new E(m.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");
|
|
10723
|
+
this.Ad = e, void 0 !== e.credentials && (this.Rd = function(t) {
|
|
10759
10724
|
if (!t) return new I;
|
|
10760
10725
|
switch (t.type) {
|
|
10761
10726
|
case "gapi":
|
|
10762
|
-
const e = t.
|
|
10727
|
+
const e = t.pd;
|
|
10763
10728
|
// Make sure this really is a Gapi client.
|
|
10764
10729
|
return Se(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty), "unexpected gapi interface"),
|
|
10765
10730
|
new V(e, t.V || "0");
|
|
10766
10731
|
|
|
10767
10732
|
case "provider":
|
|
10768
|
-
return t.
|
|
10733
|
+
return t.pd;
|
|
10769
10734
|
|
|
10770
10735
|
default:
|
|
10771
10736
|
throw new E(m.INVALID_ARGUMENT, "makeCredentialsProvider failed due to invalid credential type");
|
|
@@ -10791,30 +10756,30 @@ class pi {
|
|
|
10791
10756
|
(e.credentials));
|
|
10792
10757
|
}
|
|
10793
10758
|
enableNetwork() {
|
|
10794
|
-
return this.
|
|
10759
|
+
return this.wd(), this.Td.enableNetwork();
|
|
10795
10760
|
}
|
|
10796
10761
|
disableNetwork() {
|
|
10797
|
-
return this.
|
|
10762
|
+
return this.wd(), this.Td.disableNetwork();
|
|
10798
10763
|
}
|
|
10799
10764
|
enablePersistence(t) {
|
|
10800
10765
|
var e, s;
|
|
10801
|
-
if (this.
|
|
10766
|
+
if (this.Td) throw new E(m.FAILED_PRECONDITION, "Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");
|
|
10802
10767
|
let i = !1;
|
|
10803
10768
|
return t && (void 0 !== t.experimentalTabSynchronization && ye("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),
|
|
10804
10769
|
i = null !== (s = null !== (e = t.synchronizeTabs) && void 0 !== e ? e : t.experimentalTabSynchronization) && void 0 !== s && s),
|
|
10805
|
-
this.
|
|
10806
|
-
|
|
10807
|
-
cacheSizeBytes: this.
|
|
10770
|
+
this.gd(this.Id, {
|
|
10771
|
+
B_: !0,
|
|
10772
|
+
cacheSizeBytes: this.Ad.cacheSizeBytes,
|
|
10808
10773
|
synchronizeTabs: i
|
|
10809
10774
|
});
|
|
10810
10775
|
}
|
|
10811
10776
|
async clearPersistence() {
|
|
10812
|
-
if (void 0 !== this.
|
|
10777
|
+
if (void 0 !== this.Td && !this.Td.X_) throw new E(m.FAILED_PRECONDITION, "Persistence cannot be cleared after this Firestore instance is initialized.");
|
|
10813
10778
|
const t = new We;
|
|
10814
|
-
return this.
|
|
10779
|
+
return this.fd.Mr(async () => {
|
|
10815
10780
|
try {
|
|
10816
|
-
const e = this.
|
|
10817
|
-
await this.
|
|
10781
|
+
const e = this.yd();
|
|
10782
|
+
await this.Id.clearPersistence(e), t.resolve();
|
|
10818
10783
|
} catch (e) {
|
|
10819
10784
|
t.reject(e);
|
|
10820
10785
|
}
|
|
@@ -10823,24 +10788,24 @@ class pi {
|
|
|
10823
10788
|
terminate() {
|
|
10824
10789
|
return this.app._removeServiceInstance("firestore"), this.INTERNAL.delete();
|
|
10825
10790
|
}
|
|
10826
|
-
get
|
|
10827
|
-
return this.
|
|
10791
|
+
get bd() {
|
|
10792
|
+
return this.wd(), this.Td.X_;
|
|
10828
10793
|
}
|
|
10829
10794
|
waitForPendingWrites() {
|
|
10830
|
-
return this.
|
|
10795
|
+
return this.wd(), this.Td.waitForPendingWrites();
|
|
10831
10796
|
}
|
|
10832
10797
|
onSnapshotsInSync(t) {
|
|
10833
|
-
if (this.
|
|
10798
|
+
if (this.wd(), Pi(t)) return this.vd(t);
|
|
10834
10799
|
{
|
|
10835
10800
|
ts("Firestore.onSnapshotsInSync", "function", 1, t);
|
|
10836
10801
|
const e = {
|
|
10837
10802
|
next: t
|
|
10838
10803
|
};
|
|
10839
|
-
return this
|
|
10804
|
+
return this.vd(e);
|
|
10840
10805
|
}
|
|
10841
10806
|
}
|
|
10842
|
-
|
|
10843
|
-
const e = new
|
|
10807
|
+
vd(t) {
|
|
10808
|
+
const e = new Ai({
|
|
10844
10809
|
next: () => {
|
|
10845
10810
|
t.next && t.next();
|
|
10846
10811
|
},
|
|
@@ -10848,39 +10813,39 @@ class pi {
|
|
|
10848
10813
|
throw ve("Uncaught Error in onSnapshotsInSync");
|
|
10849
10814
|
}
|
|
10850
10815
|
});
|
|
10851
|
-
return this.
|
|
10852
|
-
e.
|
|
10816
|
+
return this.Td.Fl(e), () => {
|
|
10817
|
+
e.sd(), this.Td.Nl(e);
|
|
10853
10818
|
};
|
|
10854
10819
|
}
|
|
10855
|
-
|
|
10856
|
-
return this.
|
|
10820
|
+
wd() {
|
|
10821
|
+
return this.Td ||
|
|
10857
10822
|
// Kick off starting the client but don't actually wait for it.
|
|
10858
10823
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
10859
|
-
this.
|
|
10860
|
-
|
|
10861
|
-
}), this.
|
|
10824
|
+
this.gd(new Ri, {
|
|
10825
|
+
B_: !1
|
|
10826
|
+
}), this.Td;
|
|
10862
10827
|
}
|
|
10863
|
-
|
|
10864
|
-
return new Ne(this.
|
|
10828
|
+
yd() {
|
|
10829
|
+
return new Ne(this._d, this.Ed, this.Ad.host, this.Ad.ssl, this.Ad.forceLongPolling);
|
|
10865
10830
|
}
|
|
10866
|
-
|
|
10867
|
-
const s = this.
|
|
10868
|
-
return this.
|
|
10831
|
+
gd(t, e) {
|
|
10832
|
+
const s = this.yd();
|
|
10833
|
+
return this.Td = new Ii(Ae.Ot(), s, this.Rd, this.fd), this.Td.start(t, e);
|
|
10869
10834
|
}
|
|
10870
|
-
|
|
10835
|
+
Vd(t) {
|
|
10871
10836
|
const e = new Re(t, {
|
|
10872
10837
|
di: Ae.Ot().di
|
|
10873
10838
|
});
|
|
10874
10839
|
return new $s(e, e => {
|
|
10875
|
-
if (e instanceof
|
|
10876
|
-
const s = t, i = e.firestore.
|
|
10840
|
+
if (e instanceof Si) {
|
|
10841
|
+
const s = t, i = e.firestore._d;
|
|
10877
10842
|
if (!i.isEqual(s)) throw new E(m.INVALID_ARGUMENT, "Document reference is for database " + `${i.projectId}/${i.database} but should be ` + `for database ${s.projectId}/${s.database}`);
|
|
10878
|
-
return new Ls(t, e.
|
|
10843
|
+
return new Ls(t, e.Sd);
|
|
10879
10844
|
}
|
|
10880
10845
|
return e;
|
|
10881
10846
|
});
|
|
10882
10847
|
}
|
|
10883
|
-
static
|
|
10848
|
+
static md(t) {
|
|
10884
10849
|
if (e = t.options, s = "projectId", !Object.prototype.hasOwnProperty.call(e, s)) throw new E(m.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
|
|
10885
10850
|
var e, s;
|
|
10886
10851
|
// Export the classes with a private constructor (it will fail if invoked
|
|
@@ -10892,28 +10857,28 @@ class pi {
|
|
|
10892
10857
|
return new ke(i);
|
|
10893
10858
|
}
|
|
10894
10859
|
get app() {
|
|
10895
|
-
if (!this.
|
|
10896
|
-
return this.
|
|
10860
|
+
if (!this.dd) throw new E(m.FAILED_PRECONDITION, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
10861
|
+
return this.dd;
|
|
10897
10862
|
}
|
|
10898
10863
|
collection(t) {
|
|
10899
10864
|
return Ye("Firestore.collection", arguments, 1), ts("Firestore.collection", "non-empty string", 1, t),
|
|
10900
|
-
this.
|
|
10865
|
+
this.wd(), new Li(b.K(t), this);
|
|
10901
10866
|
}
|
|
10902
10867
|
doc(t) {
|
|
10903
10868
|
return Ye("Firestore.doc", arguments, 1), ts("Firestore.doc", "non-empty string", 1, t),
|
|
10904
|
-
this.
|
|
10869
|
+
this.wd(), Si.Cd(b.K(t), this);
|
|
10905
10870
|
}
|
|
10906
10871
|
collectionGroup(t) {
|
|
10907
10872
|
if (Ye("Firestore.collectionGroup", arguments, 1), ts("Firestore.collectionGroup", "non-empty string", 1, t),
|
|
10908
10873
|
t.indexOf("/") >= 0) throw new E(m.INVALID_ARGUMENT, `Invalid collection ID '${t}' passed to function ` + "Firestore.collectionGroup(). Collection IDs must not contain '/'.");
|
|
10909
|
-
return this.
|
|
10874
|
+
return this.wd(), new Ni(new St(b.H, t), this);
|
|
10910
10875
|
}
|
|
10911
10876
|
runTransaction(t) {
|
|
10912
10877
|
return Ye("Firestore.runTransaction", arguments, 1), ts("Firestore.runTransaction", "function", 1, t),
|
|
10913
|
-
this.
|
|
10878
|
+
this.wd().transaction(e => t(new bi(this, e)));
|
|
10914
10879
|
}
|
|
10915
10880
|
batch() {
|
|
10916
|
-
return this.
|
|
10881
|
+
return this.wd(), new vi(this);
|
|
10917
10882
|
}
|
|
10918
10883
|
static get logLevel() {
|
|
10919
10884
|
switch (Ve()) {
|
|
@@ -10949,175 +10914,175 @@ class pi {
|
|
|
10949
10914
|
}
|
|
10950
10915
|
// Note: this is not a property because the minifier can't work correctly with
|
|
10951
10916
|
// the way TypeScript compiler outputs properties.
|
|
10952
|
-
|
|
10953
|
-
return this.
|
|
10917
|
+
Dd() {
|
|
10918
|
+
return this.Ad.timestampsInSnapshots;
|
|
10954
10919
|
}
|
|
10955
10920
|
}
|
|
10956
10921
|
|
|
10957
10922
|
/**
|
|
10958
10923
|
* A reference to a transaction.
|
|
10959
|
-
*/ class
|
|
10924
|
+
*/ class bi {
|
|
10960
10925
|
constructor(t, e) {
|
|
10961
|
-
this.
|
|
10926
|
+
this.Fd = t, this.Nd = e;
|
|
10962
10927
|
}
|
|
10963
10928
|
get(t) {
|
|
10964
10929
|
Ye("Transaction.get", arguments, 1);
|
|
10965
|
-
const e =
|
|
10966
|
-
return this.
|
|
10930
|
+
const e = Ui("Transaction.get", t, this.Fd);
|
|
10931
|
+
return this.Nd.za([ e.Sd ]).then(t => {
|
|
10967
10932
|
if (!t || 1 !== t.length) return ve("Mismatch in docs returned from document lookup.");
|
|
10968
10933
|
const s = t[0];
|
|
10969
|
-
if (s instanceof yt) return new
|
|
10934
|
+
if (s instanceof yt) return new Di(this.Fd, e.Sd, null,
|
|
10970
10935
|
/* fromCache= */ !1,
|
|
10971
|
-
/* hasPendingWrites= */ !1, e.
|
|
10972
|
-
if (s instanceof gt) return new
|
|
10936
|
+
/* hasPendingWrites= */ !1, e.kd);
|
|
10937
|
+
if (s instanceof gt) return new Di(this.Fd, e.Sd, s,
|
|
10973
10938
|
/* fromCache= */ !1,
|
|
10974
|
-
/* hasPendingWrites= */ !1, e.
|
|
10939
|
+
/* hasPendingWrites= */ !1, e.kd);
|
|
10975
10940
|
throw ve(`BatchGetDocumentsRequest returned unexpected document type: ${s.constructor.name}`);
|
|
10976
10941
|
});
|
|
10977
10942
|
}
|
|
10978
10943
|
set(t, e, s) {
|
|
10979
10944
|
Ze("Transaction.set", arguments, 2, 3);
|
|
10980
|
-
const i =
|
|
10981
|
-
s =
|
|
10982
|
-
const [n, r] =
|
|
10983
|
-
return this.
|
|
10945
|
+
const i = Ui("Transaction.set", t, this.Fd);
|
|
10946
|
+
s = $i("Transaction.set", s);
|
|
10947
|
+
const [n, r] = Bi(i.kd, e, "Transaction.set"), h = s.merge || s.mergeFields ? this.Fd.Pd.zo(r, n, s.mergeFields) : this.Fd.Pd.jo(r, n);
|
|
10948
|
+
return this.Nd.set(i.Sd, h), this;
|
|
10984
10949
|
}
|
|
10985
10950
|
update(t, e, s, ...i) {
|
|
10986
10951
|
let n, r;
|
|
10987
10952
|
return "string" == typeof e || e instanceof Is ? (Xe("Transaction.update", arguments, 3),
|
|
10988
|
-
n =
|
|
10989
|
-
n =
|
|
10990
|
-
this.
|
|
10953
|
+
n = Ui("Transaction.update", t, this.Fd), r = this.Fd.Pd.Yo("Transaction.update", e, s, i)) : (Ye("Transaction.update", arguments, 2),
|
|
10954
|
+
n = Ui("Transaction.update", t, this.Fd), r = this.Fd.Pd.Ko("Transaction.update", e)),
|
|
10955
|
+
this.Nd.update(n.Sd, r), this;
|
|
10991
10956
|
}
|
|
10992
10957
|
delete(t) {
|
|
10993
10958
|
Ye("Transaction.delete", arguments, 1);
|
|
10994
|
-
const e =
|
|
10995
|
-
return this.
|
|
10959
|
+
const e = Ui("Transaction.delete", t, this.Fd);
|
|
10960
|
+
return this.Nd.delete(e.Sd), this;
|
|
10996
10961
|
}
|
|
10997
10962
|
}
|
|
10998
10963
|
|
|
10999
|
-
class
|
|
10964
|
+
class vi {
|
|
11000
10965
|
constructor(t) {
|
|
11001
|
-
this.
|
|
10966
|
+
this.Fd = t, this.Ld = [], this.$d = !1;
|
|
11002
10967
|
}
|
|
11003
10968
|
set(t, e, s) {
|
|
11004
|
-
Ze("WriteBatch.set", arguments, 2, 3), this.
|
|
11005
|
-
const i =
|
|
11006
|
-
s =
|
|
11007
|
-
const [n, r] =
|
|
11008
|
-
return this.
|
|
10969
|
+
Ze("WriteBatch.set", arguments, 2, 3), this.Od();
|
|
10970
|
+
const i = Ui("WriteBatch.set", t, this.Fd);
|
|
10971
|
+
s = $i("WriteBatch.set", s);
|
|
10972
|
+
const [n, r] = Bi(i.kd, e, "WriteBatch.set"), h = s.merge || s.mergeFields ? this.Fd.Pd.zo(r, n, s.mergeFields) : this.Fd.Pd.jo(r, n);
|
|
10973
|
+
return this.Ld = this.Ld.concat(h.Lo(i.Sd, wt.NONE)), this;
|
|
11009
10974
|
}
|
|
11010
10975
|
update(t, e, s, ...i) {
|
|
11011
10976
|
let n, r;
|
|
11012
|
-
return this.
|
|
11013
|
-
n =
|
|
11014
|
-
n =
|
|
11015
|
-
this.
|
|
10977
|
+
return this.Od(), "string" == typeof e || e instanceof Is ? (Xe("WriteBatch.update", arguments, 3),
|
|
10978
|
+
n = Ui("WriteBatch.update", t, this.Fd), r = this.Fd.Pd.Yo("WriteBatch.update", e, s, i)) : (Ye("WriteBatch.update", arguments, 2),
|
|
10979
|
+
n = Ui("WriteBatch.update", t, this.Fd), r = this.Fd.Pd.Ko("WriteBatch.update", e)),
|
|
10980
|
+
this.Ld = this.Ld.concat(r.Lo(n.Sd, wt.exists(!0))), this;
|
|
11016
10981
|
}
|
|
11017
10982
|
delete(t) {
|
|
11018
|
-
Ye("WriteBatch.delete", arguments, 1), this.
|
|
11019
|
-
const e =
|
|
11020
|
-
return this.
|
|
10983
|
+
Ye("WriteBatch.delete", arguments, 1), this.Od();
|
|
10984
|
+
const e = Ui("WriteBatch.delete", t, this.Fd);
|
|
10985
|
+
return this.Ld = this.Ld.concat(new It(e.Sd, wt.NONE)), this;
|
|
11021
10986
|
}
|
|
11022
10987
|
commit() {
|
|
11023
|
-
return this.
|
|
10988
|
+
return this.Od(), this.$d = !0, this.Ld.length > 0 ? this.Fd.wd().write(this.Ld) : Promise.resolve();
|
|
11024
10989
|
}
|
|
11025
|
-
|
|
11026
|
-
if (this
|
|
10990
|
+
Od() {
|
|
10991
|
+
if (this.$d) throw new E(m.FAILED_PRECONDITION, "A write batch can no longer be used after commit() has been called.");
|
|
11027
10992
|
}
|
|
11028
10993
|
}
|
|
11029
10994
|
|
|
11030
10995
|
/**
|
|
11031
10996
|
* A reference to a particular document in a collection in the database.
|
|
11032
|
-
*/ class
|
|
10997
|
+
*/ class Si {
|
|
11033
10998
|
constructor(t, e, s) {
|
|
11034
|
-
this.
|
|
10999
|
+
this.Sd = t, this.firestore = e, this.kd = s, this.Td = this.firestore.wd();
|
|
11035
11000
|
}
|
|
11036
|
-
static
|
|
11001
|
+
static Cd(t, e, s) {
|
|
11037
11002
|
if (t.length % 2 != 0) throw new E(m.INVALID_ARGUMENT, "Invalid document reference. Document references must have an even number of segments, but " + `${t.G()} has ${t.length}`);
|
|
11038
|
-
return new
|
|
11003
|
+
return new Si(new C(t), e, s);
|
|
11039
11004
|
}
|
|
11040
11005
|
get id() {
|
|
11041
|
-
return this.
|
|
11006
|
+
return this.Sd.path.U();
|
|
11042
11007
|
}
|
|
11043
11008
|
get parent() {
|
|
11044
|
-
return new
|
|
11009
|
+
return new Li(this.Sd.path.O(), this.firestore, this.kd);
|
|
11045
11010
|
}
|
|
11046
11011
|
get path() {
|
|
11047
|
-
return this.
|
|
11012
|
+
return this.Sd.path.G();
|
|
11048
11013
|
}
|
|
11049
11014
|
collection(t) {
|
|
11050
11015
|
if (Ye("DocumentReference.collection", arguments, 1), ts("DocumentReference.collection", "non-empty string", 1, t),
|
|
11051
11016
|
!t) throw new E(m.INVALID_ARGUMENT, "Must provide a non-empty collection name to collection()");
|
|
11052
11017
|
const e = b.K(t);
|
|
11053
|
-
return new
|
|
11018
|
+
return new Li(this.Sd.path.child(e), this.firestore);
|
|
11054
11019
|
}
|
|
11055
11020
|
isEqual(t) {
|
|
11056
|
-
if (!(t instanceof
|
|
11057
|
-
return this.firestore === t.firestore && this.
|
|
11021
|
+
if (!(t instanceof Si)) throw ls("isEqual", "DocumentReference", 1, t);
|
|
11022
|
+
return this.firestore === t.firestore && this.Sd.isEqual(t.Sd) && this.kd === t.kd;
|
|
11058
11023
|
}
|
|
11059
11024
|
set(t, e) {
|
|
11060
|
-
Ze("DocumentReference.set", arguments, 1, 2), e =
|
|
11061
|
-
const [s, i] =
|
|
11062
|
-
return this.
|
|
11025
|
+
Ze("DocumentReference.set", arguments, 1, 2), e = $i("DocumentReference.set", e);
|
|
11026
|
+
const [s, i] = Bi(this.kd, t, "DocumentReference.set"), n = e.merge || e.mergeFields ? this.firestore.Pd.zo(i, s, e.mergeFields) : this.firestore.Pd.jo(i, s);
|
|
11027
|
+
return this.Td.write(n.Lo(this.Sd, wt.NONE));
|
|
11063
11028
|
}
|
|
11064
11029
|
update(t, e, ...s) {
|
|
11065
11030
|
let i;
|
|
11066
11031
|
return "string" == typeof t || t instanceof Is ? (Xe("DocumentReference.update", arguments, 2),
|
|
11067
|
-
i = this.firestore.
|
|
11068
|
-
i = this.firestore.
|
|
11032
|
+
i = this.firestore.Pd.Yo("DocumentReference.update", t, e, s)) : (Ye("DocumentReference.update", arguments, 1),
|
|
11033
|
+
i = this.firestore.Pd.Ko("DocumentReference.update", t)), this.Td.write(i.Lo(this.Sd, wt.exists(!0)));
|
|
11069
11034
|
}
|
|
11070
11035
|
delete() {
|
|
11071
|
-
return Ye("DocumentReference.delete", arguments, 0), this.
|
|
11036
|
+
return Ye("DocumentReference.delete", arguments, 0), this.Td.write([ new It(this.Sd, wt.NONE) ]);
|
|
11072
11037
|
}
|
|
11073
11038
|
onSnapshot(...t) {
|
|
11074
11039
|
Ze("DocumentReference.onSnapshot", arguments, 1, 4);
|
|
11075
11040
|
let e, s = {
|
|
11076
11041
|
includeMetadataChanges: !1
|
|
11077
11042
|
}, i = 0;
|
|
11078
|
-
"object" != typeof t[i] ||
|
|
11043
|
+
"object" != typeof t[i] || Pi(t[i]) || (s = t[i], cs("DocumentReference.onSnapshot", s, [ "includeMetadataChanges" ]),
|
|
11079
11044
|
is("DocumentReference.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges),
|
|
11080
11045
|
i++);
|
|
11081
11046
|
const n = {
|
|
11082
11047
|
includeMetadataChanges: s.includeMetadataChanges
|
|
11083
11048
|
};
|
|
11084
|
-
return
|
|
11049
|
+
return Pi(t[i]) ? e = t[i] : (ts("DocumentReference.onSnapshot", "function", i, t[i]),
|
|
11085
11050
|
es("DocumentReference.onSnapshot", "function", i + 1, t[i + 1]), es("DocumentReference.onSnapshot", "function", i + 2, t[i + 2]),
|
|
11086
11051
|
e = {
|
|
11087
11052
|
next: t[i],
|
|
11088
11053
|
error: t[i + 1],
|
|
11089
11054
|
complete: t[i + 2]
|
|
11090
|
-
}), this.
|
|
11055
|
+
}), this.Md(n, e);
|
|
11091
11056
|
}
|
|
11092
|
-
|
|
11057
|
+
Md(t, e) {
|
|
11093
11058
|
let s = t => {
|
|
11094
11059
|
console.error("Uncaught Error in onSnapshot:", t);
|
|
11095
11060
|
};
|
|
11096
11061
|
e.error && (s = e.error.bind(e));
|
|
11097
|
-
const i = new
|
|
11062
|
+
const i = new Ai({
|
|
11098
11063
|
next: t => {
|
|
11099
11064
|
if (e.next) {
|
|
11100
|
-
const s = t.docs.get(this.
|
|
11101
|
-
e.next(new
|
|
11065
|
+
const s = t.docs.get(this.Sd);
|
|
11066
|
+
e.next(new Di(this.firestore, this.Sd, s, t.fromCache, t.hasPendingWrites, this.kd));
|
|
11102
11067
|
}
|
|
11103
11068
|
},
|
|
11104
11069
|
error: s
|
|
11105
|
-
}), n = this.
|
|
11070
|
+
}), n = this.Td.listen(St.ve(this.Sd.path), i, t);
|
|
11106
11071
|
return () => {
|
|
11107
|
-
i.
|
|
11072
|
+
i.sd(), this.Td.$u(n);
|
|
11108
11073
|
};
|
|
11109
11074
|
}
|
|
11110
11075
|
get(t) {
|
|
11111
|
-
return Ze("DocumentReference.get", arguments, 0, 1),
|
|
11076
|
+
return Ze("DocumentReference.get", arguments, 0, 1), Mi("DocumentReference.get", t),
|
|
11112
11077
|
new Promise((e, s) => {
|
|
11113
|
-
t && "cache" === t.source ? this.firestore.
|
|
11114
|
-
e(new
|
|
11115
|
-
/*fromCache=*/ !0, t instanceof gt && t.te, this.
|
|
11116
|
-
}, s) : this.
|
|
11078
|
+
t && "cache" === t.source ? this.firestore.wd().Z_(this.Sd).then(t => {
|
|
11079
|
+
e(new Di(this.firestore, this.Sd, t,
|
|
11080
|
+
/*fromCache=*/ !0, t instanceof gt && t.te, this.kd));
|
|
11081
|
+
}, s) : this.Ud(e, s, t);
|
|
11117
11082
|
});
|
|
11118
11083
|
}
|
|
11119
|
-
|
|
11120
|
-
const i = this.
|
|
11084
|
+
Ud(t, e, s) {
|
|
11085
|
+
const i = this.Md({
|
|
11121
11086
|
includeMetadataChanges: !0,
|
|
11122
11087
|
ql: !0
|
|
11123
11088
|
}, {
|
|
@@ -11138,11 +11103,11 @@ class bi {
|
|
|
11138
11103
|
});
|
|
11139
11104
|
}
|
|
11140
11105
|
withConverter(t) {
|
|
11141
|
-
return new
|
|
11106
|
+
return new Si(this.Sd, this.firestore, t);
|
|
11142
11107
|
}
|
|
11143
11108
|
}
|
|
11144
11109
|
|
|
11145
|
-
class
|
|
11110
|
+
class Ci {
|
|
11146
11111
|
constructor(t, e) {
|
|
11147
11112
|
this.hasPendingWrites = t, this.fromCache = e;
|
|
11148
11113
|
}
|
|
@@ -11151,59 +11116,59 @@ class Si {
|
|
|
11151
11116
|
}
|
|
11152
11117
|
}
|
|
11153
11118
|
|
|
11154
|
-
class
|
|
11119
|
+
class Di {
|
|
11155
11120
|
constructor(t, e, s, i, n, r) {
|
|
11156
|
-
this.
|
|
11121
|
+
this.Fd = t, this.Sd = e, this.qd = s, this.Bd = i, this.xd = n, this.kd = r;
|
|
11157
11122
|
}
|
|
11158
11123
|
data(t) {
|
|
11159
|
-
if (Ze("DocumentSnapshot.data", arguments, 0, 1), t =
|
|
11160
|
-
this.
|
|
11124
|
+
if (Ze("DocumentSnapshot.data", arguments, 0, 1), t = Oi("DocumentSnapshot.data", t),
|
|
11125
|
+
this.qd) {
|
|
11161
11126
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
11162
11127
|
// if a converter has been provided.
|
|
11163
|
-
if (this.
|
|
11164
|
-
const e = new
|
|
11165
|
-
return this.
|
|
11128
|
+
if (this.kd) {
|
|
11129
|
+
const e = new Fi(this.Fd, this.Sd, this.qd, this.Bd, this.xd);
|
|
11130
|
+
return this.kd.fromFirestore(e, t);
|
|
11166
11131
|
}
|
|
11167
|
-
return new
|
|
11168
|
-
/* converter= */ void 0).
|
|
11132
|
+
return new Vi(this.Fd, this.Fd.Dd(), t.serverTimestamps,
|
|
11133
|
+
/* converter= */ void 0).rd(this.qd.Re());
|
|
11169
11134
|
}
|
|
11170
11135
|
}
|
|
11171
11136
|
get(t, e) {
|
|
11172
|
-
if (Ze("DocumentSnapshot.get", arguments, 1, 2), e =
|
|
11173
|
-
this.
|
|
11174
|
-
const s = this.
|
|
11137
|
+
if (Ze("DocumentSnapshot.get", arguments, 1, 2), e = Oi("DocumentSnapshot.get", e),
|
|
11138
|
+
this.qd) {
|
|
11139
|
+
const s = this.qd.data().field(Us("DocumentSnapshot.get", t));
|
|
11175
11140
|
if (null !== s) {
|
|
11176
|
-
return new
|
|
11141
|
+
return new Vi(this.Fd, this.Fd.Dd(), e.serverTimestamps, this.kd).rd(s);
|
|
11177
11142
|
}
|
|
11178
11143
|
}
|
|
11179
11144
|
}
|
|
11180
11145
|
get id() {
|
|
11181
|
-
return this.
|
|
11146
|
+
return this.Sd.path.U();
|
|
11182
11147
|
}
|
|
11183
11148
|
get ref() {
|
|
11184
|
-
return new
|
|
11149
|
+
return new Si(this.Sd, this.Fd, this.kd);
|
|
11185
11150
|
}
|
|
11186
11151
|
get exists() {
|
|
11187
|
-
return null !== this.
|
|
11152
|
+
return null !== this.qd;
|
|
11188
11153
|
}
|
|
11189
11154
|
get metadata() {
|
|
11190
|
-
return new
|
|
11155
|
+
return new Ci(this.xd, this.Bd);
|
|
11191
11156
|
}
|
|
11192
11157
|
isEqual(t) {
|
|
11193
|
-
if (!(t instanceof
|
|
11194
|
-
return this.
|
|
11158
|
+
if (!(t instanceof Di)) throw ls("isEqual", "DocumentSnapshot", 1, t);
|
|
11159
|
+
return this.Fd === t.Fd && this.Bd === t.Bd && this.Sd.isEqual(t.Sd) && (null === this.qd ? null === t.qd : this.qd.isEqual(t.qd)) && this.kd === t.kd;
|
|
11195
11160
|
}
|
|
11196
11161
|
}
|
|
11197
11162
|
|
|
11198
|
-
class
|
|
11163
|
+
class Fi extends Di {
|
|
11199
11164
|
data(t) {
|
|
11200
11165
|
return super.data(t);
|
|
11201
11166
|
}
|
|
11202
11167
|
}
|
|
11203
11168
|
|
|
11204
|
-
class
|
|
11169
|
+
class Ni {
|
|
11205
11170
|
constructor(t, e, s) {
|
|
11206
|
-
this.
|
|
11171
|
+
this.Qd = t, this.firestore = e, this.kd = s;
|
|
11207
11172
|
}
|
|
11208
11173
|
where(t, e, s) {
|
|
11209
11174
|
Ye("Query.where", arguments, 3), us("Query.where", 3, s);
|
|
@@ -11215,20 +11180,20 @@ class Fi {
|
|
|
11215
11180
|
if (n.Y()) {
|
|
11216
11181
|
if (r === Ct.ARRAY_CONTAINS || r === Ct.ARRAY_CONTAINS_ANY) throw new E(m.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r.toString()}' ` + "queries on FieldPath.documentId().");
|
|
11217
11182
|
if (r === Ct.IN) {
|
|
11218
|
-
this.
|
|
11183
|
+
this.Wd(s, r);
|
|
11219
11184
|
const t = [];
|
|
11220
|
-
for (const e of s) t.push(this.
|
|
11185
|
+
for (const e of s) t.push(this.jd(e));
|
|
11221
11186
|
i = {
|
|
11222
11187
|
arrayValue: {
|
|
11223
11188
|
values: t
|
|
11224
11189
|
}
|
|
11225
11190
|
};
|
|
11226
|
-
} else i = this.
|
|
11227
|
-
} else r !== Ct.IN && r !== Ct.ARRAY_CONTAINS_ANY || this.
|
|
11191
|
+
} else i = this.jd(s);
|
|
11192
|
+
} else r !== Ct.IN && r !== Ct.ARRAY_CONTAINS_ANY || this.Wd(s, r), i = this.firestore.Pd.Xo("Query.where", s,
|
|
11228
11193
|
// We only allow nested arrays for IN queries.
|
|
11229
11194
|
/** allowArrays = */ r === Ct.IN);
|
|
11230
11195
|
const h = Dt.create(n, r, i);
|
|
11231
|
-
return this.
|
|
11196
|
+
return this.Gd(h), new Ni(this.Qd.De(h), this.firestore, this.kd);
|
|
11232
11197
|
}
|
|
11233
11198
|
orderBy(t, e) {
|
|
11234
11199
|
let s;
|
|
@@ -11237,60 +11202,60 @@ class Fi {
|
|
|
11237
11202
|
if ("desc" !== e) throw new E(m.INVALID_ARGUMENT, `Function Query.orderBy() has unknown direction '${e}', ` + "expected 'asc' or 'desc'.");
|
|
11238
11203
|
s = Ot.DESCENDING;
|
|
11239
11204
|
}
|
|
11240
|
-
if (null !== this.
|
|
11241
|
-
if (null !== this.
|
|
11205
|
+
if (null !== this.Qd.startAt) throw new E(m.INVALID_ARGUMENT, "Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");
|
|
11206
|
+
if (null !== this.Qd.endAt) throw new E(m.INVALID_ARGUMENT, "Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");
|
|
11242
11207
|
const i = Us("Query.orderBy", t), n = new Ut(i, s);
|
|
11243
|
-
return this.
|
|
11208
|
+
return this.zd(n), new Ni(this.Qd.Fe(n), this.firestore, this.kd);
|
|
11244
11209
|
}
|
|
11245
11210
|
limit(t) {
|
|
11246
11211
|
return Ye("Query.limit", arguments, 1), ts("Query.limit", "number", 1, t), _s("Query.limit", 1, t),
|
|
11247
|
-
new
|
|
11212
|
+
new Ni(this.Qd.Ne(t), this.firestore, this.kd);
|
|
11248
11213
|
}
|
|
11249
11214
|
limitToLast(t) {
|
|
11250
11215
|
return Ye("Query.limitToLast", arguments, 1), ts("Query.limitToLast", "number", 1, t),
|
|
11251
|
-
_s("Query.limitToLast", 1, t), new
|
|
11216
|
+
_s("Query.limitToLast", 1, t), new Ni(this.Qd.ke(t), this.firestore, this.kd);
|
|
11252
11217
|
}
|
|
11253
11218
|
startAt(t, ...e) {
|
|
11254
11219
|
Xe("Query.startAt", arguments, 1);
|
|
11255
|
-
const s = this.
|
|
11220
|
+
const s = this.Kd("Query.startAt", t, e,
|
|
11256
11221
|
/*before=*/ !0);
|
|
11257
|
-
return new
|
|
11222
|
+
return new Ni(this.Qd.Le(s), this.firestore, this.kd);
|
|
11258
11223
|
}
|
|
11259
11224
|
startAfter(t, ...e) {
|
|
11260
11225
|
Xe("Query.startAfter", arguments, 1);
|
|
11261
|
-
const s = this.
|
|
11226
|
+
const s = this.Kd("Query.startAfter", t, e,
|
|
11262
11227
|
/*before=*/ !1);
|
|
11263
|
-
return new
|
|
11228
|
+
return new Ni(this.Qd.Le(s), this.firestore, this.kd);
|
|
11264
11229
|
}
|
|
11265
11230
|
endBefore(t, ...e) {
|
|
11266
11231
|
Xe("Query.endBefore", arguments, 1);
|
|
11267
|
-
const s = this.
|
|
11232
|
+
const s = this.Kd("Query.endBefore", t, e,
|
|
11268
11233
|
/*before=*/ !0);
|
|
11269
|
-
return new
|
|
11234
|
+
return new Ni(this.Qd.$e(s), this.firestore, this.kd);
|
|
11270
11235
|
}
|
|
11271
11236
|
endAt(t, ...e) {
|
|
11272
11237
|
Xe("Query.endAt", arguments, 1);
|
|
11273
|
-
const s = this.
|
|
11238
|
+
const s = this.Kd("Query.endAt", t, e,
|
|
11274
11239
|
/*before=*/ !1);
|
|
11275
|
-
return new
|
|
11240
|
+
return new Ni(this.Qd.$e(s), this.firestore, this.kd);
|
|
11276
11241
|
}
|
|
11277
11242
|
isEqual(t) {
|
|
11278
|
-
if (!(t instanceof
|
|
11279
|
-
return this.firestore === t.firestore && this.
|
|
11243
|
+
if (!(t instanceof Ni)) throw ls("isEqual", "Query", 1, t);
|
|
11244
|
+
return this.firestore === t.firestore && this.Qd.isEqual(t.Qd);
|
|
11280
11245
|
}
|
|
11281
11246
|
withConverter(t) {
|
|
11282
|
-
return new
|
|
11247
|
+
return new Ni(this.Qd, this.firestore, t);
|
|
11283
11248
|
}
|
|
11284
|
-
/** Helper function to create a bound from a document or fields */
|
|
11285
|
-
if (us(t, 1, e), e instanceof
|
|
11249
|
+
/** Helper function to create a bound from a document or fields */ Kd(t, e, s, i) {
|
|
11250
|
+
if (us(t, 1, e), e instanceof Di) {
|
|
11286
11251
|
if (s.length > 0) throw new E(m.INVALID_ARGUMENT, `Too many arguments provided to ${t}().`);
|
|
11287
11252
|
const n = e;
|
|
11288
11253
|
if (!n.exists) throw new E(m.NOT_FOUND, "Can't use a DocumentSnapshot that doesn't exist for " + `${t}().`);
|
|
11289
|
-
return this.
|
|
11254
|
+
return this.Hd(n.qd, i);
|
|
11290
11255
|
}
|
|
11291
11256
|
{
|
|
11292
11257
|
const n = [ e ].concat(s);
|
|
11293
|
-
return this.
|
|
11258
|
+
return this.Jd(t, n, i);
|
|
11294
11259
|
}
|
|
11295
11260
|
}
|
|
11296
11261
|
/**
|
|
@@ -11303,7 +11268,7 @@ class Fi {
|
|
|
11303
11268
|
* Will throw if the document does not contain all fields of the order by
|
|
11304
11269
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
11305
11270
|
* server timestamp.
|
|
11306
|
-
*/
|
|
11271
|
+
*/ Hd(t, e) {
|
|
11307
11272
|
const s = [];
|
|
11308
11273
|
// Because people expect to continue/end a query at the exact document
|
|
11309
11274
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -11312,7 +11277,7 @@ class Fi {
|
|
|
11312
11277
|
// the provided document. Without the key (by using the explicit sort
|
|
11313
11278
|
// orders), multiple documents could match the position, yielding duplicate
|
|
11314
11279
|
// results.
|
|
11315
|
-
for (const e of this.
|
|
11280
|
+
for (const e of this.Qd.orderBy) if (e.field.Y()) s.push(et(this.firestore._d, t.key)); else {
|
|
11316
11281
|
const i = t.field(e.field);
|
|
11317
11282
|
if (x(i)) throw new E(m.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
11318
11283
|
if (null === i) {
|
|
@@ -11325,22 +11290,22 @@ class Fi {
|
|
|
11325
11290
|
}
|
|
11326
11291
|
/**
|
|
11327
11292
|
* Converts a list of field values to a Bound for the given query.
|
|
11328
|
-
*/
|
|
11293
|
+
*/ Jd(t, e, s) {
|
|
11329
11294
|
// Use explicit order by's because it has to match the query the user made
|
|
11330
|
-
const i = this.
|
|
11295
|
+
const i = this.Qd.Ve;
|
|
11331
11296
|
if (e.length > i.length) throw new E(m.INVALID_ARGUMENT, `Too many arguments provided to ${t}(). ` + "The number of arguments must be less than or equal to the number of Query.orderBy() clauses");
|
|
11332
11297
|
const n = [];
|
|
11333
11298
|
for (let s = 0; s < e.length; s++) {
|
|
11334
11299
|
const r = e[s];
|
|
11335
11300
|
if (i[s].field.Y()) {
|
|
11336
11301
|
if ("string" != typeof r) throw new E(m.INVALID_ARGUMENT, "Invalid query. Expected a string for document ID in " + `${t}(), but got a ${typeof r}`);
|
|
11337
|
-
if (!this.
|
|
11338
|
-
const e = this.
|
|
11302
|
+
if (!this.Qd.He() && -1 !== r.indexOf("/")) throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), " + `the value passed to ${t}() must be a plain document ID, but ` + `'${r}' contains a slash.`);
|
|
11303
|
+
const e = this.Qd.path.child(b.K(r));
|
|
11339
11304
|
if (!C.st(e)) throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying a collection group and ordering by " + `FieldPath.documentId(), the value passed to ${t}() must result in a ` + `valid document path, but '${e}' is not because it contains an odd number ` + "of segments.");
|
|
11340
11305
|
const s = new C(e);
|
|
11341
|
-
n.push(et(this.firestore.
|
|
11306
|
+
n.push(et(this.firestore._d, s));
|
|
11342
11307
|
} else {
|
|
11343
|
-
const e = this.firestore.
|
|
11308
|
+
const e = this.firestore.Pd.Xo(t, r);
|
|
11344
11309
|
n.push(e);
|
|
11345
11310
|
}
|
|
11346
11311
|
}
|
|
@@ -11349,42 +11314,42 @@ class Fi {
|
|
|
11349
11314
|
onSnapshot(...t) {
|
|
11350
11315
|
Ze("Query.onSnapshot", arguments, 1, 4);
|
|
11351
11316
|
let e, s = {}, i = 0;
|
|
11352
|
-
return "object" != typeof t[i] ||
|
|
11317
|
+
return "object" != typeof t[i] || Pi(t[i]) || (s = t[i], cs("Query.onSnapshot", s, [ "includeMetadataChanges" ]),
|
|
11353
11318
|
is("Query.onSnapshot", "boolean", "includeMetadataChanges", s.includeMetadataChanges),
|
|
11354
|
-
i++),
|
|
11319
|
+
i++), Pi(t[i]) ? e = t[i] : (ts("Query.onSnapshot", "function", i, t[i]), es("Query.onSnapshot", "function", i + 1, t[i + 1]),
|
|
11355
11320
|
es("Query.onSnapshot", "function", i + 2, t[i + 2]), e = {
|
|
11356
11321
|
next: t[i],
|
|
11357
11322
|
error: t[i + 1],
|
|
11358
11323
|
complete: t[i + 2]
|
|
11359
|
-
}), this.
|
|
11324
|
+
}), this.Yd(this.Qd), this.Md(s, e);
|
|
11360
11325
|
}
|
|
11361
|
-
|
|
11326
|
+
Md(t, e) {
|
|
11362
11327
|
let s = t => {
|
|
11363
11328
|
console.error("Uncaught Error in onSnapshot:", t);
|
|
11364
11329
|
};
|
|
11365
11330
|
e.error && (s = e.error.bind(e));
|
|
11366
|
-
const i = new
|
|
11331
|
+
const i = new Ai({
|
|
11367
11332
|
next: t => {
|
|
11368
|
-
e.next && e.next(new
|
|
11333
|
+
e.next && e.next(new ki(this.firestore, this.Qd, t, this.kd));
|
|
11369
11334
|
},
|
|
11370
11335
|
error: s
|
|
11371
|
-
}), n = this.firestore.
|
|
11336
|
+
}), n = this.firestore.wd(), r = n.listen(this.Qd, i, t);
|
|
11372
11337
|
return () => {
|
|
11373
|
-
i.
|
|
11338
|
+
i.sd(), n.$u(r);
|
|
11374
11339
|
};
|
|
11375
11340
|
}
|
|
11376
|
-
|
|
11341
|
+
Yd(t) {
|
|
11377
11342
|
if (t.Ge() && 0 === t.Ve.length) throw new E(m.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
11378
11343
|
}
|
|
11379
11344
|
get(t) {
|
|
11380
|
-
return Ze("Query.get", arguments, 0, 1),
|
|
11381
|
-
t && "cache" === t.source ? this.firestore.
|
|
11382
|
-
e(new
|
|
11383
|
-
}, s) : this.
|
|
11345
|
+
return Ze("Query.get", arguments, 0, 1), Mi("Query.get", t), this.Yd(this.Qd), new Promise((e, s) => {
|
|
11346
|
+
t && "cache" === t.source ? this.firestore.wd().td(this.Qd).then(t => {
|
|
11347
|
+
e(new ki(this.firestore, this.Qd, t, this.kd));
|
|
11348
|
+
}, s) : this.Ud(e, s, t);
|
|
11384
11349
|
});
|
|
11385
11350
|
}
|
|
11386
|
-
|
|
11387
|
-
const i = this.
|
|
11351
|
+
Ud(t, e, s) {
|
|
11352
|
+
const i = this.Md({
|
|
11388
11353
|
includeMetadataChanges: !0,
|
|
11389
11354
|
ql: !0
|
|
11390
11355
|
}, {
|
|
@@ -11400,88 +11365,88 @@ class Fi {
|
|
|
11400
11365
|
* Parses the given documentIdValue into a ReferenceValue, throwing
|
|
11401
11366
|
* appropriate errors if the value is anything other than a DocumentReference
|
|
11402
11367
|
* or String, or if the string is malformed.
|
|
11403
|
-
*/
|
|
11368
|
+
*/ jd(t) {
|
|
11404
11369
|
if ("string" == typeof t) {
|
|
11405
11370
|
if ("" === t) throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
11406
|
-
if (!this.
|
|
11407
|
-
const e = this.
|
|
11371
|
+
if (!this.Qd.He() && -1 !== t.indexOf("/")) throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but " + `'${t}' contains a '/' character.`);
|
|
11372
|
+
const e = this.Qd.path.child(b.K(t));
|
|
11408
11373
|
if (!C.st(e)) throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, " + `but '${e}' is not because it has an odd number of segments (${e.length}).`);
|
|
11409
|
-
return et(this.firestore.
|
|
11374
|
+
return et(this.firestore._d, new C(e));
|
|
11410
11375
|
}
|
|
11411
|
-
if (t instanceof
|
|
11376
|
+
if (t instanceof Si) {
|
|
11412
11377
|
const e = t;
|
|
11413
|
-
return et(this.firestore.
|
|
11378
|
+
return et(this.firestore._d, e.Sd);
|
|
11414
11379
|
}
|
|
11415
11380
|
throw new E(m.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + `${as(t)}.`);
|
|
11416
11381
|
}
|
|
11417
11382
|
/**
|
|
11418
11383
|
* Validates that the value passed into a disjunctrive filter satisfies all
|
|
11419
11384
|
* array requirements.
|
|
11420
|
-
*/
|
|
11385
|
+
*/ Wd(t, e) {
|
|
11421
11386
|
if (!Array.isArray(t) || 0 === t.length) throw new E(m.INVALID_ARGUMENT, "Invalid Query. A non-empty array is required for " + `'${e.toString()}' filters.`);
|
|
11422
11387
|
if (t.length > 10) throw new E(m.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a ` + "maximum of 10 elements in the value array.");
|
|
11423
11388
|
if (t.indexOf(null) >= 0) throw new E(m.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'null' ` + "in the value array.");
|
|
11424
11389
|
if (t.filter(t => Number.isNaN(t)).length > 0) throw new E(m.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters cannot contain 'NaN' ` + "in the value array.");
|
|
11425
11390
|
}
|
|
11426
|
-
|
|
11391
|
+
Gd(t) {
|
|
11427
11392
|
if (t instanceof Dt) {
|
|
11428
11393
|
const e = [ Ct.ARRAY_CONTAINS, Ct.ARRAY_CONTAINS_ANY ], s = [ Ct.IN, Ct.ARRAY_CONTAINS_ANY ], i = e.indexOf(t.op) >= 0, n = s.indexOf(t.op) >= 0;
|
|
11429
11394
|
if (t.ze()) {
|
|
11430
|
-
const e = this.
|
|
11395
|
+
const e = this.Qd.Se();
|
|
11431
11396
|
if (null !== e && !e.isEqual(t.field)) throw new E(m.INVALID_ARGUMENT, "Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have" + ` inequality filters on '${e.toString()}'` + ` and '${t.field.toString()}'`);
|
|
11432
|
-
const s = this.
|
|
11433
|
-
null !== s && this.
|
|
11397
|
+
const s = this.Qd.Ce();
|
|
11398
|
+
null !== s && this.Xd(t.field, s);
|
|
11434
11399
|
} else if (n || i) {
|
|
11435
11400
|
// You can have at most 1 disjunctive filter and 1 array filter. Check if
|
|
11436
11401
|
// the new filter conflicts with an existing one.
|
|
11437
11402
|
let r = null;
|
|
11438
|
-
if (n && (r = this.
|
|
11403
|
+
if (n && (r = this.Qd.Ke(s)), null === r && i && (r = this.Qd.Ke(e)), null != r)
|
|
11439
11404
|
// We special case when it's a duplicate op to give a slightly clearer error message.
|
|
11440
11405
|
throw r === t.op ? new E(m.INVALID_ARGUMENT, "Invalid query. You cannot use more than one " + `'${t.op.toString()}' filter.`) : new E(m.INVALID_ARGUMENT, `Invalid query. You cannot use '${t.op.toString()}' filters ` + `with '${r.toString()}' filters.`);
|
|
11441
11406
|
}
|
|
11442
11407
|
}
|
|
11443
11408
|
}
|
|
11444
|
-
|
|
11445
|
-
if (null === this.
|
|
11409
|
+
zd(t) {
|
|
11410
|
+
if (null === this.Qd.Ce()) {
|
|
11446
11411
|
// This is the first order by. It must match any inequality.
|
|
11447
|
-
const e = this.
|
|
11448
|
-
null !== e && this.
|
|
11412
|
+
const e = this.Qd.Se();
|
|
11413
|
+
null !== e && this.Xd(e, t.field);
|
|
11449
11414
|
}
|
|
11450
11415
|
}
|
|
11451
|
-
|
|
11416
|
+
Xd(t, e) {
|
|
11452
11417
|
if (!e.isEqual(t)) throw new E(m.INVALID_ARGUMENT, "Invalid query. You have a where filter with an inequality " + `(<, <=, >, or >=) on field '${t.toString()}' ` + `and so you must also use '${t.toString()}' ` + "as your first Query.orderBy(), but your first Query.orderBy() " + `is on field '${e.toString()}' instead.`);
|
|
11453
11418
|
}
|
|
11454
11419
|
}
|
|
11455
11420
|
|
|
11456
|
-
class
|
|
11421
|
+
class ki {
|
|
11457
11422
|
constructor(t, e, s, i) {
|
|
11458
|
-
this.
|
|
11459
|
-
this.metadata = new
|
|
11423
|
+
this.Fd = t, this.Zd = e, this.tf = s, this.kd = i, this.ef = null, this.sf = null,
|
|
11424
|
+
this.metadata = new Ci(s.hasPendingWrites, s.fromCache);
|
|
11460
11425
|
}
|
|
11461
11426
|
get docs() {
|
|
11462
11427
|
const t = [];
|
|
11463
11428
|
return this.forEach(e => t.push(e)), t;
|
|
11464
11429
|
}
|
|
11465
11430
|
get empty() {
|
|
11466
|
-
return this.
|
|
11431
|
+
return this.tf.docs.q();
|
|
11467
11432
|
}
|
|
11468
11433
|
get size() {
|
|
11469
|
-
return this.
|
|
11434
|
+
return this.tf.docs.size;
|
|
11470
11435
|
}
|
|
11471
11436
|
forEach(t, e) {
|
|
11472
11437
|
Ze("QuerySnapshot.forEach", arguments, 1, 2), ts("QuerySnapshot.forEach", "function", 1, t),
|
|
11473
|
-
this.
|
|
11474
|
-
t.call(e, this.
|
|
11438
|
+
this.tf.docs.forEach(s => {
|
|
11439
|
+
t.call(e, this.if(s));
|
|
11475
11440
|
});
|
|
11476
11441
|
}
|
|
11477
11442
|
get query() {
|
|
11478
|
-
return new
|
|
11443
|
+
return new Ni(this.Zd, this.Fd, this.kd);
|
|
11479
11444
|
}
|
|
11480
11445
|
docChanges(t) {
|
|
11481
11446
|
t && (cs("QuerySnapshot.docChanges", t, [ "includeMetadataChanges" ]), is("QuerySnapshot.docChanges", "boolean", "includeMetadataChanges", t.includeMetadataChanges));
|
|
11482
11447
|
const e = !(!t || !t.includeMetadataChanges);
|
|
11483
|
-
if (e && this.
|
|
11484
|
-
return this.
|
|
11448
|
+
if (e && this.tf.ds) throw new E(m.INVALID_ARGUMENT, "To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");
|
|
11449
|
+
return this.ef && this.sf === e || (this.ef =
|
|
11485
11450
|
/**
|
|
11486
11451
|
* Calculates the array of firestore.DocumentChange's for a given ViewSnapshot.
|
|
11487
11452
|
*
|
|
@@ -11493,7 +11458,7 @@ class Ni {
|
|
|
11493
11458
|
// fast
|
|
11494
11459
|
let e, n = 0;
|
|
11495
11460
|
return s.docChanges.map(r => {
|
|
11496
|
-
const h = new
|
|
11461
|
+
const h = new Fi(t, r.doc.key, r.doc, s.fromCache, s.ls.has(r.doc.key), i);
|
|
11497
11462
|
return e = r.doc, {
|
|
11498
11463
|
type: "added",
|
|
11499
11464
|
doc: h,
|
|
@@ -11507,41 +11472,41 @@ class Ni {
|
|
|
11507
11472
|
// to lookup the index of a document.
|
|
11508
11473
|
let n = s.cs;
|
|
11509
11474
|
return s.docChanges.filter(t => e || 3 /* Metadata */ !== t.type).map(e => {
|
|
11510
|
-
const r = new
|
|
11475
|
+
const r = new Fi(t, e.doc.key, e.doc, s.fromCache, s.ls.has(e.doc.key), i);
|
|
11511
11476
|
let h = -1, o = -1;
|
|
11512
11477
|
return 0 /* Added */ !== e.type && (h = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
11513
11478
|
1 /* Removed */ !== e.type && (n = n.add(e.doc), o = n.indexOf(e.doc.key)), {
|
|
11514
|
-
type:
|
|
11479
|
+
type: qi(e.type),
|
|
11515
11480
|
doc: r,
|
|
11516
11481
|
oldIndex: h,
|
|
11517
11482
|
newIndex: o
|
|
11518
11483
|
};
|
|
11519
11484
|
});
|
|
11520
11485
|
}
|
|
11521
|
-
}(this.
|
|
11486
|
+
}(this.Fd, e, this.tf, this.kd), this.sf = e), this.ef;
|
|
11522
11487
|
}
|
|
11523
11488
|
/** Check the equality. The call can be very expensive. */ isEqual(t) {
|
|
11524
|
-
if (!(t instanceof
|
|
11525
|
-
return this.
|
|
11489
|
+
if (!(t instanceof ki)) throw ls("isEqual", "QuerySnapshot", 1, t);
|
|
11490
|
+
return this.Fd === t.Fd && this.Zd.isEqual(t.Zd) && this.tf.isEqual(t.tf) && this.kd === t.kd;
|
|
11526
11491
|
}
|
|
11527
|
-
|
|
11528
|
-
return new
|
|
11492
|
+
if(t) {
|
|
11493
|
+
return new Fi(this.Fd, t.key, t, this.metadata.fromCache, this.tf.ls.has(t.key), this.kd);
|
|
11529
11494
|
}
|
|
11530
11495
|
}
|
|
11531
11496
|
|
|
11532
|
-
class
|
|
11497
|
+
class Li extends Ni {
|
|
11533
11498
|
constructor(t, e, s) {
|
|
11534
|
-
if (super(St.ve(t), e, s), this.
|
|
11499
|
+
if (super(St.ve(t), e, s), this.nf = t, t.length % 2 != 1) throw new E(m.INVALID_ARGUMENT, "Invalid collection reference. Collection references must have an odd number of segments, but " + `${t.G()} has ${t.length}`);
|
|
11535
11500
|
}
|
|
11536
11501
|
get id() {
|
|
11537
|
-
return this.
|
|
11502
|
+
return this.Qd.path.U();
|
|
11538
11503
|
}
|
|
11539
11504
|
get parent() {
|
|
11540
|
-
const t = this.
|
|
11541
|
-
return t.q() ? null : new
|
|
11505
|
+
const t = this.Qd.path.O();
|
|
11506
|
+
return t.q() ? null : new Si(new C(t), this.firestore);
|
|
11542
11507
|
}
|
|
11543
11508
|
get path() {
|
|
11544
|
-
return this.
|
|
11509
|
+
return this.Qd.path.G();
|
|
11545
11510
|
}
|
|
11546
11511
|
doc(t) {
|
|
11547
11512
|
if (Ze("CollectionReference.doc", arguments, 0, 1),
|
|
@@ -11550,19 +11515,19 @@ class ki extends Fi {
|
|
|
11550
11515
|
0 === arguments.length && (t = Ce.Tn()), ts("CollectionReference.doc", "non-empty string", 1, t),
|
|
11551
11516
|
"" === t) throw new E(m.INVALID_ARGUMENT, "Document path must be a non-empty string");
|
|
11552
11517
|
const e = b.K(t);
|
|
11553
|
-
return
|
|
11518
|
+
return Si.Cd(this.Qd.path.child(e), this.firestore, this.kd);
|
|
11554
11519
|
}
|
|
11555
11520
|
add(t) {
|
|
11556
|
-
Ye("CollectionReference.add", arguments, 1), ts("CollectionReference.add", "object", 1, this.
|
|
11521
|
+
Ye("CollectionReference.add", arguments, 1), ts("CollectionReference.add", "object", 1, this.kd ? this.kd.toFirestore(t) : t);
|
|
11557
11522
|
const e = this.doc();
|
|
11558
11523
|
return e.set(t).then(() => e);
|
|
11559
11524
|
}
|
|
11560
11525
|
withConverter(t) {
|
|
11561
|
-
return new
|
|
11526
|
+
return new Li(this.nf, this.firestore, t);
|
|
11562
11527
|
}
|
|
11563
11528
|
}
|
|
11564
11529
|
|
|
11565
|
-
function
|
|
11530
|
+
function $i(t, e) {
|
|
11566
11531
|
if (void 0 === e) return {
|
|
11567
11532
|
merge: !1
|
|
11568
11533
|
};
|
|
@@ -11571,24 +11536,24 @@ function Li(t, e) {
|
|
|
11571
11536
|
return e;
|
|
11572
11537
|
}
|
|
11573
11538
|
|
|
11574
|
-
function
|
|
11539
|
+
function Oi(t, e) {
|
|
11575
11540
|
return void 0 === e ? {} : (cs(t, e, [ "serverTimestamps" ]), rs(t, 0, "serverTimestamps", e.serverTimestamps, [ "estimate", "previous", "none" ]),
|
|
11576
11541
|
e);
|
|
11577
11542
|
}
|
|
11578
11543
|
|
|
11579
|
-
function
|
|
11544
|
+
function Mi(t, e) {
|
|
11580
11545
|
es(t, "object", 1, e), e && (cs(t, e, [ "source" ]), rs(t, 0, "source", e.source, [ "default", "server", "cache" ]));
|
|
11581
11546
|
}
|
|
11582
11547
|
|
|
11583
|
-
function
|
|
11584
|
-
if (e instanceof
|
|
11548
|
+
function Ui(t, e, s) {
|
|
11549
|
+
if (e instanceof Si) {
|
|
11585
11550
|
if (e.firestore !== s) throw new E(m.INVALID_ARGUMENT, "Provided document reference is from a different Firestore instance.");
|
|
11586
11551
|
return e;
|
|
11587
11552
|
}
|
|
11588
11553
|
throw ls(t, "DocumentReference", 1, e);
|
|
11589
11554
|
}
|
|
11590
11555
|
|
|
11591
|
-
function
|
|
11556
|
+
function qi(t) {
|
|
11592
11557
|
switch (t) {
|
|
11593
11558
|
case 0 /* Added */ :
|
|
11594
11559
|
return "added";
|
|
@@ -11613,28 +11578,28 @@ function Ui(t) {
|
|
|
11613
11578
|
* because we want to provide the user with a more specific error message if
|
|
11614
11579
|
* their set() or fails due to invalid data originating from a toFirestore()
|
|
11615
11580
|
* call.
|
|
11616
|
-
*/ function
|
|
11581
|
+
*/ function Bi(t, e, s) {
|
|
11617
11582
|
let i;
|
|
11618
11583
|
return t ? (i = t.toFirestore(e), s = "toFirestore() in " + s) : i = e, [ i, s ];
|
|
11619
11584
|
}
|
|
11620
11585
|
|
|
11621
|
-
const
|
|
11622
|
-
Firestore:
|
|
11586
|
+
const xi = ws(yi, "Use firebase.firestore() instead."), Qi = ws(bi, "Use firebase.firestore().runTransaction() instead."), Wi = ws(vi, "Use firebase.firestore().batch() instead."), ji = ws(Si, "Use firebase.firestore().doc() instead."), Gi = ws(Di), zi = ws(Fi), Ki = ws(Ni), Hi = ws(ki), Ji = ws(Li, "Use firebase.firestore().collection() instead."), Yi = {
|
|
11587
|
+
Firestore: xi,
|
|
11623
11588
|
GeoPoint: Ss,
|
|
11624
11589
|
Timestamp: p,
|
|
11625
11590
|
Blob: Rs,
|
|
11626
|
-
Transaction:
|
|
11627
|
-
WriteBatch:
|
|
11628
|
-
DocumentReference:
|
|
11629
|
-
DocumentSnapshot:
|
|
11630
|
-
Query:
|
|
11631
|
-
QueryDocumentSnapshot:
|
|
11632
|
-
QuerySnapshot:
|
|
11633
|
-
CollectionReference:
|
|
11591
|
+
Transaction: Qi,
|
|
11592
|
+
WriteBatch: Wi,
|
|
11593
|
+
DocumentReference: ji,
|
|
11594
|
+
DocumentSnapshot: Gi,
|
|
11595
|
+
Query: Ki,
|
|
11596
|
+
QueryDocumentSnapshot: zi,
|
|
11597
|
+
QuerySnapshot: Hi,
|
|
11598
|
+
CollectionReference: Ji,
|
|
11634
11599
|
FieldPath: Is,
|
|
11635
11600
|
FieldValue: vs,
|
|
11636
|
-
setLogLevel:
|
|
11637
|
-
CACHE_SIZE_UNLIMITED:
|
|
11601
|
+
setLogLevel: yi.setLogLevel,
|
|
11602
|
+
CACHE_SIZE_UNLIMITED: pi
|
|
11638
11603
|
};
|
|
11639
11604
|
|
|
11640
11605
|
/**
|
|
@@ -11653,7 +11618,7 @@ const Bi = ws(gi, "Use firebase.firestore() instead."), xi = ws(yi, "Use firebas
|
|
|
11653
11618
|
* See the License for the specific language governing permissions and
|
|
11654
11619
|
* limitations under the License.
|
|
11655
11620
|
*/
|
|
11656
|
-
class
|
|
11621
|
+
class Xi {
|
|
11657
11622
|
mu(t) {
|
|
11658
11623
|
// No-op.
|
|
11659
11624
|
}
|
|
@@ -11681,31 +11646,31 @@ class Yi {
|
|
|
11681
11646
|
/**
|
|
11682
11647
|
* Browser implementation of ConnectivityMonitor.
|
|
11683
11648
|
*/
|
|
11684
|
-
class
|
|
11649
|
+
class Zi {
|
|
11685
11650
|
constructor() {
|
|
11686
|
-
this.
|
|
11651
|
+
this.rf = () => this.hf(), this.af = () => this.uf(), this.cf = [], this.lf();
|
|
11687
11652
|
}
|
|
11688
11653
|
mu(t) {
|
|
11689
|
-
this.
|
|
11654
|
+
this.cf.push(t);
|
|
11690
11655
|
}
|
|
11691
11656
|
ku() {
|
|
11692
|
-
window.removeEventListener("online", this.
|
|
11657
|
+
window.removeEventListener("online", this.rf), window.removeEventListener("offline", this.af);
|
|
11693
11658
|
}
|
|
11694
|
-
|
|
11695
|
-
window.addEventListener("online", this.
|
|
11659
|
+
lf() {
|
|
11660
|
+
window.addEventListener("online", this.rf), window.addEventListener("offline", this.af);
|
|
11696
11661
|
}
|
|
11697
|
-
|
|
11662
|
+
hf() {
|
|
11698
11663
|
ge("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
|
|
11699
|
-
for (const t of this.
|
|
11664
|
+
for (const t of this.cf) t(0 /* AVAILABLE */);
|
|
11700
11665
|
}
|
|
11701
|
-
|
|
11666
|
+
uf() {
|
|
11702
11667
|
ge("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
|
|
11703
|
-
for (const t of this.
|
|
11668
|
+
for (const t of this.cf) t(1 /* UNAVAILABLE */);
|
|
11704
11669
|
}
|
|
11705
11670
|
// TODO(chenbrian): Consider passing in window either into this component or
|
|
11706
11671
|
// here for testing via FakeWindow.
|
|
11707
11672
|
/** Checks that all used attributes of window are available. */
|
|
11708
|
-
static
|
|
11673
|
+
static _f() {
|
|
11709
11674
|
return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;
|
|
11710
11675
|
}
|
|
11711
11676
|
}
|
|
@@ -11730,33 +11695,33 @@ class Xi {
|
|
|
11730
11695
|
* Provides a simple helper class that implements the Stream interface to
|
|
11731
11696
|
* bridge to other implementations that are streams but do not implement the
|
|
11732
11697
|
* interface. The stream callbacks are invoked with the callOn... methods.
|
|
11733
|
-
*/ class
|
|
11698
|
+
*/ class tn {
|
|
11734
11699
|
constructor(t) {
|
|
11735
|
-
this.
|
|
11700
|
+
this.df = t.df, this.ff = t.ff;
|
|
11736
11701
|
}
|
|
11737
11702
|
Na(t) {
|
|
11738
|
-
this.
|
|
11703
|
+
this.wf = t;
|
|
11739
11704
|
}
|
|
11740
11705
|
va(t) {
|
|
11741
|
-
this.
|
|
11706
|
+
this.Tf = t;
|
|
11742
11707
|
}
|
|
11743
11708
|
onMessage(t) {
|
|
11744
|
-
this.
|
|
11709
|
+
this.mf = t;
|
|
11745
11710
|
}
|
|
11746
11711
|
close() {
|
|
11747
|
-
this.
|
|
11712
|
+
this.ff();
|
|
11748
11713
|
}
|
|
11749
11714
|
send(t) {
|
|
11750
|
-
this.
|
|
11715
|
+
this.df(t);
|
|
11751
11716
|
}
|
|
11752
|
-
|
|
11753
|
-
this.
|
|
11717
|
+
Ef() {
|
|
11718
|
+
this.wf();
|
|
11754
11719
|
}
|
|
11755
|
-
|
|
11756
|
-
this.
|
|
11720
|
+
Rf(t) {
|
|
11721
|
+
this.Tf(t);
|
|
11757
11722
|
}
|
|
11758
|
-
|
|
11759
|
-
this.
|
|
11723
|
+
If(t) {
|
|
11724
|
+
this.mf(t);
|
|
11760
11725
|
}
|
|
11761
11726
|
}
|
|
11762
11727
|
|
|
@@ -11775,26 +11740,26 @@ class Xi {
|
|
|
11775
11740
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11776
11741
|
* See the License for the specific language governing permissions and
|
|
11777
11742
|
* limitations under the License.
|
|
11778
|
-
*/ const
|
|
11743
|
+
*/ const en = {
|
|
11779
11744
|
BatchGetDocuments: "batchGet",
|
|
11780
11745
|
Commit: "commit"
|
|
11781
|
-
},
|
|
11746
|
+
}, sn = "gl-js/ fire/" + w;
|
|
11782
11747
|
|
|
11783
|
-
class
|
|
11748
|
+
class nn {
|
|
11784
11749
|
constructor(t) {
|
|
11785
11750
|
this.ci = t.ci;
|
|
11786
11751
|
const e = t.ssl ? "https" : "http";
|
|
11787
|
-
this.
|
|
11752
|
+
this.Af = e + "://" + t.host, this.forceLongPolling = t.forceLongPolling;
|
|
11788
11753
|
}
|
|
11789
11754
|
/**
|
|
11790
11755
|
* Modifies the headers for a request, adding any authorization token if
|
|
11791
11756
|
* present and any additional headers for the request.
|
|
11792
|
-
*/
|
|
11757
|
+
*/ Pf(t, e) {
|
|
11793
11758
|
if (e) for (const s in e.o) e.o.hasOwnProperty(s) && (t[s] = e.o[s]);
|
|
11794
|
-
t["X-Goog-Api-Client"] =
|
|
11759
|
+
t["X-Goog-Api-Client"] = sn;
|
|
11795
11760
|
}
|
|
11796
11761
|
Ga(t, e, s) {
|
|
11797
|
-
const i = this.
|
|
11762
|
+
const i = this.Vf(t);
|
|
11798
11763
|
return new Promise((n, r) => {
|
|
11799
11764
|
const h = new c;
|
|
11800
11765
|
h.listenOnce(l.COMPLETE, () => {
|
|
@@ -11849,7 +11814,7 @@ class sn {
|
|
|
11849
11814
|
const u = {
|
|
11850
11815
|
"Content-Type": "text/plain"
|
|
11851
11816
|
};
|
|
11852
|
-
this.
|
|
11817
|
+
this.Pf(u, s), h.send(i, "POST", a, u, 15);
|
|
11853
11818
|
});
|
|
11854
11819
|
}
|
|
11855
11820
|
Ka(t, e, s) {
|
|
@@ -11858,7 +11823,7 @@ class sn {
|
|
|
11858
11823
|
return this.Ga(t, e, s);
|
|
11859
11824
|
}
|
|
11860
11825
|
ka(t, e) {
|
|
11861
|
-
const s = [ this.
|
|
11826
|
+
const s = [ this.Af, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], u = d(), c = {
|
|
11862
11827
|
// Required for backend stickiness, routing behavior is based on this
|
|
11863
11828
|
// parameter.
|
|
11864
11829
|
httpSessionIdParam: "gsessionid",
|
|
@@ -11881,7 +11846,7 @@ class sn {
|
|
|
11881
11846
|
},
|
|
11882
11847
|
forceLongPolling: this.forceLongPolling
|
|
11883
11848
|
};
|
|
11884
|
-
this.
|
|
11849
|
+
this.Pf(c.initMessageHeaders, e),
|
|
11885
11850
|
// Sending the custom headers we just added to request.initMessageHeaders
|
|
11886
11851
|
// (Authorization, etc.) will trigger the browser to make a CORS preflight
|
|
11887
11852
|
// request because the XHR will no longer meet the criteria for a "simple"
|
|
@@ -11910,12 +11875,12 @@ class sn {
|
|
|
11910
11875
|
// A flag to determine whether the stream was closed (by us or through an
|
|
11911
11876
|
// error/close event) to avoid delivering multiple close events or sending
|
|
11912
11877
|
// on a closed stream
|
|
11913
|
-
const R = new
|
|
11914
|
-
|
|
11878
|
+
const R = new tn({
|
|
11879
|
+
df: t => {
|
|
11915
11880
|
T ? ge("Connection", "Not sending because WebChannel is closed:", t) : (w || (ge("Connection", "Opening WebChannel transport."),
|
|
11916
11881
|
_.open(), w = !0), ge("Connection", "WebChannel sending:", t), _.send(t));
|
|
11917
11882
|
},
|
|
11918
|
-
|
|
11883
|
+
ff: () => _.close()
|
|
11919
11884
|
}), I = (t, e) => {
|
|
11920
11885
|
// TODO(dimond): closure typing seems broken because WebChannel does
|
|
11921
11886
|
// not implement goog.events.Listenable
|
|
@@ -11936,9 +11901,9 @@ class sn {
|
|
|
11936
11901
|
return I(f.EventType.OPEN, () => {
|
|
11937
11902
|
T || ge("Connection", "WebChannel transport opened.");
|
|
11938
11903
|
}), I(f.EventType.CLOSE, () => {
|
|
11939
|
-
T || (T = !0, ge("Connection", "WebChannel transport closed"), R.
|
|
11904
|
+
T || (T = !0, ge("Connection", "WebChannel transport closed"), R.Rf());
|
|
11940
11905
|
}), I(f.EventType.ERROR, t => {
|
|
11941
|
-
T || (T = !0, ge("Connection", "WebChannel transport errored:", t), R.
|
|
11906
|
+
T || (T = !0, ge("Connection", "WebChannel transport errored:", t), R.Rf(new E(m.UNAVAILABLE, "The operation could not be completed")));
|
|
11942
11907
|
}), I(f.EventType.MESSAGE, t => {
|
|
11943
11908
|
var e;
|
|
11944
11909
|
if (!T) {
|
|
@@ -11962,21 +11927,21 @@ class sn {
|
|
|
11962
11927
|
}(t), s = n.message;
|
|
11963
11928
|
void 0 === e && (e = m.INTERNAL, s = "Unknown error status: " + t + " with message " + n.message),
|
|
11964
11929
|
// Mark closed so no further events are propagated
|
|
11965
|
-
T = !0, R.
|
|
11966
|
-
} else ge("Connection", "WebChannel received:", s), R.
|
|
11930
|
+
T = !0, R.Rf(new E(e, s)), _.close();
|
|
11931
|
+
} else ge("Connection", "WebChannel received:", s), R.If(s);
|
|
11967
11932
|
}
|
|
11968
11933
|
}), setTimeout(() => {
|
|
11969
11934
|
// Technically we could/should wait for the WebChannel opened event,
|
|
11970
11935
|
// but because we want to send the first message with the WebChannel
|
|
11971
11936
|
// handshake we pretend the channel opened here (asynchronously), and
|
|
11972
11937
|
// then delay the actual open until the first message is sent.
|
|
11973
|
-
R.
|
|
11938
|
+
R.Ef();
|
|
11974
11939
|
}, 0), R;
|
|
11975
11940
|
}
|
|
11976
11941
|
// visible for testing
|
|
11977
|
-
|
|
11978
|
-
const e =
|
|
11979
|
-
return this.
|
|
11942
|
+
Vf(t) {
|
|
11943
|
+
const e = en[t];
|
|
11944
|
+
return this.Af + "/v1/projects/" + this.ci.projectId + "/databases/" + this.ci.database + "/documents:" + e;
|
|
11980
11945
|
}
|
|
11981
11946
|
}
|
|
11982
11947
|
|
|
@@ -12029,13 +11994,13 @@ Ae.fn(new class {
|
|
|
12029
11994
|
get window() {
|
|
12030
11995
|
return "undefined" != typeof window ? window : null;
|
|
12031
11996
|
}
|
|
12032
|
-
|
|
12033
|
-
return Promise.resolve(new
|
|
11997
|
+
K_(t) {
|
|
11998
|
+
return Promise.resolve(new nn(t));
|
|
12034
11999
|
}
|
|
12035
|
-
|
|
12036
|
-
return
|
|
12000
|
+
Q_() {
|
|
12001
|
+
return Zi._f() ? new Zi : new Xi;
|
|
12037
12002
|
}
|
|
12038
|
-
|
|
12003
|
+
H_(t) {
|
|
12039
12004
|
return new Re(t, {
|
|
12040
12005
|
di: !0
|
|
12041
12006
|
});
|
|
@@ -12070,7 +12035,7 @@ Ae.fn(new class {
|
|
|
12070
12035
|
/**
|
|
12071
12036
|
* Registers the memory-only Firestore build with the components framework.
|
|
12072
12037
|
*/
|
|
12073
|
-
function
|
|
12038
|
+
function rn(t) {
|
|
12074
12039
|
!
|
|
12075
12040
|
/**
|
|
12076
12041
|
* Configures Firestore as part of the Firebase SDK by calling registerService.
|
|
@@ -12083,11 +12048,11 @@ function nn(t) {
|
|
|
12083
12048
|
t.INTERNAL.registerComponent(new u("firestore", t => {
|
|
12084
12049
|
const s = t.getProvider("app").getImmediate();
|
|
12085
12050
|
return e(s, t.getProvider("auth-internal"));
|
|
12086
|
-
}, "PUBLIC" /* PUBLIC */).setServiceProps(Object.assign({},
|
|
12087
|
-
}(t, (t, e) => new
|
|
12051
|
+
}, "PUBLIC" /* PUBLIC */).setServiceProps(Object.assign({}, Yi)));
|
|
12052
|
+
}(t, (t, e) => new yi(t, e, new Ri)), t.registerVersion("@firebase/firestore", "1.14.0");
|
|
12088
12053
|
}
|
|
12089
12054
|
|
|
12090
|
-
|
|
12055
|
+
rn(t);
|
|
12091
12056
|
|
|
12092
|
-
export {
|
|
12057
|
+
export { rn as __PRIVATE_registerFirestore };
|
|
12093
12058
|
//# sourceMappingURL=index.memory.esm2017.js.map
|