@firebase/firestore 3.4.1 → 3.4.2-202205224240
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 +13 -0
- package/dist/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/firestore/src/model/collections.d.ts +0 -4
- package/dist/firestore/src/model/document.d.ts +3 -1
- package/dist/firestore/src/model/values.d.ts +3 -0
- package/dist/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/firestore/src/util/error.d.ts +2 -3
- package/dist/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/firestore/test/util/helpers.d.ts +1 -0
- package/dist/index.d.ts +13 -21
- package/dist/index.esm2017.js +2649 -2640
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2640 -2630
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +42 -24
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +43 -25
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2839 -2830
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +18 -22
- package/dist/lite/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/lite/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/lite/firestore/src/util/error.d.ts +2 -3
- package/dist/lite/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +1378 -1365
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +842 -828
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +18 -21
- package/dist/lite/index.node.cjs.js +25 -7
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +26 -8
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +849 -836
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +86 -21
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +142 -141
- package/dist/lite/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/lite/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/lite/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/lite/packages/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/lite/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/lite/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/lite/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/lite/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/lite/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/lite/packages/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/lite/packages/firestore/src/util/error.d.ts +2 -3
- package/dist/lite/packages/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -0
- package/dist/lite/private.d.ts +85 -21
- package/dist/packages/firestore/dist/index.esm2017.d.ts +152 -152
- package/dist/packages/firestore/src/index/directional_index_byte_encoder.d.ts +24 -0
- package/dist/packages/firestore/src/index/firestore_index_value_writer.d.ts +33 -0
- package/dist/packages/firestore/src/index/index_byte_encoder.d.ts +14 -0
- package/dist/packages/firestore/src/index/ordered_code_writer.d.ts +60 -0
- package/dist/packages/firestore/src/lite-api/reference.d.ts +4 -2
- package/dist/packages/firestore/src/lite-api/reference_impl.d.ts +5 -0
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +4 -0
- package/dist/packages/firestore/src/lite-api/write_batch.d.ts +3 -0
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +5 -0
- package/dist/packages/firestore/src/model/collections.d.ts +0 -4
- package/dist/packages/firestore/src/model/document.d.ts +3 -1
- package/dist/packages/firestore/src/model/values.d.ts +3 -0
- package/dist/packages/firestore/src/util/byte_string.d.ts +1 -0
- package/dist/packages/firestore/src/util/error.d.ts +2 -3
- package/dist/packages/firestore/test/unit/index/ordered_code_writer.test.d.ts +1 -0
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -0
- package/dist/private.d.ts +17 -22
- package/package.json +7 -7
|
@@ -6,7 +6,7 @@ import { Component as c } from "@firebase/component";
|
|
|
6
6
|
|
|
7
7
|
import { Logger as l, LogLevel as f } from "@firebase/logger";
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { FirebaseError as h, getModularInstance as p, createMockUserToken as d } from "@firebase/util";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -27,7 +27,7 @@ import { getModularInstance as h, createMockUserToken as p } from "@firebase/uti
|
|
|
27
27
|
/**
|
|
28
28
|
* Simple wrapper around a nullable UID. Mostly exists to make code more
|
|
29
29
|
* readable.
|
|
30
|
-
*/ var
|
|
30
|
+
*/ var m = /** @class */ function() {
|
|
31
31
|
function t(t) {
|
|
32
32
|
this.uid = t;
|
|
33
33
|
}
|
|
@@ -45,11 +45,11 @@ import { getModularInstance as h, createMockUserToken as p } from "@firebase/uti
|
|
|
45
45
|
}, t;
|
|
46
46
|
}();
|
|
47
47
|
|
|
48
|
-
/** A user with a null UID. */
|
|
48
|
+
/** A user with a null UID. */ m.UNAUTHENTICATED = new m(null),
|
|
49
49
|
// TODO(mikelehen): Look into getting a proper uid-equivalent for
|
|
50
50
|
// non-FirebaseAuth providers.
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
m.GOOGLE_CREDENTIALS = new m("google-credentials-uid"), m.FIRST_PARTY = new m("first-party-uid"),
|
|
52
|
+
m.MOCK_USER = new m("mock-user");
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* @license
|
|
@@ -67,7 +67,7 @@ d.MOCK_USER = new d("mock-user");
|
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
69
|
*/
|
|
70
|
-
var
|
|
70
|
+
var y = "9.6.2-202205224240", v = new l("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -98,39 +98,39 @@ var m = "9.6.1", y = new l("@firebase/firestore");
|
|
|
98
98
|
* <li><code>`silent` to turn off logging.</li>
|
|
99
99
|
* </ul>
|
|
100
100
|
*/
|
|
101
|
-
function
|
|
102
|
-
|
|
101
|
+
function g(t) {
|
|
102
|
+
v.setLogLevel(t);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
function
|
|
105
|
+
function w(t) {
|
|
106
106
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
107
|
-
if (
|
|
108
|
-
var i = e.map(
|
|
109
|
-
|
|
107
|
+
if (v.logLevel <= f.DEBUG) {
|
|
108
|
+
var i = e.map(T);
|
|
109
|
+
v.debug.apply(v, r([ "Firestore (" + y + "): " + t ], i));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function
|
|
113
|
+
function b(t) {
|
|
114
114
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
115
|
-
if (
|
|
116
|
-
var i = e.map(
|
|
117
|
-
|
|
115
|
+
if (v.logLevel <= f.ERROR) {
|
|
116
|
+
var i = e.map(T);
|
|
117
|
+
v.error.apply(v, r([ "Firestore (" + y + "): " + t ], i));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* @internal
|
|
123
|
-
*/ function
|
|
123
|
+
*/ function _(t) {
|
|
124
124
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
125
|
-
if (
|
|
126
|
-
var i = e.map(
|
|
127
|
-
|
|
125
|
+
if (v.logLevel <= f.WARN) {
|
|
126
|
+
var i = e.map(T);
|
|
127
|
+
v.warn.apply(v, r([ "Firestore (" + y + "): " + t ], i));
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Converts an additional log parameter to a string representation.
|
|
133
|
-
*/ function
|
|
133
|
+
*/ function T(t) {
|
|
134
134
|
if ("string" == typeof t) return t;
|
|
135
135
|
try {
|
|
136
136
|
return e = t, JSON.stringify(e);
|
|
@@ -180,15 +180,15 @@ function w(t) {
|
|
|
180
180
|
* Returns `never` and can be used in expressions:
|
|
181
181
|
* @example
|
|
182
182
|
* let futureVar = fail('not implemented yet');
|
|
183
|
-
*/ function
|
|
183
|
+
*/ function S(t) {
|
|
184
184
|
void 0 === t && (t = "Unexpected state");
|
|
185
185
|
// Log the failure in addition to throw an exception, just in case the
|
|
186
186
|
// exception is swallowed.
|
|
187
|
-
var e = "FIRESTORE (" +
|
|
187
|
+
var e = "FIRESTORE (" + y + ") INTERNAL ASSERTION FAILED: " + t;
|
|
188
188
|
// NOTE: We don't use FirestoreError here because these are internal failures
|
|
189
189
|
// that cannot be handled by the user. (Also it would create a circular
|
|
190
190
|
// dependency between the error and assert modules which doesn't work.)
|
|
191
|
-
throw
|
|
191
|
+
throw b(e), new Error(e)
|
|
192
192
|
/**
|
|
193
193
|
* Fails if the given assertion condition is false, throwing an Error with the
|
|
194
194
|
* given message if it did.
|
|
@@ -197,14 +197,14 @@ function w(t) {
|
|
|
197
197
|
*/;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
function
|
|
201
|
-
t ||
|
|
200
|
+
function E(t, e) {
|
|
201
|
+
t || S();
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
|
|
206
206
|
* instance of `T` before casting.
|
|
207
|
-
*/ function
|
|
207
|
+
*/ function I(t,
|
|
208
208
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
209
|
e) {
|
|
210
210
|
return t;
|
|
@@ -225,7 +225,7 @@ e) {
|
|
|
225
225
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
226
226
|
* See the License for the specific language governing permissions and
|
|
227
227
|
* limitations under the License.
|
|
228
|
-
*/ var
|
|
228
|
+
*/ var A = "cancelled", k = "unknown", V = "invalid-argument", D = "deadline-exceeded", P = "not-found", F = "permission-denied", N = "unauthenticated", q = "resource-exhausted", O = "failed-precondition", C = "aborted", j = "out-of-range", L = "unimplemented", R = "internal", M = "unavailable", U = /** @class */ function(e) {
|
|
229
229
|
/** @hideconstructor */
|
|
230
230
|
function n(
|
|
231
231
|
/**
|
|
@@ -237,9 +237,7 @@ e) {
|
|
|
237
237
|
*/
|
|
238
238
|
n) {
|
|
239
239
|
var r = this;
|
|
240
|
-
return (r = e.call(this, n) || this).code = t, r.message = n,
|
|
241
|
-
/** The custom name for all FirestoreErrors. */
|
|
242
|
-
r.name = "FirebaseError",
|
|
240
|
+
return (r = e.call(this, t, n) || this).code = t, r.message = n,
|
|
243
241
|
// HACK: We write a toString property directly because Error is not a real
|
|
244
242
|
// class and so inheritance does not work correctly. We could alternatively
|
|
245
243
|
// do the same "back-door inheritance" trick that FirebaseError does.
|
|
@@ -248,24 +246,24 @@ e) {
|
|
|
248
246
|
}, r;
|
|
249
247
|
}
|
|
250
248
|
return t(n, e), n;
|
|
251
|
-
}(
|
|
249
|
+
}(h), x = function() {
|
|
252
250
|
var t = this;
|
|
253
251
|
this.promise = new Promise((function(e, n) {
|
|
254
252
|
t.resolve = e, t.reject = n;
|
|
255
253
|
}));
|
|
256
|
-
},
|
|
254
|
+
}, B = function(t, e) {
|
|
257
255
|
this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", "Bearer " + t);
|
|
258
|
-
},
|
|
256
|
+
}, G = /** @class */ function() {
|
|
259
257
|
function t() {}
|
|
260
258
|
return t.prototype.getToken = function() {
|
|
261
259
|
return Promise.resolve(null);
|
|
262
260
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {
|
|
263
261
|
// Fire with initial user.
|
|
264
262
|
t.enqueueRetryable((function() {
|
|
265
|
-
return e(
|
|
263
|
+
return e(m.UNAUTHENTICATED);
|
|
266
264
|
}));
|
|
267
265
|
}, t.prototype.shutdown = function() {}, t;
|
|
268
|
-
}(),
|
|
266
|
+
}(), z = /** @class */ function() {
|
|
269
267
|
function t(t) {
|
|
270
268
|
this.token = t,
|
|
271
269
|
/**
|
|
@@ -287,7 +285,7 @@ e) {
|
|
|
287
285
|
}, t.prototype.shutdown = function() {
|
|
288
286
|
this.changeListener = null;
|
|
289
287
|
}, t;
|
|
290
|
-
}(),
|
|
288
|
+
}(), Q = /** @class */ function() {
|
|
291
289
|
function t(t) {
|
|
292
290
|
var e = this;
|
|
293
291
|
this.auth = null, t.onInit((function(t) {
|
|
@@ -297,30 +295,30 @@ e) {
|
|
|
297
295
|
return t.prototype.getToken = function() {
|
|
298
296
|
var t = this;
|
|
299
297
|
return this.auth ? this.auth.getToken().then((function(e) {
|
|
300
|
-
return e ? (
|
|
298
|
+
return e ? (E("string" == typeof e.accessToken), new B(e.accessToken, new m(t.auth.getUid()))) : null;
|
|
301
299
|
})) : Promise.resolve(null);
|
|
302
300
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
|
|
303
301
|
t.prototype.shutdown = function() {}, t;
|
|
304
|
-
}(),
|
|
305
|
-
this.type = "FirstParty", this.user =
|
|
302
|
+
}(), K = function(t, e, n) {
|
|
303
|
+
this.type = "FirstParty", this.user = m.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
|
|
306
304
|
var r = t.auth.getAuthHeaderValueForFirstParty([]);
|
|
307
305
|
r && this.headers.set("Authorization", r), n && this.headers.set("X-Goog-Iam-Authorization-Token", n);
|
|
308
|
-
},
|
|
306
|
+
}, H = /** @class */ function() {
|
|
309
307
|
function t(t, e, n) {
|
|
310
308
|
this.t = t, this.i = e, this.o = n;
|
|
311
309
|
}
|
|
312
310
|
return t.prototype.getToken = function() {
|
|
313
|
-
return Promise.resolve(new
|
|
311
|
+
return Promise.resolve(new K(this.t, this.i, this.o));
|
|
314
312
|
}, t.prototype.start = function(t, e) {
|
|
315
313
|
// Fire with initial uid.
|
|
316
314
|
t.enqueueRetryable((function() {
|
|
317
|
-
return e(
|
|
315
|
+
return e(m.FIRST_PARTY);
|
|
318
316
|
}));
|
|
319
317
|
}, t.prototype.shutdown = function() {}, t.prototype.invalidateToken = function() {},
|
|
320
318
|
t;
|
|
321
|
-
}(),
|
|
319
|
+
}(), W = function(t) {
|
|
322
320
|
this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
|
|
323
|
-
},
|
|
321
|
+
}, Y = /** @class */ function() {
|
|
324
322
|
function t(t) {
|
|
325
323
|
var e = this;
|
|
326
324
|
this.u = t, this.appCheck = null, t.onInit((function(t) {
|
|
@@ -329,11 +327,11 @@ e) {
|
|
|
329
327
|
}
|
|
330
328
|
return t.prototype.getToken = function() {
|
|
331
329
|
return this.appCheck ? this.appCheck.getToken().then((function(t) {
|
|
332
|
-
return t ? (
|
|
330
|
+
return t ? (E("string" == typeof t.token), new W(t.token)) : null;
|
|
333
331
|
})) : Promise.resolve(null);
|
|
334
332
|
}, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
|
|
335
333
|
t.prototype.shutdown = function() {}, t;
|
|
336
|
-
}(),
|
|
334
|
+
}(), $ =
|
|
337
335
|
/**
|
|
338
336
|
* Constructs a DatabaseInfo using the provided host, databaseId and
|
|
339
337
|
* persistenceKey.
|
|
@@ -354,7 +352,7 @@ e) {
|
|
|
354
352
|
function(t, e, n, r, i, o, a, s) {
|
|
355
353
|
this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
|
|
356
354
|
this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = s;
|
|
357
|
-
},
|
|
355
|
+
}, X = /** @class */ function() {
|
|
358
356
|
function t(t, e) {
|
|
359
357
|
this.projectId = t, this.database = e || "(default)";
|
|
360
358
|
}
|
|
@@ -367,9 +365,9 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
367
365
|
}), t.prototype.isEqual = function(e) {
|
|
368
366
|
return e instanceof t && e.projectId === this.projectId && e.database === this.database;
|
|
369
367
|
}, t;
|
|
370
|
-
}(),
|
|
368
|
+
}(), J = /** @class */ function() {
|
|
371
369
|
function t(t, e, n) {
|
|
372
|
-
void 0 === e ? e = 0 : e > t.length &&
|
|
370
|
+
void 0 === e ? e = 0 : e > t.length && S(), void 0 === n ? n = t.length - e : n > t.length - e && S(),
|
|
373
371
|
this.segments = t, this.offset = e, this.len = n;
|
|
374
372
|
}
|
|
375
373
|
return Object.defineProperty(t.prototype, "length", {
|
|
@@ -420,7 +418,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
420
418
|
}
|
|
421
419
|
return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
|
|
422
420
|
}, t;
|
|
423
|
-
}(),
|
|
421
|
+
}(), Z = /** @class */ function(e) {
|
|
424
422
|
function n() {
|
|
425
423
|
return null !== e && e.apply(this, arguments) || this;
|
|
426
424
|
}
|
|
@@ -446,7 +444,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
446
444
|
// for legacy reasons and should not be used frequently).
|
|
447
445
|
for (var r = [], i = 0, o = t; i < o.length; i++) {
|
|
448
446
|
var a = o[i];
|
|
449
|
-
if (a.indexOf("//") >= 0) throw new
|
|
447
|
+
if (a.indexOf("//") >= 0) throw new U(V, "Invalid segment (" + a + "). Paths must not contain // in them.");
|
|
450
448
|
// Strip leading and traling slashed.
|
|
451
449
|
r.push.apply(r, a.split("/").filter((function(t) {
|
|
452
450
|
return t.length > 0;
|
|
@@ -456,7 +454,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
456
454
|
}, n.emptyPath = function() {
|
|
457
455
|
return new n([]);
|
|
458
456
|
}, n;
|
|
459
|
-
}(
|
|
457
|
+
}(J), tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/, et = /** @class */ function(e) {
|
|
460
458
|
function n() {
|
|
461
459
|
return null !== e && e.apply(this, arguments) || this;
|
|
462
460
|
}
|
|
@@ -468,7 +466,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
468
466
|
* without escaping.
|
|
469
467
|
*/
|
|
470
468
|
n.isValidIdentifier = function(t) {
|
|
471
|
-
return
|
|
469
|
+
return tt.test(t);
|
|
472
470
|
}, n.prototype.canonicalString = function() {
|
|
473
471
|
return this.toArray().map((function(t) {
|
|
474
472
|
return t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"), n.isValidIdentifier(t) || (t = "`" + t + "`"),
|
|
@@ -501,39 +499,39 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
501
499
|
*/
|
|
502
500
|
n.fromServerFormat = function(t) {
|
|
503
501
|
for (var e = [], r = "", i = 0, o = function() {
|
|
504
|
-
if (0 === r.length) throw new
|
|
502
|
+
if (0 === r.length) throw new U(V, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
|
|
505
503
|
e.push(r), r = "";
|
|
506
504
|
}, a = !1; i < t.length; ) {
|
|
507
505
|
var s = t[i];
|
|
508
506
|
if ("\\" === s) {
|
|
509
|
-
if (i + 1 === t.length) throw new
|
|
507
|
+
if (i + 1 === t.length) throw new U(V, "Path has trailing escape character: " + t);
|
|
510
508
|
var u = t[i + 1];
|
|
511
|
-
if ("\\" !== u && "." !== u && "`" !== u) throw new
|
|
509
|
+
if ("\\" !== u && "." !== u && "`" !== u) throw new U(V, "Path has invalid escape sequence: " + t);
|
|
512
510
|
r += u, i += 2;
|
|
513
511
|
} else "`" === s ? (a = !a, i++) : "." !== s || a ? (r += s, i++) : (o(), i++);
|
|
514
512
|
}
|
|
515
|
-
if (o(), a) throw new
|
|
513
|
+
if (o(), a) throw new U(V, "Unterminated ` in path: " + t);
|
|
516
514
|
return new n(e);
|
|
517
515
|
}, n.emptyPath = function() {
|
|
518
516
|
return new n([]);
|
|
519
517
|
}, n;
|
|
520
|
-
}(
|
|
518
|
+
}(J), nt = /** @class */ function() {
|
|
521
519
|
function t(t) {
|
|
522
520
|
this.path = t;
|
|
523
521
|
}
|
|
524
522
|
return t.fromPath = function(e) {
|
|
525
|
-
return new t(
|
|
523
|
+
return new t(Z.fromString(e));
|
|
526
524
|
}, t.fromName = function(e) {
|
|
527
|
-
return new t(
|
|
525
|
+
return new t(Z.fromString(e).popFirst(5));
|
|
528
526
|
},
|
|
529
527
|
/** Returns true if the document is in the specified collectionId. */ t.prototype.hasCollectionId = function(t) {
|
|
530
528
|
return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
|
|
531
529
|
}, t.prototype.isEqual = function(t) {
|
|
532
|
-
return null !== t && 0 ===
|
|
530
|
+
return null !== t && 0 === Z.comparator(this.path, t.path);
|
|
533
531
|
}, t.prototype.toString = function() {
|
|
534
532
|
return this.path.toString();
|
|
535
533
|
}, t.comparator = function(t, e) {
|
|
536
|
-
return
|
|
534
|
+
return Z.comparator(t.path, e.path);
|
|
537
535
|
}, t.isDocumentKey = function(t) {
|
|
538
536
|
return t.length % 2 == 0;
|
|
539
537
|
},
|
|
@@ -544,7 +542,7 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
544
542
|
* @returns A new instance of DocumentKey
|
|
545
543
|
*/
|
|
546
544
|
t.fromSegments = function(e) {
|
|
547
|
-
return new t(new
|
|
545
|
+
return new t(new Z(e.slice()));
|
|
548
546
|
}, t;
|
|
549
547
|
}();
|
|
550
548
|
|
|
@@ -565,8 +563,8 @@ function(t, e, n, r, i, o, a, s) {
|
|
|
565
563
|
* See the License for the specific language governing permissions and
|
|
566
564
|
* limitations under the License.
|
|
567
565
|
*/
|
|
568
|
-
function
|
|
569
|
-
if (!n) throw new
|
|
566
|
+
function rt(t, e, n) {
|
|
567
|
+
if (!n) throw new U(V, "Function " + t + "() cannot be called with an empty " + e + ".");
|
|
570
568
|
}
|
|
571
569
|
|
|
572
570
|
/**
|
|
@@ -576,22 +574,22 @@ function nt(t, e, n) {
|
|
|
576
574
|
/**
|
|
577
575
|
* Validates that `path` refers to a document (indicated by the fact it contains
|
|
578
576
|
* an even numbers of segments).
|
|
579
|
-
*/ function
|
|
580
|
-
if (!
|
|
577
|
+
*/ function it(t) {
|
|
578
|
+
if (!nt.isDocumentKey(t)) throw new U(V, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
|
|
581
579
|
}
|
|
582
580
|
|
|
583
581
|
/**
|
|
584
582
|
* Validates that `path` refers to a collection (indicated by the fact it
|
|
585
583
|
* contains an odd numbers of segments).
|
|
586
|
-
*/ function
|
|
587
|
-
if (
|
|
584
|
+
*/ function ot(t) {
|
|
585
|
+
if (nt.isDocumentKey(t)) throw new U(V, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
|
|
588
586
|
}
|
|
589
587
|
|
|
590
588
|
/**
|
|
591
589
|
* Returns true if it's a non-null object without a custom prototype
|
|
592
590
|
* (i.e. excludes Array, Date, etc.).
|
|
593
591
|
*/
|
|
594
|
-
/** Returns a string describing the type / value of the provided input. */ function
|
|
592
|
+
/** Returns a string describing the type / value of the provided input. */ function at(t) {
|
|
595
593
|
if (void 0 === t) return "undefined";
|
|
596
594
|
if (null === t) return "null";
|
|
597
595
|
if ("string" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + "..."),
|
|
@@ -606,25 +604,25 @@ function nt(t, e, n) {
|
|
|
606
604
|
}(t);
|
|
607
605
|
return e ? "a custom " + e + " object" : "an object";
|
|
608
606
|
}
|
|
609
|
-
return "function" == typeof t ? "a function" :
|
|
607
|
+
return "function" == typeof t ? "a function" : S();
|
|
610
608
|
}
|
|
611
609
|
|
|
612
|
-
function
|
|
610
|
+
function st(t,
|
|
613
611
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
614
612
|
e) {
|
|
615
613
|
if ("_delegate" in t && (
|
|
616
614
|
// Unwrap Compat types
|
|
617
615
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
618
616
|
t = t._delegate), !(t instanceof e)) {
|
|
619
|
-
if (e.name === t.constructor.name) throw new
|
|
620
|
-
var n =
|
|
621
|
-
throw new
|
|
617
|
+
if (e.name === t.constructor.name) throw new U(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
|
|
618
|
+
var n = at(t);
|
|
619
|
+
throw new U(V, "Expected type '" + e.name + "', but it was: " + n);
|
|
622
620
|
}
|
|
623
621
|
return t;
|
|
624
622
|
}
|
|
625
623
|
|
|
626
|
-
function
|
|
627
|
-
if (e <= 0) throw new
|
|
624
|
+
function ut(t, e) {
|
|
625
|
+
if (e <= 0) throw new U(V, "Function " + t + "() requires a positive number, but it was: " + e + ".");
|
|
628
626
|
}
|
|
629
627
|
|
|
630
628
|
/**
|
|
@@ -645,11 +643,11 @@ function st(t, e) {
|
|
|
645
643
|
*/
|
|
646
644
|
/**
|
|
647
645
|
* Returns whether a variable is either undefined or null.
|
|
648
|
-
*/ function
|
|
646
|
+
*/ function ct(t) {
|
|
649
647
|
return null == t;
|
|
650
648
|
}
|
|
651
649
|
|
|
652
|
-
/** Returns whether the value represents -0. */ function
|
|
650
|
+
/** Returns whether the value represents -0. */ function lt(t) {
|
|
653
651
|
// Detect if the value is -0.0. Based on polyfill from
|
|
654
652
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
655
653
|
return 0 === t && 1 / t == -1 / 0;
|
|
@@ -674,7 +672,7 @@ function st(t, e) {
|
|
|
674
672
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
675
673
|
* See the License for the specific language governing permissions and
|
|
676
674
|
* limitations under the License.
|
|
677
|
-
*/ var
|
|
675
|
+
*/ var ft, ht, pt = {
|
|
678
676
|
BatchGetDocuments: "batchGet",
|
|
679
677
|
Commit: "commit",
|
|
680
678
|
RunQuery: "runQuery"
|
|
@@ -718,8 +716,8 @@ function st(t, e) {
|
|
|
718
716
|
* @returns The equivalent Code. Unknown status codes are mapped to
|
|
719
717
|
* Code.UNKNOWN.
|
|
720
718
|
*/
|
|
721
|
-
function
|
|
722
|
-
if (void 0 === t) return
|
|
719
|
+
function dt(t) {
|
|
720
|
+
if (void 0 === t) return b("RPC_ERROR", "HTTP error has no status"), k;
|
|
723
721
|
// The canonical error codes for Google APIs [1] specify mapping onto HTTP
|
|
724
722
|
// status codes but the mapping is not bijective. In each case of ambiguity
|
|
725
723
|
// this function chooses a primary error.
|
|
@@ -732,62 +730,62 @@ function pt(t) {
|
|
|
732
730
|
|
|
733
731
|
case 400:
|
|
734
732
|
// Bad Request
|
|
735
|
-
return
|
|
733
|
+
return O;
|
|
736
734
|
|
|
737
735
|
// Other possibilities based on the forward mapping
|
|
738
736
|
// return Code.INVALID_ARGUMENT;
|
|
739
737
|
// return Code.OUT_OF_RANGE;
|
|
740
738
|
case 401:
|
|
741
739
|
// Unauthorized
|
|
742
|
-
return
|
|
740
|
+
return N;
|
|
743
741
|
|
|
744
742
|
case 403:
|
|
745
743
|
// Forbidden
|
|
746
|
-
return
|
|
744
|
+
return F;
|
|
747
745
|
|
|
748
746
|
case 404:
|
|
749
747
|
// Not Found
|
|
750
|
-
return
|
|
748
|
+
return P;
|
|
751
749
|
|
|
752
750
|
case 409:
|
|
753
751
|
// Conflict
|
|
754
|
-
return
|
|
752
|
+
return C;
|
|
755
753
|
|
|
756
754
|
// Other possibilities:
|
|
757
755
|
// return Code.ALREADY_EXISTS;
|
|
758
756
|
case 416:
|
|
759
757
|
// Range Not Satisfiable
|
|
760
|
-
return
|
|
758
|
+
return j;
|
|
761
759
|
|
|
762
760
|
case 429:
|
|
763
761
|
// Too Many Requests
|
|
764
|
-
return
|
|
762
|
+
return q;
|
|
765
763
|
|
|
766
764
|
case 499:
|
|
767
765
|
// Client Closed Request
|
|
768
|
-
return
|
|
766
|
+
return A;
|
|
769
767
|
|
|
770
768
|
case 500:
|
|
771
769
|
// Internal Server Error
|
|
772
|
-
return
|
|
770
|
+
return k;
|
|
773
771
|
|
|
774
772
|
// Other possibilities:
|
|
775
773
|
// return Code.INTERNAL;
|
|
776
774
|
// return Code.DATA_LOSS;
|
|
777
775
|
case 501:
|
|
778
776
|
// Unimplemented
|
|
779
|
-
return
|
|
777
|
+
return L;
|
|
780
778
|
|
|
781
779
|
case 503:
|
|
782
780
|
// Service Unavailable
|
|
783
|
-
return
|
|
781
|
+
return M;
|
|
784
782
|
|
|
785
783
|
case 504:
|
|
786
784
|
// Gateway Timeout
|
|
787
|
-
return
|
|
785
|
+
return D;
|
|
788
786
|
|
|
789
787
|
default:
|
|
790
|
-
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ?
|
|
788
|
+
return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? O : t >= 500 && t < 600 ? R : k;
|
|
791
789
|
}
|
|
792
790
|
}
|
|
793
791
|
|
|
@@ -810,16 +808,16 @@ function pt(t) {
|
|
|
810
808
|
/**
|
|
811
809
|
* A Rest-based connection that relies on the native HTTP stack
|
|
812
810
|
* (e.g. `fetch` or a polyfill).
|
|
813
|
-
*/ (
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
var
|
|
811
|
+
*/ (ht = ft || (ft = {}))[ht.OK = 0] = "OK", ht[ht.CANCELLED = 1] = "CANCELLED",
|
|
812
|
+
ht[ht.UNKNOWN = 2] = "UNKNOWN", ht[ht.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
|
|
813
|
+
ht[ht.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ht[ht.NOT_FOUND = 5] = "NOT_FOUND",
|
|
814
|
+
ht[ht.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ht[ht.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
|
|
815
|
+
ht[ht.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ht[ht.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
|
|
816
|
+
ht[ht.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ht[ht.ABORTED = 10] = "ABORTED",
|
|
817
|
+
ht[ht.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ht[ht.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
|
|
818
|
+
ht[ht.INTERNAL = 13] = "INTERNAL", ht[ht.UNAVAILABLE = 14] = "UNAVAILABLE", ht[ht.DATA_LOSS = 15] = "DATA_LOSS";
|
|
819
|
+
|
|
820
|
+
var mt = /** @class */ function(r) {
|
|
823
821
|
/**
|
|
824
822
|
* @param databaseInfo - The connection info.
|
|
825
823
|
* @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
|
|
@@ -853,10 +851,10 @@ var dt = /** @class */ function(r) {
|
|
|
853
851
|
return e = n.sent(), [ 3 /*break*/ , 4 ];
|
|
854
852
|
|
|
855
853
|
case 3:
|
|
856
|
-
throw a = n.sent(), new
|
|
854
|
+
throw a = n.sent(), new U(dt(a.status), "Request failed with error: " + a.statusText);
|
|
857
855
|
|
|
858
856
|
case 4:
|
|
859
|
-
if (!e.ok) throw new
|
|
857
|
+
if (!e.ok) throw new U(dt(e.status), "Request failed with error: " + e.statusText);
|
|
860
858
|
return [ 2 /*return*/ , e.json() ];
|
|
861
859
|
}
|
|
862
860
|
}));
|
|
@@ -870,12 +868,12 @@ var dt = /** @class */ function(r) {
|
|
|
870
868
|
}
|
|
871
869
|
return t.prototype.m = function(t, e, n, r, i) {
|
|
872
870
|
var o = this.p(t, e);
|
|
873
|
-
|
|
871
|
+
w("RestConnection", "Sending: ", o, n);
|
|
874
872
|
var a = {};
|
|
875
873
|
return this.g(a, r, i), this.v(t, o, a, n).then((function(t) {
|
|
876
|
-
return
|
|
874
|
+
return w("RestConnection", "Received: ", t), t;
|
|
877
875
|
}), (function(e) {
|
|
878
|
-
throw
|
|
876
|
+
throw _("RestConnection", t + " failed with error: ", e, "url: ", o, "request:", n),
|
|
879
877
|
e;
|
|
880
878
|
}));
|
|
881
879
|
}, t.prototype.T = function(t, e, n, r, i) {
|
|
@@ -888,7 +886,7 @@ var dt = /** @class */ function(r) {
|
|
|
888
886
|
* present and any additional headers for the request.
|
|
889
887
|
*/
|
|
890
888
|
t.prototype.g = function(t, e, n) {
|
|
891
|
-
t["X-Goog-Api-Client"] = "gl-js/ fire/" +
|
|
889
|
+
t["X-Goog-Api-Client"] = "gl-js/ fire/" + y,
|
|
892
890
|
// Content-Type: text/plain will avoid preflight requests which might
|
|
893
891
|
// mess with CORS and redirects by proxies. If we add custom headers
|
|
894
892
|
// we will need to change this code to potentially use the $httpOverwrite
|
|
@@ -900,7 +898,7 @@ var dt = /** @class */ function(r) {
|
|
|
900
898
|
return t[n] = e;
|
|
901
899
|
}));
|
|
902
900
|
}, t.prototype.p = function(t, e) {
|
|
903
|
-
var n =
|
|
901
|
+
var n = pt[t];
|
|
904
902
|
return this.h + "/v1/" + e + ":" + n;
|
|
905
903
|
}, t;
|
|
906
904
|
}());
|
|
@@ -942,7 +940,7 @@ var dt = /** @class */ function(r) {
|
|
|
942
940
|
* Generates `nBytes` of random bytes.
|
|
943
941
|
*
|
|
944
942
|
* If `nBytes < 0` , an error will be thrown.
|
|
945
|
-
*/ function
|
|
943
|
+
*/ function yt(t) {
|
|
946
944
|
// Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
|
|
947
945
|
var e =
|
|
948
946
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -968,14 +966,14 @@ var dt = /** @class */ function(r) {
|
|
|
968
966
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
969
967
|
* See the License for the specific language governing permissions and
|
|
970
968
|
* limitations under the License.
|
|
971
|
-
*/ var
|
|
969
|
+
*/ var vt = /** @class */ function() {
|
|
972
970
|
function t() {}
|
|
973
971
|
return t.P = function() {
|
|
974
972
|
for (
|
|
975
973
|
// Alphanumeric characters
|
|
976
974
|
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = ""
|
|
977
975
|
// The largest byte value that is a multiple of `char.length`.
|
|
978
|
-
; n.length < 20; ) for (var r =
|
|
976
|
+
; n.length < 20; ) for (var r = yt(40), i = 0; i < r.length; ++i)
|
|
979
977
|
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
980
978
|
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
981
979
|
n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));
|
|
@@ -983,11 +981,11 @@ var dt = /** @class */ function(r) {
|
|
|
983
981
|
}, t;
|
|
984
982
|
}();
|
|
985
983
|
|
|
986
|
-
function
|
|
984
|
+
function gt(t, e) {
|
|
987
985
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
988
986
|
}
|
|
989
987
|
|
|
990
|
-
/** Helper to compare arrays using isEqual(). */ function
|
|
988
|
+
/** Helper to compare arrays using isEqual(). */ function wt(t, e, n) {
|
|
991
989
|
return t.length === e.length && t.every((function(t, r) {
|
|
992
990
|
return n(t, e[r]);
|
|
993
991
|
}));
|
|
@@ -1023,7 +1021,7 @@ function vt(t, e) {
|
|
|
1023
1021
|
*
|
|
1024
1022
|
* For examples and further specifications, refer to the
|
|
1025
1023
|
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
|
|
1026
|
-
*/ var
|
|
1024
|
+
*/ var bt = /** @class */ function() {
|
|
1027
1025
|
/**
|
|
1028
1026
|
* Creates a new timestamp.
|
|
1029
1027
|
*
|
|
@@ -1044,11 +1042,11 @@ function vt(t, e) {
|
|
|
1044
1042
|
* The fractions of a second at nanosecond resolution.*
|
|
1045
1043
|
*/
|
|
1046
1044
|
e) {
|
|
1047
|
-
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new
|
|
1048
|
-
if (e >= 1e9) throw new
|
|
1049
|
-
if (t < -62135596800) throw new
|
|
1045
|
+
if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(V, "Timestamp nanoseconds out of range: " + e);
|
|
1046
|
+
if (e >= 1e9) throw new U(V, "Timestamp nanoseconds out of range: " + e);
|
|
1047
|
+
if (t < -62135596800) throw new U(V, "Timestamp seconds out of range: " + t);
|
|
1050
1048
|
// This will break in the year 10,000.
|
|
1051
|
-
if (t >= 253402300800) throw new
|
|
1049
|
+
if (t >= 253402300800) throw new U(V, "Timestamp seconds out of range: " + t);
|
|
1052
1050
|
}
|
|
1053
1051
|
/**
|
|
1054
1052
|
* Creates a new timestamp with the current date, with millisecond precision.
|
|
@@ -1100,7 +1098,7 @@ function vt(t, e) {
|
|
|
1100
1098
|
t.prototype.toMillis = function() {
|
|
1101
1099
|
return 1e3 * this.seconds + this.nanoseconds / 1e6;
|
|
1102
1100
|
}, t.prototype._compareTo = function(t) {
|
|
1103
|
-
return this.seconds === t.seconds ?
|
|
1101
|
+
return this.seconds === t.seconds ? gt(this.nanoseconds, t.nanoseconds) : gt(this.seconds, t.seconds);
|
|
1104
1102
|
},
|
|
1105
1103
|
/**
|
|
1106
1104
|
* Returns true if this `Timestamp` is equal to the provided one.
|
|
@@ -1137,14 +1135,14 @@ function vt(t, e) {
|
|
|
1137
1135
|
// 'seconds' values.
|
|
1138
1136
|
return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0");
|
|
1139
1137
|
}, t;
|
|
1140
|
-
}(),
|
|
1138
|
+
}(), _t = /** @class */ function() {
|
|
1141
1139
|
function t(t) {
|
|
1142
1140
|
this.timestamp = t;
|
|
1143
1141
|
}
|
|
1144
1142
|
return t.fromTimestamp = function(e) {
|
|
1145
1143
|
return new t(e);
|
|
1146
1144
|
}, t.min = function() {
|
|
1147
|
-
return new t(new
|
|
1145
|
+
return new t(new bt(0, 0));
|
|
1148
1146
|
}, t.prototype.compareTo = function(t) {
|
|
1149
1147
|
return this.timestamp._compareTo(t.timestamp);
|
|
1150
1148
|
}, t.prototype.isEqual = function(t) {
|
|
@@ -1196,13 +1194,13 @@ function vt(t, e) {
|
|
|
1196
1194
|
* See the License for the specific language governing permissions and
|
|
1197
1195
|
* limitations under the License.
|
|
1198
1196
|
*/
|
|
1199
|
-
function
|
|
1197
|
+
function Tt(t) {
|
|
1200
1198
|
var e = 0;
|
|
1201
1199
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
|
|
1202
1200
|
return e;
|
|
1203
1201
|
}
|
|
1204
1202
|
|
|
1205
|
-
function
|
|
1203
|
+
function St(t, e) {
|
|
1206
1204
|
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
|
|
1207
1205
|
}
|
|
1208
1206
|
|
|
@@ -1231,12 +1229,12 @@ function Tt(t, e) {
|
|
|
1231
1229
|
* foo.bar - Overwrites only the field bar of the object foo.
|
|
1232
1230
|
* If foo is not an object, foo is replaced with an object
|
|
1233
1231
|
* containing foo
|
|
1234
|
-
*/ var
|
|
1232
|
+
*/ var Et = /** @class */ function() {
|
|
1235
1233
|
function t(t) {
|
|
1236
1234
|
this.fields = t,
|
|
1237
1235
|
// TODO(dimond): validation of FieldMask
|
|
1238
1236
|
// Sort the field mask to support `FieldMask.isEqual()` and assert below.
|
|
1239
|
-
t.sort(
|
|
1237
|
+
t.sort(et.comparator)
|
|
1240
1238
|
/**
|
|
1241
1239
|
* Verifies that `fieldPath` is included by at least one field in this field
|
|
1242
1240
|
* mask.
|
|
@@ -1250,11 +1248,11 @@ function Tt(t, e) {
|
|
|
1250
1248
|
}
|
|
1251
1249
|
return !1;
|
|
1252
1250
|
}, t.prototype.isEqual = function(t) {
|
|
1253
|
-
return
|
|
1251
|
+
return wt(this.fields, t.fields, (function(t, e) {
|
|
1254
1252
|
return t.isEqual(e);
|
|
1255
1253
|
}));
|
|
1256
1254
|
}, t;
|
|
1257
|
-
}(),
|
|
1255
|
+
}(), It = /** @class */ function() {
|
|
1258
1256
|
function t(t) {
|
|
1259
1257
|
this.binaryString = t;
|
|
1260
1258
|
}
|
|
@@ -1270,6 +1268,19 @@ function Tt(t, e) {
|
|
|
1270
1268
|
return e;
|
|
1271
1269
|
}(e);
|
|
1272
1270
|
return new t(n);
|
|
1271
|
+
}, t.prototype[Symbol.iterator] = function() {
|
|
1272
|
+
var t = this, e = 0;
|
|
1273
|
+
return {
|
|
1274
|
+
next: function() {
|
|
1275
|
+
return e < t.binaryString.length ? {
|
|
1276
|
+
value: t.binaryString.charCodeAt(e++),
|
|
1277
|
+
done: !1
|
|
1278
|
+
} : {
|
|
1279
|
+
value: void 0,
|
|
1280
|
+
done: !0
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1273
1284
|
}, t.prototype.toBase64 = function() {
|
|
1274
1285
|
return t = this.binaryString, btoa(t);
|
|
1275
1286
|
/** Converts a binary string to a Base64 encoded string. */ var t;
|
|
@@ -1281,7 +1292,7 @@ function Tt(t, e) {
|
|
|
1281
1292
|
}, t.prototype.approximateByteSize = function() {
|
|
1282
1293
|
return 2 * this.binaryString.length;
|
|
1283
1294
|
}, t.prototype.compareTo = function(t) {
|
|
1284
|
-
return
|
|
1295
|
+
return gt(this.binaryString, t.binaryString);
|
|
1285
1296
|
}, t.prototype.isEqual = function(t) {
|
|
1286
1297
|
return this.binaryString === t.binaryString;
|
|
1287
1298
|
}, t;
|
|
@@ -1328,23 +1339,23 @@ function Tt(t, e) {
|
|
|
1328
1339
|
* the proto byte string in a common class that must be converted into a string
|
|
1329
1340
|
* before being sent as a proto.
|
|
1330
1341
|
* @internal
|
|
1331
|
-
*/
|
|
1342
|
+
*/ It.EMPTY_BYTE_STRING = new It("");
|
|
1332
1343
|
|
|
1333
|
-
var
|
|
1344
|
+
var At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
1334
1345
|
|
|
1335
1346
|
/**
|
|
1336
1347
|
* Converts the possible Proto values for a timestamp value into a "seconds and
|
|
1337
1348
|
* nanos" representation.
|
|
1338
|
-
*/ function
|
|
1349
|
+
*/ function kt(t) {
|
|
1339
1350
|
// The json interface (for the browser) will return an iso timestamp string,
|
|
1340
1351
|
// while the proto js library (for node) will return a
|
|
1341
1352
|
// google.protobuf.Timestamp instance.
|
|
1342
|
-
if (
|
|
1353
|
+
if (E(!!t), "string" == typeof t) {
|
|
1343
1354
|
// The date string can have higher precision (nanos) than the Date class
|
|
1344
1355
|
// (millis), so we do some custom parsing here.
|
|
1345
1356
|
// Parse the nanos right out of the string.
|
|
1346
|
-
var e = 0, n =
|
|
1347
|
-
if (
|
|
1357
|
+
var e = 0, n = At.exec(t);
|
|
1358
|
+
if (E(!!n), n[1]) {
|
|
1348
1359
|
// Pad the fraction out to 9 digits (nanos).
|
|
1349
1360
|
var r = n[1];
|
|
1350
1361
|
r = (r + "000000000").substr(0, 9), e = Number(r);
|
|
@@ -1357,21 +1368,21 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1357
1368
|
};
|
|
1358
1369
|
}
|
|
1359
1370
|
return {
|
|
1360
|
-
seconds:
|
|
1361
|
-
nanos:
|
|
1371
|
+
seconds: Vt(t.seconds),
|
|
1372
|
+
nanos: Vt(t.nanos)
|
|
1362
1373
|
};
|
|
1363
1374
|
}
|
|
1364
1375
|
|
|
1365
1376
|
/**
|
|
1366
1377
|
* Converts the possible Proto types for numbers into a JavaScript number.
|
|
1367
1378
|
* Returns 0 if the value is not numeric.
|
|
1368
|
-
*/ function
|
|
1379
|
+
*/ function Vt(t) {
|
|
1369
1380
|
// TODO(bjornick): Handle int64 greater than 53 bits.
|
|
1370
1381
|
return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
|
|
1371
1382
|
}
|
|
1372
1383
|
|
|
1373
|
-
/** Converts the possible Proto types for Blobs into a ByteString. */ function
|
|
1374
|
-
return "string" == typeof t ?
|
|
1384
|
+
/** Converts the possible Proto types for Blobs into a ByteString. */ function Dt(t) {
|
|
1385
|
+
return "string" == typeof t ? It.fromBase64String(t) : It.fromUint8Array(t);
|
|
1375
1386
|
}
|
|
1376
1387
|
|
|
1377
1388
|
/**
|
|
@@ -1407,7 +1418,7 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1407
1418
|
* FieldValueOptions to value().
|
|
1408
1419
|
* - With respect to other ServerTimestampValues, they sort by their
|
|
1409
1420
|
* localWriteTime.
|
|
1410
|
-
*/ function
|
|
1421
|
+
*/ function Pt(t) {
|
|
1411
1422
|
var e, n;
|
|
1412
1423
|
return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
|
|
1413
1424
|
}
|
|
@@ -1417,16 +1428,16 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1417
1428
|
*
|
|
1418
1429
|
* Preserving the previous values allows the user to display the last resoled
|
|
1419
1430
|
* value until the backend responds with the timestamp.
|
|
1420
|
-
*/ function
|
|
1431
|
+
*/ function Ft(t) {
|
|
1421
1432
|
var e = t.mapValue.fields.__previous_value__;
|
|
1422
|
-
return
|
|
1433
|
+
return Pt(e) ? Ft(e) : e;
|
|
1423
1434
|
}
|
|
1424
1435
|
|
|
1425
1436
|
/**
|
|
1426
1437
|
* Returns the local time at which this timestamp was first set.
|
|
1427
|
-
*/ function
|
|
1428
|
-
var e =
|
|
1429
|
-
return new
|
|
1438
|
+
*/ function Nt(t) {
|
|
1439
|
+
var e = kt(t.mapValue.fields.__local_write_time__.timestampValue);
|
|
1440
|
+
return new bt(e.seconds, e.nanos);
|
|
1430
1441
|
}
|
|
1431
1442
|
|
|
1432
1443
|
/**
|
|
@@ -1445,13 +1456,14 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1445
1456
|
* See the License for the specific language governing permissions and
|
|
1446
1457
|
* limitations under the License.
|
|
1447
1458
|
*/
|
|
1448
|
-
/** Extracts the backend's type order for the provided value. */ function
|
|
1449
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ?
|
|
1459
|
+
/** Extracts the backend's type order for the provided value. */ function qt(t) {
|
|
1460
|
+
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Pt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : S();
|
|
1450
1461
|
}
|
|
1451
1462
|
|
|
1452
|
-
/** Tests `left` and `right` for equality based on the backend semantics. */ function
|
|
1453
|
-
|
|
1454
|
-
|
|
1463
|
+
/** Tests `left` and `right` for equality based on the backend semantics. */ function Ot(t, e) {
|
|
1464
|
+
if (t === e) return !0;
|
|
1465
|
+
var n = qt(t);
|
|
1466
|
+
if (n !== qt(e)) return !1;
|
|
1455
1467
|
switch (n) {
|
|
1456
1468
|
case 0 /* NullValue */ :
|
|
1457
1469
|
return !0;
|
|
@@ -1460,14 +1472,14 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1460
1472
|
return t.booleanValue === e.booleanValue;
|
|
1461
1473
|
|
|
1462
1474
|
case 4 /* ServerTimestampValue */ :
|
|
1463
|
-
return
|
|
1475
|
+
return Nt(t).isEqual(Nt(e));
|
|
1464
1476
|
|
|
1465
1477
|
case 3 /* TimestampValue */ :
|
|
1466
1478
|
return function(t, e) {
|
|
1467
1479
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
1468
1480
|
// Use string equality for ISO 8601 timestamps
|
|
1469
1481
|
return t.timestampValue === e.timestampValue;
|
|
1470
|
-
var n =
|
|
1482
|
+
var n = kt(t.timestampValue), r = kt(e.timestampValue);
|
|
1471
1483
|
return n.seconds === r.seconds && n.nanos === r.nanos;
|
|
1472
1484
|
}(t, e);
|
|
1473
1485
|
|
|
@@ -1476,7 +1488,7 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1476
1488
|
|
|
1477
1489
|
case 6 /* BlobValue */ :
|
|
1478
1490
|
return function(t, e) {
|
|
1479
|
-
return
|
|
1491
|
+
return Dt(t.bytesValue).isEqual(Dt(e.bytesValue));
|
|
1480
1492
|
}(t, e);
|
|
1481
1493
|
|
|
1482
1494
|
case 7 /* RefValue */ :
|
|
@@ -1484,96 +1496,97 @@ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
|
|
|
1484
1496
|
|
|
1485
1497
|
case 8 /* GeoPointValue */ :
|
|
1486
1498
|
return function(t, e) {
|
|
1487
|
-
return
|
|
1499
|
+
return Vt(t.geoPointValue.latitude) === Vt(e.geoPointValue.latitude) && Vt(t.geoPointValue.longitude) === Vt(e.geoPointValue.longitude);
|
|
1488
1500
|
}(t, e);
|
|
1489
1501
|
|
|
1490
1502
|
case 2 /* NumberValue */ :
|
|
1491
1503
|
return function(t, e) {
|
|
1492
|
-
if ("integerValue" in t && "integerValue" in e) return
|
|
1504
|
+
if ("integerValue" in t && "integerValue" in e) return Vt(t.integerValue) === Vt(e.integerValue);
|
|
1493
1505
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
1494
|
-
var n =
|
|
1495
|
-
return n === r ?
|
|
1506
|
+
var n = Vt(t.doubleValue), r = Vt(e.doubleValue);
|
|
1507
|
+
return n === r ? lt(n) === lt(r) : isNaN(n) && isNaN(r);
|
|
1496
1508
|
}
|
|
1497
1509
|
return !1;
|
|
1498
1510
|
}(t, e);
|
|
1499
1511
|
|
|
1500
1512
|
case 9 /* ArrayValue */ :
|
|
1501
|
-
return
|
|
1513
|
+
return wt(t.arrayValue.values || [], e.arrayValue.values || [], Ot);
|
|
1502
1514
|
|
|
1503
1515
|
case 10 /* ObjectValue */ :
|
|
1504
1516
|
return function(t, e) {
|
|
1505
1517
|
var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
|
|
1506
|
-
if (
|
|
1507
|
-
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !
|
|
1518
|
+
if (Tt(n) !== Tt(r)) return !1;
|
|
1519
|
+
for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Ot(n[i], r[i]))) return !1;
|
|
1508
1520
|
return !0;
|
|
1509
1521
|
}(t, e);
|
|
1510
1522
|
|
|
1511
1523
|
default:
|
|
1512
|
-
return
|
|
1524
|
+
return S();
|
|
1513
1525
|
}
|
|
1514
1526
|
}
|
|
1515
1527
|
|
|
1516
|
-
function
|
|
1528
|
+
function Ct(t, e) {
|
|
1517
1529
|
return void 0 !== (t.values || []).find((function(t) {
|
|
1518
|
-
return
|
|
1530
|
+
return Ot(t, e);
|
|
1519
1531
|
}));
|
|
1520
1532
|
}
|
|
1521
1533
|
|
|
1522
|
-
function
|
|
1523
|
-
|
|
1524
|
-
|
|
1534
|
+
function jt(t, e) {
|
|
1535
|
+
if (t === e) return 0;
|
|
1536
|
+
var n = qt(t), r = qt(e);
|
|
1537
|
+
if (n !== r) return gt(n, r);
|
|
1525
1538
|
switch (n) {
|
|
1526
1539
|
case 0 /* NullValue */ :
|
|
1527
1540
|
return 0;
|
|
1528
1541
|
|
|
1529
1542
|
case 1 /* BooleanValue */ :
|
|
1530
|
-
return
|
|
1543
|
+
return gt(t.booleanValue, e.booleanValue);
|
|
1531
1544
|
|
|
1532
1545
|
case 2 /* NumberValue */ :
|
|
1533
1546
|
return function(t, e) {
|
|
1534
|
-
var n =
|
|
1547
|
+
var n = Vt(t.integerValue || t.doubleValue), r = Vt(e.integerValue || e.doubleValue);
|
|
1535
1548
|
return n < r ? -1 : n > r ? 1 : n === r ? 0 :
|
|
1536
1549
|
// one or both are NaN.
|
|
1537
1550
|
isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
|
|
1538
1551
|
}(t, e);
|
|
1539
1552
|
|
|
1540
1553
|
case 3 /* TimestampValue */ :
|
|
1541
|
-
return
|
|
1554
|
+
return Lt(t.timestampValue, e.timestampValue);
|
|
1542
1555
|
|
|
1543
1556
|
case 4 /* ServerTimestampValue */ :
|
|
1544
|
-
return
|
|
1557
|
+
return Lt(Nt(t), Nt(e));
|
|
1545
1558
|
|
|
1546
1559
|
case 5 /* StringValue */ :
|
|
1547
|
-
return
|
|
1560
|
+
return gt(t.stringValue, e.stringValue);
|
|
1548
1561
|
|
|
1549
1562
|
case 6 /* BlobValue */ :
|
|
1550
1563
|
return function(t, e) {
|
|
1551
|
-
var n =
|
|
1564
|
+
var n = Dt(t), r = Dt(e);
|
|
1552
1565
|
return n.compareTo(r);
|
|
1553
1566
|
}(t.bytesValue, e.bytesValue);
|
|
1554
1567
|
|
|
1555
1568
|
case 7 /* RefValue */ :
|
|
1556
1569
|
return function(t, e) {
|
|
1557
1570
|
for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) {
|
|
1558
|
-
var o =
|
|
1571
|
+
var o = gt(n[i], r[i]);
|
|
1559
1572
|
if (0 !== o) return o;
|
|
1560
1573
|
}
|
|
1561
|
-
return
|
|
1574
|
+
return gt(n.length, r.length);
|
|
1562
1575
|
}(t.referenceValue, e.referenceValue);
|
|
1563
1576
|
|
|
1564
1577
|
case 8 /* GeoPointValue */ :
|
|
1565
1578
|
return function(t, e) {
|
|
1566
|
-
var n =
|
|
1567
|
-
return 0 !== n ? n :
|
|
1579
|
+
var n = gt(Vt(t.latitude), Vt(e.latitude));
|
|
1580
|
+
return 0 !== n ? n : gt(Vt(t.longitude), Vt(e.longitude));
|
|
1568
1581
|
}(t.geoPointValue, e.geoPointValue);
|
|
1569
1582
|
|
|
1570
1583
|
case 9 /* ArrayValue */ :
|
|
1571
1584
|
return function(t, e) {
|
|
1572
1585
|
for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {
|
|
1573
|
-
var o =
|
|
1586
|
+
var o = jt(n[i], r[i]);
|
|
1574
1587
|
if (o) return o;
|
|
1575
1588
|
}
|
|
1576
|
-
return
|
|
1589
|
+
return gt(n.length, r.length);
|
|
1577
1590
|
}(t.arrayValue, e.arrayValue);
|
|
1578
1591
|
|
|
1579
1592
|
case 10 /* ObjectValue */ :
|
|
@@ -1585,48 +1598,48 @@ function Ct(t, e) {
|
|
|
1585
1598
|
// canonical IDs are independent of insertion order.
|
|
1586
1599
|
r.sort(), o.sort();
|
|
1587
1600
|
for (var a = 0; a < r.length && a < o.length; ++a) {
|
|
1588
|
-
var s =
|
|
1601
|
+
var s = gt(r[a], o[a]);
|
|
1589
1602
|
if (0 !== s) return s;
|
|
1590
|
-
var u =
|
|
1603
|
+
var u = jt(n[r[a]], i[o[a]]);
|
|
1591
1604
|
if (0 !== u) return u;
|
|
1592
1605
|
}
|
|
1593
|
-
return
|
|
1606
|
+
return gt(r.length, o.length);
|
|
1594
1607
|
}(t.mapValue, e.mapValue);
|
|
1595
1608
|
|
|
1596
1609
|
default:
|
|
1597
|
-
throw
|
|
1610
|
+
throw S();
|
|
1598
1611
|
}
|
|
1599
1612
|
}
|
|
1600
1613
|
|
|
1601
|
-
function
|
|
1602
|
-
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return
|
|
1603
|
-
var n =
|
|
1604
|
-
return 0 !== i ? i :
|
|
1614
|
+
function Lt(t, e) {
|
|
1615
|
+
if ("string" == typeof t && "string" == typeof e && t.length === e.length) return gt(t, e);
|
|
1616
|
+
var n = kt(t), r = kt(e), i = gt(n.seconds, r.seconds);
|
|
1617
|
+
return 0 !== i ? i : gt(n.nanos, r.nanos);
|
|
1605
1618
|
}
|
|
1606
1619
|
|
|
1607
|
-
function
|
|
1620
|
+
function Rt(t, e) {
|
|
1608
1621
|
return {
|
|
1609
1622
|
referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
|
|
1610
1623
|
};
|
|
1611
1624
|
}
|
|
1612
1625
|
|
|
1613
|
-
/** Returns true if `value` is an ArrayValue. */ function
|
|
1626
|
+
/** Returns true if `value` is an ArrayValue. */ function Mt(t) {
|
|
1614
1627
|
return !!t && "arrayValue" in t;
|
|
1615
1628
|
}
|
|
1616
1629
|
|
|
1617
|
-
/** Returns true if `value` is a NullValue. */ function
|
|
1630
|
+
/** Returns true if `value` is a NullValue. */ function Ut(t) {
|
|
1618
1631
|
return !!t && "nullValue" in t;
|
|
1619
1632
|
}
|
|
1620
1633
|
|
|
1621
|
-
/** Returns true if `value` is NaN. */ function
|
|
1634
|
+
/** Returns true if `value` is NaN. */ function xt(t) {
|
|
1622
1635
|
return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
|
|
1623
1636
|
}
|
|
1624
1637
|
|
|
1625
|
-
/** Returns true if `value` is a MapValue. */ function
|
|
1638
|
+
/** Returns true if `value` is a MapValue. */ function Bt(t) {
|
|
1626
1639
|
return !!t && "mapValue" in t;
|
|
1627
1640
|
}
|
|
1628
1641
|
|
|
1629
|
-
/** Creates a deep copy of `source`. */ function
|
|
1642
|
+
/** Creates a deep copy of `source`. */ function Gt(t) {
|
|
1630
1643
|
if (t.geoPointValue) return {
|
|
1631
1644
|
geoPointValue: Object.assign({}, t.geoPointValue)
|
|
1632
1645
|
};
|
|
@@ -1639,8 +1652,8 @@ function Lt(t, e) {
|
|
|
1639
1652
|
fields: {}
|
|
1640
1653
|
}
|
|
1641
1654
|
};
|
|
1642
|
-
return
|
|
1643
|
-
return e.mapValue.fields[t] =
|
|
1655
|
+
return St(t.mapValue.fields, (function(t, n) {
|
|
1656
|
+
return e.mapValue.fields[t] = Gt(n);
|
|
1644
1657
|
})), e;
|
|
1645
1658
|
}
|
|
1646
1659
|
if (t.arrayValue) {
|
|
@@ -1648,7 +1661,7 @@ function Lt(t, e) {
|
|
|
1648
1661
|
arrayValue: {
|
|
1649
1662
|
values: []
|
|
1650
1663
|
}
|
|
1651
|
-
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] =
|
|
1664
|
+
}, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = Gt(t.arrayValue.values[r]);
|
|
1652
1665
|
return n;
|
|
1653
1666
|
}
|
|
1654
1667
|
return Object.assign({}, t);
|
|
@@ -1673,7 +1686,7 @@ function Lt(t, e) {
|
|
|
1673
1686
|
/**
|
|
1674
1687
|
* An ObjectValue represents a MapValue in the Firestore Proto and offers the
|
|
1675
1688
|
* ability to add and remove fields (via the ObjectValueBuilder).
|
|
1676
|
-
*/ var
|
|
1689
|
+
*/ var zt = /** @class */ function() {
|
|
1677
1690
|
function t(t) {
|
|
1678
1691
|
this.value = t;
|
|
1679
1692
|
}
|
|
@@ -1690,7 +1703,7 @@ function Lt(t, e) {
|
|
|
1690
1703
|
*/
|
|
1691
1704
|
t.prototype.field = function(t) {
|
|
1692
1705
|
if (t.isEmpty()) return this.value;
|
|
1693
|
-
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!
|
|
1706
|
+
for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Bt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
|
|
1694
1707
|
return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
|
|
1695
1708
|
},
|
|
1696
1709
|
/**
|
|
@@ -1700,7 +1713,7 @@ function Lt(t, e) {
|
|
|
1700
1713
|
* @param value - The value to set.
|
|
1701
1714
|
*/
|
|
1702
1715
|
t.prototype.set = function(t, e) {
|
|
1703
|
-
this.getFieldsMap(t.popLast())[t.lastSegment()] =
|
|
1716
|
+
this.getFieldsMap(t.popLast())[t.lastSegment()] = Gt(e);
|
|
1704
1717
|
},
|
|
1705
1718
|
/**
|
|
1706
1719
|
* Sets the provided fields to the provided values.
|
|
@@ -1708,14 +1721,14 @@ function Lt(t, e) {
|
|
|
1708
1721
|
* @param data - A map of fields to values (or null for deletes).
|
|
1709
1722
|
*/
|
|
1710
1723
|
t.prototype.setAll = function(t) {
|
|
1711
|
-
var e = this, n =
|
|
1724
|
+
var e = this, n = et.emptyPath(), r = {}, i = [];
|
|
1712
1725
|
t.forEach((function(t, o) {
|
|
1713
1726
|
if (!n.isImmediateParentOf(o)) {
|
|
1714
1727
|
// Insert the accumulated changes at this parent location
|
|
1715
1728
|
var a = e.getFieldsMap(n);
|
|
1716
1729
|
e.applyChanges(a, r, i), r = {}, i = [], n = o.popLast();
|
|
1717
1730
|
}
|
|
1718
|
-
t ? r[o.lastSegment()] =
|
|
1731
|
+
t ? r[o.lastSegment()] = Gt(t) : i.push(o.lastSegment());
|
|
1719
1732
|
}));
|
|
1720
1733
|
var o = this.getFieldsMap(n);
|
|
1721
1734
|
this.applyChanges(o, r, i);
|
|
@@ -1728,9 +1741,9 @@ function Lt(t, e) {
|
|
|
1728
1741
|
*/
|
|
1729
1742
|
t.prototype.delete = function(t) {
|
|
1730
1743
|
var e = this.field(t.popLast());
|
|
1731
|
-
|
|
1744
|
+
Bt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
|
|
1732
1745
|
}, t.prototype.isEqual = function(t) {
|
|
1733
|
-
return
|
|
1746
|
+
return Ot(this.value, t.value);
|
|
1734
1747
|
},
|
|
1735
1748
|
/**
|
|
1736
1749
|
* Returns the map that contains the leaf element of `path`. If the parent
|
|
@@ -1743,7 +1756,7 @@ function Lt(t, e) {
|
|
|
1743
1756
|
});
|
|
1744
1757
|
for (var n = 0; n < t.length; ++n) {
|
|
1745
1758
|
var r = e.mapValue.fields[t.get(n)];
|
|
1746
|
-
|
|
1759
|
+
Bt(r) && r.mapValue.fields || (r = {
|
|
1747
1760
|
mapValue: {
|
|
1748
1761
|
fields: {}
|
|
1749
1762
|
}
|
|
@@ -1756,7 +1769,7 @@ function Lt(t, e) {
|
|
|
1756
1769
|
* entries.
|
|
1757
1770
|
*/
|
|
1758
1771
|
t.prototype.applyChanges = function(t, e, n) {
|
|
1759
|
-
|
|
1772
|
+
St(e, (function(e, n) {
|
|
1760
1773
|
return t[e] = n;
|
|
1761
1774
|
}));
|
|
1762
1775
|
for (var r = 0, i = n; r < i.length; r++) {
|
|
@@ -1764,9 +1777,9 @@ function Lt(t, e) {
|
|
|
1764
1777
|
delete t[o];
|
|
1765
1778
|
}
|
|
1766
1779
|
}, t.prototype.clone = function() {
|
|
1767
|
-
return new t(
|
|
1780
|
+
return new t(Gt(this.value));
|
|
1768
1781
|
}, t;
|
|
1769
|
-
}(),
|
|
1782
|
+
}(), Qt = /** @class */ function() {
|
|
1770
1783
|
function t(t, e, n, r, i) {
|
|
1771
1784
|
this.key = t, this.documentType = e, this.version = n, this.data = r, this.documentState = i
|
|
1772
1785
|
/**
|
|
@@ -1775,7 +1788,7 @@ function Lt(t, e) {
|
|
|
1775
1788
|
*/;
|
|
1776
1789
|
}
|
|
1777
1790
|
return t.newInvalidDocument = function(e) {
|
|
1778
|
-
return new t(e, 0 /* INVALID */ ,
|
|
1791
|
+
return new t(e, 0 /* INVALID */ , _t.min(), zt.empty(), 0 /* SYNCED */);
|
|
1779
1792
|
},
|
|
1780
1793
|
/**
|
|
1781
1794
|
* Creates a new document that is known to exist with the given data at the
|
|
@@ -1785,7 +1798,7 @@ function Lt(t, e) {
|
|
|
1785
1798
|
return new t(e, 1 /* FOUND_DOCUMENT */ , n, r, 0 /* SYNCED */);
|
|
1786
1799
|
},
|
|
1787
1800
|
/** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
|
|
1788
|
-
return new t(e, 2 /* NO_DOCUMENT */ , n,
|
|
1801
|
+
return new t(e, 2 /* NO_DOCUMENT */ , n, zt.empty(), 0 /* SYNCED */);
|
|
1789
1802
|
},
|
|
1790
1803
|
/**
|
|
1791
1804
|
* Creates a new document that is known to exist at the given version but
|
|
@@ -1793,7 +1806,7 @@ function Lt(t, e) {
|
|
|
1793
1806
|
* base document).
|
|
1794
1807
|
*/
|
|
1795
1808
|
t.newUnknownDocument = function(e, n) {
|
|
1796
|
-
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n,
|
|
1809
|
+
return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, zt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
1797
1810
|
},
|
|
1798
1811
|
/**
|
|
1799
1812
|
* Changes the document type to indicate that it exists and that its version
|
|
@@ -1808,7 +1821,7 @@ function Lt(t, e) {
|
|
|
1808
1821
|
* version.
|
|
1809
1822
|
*/
|
|
1810
1823
|
t.prototype.convertToNoDocument = function(t) {
|
|
1811
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data =
|
|
1824
|
+
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = zt.empty(),
|
|
1812
1825
|
this.documentState = 0 /* SYNCED */ , this;
|
|
1813
1826
|
},
|
|
1814
1827
|
/**
|
|
@@ -1817,7 +1830,7 @@ function Lt(t, e) {
|
|
|
1817
1830
|
* base document).
|
|
1818
1831
|
*/
|
|
1819
1832
|
t.prototype.convertToUnknownDocument = function(t) {
|
|
1820
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data =
|
|
1833
|
+
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = zt.empty(),
|
|
1821
1834
|
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
1822
1835
|
}, t.prototype.setHasCommittedMutations = function() {
|
|
1823
1836
|
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
@@ -1851,12 +1864,12 @@ function Lt(t, e) {
|
|
|
1851
1864
|
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
1852
1865
|
}, t.prototype.isEqual = function(e) {
|
|
1853
1866
|
return e instanceof t && this.key.isEqual(e.key) && this.version.isEqual(e.version) && this.documentType === e.documentType && this.documentState === e.documentState && this.data.isEqual(e.data);
|
|
1854
|
-
}, t.prototype.
|
|
1867
|
+
}, t.prototype.mutableCopy = function() {
|
|
1855
1868
|
return new t(this.key, this.documentType, this.version, this.data.clone(), this.documentState);
|
|
1856
1869
|
}, t.prototype.toString = function() {
|
|
1857
1870
|
return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
|
|
1858
1871
|
}, t;
|
|
1859
|
-
}(),
|
|
1872
|
+
}(), Kt = function(t, e, n, r, i, o, a) {
|
|
1860
1873
|
void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1861
1874
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1862
1875
|
this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
|
|
@@ -1897,13 +1910,13 @@ function Lt(t, e) {
|
|
|
1897
1910
|
* using this factory method, because `Query` provides an implicit `orderBy`
|
|
1898
1911
|
* property.
|
|
1899
1912
|
*/
|
|
1900
|
-
function
|
|
1913
|
+
function Ht(t, e, n, r, i, o, a) {
|
|
1901
1914
|
return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
|
|
1902
1915
|
void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
|
|
1903
|
-
new
|
|
1916
|
+
new Kt(t, e, n, r, i, o, a);
|
|
1904
1917
|
}
|
|
1905
1918
|
|
|
1906
|
-
var
|
|
1919
|
+
var Wt = /** @class */ function(e) {
|
|
1907
1920
|
function n(t, n, r) {
|
|
1908
1921
|
var i = this;
|
|
1909
1922
|
return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
|
|
@@ -1911,13 +1924,13 @@ var Ht = /** @class */ function(e) {
|
|
|
1911
1924
|
/**
|
|
1912
1925
|
* Creates a filter based on the provided arguments.
|
|
1913
1926
|
*/ return t(n, e), n.create = function(t, e, r) {
|
|
1914
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, r) : new
|
|
1927
|
+
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, r) : new Yt(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Zt(t, r) : "in" /* IN */ === e ? new te(t, r) : "not-in" /* NOT_IN */ === e ? new ee(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ne(t, r) : new n(t, e, r);
|
|
1915
1928
|
}, n.V = function(t, e, n) {
|
|
1916
|
-
return "in" /* IN */ === e ? new
|
|
1929
|
+
return "in" /* IN */ === e ? new $t(t, n) : new Xt(t, n);
|
|
1917
1930
|
}, n.prototype.matches = function(t) {
|
|
1918
1931
|
var e = t.data.field(this.field);
|
|
1919
1932
|
// Types do not have to match in NOT_EQUAL filters.
|
|
1920
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(
|
|
1933
|
+
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(jt(e, this.value)) : null !== e && qt(this.value) === qt(e) && this.D(jt(e, this.value));
|
|
1921
1934
|
// Only compare types with matching backend order (such as double and int).
|
|
1922
1935
|
}, n.prototype.D = function(t) {
|
|
1923
1936
|
switch (this.op) {
|
|
@@ -1940,25 +1953,25 @@ var Ht = /** @class */ function(e) {
|
|
|
1940
1953
|
return t >= 0;
|
|
1941
1954
|
|
|
1942
1955
|
default:
|
|
1943
|
-
return
|
|
1956
|
+
return S();
|
|
1944
1957
|
}
|
|
1945
1958
|
}, n.prototype.N = function() {
|
|
1946
1959
|
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
1947
1960
|
}, n;
|
|
1948
|
-
}((function() {})),
|
|
1961
|
+
}((function() {})), Yt = /** @class */ function(e) {
|
|
1949
1962
|
function n(t, n, r) {
|
|
1950
1963
|
var i = this;
|
|
1951
|
-
return (i = e.call(this, t, n, r) || this).key =
|
|
1964
|
+
return (i = e.call(this, t, n, r) || this).key = nt.fromName(r.referenceValue),
|
|
1952
1965
|
i;
|
|
1953
1966
|
}
|
|
1954
1967
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1955
|
-
var e =
|
|
1968
|
+
var e = nt.comparator(t.key, this.key);
|
|
1956
1969
|
return this.D(e);
|
|
1957
1970
|
}, n;
|
|
1958
|
-
}(
|
|
1971
|
+
}(Wt), $t = /** @class */ function(e) {
|
|
1959
1972
|
function n(t, n) {
|
|
1960
1973
|
var r = this;
|
|
1961
|
-
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys =
|
|
1974
|
+
return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = Jt("in" /* IN */ , n),
|
|
1962
1975
|
r;
|
|
1963
1976
|
}
|
|
1964
1977
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1966,10 +1979,10 @@ var Ht = /** @class */ function(e) {
|
|
|
1966
1979
|
return e.isEqual(t.key);
|
|
1967
1980
|
}));
|
|
1968
1981
|
}, n;
|
|
1969
|
-
}(
|
|
1982
|
+
}(Wt), Xt = /** @class */ function(e) {
|
|
1970
1983
|
function n(t, n) {
|
|
1971
1984
|
var r = this;
|
|
1972
|
-
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys =
|
|
1985
|
+
return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = Jt("not-in" /* NOT_IN */ , n),
|
|
1973
1986
|
r;
|
|
1974
1987
|
}
|
|
1975
1988
|
return t(n, e), n.prototype.matches = function(t) {
|
|
@@ -1977,67 +1990,67 @@ var Ht = /** @class */ function(e) {
|
|
|
1977
1990
|
return e.isEqual(t.key);
|
|
1978
1991
|
}));
|
|
1979
1992
|
}, n;
|
|
1980
|
-
}(
|
|
1993
|
+
}(Wt);
|
|
1981
1994
|
|
|
1982
|
-
/** Filter that matches on key fields (i.e. '__name__'). */ function
|
|
1995
|
+
/** Filter that matches on key fields (i.e. '__name__'). */ function Jt(t, e) {
|
|
1983
1996
|
var n;
|
|
1984
1997
|
return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
|
|
1985
|
-
return
|
|
1998
|
+
return nt.fromName(t.referenceValue);
|
|
1986
1999
|
}));
|
|
1987
2000
|
}
|
|
1988
2001
|
|
|
1989
|
-
/** A Filter that implements the array-contains operator. */ var
|
|
2002
|
+
/** A Filter that implements the array-contains operator. */ var Zt = /** @class */ function(e) {
|
|
1990
2003
|
function n(t, n) {
|
|
1991
2004
|
return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this;
|
|
1992
2005
|
}
|
|
1993
2006
|
return t(n, e), n.prototype.matches = function(t) {
|
|
1994
2007
|
var e = t.data.field(this.field);
|
|
1995
|
-
return
|
|
2008
|
+
return Mt(e) && Ct(e.arrayValue, this.value);
|
|
1996
2009
|
}, n;
|
|
1997
|
-
}(
|
|
2010
|
+
}(Wt), te = /** @class */ function(e) {
|
|
1998
2011
|
function n(t, n) {
|
|
1999
2012
|
return e.call(this, t, "in" /* IN */ , n) || this;
|
|
2000
2013
|
}
|
|
2001
2014
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2002
2015
|
var e = t.data.field(this.field);
|
|
2003
|
-
return null !== e &&
|
|
2016
|
+
return null !== e && Ct(this.value.arrayValue, e);
|
|
2004
2017
|
}, n;
|
|
2005
|
-
}(
|
|
2018
|
+
}(Wt), ee = /** @class */ function(e) {
|
|
2006
2019
|
function n(t, n) {
|
|
2007
2020
|
return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
|
|
2008
2021
|
}
|
|
2009
2022
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2010
|
-
if (
|
|
2023
|
+
if (Ct(this.value.arrayValue, {
|
|
2011
2024
|
nullValue: "NULL_VALUE"
|
|
2012
2025
|
})) return !1;
|
|
2013
2026
|
var e = t.data.field(this.field);
|
|
2014
|
-
return null !== e && !
|
|
2027
|
+
return null !== e && !Ct(this.value.arrayValue, e);
|
|
2015
2028
|
}, n;
|
|
2016
|
-
}(
|
|
2029
|
+
}(Wt), ne = /** @class */ function(e) {
|
|
2017
2030
|
function n(t, n) {
|
|
2018
2031
|
return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
|
|
2019
2032
|
}
|
|
2020
2033
|
return t(n, e), n.prototype.matches = function(t) {
|
|
2021
2034
|
var e = this, n = t.data.field(this.field);
|
|
2022
|
-
return !(!
|
|
2023
|
-
return
|
|
2035
|
+
return !(!Mt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
|
|
2036
|
+
return Ct(e.value.arrayValue, t);
|
|
2024
2037
|
}));
|
|
2025
2038
|
}, n;
|
|
2026
|
-
}(
|
|
2039
|
+
}(Wt), re = function(t, e) {
|
|
2027
2040
|
this.position = t, this.before = e;
|
|
2028
|
-
},
|
|
2041
|
+
}, ie = function(t, e /* ASCENDING */) {
|
|
2029
2042
|
void 0 === e && (e = "asc"), this.field = t, this.dir = e;
|
|
2030
2043
|
};
|
|
2031
2044
|
|
|
2032
|
-
/** A Filter that implements the IN operator. */ function
|
|
2045
|
+
/** A Filter that implements the IN operator. */ function oe(t, e) {
|
|
2033
2046
|
return t.dir === e.dir && t.field.isEqual(e.field);
|
|
2034
2047
|
}
|
|
2035
2048
|
|
|
2036
|
-
function
|
|
2049
|
+
function ae(t, e) {
|
|
2037
2050
|
if (null === t) return null === e;
|
|
2038
2051
|
if (null === e) return !1;
|
|
2039
2052
|
if (t.before !== e.before || t.position.length !== e.position.length) return !1;
|
|
2040
|
-
for (var n = 0; n < t.position.length; n++) if (!
|
|
2053
|
+
for (var n = 0; n < t.position.length; n++) if (!Ot(t.position[n], e.position[n])) return !1;
|
|
2041
2054
|
return !0;
|
|
2042
2055
|
}
|
|
2043
2056
|
|
|
@@ -2063,7 +2076,7 @@ function oe(t, e) {
|
|
|
2063
2076
|
* query the RemoteStore results.
|
|
2064
2077
|
*
|
|
2065
2078
|
* Visible for testing.
|
|
2066
|
-
*/ var
|
|
2079
|
+
*/ var se =
|
|
2067
2080
|
/**
|
|
2068
2081
|
* Initializes a Query with a path and optional additional query constraints.
|
|
2069
2082
|
* Path must currently be empty if this is a collection group query.
|
|
@@ -2078,15 +2091,15 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2078
2091
|
this.F = null, this.startAt, this.endAt;
|
|
2079
2092
|
};
|
|
2080
2093
|
|
|
2081
|
-
/** Creates a new Query for a query that matches all documents at `path` */ function
|
|
2082
|
-
return !
|
|
2094
|
+
/** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
|
|
2095
|
+
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2083
2096
|
}
|
|
2084
2097
|
|
|
2085
|
-
function
|
|
2098
|
+
function ce(t) {
|
|
2086
2099
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2087
2100
|
}
|
|
2088
2101
|
|
|
2089
|
-
function
|
|
2102
|
+
function le(t) {
|
|
2090
2103
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2091
2104
|
var r = n[e];
|
|
2092
2105
|
if (r.N()) return r.field;
|
|
@@ -2101,7 +2114,7 @@ function ce(t) {
|
|
|
2101
2114
|
/**
|
|
2102
2115
|
* Returns whether the query matches a collection group rather than a specific
|
|
2103
2116
|
* collection.
|
|
2104
|
-
*/ function
|
|
2117
|
+
*/ function fe(t) {
|
|
2105
2118
|
return null !== t.collectionGroup;
|
|
2106
2119
|
}
|
|
2107
2120
|
|
|
@@ -2109,16 +2122,16 @@ function ce(t) {
|
|
|
2109
2122
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2110
2123
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2111
2124
|
* the SDK and backend always orders by `__name__`).
|
|
2112
|
-
*/ function
|
|
2113
|
-
var e =
|
|
2125
|
+
*/ function he(t) {
|
|
2126
|
+
var e = I(t);
|
|
2114
2127
|
if (null === e.$) {
|
|
2115
2128
|
e.$ = [];
|
|
2116
|
-
var n =
|
|
2129
|
+
var n = le(e), r = ce(e);
|
|
2117
2130
|
if (null !== n && null === r)
|
|
2118
2131
|
// In order to implicitly add key ordering, we must also add the
|
|
2119
2132
|
// inequality filter field for it to be a valid query.
|
|
2120
2133
|
// Note that the default inequality field and key ordering is ascending.
|
|
2121
|
-
n.isKeyField() || e.$.push(new
|
|
2134
|
+
n.isKeyField() || e.$.push(new ie(n)), e.$.push(new ie(et.keyField(), "asc" /* ASCENDING */)); else {
|
|
2122
2135
|
for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
|
|
2123
2136
|
var s = a[o];
|
|
2124
2137
|
e.$.push(s), s.field.isKeyField() && (i = !0);
|
|
@@ -2127,7 +2140,7 @@ function ce(t) {
|
|
|
2127
2140
|
// The order of the implicit key ordering always matches the last
|
|
2128
2141
|
// explicit order by
|
|
2129
2142
|
var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
2130
|
-
e.$.push(new
|
|
2143
|
+
e.$.push(new ie(et.keyField(), u));
|
|
2131
2144
|
}
|
|
2132
2145
|
}
|
|
2133
2146
|
}
|
|
@@ -2136,19 +2149,19 @@ function ce(t) {
|
|
|
2136
2149
|
|
|
2137
2150
|
/**
|
|
2138
2151
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2139
|
-
*/ function
|
|
2140
|
-
var e =
|
|
2141
|
-
if (!e.F) if ("F" /* First */ === e.limitType) e.F =
|
|
2152
|
+
*/ function pe(t) {
|
|
2153
|
+
var e = I(t);
|
|
2154
|
+
if (!e.F) if ("F" /* First */ === e.limitType) e.F = Ht(e.path, e.collectionGroup, he(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2142
2155
|
for (
|
|
2143
2156
|
// Flip the orderBy directions since we want the last results
|
|
2144
|
-
var n = [], r = 0, i =
|
|
2157
|
+
var n = [], r = 0, i = he(e); r < i.length; r++) {
|
|
2145
2158
|
var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2146
|
-
n.push(new
|
|
2159
|
+
n.push(new ie(o.field, a));
|
|
2147
2160
|
}
|
|
2148
2161
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2149
|
-
var s = e.endAt ? new
|
|
2162
|
+
var s = e.endAt ? new re(e.endAt.position, !e.endAt.before) : null, u = e.startAt ? new re(e.startAt.position, !e.startAt.before) : null;
|
|
2150
2163
|
// Now return as a LimitType.First query.
|
|
2151
|
-
e.F =
|
|
2164
|
+
e.F = Ht(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
|
|
2152
2165
|
}
|
|
2153
2166
|
return e.F;
|
|
2154
2167
|
}
|
|
@@ -2178,9 +2191,9 @@ function ce(t) {
|
|
|
2178
2191
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2179
2192
|
* otherwise a DoubleValue is returned.
|
|
2180
2193
|
*/
|
|
2181
|
-
function
|
|
2194
|
+
function de(t, e) {
|
|
2182
2195
|
return function(t) {
|
|
2183
|
-
return "number" == typeof t && Number.isInteger(t) && !
|
|
2196
|
+
return "number" == typeof t && Number.isInteger(t) && !lt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2184
2197
|
}(e) ?
|
|
2185
2198
|
/**
|
|
2186
2199
|
* Returns an IntegerValue for `value`.
|
|
@@ -2202,7 +2215,7 @@ function pe(t, e) {
|
|
|
2202
2215
|
};
|
|
2203
2216
|
}
|
|
2204
2217
|
return {
|
|
2205
|
-
doubleValue:
|
|
2218
|
+
doubleValue: lt(e) ? "-0" : e
|
|
2206
2219
|
};
|
|
2207
2220
|
}(t, e);
|
|
2208
2221
|
}
|
|
@@ -2223,36 +2236,36 @@ function pe(t, e) {
|
|
|
2223
2236
|
* See the License for the specific language governing permissions and
|
|
2224
2237
|
* limitations under the License.
|
|
2225
2238
|
*/
|
|
2226
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
2239
|
+
/** Used to represent a field transform on a mutation. */ var me = function() {
|
|
2227
2240
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2228
2241
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
2229
2242
|
this._ = void 0;
|
|
2230
|
-
},
|
|
2243
|
+
}, ye = /** @class */ function(e) {
|
|
2231
2244
|
function n() {
|
|
2232
2245
|
return null !== e && e.apply(this, arguments) || this;
|
|
2233
2246
|
}
|
|
2234
2247
|
return t(n, e), n;
|
|
2235
|
-
}(
|
|
2248
|
+
}(me), ve = /** @class */ function(e) {
|
|
2236
2249
|
function n(t) {
|
|
2237
2250
|
var n = this;
|
|
2238
2251
|
return (n = e.call(this) || this).elements = t, n;
|
|
2239
2252
|
}
|
|
2240
2253
|
return t(n, e), n;
|
|
2241
|
-
}(
|
|
2254
|
+
}(me), ge = /** @class */ function(e) {
|
|
2242
2255
|
function n(t) {
|
|
2243
2256
|
var n = this;
|
|
2244
2257
|
return (n = e.call(this) || this).elements = t, n;
|
|
2245
2258
|
}
|
|
2246
2259
|
return t(n, e), n;
|
|
2247
|
-
}(
|
|
2260
|
+
}(me), we = /** @class */ function(e) {
|
|
2248
2261
|
function n(t, n) {
|
|
2249
2262
|
var r = this;
|
|
2250
2263
|
return (r = e.call(this) || this).q = t, r.O = n, r;
|
|
2251
2264
|
}
|
|
2252
2265
|
return t(n, e), n;
|
|
2253
|
-
}(
|
|
2266
|
+
}(me), be = function(t, e) {
|
|
2254
2267
|
this.field = t, this.transform = e;
|
|
2255
|
-
},
|
|
2268
|
+
}, _e = /** @class */ function() {
|
|
2256
2269
|
function t(t, e) {
|
|
2257
2270
|
this.updateTime = t, this.exists = e
|
|
2258
2271
|
/** Creates a new empty Precondition. */;
|
|
@@ -2274,7 +2287,7 @@ function pe(t, e) {
|
|
|
2274
2287
|
}), t.prototype.isEqual = function(t) {
|
|
2275
2288
|
return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
|
|
2276
2289
|
}, t;
|
|
2277
|
-
}(),
|
|
2290
|
+
}(), Te = function() {}, Se = /** @class */ function(e) {
|
|
2278
2291
|
function n(t, n, r, i) {
|
|
2279
2292
|
void 0 === i && (i = []);
|
|
2280
2293
|
var o = this;
|
|
@@ -2282,7 +2295,7 @@ function pe(t, e) {
|
|
|
2282
2295
|
o.type = 0 /* Set */ , o;
|
|
2283
2296
|
}
|
|
2284
2297
|
return t(n, e), n;
|
|
2285
|
-
}(
|
|
2298
|
+
}(Te), Ee = /** @class */ function(e) {
|
|
2286
2299
|
function n(t, n, r, i, o) {
|
|
2287
2300
|
void 0 === o && (o = []);
|
|
2288
2301
|
var a = this;
|
|
@@ -2290,24 +2303,24 @@ function pe(t, e) {
|
|
|
2290
2303
|
a.fieldTransforms = o, a.type = 1 /* Patch */ , a;
|
|
2291
2304
|
}
|
|
2292
2305
|
return t(n, e), n;
|
|
2293
|
-
}(
|
|
2306
|
+
}(Te), Ie = /** @class */ function(e) {
|
|
2294
2307
|
function n(t, n) {
|
|
2295
2308
|
var r = this;
|
|
2296
2309
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
|
|
2297
2310
|
r.fieldTransforms = [], r;
|
|
2298
2311
|
}
|
|
2299
2312
|
return t(n, e), n;
|
|
2300
|
-
}(
|
|
2313
|
+
}(Te), Ae = /** @class */ function(e) {
|
|
2301
2314
|
function n(t, n) {
|
|
2302
2315
|
var r = this;
|
|
2303
2316
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
|
|
2304
2317
|
r.fieldTransforms = [], r;
|
|
2305
2318
|
}
|
|
2306
2319
|
return t(n, e), n;
|
|
2307
|
-
}(
|
|
2320
|
+
}(Te), ke = {
|
|
2308
2321
|
asc: "ASCENDING",
|
|
2309
2322
|
desc: "DESCENDING"
|
|
2310
|
-
},
|
|
2323
|
+
}, Ve = {
|
|
2311
2324
|
"<": "LESS_THAN",
|
|
2312
2325
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
2313
2326
|
">": "GREATER_THAN",
|
|
@@ -2318,7 +2331,7 @@ function pe(t, e) {
|
|
|
2318
2331
|
in: "IN",
|
|
2319
2332
|
"not-in": "NOT_IN",
|
|
2320
2333
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2321
|
-
},
|
|
2334
|
+
}, De = function(t, e) {
|
|
2322
2335
|
this.databaseId = t, this.S = e;
|
|
2323
2336
|
};
|
|
2324
2337
|
|
|
@@ -2334,7 +2347,7 @@ function pe(t, e) {
|
|
|
2334
2347
|
/**
|
|
2335
2348
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2336
2349
|
*/
|
|
2337
|
-
function
|
|
2350
|
+
function Pe(t, e) {
|
|
2338
2351
|
return t.S ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
2339
2352
|
seconds: "" + e.seconds,
|
|
2340
2353
|
nanos: e.nanoseconds
|
|
@@ -2345,80 +2358,80 @@ function De(t, e) {
|
|
|
2345
2358
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
2346
2359
|
*
|
|
2347
2360
|
* Visible for testing.
|
|
2348
|
-
*/ function
|
|
2361
|
+
*/ function Fe(t, e) {
|
|
2349
2362
|
return t.S ? e.toBase64() : e.toUint8Array();
|
|
2350
2363
|
}
|
|
2351
2364
|
|
|
2352
|
-
function
|
|
2353
|
-
return
|
|
2365
|
+
function Ne(t, e) {
|
|
2366
|
+
return Pe(t, e.toTimestamp());
|
|
2354
2367
|
}
|
|
2355
2368
|
|
|
2356
|
-
function
|
|
2357
|
-
return
|
|
2358
|
-
var e =
|
|
2359
|
-
return new
|
|
2369
|
+
function qe(t) {
|
|
2370
|
+
return E(!!t), _t.fromTimestamp(function(t) {
|
|
2371
|
+
var e = kt(t);
|
|
2372
|
+
return new bt(e.seconds, e.nanos);
|
|
2360
2373
|
}(t));
|
|
2361
2374
|
}
|
|
2362
2375
|
|
|
2363
|
-
function
|
|
2376
|
+
function Oe(t, e) {
|
|
2364
2377
|
return function(t) {
|
|
2365
|
-
return new
|
|
2378
|
+
return new Z([ "projects", t.projectId, "databases", t.database ]);
|
|
2366
2379
|
}(t).child("documents").child(e).canonicalString();
|
|
2367
2380
|
}
|
|
2368
2381
|
|
|
2369
|
-
function
|
|
2370
|
-
return
|
|
2382
|
+
function Ce(t, e) {
|
|
2383
|
+
return Oe(t.databaseId, e.path);
|
|
2371
2384
|
}
|
|
2372
2385
|
|
|
2373
|
-
function
|
|
2386
|
+
function je(t, e) {
|
|
2374
2387
|
var n, r = function(t) {
|
|
2375
|
-
var e =
|
|
2376
|
-
return
|
|
2388
|
+
var e = Z.fromString(t);
|
|
2389
|
+
return E(Qe(e)), e;
|
|
2377
2390
|
}(e);
|
|
2378
|
-
if (r.get(1) !== t.databaseId.projectId) throw new
|
|
2379
|
-
if (r.get(3) !== t.databaseId.database) throw new
|
|
2380
|
-
return new
|
|
2391
|
+
if (r.get(1) !== t.databaseId.projectId) throw new U(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
2392
|
+
if (r.get(3) !== t.databaseId.database) throw new U(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
2393
|
+
return new nt((E((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
2381
2394
|
}
|
|
2382
2395
|
|
|
2383
|
-
function
|
|
2384
|
-
return
|
|
2396
|
+
function Le(t, e) {
|
|
2397
|
+
return Oe(t.databaseId, e);
|
|
2385
2398
|
}
|
|
2386
2399
|
|
|
2387
|
-
function
|
|
2388
|
-
return new
|
|
2400
|
+
function Re(t) {
|
|
2401
|
+
return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2389
2402
|
}
|
|
2390
2403
|
|
|
2391
|
-
function
|
|
2404
|
+
function Me(t, e, n) {
|
|
2392
2405
|
return {
|
|
2393
|
-
name:
|
|
2406
|
+
name: Ce(t, e),
|
|
2394
2407
|
fields: n.value.mapValue.fields
|
|
2395
2408
|
};
|
|
2396
2409
|
}
|
|
2397
2410
|
|
|
2398
|
-
function
|
|
2411
|
+
function Ue(t) {
|
|
2399
2412
|
return {
|
|
2400
2413
|
before: t.before,
|
|
2401
2414
|
values: t.position
|
|
2402
2415
|
};
|
|
2403
2416
|
}
|
|
2404
2417
|
|
|
2405
|
-
// visible for testing
|
|
2406
|
-
function Ue(t) {
|
|
2407
|
-
return Ae[t];
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
2418
|
// visible for testing
|
|
2411
2419
|
function xe(t) {
|
|
2412
2420
|
return ke[t];
|
|
2413
2421
|
}
|
|
2414
2422
|
|
|
2423
|
+
// visible for testing
|
|
2415
2424
|
function Be(t) {
|
|
2425
|
+
return Ve[t];
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
function Ge(t) {
|
|
2416
2429
|
return {
|
|
2417
2430
|
fieldPath: t.canonicalString()
|
|
2418
2431
|
};
|
|
2419
2432
|
}
|
|
2420
2433
|
|
|
2421
|
-
function
|
|
2434
|
+
function ze(t) {
|
|
2422
2435
|
var e = [];
|
|
2423
2436
|
return t.fields.forEach((function(t) {
|
|
2424
2437
|
return e.push(t.canonicalString());
|
|
@@ -2427,7 +2440,7 @@ function Ge(t) {
|
|
|
2427
2440
|
};
|
|
2428
2441
|
}
|
|
2429
2442
|
|
|
2430
|
-
function
|
|
2443
|
+
function Qe(t) {
|
|
2431
2444
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2432
2445
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2433
2446
|
}
|
|
@@ -2447,8 +2460,8 @@ function ze(t) {
|
|
|
2447
2460
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2448
2461
|
* See the License for the specific language governing permissions and
|
|
2449
2462
|
* limitations under the License.
|
|
2450
|
-
*/ function
|
|
2451
|
-
return new
|
|
2463
|
+
*/ function Ke(t) {
|
|
2464
|
+
return new De(t, /* useProto3Json= */ !0);
|
|
2452
2465
|
}
|
|
2453
2466
|
|
|
2454
2467
|
/**
|
|
@@ -2475,7 +2488,7 @@ function ze(t) {
|
|
|
2475
2488
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
2476
2489
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2477
2490
|
* delays causing spikes of load to the backend.
|
|
2478
|
-
*/ var
|
|
2491
|
+
*/ var He = /** @class */ function() {
|
|
2479
2492
|
function t(
|
|
2480
2493
|
/**
|
|
2481
2494
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -2534,7 +2547,7 @@ function ze(t) {
|
|
|
2534
2547
|
// honored as such).
|
|
2535
2548
|
var n = Math.floor(this.j + this.Y()), r = Math.max(0, Date.now() - this.B), i = Math.max(0, n - r);
|
|
2536
2549
|
// Guard against lastAttemptTime being in the future due to a clock change.
|
|
2537
|
-
i > 0 &&
|
|
2550
|
+
i > 0 && w("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.j + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
|
|
2538
2551
|
this.M = this.C.enqueueAfterDelay(this.timerId, i, (function() {
|
|
2539
2552
|
return e.B = Date.now(), t();
|
|
2540
2553
|
})),
|
|
@@ -2549,14 +2562,14 @@ function ze(t) {
|
|
|
2549
2562
|
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Y = function() {
|
|
2550
2563
|
return (Math.random() - .5) * this.j;
|
|
2551
2564
|
}, t;
|
|
2552
|
-
}(),
|
|
2565
|
+
}(), We = /** @class */ function(e) {
|
|
2553
2566
|
function n(t, n, r, i) {
|
|
2554
2567
|
var o = this;
|
|
2555
2568
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
2556
2569
|
o.K = r, o.q = i, o.J = !1, o;
|
|
2557
2570
|
}
|
|
2558
2571
|
return t(n, e), n.prototype.X = function() {
|
|
2559
|
-
if (this.J) throw new
|
|
2572
|
+
if (this.J) throw new U(O, "The client has already been terminated.");
|
|
2560
2573
|
},
|
|
2561
2574
|
/** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.m = function(t, e, n) {
|
|
2562
2575
|
var r = this;
|
|
@@ -2564,8 +2577,8 @@ function ze(t) {
|
|
|
2564
2577
|
var o = i[0], a = i[1];
|
|
2565
2578
|
return r.K.m(t, e, n, o, a);
|
|
2566
2579
|
})).catch((function(t) {
|
|
2567
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
2568
|
-
r.appCheckCredentials.invalidateToken()), t) : new
|
|
2580
|
+
throw "FirebaseError" === t.name ? (t.code === N && (r.authCredentials.invalidateToken(),
|
|
2581
|
+
r.appCheckCredentials.invalidateToken()), t) : new U(k, t.toString());
|
|
2569
2582
|
}));
|
|
2570
2583
|
},
|
|
2571
2584
|
/** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.T = function(t, e, n) {
|
|
@@ -2574,8 +2587,8 @@ function ze(t) {
|
|
|
2574
2587
|
var o = i[0], a = i[1];
|
|
2575
2588
|
return r.K.T(t, e, n, o, a);
|
|
2576
2589
|
})).catch((function(t) {
|
|
2577
|
-
throw "FirebaseError" === t.name ? (t.code ===
|
|
2578
|
-
r.appCheckCredentials.invalidateToken()), t) : new
|
|
2590
|
+
throw "FirebaseError" === t.name ? (t.code === N && (r.authCredentials.invalidateToken(),
|
|
2591
|
+
r.appCheckCredentials.invalidateToken()), t) : new U(k, t.toString());
|
|
2579
2592
|
}));
|
|
2580
2593
|
}, n.prototype.terminate = function() {
|
|
2581
2594
|
this.J = !0;
|
|
@@ -2609,60 +2622,60 @@ function ze(t) {
|
|
|
2609
2622
|
*/
|
|
2610
2623
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
2611
2624
|
// firestore-exp client.
|
|
2612
|
-
function
|
|
2625
|
+
function Ye(t, r) {
|
|
2613
2626
|
return e(this, void 0, void 0, (function() {
|
|
2614
2627
|
var e, i, o;
|
|
2615
2628
|
return n(this, (function(n) {
|
|
2616
2629
|
switch (n.label) {
|
|
2617
2630
|
case 0:
|
|
2618
|
-
return e =
|
|
2631
|
+
return e = I(t), i = Re(e.q) + "/documents", o = {
|
|
2619
2632
|
writes: r.map((function(t) {
|
|
2620
2633
|
return function(t, e) {
|
|
2621
2634
|
var n;
|
|
2622
|
-
if (e instanceof
|
|
2623
|
-
update:
|
|
2635
|
+
if (e instanceof Se) n = {
|
|
2636
|
+
update: Me(t, e.key, e.value)
|
|
2637
|
+
}; else if (e instanceof Ie) n = {
|
|
2638
|
+
delete: Ce(t, e.key)
|
|
2624
2639
|
}; else if (e instanceof Ee) n = {
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
update: Re(t, e.key, e.data),
|
|
2628
|
-
updateMask: Ge(e.fieldMask)
|
|
2640
|
+
update: Me(t, e.key, e.data),
|
|
2641
|
+
updateMask: ze(e.fieldMask)
|
|
2629
2642
|
}; else {
|
|
2630
|
-
if (!(e instanceof
|
|
2643
|
+
if (!(e instanceof Ae)) return S();
|
|
2631
2644
|
n = {
|
|
2632
|
-
verify:
|
|
2645
|
+
verify: Ce(t, e.key)
|
|
2633
2646
|
};
|
|
2634
2647
|
}
|
|
2635
2648
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
2636
2649
|
return function(t, e) {
|
|
2637
2650
|
var n = e.transform;
|
|
2638
|
-
if (n instanceof
|
|
2651
|
+
if (n instanceof ye) return {
|
|
2639
2652
|
fieldPath: e.field.canonicalString(),
|
|
2640
2653
|
setToServerValue: "REQUEST_TIME"
|
|
2641
2654
|
};
|
|
2642
|
-
if (n instanceof
|
|
2655
|
+
if (n instanceof ve) return {
|
|
2643
2656
|
fieldPath: e.field.canonicalString(),
|
|
2644
2657
|
appendMissingElements: {
|
|
2645
2658
|
values: n.elements
|
|
2646
2659
|
}
|
|
2647
2660
|
};
|
|
2648
|
-
if (n instanceof
|
|
2661
|
+
if (n instanceof ge) return {
|
|
2649
2662
|
fieldPath: e.field.canonicalString(),
|
|
2650
2663
|
removeAllFromArray: {
|
|
2651
2664
|
values: n.elements
|
|
2652
2665
|
}
|
|
2653
2666
|
};
|
|
2654
|
-
if (n instanceof
|
|
2667
|
+
if (n instanceof we) return {
|
|
2655
2668
|
fieldPath: e.field.canonicalString(),
|
|
2656
2669
|
increment: n.O
|
|
2657
2670
|
};
|
|
2658
|
-
throw
|
|
2671
|
+
throw S();
|
|
2659
2672
|
}(0, t);
|
|
2660
2673
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2661
2674
|
return void 0 !== e.updateTime ? {
|
|
2662
|
-
updateTime:
|
|
2675
|
+
updateTime: Ne(t, e.updateTime)
|
|
2663
2676
|
} : void 0 !== e.exists ? {
|
|
2664
2677
|
exists: e.exists
|
|
2665
|
-
} :
|
|
2678
|
+
} : S();
|
|
2666
2679
|
}(t, e.precondition)), n;
|
|
2667
2680
|
}(e.q, t);
|
|
2668
2681
|
}))
|
|
@@ -2675,15 +2688,15 @@ function We(t, r) {
|
|
|
2675
2688
|
}));
|
|
2676
2689
|
}
|
|
2677
2690
|
|
|
2678
|
-
function
|
|
2691
|
+
function $e(t, r) {
|
|
2679
2692
|
return e(this, void 0, void 0, (function() {
|
|
2680
2693
|
var e, i, o, a, s, u;
|
|
2681
2694
|
return n(this, (function(n) {
|
|
2682
2695
|
switch (n.label) {
|
|
2683
2696
|
case 0:
|
|
2684
|
-
return e =
|
|
2697
|
+
return e = I(t), i = Re(e.q) + "/documents", o = {
|
|
2685
2698
|
documents: r.map((function(t) {
|
|
2686
|
-
return
|
|
2699
|
+
return Ce(e.q, t);
|
|
2687
2700
|
}))
|
|
2688
2701
|
}, [ 4 /*yield*/ , e.T("BatchGetDocuments", i, o) ];
|
|
2689
2702
|
|
|
@@ -2691,44 +2704,44 @@ function Ye(t, r) {
|
|
|
2691
2704
|
return a = n.sent(), s = new Map, a.forEach((function(t) {
|
|
2692
2705
|
var n = function(t, e) {
|
|
2693
2706
|
return "found" in e ? function(t, e) {
|
|
2694
|
-
|
|
2695
|
-
var n =
|
|
2707
|
+
E(!!e.found), e.found.name, e.found.updateTime;
|
|
2708
|
+
var n = je(t, e.found.name), r = qe(e.found.updateTime), i = new zt({
|
|
2696
2709
|
mapValue: {
|
|
2697
2710
|
fields: e.found.fields
|
|
2698
2711
|
}
|
|
2699
2712
|
});
|
|
2700
|
-
return
|
|
2713
|
+
return Qt.newFoundDocument(n, r, i);
|
|
2701
2714
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2702
|
-
|
|
2703
|
-
var n =
|
|
2704
|
-
return
|
|
2705
|
-
}(t, e) :
|
|
2715
|
+
E(!!e.missing), E(!!e.readTime);
|
|
2716
|
+
var n = je(t, e.missing), r = qe(e.readTime);
|
|
2717
|
+
return Qt.newNoDocument(n, r);
|
|
2718
|
+
}(t, e) : S();
|
|
2706
2719
|
}(e.q, t);
|
|
2707
2720
|
s.set(n.key.toString(), n);
|
|
2708
2721
|
})), u = [], [ 2 /*return*/ , (r.forEach((function(t) {
|
|
2709
2722
|
var e = s.get(t.toString());
|
|
2710
|
-
|
|
2723
|
+
E(!!e), u.push(e);
|
|
2711
2724
|
})), u) ];
|
|
2712
2725
|
}
|
|
2713
2726
|
}));
|
|
2714
2727
|
}));
|
|
2715
2728
|
}
|
|
2716
2729
|
|
|
2717
|
-
function
|
|
2730
|
+
function Xe(t, r) {
|
|
2718
2731
|
return e(this, void 0, void 0, (function() {
|
|
2719
2732
|
var e, i;
|
|
2720
2733
|
return n(this, (function(n) {
|
|
2721
2734
|
switch (n.label) {
|
|
2722
2735
|
case 0:
|
|
2723
|
-
return e =
|
|
2736
|
+
return e = I(t), i = function(t, e) {
|
|
2724
2737
|
// Dissect the path into parent, collectionId, and optional key filter.
|
|
2725
2738
|
var n = {
|
|
2726
2739
|
structuredQuery: {}
|
|
2727
2740
|
}, r = e.path;
|
|
2728
|
-
null !== e.collectionGroup ? (n.parent =
|
|
2741
|
+
null !== e.collectionGroup ? (n.parent = Le(t, r), n.structuredQuery.from = [ {
|
|
2729
2742
|
collectionId: e.collectionGroup,
|
|
2730
2743
|
allDescendants: !0
|
|
2731
|
-
} ]) : (n.parent =
|
|
2744
|
+
} ]) : (n.parent = Le(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2732
2745
|
collectionId: r.lastSegment()
|
|
2733
2746
|
} ]);
|
|
2734
2747
|
var i = function(t) {
|
|
@@ -2737,36 +2750,36 @@ function $e(t, r) {
|
|
|
2737
2750
|
// visible for testing
|
|
2738
2751
|
return function(t) {
|
|
2739
2752
|
if ("==" /* EQUAL */ === t.op) {
|
|
2740
|
-
if (
|
|
2753
|
+
if (xt(t.value)) return {
|
|
2741
2754
|
unaryFilter: {
|
|
2742
|
-
field:
|
|
2755
|
+
field: Ge(t.field),
|
|
2743
2756
|
op: "IS_NAN"
|
|
2744
2757
|
}
|
|
2745
2758
|
};
|
|
2746
|
-
if (
|
|
2759
|
+
if (Ut(t.value)) return {
|
|
2747
2760
|
unaryFilter: {
|
|
2748
|
-
field:
|
|
2761
|
+
field: Ge(t.field),
|
|
2749
2762
|
op: "IS_NULL"
|
|
2750
2763
|
}
|
|
2751
2764
|
};
|
|
2752
2765
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2753
|
-
if (
|
|
2766
|
+
if (xt(t.value)) return {
|
|
2754
2767
|
unaryFilter: {
|
|
2755
|
-
field:
|
|
2768
|
+
field: Ge(t.field),
|
|
2756
2769
|
op: "IS_NOT_NAN"
|
|
2757
2770
|
}
|
|
2758
2771
|
};
|
|
2759
|
-
if (
|
|
2772
|
+
if (Ut(t.value)) return {
|
|
2760
2773
|
unaryFilter: {
|
|
2761
|
-
field:
|
|
2774
|
+
field: Ge(t.field),
|
|
2762
2775
|
op: "IS_NOT_NULL"
|
|
2763
2776
|
}
|
|
2764
2777
|
};
|
|
2765
2778
|
}
|
|
2766
2779
|
return {
|
|
2767
2780
|
fieldFilter: {
|
|
2768
|
-
field:
|
|
2769
|
-
op:
|
|
2781
|
+
field: Ge(t.field),
|
|
2782
|
+
op: Be(t.op),
|
|
2770
2783
|
value: t.value
|
|
2771
2784
|
}
|
|
2772
2785
|
};
|
|
@@ -2786,21 +2799,21 @@ function $e(t, r) {
|
|
|
2786
2799
|
// visible for testing
|
|
2787
2800
|
return function(t) {
|
|
2788
2801
|
return {
|
|
2789
|
-
field:
|
|
2790
|
-
direction:
|
|
2802
|
+
field: Ge(t.field),
|
|
2803
|
+
direction: xe(t.dir)
|
|
2791
2804
|
};
|
|
2792
2805
|
}(t);
|
|
2793
2806
|
}));
|
|
2794
2807
|
}(e.orderBy);
|
|
2795
2808
|
o && (n.structuredQuery.orderBy = o);
|
|
2796
2809
|
var a = function(t, e) {
|
|
2797
|
-
return t.S ||
|
|
2810
|
+
return t.S || ct(e) ? e : {
|
|
2798
2811
|
value: e
|
|
2799
2812
|
};
|
|
2800
2813
|
}(t, e.limit);
|
|
2801
|
-
return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt =
|
|
2802
|
-
e.endAt && (n.structuredQuery.endAt =
|
|
2803
|
-
}(e.q,
|
|
2814
|
+
return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt = Ue(e.startAt)),
|
|
2815
|
+
e.endAt && (n.structuredQuery.endAt = Ue(e.endAt)), n;
|
|
2816
|
+
}(e.q, pe(r)), [ 4 /*yield*/ , e.T("RunQuery", i.parent, {
|
|
2804
2817
|
structuredQuery: i.structuredQuery
|
|
2805
2818
|
}) ];
|
|
2806
2819
|
|
|
@@ -2809,11 +2822,11 @@ function $e(t, r) {
|
|
|
2809
2822
|
return !!t.document;
|
|
2810
2823
|
})).map((function(t) {
|
|
2811
2824
|
return function(t, e, n) {
|
|
2812
|
-
var r =
|
|
2825
|
+
var r = je(t, e.name), i = qe(e.updateTime), o = new zt({
|
|
2813
2826
|
mapValue: {
|
|
2814
2827
|
fields: e.fields
|
|
2815
2828
|
}
|
|
2816
|
-
}), a =
|
|
2829
|
+
}), a = Qt.newFoundDocument(r, i, o);
|
|
2817
2830
|
return a;
|
|
2818
2831
|
}(e.q, t.document);
|
|
2819
2832
|
})) ];
|
|
@@ -2837,7 +2850,7 @@ function $e(t, r) {
|
|
|
2837
2850
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2838
2851
|
* See the License for the specific language governing permissions and
|
|
2839
2852
|
* limitations under the License.
|
|
2840
|
-
*/ var
|
|
2853
|
+
*/ var Je = new Map;
|
|
2841
2854
|
|
|
2842
2855
|
/**
|
|
2843
2856
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -2847,17 +2860,17 @@ function $e(t, r) {
|
|
|
2847
2860
|
* Returns an initialized and started Datastore for the given Firestore
|
|
2848
2861
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
2849
2862
|
* instance is terminated.
|
|
2850
|
-
*/ function
|
|
2851
|
-
if (t._terminated) throw new
|
|
2852
|
-
if (!
|
|
2853
|
-
|
|
2863
|
+
*/ function Ze(t) {
|
|
2864
|
+
if (t._terminated) throw new U(O, "The client has already been terminated.");
|
|
2865
|
+
if (!Je.has(t)) {
|
|
2866
|
+
w("ComponentProvider", "Initializing Datastore");
|
|
2854
2867
|
var e = function(t) {
|
|
2855
|
-
return new
|
|
2868
|
+
return new mt(t, fetch.bind(null));
|
|
2856
2869
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
|
|
2857
|
-
new
|
|
2858
|
-
return new
|
|
2870
|
+
new $(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Ke(t._databaseId), r = function(t, e, n, r) {
|
|
2871
|
+
return new We(t, e, n, r);
|
|
2859
2872
|
}(t._authCredentials, t._appCheckCredentials, e, n);
|
|
2860
|
-
|
|
2873
|
+
Je.set(t, r);
|
|
2861
2874
|
}
|
|
2862
2875
|
var i, o, a, s;
|
|
2863
2876
|
/**
|
|
@@ -2875,7 +2888,7 @@ function $e(t, r) {
|
|
|
2875
2888
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2876
2889
|
* See the License for the specific language governing permissions and
|
|
2877
2890
|
* limitations under the License.
|
|
2878
|
-
*/ return
|
|
2891
|
+
*/ return Je.get(t);
|
|
2879
2892
|
}
|
|
2880
2893
|
|
|
2881
2894
|
/**
|
|
@@ -2886,38 +2899,38 @@ function $e(t, r) {
|
|
|
2886
2899
|
* A concrete type describing all the values that can be applied via a
|
|
2887
2900
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
2888
2901
|
* defaults can be supplied and the value can be checked for equality.
|
|
2889
|
-
*/ var
|
|
2902
|
+
*/ var tn = /** @class */ function() {
|
|
2890
2903
|
function t(t) {
|
|
2891
2904
|
var e;
|
|
2892
2905
|
if (void 0 === t.host) {
|
|
2893
|
-
if (void 0 !== t.ssl) throw new
|
|
2906
|
+
if (void 0 !== t.ssl) throw new U(V, "Can't provide ssl option if host option is not set");
|
|
2894
2907
|
this.host = "firestore.googleapis.com", this.ssl = !0;
|
|
2895
2908
|
} else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
|
|
2896
2909
|
if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
|
|
2897
2910
|
void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
|
|
2898
|
-
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new
|
|
2911
|
+
if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(V, "cacheSizeBytes must be at least 1048576");
|
|
2899
2912
|
this.cacheSizeBytes = t.cacheSizeBytes;
|
|
2900
2913
|
}
|
|
2901
2914
|
this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
|
|
2902
2915
|
this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
|
|
2903
|
-
if (!0 === e && !0 === r) throw new
|
|
2916
|
+
if (!0 === e && !0 === r) throw new U(V, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
|
|
2904
2917
|
}(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);
|
|
2905
2918
|
}
|
|
2906
2919
|
return t.prototype.isEqual = function(t) {
|
|
2907
2920
|
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;
|
|
2908
2921
|
}, t;
|
|
2909
|
-
}(),
|
|
2922
|
+
}(), en = /** @class */ function() {
|
|
2910
2923
|
/** @hideconstructor */
|
|
2911
2924
|
function t(t, e, n) {
|
|
2912
2925
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
2913
2926
|
/**
|
|
2914
2927
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
2915
2928
|
*/
|
|
2916
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
2917
|
-
this._settingsFrozen = !1, t instanceof
|
|
2929
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new tn({}),
|
|
2930
|
+
this._settingsFrozen = !1, t instanceof X ? this._databaseId = t : (this._app = t,
|
|
2918
2931
|
this._databaseId = function(t) {
|
|
2919
|
-
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new
|
|
2920
|
-
return new
|
|
2932
|
+
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(V, '"projectId" not provided in firebase.initializeApp.');
|
|
2933
|
+
return new X(t.options.projectId);
|
|
2921
2934
|
}(t));
|
|
2922
2935
|
}
|
|
2923
2936
|
return Object.defineProperty(t.prototype, "app", {
|
|
@@ -2926,7 +2939,7 @@ function $e(t, r) {
|
|
|
2926
2939
|
* instance.
|
|
2927
2940
|
*/
|
|
2928
2941
|
get: function() {
|
|
2929
|
-
if (!this._app) throw new
|
|
2942
|
+
if (!this._app) throw new U(O, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
|
|
2930
2943
|
return this._app;
|
|
2931
2944
|
},
|
|
2932
2945
|
enumerable: !1,
|
|
@@ -2944,21 +2957,21 @@ function $e(t, r) {
|
|
|
2944
2957
|
enumerable: !1,
|
|
2945
2958
|
configurable: !0
|
|
2946
2959
|
}), t.prototype._setSettings = function(t) {
|
|
2947
|
-
if (this._settingsFrozen) throw new
|
|
2948
|
-
this._settings = new
|
|
2949
|
-
if (!t) return new
|
|
2960
|
+
if (this._settingsFrozen) throw new U(O, "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.");
|
|
2961
|
+
this._settings = new tn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
2962
|
+
if (!t) return new G;
|
|
2950
2963
|
switch (t.type) {
|
|
2951
2964
|
case "gapi":
|
|
2952
2965
|
var e = t.client;
|
|
2953
2966
|
// Make sure this really is a Gapi client.
|
|
2954
|
-
return
|
|
2955
|
-
new
|
|
2967
|
+
return E(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
|
|
2968
|
+
new H(e, t.sessionIndex || "0", t.iamToken || null);
|
|
2956
2969
|
|
|
2957
2970
|
case "provider":
|
|
2958
2971
|
return t.client;
|
|
2959
2972
|
|
|
2960
2973
|
default:
|
|
2961
|
-
throw new
|
|
2974
|
+
throw new U(V, "makeAuthCredentialsProvider failed due to invalid credential type");
|
|
2962
2975
|
}
|
|
2963
2976
|
}(t.credentials));
|
|
2964
2977
|
}, t.prototype._getSettings = function() {
|
|
@@ -2983,8 +2996,8 @@ function $e(t, r) {
|
|
|
2983
2996
|
* Only ever called once.
|
|
2984
2997
|
*/
|
|
2985
2998
|
t.prototype._terminate = function() {
|
|
2986
|
-
return t = this, (e =
|
|
2987
|
-
|
|
2999
|
+
return t = this, (e = Je.get(t)) && (w("ComponentProvider", "Removing Datastore"),
|
|
3000
|
+
Je.delete(t), e.terminate()), Promise.resolve();
|
|
2988
3001
|
var t, e;
|
|
2989
3002
|
}, t;
|
|
2990
3003
|
}();
|
|
@@ -3009,9 +3022,9 @@ function $e(t, r) {
|
|
|
3009
3022
|
* The Cloud Firestore service interface.
|
|
3010
3023
|
*
|
|
3011
3024
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3012
|
-
*/ function
|
|
3025
|
+
*/ function nn(t, e) {
|
|
3013
3026
|
var n = _getProvider(t, "firestore/lite");
|
|
3014
|
-
if (n.isInitialized()) throw new
|
|
3027
|
+
if (n.isInitialized()) throw new U(O, "Firestore can only be initialized once per app.");
|
|
3015
3028
|
return n.initialize({
|
|
3016
3029
|
options: e
|
|
3017
3030
|
});
|
|
@@ -3025,7 +3038,7 @@ function $e(t, r) {
|
|
|
3025
3038
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3026
3039
|
* instance is associated with.
|
|
3027
3040
|
* @returns The `Firestore` instance of the provided app.
|
|
3028
|
-
*/ function
|
|
3041
|
+
*/ function rn(t) {
|
|
3029
3042
|
return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
|
|
3030
3043
|
}
|
|
3031
3044
|
|
|
@@ -3041,25 +3054,25 @@ function $e(t, r) {
|
|
|
3041
3054
|
* @param port - the emulator port (ex: 9000).
|
|
3042
3055
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3043
3056
|
* Security Rules.
|
|
3044
|
-
*/ function
|
|
3057
|
+
*/ function on(t, e, n, r) {
|
|
3045
3058
|
var i;
|
|
3046
3059
|
void 0 === r && (r = {});
|
|
3047
|
-
var o = (t =
|
|
3048
|
-
if ("firestore.googleapis.com" !== o.host && o.host !== e &&
|
|
3060
|
+
var o = (t = st(t, en))._getSettings();
|
|
3061
|
+
if ("firestore.googleapis.com" !== o.host && o.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3049
3062
|
t._setSettings(Object.assign(Object.assign({}, o), {
|
|
3050
3063
|
host: e + ":" + n,
|
|
3051
3064
|
ssl: !1
|
|
3052
3065
|
})), r.mockUserToken) {
|
|
3053
3066
|
var a, s;
|
|
3054
|
-
if ("string" == typeof r.mockUserToken) a = r.mockUserToken, s =
|
|
3067
|
+
if ("string" == typeof r.mockUserToken) a = r.mockUserToken, s = m.MOCK_USER; else {
|
|
3055
3068
|
// Let createMockUserToken validate first (catches common mistakes like
|
|
3056
3069
|
// invalid field "uid" and missing field "sub" / "user_id".)
|
|
3057
|
-
a =
|
|
3070
|
+
a = d(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
|
|
3058
3071
|
var u = r.mockUserToken.sub || r.mockUserToken.user_id;
|
|
3059
|
-
if (!u) throw new
|
|
3060
|
-
s = new
|
|
3072
|
+
if (!u) throw new U(V, "mockUserToken must contain 'sub' or 'user_id' field!");
|
|
3073
|
+
s = new m(u);
|
|
3061
3074
|
}
|
|
3062
|
-
t._authCredentials = new
|
|
3075
|
+
t._authCredentials = new z(new B(a, s));
|
|
3063
3076
|
}
|
|
3064
3077
|
}
|
|
3065
3078
|
|
|
@@ -3082,8 +3095,8 @@ function $e(t, r) {
|
|
|
3082
3095
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3083
3096
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3084
3097
|
* terminated.
|
|
3085
|
-
*/ function
|
|
3086
|
-
return t =
|
|
3098
|
+
*/ function an(t) {
|
|
3099
|
+
return t = st(t, en), u(t.app, "firestore/lite"), t._delete()
|
|
3087
3100
|
/**
|
|
3088
3101
|
* @license
|
|
3089
3102
|
* Copyright 2020 Google LLC
|
|
@@ -3123,7 +3136,7 @@ function $e(t, r) {
|
|
|
3123
3136
|
*/;
|
|
3124
3137
|
}
|
|
3125
3138
|
|
|
3126
|
-
var
|
|
3139
|
+
var sn = /** @class */ function() {
|
|
3127
3140
|
/** @hideconstructor */
|
|
3128
3141
|
function t(t,
|
|
3129
3142
|
/**
|
|
@@ -3164,14 +3177,14 @@ var an = /** @class */ function() {
|
|
|
3164
3177
|
* The collection this `DocumentReference` belongs to.
|
|
3165
3178
|
*/
|
|
3166
3179
|
get: function() {
|
|
3167
|
-
return new
|
|
3180
|
+
return new cn(this.firestore, this.converter, this._key.path.popLast());
|
|
3168
3181
|
},
|
|
3169
3182
|
enumerable: !1,
|
|
3170
3183
|
configurable: !0
|
|
3171
3184
|
}), t.prototype.withConverter = function(e) {
|
|
3172
3185
|
return new t(this.firestore, e, this._key);
|
|
3173
3186
|
}, t;
|
|
3174
|
-
}(),
|
|
3187
|
+
}(), un = /** @class */ function() {
|
|
3175
3188
|
// This is the lite version of the Query class in the main SDK.
|
|
3176
3189
|
/** @hideconstructor protected */
|
|
3177
3190
|
function t(t,
|
|
@@ -3186,11 +3199,11 @@ var an = /** @class */ function() {
|
|
|
3186
3199
|
return t.prototype.withConverter = function(e) {
|
|
3187
3200
|
return new t(this.firestore, e, this._query);
|
|
3188
3201
|
}, t;
|
|
3189
|
-
}(),
|
|
3202
|
+
}(), cn = /** @class */ function(e) {
|
|
3190
3203
|
/** @hideconstructor */
|
|
3191
3204
|
function n(t, n, r) {
|
|
3192
3205
|
var i = this;
|
|
3193
|
-
return (i = e.call(this, t, n, new
|
|
3206
|
+
return (i = e.call(this, t, n, new se(r)) || this)._path = r,
|
|
3194
3207
|
/** The type of this Firestore reference. */
|
|
3195
3208
|
i.type = "collection", i;
|
|
3196
3209
|
}
|
|
@@ -3217,28 +3230,28 @@ var an = /** @class */ function() {
|
|
|
3217
3230
|
*/
|
|
3218
3231
|
get: function() {
|
|
3219
3232
|
var t = this._path.popLast();
|
|
3220
|
-
return t.isEmpty() ? null : new
|
|
3221
|
-
/* converter= */ null, new
|
|
3233
|
+
return t.isEmpty() ? null : new sn(this.firestore,
|
|
3234
|
+
/* converter= */ null, new nt(t));
|
|
3222
3235
|
},
|
|
3223
3236
|
enumerable: !1,
|
|
3224
3237
|
configurable: !0
|
|
3225
3238
|
}), n.prototype.withConverter = function(t) {
|
|
3226
3239
|
return new n(this.firestore, t, this._path);
|
|
3227
3240
|
}, n;
|
|
3228
|
-
}(
|
|
3241
|
+
}(un);
|
|
3229
3242
|
|
|
3230
3243
|
/**
|
|
3231
3244
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3232
3245
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3233
|
-
*/ function
|
|
3246
|
+
*/ function ln(t, e) {
|
|
3234
3247
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3235
|
-
if (t =
|
|
3236
|
-
var o =
|
|
3237
|
-
return
|
|
3248
|
+
if (t = p(t), rt("collection", "path", e), t instanceof en) {
|
|
3249
|
+
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3250
|
+
return ot(o), new cn(t, /* converter= */ null, o);
|
|
3238
3251
|
}
|
|
3239
|
-
if (!(t instanceof
|
|
3240
|
-
var a = t._path.child(
|
|
3241
|
-
return
|
|
3252
|
+
if (!(t instanceof sn || t instanceof cn)) throw new U(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3253
|
+
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3254
|
+
return ot(a), new cn(t.firestore,
|
|
3242
3255
|
/* converter= */ null, a);
|
|
3243
3256
|
}
|
|
3244
3257
|
|
|
@@ -3254,32 +3267,32 @@ var an = /** @class */ function() {
|
|
|
3254
3267
|
* collection or subcollection with this ID as the last segment of its path
|
|
3255
3268
|
* will be included. Cannot contain a slash.
|
|
3256
3269
|
* @returns The created `Query`.
|
|
3257
|
-
*/ function
|
|
3258
|
-
if (t =
|
|
3259
|
-
return new
|
|
3270
|
+
*/ function fn(t, e) {
|
|
3271
|
+
if (t = st(t, en), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
|
|
3272
|
+
return new un(t,
|
|
3260
3273
|
/* converter= */ null,
|
|
3261
3274
|
/**
|
|
3262
3275
|
* Creates a new Query for a collection group query that matches all documents
|
|
3263
3276
|
* within the provided collection group.
|
|
3264
3277
|
*/
|
|
3265
3278
|
function(t) {
|
|
3266
|
-
return new
|
|
3279
|
+
return new se(Z.emptyPath(), t);
|
|
3267
3280
|
}(e));
|
|
3268
3281
|
}
|
|
3269
3282
|
|
|
3270
|
-
function
|
|
3283
|
+
function hn(t, e) {
|
|
3271
3284
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3272
|
-
if (t =
|
|
3285
|
+
if (t = p(t),
|
|
3273
3286
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3274
3287
|
// 'undefined' and 'null'.
|
|
3275
|
-
1 === arguments.length && (e =
|
|
3276
|
-
var o =
|
|
3277
|
-
return
|
|
3278
|
-
/* converter= */ null, new
|
|
3288
|
+
1 === arguments.length && (e = vt.P()), rt("doc", "path", e), t instanceof en) {
|
|
3289
|
+
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3290
|
+
return it(o), new sn(t,
|
|
3291
|
+
/* converter= */ null, new nt(o));
|
|
3279
3292
|
}
|
|
3280
|
-
if (!(t instanceof
|
|
3281
|
-
var a = t._path.child(
|
|
3282
|
-
return
|
|
3293
|
+
if (!(t instanceof sn || t instanceof cn)) throw new U(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3294
|
+
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3295
|
+
return it(a), new sn(t.firestore, t instanceof cn ? t.converter : null, new nt(a));
|
|
3283
3296
|
}
|
|
3284
3297
|
|
|
3285
3298
|
/**
|
|
@@ -3289,8 +3302,8 @@ function fn(t, e) {
|
|
|
3289
3302
|
* @param right - A reference to compare.
|
|
3290
3303
|
* @returns true if the references point to the same location in the same
|
|
3291
3304
|
* Firestore database.
|
|
3292
|
-
*/ function
|
|
3293
|
-
return t =
|
|
3305
|
+
*/ function pn(t, e) {
|
|
3306
|
+
return t = p(t), e = p(e), (t instanceof sn || t instanceof cn) && (e instanceof sn || e instanceof cn) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
|
|
3294
3307
|
/**
|
|
3295
3308
|
* Returns true if the provided queries point to the same collection and apply
|
|
3296
3309
|
* the same constraints.
|
|
@@ -3302,18 +3315,18 @@ function fn(t, e) {
|
|
|
3302
3315
|
*/;
|
|
3303
3316
|
}
|
|
3304
3317
|
|
|
3305
|
-
function
|
|
3306
|
-
return t =
|
|
3318
|
+
function dn(t, e) {
|
|
3319
|
+
return t = p(t), e = p(e), t instanceof un && e instanceof un && t.firestore === e.firestore && function(t, e) {
|
|
3307
3320
|
return function(t, e) {
|
|
3308
3321
|
if (t.limit !== e.limit) return !1;
|
|
3309
3322
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
3310
|
-
for (var n = 0; n < t.orderBy.length; n++) if (!
|
|
3323
|
+
for (var n = 0; n < t.orderBy.length; n++) if (!oe(t.orderBy[n], e.orderBy[n])) return !1;
|
|
3311
3324
|
if (t.filters.length !== e.filters.length) return !1;
|
|
3312
3325
|
for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r],
|
|
3313
|
-
i.op !== o.op || !i.field.isEqual(o.field) || !
|
|
3326
|
+
i.op !== o.op || !i.field.isEqual(o.field) || !Ot(i.value, o.value)) return !1;
|
|
3314
3327
|
var i, o;
|
|
3315
|
-
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!
|
|
3316
|
-
}(
|
|
3328
|
+
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ae(t.startAt, e.startAt) && ae(t.endAt, e.endAt);
|
|
3329
|
+
}(pe(t), pe(e)) && t.limitType === e.limitType;
|
|
3317
3330
|
}(t._query, e._query) && t.converter === e.converter
|
|
3318
3331
|
/**
|
|
3319
3332
|
* @license
|
|
@@ -3341,7 +3354,7 @@ function pn(t, e) {
|
|
|
3341
3354
|
*/;
|
|
3342
3355
|
}
|
|
3343
3356
|
|
|
3344
|
-
var
|
|
3357
|
+
var mn = /** @class */ function() {
|
|
3345
3358
|
/**
|
|
3346
3359
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3347
3360
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3350,8 +3363,8 @@ var dn = /** @class */ function() {
|
|
|
3350
3363
|
*/
|
|
3351
3364
|
function t() {
|
|
3352
3365
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
3353
|
-
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new
|
|
3354
|
-
this._internalPath = new
|
|
3366
|
+
for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
|
|
3367
|
+
this._internalPath = new et(t);
|
|
3355
3368
|
}
|
|
3356
3369
|
/**
|
|
3357
3370
|
* Returns true if this `FieldPath` is equal to the provided one.
|
|
@@ -3366,8 +3379,8 @@ var dn = /** @class */ function() {
|
|
|
3366
3379
|
/**
|
|
3367
3380
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3368
3381
|
* It can be used in queries to sort or filter by the document ID.
|
|
3369
|
-
*/ function
|
|
3370
|
-
return new
|
|
3382
|
+
*/ function yn() {
|
|
3383
|
+
return new mn("__name__");
|
|
3371
3384
|
}
|
|
3372
3385
|
|
|
3373
3386
|
/**
|
|
@@ -3388,7 +3401,7 @@ var dn = /** @class */ function() {
|
|
|
3388
3401
|
*/
|
|
3389
3402
|
/**
|
|
3390
3403
|
* An immutable object representing an array of bytes.
|
|
3391
|
-
*/ var
|
|
3404
|
+
*/ var vn = /** @class */ function() {
|
|
3392
3405
|
/** @hideconstructor */
|
|
3393
3406
|
function t(t) {
|
|
3394
3407
|
this._byteString = t;
|
|
@@ -3400,9 +3413,9 @@ var dn = /** @class */ function() {
|
|
|
3400
3413
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3401
3414
|
*/ return t.fromBase64String = function(e) {
|
|
3402
3415
|
try {
|
|
3403
|
-
return new t(
|
|
3416
|
+
return new t(It.fromBase64String(e));
|
|
3404
3417
|
} catch (e) {
|
|
3405
|
-
throw new
|
|
3418
|
+
throw new U(V, "Failed to construct data from Base64 string: " + e);
|
|
3406
3419
|
}
|
|
3407
3420
|
},
|
|
3408
3421
|
/**
|
|
@@ -3411,7 +3424,7 @@ var dn = /** @class */ function() {
|
|
|
3411
3424
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3412
3425
|
*/
|
|
3413
3426
|
t.fromUint8Array = function(e) {
|
|
3414
|
-
return new t(
|
|
3427
|
+
return new t(It.fromUint8Array(e));
|
|
3415
3428
|
},
|
|
3416
3429
|
/**
|
|
3417
3430
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3446,14 +3459,14 @@ var dn = /** @class */ function() {
|
|
|
3446
3459
|
t.prototype.isEqual = function(t) {
|
|
3447
3460
|
return this._byteString.isEqual(t._byteString);
|
|
3448
3461
|
}, t;
|
|
3449
|
-
}(),
|
|
3462
|
+
}(), gn =
|
|
3450
3463
|
/**
|
|
3451
3464
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3452
3465
|
* @hideconstructor
|
|
3453
3466
|
*/
|
|
3454
3467
|
function(t) {
|
|
3455
3468
|
this._methodName = t;
|
|
3456
|
-
},
|
|
3469
|
+
}, wn = /** @class */ function() {
|
|
3457
3470
|
/**
|
|
3458
3471
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3459
3472
|
* longitude values.
|
|
@@ -3461,8 +3474,8 @@ function(t) {
|
|
|
3461
3474
|
* @param longitude - The longitude as number between -180 and 180.
|
|
3462
3475
|
*/
|
|
3463
3476
|
function t(t, e) {
|
|
3464
|
-
if (!isFinite(t) || t < -90 || t > 90) throw new
|
|
3465
|
-
if (!isFinite(e) || e < -180 || e > 180) throw new
|
|
3477
|
+
if (!isFinite(t) || t < -90 || t > 90) throw new U(V, "Latitude must be a number between -90 and 90, but was: " + t);
|
|
3478
|
+
if (!isFinite(e) || e < -180 || e > 180) throw new U(V, "Longitude must be a number between -180 and 180, but was: " + e);
|
|
3466
3479
|
this._lat = t, this._long = e;
|
|
3467
3480
|
}
|
|
3468
3481
|
return Object.defineProperty(t.prototype, "latitude", {
|
|
@@ -3504,23 +3517,23 @@ function(t) {
|
|
|
3504
3517
|
* with an underscore.
|
|
3505
3518
|
*/
|
|
3506
3519
|
t.prototype._compareTo = function(t) {
|
|
3507
|
-
return
|
|
3520
|
+
return gt(this._lat, t._lat) || gt(this._long, t._long);
|
|
3508
3521
|
}, t;
|
|
3509
|
-
}(),
|
|
3522
|
+
}(), bn = /^__.*__$/, _n = /** @class */ function() {
|
|
3510
3523
|
function t(t, e, n) {
|
|
3511
3524
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3512
3525
|
}
|
|
3513
3526
|
return t.prototype.toMutation = function(t, e) {
|
|
3514
|
-
return null !== this.fieldMask ? new
|
|
3527
|
+
return null !== this.fieldMask ? new Ee(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Se(t, this.data, e, this.fieldTransforms);
|
|
3515
3528
|
}, t;
|
|
3516
|
-
}(),
|
|
3529
|
+
}(), Tn = /** @class */ function() {
|
|
3517
3530
|
function t(t,
|
|
3518
3531
|
// The fieldMask does not include document transforms.
|
|
3519
3532
|
e, n) {
|
|
3520
3533
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3521
3534
|
}
|
|
3522
3535
|
return t.prototype.toMutation = function(t, e) {
|
|
3523
|
-
return new
|
|
3536
|
+
return new Ee(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3524
3537
|
}, t;
|
|
3525
3538
|
}();
|
|
3526
3539
|
|
|
@@ -3543,7 +3556,7 @@ function(t) {
|
|
|
3543
3556
|
/**
|
|
3544
3557
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3545
3558
|
* or `update()`.
|
|
3546
|
-
*/ function
|
|
3559
|
+
*/ function Sn(t) {
|
|
3547
3560
|
switch (t) {
|
|
3548
3561
|
case 0 /* Set */ :
|
|
3549
3562
|
// fall through
|
|
@@ -3557,11 +3570,11 @@ function(t) {
|
|
|
3557
3570
|
return !1;
|
|
3558
3571
|
|
|
3559
3572
|
default:
|
|
3560
|
-
throw
|
|
3573
|
+
throw S();
|
|
3561
3574
|
}
|
|
3562
3575
|
}
|
|
3563
3576
|
|
|
3564
|
-
/** A "context" object passed around while parsing user data. */ var
|
|
3577
|
+
/** A "context" object passed around while parsing user data. */ var En = /** @class */ function() {
|
|
3565
3578
|
/**
|
|
3566
3579
|
* Initializes a ParseContext with the given source and path.
|
|
3567
3580
|
*
|
|
@@ -3599,16 +3612,16 @@ function(t) {
|
|
|
3599
3612
|
enumerable: !1,
|
|
3600
3613
|
configurable: !0
|
|
3601
3614
|
}),
|
|
3602
|
-
/** Returns a new context with the specified settings overwritten. */ t.prototype.
|
|
3615
|
+
/** Returns a new context with the specified settings overwritten. */ t.prototype.et = function(e) {
|
|
3603
3616
|
return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3604
|
-
}, t.prototype.
|
|
3605
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
3617
|
+
}, t.prototype.nt = function(t) {
|
|
3618
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
|
|
3606
3619
|
path: n,
|
|
3607
3620
|
rt: !1
|
|
3608
3621
|
});
|
|
3609
3622
|
return r.st(t), r;
|
|
3610
3623
|
}, t.prototype.it = function(t) {
|
|
3611
|
-
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.
|
|
3624
|
+
var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
|
|
3612
3625
|
path: n,
|
|
3613
3626
|
rt: !1
|
|
3614
3627
|
});
|
|
@@ -3616,12 +3629,12 @@ function(t) {
|
|
|
3616
3629
|
}, t.prototype.ot = function(t) {
|
|
3617
3630
|
// TODO(b/34871131): We don't support array paths right now; so make path
|
|
3618
3631
|
// undefined.
|
|
3619
|
-
return this.
|
|
3632
|
+
return this.et({
|
|
3620
3633
|
path: void 0,
|
|
3621
3634
|
rt: !0
|
|
3622
3635
|
});
|
|
3623
3636
|
}, t.prototype.ut = function(t) {
|
|
3624
|
-
return
|
|
3637
|
+
return zn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3625
3638
|
},
|
|
3626
3639
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
3627
3640
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -3635,19 +3648,19 @@ function(t) {
|
|
|
3635
3648
|
if (this.path) for (var t = 0; t < this.path.length; t++) this.st(this.path.get(t));
|
|
3636
3649
|
}, t.prototype.st = function(t) {
|
|
3637
3650
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3638
|
-
if (
|
|
3651
|
+
if (Sn(this.tt) && bn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3639
3652
|
}, t;
|
|
3640
|
-
}(),
|
|
3653
|
+
}(), In = /** @class */ function() {
|
|
3641
3654
|
function t(t, e, n) {
|
|
3642
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
3655
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ke(t)
|
|
3643
3656
|
/** Creates a new top-level parse context. */;
|
|
3644
3657
|
}
|
|
3645
3658
|
return t.prototype.ht = function(t, e, n, r) {
|
|
3646
|
-
return void 0 === r && (r = !1), new
|
|
3659
|
+
return void 0 === r && (r = !1), new En({
|
|
3647
3660
|
tt: t,
|
|
3648
3661
|
methodName: e,
|
|
3649
3662
|
at: n,
|
|
3650
|
-
path:
|
|
3663
|
+
path: et.emptyPath(),
|
|
3651
3664
|
rt: !1,
|
|
3652
3665
|
ct: r
|
|
3653
3666
|
}, this.databaseId, this.q, this.ignoreUndefinedProperties);
|
|
@@ -3657,30 +3670,30 @@ function(t) {
|
|
|
3657
3670
|
/**
|
|
3658
3671
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3659
3672
|
* classes.
|
|
3660
|
-
*/ function
|
|
3661
|
-
var e = t._freezeSettings(), n =
|
|
3662
|
-
return new
|
|
3673
|
+
*/ function An(t) {
|
|
3674
|
+
var e = t._freezeSettings(), n = Ke(t._databaseId);
|
|
3675
|
+
return new In(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
3663
3676
|
}
|
|
3664
3677
|
|
|
3665
|
-
/** Parse document data from a set() call. */ function
|
|
3678
|
+
/** Parse document data from a set() call. */ function kn(t, e, n, r, i, o) {
|
|
3666
3679
|
void 0 === o && (o = {});
|
|
3667
3680
|
var a = t.ht(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
3668
|
-
|
|
3669
|
-
var s, u, c =
|
|
3670
|
-
if (o.merge) s = new
|
|
3681
|
+
Un("Data must be an object, but it was:", a, r);
|
|
3682
|
+
var s, u, c = Rn(r, a);
|
|
3683
|
+
if (o.merge) s = new Et(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
3671
3684
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
3672
|
-
var p =
|
|
3673
|
-
if (!a.contains(p)) throw new
|
|
3674
|
-
|
|
3685
|
+
var p = xn(e, h[f], n);
|
|
3686
|
+
if (!a.contains(p)) throw new U(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
|
|
3687
|
+
Qn(l, p) || l.push(p);
|
|
3675
3688
|
}
|
|
3676
|
-
s = new
|
|
3689
|
+
s = new Et(l), u = a.fieldTransforms.filter((function(t) {
|
|
3677
3690
|
return s.covers(t.field);
|
|
3678
3691
|
}));
|
|
3679
3692
|
} else s = null, u = a.fieldTransforms;
|
|
3680
|
-
return new
|
|
3693
|
+
return new _n(new zt(c), s, u);
|
|
3681
3694
|
}
|
|
3682
3695
|
|
|
3683
|
-
var
|
|
3696
|
+
var Vn = /** @class */ function(e) {
|
|
3684
3697
|
function n() {
|
|
3685
3698
|
return null !== e && e.apply(this, arguments) || this;
|
|
3686
3699
|
}
|
|
@@ -3692,7 +3705,7 @@ var kn = /** @class */ function(e) {
|
|
|
3692
3705
|
}, n.prototype.isEqual = function(t) {
|
|
3693
3706
|
return t instanceof n;
|
|
3694
3707
|
}, n;
|
|
3695
|
-
}(
|
|
3708
|
+
}(gn);
|
|
3696
3709
|
|
|
3697
3710
|
/**
|
|
3698
3711
|
* Creates a child context for parsing SerializableFieldValues.
|
|
@@ -3709,8 +3722,8 @@ var kn = /** @class */ function(e) {
|
|
|
3709
3722
|
* context.
|
|
3710
3723
|
* @param context - The parent context.
|
|
3711
3724
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
3712
|
-
*/ function
|
|
3713
|
-
return new
|
|
3725
|
+
*/ function Dn(t, e, n) {
|
|
3726
|
+
return new En({
|
|
3714
3727
|
tt: 3 /* Argument */ ,
|
|
3715
3728
|
at: e.settings.at,
|
|
3716
3729
|
methodName: t._methodName,
|
|
@@ -3718,101 +3731,101 @@ var kn = /** @class */ function(e) {
|
|
|
3718
3731
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
3719
3732
|
}
|
|
3720
3733
|
|
|
3721
|
-
var
|
|
3734
|
+
var Pn = /** @class */ function(e) {
|
|
3722
3735
|
function n() {
|
|
3723
3736
|
return null !== e && e.apply(this, arguments) || this;
|
|
3724
3737
|
}
|
|
3725
3738
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3726
|
-
return new
|
|
3739
|
+
return new be(t.path, new ye);
|
|
3727
3740
|
}, n.prototype.isEqual = function(t) {
|
|
3728
3741
|
return t instanceof n;
|
|
3729
3742
|
}, n;
|
|
3730
|
-
}(
|
|
3743
|
+
}(gn), Fn = /** @class */ function(e) {
|
|
3731
3744
|
function n(t, n) {
|
|
3732
3745
|
var r = this;
|
|
3733
3746
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3734
3747
|
}
|
|
3735
3748
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3736
|
-
var e =
|
|
3749
|
+
var e = Dn(this, t,
|
|
3737
3750
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3738
|
-
return
|
|
3739
|
-
})), r = new
|
|
3740
|
-
return new
|
|
3751
|
+
return Ln(t, e);
|
|
3752
|
+
})), r = new ve(n);
|
|
3753
|
+
return new be(t.path, r);
|
|
3741
3754
|
}, n.prototype.isEqual = function(t) {
|
|
3742
3755
|
// TODO(mrschmidt): Implement isEquals
|
|
3743
3756
|
return this === t;
|
|
3744
3757
|
}, n;
|
|
3745
|
-
}(
|
|
3758
|
+
}(gn), Nn = /** @class */ function(e) {
|
|
3746
3759
|
function n(t, n) {
|
|
3747
3760
|
var r = this;
|
|
3748
3761
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3749
3762
|
}
|
|
3750
3763
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3751
|
-
var e =
|
|
3764
|
+
var e = Dn(this, t,
|
|
3752
3765
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3753
|
-
return
|
|
3754
|
-
})), r = new
|
|
3755
|
-
return new
|
|
3766
|
+
return Ln(t, e);
|
|
3767
|
+
})), r = new ge(n);
|
|
3768
|
+
return new be(t.path, r);
|
|
3756
3769
|
}, n.prototype.isEqual = function(t) {
|
|
3757
3770
|
// TODO(mrschmidt): Implement isEquals
|
|
3758
3771
|
return this === t;
|
|
3759
3772
|
}, n;
|
|
3760
|
-
}(
|
|
3773
|
+
}(gn), qn = /** @class */ function(e) {
|
|
3761
3774
|
function n(t, n) {
|
|
3762
3775
|
var r = this;
|
|
3763
3776
|
return (r = e.call(this, t) || this).ft = n, r;
|
|
3764
3777
|
}
|
|
3765
3778
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3766
|
-
var e = new
|
|
3767
|
-
return new
|
|
3779
|
+
var e = new we(t.q, de(t.q, this.ft));
|
|
3780
|
+
return new be(t.path, e);
|
|
3768
3781
|
}, n.prototype.isEqual = function(t) {
|
|
3769
3782
|
// TODO(mrschmidt): Implement isEquals
|
|
3770
3783
|
return this === t;
|
|
3771
3784
|
}, n;
|
|
3772
|
-
}(
|
|
3785
|
+
}(gn);
|
|
3773
3786
|
|
|
3774
|
-
/** Parse update data from an update() call. */ function
|
|
3787
|
+
/** Parse update data from an update() call. */ function On(t, e, n, r) {
|
|
3775
3788
|
var i = t.ht(1 /* Update */ , e, n);
|
|
3776
|
-
|
|
3777
|
-
var o = [], a =
|
|
3778
|
-
|
|
3779
|
-
var s =
|
|
3789
|
+
Un("Data must be an object, but it was:", i, r);
|
|
3790
|
+
var o = [], a = zt.empty();
|
|
3791
|
+
St(r, (function(t, r) {
|
|
3792
|
+
var s = Gn(e, t, n);
|
|
3780
3793
|
// For Compat types, we have to "extract" the underlying types before
|
|
3781
3794
|
// performing validation.
|
|
3782
|
-
r =
|
|
3795
|
+
r = p(r);
|
|
3783
3796
|
var u = i.it(s);
|
|
3784
|
-
if (r instanceof
|
|
3797
|
+
if (r instanceof Vn)
|
|
3785
3798
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3786
3799
|
o.push(s); else {
|
|
3787
|
-
var c =
|
|
3800
|
+
var c = Ln(r, u);
|
|
3788
3801
|
null != c && (o.push(s), a.set(s, c));
|
|
3789
3802
|
}
|
|
3790
3803
|
}));
|
|
3791
|
-
var s = new
|
|
3792
|
-
return new
|
|
3804
|
+
var s = new Et(o);
|
|
3805
|
+
return new Tn(a, s, i.fieldTransforms);
|
|
3793
3806
|
}
|
|
3794
3807
|
|
|
3795
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
3796
|
-
var a = t.ht(1 /* Update */ , e, n), s = [
|
|
3797
|
-
if (o.length % 2 != 0) throw new
|
|
3798
|
-
for (var c = 0; c < o.length; c += 2) s.push(
|
|
3808
|
+
/** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, i, o) {
|
|
3809
|
+
var a = t.ht(1 /* Update */ , e, n), s = [ xn(e, r, n) ], u = [ i ];
|
|
3810
|
+
if (o.length % 2 != 0) throw new U(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
3811
|
+
for (var c = 0; c < o.length; c += 2) s.push(xn(e, o[c])), u.push(o[c + 1]);
|
|
3799
3812
|
// We iterate in reverse order to pick the last value for a field if the
|
|
3800
3813
|
// user specified the field multiple times.
|
|
3801
|
-
for (var l = [], f =
|
|
3802
|
-
var d = s[
|
|
3814
|
+
for (var l = [], f = zt.empty(), h = s.length - 1; h >= 0; --h) if (!Qn(l, s[h])) {
|
|
3815
|
+
var d = s[h], m = u[h];
|
|
3803
3816
|
// For Compat types, we have to "extract" the underlying types before
|
|
3804
3817
|
// performing validation.
|
|
3805
|
-
m =
|
|
3818
|
+
m = p(m);
|
|
3806
3819
|
var y = a.it(d);
|
|
3807
|
-
if (m instanceof
|
|
3820
|
+
if (m instanceof Vn)
|
|
3808
3821
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3809
3822
|
l.push(d); else {
|
|
3810
|
-
var v =
|
|
3823
|
+
var v = Ln(m, y);
|
|
3811
3824
|
null != v && (l.push(d), f.set(d, v));
|
|
3812
3825
|
}
|
|
3813
3826
|
}
|
|
3814
|
-
var g = new
|
|
3815
|
-
return new
|
|
3827
|
+
var g = new Et(l);
|
|
3828
|
+
return new Tn(f, g, a.fieldTransforms);
|
|
3816
3829
|
}
|
|
3817
3830
|
|
|
3818
3831
|
/**
|
|
@@ -3821,8 +3834,8 @@ var Dn = /** @class */ function(e) {
|
|
|
3821
3834
|
*
|
|
3822
3835
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
3823
3836
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
3824
|
-
*/ function
|
|
3825
|
-
return void 0 === r && (r = !1),
|
|
3837
|
+
*/ function jn(t, e, n, r) {
|
|
3838
|
+
return void 0 === r && (r = !1), Ln(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
3826
3839
|
}
|
|
3827
3840
|
|
|
3828
3841
|
/**
|
|
@@ -3833,12 +3846,12 @@ var Dn = /** @class */ function(e) {
|
|
|
3833
3846
|
* the source of the data being parsed, etc.
|
|
3834
3847
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
3835
3848
|
* that should not be included in the resulting parsed data.
|
|
3836
|
-
*/ function
|
|
3837
|
-
if (
|
|
3849
|
+
*/ function Ln(t, e) {
|
|
3850
|
+
if (Mn(
|
|
3838
3851
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
3839
3852
|
// from firestore-exp.
|
|
3840
|
-
t =
|
|
3841
|
-
if (t instanceof
|
|
3853
|
+
t = p(t))) return Un("Unsupported field value:", e, t), Rn(t, e);
|
|
3854
|
+
if (t instanceof gn)
|
|
3842
3855
|
// FieldValues usually parse into transforms (except FieldValue.delete())
|
|
3843
3856
|
// in which case we do not want to include this field in our parsed data
|
|
3844
3857
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -3850,7 +3863,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3850
3863
|
*/
|
|
3851
3864
|
return function(t, e) {
|
|
3852
3865
|
// Sentinels are only supported with writes, and not within arrays.
|
|
3853
|
-
if (!
|
|
3866
|
+
if (!Sn(e.tt)) throw e.ut(t._methodName + "() can only be used with update() and set()");
|
|
3854
3867
|
if (!e.path) throw e.ut(t._methodName + "() is not currently supported inside arrays");
|
|
3855
3868
|
var n = t._toFieldTransform(e);
|
|
3856
3869
|
n && e.fieldTransforms.push(n);
|
|
@@ -3873,7 +3886,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3873
3886
|
if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
|
|
3874
3887
|
return function(t, e) {
|
|
3875
3888
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
3876
|
-
var a =
|
|
3889
|
+
var a = Ln(o[i], e.ot(r));
|
|
3877
3890
|
null == a && (
|
|
3878
3891
|
// Just include nulls in the array for fields being replaced with a
|
|
3879
3892
|
// sentinel.
|
|
@@ -3889,10 +3902,10 @@ var Dn = /** @class */ function(e) {
|
|
|
3889
3902
|
}(t, e);
|
|
3890
3903
|
}
|
|
3891
3904
|
return function(t, e) {
|
|
3892
|
-
if (null === (t =
|
|
3905
|
+
if (null === (t = p(t))) return {
|
|
3893
3906
|
nullValue: "NULL_VALUE"
|
|
3894
3907
|
};
|
|
3895
|
-
if ("number" == typeof t) return
|
|
3908
|
+
if ("number" == typeof t) return de(e.q, t);
|
|
3896
3909
|
if ("boolean" == typeof t) return {
|
|
3897
3910
|
booleanValue: t
|
|
3898
3911
|
};
|
|
@@ -3900,41 +3913,41 @@ var Dn = /** @class */ function(e) {
|
|
|
3900
3913
|
stringValue: t
|
|
3901
3914
|
};
|
|
3902
3915
|
if (t instanceof Date) {
|
|
3903
|
-
var n =
|
|
3916
|
+
var n = bt.fromDate(t);
|
|
3904
3917
|
return {
|
|
3905
|
-
timestampValue:
|
|
3918
|
+
timestampValue: Pe(e.q, n)
|
|
3906
3919
|
};
|
|
3907
3920
|
}
|
|
3908
|
-
if (t instanceof
|
|
3921
|
+
if (t instanceof bt) {
|
|
3909
3922
|
// Firestore backend truncates precision down to microseconds. To ensure
|
|
3910
3923
|
// offline mode works the same with regards to truncation, perform the
|
|
3911
3924
|
// truncation immediately without waiting for the backend to do that.
|
|
3912
|
-
var r = new
|
|
3925
|
+
var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
3913
3926
|
return {
|
|
3914
|
-
timestampValue:
|
|
3927
|
+
timestampValue: Pe(e.q, r)
|
|
3915
3928
|
};
|
|
3916
3929
|
}
|
|
3917
|
-
if (t instanceof
|
|
3930
|
+
if (t instanceof wn) return {
|
|
3918
3931
|
geoPointValue: {
|
|
3919
3932
|
latitude: t.latitude,
|
|
3920
3933
|
longitude: t.longitude
|
|
3921
3934
|
}
|
|
3922
3935
|
};
|
|
3923
|
-
if (t instanceof
|
|
3924
|
-
bytesValue:
|
|
3936
|
+
if (t instanceof vn) return {
|
|
3937
|
+
bytesValue: Fe(e.q, t._byteString)
|
|
3925
3938
|
};
|
|
3926
|
-
if (t instanceof
|
|
3939
|
+
if (t instanceof sn) {
|
|
3927
3940
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
3928
3941
|
if (!o.isEqual(i)) throw e.ut("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
|
|
3929
3942
|
return {
|
|
3930
|
-
referenceValue:
|
|
3943
|
+
referenceValue: Oe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
3931
3944
|
};
|
|
3932
3945
|
}
|
|
3933
|
-
throw e.ut("Unsupported field value: " +
|
|
3946
|
+
throw e.ut("Unsupported field value: " + at(t));
|
|
3934
3947
|
}(t, e);
|
|
3935
3948
|
}
|
|
3936
3949
|
|
|
3937
|
-
function
|
|
3950
|
+
function Rn(t, e) {
|
|
3938
3951
|
var n = {};
|
|
3939
3952
|
return function(t) {
|
|
3940
3953
|
for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
@@ -3942,8 +3955,8 @@ function Ln(t, e) {
|
|
|
3942
3955
|
}(t) ?
|
|
3943
3956
|
// If we encounter an empty object, we explicitly add it to the update
|
|
3944
3957
|
// mask to ensure that the server creates a map entry.
|
|
3945
|
-
e.path && e.path.length > 0 && e.fieldMask.push(e.path) :
|
|
3946
|
-
var i =
|
|
3958
|
+
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : St(t, (function(t, r) {
|
|
3959
|
+
var i = Ln(r, e.nt(t));
|
|
3947
3960
|
null != i && (n[t] = i);
|
|
3948
3961
|
})), {
|
|
3949
3962
|
mapValue: {
|
|
@@ -3952,35 +3965,35 @@ function Ln(t, e) {
|
|
|
3952
3965
|
};
|
|
3953
3966
|
}
|
|
3954
3967
|
|
|
3955
|
-
function
|
|
3956
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof
|
|
3968
|
+
function Mn(t) {
|
|
3969
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof wn || t instanceof vn || t instanceof sn || t instanceof gn);
|
|
3957
3970
|
}
|
|
3958
3971
|
|
|
3959
|
-
function
|
|
3960
|
-
if (!
|
|
3972
|
+
function Un(t, e, n) {
|
|
3973
|
+
if (!Mn(n) || !function(t) {
|
|
3961
3974
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
3962
3975
|
}(n)) {
|
|
3963
|
-
var r =
|
|
3976
|
+
var r = at(n);
|
|
3964
3977
|
throw "an object" === r ? e.ut(t + " a custom object") : e.ut(t + " " + r);
|
|
3965
3978
|
}
|
|
3966
3979
|
}
|
|
3967
3980
|
|
|
3968
3981
|
/**
|
|
3969
3982
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
3970
|
-
*/ function
|
|
3983
|
+
*/ function xn(t, e, n) {
|
|
3971
3984
|
if (
|
|
3972
3985
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
3973
3986
|
// FieldPath.
|
|
3974
|
-
(e =
|
|
3975
|
-
if ("string" == typeof e) return
|
|
3976
|
-
throw
|
|
3987
|
+
(e = p(e)) instanceof mn) return e._internalPath;
|
|
3988
|
+
if ("string" == typeof e) return Gn(t, e);
|
|
3989
|
+
throw zn("Field path arguments must be of type string or FieldPath.", t,
|
|
3977
3990
|
/* hasConverter= */ !1,
|
|
3978
3991
|
/* path= */ void 0, n);
|
|
3979
3992
|
}
|
|
3980
3993
|
|
|
3981
3994
|
/**
|
|
3982
3995
|
* Matches any characters in a field path string that are reserved.
|
|
3983
|
-
*/ var
|
|
3996
|
+
*/ var Bn = new RegExp("[~\\*/\\[\\]]");
|
|
3984
3997
|
|
|
3985
3998
|
/**
|
|
3986
3999
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -3990,29 +4003,29 @@ function Mn(t, e, n) {
|
|
|
3990
4003
|
* split on dots.
|
|
3991
4004
|
* @param targetDoc - The document against which the field path will be
|
|
3992
4005
|
* evaluated.
|
|
3993
|
-
*/ function
|
|
3994
|
-
if (e.search(
|
|
4006
|
+
*/ function Gn(t, e, n) {
|
|
4007
|
+
if (e.search(Bn) >= 0) throw zn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
3995
4008
|
/* hasConverter= */ !1,
|
|
3996
4009
|
/* path= */ void 0, n);
|
|
3997
4010
|
try {
|
|
3998
|
-
return (new (
|
|
4011
|
+
return (new (mn.bind.apply(mn, r([ void 0 ], e.split(".")))))._internalPath;
|
|
3999
4012
|
} catch (r) {
|
|
4000
|
-
throw
|
|
4013
|
+
throw zn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
|
|
4001
4014
|
/* hasConverter= */ !1,
|
|
4002
4015
|
/* path= */ void 0, n);
|
|
4003
4016
|
}
|
|
4004
4017
|
}
|
|
4005
4018
|
|
|
4006
|
-
function
|
|
4019
|
+
function zn(t, e, n, r, i) {
|
|
4007
4020
|
var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
|
|
4008
4021
|
n && (s += " (via `toFirestore()`)");
|
|
4009
4022
|
var u = "";
|
|
4010
4023
|
return (o || a) && (u += " (found", o && (u += " in field " + r), a && (u += " in document " + i),
|
|
4011
|
-
u += ")"), new
|
|
4024
|
+
u += ")"), new U(V, (s += ". ") + t + u)
|
|
4012
4025
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
|
|
4013
4026
|
}
|
|
4014
4027
|
|
|
4015
|
-
function
|
|
4028
|
+
function Qn(t, e) {
|
|
4016
4029
|
return t.some((function(t) {
|
|
4017
4030
|
return t.isEqual(e);
|
|
4018
4031
|
}));
|
|
@@ -4042,7 +4055,7 @@ function zn(t, e) {
|
|
|
4042
4055
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4043
4056
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4044
4057
|
* explicitly verify a document's existence.
|
|
4045
|
-
*/ var
|
|
4058
|
+
*/ var Kn = /** @class */ function() {
|
|
4046
4059
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4047
4060
|
// the legacy SDK. The changes are:
|
|
4048
4061
|
// - No support for SnapshotMetadata.
|
|
@@ -4063,7 +4076,7 @@ function zn(t, e) {
|
|
|
4063
4076
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4064
4077
|
*/
|
|
4065
4078
|
get: function() {
|
|
4066
|
-
return new
|
|
4079
|
+
return new sn(this._firestore, this._converter, this._key);
|
|
4067
4080
|
},
|
|
4068
4081
|
enumerable: !1,
|
|
4069
4082
|
configurable: !0
|
|
@@ -4088,7 +4101,7 @@ function zn(t, e) {
|
|
|
4088
4101
|
if (this._converter) {
|
|
4089
4102
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4090
4103
|
// if a converter has been provided.
|
|
4091
|
-
var t = new
|
|
4104
|
+
var t = new Hn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4092
4105
|
/* converter= */ null);
|
|
4093
4106
|
return this._converter.fromFirestore(t);
|
|
4094
4107
|
}
|
|
@@ -4108,11 +4121,11 @@ function zn(t, e) {
|
|
|
4108
4121
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4109
4122
|
t.prototype.get = function(t) {
|
|
4110
4123
|
if (this._document) {
|
|
4111
|
-
var e = this._document.data.field(
|
|
4124
|
+
var e = this._document.data.field($n("DocumentSnapshot.get", t));
|
|
4112
4125
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4113
4126
|
}
|
|
4114
4127
|
}, t;
|
|
4115
|
-
}(),
|
|
4128
|
+
}(), Hn = /** @class */ function(e) {
|
|
4116
4129
|
function n() {
|
|
4117
4130
|
return null !== e && e.apply(this, arguments) || this;
|
|
4118
4131
|
}
|
|
@@ -4124,7 +4137,7 @@ function zn(t, e) {
|
|
|
4124
4137
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4125
4138
|
return e.prototype.data.call(this);
|
|
4126
4139
|
}, n;
|
|
4127
|
-
}(
|
|
4140
|
+
}(Kn), Wn = /** @class */ function() {
|
|
4128
4141
|
/** @hideconstructor */
|
|
4129
4142
|
function t(t, e) {
|
|
4130
4143
|
this._docs = e, this.query = t;
|
|
@@ -4178,15 +4191,15 @@ function zn(t, e) {
|
|
|
4178
4191
|
* @param right - A snapshot to compare.
|
|
4179
4192
|
* @returns true if the snapshots are equal.
|
|
4180
4193
|
*/
|
|
4181
|
-
function
|
|
4182
|
-
return t =
|
|
4194
|
+
function Yn(t, e) {
|
|
4195
|
+
return t = p(t), e = p(e), t instanceof Kn && e instanceof Kn ? 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 Wn && e instanceof Wn && dn(t.query, e.query) && wt(t.docs, e.docs, Yn)
|
|
4183
4196
|
/**
|
|
4184
4197
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4185
4198
|
*/;
|
|
4186
4199
|
}
|
|
4187
4200
|
|
|
4188
|
-
function
|
|
4189
|
-
return "string" == typeof e ?
|
|
4201
|
+
function $n(t, e) {
|
|
4202
|
+
return "string" == typeof e ? Gn(t, e) : e instanceof mn ? e._internalPath : e._delegate._internalPath;
|
|
4190
4203
|
}
|
|
4191
4204
|
|
|
4192
4205
|
/**
|
|
@@ -4212,7 +4225,7 @@ function Yn(t, e) {
|
|
|
4212
4225
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
4213
4226
|
* can then be passed to {@link query} to create a new query instance that
|
|
4214
4227
|
* also contains this `QueryConstraint`.
|
|
4215
|
-
*/ var
|
|
4228
|
+
*/ var Xn = function() {};
|
|
4216
4229
|
|
|
4217
4230
|
/**
|
|
4218
4231
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4222,7 +4235,7 @@ function Yn(t, e) {
|
|
|
4222
4235
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4223
4236
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4224
4237
|
* existing or new constraints.
|
|
4225
|
-
*/ function
|
|
4238
|
+
*/ function Jn(t) {
|
|
4226
4239
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
4227
4240
|
for (var r = 0, i = e; r < i.length; r++) {
|
|
4228
4241
|
var o = i[r];
|
|
@@ -4231,39 +4244,39 @@ function Yn(t, e) {
|
|
|
4231
4244
|
return t;
|
|
4232
4245
|
}
|
|
4233
4246
|
|
|
4234
|
-
var
|
|
4247
|
+
var Zn = /** @class */ function(e) {
|
|
4235
4248
|
function n(t, n, r) {
|
|
4236
4249
|
var i = this;
|
|
4237
4250
|
return (i = e.call(this) || this).dt = t, i.wt = n, i.yt = r, i.type = "where",
|
|
4238
4251
|
i;
|
|
4239
4252
|
}
|
|
4240
4253
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4241
|
-
var e =
|
|
4254
|
+
var e = An(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4242
4255
|
var s;
|
|
4243
4256
|
if (i.isKeyField()) {
|
|
4244
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new
|
|
4257
|
+
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new U(V, "Invalid Query. You can't perform '" + o + "' queries on FieldPath.documentId().");
|
|
4245
4258
|
if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
|
|
4246
|
-
|
|
4259
|
+
dr(a, o);
|
|
4247
4260
|
for (var u = [], c = 0, l = a; c < l.length; c++) {
|
|
4248
4261
|
var f = l[c];
|
|
4249
|
-
u.push(
|
|
4262
|
+
u.push(pr(r, t, f));
|
|
4250
4263
|
}
|
|
4251
4264
|
s = {
|
|
4252
4265
|
arrayValue: {
|
|
4253
4266
|
values: u
|
|
4254
4267
|
}
|
|
4255
4268
|
};
|
|
4256
|
-
} else s =
|
|
4257
|
-
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o ||
|
|
4258
|
-
s =
|
|
4269
|
+
} else s = pr(r, t, a);
|
|
4270
|
+
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || dr(a, o),
|
|
4271
|
+
s = jn(n, "where", a,
|
|
4259
4272
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4260
|
-
var h =
|
|
4273
|
+
var h = Wt.create(i, o, s);
|
|
4261
4274
|
return function(t, e) {
|
|
4262
4275
|
if (e.N()) {
|
|
4263
|
-
var n =
|
|
4264
|
-
if (null !== n && !n.isEqual(e.field)) throw new
|
|
4265
|
-
var r =
|
|
4266
|
-
null !== r &&
|
|
4276
|
+
var n = le(t);
|
|
4277
|
+
if (null !== n && !n.isEqual(e.field)) throw new U(V, "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() + "'");
|
|
4278
|
+
var r = ce(t);
|
|
4279
|
+
null !== r && mr(t, e.field, r);
|
|
4267
4280
|
}
|
|
4268
4281
|
var i = function(t, e) {
|
|
4269
4282
|
for (var n = 0, r = t.filters; n < r.length; n++) {
|
|
@@ -4307,15 +4320,15 @@ var Jn = /** @class */ function(e) {
|
|
|
4307
4320
|
}(e.op));
|
|
4308
4321
|
if (null !== i)
|
|
4309
4322
|
// Special case when it's a duplicate op to give a slightly clearer error message.
|
|
4310
|
-
throw i === e.op ? new
|
|
4323
|
+
throw i === e.op ? new U(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new U(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
4311
4324
|
}(t, h), h;
|
|
4312
4325
|
}(t._query, 0, e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4313
|
-
return new
|
|
4326
|
+
return new un(t.firestore, t.converter, function(t, e) {
|
|
4314
4327
|
var n = t.filters.concat([ e ]);
|
|
4315
|
-
return new
|
|
4328
|
+
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4316
4329
|
}(t._query, n));
|
|
4317
4330
|
}, n;
|
|
4318
|
-
}(
|
|
4331
|
+
}(Xn);
|
|
4319
4332
|
|
|
4320
4333
|
/**
|
|
4321
4334
|
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
@@ -4327,36 +4340,36 @@ var Jn = /** @class */ function(e) {
|
|
|
4327
4340
|
* "<=", "!=").
|
|
4328
4341
|
* @param value - The value for comparison
|
|
4329
4342
|
* @returns The created {@link Query}.
|
|
4330
|
-
*/ function
|
|
4331
|
-
var r = e, i =
|
|
4332
|
-
return new
|
|
4343
|
+
*/ function tr(t, e, n) {
|
|
4344
|
+
var r = e, i = $n("where", t);
|
|
4345
|
+
return new Zn(i, r, n);
|
|
4333
4346
|
}
|
|
4334
4347
|
|
|
4335
|
-
var
|
|
4348
|
+
var er = /** @class */ function(e) {
|
|
4336
4349
|
function n(t, n) {
|
|
4337
4350
|
var r = this;
|
|
4338
4351
|
return (r = e.call(this) || this).dt = t, r._t = n, r.type = "orderBy", r;
|
|
4339
4352
|
}
|
|
4340
4353
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4341
4354
|
var e = function(t, e, n) {
|
|
4342
|
-
if (null !== t.startAt) throw new
|
|
4343
|
-
if (null !== t.endAt) throw new
|
|
4344
|
-
var r = new
|
|
4355
|
+
if (null !== t.startAt) throw new U(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
|
|
4356
|
+
if (null !== t.endAt) throw new U(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4357
|
+
var r = new ie(e, n);
|
|
4345
4358
|
return function(t, e) {
|
|
4346
|
-
if (null ===
|
|
4359
|
+
if (null === ce(t)) {
|
|
4347
4360
|
// This is the first order by. It must match any inequality.
|
|
4348
|
-
var n =
|
|
4349
|
-
null !== n &&
|
|
4361
|
+
var n = le(t);
|
|
4362
|
+
null !== n && mr(t, n, e.field);
|
|
4350
4363
|
}
|
|
4351
4364
|
}(t, r), r;
|
|
4352
4365
|
}(t._query, this.dt, this._t);
|
|
4353
|
-
return new
|
|
4366
|
+
return new un(t.firestore, t.converter, function(t, e) {
|
|
4354
4367
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4355
4368
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
4356
|
-
return new
|
|
4369
|
+
return new se(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4357
4370
|
}(t._query, e));
|
|
4358
4371
|
}, n;
|
|
4359
|
-
}(
|
|
4372
|
+
}(Xn);
|
|
4360
4373
|
|
|
4361
4374
|
/**
|
|
4362
4375
|
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
@@ -4366,31 +4379,31 @@ var tr = /** @class */ function(e) {
|
|
|
4366
4379
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4367
4380
|
* not specified, order will be ascending.
|
|
4368
4381
|
* @returns The created {@link Query}.
|
|
4369
|
-
*/ function
|
|
4382
|
+
*/ function nr(t, e) {
|
|
4370
4383
|
void 0 === e && (e = "asc");
|
|
4371
|
-
var n = e, r =
|
|
4372
|
-
return new
|
|
4384
|
+
var n = e, r = $n("orderBy", t);
|
|
4385
|
+
return new er(r, n);
|
|
4373
4386
|
}
|
|
4374
4387
|
|
|
4375
|
-
var
|
|
4388
|
+
var rr = /** @class */ function(e) {
|
|
4376
4389
|
function n(t, n, r) {
|
|
4377
4390
|
var i = this;
|
|
4378
|
-
return (i = e.call(this) || this).type = t, i.gt = n, i.
|
|
4391
|
+
return (i = e.call(this) || this).type = t, i.gt = n, i.vt = r, i;
|
|
4379
4392
|
}
|
|
4380
4393
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4381
|
-
return new
|
|
4382
|
-
return new
|
|
4383
|
-
}(t._query, this.gt, this.
|
|
4394
|
+
return new un(t.firestore, t.converter, function(t, e, n) {
|
|
4395
|
+
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4396
|
+
}(t._query, this.gt, this.vt));
|
|
4384
4397
|
}, n;
|
|
4385
|
-
}(
|
|
4398
|
+
}(Xn);
|
|
4386
4399
|
|
|
4387
4400
|
/**
|
|
4388
4401
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
4389
4402
|
*
|
|
4390
4403
|
* @param limit - The maximum number of items to return.
|
|
4391
4404
|
* @returns The created {@link Query}.
|
|
4392
|
-
*/ function
|
|
4393
|
-
return
|
|
4405
|
+
*/ function ir(t) {
|
|
4406
|
+
return ut("limit", t), new rr("limit", t, "F" /* First */)
|
|
4394
4407
|
/**
|
|
4395
4408
|
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
4396
4409
|
*
|
|
@@ -4402,60 +4415,60 @@ var nr = /** @class */ function(e) {
|
|
|
4402
4415
|
*/;
|
|
4403
4416
|
}
|
|
4404
4417
|
|
|
4405
|
-
function
|
|
4406
|
-
return
|
|
4418
|
+
function or(t) {
|
|
4419
|
+
return ut("limitToLast", t), new rr("limitToLast", t, "L" /* Last */);
|
|
4407
4420
|
}
|
|
4408
4421
|
|
|
4409
|
-
var
|
|
4422
|
+
var ar = /** @class */ function(e) {
|
|
4410
4423
|
function n(t, n, r) {
|
|
4411
4424
|
var i = this;
|
|
4412
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4425
|
+
return (i = e.call(this) || this).type = t, i.bt = n, i.Et = r, i;
|
|
4413
4426
|
}
|
|
4414
4427
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4415
|
-
var e =
|
|
4416
|
-
return new
|
|
4417
|
-
return new
|
|
4428
|
+
var e = hr(t, this.type, this.bt, this.Et);
|
|
4429
|
+
return new un(t.firestore, t.converter, function(t, e) {
|
|
4430
|
+
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4418
4431
|
}(t._query, e));
|
|
4419
4432
|
}, n;
|
|
4420
|
-
}(
|
|
4433
|
+
}(Xn);
|
|
4421
4434
|
|
|
4422
|
-
function
|
|
4435
|
+
function sr() {
|
|
4423
4436
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4424
|
-
return new
|
|
4437
|
+
return new ar("startAt", t, /*before=*/ !0);
|
|
4425
4438
|
}
|
|
4426
4439
|
|
|
4427
|
-
function
|
|
4440
|
+
function ur() {
|
|
4428
4441
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4429
|
-
return new
|
|
4442
|
+
return new ar("startAfter", t,
|
|
4430
4443
|
/*before=*/ !1);
|
|
4431
4444
|
}
|
|
4432
4445
|
|
|
4433
|
-
var
|
|
4446
|
+
var cr = /** @class */ function(e) {
|
|
4434
4447
|
function n(t, n, r) {
|
|
4435
4448
|
var i = this;
|
|
4436
|
-
return (i = e.call(this) || this).type = t, i.
|
|
4449
|
+
return (i = e.call(this) || this).type = t, i.bt = n, i.Et = r, i;
|
|
4437
4450
|
}
|
|
4438
4451
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4439
|
-
var e =
|
|
4440
|
-
return new
|
|
4441
|
-
return new
|
|
4452
|
+
var e = hr(t, this.type, this.bt, this.Et);
|
|
4453
|
+
return new un(t.firestore, t.converter, function(t, e) {
|
|
4454
|
+
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4442
4455
|
}(t._query, e));
|
|
4443
4456
|
}, n;
|
|
4444
|
-
}(
|
|
4457
|
+
}(Xn);
|
|
4445
4458
|
|
|
4446
|
-
function
|
|
4459
|
+
function lr() {
|
|
4447
4460
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4448
|
-
return new
|
|
4461
|
+
return new cr("endBefore", t, /*before=*/ !0);
|
|
4449
4462
|
}
|
|
4450
4463
|
|
|
4451
|
-
function
|
|
4464
|
+
function fr() {
|
|
4452
4465
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4453
|
-
return new
|
|
4466
|
+
return new cr("endAt", t, /*before=*/ !1);
|
|
4454
4467
|
}
|
|
4455
4468
|
|
|
4456
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4457
|
-
if (n[0] =
|
|
4458
|
-
if (!r) throw new
|
|
4469
|
+
/** Helper function to create a bound from a document or fields */ function hr(t, e, n, r) {
|
|
4470
|
+
if (n[0] = p(n[0]), n[0] instanceof Kn) return function(t, e, n, r, i) {
|
|
4471
|
+
if (!r) throw new U(P, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4459
4472
|
// Because people expect to continue/end a query at the exact document
|
|
4460
4473
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
4461
4474
|
// sort order, because it's guaranteed to contain the document key. That way
|
|
@@ -4463,65 +4476,65 @@ function lr() {
|
|
|
4463
4476
|
// the provided document. Without the key (by using the explicit sort
|
|
4464
4477
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4465
4478
|
// results.
|
|
4466
|
-
for (var o = [], a = 0, s =
|
|
4479
|
+
for (var o = [], a = 0, s = he(t); a < s.length; a++) {
|
|
4467
4480
|
var u = s[a];
|
|
4468
|
-
if (u.field.isKeyField()) o.push(
|
|
4481
|
+
if (u.field.isKeyField()) o.push(Rt(e, r.key)); else {
|
|
4469
4482
|
var c = r.data.field(u.field);
|
|
4470
|
-
if (
|
|
4483
|
+
if (Pt(c)) throw new U(V, 'Invalid query. You are trying to start or end a query using a document for which the field "' + u.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
|
|
4471
4484
|
if (null === c) {
|
|
4472
4485
|
var l = u.field.canonicalString();
|
|
4473
|
-
throw new
|
|
4486
|
+
throw new U(V, "Invalid query. You are trying to start or end a query using a document for which the field '" + l + "' (used as the orderBy) does not exist.");
|
|
4474
4487
|
}
|
|
4475
4488
|
o.push(c);
|
|
4476
4489
|
}
|
|
4477
4490
|
}
|
|
4478
|
-
return new
|
|
4491
|
+
return new re(o, i);
|
|
4479
4492
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4480
|
-
var i =
|
|
4493
|
+
var i = An(t.firestore);
|
|
4481
4494
|
return function(t, e, n, r, i, o) {
|
|
4482
4495
|
// Use explicit order by's because it has to match the query the user made
|
|
4483
4496
|
var a = t.explicitOrderBy;
|
|
4484
|
-
if (i.length > a.length) throw new
|
|
4497
|
+
if (i.length > a.length) throw new U(V, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
|
|
4485
4498
|
for (var s = [], u = 0; u < i.length; u++) {
|
|
4486
4499
|
var c = i[u];
|
|
4487
4500
|
if (a[u].field.isKeyField()) {
|
|
4488
|
-
if ("string" != typeof c) throw new
|
|
4489
|
-
if (!
|
|
4490
|
-
var l = t.path.child(
|
|
4491
|
-
if (!
|
|
4492
|
-
var f = new
|
|
4493
|
-
s.push(
|
|
4501
|
+
if ("string" != typeof c) throw new U(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4502
|
+
if (!fe(t) && -1 !== c.indexOf("/")) throw new U(V, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
|
|
4503
|
+
var l = t.path.child(Z.fromString(c));
|
|
4504
|
+
if (!nt.isDocumentKey(l)) throw new U(V, "Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to " + r + "() must result in a valid document path, but '" + l + "' is not because it contains an odd number of segments.");
|
|
4505
|
+
var f = new nt(l);
|
|
4506
|
+
s.push(Rt(e, f));
|
|
4494
4507
|
} else {
|
|
4495
|
-
var h =
|
|
4508
|
+
var h = jn(n, r, c);
|
|
4496
4509
|
s.push(h);
|
|
4497
4510
|
}
|
|
4498
4511
|
}
|
|
4499
|
-
return new
|
|
4512
|
+
return new re(s, o);
|
|
4500
4513
|
}(t._query, t.firestore._databaseId, i, e, n, r);
|
|
4501
4514
|
}
|
|
4502
4515
|
|
|
4503
|
-
function
|
|
4504
|
-
if ("string" == typeof (n =
|
|
4505
|
-
if ("" === n) throw new
|
|
4506
|
-
if (!
|
|
4507
|
-
var r = e.path.child(
|
|
4508
|
-
if (!
|
|
4509
|
-
return
|
|
4516
|
+
function pr(t, e, n) {
|
|
4517
|
+
if ("string" == typeof (n = p(n))) {
|
|
4518
|
+
if ("" === n) throw new U(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4519
|
+
if (!fe(e) && -1 !== n.indexOf("/")) throw new U(V, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
|
|
4520
|
+
var r = e.path.child(Z.fromString(n));
|
|
4521
|
+
if (!nt.isDocumentKey(r)) throw new U(V, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ").");
|
|
4522
|
+
return Rt(t, new nt(r));
|
|
4510
4523
|
}
|
|
4511
|
-
if (n instanceof
|
|
4512
|
-
throw new
|
|
4524
|
+
if (n instanceof sn) return Rt(t, n._key);
|
|
4525
|
+
throw new U(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + at(n) + ".");
|
|
4513
4526
|
}
|
|
4514
4527
|
|
|
4515
4528
|
/**
|
|
4516
4529
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4517
4530
|
* array requirements.
|
|
4518
|
-
*/ function
|
|
4519
|
-
if (!Array.isArray(t) || 0 === t.length) throw new
|
|
4520
|
-
if (t.length > 10) throw new
|
|
4531
|
+
*/ function dr(t, e) {
|
|
4532
|
+
if (!Array.isArray(t) || 0 === t.length) throw new U(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
|
|
4533
|
+
if (t.length > 10) throw new U(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
|
|
4521
4534
|
}
|
|
4522
4535
|
|
|
4523
|
-
function
|
|
4524
|
-
if (!n.isEqual(e)) throw new
|
|
4536
|
+
function mr(t, e, n) {
|
|
4537
|
+
if (!n.isEqual(e)) throw new U(V, "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.");
|
|
4525
4538
|
}
|
|
4526
4539
|
|
|
4527
4540
|
/**
|
|
@@ -4570,28 +4583,28 @@ function dr(t, e, n) {
|
|
|
4570
4583
|
* because we want to provide the user with a more specific error message if
|
|
4571
4584
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4572
4585
|
* call.
|
|
4573
|
-
*/ function
|
|
4586
|
+
*/ function yr(t, e, n) {
|
|
4574
4587
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4575
4588
|
// toFirestore().
|
|
4576
4589
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4577
4590
|
return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
|
|
4578
4591
|
}
|
|
4579
4592
|
|
|
4580
|
-
var
|
|
4593
|
+
var vr = /** @class */ function(e) {
|
|
4581
4594
|
function n(t) {
|
|
4582
4595
|
var n = this;
|
|
4583
4596
|
return (n = e.call(this) || this).firestore = t, n;
|
|
4584
4597
|
}
|
|
4585
4598
|
return t(n, e), n.prototype.convertBytes = function(t) {
|
|
4586
|
-
return new
|
|
4599
|
+
return new vn(t);
|
|
4587
4600
|
}, n.prototype.convertReference = function(t) {
|
|
4588
4601
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
4589
|
-
return new
|
|
4602
|
+
return new sn(this.firestore, /* converter= */ null, e);
|
|
4590
4603
|
}, n;
|
|
4591
4604
|
}(/** @class */ function() {
|
|
4592
4605
|
function t() {}
|
|
4593
4606
|
return t.prototype.convertValue = function(t, e) {
|
|
4594
|
-
switch (void 0 === e && (e = "none"),
|
|
4607
|
+
switch (void 0 === e && (e = "none"), qt(t)) {
|
|
4595
4608
|
case 0 /* NullValue */ :
|
|
4596
4609
|
return null;
|
|
4597
4610
|
|
|
@@ -4599,7 +4612,7 @@ var yr = /** @class */ function(e) {
|
|
|
4599
4612
|
return t.booleanValue;
|
|
4600
4613
|
|
|
4601
4614
|
case 2 /* NumberValue */ :
|
|
4602
|
-
return
|
|
4615
|
+
return Vt(t.integerValue || t.doubleValue);
|
|
4603
4616
|
|
|
4604
4617
|
case 3 /* TimestampValue */ :
|
|
4605
4618
|
return this.convertTimestamp(t.timestampValue);
|
|
@@ -4611,7 +4624,7 @@ var yr = /** @class */ function(e) {
|
|
|
4611
4624
|
return t.stringValue;
|
|
4612
4625
|
|
|
4613
4626
|
case 6 /* BlobValue */ :
|
|
4614
|
-
return this.convertBytes(
|
|
4627
|
+
return this.convertBytes(Dt(t.bytesValue));
|
|
4615
4628
|
|
|
4616
4629
|
case 7 /* RefValue */ :
|
|
4617
4630
|
return this.convertReference(t.referenceValue);
|
|
@@ -4626,15 +4639,15 @@ var yr = /** @class */ function(e) {
|
|
|
4626
4639
|
return this.convertObject(t.mapValue, e);
|
|
4627
4640
|
|
|
4628
4641
|
default:
|
|
4629
|
-
throw
|
|
4642
|
+
throw S();
|
|
4630
4643
|
}
|
|
4631
4644
|
}, t.prototype.convertObject = function(t, e) {
|
|
4632
4645
|
var n = this, r = {};
|
|
4633
|
-
return
|
|
4646
|
+
return St(t.fields, (function(t, i) {
|
|
4634
4647
|
r[t] = n.convertValue(i, e);
|
|
4635
4648
|
})), r;
|
|
4636
4649
|
}, t.prototype.convertGeoPoint = function(t) {
|
|
4637
|
-
return new
|
|
4650
|
+
return new wn(Vt(t.latitude), Vt(t.longitude));
|
|
4638
4651
|
}, t.prototype.convertArray = function(t, e) {
|
|
4639
4652
|
var n = this;
|
|
4640
4653
|
return (t.values || []).map((function(t) {
|
|
@@ -4643,25 +4656,25 @@ var yr = /** @class */ function(e) {
|
|
|
4643
4656
|
}, t.prototype.convertServerTimestamp = function(t, e) {
|
|
4644
4657
|
switch (e) {
|
|
4645
4658
|
case "previous":
|
|
4646
|
-
var n =
|
|
4659
|
+
var n = Ft(t);
|
|
4647
4660
|
return null == n ? null : this.convertValue(n, e);
|
|
4648
4661
|
|
|
4649
4662
|
case "estimate":
|
|
4650
|
-
return this.convertTimestamp(
|
|
4663
|
+
return this.convertTimestamp(Nt(t));
|
|
4651
4664
|
|
|
4652
4665
|
default:
|
|
4653
4666
|
return null;
|
|
4654
4667
|
}
|
|
4655
4668
|
}, t.prototype.convertTimestamp = function(t) {
|
|
4656
|
-
var e =
|
|
4657
|
-
return new
|
|
4669
|
+
var e = kt(t);
|
|
4670
|
+
return new bt(e.seconds, e.nanos);
|
|
4658
4671
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
4659
|
-
var n =
|
|
4660
|
-
|
|
4661
|
-
var r = new
|
|
4672
|
+
var n = Z.fromString(t);
|
|
4673
|
+
E(Qe(n));
|
|
4674
|
+
var r = new X(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
|
|
4662
4675
|
return r.isEqual(e) ||
|
|
4663
4676
|
// TODO(b/64130202): Somehow support foreign references.
|
|
4664
|
-
|
|
4677
|
+
b("Document " + i + " contains a document reference within a different database (" + r.projectId + "/" + r.database + ") which is not supported. It will be treated as a reference in the current database (" + e.projectId + "/" + e.database + ") instead."),
|
|
4665
4678
|
i;
|
|
4666
4679
|
}, t;
|
|
4667
4680
|
}());
|
|
@@ -4678,12 +4691,12 @@ var yr = /** @class */ function(e) {
|
|
|
4678
4691
|
* @param reference - The reference of the document to fetch.
|
|
4679
4692
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
4680
4693
|
* document contents.
|
|
4681
|
-
*/ function
|
|
4682
|
-
var e =
|
|
4683
|
-
return
|
|
4684
|
-
|
|
4694
|
+
*/ function gr(t) {
|
|
4695
|
+
var e = Ze((t = st(t, sn)).firestore), n = new vr(t.firestore);
|
|
4696
|
+
return $e(e, [ t._key ]).then((function(e) {
|
|
4697
|
+
E(1 === e.length);
|
|
4685
4698
|
var r = e[0];
|
|
4686
|
-
return new
|
|
4699
|
+
return new Kn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
4687
4700
|
}));
|
|
4688
4701
|
}
|
|
4689
4702
|
|
|
@@ -4698,35 +4711,35 @@ var yr = /** @class */ function(e) {
|
|
|
4698
4711
|
*
|
|
4699
4712
|
* @param query - The `Query` to execute.
|
|
4700
4713
|
* @returns A Promise that will be resolved with the results of the query.
|
|
4701
|
-
*/ function
|
|
4714
|
+
*/ function wr(t) {
|
|
4702
4715
|
!function(t) {
|
|
4703
|
-
if (
|
|
4704
|
-
}((t =
|
|
4705
|
-
var e =
|
|
4706
|
-
return
|
|
4716
|
+
if (ue(t) && 0 === t.explicitOrderBy.length) throw new U(L, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
4717
|
+
}((t = st(t, un))._query);
|
|
4718
|
+
var e = Ze(t.firestore), n = new vr(t.firestore);
|
|
4719
|
+
return Xe(e, t._query).then((function(e) {
|
|
4707
4720
|
var r = e.map((function(e) {
|
|
4708
|
-
return new
|
|
4721
|
+
return new Hn(t.firestore, n, e.key, e, t.converter);
|
|
4709
4722
|
}));
|
|
4710
|
-
return
|
|
4723
|
+
return ue(t._query) &&
|
|
4711
4724
|
// Limit to last queries reverse the orderBy constraint that was
|
|
4712
4725
|
// specified by the user. As such, we need to reverse the order of the
|
|
4713
4726
|
// results to return the documents in the expected order.
|
|
4714
|
-
r.reverse(), new
|
|
4727
|
+
r.reverse(), new Wn(t, r);
|
|
4715
4728
|
}));
|
|
4716
4729
|
}
|
|
4717
4730
|
|
|
4718
|
-
function
|
|
4719
|
-
var r =
|
|
4720
|
-
return
|
|
4731
|
+
function br(t, e, n) {
|
|
4732
|
+
var r = yr((t = st(t, sn)).converter, e, n), i = kn(An(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
4733
|
+
return Ye(Ze(t.firestore), [ i.toMutation(t._key, _e.none()) ]);
|
|
4721
4734
|
}
|
|
4722
4735
|
|
|
4723
|
-
function
|
|
4736
|
+
function _r(t, e, n) {
|
|
4724
4737
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4725
|
-
var o, a =
|
|
4738
|
+
var o, a = An((t = st(t, sn)).firestore);
|
|
4726
4739
|
// For Compat types, we have to "extract" the underlying types before
|
|
4727
4740
|
// performing validation.
|
|
4728
|
-
return o = "string" == typeof (e =
|
|
4729
|
-
|
|
4741
|
+
return o = "string" == typeof (e = p(e)) || e instanceof mn ? Cn(a, "updateDoc", t._key, e, n, r) : On(a, "updateDoc", t._key, e),
|
|
4742
|
+
Ye(Ze(t.firestore), [ o.toMutation(t._key, _e.exists(!0)) ]);
|
|
4730
4743
|
}
|
|
4731
4744
|
|
|
4732
4745
|
/**
|
|
@@ -4740,8 +4753,8 @@ function br(t, e, n) {
|
|
|
4740
4753
|
* @param reference - A reference to the document to delete.
|
|
4741
4754
|
* @returns A `Promise` resolved once the document has been successfully
|
|
4742
4755
|
* deleted from the backend.
|
|
4743
|
-
*/ function
|
|
4744
|
-
return
|
|
4756
|
+
*/ function Tr(t) {
|
|
4757
|
+
return Ye(Ze((t = st(t, sn)).firestore), [ new Ie(t._key, _e.none()) ]);
|
|
4745
4758
|
}
|
|
4746
4759
|
|
|
4747
4760
|
/**
|
|
@@ -4755,11 +4768,12 @@ function br(t, e, n) {
|
|
|
4755
4768
|
*
|
|
4756
4769
|
* @param reference - A reference to the collection to add this document to.
|
|
4757
4770
|
* @param data - An Object containing the data for the new document.
|
|
4771
|
+
* @throws Error - If the provided input is not a valid Firestore document.
|
|
4758
4772
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
4759
4773
|
* newly created document after it has been written to the backend.
|
|
4760
|
-
*/ function
|
|
4761
|
-
var n =
|
|
4762
|
-
return
|
|
4774
|
+
*/ function Sr(t, e) {
|
|
4775
|
+
var n = hn(t = st(t, cn)), r = yr(t.converter, e), i = kn(An(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
4776
|
+
return Ye(Ze(t.firestore), [ i.toMutation(n._key, _e.exists(!1)) ]).then((function() {
|
|
4763
4777
|
return n;
|
|
4764
4778
|
}));
|
|
4765
4779
|
}
|
|
@@ -4783,15 +4797,15 @@ function br(t, e, n) {
|
|
|
4783
4797
|
/**
|
|
4784
4798
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
4785
4799
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
4786
|
-
*/ function
|
|
4787
|
-
return new
|
|
4800
|
+
*/ function Er() {
|
|
4801
|
+
return new Vn("deleteField");
|
|
4788
4802
|
}
|
|
4789
4803
|
|
|
4790
4804
|
/**
|
|
4791
4805
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
4792
4806
|
* include a server-generated timestamp in the written data.
|
|
4793
|
-
*/ function
|
|
4794
|
-
return new
|
|
4807
|
+
*/ function Ir() {
|
|
4808
|
+
return new Pn("serverTimestamp");
|
|
4795
4809
|
}
|
|
4796
4810
|
|
|
4797
4811
|
/**
|
|
@@ -4805,11 +4819,11 @@ function br(t, e, n) {
|
|
|
4805
4819
|
* @param elements - The elements to union into the array.
|
|
4806
4820
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4807
4821
|
* `updateDoc()`.
|
|
4808
|
-
*/ function
|
|
4822
|
+
*/ function Ar() {
|
|
4809
4823
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4810
4824
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4811
4825
|
// update() since we'd need the Firestore instance to do this.
|
|
4812
|
-
return new
|
|
4826
|
+
return new Fn("arrayUnion", t);
|
|
4813
4827
|
}
|
|
4814
4828
|
|
|
4815
4829
|
/**
|
|
@@ -4822,11 +4836,11 @@ function br(t, e, n) {
|
|
|
4822
4836
|
* @param elements - The elements to remove from the array.
|
|
4823
4837
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4824
4838
|
* `updateDoc()`
|
|
4825
|
-
*/ function
|
|
4839
|
+
*/ function kr() {
|
|
4826
4840
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4827
4841
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4828
4842
|
// update() since we'd need the Firestore instance to do this.
|
|
4829
|
-
return new
|
|
4843
|
+
return new Nn("arrayRemove", t);
|
|
4830
4844
|
}
|
|
4831
4845
|
|
|
4832
4846
|
/**
|
|
@@ -4847,8 +4861,8 @@ function br(t, e, n) {
|
|
|
4847
4861
|
* @param n - The value to increment by.
|
|
4848
4862
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4849
4863
|
* `updateDoc()`
|
|
4850
|
-
*/ function
|
|
4851
|
-
return new
|
|
4864
|
+
*/ function Vr(t) {
|
|
4865
|
+
return new qn("increment", t);
|
|
4852
4866
|
}
|
|
4853
4867
|
|
|
4854
4868
|
/**
|
|
@@ -4874,24 +4888,24 @@ function br(t, e, n) {
|
|
|
4874
4888
|
* provides methods for adding writes to the write batch. None of the writes
|
|
4875
4889
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
4876
4890
|
* called.
|
|
4877
|
-
*/ var
|
|
4891
|
+
*/ var Dr = /** @class */ function() {
|
|
4878
4892
|
/** @hideconstructor */
|
|
4879
4893
|
function t(t, e) {
|
|
4880
4894
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
4881
|
-
this._dataReader =
|
|
4895
|
+
this._dataReader = An(t);
|
|
4882
4896
|
}
|
|
4883
4897
|
return t.prototype.set = function(t, e, n) {
|
|
4884
4898
|
this._verifyNotCommitted();
|
|
4885
|
-
var r =
|
|
4886
|
-
return this._mutations.push(o.toMutation(r._key,
|
|
4899
|
+
var r = Pr(t, this._firestore), i = yr(r.converter, e, n), o = kn(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
4900
|
+
return this._mutations.push(o.toMutation(r._key, _e.none())), this;
|
|
4887
4901
|
}, t.prototype.update = function(t, e, n) {
|
|
4888
4902
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4889
4903
|
this._verifyNotCommitted();
|
|
4890
|
-
var o, a =
|
|
4904
|
+
var o, a = Pr(t, this._firestore);
|
|
4891
4905
|
// For Compat types, we have to "extract" the underlying types before
|
|
4892
4906
|
// performing validation.
|
|
4893
|
-
return o = "string" == typeof (e =
|
|
4894
|
-
this._mutations.push(o.toMutation(a._key,
|
|
4907
|
+
return o = "string" == typeof (e = p(e)) || e instanceof mn ? Cn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : On(this._dataReader, "WriteBatch.update", a._key, e),
|
|
4908
|
+
this._mutations.push(o.toMutation(a._key, _e.exists(!0))), this;
|
|
4895
4909
|
},
|
|
4896
4910
|
/**
|
|
4897
4911
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -4901,8 +4915,8 @@ function br(t, e, n) {
|
|
|
4901
4915
|
*/
|
|
4902
4916
|
t.prototype.delete = function(t) {
|
|
4903
4917
|
this._verifyNotCommitted();
|
|
4904
|
-
var e =
|
|
4905
|
-
return this._mutations = this._mutations.concat(new
|
|
4918
|
+
var e = Pr(t, this._firestore);
|
|
4919
|
+
return this._mutations = this._mutations.concat(new Ie(e._key, _e.none())), this;
|
|
4906
4920
|
},
|
|
4907
4921
|
/**
|
|
4908
4922
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -4919,12 +4933,12 @@ function br(t, e, n) {
|
|
|
4919
4933
|
t.prototype.commit = function() {
|
|
4920
4934
|
return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
|
|
4921
4935
|
}, t.prototype._verifyNotCommitted = function() {
|
|
4922
|
-
if (this._committed) throw new
|
|
4936
|
+
if (this._committed) throw new U(O, "A write batch can no longer be used after commit() has been called.");
|
|
4923
4937
|
}, t;
|
|
4924
4938
|
}();
|
|
4925
4939
|
|
|
4926
|
-
function
|
|
4927
|
-
if ((t =
|
|
4940
|
+
function Pr(t, e) {
|
|
4941
|
+
if ((t = p(t)).firestore !== e) throw new U(V, "Provided document reference is from a different Firestore instance.");
|
|
4928
4942
|
return t;
|
|
4929
4943
|
}
|
|
4930
4944
|
|
|
@@ -4940,10 +4954,10 @@ function Dr(t, e) {
|
|
|
4940
4954
|
*
|
|
4941
4955
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
4942
4956
|
* writes.
|
|
4943
|
-
*/ function
|
|
4944
|
-
var e =
|
|
4945
|
-
return new
|
|
4946
|
-
return
|
|
4957
|
+
*/ function Fr(t) {
|
|
4958
|
+
var e = Ze(t = st(t, en));
|
|
4959
|
+
return new Dr(t, (function(t) {
|
|
4960
|
+
return Ye(e, t);
|
|
4947
4961
|
}));
|
|
4948
4962
|
}
|
|
4949
4963
|
|
|
@@ -4966,7 +4980,7 @@ function Dr(t, e) {
|
|
|
4966
4980
|
/**
|
|
4967
4981
|
* Internal transaction object responsible for accumulating the mutations to
|
|
4968
4982
|
* perform and the base versions for any documents read.
|
|
4969
|
-
*/ var
|
|
4983
|
+
*/ var Nr = /** @class */ function() {
|
|
4970
4984
|
function t(t) {
|
|
4971
4985
|
this.datastore = t,
|
|
4972
4986
|
// The version of each document that was read during this transaction.
|
|
@@ -4990,8 +5004,8 @@ function Dr(t, e) {
|
|
|
4990
5004
|
return n(this, (function(n) {
|
|
4991
5005
|
switch (n.label) {
|
|
4992
5006
|
case 0:
|
|
4993
|
-
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new
|
|
4994
|
-
return [ 4 /*yield*/ ,
|
|
5007
|
+
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(V, "Firestore transactions require all reads to be executed before all writes.");
|
|
5008
|
+
return [ 4 /*yield*/ , $e(this.datastore, t) ];
|
|
4995
5009
|
|
|
4996
5010
|
case 1:
|
|
4997
5011
|
return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
|
|
@@ -5010,7 +5024,7 @@ function Dr(t, e) {
|
|
|
5010
5024
|
}
|
|
5011
5025
|
this.writtenDocs.add(t.toString());
|
|
5012
5026
|
}, t.prototype.delete = function(t) {
|
|
5013
|
-
this.write(new
|
|
5027
|
+
this.write(new Ie(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5014
5028
|
}, t.prototype.commit = function() {
|
|
5015
5029
|
return e(this, void 0, void 0, (function() {
|
|
5016
5030
|
var t, e = this;
|
|
@@ -5026,9 +5040,9 @@ function Dr(t, e) {
|
|
|
5026
5040
|
// For each document that was read but not written to, we want to perform
|
|
5027
5041
|
// a `verify` operation.
|
|
5028
5042
|
t.forEach((function(t, n) {
|
|
5029
|
-
var r =
|
|
5030
|
-
e.mutations.push(new
|
|
5031
|
-
})), [ 4 /*yield*/ ,
|
|
5043
|
+
var r = nt.fromPath(n);
|
|
5044
|
+
e.mutations.push(new Ae(r, e.precondition(r)));
|
|
5045
|
+
})), [ 4 /*yield*/ , Ye(this.datastore, this.mutations) ];
|
|
5032
5046
|
|
|
5033
5047
|
case 1:
|
|
5034
5048
|
// For each mutation, note that the doc was written.
|
|
@@ -5039,15 +5053,15 @@ function Dr(t, e) {
|
|
|
5039
5053
|
}, t.prototype.recordVersion = function(t) {
|
|
5040
5054
|
var e;
|
|
5041
5055
|
if (t.isFoundDocument()) e = t.version; else {
|
|
5042
|
-
if (!t.isNoDocument()) throw
|
|
5056
|
+
if (!t.isNoDocument()) throw S();
|
|
5043
5057
|
// For deleted docs, we must use baseVersion 0 when we overwrite them.
|
|
5044
|
-
e =
|
|
5058
|
+
e = _t.min();
|
|
5045
5059
|
}
|
|
5046
5060
|
var n = this.readVersions.get(t.key.toString());
|
|
5047
5061
|
if (n) {
|
|
5048
5062
|
if (!e.isEqual(n))
|
|
5049
5063
|
// This transaction will fail no matter what.
|
|
5050
|
-
throw new
|
|
5064
|
+
throw new U(C, "Document version changed between two reads.");
|
|
5051
5065
|
} else this.readVersions.set(t.key.toString(), e);
|
|
5052
5066
|
},
|
|
5053
5067
|
/**
|
|
@@ -5056,7 +5070,7 @@ function Dr(t, e) {
|
|
|
5056
5070
|
*/
|
|
5057
5071
|
t.prototype.precondition = function(t) {
|
|
5058
5072
|
var e = this.readVersions.get(t.toString());
|
|
5059
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5073
|
+
return !this.writtenDocs.has(t.toString()) && e ? _e.updateTime(e) : _e.none();
|
|
5060
5074
|
},
|
|
5061
5075
|
/**
|
|
5062
5076
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5066,7 +5080,7 @@ function Dr(t, e) {
|
|
|
5066
5080
|
// The first time a document is written, we want to take into account the
|
|
5067
5081
|
// read time and existence
|
|
5068
5082
|
if (!this.writtenDocs.has(t.toString()) && e) {
|
|
5069
|
-
if (e.isEqual(
|
|
5083
|
+
if (e.isEqual(_t.min()))
|
|
5070
5084
|
// The document doesn't exist, so fail the transaction.
|
|
5071
5085
|
// This has to be validated locally because you can't send a
|
|
5072
5086
|
// precondition that a document does not exist without changing the
|
|
@@ -5076,20 +5090,20 @@ function Dr(t, e) {
|
|
|
5076
5090
|
// express that to the backend, we have to validate locally.
|
|
5077
5091
|
// Note: this can change once we can send separate verify writes in the
|
|
5078
5092
|
// transaction.
|
|
5079
|
-
throw new
|
|
5093
|
+
throw new U(V, "Can't update a document that doesn't exist.");
|
|
5080
5094
|
// Document exists, base precondition on document update time.
|
|
5081
|
-
return
|
|
5095
|
+
return _e.updateTime(e);
|
|
5082
5096
|
}
|
|
5083
5097
|
// Document was not read, so we just use the preconditions for a blind
|
|
5084
5098
|
// update.
|
|
5085
|
-
return
|
|
5099
|
+
return _e.exists(!0);
|
|
5086
5100
|
}, t.prototype.write = function(t) {
|
|
5087
5101
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5088
5102
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5089
|
-
}(),
|
|
5103
|
+
}(), qr = /** @class */ function() {
|
|
5090
5104
|
function t(t, e, n, r) {
|
|
5091
5105
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
5092
|
-
this.Tt = 5, this.It = new
|
|
5106
|
+
this.Tt = 5, this.It = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5093
5107
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5094
5108
|
}
|
|
5095
5109
|
return t.prototype.run = function() {
|
|
@@ -5100,7 +5114,7 @@ function Dr(t, e) {
|
|
|
5100
5114
|
return e(t, void 0, void 0, (function() {
|
|
5101
5115
|
var t, e, r = this;
|
|
5102
5116
|
return n(this, (function(n) {
|
|
5103
|
-
return t = new
|
|
5117
|
+
return t = new Nr(this.datastore), (e = this.Pt(t)) && e.then((function(e) {
|
|
5104
5118
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5105
5119
|
return t.commit().then((function() {
|
|
5106
5120
|
r.deferred.resolve(e);
|
|
@@ -5117,7 +5131,7 @@ function Dr(t, e) {
|
|
|
5117
5131
|
}, t.prototype.Pt = function(t) {
|
|
5118
5132
|
try {
|
|
5119
5133
|
var e = this.updateFunction(t);
|
|
5120
|
-
return !
|
|
5134
|
+
return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
|
|
5121
5135
|
null);
|
|
5122
5136
|
} catch (t) {
|
|
5123
5137
|
// Do not retry errors thrown by user provided updateFunction.
|
|
@@ -5143,30 +5157,30 @@ function Dr(t, e) {
|
|
|
5143
5157
|
function(t) {
|
|
5144
5158
|
switch (t) {
|
|
5145
5159
|
default:
|
|
5146
|
-
return
|
|
5160
|
+
return S();
|
|
5147
5161
|
|
|
5148
|
-
case I:
|
|
5149
5162
|
case A:
|
|
5150
|
-
case
|
|
5151
|
-
case
|
|
5152
|
-
case
|
|
5163
|
+
case k:
|
|
5164
|
+
case D:
|
|
5165
|
+
case q:
|
|
5153
5166
|
case R:
|
|
5167
|
+
case M:
|
|
5154
5168
|
// Unauthenticated means something went wrong with our token and we need
|
|
5155
5169
|
// to retry with new credentials which will happen automatically.
|
|
5156
|
-
case
|
|
5170
|
+
case N:
|
|
5157
5171
|
return !1;
|
|
5158
5172
|
|
|
5159
|
-
case
|
|
5160
|
-
case D:
|
|
5161
|
-
case "already-exists":
|
|
5173
|
+
case V:
|
|
5162
5174
|
case P:
|
|
5163
|
-
case
|
|
5175
|
+
case "already-exists":
|
|
5176
|
+
case F:
|
|
5177
|
+
case O:
|
|
5164
5178
|
// Aborted might be retried in some scenarios, but that is dependant on
|
|
5165
5179
|
// the context and should handled individually by the calling code.
|
|
5166
5180
|
// See https://cloud.google.com/apis/design/errors.
|
|
5167
|
-
case
|
|
5168
|
-
case C:
|
|
5181
|
+
case C:
|
|
5169
5182
|
case j:
|
|
5183
|
+
case L:
|
|
5170
5184
|
case "data-loss":
|
|
5171
5185
|
return !0;
|
|
5172
5186
|
}
|
|
@@ -5212,7 +5226,7 @@ function Dr(t, e) {
|
|
|
5212
5226
|
* See the License for the specific language governing permissions and
|
|
5213
5227
|
* limitations under the License.
|
|
5214
5228
|
*/
|
|
5215
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5229
|
+
/** The Platform's 'document' implementation or null if not available. */ function Or() {
|
|
5216
5230
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5217
5231
|
// eslint-disable-next-line no-restricted-globals
|
|
5218
5232
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5244,10 +5258,10 @@ function Dr(t, e) {
|
|
|
5244
5258
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5245
5259
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5246
5260
|
* IE.
|
|
5247
|
-
*/ var
|
|
5261
|
+
*/ var Cr = /** @class */ function() {
|
|
5248
5262
|
function t(t, e, n, r, i) {
|
|
5249
5263
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
|
|
5250
|
-
this.deferred = new
|
|
5264
|
+
this.deferred = new x, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
5251
5265
|
// It's normal for the deferred promise to be canceled (due to cancellation)
|
|
5252
5266
|
// and so we attach a dummy catch callback to avoid
|
|
5253
5267
|
// 'UnhandledPromiseRejectionWarning' log spam.
|
|
@@ -5296,7 +5310,7 @@ function Dr(t, e) {
|
|
|
5296
5310
|
* guarantee that the operation will not be run.
|
|
5297
5311
|
*/
|
|
5298
5312
|
t.prototype.cancel = function(t) {
|
|
5299
|
-
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new
|
|
5313
|
+
null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new U(A, "Operation cancelled" + (t ? ": " + t : ""))));
|
|
5300
5314
|
}, t.prototype.handleDelayElapsed = function() {
|
|
5301
5315
|
var t = this;
|
|
5302
5316
|
this.asyncQueue.enqueueAndForget((function() {
|
|
@@ -5308,7 +5322,7 @@ function Dr(t, e) {
|
|
|
5308
5322
|
null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
|
|
5309
5323
|
this.timerHandle = null);
|
|
5310
5324
|
}, t;
|
|
5311
|
-
}(),
|
|
5325
|
+
}(), jr = /** @class */ function() {
|
|
5312
5326
|
function t() {
|
|
5313
5327
|
var t = this;
|
|
5314
5328
|
// The last promise in the queue.
|
|
@@ -5326,21 +5340,21 @@ function Dr(t, e) {
|
|
|
5326
5340
|
this.St = null,
|
|
5327
5341
|
// Flag set while there's an outstanding AsyncQueue operation, used for
|
|
5328
5342
|
// assertion sanity-checks.
|
|
5329
|
-
this.qt = !1,
|
|
5330
|
-
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5331
5343
|
this.xt = !1,
|
|
5344
|
+
// Enabled during shutdown on Safari to prevent future access to IndexedDB.
|
|
5345
|
+
this.qt = !1,
|
|
5332
5346
|
// List of TimerIds to fast-forward delays for.
|
|
5333
5347
|
this.Ot = [],
|
|
5334
5348
|
// Backoff timer used to schedule retries for retryable operations
|
|
5335
|
-
this.It = new
|
|
5349
|
+
this.It = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5336
5350
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5337
5351
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5338
5352
|
// after page comes into foreground.
|
|
5339
5353
|
this.Ct = function() {
|
|
5340
|
-
var e =
|
|
5341
|
-
e &&
|
|
5354
|
+
var e = Or();
|
|
5355
|
+
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.It.H();
|
|
5342
5356
|
};
|
|
5343
|
-
var e =
|
|
5357
|
+
var e = Or();
|
|
5344
5358
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ct);
|
|
5345
5359
|
}
|
|
5346
5360
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
@@ -5363,8 +5377,8 @@ function Dr(t, e) {
|
|
|
5363
5377
|
this.Ut(t);
|
|
5364
5378
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5365
5379
|
if (!this.$t) {
|
|
5366
|
-
this.$t = !0, this.
|
|
5367
|
-
var e =
|
|
5380
|
+
this.$t = !0, this.qt = t || !1;
|
|
5381
|
+
var e = Or();
|
|
5368
5382
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5369
5383
|
}
|
|
5370
5384
|
}, t.prototype.enqueue = function(t) {
|
|
@@ -5375,9 +5389,9 @@ function Dr(t, e) {
|
|
|
5375
5389
|
// Create a deferred Promise that we can return to the callee. This
|
|
5376
5390
|
// allows us to return a "hanging Promise" only to the callee and still
|
|
5377
5391
|
// advance the queue even when the operation is not run.
|
|
5378
|
-
var n = new
|
|
5392
|
+
var n = new x;
|
|
5379
5393
|
return this.Ut((function() {
|
|
5380
|
-
return e.$t && e.
|
|
5394
|
+
return e.$t && e.qt ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
|
|
5381
5395
|
})).then((function() {
|
|
5382
5396
|
return n.promise;
|
|
5383
5397
|
}));
|
|
@@ -5409,7 +5423,7 @@ function Dr(t, e) {
|
|
|
5409
5423
|
case 3:
|
|
5410
5424
|
if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
|
|
5411
5425
|
// Failure will be handled by AsyncQueue
|
|
5412
|
-
return
|
|
5426
|
+
return w("AsyncQueue", "Operation failed with retryable error: " + t),
|
|
5413
5427
|
[ 3 /*break*/ , 4 ];
|
|
5414
5428
|
|
|
5415
5429
|
case 4:
|
|
@@ -5435,8 +5449,8 @@ function Dr(t, e) {
|
|
|
5435
5449
|
}));
|
|
5436
5450
|
}, t.prototype.Ut = function(t) {
|
|
5437
5451
|
var e = this, n = this.Dt.then((function() {
|
|
5438
|
-
return e.
|
|
5439
|
-
e.St = t, e.
|
|
5452
|
+
return e.xt = !0, t().catch((function(t) {
|
|
5453
|
+
e.St = t, e.xt = !1;
|
|
5440
5454
|
var n =
|
|
5441
5455
|
/**
|
|
5442
5456
|
* Chrome includes Error.message in Error.stack. Other browsers do not.
|
|
@@ -5451,9 +5465,9 @@ function Dr(t, e) {
|
|
|
5451
5465
|
// Re-throw the error so that this.tail becomes a rejected Promise and
|
|
5452
5466
|
// all further attempts to chain (via .then) will just short-circuit
|
|
5453
5467
|
// and return the rejected Promise.
|
|
5454
|
-
throw
|
|
5468
|
+
throw b("INTERNAL UNHANDLED ERROR: ", n), t;
|
|
5455
5469
|
})).then((function(t) {
|
|
5456
|
-
return e.
|
|
5470
|
+
return e.xt = !1, t;
|
|
5457
5471
|
}));
|
|
5458
5472
|
}));
|
|
5459
5473
|
return this.Dt = n, n;
|
|
@@ -5462,12 +5476,12 @@ function Dr(t, e) {
|
|
|
5462
5476
|
this.Lt(),
|
|
5463
5477
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5464
5478
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5465
|
-
var i =
|
|
5479
|
+
var i = Cr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5466
5480
|
return r.jt(t);
|
|
5467
5481
|
}));
|
|
5468
5482
|
return this.Ft.push(i), i;
|
|
5469
5483
|
}, t.prototype.Lt = function() {
|
|
5470
|
-
this.St &&
|
|
5484
|
+
this.St && S();
|
|
5471
5485
|
}, t.prototype.verifyOperationInProgress = function() {},
|
|
5472
5486
|
/**
|
|
5473
5487
|
* Waits until all currently queued tasks are finished executing. Delayed
|
|
@@ -5537,10 +5551,10 @@ function Dr(t, e) {
|
|
|
5537
5551
|
var e = this.Ft.indexOf(t);
|
|
5538
5552
|
this.Ft.splice(e, 1);
|
|
5539
5553
|
}, t;
|
|
5540
|
-
}(),
|
|
5554
|
+
}(), Lr = /** @class */ function() {
|
|
5541
5555
|
/** @hideconstructor */
|
|
5542
5556
|
function t(t, e) {
|
|
5543
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5557
|
+
this._firestore = t, this._transaction = e, this._dataReader = An(t)
|
|
5544
5558
|
/**
|
|
5545
5559
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5546
5560
|
*
|
|
@@ -5549,23 +5563,23 @@ function Dr(t, e) {
|
|
|
5549
5563
|
*/;
|
|
5550
5564
|
}
|
|
5551
5565
|
return t.prototype.get = function(t) {
|
|
5552
|
-
var e = this, n =
|
|
5566
|
+
var e = this, n = Pr(t, this._firestore), r = new vr(this._firestore);
|
|
5553
5567
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5554
|
-
if (!t || 1 !== t.length) return
|
|
5568
|
+
if (!t || 1 !== t.length) return S();
|
|
5555
5569
|
var i = t[0];
|
|
5556
|
-
if (i.isFoundDocument()) return new
|
|
5557
|
-
if (i.isNoDocument()) return new
|
|
5558
|
-
throw
|
|
5570
|
+
if (i.isFoundDocument()) return new Kn(e._firestore, r, i.key, i, n.converter);
|
|
5571
|
+
if (i.isNoDocument()) return new Kn(e._firestore, r, n._key, null, n.converter);
|
|
5572
|
+
throw S();
|
|
5559
5573
|
}));
|
|
5560
5574
|
}, t.prototype.set = function(t, e, n) {
|
|
5561
|
-
var r =
|
|
5575
|
+
var r = Pr(t, this._firestore), i = yr(r.converter, e, n), o = kn(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
5562
5576
|
return this._transaction.set(r._key, o), this;
|
|
5563
5577
|
}, t.prototype.update = function(t, e, n) {
|
|
5564
5578
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5565
|
-
var o, a =
|
|
5579
|
+
var o, a = Pr(t, this._firestore);
|
|
5566
5580
|
// For Compat types, we have to "extract" the underlying types before
|
|
5567
5581
|
// performing validation.
|
|
5568
|
-
return o = "string" == typeof (e =
|
|
5582
|
+
return o = "string" == typeof (e = p(e)) || e instanceof mn ? Cn(this._dataReader, "Transaction.update", a._key, e, n, r) : On(this._dataReader, "Transaction.update", a._key, e),
|
|
5569
5583
|
this._transaction.update(a._key, o), this;
|
|
5570
5584
|
},
|
|
5571
5585
|
/**
|
|
@@ -5575,7 +5589,7 @@ function Dr(t, e) {
|
|
|
5575
5589
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5576
5590
|
*/
|
|
5577
5591
|
t.prototype.delete = function(t) {
|
|
5578
|
-
var e =
|
|
5592
|
+
var e = Pr(t, this._firestore);
|
|
5579
5593
|
return this._transaction.delete(e._key), this;
|
|
5580
5594
|
}, t;
|
|
5581
5595
|
}();
|
|
@@ -5613,10 +5627,10 @@ function Dr(t, e) {
|
|
|
5613
5627
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5614
5628
|
* rejected promise with the corresponding failure error is returned.
|
|
5615
5629
|
*/
|
|
5616
|
-
function
|
|
5617
|
-
var n =
|
|
5618
|
-
return new
|
|
5619
|
-
return e(new
|
|
5630
|
+
function Rr(t, e) {
|
|
5631
|
+
var n = Ze(t = st(t, en)), r = new x;
|
|
5632
|
+
return new qr(new jr, n, (function(n) {
|
|
5633
|
+
return e(new Lr(t, n));
|
|
5620
5634
|
}), r).run(), r.promise
|
|
5621
5635
|
/**
|
|
5622
5636
|
* Firestore Lite
|
|
@@ -5628,12 +5642,12 @@ function Lr(t, e) {
|
|
|
5628
5642
|
*/;
|
|
5629
5643
|
}
|
|
5630
5644
|
|
|
5631
|
-
|
|
5632
|
-
var n = e.options, r = t.getProvider("app").getImmediate(), i = new
|
|
5645
|
+
y = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
5646
|
+
var n = e.options, r = t.getProvider("app").getImmediate(), i = new en(r, new Q(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5633
5647
|
return n && i._setSettings(n), i;
|
|
5634
5648
|
}), "PUBLIC")),
|
|
5635
5649
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5636
|
-
a("firestore-lite", "3.4.
|
|
5650
|
+
a("firestore-lite", "3.4.2-202205224240", ""), a("firestore-lite", "3.4.2-202205224240", "esm5");
|
|
5637
5651
|
|
|
5638
|
-
export {
|
|
5652
|
+
export { vn as Bytes, cn as CollectionReference, sn as DocumentReference, Kn as DocumentSnapshot, mn as FieldPath, gn as FieldValue, en as Firestore, U as FirestoreError, wn as GeoPoint, un as Query, Xn as QueryConstraint, Hn as QueryDocumentSnapshot, Wn as QuerySnapshot, bt as Timestamp, Lr as Transaction, Dr as WriteBatch, Sr as addDoc, kr as arrayRemove, Ar as arrayUnion, ln as collection, fn as collectionGroup, on as connectFirestoreEmulator, Tr as deleteDoc, Er as deleteField, hn as doc, yn as documentId, fr as endAt, lr as endBefore, gr as getDoc, wr as getDocs, rn as getFirestore, Vr as increment, nn as initializeFirestore, ir as limit, or as limitToLast, nr as orderBy, Jn as query, dn as queryEqual, pn as refEqual, Rr as runTransaction, Ir as serverTimestamp, br as setDoc, g as setLogLevel, Yn as snapshotEqual, ur as startAfter, sr as startAt, an as terminate, _r as updateDoc, tr as where, Fr as writeBatch };
|
|
5639
5653
|
//# sourceMappingURL=index.browser.esm5.js.map
|