@firebase/firestore 3.4.7 → 3.4.8-canary.44948ac91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/firestore/src/core/query.d.ts +2 -4
- package/dist/firestore/src/core/target.d.ts +2 -0
- package/dist/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/firestore/src/model/collections.d.ts +1 -1
- package/dist/firestore/src/model/field_index.d.ts +6 -0
- package/dist/firestore/src/util/misc.d.ts +3 -0
- package/dist/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/index.esm2017.js +4632 -4498
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +4989 -4864
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +1743 -1547
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +1743 -1547
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +4461 -4327
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +26 -4
- package/dist/lite/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/firestore/src/core/target.d.ts +2 -0
- package/dist/lite/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/lite/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/lite/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/lite/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/firestore/src/model/field_index.d.ts +6 -0
- package/dist/lite/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/lite/index.browser.esm2017.js +385 -389
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +377 -381
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +7 -9
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +7 -9
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +385 -389
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +95 -95
- package/dist/lite/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/lite/packages/firestore/src/core/target.d.ts +2 -0
- package/dist/lite/packages/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/lite/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/lite/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/lite/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/lite/packages/firestore/src/model/field_index.d.ts +6 -0
- package/dist/lite/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/packages/firestore/dist/index.esm2017.d.ts +173 -173
- package/dist/packages/firestore/src/core/query.d.ts +2 -4
- package/dist/packages/firestore/src/core/target.d.ts +2 -0
- package/dist/packages/firestore/src/local/index_manager.d.ts +27 -5
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +15 -5
- package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +9 -0
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +8 -2
- package/dist/packages/firestore/src/local/indexeddb_sentinels.d.ts +9 -2
- package/dist/packages/firestore/src/local/local_documents_view.d.ts +1 -1
- package/dist/packages/firestore/src/local/memory_index_manager.d.ts +6 -4
- package/dist/packages/firestore/src/local/query_engine.d.ts +44 -5
- package/dist/packages/firestore/src/local/simple_db.d.ts +2 -0
- package/dist/packages/firestore/src/model/collections.d.ts +1 -1
- package/dist/packages/firestore/src/model/field_index.d.ts +6 -0
- package/dist/packages/firestore/src/util/misc.d.ts +3 -0
- package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +2 -1
- package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +5 -4
- package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +0 -4
- package/dist/private.d.ts +26 -4
- package/package.json +9 -9
|
@@ -67,7 +67,7 @@ m.MOCK_USER = new m("mock-user");
|
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
69
|
*/
|
|
70
|
-
var y = "9.6.
|
|
70
|
+
var y = "9.6.11-canary.44948ac91", v = new l("@firebase/firestore");
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
@@ -2102,14 +2102,10 @@ function(t, e, n, r, i, o /* First */ , a, s) {
|
|
|
2102
2102
|
};
|
|
2103
2103
|
|
|
2104
2104
|
/** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
|
|
2105
|
-
return !ct(t.limit) && "L" /* Last */ === t.limitType;
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
function ce(t) {
|
|
2109
2105
|
return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
|
|
2110
2106
|
}
|
|
2111
2107
|
|
|
2112
|
-
function
|
|
2108
|
+
function ce(t) {
|
|
2113
2109
|
for (var e = 0, n = t.filters; e < n.length; e++) {
|
|
2114
2110
|
var r = n[e];
|
|
2115
2111
|
if (r.N()) return r.field;
|
|
@@ -2124,7 +2120,7 @@ function le(t) {
|
|
|
2124
2120
|
/**
|
|
2125
2121
|
* Returns whether the query matches a collection group rather than a specific
|
|
2126
2122
|
* collection.
|
|
2127
|
-
*/ function
|
|
2123
|
+
*/ function le(t) {
|
|
2128
2124
|
return null !== t.collectionGroup;
|
|
2129
2125
|
}
|
|
2130
2126
|
|
|
@@ -2132,11 +2128,11 @@ function le(t) {
|
|
|
2132
2128
|
* Returns the implicit order by constraint that is used to execute the Query,
|
|
2133
2129
|
* which can be different from the order by constraints the user provided (e.g.
|
|
2134
2130
|
* the SDK and backend always orders by `__name__`).
|
|
2135
|
-
*/ function
|
|
2131
|
+
*/ function fe(t) {
|
|
2136
2132
|
var e = I(t);
|
|
2137
2133
|
if (null === e.$) {
|
|
2138
2134
|
e.$ = [];
|
|
2139
|
-
var n =
|
|
2135
|
+
var n = ce(e), r = ue(e);
|
|
2140
2136
|
if (null !== n && null === r)
|
|
2141
2137
|
// In order to implicitly add key ordering, we must also add the
|
|
2142
2138
|
// inequality filter field for it to be a valid query.
|
|
@@ -2159,17 +2155,17 @@ function le(t) {
|
|
|
2159
2155
|
|
|
2160
2156
|
/**
|
|
2161
2157
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
2162
|
-
*/ function
|
|
2158
|
+
*/ function he(t) {
|
|
2163
2159
|
var e = I(t);
|
|
2164
|
-
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Ht(e.path, e.collectionGroup,
|
|
2160
|
+
if (!e.S) if ("F" /* First */ === e.limitType) e.S = Ht(e.path, e.collectionGroup, fe(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
2165
2161
|
for (
|
|
2166
2162
|
// Flip the orderBy directions since we want the last results
|
|
2167
|
-
var n = [], r = 0, i =
|
|
2163
|
+
var n = [], r = 0, i = fe(e); r < i.length; r++) {
|
|
2168
2164
|
var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
2169
2165
|
n.push(new ie(o.field, a));
|
|
2170
2166
|
}
|
|
2171
2167
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2172
|
-
var s = e.endAt ? new re(e.endAt.position,
|
|
2168
|
+
var s = e.endAt ? new re(e.endAt.position, e.endAt.inclusive) : null, u = e.startAt ? new re(e.startAt.position, e.startAt.inclusive) : null;
|
|
2173
2169
|
// Now return as a LimitType.First query.
|
|
2174
2170
|
e.S = Ht(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
|
|
2175
2171
|
}
|
|
@@ -2201,7 +2197,7 @@ function le(t) {
|
|
|
2201
2197
|
* The return value is an IntegerValue if it can safely represent the value,
|
|
2202
2198
|
* otherwise a DoubleValue is returned.
|
|
2203
2199
|
*/
|
|
2204
|
-
function
|
|
2200
|
+
function pe(t, e) {
|
|
2205
2201
|
return function(t) {
|
|
2206
2202
|
return "number" == typeof t && Number.isInteger(t) && !lt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
|
|
2207
2203
|
}(e) ?
|
|
@@ -2246,36 +2242,36 @@ function de(t, e) {
|
|
|
2246
2242
|
* See the License for the specific language governing permissions and
|
|
2247
2243
|
* limitations under the License.
|
|
2248
2244
|
*/
|
|
2249
|
-
/** Used to represent a field transform on a mutation. */ var
|
|
2245
|
+
/** Used to represent a field transform on a mutation. */ var de = function() {
|
|
2250
2246
|
// Make sure that the structural type of `TransformOperation` is unique.
|
|
2251
2247
|
// See https://github.com/microsoft/TypeScript/issues/5451
|
|
2252
2248
|
this._ = void 0;
|
|
2253
|
-
},
|
|
2249
|
+
}, me = /** @class */ function(e) {
|
|
2254
2250
|
function n() {
|
|
2255
2251
|
return null !== e && e.apply(this, arguments) || this;
|
|
2256
2252
|
}
|
|
2257
2253
|
return t(n, e), n;
|
|
2258
|
-
}(
|
|
2254
|
+
}(de), ye = /** @class */ function(e) {
|
|
2259
2255
|
function n(t) {
|
|
2260
2256
|
var n = this;
|
|
2261
2257
|
return (n = e.call(this) || this).elements = t, n;
|
|
2262
2258
|
}
|
|
2263
2259
|
return t(n, e), n;
|
|
2264
|
-
}(
|
|
2260
|
+
}(de), ve = /** @class */ function(e) {
|
|
2265
2261
|
function n(t) {
|
|
2266
2262
|
var n = this;
|
|
2267
2263
|
return (n = e.call(this) || this).elements = t, n;
|
|
2268
2264
|
}
|
|
2269
2265
|
return t(n, e), n;
|
|
2270
|
-
}(
|
|
2266
|
+
}(de), ge = /** @class */ function(e) {
|
|
2271
2267
|
function n(t, n) {
|
|
2272
2268
|
var r = this;
|
|
2273
2269
|
return (r = e.call(this) || this).q = t, r.O = n, r;
|
|
2274
2270
|
}
|
|
2275
2271
|
return t(n, e), n;
|
|
2276
|
-
}(
|
|
2272
|
+
}(de), we = function(t, e) {
|
|
2277
2273
|
this.field = t, this.transform = e;
|
|
2278
|
-
},
|
|
2274
|
+
}, be = /** @class */ function() {
|
|
2279
2275
|
function t(t, e) {
|
|
2280
2276
|
this.updateTime = t, this.exists = e
|
|
2281
2277
|
/** Creates a new empty Precondition. */;
|
|
@@ -2297,7 +2293,7 @@ function de(t, e) {
|
|
|
2297
2293
|
}), t.prototype.isEqual = function(t) {
|
|
2298
2294
|
return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
|
|
2299
2295
|
}, t;
|
|
2300
|
-
}(),
|
|
2296
|
+
}(), _e = function() {}, Te = /** @class */ function(e) {
|
|
2301
2297
|
function n(t, n, r, i) {
|
|
2302
2298
|
void 0 === i && (i = []);
|
|
2303
2299
|
var o = this;
|
|
@@ -2305,7 +2301,7 @@ function de(t, e) {
|
|
|
2305
2301
|
o.type = 0 /* Set */ , o;
|
|
2306
2302
|
}
|
|
2307
2303
|
return t(n, e), n;
|
|
2308
|
-
}(
|
|
2304
|
+
}(_e), Se = /** @class */ function(e) {
|
|
2309
2305
|
function n(t, n, r, i, o) {
|
|
2310
2306
|
void 0 === o && (o = []);
|
|
2311
2307
|
var a = this;
|
|
@@ -2313,24 +2309,24 @@ function de(t, e) {
|
|
|
2313
2309
|
a.fieldTransforms = o, a.type = 1 /* Patch */ , a;
|
|
2314
2310
|
}
|
|
2315
2311
|
return t(n, e), n;
|
|
2316
|
-
}(
|
|
2312
|
+
}(_e), Ee = /** @class */ function(e) {
|
|
2317
2313
|
function n(t, n) {
|
|
2318
2314
|
var r = this;
|
|
2319
2315
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
|
|
2320
2316
|
r.fieldTransforms = [], r;
|
|
2321
2317
|
}
|
|
2322
2318
|
return t(n, e), n;
|
|
2323
|
-
}(
|
|
2319
|
+
}(_e), Ie = /** @class */ function(e) {
|
|
2324
2320
|
function n(t, n) {
|
|
2325
2321
|
var r = this;
|
|
2326
2322
|
return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
|
|
2327
2323
|
r.fieldTransforms = [], r;
|
|
2328
2324
|
}
|
|
2329
2325
|
return t(n, e), n;
|
|
2330
|
-
}(
|
|
2326
|
+
}(_e), Ae = {
|
|
2331
2327
|
asc: "ASCENDING",
|
|
2332
2328
|
desc: "DESCENDING"
|
|
2333
|
-
},
|
|
2329
|
+
}, ke = {
|
|
2334
2330
|
"<": "LESS_THAN",
|
|
2335
2331
|
"<=": "LESS_THAN_OR_EQUAL",
|
|
2336
2332
|
">": "GREATER_THAN",
|
|
@@ -2341,7 +2337,7 @@ function de(t, e) {
|
|
|
2341
2337
|
in: "IN",
|
|
2342
2338
|
"not-in": "NOT_IN",
|
|
2343
2339
|
"array-contains-any": "ARRAY_CONTAINS_ANY"
|
|
2344
|
-
},
|
|
2340
|
+
}, Ve = function(t, e) {
|
|
2345
2341
|
this.databaseId = t, this.F = e;
|
|
2346
2342
|
};
|
|
2347
2343
|
|
|
@@ -2357,7 +2353,7 @@ function de(t, e) {
|
|
|
2357
2353
|
/**
|
|
2358
2354
|
* Returns a value for a Date that's appropriate to put into a proto.
|
|
2359
2355
|
*/
|
|
2360
|
-
function
|
|
2356
|
+
function De(t, e) {
|
|
2361
2357
|
return t.F ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
|
|
2362
2358
|
seconds: "" + e.seconds,
|
|
2363
2359
|
nanos: e.nanoseconds
|
|
@@ -2368,72 +2364,72 @@ function Pe(t, e) {
|
|
|
2368
2364
|
* Returns a value for bytes that's appropriate to put in a proto.
|
|
2369
2365
|
*
|
|
2370
2366
|
* Visible for testing.
|
|
2371
|
-
*/ function
|
|
2367
|
+
*/ function Pe(t, e) {
|
|
2372
2368
|
return t.F ? e.toBase64() : e.toUint8Array();
|
|
2373
2369
|
}
|
|
2374
2370
|
|
|
2375
|
-
function
|
|
2376
|
-
return
|
|
2371
|
+
function Ne(t, e) {
|
|
2372
|
+
return De(t, e.toTimestamp());
|
|
2377
2373
|
}
|
|
2378
2374
|
|
|
2379
|
-
function
|
|
2375
|
+
function qe(t) {
|
|
2380
2376
|
return E(!!t), _t.fromTimestamp(function(t) {
|
|
2381
2377
|
var e = kt(t);
|
|
2382
2378
|
return new bt(e.seconds, e.nanos);
|
|
2383
2379
|
}(t));
|
|
2384
2380
|
}
|
|
2385
2381
|
|
|
2386
|
-
function
|
|
2382
|
+
function Fe(t, e) {
|
|
2387
2383
|
return function(t) {
|
|
2388
2384
|
return new Z([ "projects", t.projectId, "databases", t.database ]);
|
|
2389
2385
|
}(t).child("documents").child(e).canonicalString();
|
|
2390
2386
|
}
|
|
2391
2387
|
|
|
2392
|
-
function
|
|
2393
|
-
return
|
|
2388
|
+
function Oe(t, e) {
|
|
2389
|
+
return Fe(t.databaseId, e.path);
|
|
2394
2390
|
}
|
|
2395
2391
|
|
|
2396
|
-
function
|
|
2392
|
+
function Ce(t, e) {
|
|
2397
2393
|
var n, r = function(t) {
|
|
2398
2394
|
var e = Z.fromString(t);
|
|
2399
|
-
return E(
|
|
2395
|
+
return E(Ge(e)), e;
|
|
2400
2396
|
}(e);
|
|
2401
2397
|
if (r.get(1) !== t.databaseId.projectId) throw new x(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
|
|
2402
2398
|
if (r.get(3) !== t.databaseId.database) throw new x(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
|
|
2403
2399
|
return new nt((E((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
|
|
2404
2400
|
}
|
|
2405
2401
|
|
|
2406
|
-
function
|
|
2407
|
-
return
|
|
2402
|
+
function Le(t, e) {
|
|
2403
|
+
return Fe(t.databaseId, e);
|
|
2408
2404
|
}
|
|
2409
2405
|
|
|
2410
|
-
function
|
|
2406
|
+
function je(t) {
|
|
2411
2407
|
return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
|
|
2412
2408
|
}
|
|
2413
2409
|
|
|
2414
|
-
function
|
|
2410
|
+
function Re(t, e, n) {
|
|
2415
2411
|
return {
|
|
2416
|
-
name:
|
|
2412
|
+
name: Oe(t, e),
|
|
2417
2413
|
fields: n.value.mapValue.fields
|
|
2418
2414
|
};
|
|
2419
2415
|
}
|
|
2420
2416
|
|
|
2421
|
-
function
|
|
2422
|
-
return
|
|
2417
|
+
function Me(t) {
|
|
2418
|
+
return Ae[t];
|
|
2423
2419
|
}
|
|
2424
2420
|
|
|
2425
2421
|
// visible for testing
|
|
2426
|
-
function
|
|
2427
|
-
return
|
|
2422
|
+
function xe(t) {
|
|
2423
|
+
return ke[t];
|
|
2428
2424
|
}
|
|
2429
2425
|
|
|
2430
|
-
function
|
|
2426
|
+
function Ue(t) {
|
|
2431
2427
|
return {
|
|
2432
2428
|
fieldPath: t.canonicalString()
|
|
2433
2429
|
};
|
|
2434
2430
|
}
|
|
2435
2431
|
|
|
2436
|
-
function
|
|
2432
|
+
function Be(t) {
|
|
2437
2433
|
var e = [];
|
|
2438
2434
|
return t.fields.forEach((function(t) {
|
|
2439
2435
|
return e.push(t.canonicalString());
|
|
@@ -2442,7 +2438,7 @@ function Ge(t) {
|
|
|
2442
2438
|
};
|
|
2443
2439
|
}
|
|
2444
2440
|
|
|
2445
|
-
function
|
|
2441
|
+
function Ge(t) {
|
|
2446
2442
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2447
2443
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2448
2444
|
}
|
|
@@ -2462,8 +2458,8 @@ function ze(t) {
|
|
|
2462
2458
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2463
2459
|
* See the License for the specific language governing permissions and
|
|
2464
2460
|
* limitations under the License.
|
|
2465
|
-
*/ function
|
|
2466
|
-
return new
|
|
2461
|
+
*/ function ze(t) {
|
|
2462
|
+
return new Ve(t, /* useProto3Json= */ !0);
|
|
2467
2463
|
}
|
|
2468
2464
|
|
|
2469
2465
|
/**
|
|
@@ -2490,7 +2486,7 @@ function ze(t) {
|
|
|
2490
2486
|
* backoff curve, and a +/- 50% "jitter" that is calculated and added to the
|
|
2491
2487
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
2492
2488
|
* delays causing spikes of load to the backend.
|
|
2493
|
-
*/ var
|
|
2489
|
+
*/ var Qe = /** @class */ function() {
|
|
2494
2490
|
function t(
|
|
2495
2491
|
/**
|
|
2496
2492
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -2564,7 +2560,7 @@ function ze(t) {
|
|
|
2564
2560
|
/** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Y = function() {
|
|
2565
2561
|
return (Math.random() - .5) * this.j;
|
|
2566
2562
|
}, t;
|
|
2567
|
-
}(),
|
|
2563
|
+
}(), Ke = /** @class */ function(e) {
|
|
2568
2564
|
function n(t, n, r, i) {
|
|
2569
2565
|
var o = this;
|
|
2570
2566
|
return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
|
|
@@ -2624,49 +2620,49 @@ function ze(t) {
|
|
|
2624
2620
|
*/
|
|
2625
2621
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
2626
2622
|
// firestore-exp client.
|
|
2627
|
-
function
|
|
2623
|
+
function He(t, r) {
|
|
2628
2624
|
return e(this, void 0, void 0, (function() {
|
|
2629
2625
|
var e, i, o;
|
|
2630
2626
|
return n(this, (function(n) {
|
|
2631
2627
|
switch (n.label) {
|
|
2632
2628
|
case 0:
|
|
2633
|
-
return e = I(t), i =
|
|
2629
|
+
return e = I(t), i = je(e.q) + "/documents", o = {
|
|
2634
2630
|
writes: r.map((function(t) {
|
|
2635
2631
|
return function(t, e) {
|
|
2636
2632
|
var n;
|
|
2637
|
-
if (e instanceof
|
|
2638
|
-
update:
|
|
2639
|
-
}; else if (e instanceof Ie) n = {
|
|
2640
|
-
delete: Ce(t, e.key)
|
|
2633
|
+
if (e instanceof Te) n = {
|
|
2634
|
+
update: Re(t, e.key, e.value)
|
|
2641
2635
|
}; else if (e instanceof Ee) n = {
|
|
2642
|
-
|
|
2643
|
-
|
|
2636
|
+
delete: Oe(t, e.key)
|
|
2637
|
+
}; else if (e instanceof Se) n = {
|
|
2638
|
+
update: Re(t, e.key, e.data),
|
|
2639
|
+
updateMask: Be(e.fieldMask)
|
|
2644
2640
|
}; else {
|
|
2645
|
-
if (!(e instanceof
|
|
2641
|
+
if (!(e instanceof Ie)) return S();
|
|
2646
2642
|
n = {
|
|
2647
|
-
verify:
|
|
2643
|
+
verify: Oe(t, e.key)
|
|
2648
2644
|
};
|
|
2649
2645
|
}
|
|
2650
2646
|
return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
|
|
2651
2647
|
return function(t, e) {
|
|
2652
2648
|
var n = e.transform;
|
|
2653
|
-
if (n instanceof
|
|
2649
|
+
if (n instanceof me) return {
|
|
2654
2650
|
fieldPath: e.field.canonicalString(),
|
|
2655
2651
|
setToServerValue: "REQUEST_TIME"
|
|
2656
2652
|
};
|
|
2657
|
-
if (n instanceof
|
|
2653
|
+
if (n instanceof ye) return {
|
|
2658
2654
|
fieldPath: e.field.canonicalString(),
|
|
2659
2655
|
appendMissingElements: {
|
|
2660
2656
|
values: n.elements
|
|
2661
2657
|
}
|
|
2662
2658
|
};
|
|
2663
|
-
if (n instanceof
|
|
2659
|
+
if (n instanceof ve) return {
|
|
2664
2660
|
fieldPath: e.field.canonicalString(),
|
|
2665
2661
|
removeAllFromArray: {
|
|
2666
2662
|
values: n.elements
|
|
2667
2663
|
}
|
|
2668
2664
|
};
|
|
2669
|
-
if (n instanceof
|
|
2665
|
+
if (n instanceof ge) return {
|
|
2670
2666
|
fieldPath: e.field.canonicalString(),
|
|
2671
2667
|
increment: n.O
|
|
2672
2668
|
};
|
|
@@ -2674,7 +2670,7 @@ function We(t, r) {
|
|
|
2674
2670
|
}(0, t);
|
|
2675
2671
|
}))), e.precondition.isNone || (n.currentDocument = function(t, e) {
|
|
2676
2672
|
return void 0 !== e.updateTime ? {
|
|
2677
|
-
updateTime:
|
|
2673
|
+
updateTime: Ne(t, e.updateTime)
|
|
2678
2674
|
} : void 0 !== e.exists ? {
|
|
2679
2675
|
exists: e.exists
|
|
2680
2676
|
} : S();
|
|
@@ -2690,15 +2686,15 @@ function We(t, r) {
|
|
|
2690
2686
|
}));
|
|
2691
2687
|
}
|
|
2692
2688
|
|
|
2693
|
-
function
|
|
2689
|
+
function We(t, r) {
|
|
2694
2690
|
return e(this, void 0, void 0, (function() {
|
|
2695
2691
|
var e, i, o, a, s, u;
|
|
2696
2692
|
return n(this, (function(n) {
|
|
2697
2693
|
switch (n.label) {
|
|
2698
2694
|
case 0:
|
|
2699
|
-
return e = I(t), i =
|
|
2695
|
+
return e = I(t), i = je(e.q) + "/documents", o = {
|
|
2700
2696
|
documents: r.map((function(t) {
|
|
2701
|
-
return
|
|
2697
|
+
return Oe(e.q, t);
|
|
2702
2698
|
}))
|
|
2703
2699
|
}, [ 4 /*yield*/ , e.T("BatchGetDocuments", i, o) ];
|
|
2704
2700
|
|
|
@@ -2707,7 +2703,7 @@ function Ye(t, r) {
|
|
|
2707
2703
|
var n = function(t, e) {
|
|
2708
2704
|
return "found" in e ? function(t, e) {
|
|
2709
2705
|
E(!!e.found), e.found.name, e.found.updateTime;
|
|
2710
|
-
var n =
|
|
2706
|
+
var n = Ce(t, e.found.name), r = qe(e.found.updateTime), i = new zt({
|
|
2711
2707
|
mapValue: {
|
|
2712
2708
|
fields: e.found.fields
|
|
2713
2709
|
}
|
|
@@ -2715,7 +2711,7 @@ function Ye(t, r) {
|
|
|
2715
2711
|
return Qt.newFoundDocument(n, r, i);
|
|
2716
2712
|
}(t, e) : "missing" in e ? function(t, e) {
|
|
2717
2713
|
E(!!e.missing), E(!!e.readTime);
|
|
2718
|
-
var n =
|
|
2714
|
+
var n = Ce(t, e.missing), r = qe(e.readTime);
|
|
2719
2715
|
return Qt.newNoDocument(n, r);
|
|
2720
2716
|
}(t, e) : S();
|
|
2721
2717
|
}(e.q, t);
|
|
@@ -2729,7 +2725,7 @@ function Ye(t, r) {
|
|
|
2729
2725
|
}));
|
|
2730
2726
|
}
|
|
2731
2727
|
|
|
2732
|
-
function
|
|
2728
|
+
function Ye(t, r) {
|
|
2733
2729
|
return e(this, void 0, void 0, (function() {
|
|
2734
2730
|
var e, i;
|
|
2735
2731
|
return n(this, (function(n) {
|
|
@@ -2740,10 +2736,10 @@ function $e(t, r) {
|
|
|
2740
2736
|
var n = {
|
|
2741
2737
|
structuredQuery: {}
|
|
2742
2738
|
}, r = e.path;
|
|
2743
|
-
null !== e.collectionGroup ? (n.parent =
|
|
2739
|
+
null !== e.collectionGroup ? (n.parent = Le(t, r), n.structuredQuery.from = [ {
|
|
2744
2740
|
collectionId: e.collectionGroup,
|
|
2745
2741
|
allDescendants: !0
|
|
2746
|
-
} ]) : (n.parent =
|
|
2742
|
+
} ]) : (n.parent = Le(t, r.popLast()), n.structuredQuery.from = [ {
|
|
2747
2743
|
collectionId: r.lastSegment()
|
|
2748
2744
|
} ]);
|
|
2749
2745
|
var i = function(t) {
|
|
@@ -2754,34 +2750,34 @@ function $e(t, r) {
|
|
|
2754
2750
|
if ("==" /* EQUAL */ === t.op) {
|
|
2755
2751
|
if (Ut(t.value)) return {
|
|
2756
2752
|
unaryFilter: {
|
|
2757
|
-
field:
|
|
2753
|
+
field: Ue(t.field),
|
|
2758
2754
|
op: "IS_NAN"
|
|
2759
2755
|
}
|
|
2760
2756
|
};
|
|
2761
2757
|
if (xt(t.value)) return {
|
|
2762
2758
|
unaryFilter: {
|
|
2763
|
-
field:
|
|
2759
|
+
field: Ue(t.field),
|
|
2764
2760
|
op: "IS_NULL"
|
|
2765
2761
|
}
|
|
2766
2762
|
};
|
|
2767
2763
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2768
2764
|
if (Ut(t.value)) return {
|
|
2769
2765
|
unaryFilter: {
|
|
2770
|
-
field:
|
|
2766
|
+
field: Ue(t.field),
|
|
2771
2767
|
op: "IS_NOT_NAN"
|
|
2772
2768
|
}
|
|
2773
2769
|
};
|
|
2774
2770
|
if (xt(t.value)) return {
|
|
2775
2771
|
unaryFilter: {
|
|
2776
|
-
field:
|
|
2772
|
+
field: Ue(t.field),
|
|
2777
2773
|
op: "IS_NOT_NULL"
|
|
2778
2774
|
}
|
|
2779
2775
|
};
|
|
2780
2776
|
}
|
|
2781
2777
|
return {
|
|
2782
2778
|
fieldFilter: {
|
|
2783
|
-
field:
|
|
2784
|
-
op:
|
|
2779
|
+
field: Ue(t.field),
|
|
2780
|
+
op: xe(t.op),
|
|
2785
2781
|
value: t.value
|
|
2786
2782
|
}
|
|
2787
2783
|
};
|
|
@@ -2801,8 +2797,8 @@ function $e(t, r) {
|
|
|
2801
2797
|
// visible for testing
|
|
2802
2798
|
return function(t) {
|
|
2803
2799
|
return {
|
|
2804
|
-
field:
|
|
2805
|
-
direction:
|
|
2800
|
+
field: Ue(t.field),
|
|
2801
|
+
direction: Me(t.dir)
|
|
2806
2802
|
};
|
|
2807
2803
|
}(t);
|
|
2808
2804
|
}));
|
|
@@ -2822,7 +2818,7 @@ function $e(t, r) {
|
|
|
2822
2818
|
values: t.position
|
|
2823
2819
|
};
|
|
2824
2820
|
}(e.endAt)), n;
|
|
2825
|
-
}(e.q,
|
|
2821
|
+
}(e.q, he(r)), [ 4 /*yield*/ , e.T("RunQuery", i.parent, {
|
|
2826
2822
|
structuredQuery: i.structuredQuery
|
|
2827
2823
|
}) ];
|
|
2828
2824
|
|
|
@@ -2831,7 +2827,7 @@ function $e(t, r) {
|
|
|
2831
2827
|
return !!t.document;
|
|
2832
2828
|
})).map((function(t) {
|
|
2833
2829
|
return function(t, e, n) {
|
|
2834
|
-
var r =
|
|
2830
|
+
var r = Ce(t, e.name), i = qe(e.updateTime), o = new zt({
|
|
2835
2831
|
mapValue: {
|
|
2836
2832
|
fields: e.fields
|
|
2837
2833
|
}
|
|
@@ -2859,7 +2855,7 @@ function $e(t, r) {
|
|
|
2859
2855
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2860
2856
|
* See the License for the specific language governing permissions and
|
|
2861
2857
|
* limitations under the License.
|
|
2862
|
-
*/ var
|
|
2858
|
+
*/ var $e = new Map;
|
|
2863
2859
|
|
|
2864
2860
|
/**
|
|
2865
2861
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -2869,17 +2865,17 @@ function $e(t, r) {
|
|
|
2869
2865
|
* Returns an initialized and started Datastore for the given Firestore
|
|
2870
2866
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
2871
2867
|
* instance is terminated.
|
|
2872
|
-
*/ function
|
|
2868
|
+
*/ function Xe(t) {
|
|
2873
2869
|
if (t._terminated) throw new x(O, "The client has already been terminated.");
|
|
2874
|
-
if (
|
|
2870
|
+
if (!$e.has(t)) {
|
|
2875
2871
|
w("ComponentProvider", "Initializing Datastore");
|
|
2876
2872
|
var e = function(t) {
|
|
2877
2873
|
return new mt(t, fetch.bind(null));
|
|
2878
2874
|
}((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
|
|
2879
|
-
new $(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n =
|
|
2880
|
-
return new
|
|
2875
|
+
new $(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = ze(t._databaseId), r = function(t, e, n, r) {
|
|
2876
|
+
return new Ke(t, e, n, r);
|
|
2881
2877
|
}(t._authCredentials, t._appCheckCredentials, e, n);
|
|
2882
|
-
|
|
2878
|
+
$e.set(t, r);
|
|
2883
2879
|
}
|
|
2884
2880
|
var i, o, a, s;
|
|
2885
2881
|
/**
|
|
@@ -2897,7 +2893,7 @@ function $e(t, r) {
|
|
|
2897
2893
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2898
2894
|
* See the License for the specific language governing permissions and
|
|
2899
2895
|
* limitations under the License.
|
|
2900
|
-
*/ return
|
|
2896
|
+
*/ return $e.get(t);
|
|
2901
2897
|
}
|
|
2902
2898
|
|
|
2903
2899
|
/**
|
|
@@ -2908,7 +2904,7 @@ function $e(t, r) {
|
|
|
2908
2904
|
* A concrete type describing all the values that can be applied via a
|
|
2909
2905
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
2910
2906
|
* defaults can be supplied and the value can be checked for equality.
|
|
2911
|
-
*/ var
|
|
2907
|
+
*/ var Je = /** @class */ function() {
|
|
2912
2908
|
function t(t) {
|
|
2913
2909
|
var e;
|
|
2914
2910
|
if (void 0 === t.host) {
|
|
@@ -2928,14 +2924,14 @@ function $e(t, r) {
|
|
|
2928
2924
|
return t.prototype.isEqual = function(t) {
|
|
2929
2925
|
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;
|
|
2930
2926
|
}, t;
|
|
2931
|
-
}(),
|
|
2927
|
+
}(), Ze = /** @class */ function() {
|
|
2932
2928
|
/** @hideconstructor */
|
|
2933
2929
|
function t(t, e, n) {
|
|
2934
2930
|
this._authCredentials = e, this._appCheckCredentials = n,
|
|
2935
2931
|
/**
|
|
2936
2932
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
2937
2933
|
*/
|
|
2938
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
2934
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Je({}),
|
|
2939
2935
|
this._settingsFrozen = !1, t instanceof X ? this._databaseId = t : (this._app = t,
|
|
2940
2936
|
this._databaseId = function(t) {
|
|
2941
2937
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new x(V, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -2967,7 +2963,7 @@ function $e(t, r) {
|
|
|
2967
2963
|
configurable: !0
|
|
2968
2964
|
}), t.prototype._setSettings = function(t) {
|
|
2969
2965
|
if (this._settingsFrozen) throw new x(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.");
|
|
2970
|
-
this._settings = new
|
|
2966
|
+
this._settings = new Je(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
2971
2967
|
if (!t) return new G;
|
|
2972
2968
|
switch (t.type) {
|
|
2973
2969
|
case "gapi":
|
|
@@ -3005,8 +3001,8 @@ function $e(t, r) {
|
|
|
3005
3001
|
* Only ever called once.
|
|
3006
3002
|
*/
|
|
3007
3003
|
t.prototype._terminate = function() {
|
|
3008
|
-
return t = this, (e =
|
|
3009
|
-
|
|
3004
|
+
return t = this, (e = $e.get(t)) && (w("ComponentProvider", "Removing Datastore"),
|
|
3005
|
+
$e.delete(t), e.terminate()), Promise.resolve();
|
|
3010
3006
|
var t, e;
|
|
3011
3007
|
}, t;
|
|
3012
3008
|
}();
|
|
@@ -3031,7 +3027,7 @@ function $e(t, r) {
|
|
|
3031
3027
|
* The Cloud Firestore service interface.
|
|
3032
3028
|
*
|
|
3033
3029
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3034
|
-
*/ function
|
|
3030
|
+
*/ function tn(t, e) {
|
|
3035
3031
|
var n = _getProvider(t, "firestore/lite");
|
|
3036
3032
|
if (n.isInitialized()) throw new x(O, "Firestore can only be initialized once per app.");
|
|
3037
3033
|
return n.initialize({
|
|
@@ -3047,7 +3043,7 @@ function $e(t, r) {
|
|
|
3047
3043
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3048
3044
|
* instance is associated with.
|
|
3049
3045
|
* @returns The `Firestore` instance of the provided app.
|
|
3050
|
-
*/ function
|
|
3046
|
+
*/ function en(t) {
|
|
3051
3047
|
return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
|
|
3052
3048
|
}
|
|
3053
3049
|
|
|
@@ -3063,10 +3059,10 @@ function $e(t, r) {
|
|
|
3063
3059
|
* @param port - the emulator port (ex: 9000).
|
|
3064
3060
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3065
3061
|
* Security Rules.
|
|
3066
|
-
*/ function
|
|
3062
|
+
*/ function nn(t, e, n, r) {
|
|
3067
3063
|
var i;
|
|
3068
3064
|
void 0 === r && (r = {});
|
|
3069
|
-
var o = (t = st(t,
|
|
3065
|
+
var o = (t = st(t, Ze))._getSettings();
|
|
3070
3066
|
if ("firestore.googleapis.com" !== o.host && o.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3071
3067
|
t._setSettings(Object.assign(Object.assign({}, o), {
|
|
3072
3068
|
host: e + ":" + n,
|
|
@@ -3104,8 +3100,8 @@ function $e(t, r) {
|
|
|
3104
3100
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3105
3101
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3106
3102
|
* terminated.
|
|
3107
|
-
*/ function
|
|
3108
|
-
return t = st(t,
|
|
3103
|
+
*/ function rn(t) {
|
|
3104
|
+
return t = st(t, Ze), u(t.app, "firestore/lite"), t._delete()
|
|
3109
3105
|
/**
|
|
3110
3106
|
* @license
|
|
3111
3107
|
* Copyright 2020 Google LLC
|
|
@@ -3145,7 +3141,7 @@ function $e(t, r) {
|
|
|
3145
3141
|
*/;
|
|
3146
3142
|
}
|
|
3147
3143
|
|
|
3148
|
-
var
|
|
3144
|
+
var on = /** @class */ function() {
|
|
3149
3145
|
/** @hideconstructor */
|
|
3150
3146
|
function t(t,
|
|
3151
3147
|
/**
|
|
@@ -3186,14 +3182,14 @@ var an = /** @class */ function() {
|
|
|
3186
3182
|
* The collection this `DocumentReference` belongs to.
|
|
3187
3183
|
*/
|
|
3188
3184
|
get: function() {
|
|
3189
|
-
return new
|
|
3185
|
+
return new sn(this.firestore, this.converter, this._key.path.popLast());
|
|
3190
3186
|
},
|
|
3191
3187
|
enumerable: !1,
|
|
3192
3188
|
configurable: !0
|
|
3193
3189
|
}), t.prototype.withConverter = function(e) {
|
|
3194
3190
|
return new t(this.firestore, e, this._key);
|
|
3195
3191
|
}, t;
|
|
3196
|
-
}(),
|
|
3192
|
+
}(), an = /** @class */ function() {
|
|
3197
3193
|
// This is the lite version of the Query class in the main SDK.
|
|
3198
3194
|
/** @hideconstructor protected */
|
|
3199
3195
|
function t(t,
|
|
@@ -3208,7 +3204,7 @@ var an = /** @class */ function() {
|
|
|
3208
3204
|
return t.prototype.withConverter = function(e) {
|
|
3209
3205
|
return new t(this.firestore, e, this._query);
|
|
3210
3206
|
}, t;
|
|
3211
|
-
}(),
|
|
3207
|
+
}(), sn = /** @class */ function(e) {
|
|
3212
3208
|
/** @hideconstructor */
|
|
3213
3209
|
function n(t, n, r) {
|
|
3214
3210
|
var i = this;
|
|
@@ -3239,7 +3235,7 @@ var an = /** @class */ function() {
|
|
|
3239
3235
|
*/
|
|
3240
3236
|
get: function() {
|
|
3241
3237
|
var t = this._path.popLast();
|
|
3242
|
-
return t.isEmpty() ? null : new
|
|
3238
|
+
return t.isEmpty() ? null : new on(this.firestore,
|
|
3243
3239
|
/* converter= */ null, new nt(t));
|
|
3244
3240
|
},
|
|
3245
3241
|
enumerable: !1,
|
|
@@ -3247,20 +3243,20 @@ var an = /** @class */ function() {
|
|
|
3247
3243
|
}), n.prototype.withConverter = function(t) {
|
|
3248
3244
|
return new n(this.firestore, t, this._path);
|
|
3249
3245
|
}, n;
|
|
3250
|
-
}(
|
|
3246
|
+
}(an);
|
|
3251
3247
|
|
|
3252
3248
|
/**
|
|
3253
3249
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3254
3250
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3255
|
-
*/ function
|
|
3251
|
+
*/ function un(t, e) {
|
|
3256
3252
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3257
|
-
if (t = p(t), rt("collection", "path", e), t instanceof
|
|
3253
|
+
if (t = p(t), rt("collection", "path", e), t instanceof Ze) {
|
|
3258
3254
|
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3259
|
-
return ot(o), new
|
|
3255
|
+
return ot(o), new sn(t, /* converter= */ null, o);
|
|
3260
3256
|
}
|
|
3261
|
-
if (!(t instanceof
|
|
3257
|
+
if (!(t instanceof on || t instanceof sn)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3262
3258
|
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3263
|
-
return ot(a), new
|
|
3259
|
+
return ot(a), new sn(t.firestore,
|
|
3264
3260
|
/* converter= */ null, a);
|
|
3265
3261
|
}
|
|
3266
3262
|
|
|
@@ -3276,9 +3272,9 @@ var an = /** @class */ function() {
|
|
|
3276
3272
|
* collection or subcollection with this ID as the last segment of its path
|
|
3277
3273
|
* will be included. Cannot contain a slash.
|
|
3278
3274
|
* @returns The created `Query`.
|
|
3279
|
-
*/ function
|
|
3280
|
-
if (t = st(t,
|
|
3281
|
-
return new
|
|
3275
|
+
*/ function cn(t, e) {
|
|
3276
|
+
if (t = st(t, Ze), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new x(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
|
|
3277
|
+
return new an(t,
|
|
3282
3278
|
/* converter= */ null,
|
|
3283
3279
|
/**
|
|
3284
3280
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3289,19 +3285,19 @@ var an = /** @class */ function() {
|
|
|
3289
3285
|
}(e));
|
|
3290
3286
|
}
|
|
3291
3287
|
|
|
3292
|
-
function
|
|
3288
|
+
function ln(t, e) {
|
|
3293
3289
|
for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
|
|
3294
3290
|
if (t = p(t),
|
|
3295
3291
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3296
3292
|
// 'undefined' and 'null'.
|
|
3297
|
-
1 === arguments.length && (e = vt.R()), rt("doc", "path", e), t instanceof
|
|
3293
|
+
1 === arguments.length && (e = vt.R()), rt("doc", "path", e), t instanceof Ze) {
|
|
3298
3294
|
var o = Z.fromString.apply(Z, r([ e ], n));
|
|
3299
|
-
return it(o), new
|
|
3295
|
+
return it(o), new on(t,
|
|
3300
3296
|
/* converter= */ null, new nt(o));
|
|
3301
3297
|
}
|
|
3302
|
-
if (!(t instanceof
|
|
3298
|
+
if (!(t instanceof on || t instanceof sn)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3303
3299
|
var a = t._path.child(Z.fromString.apply(Z, r([ e ], n)));
|
|
3304
|
-
return it(a), new
|
|
3300
|
+
return it(a), new on(t.firestore, t instanceof sn ? t.converter : null, new nt(a));
|
|
3305
3301
|
}
|
|
3306
3302
|
|
|
3307
3303
|
/**
|
|
@@ -3311,8 +3307,8 @@ function fn(t, e) {
|
|
|
3311
3307
|
* @param right - A reference to compare.
|
|
3312
3308
|
* @returns true if the references point to the same location in the same
|
|
3313
3309
|
* Firestore database.
|
|
3314
|
-
*/ function
|
|
3315
|
-
return t = p(t), e = p(e), (t instanceof
|
|
3310
|
+
*/ function fn(t, e) {
|
|
3311
|
+
return t = p(t), e = p(e), (t instanceof on || t instanceof sn) && (e instanceof on || e instanceof sn) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
|
|
3316
3312
|
/**
|
|
3317
3313
|
* Returns true if the provided queries point to the same collection and apply
|
|
3318
3314
|
* the same constraints.
|
|
@@ -3324,8 +3320,8 @@ function fn(t, e) {
|
|
|
3324
3320
|
*/;
|
|
3325
3321
|
}
|
|
3326
3322
|
|
|
3327
|
-
function
|
|
3328
|
-
return t = p(t), e = p(e), t instanceof
|
|
3323
|
+
function hn(t, e) {
|
|
3324
|
+
return t = p(t), e = p(e), t instanceof an && e instanceof an && t.firestore === e.firestore && function(t, e) {
|
|
3329
3325
|
return function(t, e) {
|
|
3330
3326
|
if (t.limit !== e.limit) return !1;
|
|
3331
3327
|
if (t.orderBy.length !== e.orderBy.length) return !1;
|
|
@@ -3335,7 +3331,7 @@ function pn(t, e) {
|
|
|
3335
3331
|
i.op !== o.op || !i.field.isEqual(o.field) || !Ot(i.value, o.value)) return !1;
|
|
3336
3332
|
var i, o;
|
|
3337
3333
|
return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ae(t.startAt, e.startAt) && ae(t.endAt, e.endAt);
|
|
3338
|
-
}(
|
|
3334
|
+
}(he(t), he(e)) && t.limitType === e.limitType;
|
|
3339
3335
|
}(t._query, e._query) && t.converter === e.converter
|
|
3340
3336
|
/**
|
|
3341
3337
|
* @license
|
|
@@ -3363,7 +3359,7 @@ function pn(t, e) {
|
|
|
3363
3359
|
*/;
|
|
3364
3360
|
}
|
|
3365
3361
|
|
|
3366
|
-
var
|
|
3362
|
+
var pn = /** @class */ function() {
|
|
3367
3363
|
/**
|
|
3368
3364
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3369
3365
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3388,8 +3384,8 @@ var dn = /** @class */ function() {
|
|
|
3388
3384
|
/**
|
|
3389
3385
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3390
3386
|
* It can be used in queries to sort or filter by the document ID.
|
|
3391
|
-
*/ function
|
|
3392
|
-
return new
|
|
3387
|
+
*/ function dn() {
|
|
3388
|
+
return new pn("__name__");
|
|
3393
3389
|
}
|
|
3394
3390
|
|
|
3395
3391
|
/**
|
|
@@ -3410,7 +3406,7 @@ var dn = /** @class */ function() {
|
|
|
3410
3406
|
*/
|
|
3411
3407
|
/**
|
|
3412
3408
|
* An immutable object representing an array of bytes.
|
|
3413
|
-
*/ var
|
|
3409
|
+
*/ var mn = /** @class */ function() {
|
|
3414
3410
|
/** @hideconstructor */
|
|
3415
3411
|
function t(t) {
|
|
3416
3412
|
this._byteString = t;
|
|
@@ -3468,14 +3464,14 @@ var dn = /** @class */ function() {
|
|
|
3468
3464
|
t.prototype.isEqual = function(t) {
|
|
3469
3465
|
return this._byteString.isEqual(t._byteString);
|
|
3470
3466
|
}, t;
|
|
3471
|
-
}(),
|
|
3467
|
+
}(), yn =
|
|
3472
3468
|
/**
|
|
3473
3469
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3474
3470
|
* @hideconstructor
|
|
3475
3471
|
*/
|
|
3476
3472
|
function(t) {
|
|
3477
3473
|
this._methodName = t;
|
|
3478
|
-
},
|
|
3474
|
+
}, vn = /** @class */ function() {
|
|
3479
3475
|
/**
|
|
3480
3476
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3481
3477
|
* longitude values.
|
|
@@ -3528,21 +3524,21 @@ function(t) {
|
|
|
3528
3524
|
t.prototype._compareTo = function(t) {
|
|
3529
3525
|
return gt(this._lat, t._lat) || gt(this._long, t._long);
|
|
3530
3526
|
}, t;
|
|
3531
|
-
}(),
|
|
3527
|
+
}(), gn = /^__.*__$/, wn = /** @class */ function() {
|
|
3532
3528
|
function t(t, e, n) {
|
|
3533
3529
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3534
3530
|
}
|
|
3535
3531
|
return t.prototype.toMutation = function(t, e) {
|
|
3536
|
-
return null !== this.fieldMask ? new
|
|
3532
|
+
return null !== this.fieldMask ? new Se(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
|
|
3537
3533
|
}, t;
|
|
3538
|
-
}(),
|
|
3534
|
+
}(), bn = /** @class */ function() {
|
|
3539
3535
|
function t(t,
|
|
3540
3536
|
// The fieldMask does not include document transforms.
|
|
3541
3537
|
e, n) {
|
|
3542
3538
|
this.data = t, this.fieldMask = e, this.fieldTransforms = n;
|
|
3543
3539
|
}
|
|
3544
3540
|
return t.prototype.toMutation = function(t, e) {
|
|
3545
|
-
return new
|
|
3541
|
+
return new Se(t, this.data, this.fieldMask, e, this.fieldTransforms);
|
|
3546
3542
|
}, t;
|
|
3547
3543
|
}();
|
|
3548
3544
|
|
|
@@ -3565,7 +3561,7 @@ function(t) {
|
|
|
3565
3561
|
/**
|
|
3566
3562
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3567
3563
|
* or `update()`.
|
|
3568
|
-
*/ function
|
|
3564
|
+
*/ function _n(t) {
|
|
3569
3565
|
switch (t) {
|
|
3570
3566
|
case 0 /* Set */ :
|
|
3571
3567
|
// fall through
|
|
@@ -3583,7 +3579,7 @@ function(t) {
|
|
|
3583
3579
|
}
|
|
3584
3580
|
}
|
|
3585
3581
|
|
|
3586
|
-
/** A "context" object passed around while parsing user data. */ var
|
|
3582
|
+
/** A "context" object passed around while parsing user data. */ var Tn = /** @class */ function() {
|
|
3587
3583
|
/**
|
|
3588
3584
|
* Initializes a ParseContext with the given source and path.
|
|
3589
3585
|
*
|
|
@@ -3643,7 +3639,7 @@ function(t) {
|
|
|
3643
3639
|
rt: !0
|
|
3644
3640
|
});
|
|
3645
3641
|
}, t.prototype.ut = function(t) {
|
|
3646
|
-
return
|
|
3642
|
+
return Bn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3647
3643
|
},
|
|
3648
3644
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
|
|
3649
3645
|
return void 0 !== this.fieldMask.find((function(e) {
|
|
@@ -3657,15 +3653,15 @@ function(t) {
|
|
|
3657
3653
|
if (this.path) for (var t = 0; t < this.path.length; t++) this.st(this.path.get(t));
|
|
3658
3654
|
}, t.prototype.st = function(t) {
|
|
3659
3655
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3660
|
-
if (
|
|
3656
|
+
if (_n(this.tt) && gn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3661
3657
|
}, t;
|
|
3662
|
-
}(),
|
|
3658
|
+
}(), Sn = /** @class */ function() {
|
|
3663
3659
|
function t(t, e, n) {
|
|
3664
|
-
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n ||
|
|
3660
|
+
this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || ze(t)
|
|
3665
3661
|
/** Creates a new top-level parse context. */;
|
|
3666
3662
|
}
|
|
3667
3663
|
return t.prototype.ht = function(t, e, n, r) {
|
|
3668
|
-
return void 0 === r && (r = !1), new
|
|
3664
|
+
return void 0 === r && (r = !1), new Tn({
|
|
3669
3665
|
tt: t,
|
|
3670
3666
|
methodName: e,
|
|
3671
3667
|
at: n,
|
|
@@ -3679,30 +3675,30 @@ function(t) {
|
|
|
3679
3675
|
/**
|
|
3680
3676
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3681
3677
|
* classes.
|
|
3682
|
-
*/ function
|
|
3683
|
-
var e = t._freezeSettings(), n =
|
|
3684
|
-
return new
|
|
3678
|
+
*/ function En(t) {
|
|
3679
|
+
var e = t._freezeSettings(), n = ze(t._databaseId);
|
|
3680
|
+
return new Sn(t._databaseId, !!e.ignoreUndefinedProperties, n);
|
|
3685
3681
|
}
|
|
3686
3682
|
|
|
3687
|
-
/** Parse document data from a set() call. */ function
|
|
3683
|
+
/** Parse document data from a set() call. */ function In(t, e, n, r, i, o) {
|
|
3688
3684
|
void 0 === o && (o = {});
|
|
3689
3685
|
var a = t.ht(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
3690
|
-
|
|
3691
|
-
var s, u, c =
|
|
3686
|
+
Rn("Data must be an object, but it was:", a, r);
|
|
3687
|
+
var s, u, c = Ln(r, a);
|
|
3692
3688
|
if (o.merge) s = new Et(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
|
|
3693
3689
|
for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
|
|
3694
|
-
var p =
|
|
3690
|
+
var p = Mn(e, h[f], n);
|
|
3695
3691
|
if (!a.contains(p)) throw new x(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
|
|
3696
|
-
|
|
3692
|
+
Gn(l, p) || l.push(p);
|
|
3697
3693
|
}
|
|
3698
3694
|
s = new Et(l), u = a.fieldTransforms.filter((function(t) {
|
|
3699
3695
|
return s.covers(t.field);
|
|
3700
3696
|
}));
|
|
3701
3697
|
} else s = null, u = a.fieldTransforms;
|
|
3702
|
-
return new
|
|
3698
|
+
return new wn(new zt(c), s, u);
|
|
3703
3699
|
}
|
|
3704
3700
|
|
|
3705
|
-
var
|
|
3701
|
+
var An = /** @class */ function(e) {
|
|
3706
3702
|
function n() {
|
|
3707
3703
|
return null !== e && e.apply(this, arguments) || this;
|
|
3708
3704
|
}
|
|
@@ -3714,7 +3710,7 @@ var kn = /** @class */ function(e) {
|
|
|
3714
3710
|
}, n.prototype.isEqual = function(t) {
|
|
3715
3711
|
return t instanceof n;
|
|
3716
3712
|
}, n;
|
|
3717
|
-
}(
|
|
3713
|
+
}(yn);
|
|
3718
3714
|
|
|
3719
3715
|
/**
|
|
3720
3716
|
* Creates a child context for parsing SerializableFieldValues.
|
|
@@ -3731,8 +3727,8 @@ var kn = /** @class */ function(e) {
|
|
|
3731
3727
|
* context.
|
|
3732
3728
|
* @param context - The parent context.
|
|
3733
3729
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
3734
|
-
*/ function
|
|
3735
|
-
return new
|
|
3730
|
+
*/ function kn(t, e, n) {
|
|
3731
|
+
return new Tn({
|
|
3736
3732
|
tt: 3 /* Argument */ ,
|
|
3737
3733
|
at: e.settings.at,
|
|
3738
3734
|
methodName: t._methodName,
|
|
@@ -3740,101 +3736,101 @@ var kn = /** @class */ function(e) {
|
|
|
3740
3736
|
}, e.databaseId, e.q, e.ignoreUndefinedProperties);
|
|
3741
3737
|
}
|
|
3742
3738
|
|
|
3743
|
-
var
|
|
3739
|
+
var Vn = /** @class */ function(e) {
|
|
3744
3740
|
function n() {
|
|
3745
3741
|
return null !== e && e.apply(this, arguments) || this;
|
|
3746
3742
|
}
|
|
3747
3743
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3748
|
-
return new
|
|
3744
|
+
return new we(t.path, new me);
|
|
3749
3745
|
}, n.prototype.isEqual = function(t) {
|
|
3750
3746
|
return t instanceof n;
|
|
3751
3747
|
}, n;
|
|
3752
|
-
}(
|
|
3748
|
+
}(yn), Dn = /** @class */ function(e) {
|
|
3753
3749
|
function n(t, n) {
|
|
3754
3750
|
var r = this;
|
|
3755
3751
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3756
3752
|
}
|
|
3757
3753
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3758
|
-
var e =
|
|
3754
|
+
var e = kn(this, t,
|
|
3759
3755
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3760
|
-
return
|
|
3761
|
-
})), r = new
|
|
3762
|
-
return new
|
|
3756
|
+
return Cn(t, e);
|
|
3757
|
+
})), r = new ye(n);
|
|
3758
|
+
return new we(t.path, r);
|
|
3763
3759
|
}, n.prototype.isEqual = function(t) {
|
|
3764
3760
|
// TODO(mrschmidt): Implement isEquals
|
|
3765
3761
|
return this === t;
|
|
3766
3762
|
}, n;
|
|
3767
|
-
}(
|
|
3763
|
+
}(yn), Pn = /** @class */ function(e) {
|
|
3768
3764
|
function n(t, n) {
|
|
3769
3765
|
var r = this;
|
|
3770
3766
|
return (r = e.call(this, t) || this).lt = n, r;
|
|
3771
3767
|
}
|
|
3772
3768
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3773
|
-
var e =
|
|
3769
|
+
var e = kn(this, t,
|
|
3774
3770
|
/*array=*/ !0), n = this.lt.map((function(t) {
|
|
3775
|
-
return
|
|
3776
|
-
})), r = new
|
|
3777
|
-
return new
|
|
3771
|
+
return Cn(t, e);
|
|
3772
|
+
})), r = new ve(n);
|
|
3773
|
+
return new we(t.path, r);
|
|
3778
3774
|
}, n.prototype.isEqual = function(t) {
|
|
3779
3775
|
// TODO(mrschmidt): Implement isEquals
|
|
3780
3776
|
return this === t;
|
|
3781
3777
|
}, n;
|
|
3782
|
-
}(
|
|
3778
|
+
}(yn), Nn = /** @class */ function(e) {
|
|
3783
3779
|
function n(t, n) {
|
|
3784
3780
|
var r = this;
|
|
3785
3781
|
return (r = e.call(this, t) || this).ft = n, r;
|
|
3786
3782
|
}
|
|
3787
3783
|
return t(n, e), n.prototype._toFieldTransform = function(t) {
|
|
3788
|
-
var e = new
|
|
3789
|
-
return new
|
|
3784
|
+
var e = new ge(t.q, pe(t.q, this.ft));
|
|
3785
|
+
return new we(t.path, e);
|
|
3790
3786
|
}, n.prototype.isEqual = function(t) {
|
|
3791
3787
|
// TODO(mrschmidt): Implement isEquals
|
|
3792
3788
|
return this === t;
|
|
3793
3789
|
}, n;
|
|
3794
|
-
}(
|
|
3790
|
+
}(yn);
|
|
3795
3791
|
|
|
3796
|
-
/** Parse update data from an update() call. */ function
|
|
3792
|
+
/** Parse update data from an update() call. */ function qn(t, e, n, r) {
|
|
3797
3793
|
var i = t.ht(1 /* Update */ , e, n);
|
|
3798
|
-
|
|
3794
|
+
Rn("Data must be an object, but it was:", i, r);
|
|
3799
3795
|
var o = [], a = zt.empty();
|
|
3800
3796
|
St(r, (function(t, r) {
|
|
3801
|
-
var s =
|
|
3797
|
+
var s = Un(e, t, n);
|
|
3802
3798
|
// For Compat types, we have to "extract" the underlying types before
|
|
3803
3799
|
// performing validation.
|
|
3804
3800
|
r = p(r);
|
|
3805
3801
|
var u = i.it(s);
|
|
3806
|
-
if (r instanceof
|
|
3802
|
+
if (r instanceof An)
|
|
3807
3803
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3808
3804
|
o.push(s); else {
|
|
3809
|
-
var c =
|
|
3805
|
+
var c = Cn(r, u);
|
|
3810
3806
|
null != c && (o.push(s), a.set(s, c));
|
|
3811
3807
|
}
|
|
3812
3808
|
}));
|
|
3813
3809
|
var s = new Et(o);
|
|
3814
|
-
return new
|
|
3810
|
+
return new bn(a, s, i.fieldTransforms);
|
|
3815
3811
|
}
|
|
3816
3812
|
|
|
3817
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
3818
|
-
var a = t.ht(1 /* Update */ , e, n), s = [
|
|
3813
|
+
/** Parse update data from a list of field/value arguments. */ function Fn(t, e, n, r, i, o) {
|
|
3814
|
+
var a = t.ht(1 /* Update */ , e, n), s = [ Mn(e, r, n) ], u = [ i ];
|
|
3819
3815
|
if (o.length % 2 != 0) throw new x(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
|
|
3820
|
-
for (var c = 0; c < o.length; c += 2) s.push(
|
|
3816
|
+
for (var c = 0; c < o.length; c += 2) s.push(Mn(e, o[c])), u.push(o[c + 1]);
|
|
3821
3817
|
// We iterate in reverse order to pick the last value for a field if the
|
|
3822
3818
|
// user specified the field multiple times.
|
|
3823
|
-
for (var l = [], f = zt.empty(), h = s.length - 1; h >= 0; --h) if (!
|
|
3819
|
+
for (var l = [], f = zt.empty(), h = s.length - 1; h >= 0; --h) if (!Gn(l, s[h])) {
|
|
3824
3820
|
var d = s[h], m = u[h];
|
|
3825
3821
|
// For Compat types, we have to "extract" the underlying types before
|
|
3826
3822
|
// performing validation.
|
|
3827
3823
|
m = p(m);
|
|
3828
3824
|
var y = a.it(d);
|
|
3829
|
-
if (m instanceof
|
|
3825
|
+
if (m instanceof An)
|
|
3830
3826
|
// Add it to the field mask, but don't add anything to updateData.
|
|
3831
3827
|
l.push(d); else {
|
|
3832
|
-
var v =
|
|
3828
|
+
var v = Cn(m, y);
|
|
3833
3829
|
null != v && (l.push(d), f.set(d, v));
|
|
3834
3830
|
}
|
|
3835
3831
|
}
|
|
3836
3832
|
var g = new Et(l);
|
|
3837
|
-
return new
|
|
3833
|
+
return new bn(f, g, a.fieldTransforms);
|
|
3838
3834
|
}
|
|
3839
3835
|
|
|
3840
3836
|
/**
|
|
@@ -3843,8 +3839,8 @@ var Dn = /** @class */ function(e) {
|
|
|
3843
3839
|
*
|
|
3844
3840
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
3845
3841
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
3846
|
-
*/ function
|
|
3847
|
-
return void 0 === r && (r = !1),
|
|
3842
|
+
*/ function On(t, e, n, r) {
|
|
3843
|
+
return void 0 === r && (r = !1), Cn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
3848
3844
|
}
|
|
3849
3845
|
|
|
3850
3846
|
/**
|
|
@@ -3855,12 +3851,12 @@ var Dn = /** @class */ function(e) {
|
|
|
3855
3851
|
* the source of the data being parsed, etc.
|
|
3856
3852
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
3857
3853
|
* that should not be included in the resulting parsed data.
|
|
3858
|
-
*/ function
|
|
3859
|
-
if (
|
|
3854
|
+
*/ function Cn(t, e) {
|
|
3855
|
+
if (jn(
|
|
3860
3856
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
3861
3857
|
// from firestore-exp.
|
|
3862
|
-
t = p(t))) return
|
|
3863
|
-
if (t instanceof
|
|
3858
|
+
t = p(t))) return Rn("Unsupported field value:", e, t), Ln(t, e);
|
|
3859
|
+
if (t instanceof yn)
|
|
3864
3860
|
// FieldValues usually parse into transforms (except deleteField())
|
|
3865
3861
|
// in which case we do not want to include this field in our parsed data
|
|
3866
3862
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -3872,7 +3868,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3872
3868
|
*/
|
|
3873
3869
|
return function(t, e) {
|
|
3874
3870
|
// Sentinels are only supported with writes, and not within arrays.
|
|
3875
|
-
if (!
|
|
3871
|
+
if (!_n(e.tt)) throw e.ut(t._methodName + "() can only be used with update() and set()");
|
|
3876
3872
|
if (!e.path) throw e.ut(t._methodName + "() is not currently supported inside arrays");
|
|
3877
3873
|
var n = t._toFieldTransform(e);
|
|
3878
3874
|
n && e.fieldTransforms.push(n);
|
|
@@ -3895,7 +3891,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3895
3891
|
if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
|
|
3896
3892
|
return function(t, e) {
|
|
3897
3893
|
for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
|
|
3898
|
-
var a =
|
|
3894
|
+
var a = Cn(o[i], e.ot(r));
|
|
3899
3895
|
null == a && (
|
|
3900
3896
|
// Just include nulls in the array for fields being replaced with a
|
|
3901
3897
|
// sentinel.
|
|
@@ -3914,7 +3910,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3914
3910
|
if (null === (t = p(t))) return {
|
|
3915
3911
|
nullValue: "NULL_VALUE"
|
|
3916
3912
|
};
|
|
3917
|
-
if ("number" == typeof t) return
|
|
3913
|
+
if ("number" == typeof t) return pe(e.q, t);
|
|
3918
3914
|
if ("boolean" == typeof t) return {
|
|
3919
3915
|
booleanValue: t
|
|
3920
3916
|
};
|
|
@@ -3924,7 +3920,7 @@ var Dn = /** @class */ function(e) {
|
|
|
3924
3920
|
if (t instanceof Date) {
|
|
3925
3921
|
var n = bt.fromDate(t);
|
|
3926
3922
|
return {
|
|
3927
|
-
timestampValue:
|
|
3923
|
+
timestampValue: De(e.q, n)
|
|
3928
3924
|
};
|
|
3929
3925
|
}
|
|
3930
3926
|
if (t instanceof bt) {
|
|
@@ -3933,30 +3929,30 @@ var Dn = /** @class */ function(e) {
|
|
|
3933
3929
|
// truncation immediately without waiting for the backend to do that.
|
|
3934
3930
|
var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
|
|
3935
3931
|
return {
|
|
3936
|
-
timestampValue:
|
|
3932
|
+
timestampValue: De(e.q, r)
|
|
3937
3933
|
};
|
|
3938
3934
|
}
|
|
3939
|
-
if (t instanceof
|
|
3935
|
+
if (t instanceof vn) return {
|
|
3940
3936
|
geoPointValue: {
|
|
3941
3937
|
latitude: t.latitude,
|
|
3942
3938
|
longitude: t.longitude
|
|
3943
3939
|
}
|
|
3944
3940
|
};
|
|
3945
|
-
if (t instanceof
|
|
3946
|
-
bytesValue:
|
|
3941
|
+
if (t instanceof mn) return {
|
|
3942
|
+
bytesValue: Pe(e.q, t._byteString)
|
|
3947
3943
|
};
|
|
3948
|
-
if (t instanceof
|
|
3944
|
+
if (t instanceof on) {
|
|
3949
3945
|
var i = e.databaseId, o = t.firestore._databaseId;
|
|
3950
3946
|
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);
|
|
3951
3947
|
return {
|
|
3952
|
-
referenceValue:
|
|
3948
|
+
referenceValue: Fe(t.firestore._databaseId || e.databaseId, t._key.path)
|
|
3953
3949
|
};
|
|
3954
3950
|
}
|
|
3955
3951
|
throw e.ut("Unsupported field value: " + at(t));
|
|
3956
3952
|
}(t, e);
|
|
3957
3953
|
}
|
|
3958
3954
|
|
|
3959
|
-
function
|
|
3955
|
+
function Ln(t, e) {
|
|
3960
3956
|
var n = {};
|
|
3961
3957
|
return function(t) {
|
|
3962
3958
|
for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
|
|
@@ -3965,7 +3961,7 @@ function jn(t, e) {
|
|
|
3965
3961
|
// If we encounter an empty object, we explicitly add it to the update
|
|
3966
3962
|
// mask to ensure that the server creates a map entry.
|
|
3967
3963
|
e.path && e.path.length > 0 && e.fieldMask.push(e.path) : St(t, (function(t, r) {
|
|
3968
|
-
var i =
|
|
3964
|
+
var i = Cn(r, e.nt(t));
|
|
3969
3965
|
null != i && (n[t] = i);
|
|
3970
3966
|
})), {
|
|
3971
3967
|
mapValue: {
|
|
@@ -3974,12 +3970,12 @@ function jn(t, e) {
|
|
|
3974
3970
|
};
|
|
3975
3971
|
}
|
|
3976
3972
|
|
|
3977
|
-
function
|
|
3978
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof
|
|
3973
|
+
function jn(t) {
|
|
3974
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof vn || t instanceof mn || t instanceof on || t instanceof yn);
|
|
3979
3975
|
}
|
|
3980
3976
|
|
|
3981
|
-
function
|
|
3982
|
-
if (!
|
|
3977
|
+
function Rn(t, e, n) {
|
|
3978
|
+
if (!jn(n) || !function(t) {
|
|
3983
3979
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
3984
3980
|
}(n)) {
|
|
3985
3981
|
var r = at(n);
|
|
@@ -3989,20 +3985,20 @@ function Mn(t, e, n) {
|
|
|
3989
3985
|
|
|
3990
3986
|
/**
|
|
3991
3987
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
3992
|
-
*/ function
|
|
3988
|
+
*/ function Mn(t, e, n) {
|
|
3993
3989
|
if (
|
|
3994
3990
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
3995
3991
|
// FieldPath.
|
|
3996
|
-
(e = p(e)) instanceof
|
|
3997
|
-
if ("string" == typeof e) return
|
|
3998
|
-
throw
|
|
3992
|
+
(e = p(e)) instanceof pn) return e._internalPath;
|
|
3993
|
+
if ("string" == typeof e) return Un(t, e);
|
|
3994
|
+
throw Bn("Field path arguments must be of type string or ", t,
|
|
3999
3995
|
/* hasConverter= */ !1,
|
|
4000
3996
|
/* path= */ void 0, n);
|
|
4001
3997
|
}
|
|
4002
3998
|
|
|
4003
3999
|
/**
|
|
4004
4000
|
* Matches any characters in a field path string that are reserved.
|
|
4005
|
-
*/ var
|
|
4001
|
+
*/ var xn = new RegExp("[~\\*/\\[\\]]");
|
|
4006
4002
|
|
|
4007
4003
|
/**
|
|
4008
4004
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4012,20 +4008,20 @@ function Mn(t, e, n) {
|
|
|
4012
4008
|
* split on dots.
|
|
4013
4009
|
* @param targetDoc - The document against which the field path will be
|
|
4014
4010
|
* evaluated.
|
|
4015
|
-
*/ function
|
|
4016
|
-
if (e.search(
|
|
4011
|
+
*/ function Un(t, e, n) {
|
|
4012
|
+
if (e.search(xn) >= 0) throw Bn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
|
|
4017
4013
|
/* hasConverter= */ !1,
|
|
4018
4014
|
/* path= */ void 0, n);
|
|
4019
4015
|
try {
|
|
4020
|
-
return (new (
|
|
4016
|
+
return (new (pn.bind.apply(pn, r([ void 0 ], e.split(".")))))._internalPath;
|
|
4021
4017
|
} catch (r) {
|
|
4022
|
-
throw
|
|
4018
|
+
throw Bn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
|
|
4023
4019
|
/* hasConverter= */ !1,
|
|
4024
4020
|
/* path= */ void 0, n);
|
|
4025
4021
|
}
|
|
4026
4022
|
}
|
|
4027
4023
|
|
|
4028
|
-
function
|
|
4024
|
+
function Bn(t, e, n, r, i) {
|
|
4029
4025
|
var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
|
|
4030
4026
|
n && (s += " (via `toFirestore()`)");
|
|
4031
4027
|
var u = "";
|
|
@@ -4034,7 +4030,7 @@ function Gn(t, e, n, r, i) {
|
|
|
4034
4030
|
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
|
|
4035
4031
|
}
|
|
4036
4032
|
|
|
4037
|
-
function
|
|
4033
|
+
function Gn(t, e) {
|
|
4038
4034
|
return t.some((function(t) {
|
|
4039
4035
|
return t.isEqual(e);
|
|
4040
4036
|
}));
|
|
@@ -4064,7 +4060,7 @@ function zn(t, e) {
|
|
|
4064
4060
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4065
4061
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4066
4062
|
* explicitly verify a document's existence.
|
|
4067
|
-
*/ var
|
|
4063
|
+
*/ var zn = /** @class */ function() {
|
|
4068
4064
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4069
4065
|
// the legacy SDK. The changes are:
|
|
4070
4066
|
// - No support for SnapshotMetadata.
|
|
@@ -4085,7 +4081,7 @@ function zn(t, e) {
|
|
|
4085
4081
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4086
4082
|
*/
|
|
4087
4083
|
get: function() {
|
|
4088
|
-
return new
|
|
4084
|
+
return new on(this._firestore, this._converter, this._key);
|
|
4089
4085
|
},
|
|
4090
4086
|
enumerable: !1,
|
|
4091
4087
|
configurable: !0
|
|
@@ -4110,7 +4106,7 @@ function zn(t, e) {
|
|
|
4110
4106
|
if (this._converter) {
|
|
4111
4107
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4112
4108
|
// if a converter has been provided.
|
|
4113
|
-
var t = new
|
|
4109
|
+
var t = new Qn(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4114
4110
|
/* converter= */ null);
|
|
4115
4111
|
return this._converter.fromFirestore(t);
|
|
4116
4112
|
}
|
|
@@ -4130,11 +4126,11 @@ function zn(t, e) {
|
|
|
4130
4126
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4131
4127
|
t.prototype.get = function(t) {
|
|
4132
4128
|
if (this._document) {
|
|
4133
|
-
var e = this._document.data.field(
|
|
4129
|
+
var e = this._document.data.field(Wn("DocumentSnapshot.get", t));
|
|
4134
4130
|
if (null !== e) return this._userDataWriter.convertValue(e);
|
|
4135
4131
|
}
|
|
4136
4132
|
}, t;
|
|
4137
|
-
}(),
|
|
4133
|
+
}(), Qn = /** @class */ function(e) {
|
|
4138
4134
|
function n() {
|
|
4139
4135
|
return null !== e && e.apply(this, arguments) || this;
|
|
4140
4136
|
}
|
|
@@ -4146,7 +4142,7 @@ function zn(t, e) {
|
|
|
4146
4142
|
*/ return t(n, e), n.prototype.data = function() {
|
|
4147
4143
|
return e.prototype.data.call(this);
|
|
4148
4144
|
}, n;
|
|
4149
|
-
}(
|
|
4145
|
+
}(zn), Kn = /** @class */ function() {
|
|
4150
4146
|
/** @hideconstructor */
|
|
4151
4147
|
function t(t, e) {
|
|
4152
4148
|
this._docs = e, this.query = t;
|
|
@@ -4200,15 +4196,15 @@ function zn(t, e) {
|
|
|
4200
4196
|
* @param right - A snapshot to compare.
|
|
4201
4197
|
* @returns true if the snapshots are equal.
|
|
4202
4198
|
*/
|
|
4203
|
-
function
|
|
4204
|
-
return t = p(t), e = p(e), t instanceof
|
|
4199
|
+
function Hn(t, e) {
|
|
4200
|
+
return t = p(t), e = p(e), t instanceof zn && e instanceof zn ? 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 Kn && e instanceof Kn && hn(t.query, e.query) && wt(t.docs, e.docs, Hn)
|
|
4205
4201
|
/**
|
|
4206
4202
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4207
4203
|
*/;
|
|
4208
4204
|
}
|
|
4209
4205
|
|
|
4210
|
-
function
|
|
4211
|
-
return "string" == typeof e ?
|
|
4206
|
+
function Wn(t, e) {
|
|
4207
|
+
return "string" == typeof e ? Un(t, e) : e instanceof pn ? e._internalPath : e._delegate._internalPath;
|
|
4212
4208
|
}
|
|
4213
4209
|
|
|
4214
4210
|
/**
|
|
@@ -4234,7 +4230,7 @@ function Yn(t, e) {
|
|
|
4234
4230
|
* endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
|
|
4235
4231
|
* can then be passed to {@link query} to create a new query instance that
|
|
4236
4232
|
* also contains this `QueryConstraint`.
|
|
4237
|
-
*/ var
|
|
4233
|
+
*/ var Yn = function() {};
|
|
4238
4234
|
|
|
4239
4235
|
/**
|
|
4240
4236
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4244,7 +4240,7 @@ function Yn(t, e) {
|
|
|
4244
4240
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4245
4241
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4246
4242
|
* existing or new constraints.
|
|
4247
|
-
*/ function
|
|
4243
|
+
*/ function $n(t) {
|
|
4248
4244
|
for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
|
|
4249
4245
|
for (var r = 0, i = e; r < i.length; r++) {
|
|
4250
4246
|
var o = i[r];
|
|
@@ -4253,39 +4249,39 @@ function Yn(t, e) {
|
|
|
4253
4249
|
return t;
|
|
4254
4250
|
}
|
|
4255
4251
|
|
|
4256
|
-
var
|
|
4252
|
+
var Xn = /** @class */ function(e) {
|
|
4257
4253
|
function n(t, n, r) {
|
|
4258
4254
|
var i = this;
|
|
4259
4255
|
return (i = e.call(this) || this).dt = t, i.wt = n, i.yt = r, i.type = "where",
|
|
4260
4256
|
i;
|
|
4261
4257
|
}
|
|
4262
4258
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4263
|
-
var e =
|
|
4259
|
+
var e = En(t.firestore), n = function(t, e, n, r, i, o, a) {
|
|
4264
4260
|
var s;
|
|
4265
4261
|
if (i.isKeyField()) {
|
|
4266
4262
|
if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new x(V, "Invalid Query. You can't perform '" + o + "' queries on documentId().");
|
|
4267
4263
|
if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
|
|
4268
|
-
|
|
4264
|
+
hr(a, o);
|
|
4269
4265
|
for (var u = [], c = 0, l = a; c < l.length; c++) {
|
|
4270
4266
|
var f = l[c];
|
|
4271
|
-
u.push(
|
|
4267
|
+
u.push(fr(r, t, f));
|
|
4272
4268
|
}
|
|
4273
4269
|
s = {
|
|
4274
4270
|
arrayValue: {
|
|
4275
4271
|
values: u
|
|
4276
4272
|
}
|
|
4277
4273
|
};
|
|
4278
|
-
} else s =
|
|
4279
|
-
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o ||
|
|
4280
|
-
s =
|
|
4274
|
+
} else s = fr(r, t, a);
|
|
4275
|
+
} else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || hr(a, o),
|
|
4276
|
+
s = On(n, "where", a,
|
|
4281
4277
|
/* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
|
|
4282
4278
|
var h = Wt.create(i, o, s);
|
|
4283
4279
|
return function(t, e) {
|
|
4284
4280
|
if (e.N()) {
|
|
4285
|
-
var n =
|
|
4281
|
+
var n = ce(t);
|
|
4286
4282
|
if (null !== n && !n.isEqual(e.field)) throw new x(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() + "'");
|
|
4287
|
-
var r =
|
|
4288
|
-
null !== r &&
|
|
4283
|
+
var r = ue(t);
|
|
4284
|
+
null !== r && pr(t, e.field, r);
|
|
4289
4285
|
}
|
|
4290
4286
|
var i = function(t, e) {
|
|
4291
4287
|
for (var n = 0, r = t.filters; n < r.length; n++) {
|
|
@@ -4332,12 +4328,12 @@ var Jn = /** @class */ function(e) {
|
|
|
4332
4328
|
throw i === e.op ? new x(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new x(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
|
|
4333
4329
|
}(t, h), h;
|
|
4334
4330
|
}(t._query, 0, e, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4335
|
-
return new
|
|
4331
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4336
4332
|
var n = t.filters.concat([ e ]);
|
|
4337
4333
|
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4338
4334
|
}(t._query, n));
|
|
4339
4335
|
}, n;
|
|
4340
|
-
}(
|
|
4336
|
+
}(Yn);
|
|
4341
4337
|
|
|
4342
4338
|
/**
|
|
4343
4339
|
* Creates a {@link QueryConstraint} that enforces that documents must contain the
|
|
@@ -4349,12 +4345,12 @@ var Jn = /** @class */ function(e) {
|
|
|
4349
4345
|
* "<=", "!=").
|
|
4350
4346
|
* @param value - The value for comparison
|
|
4351
4347
|
* @returns The created {@link Query}.
|
|
4352
|
-
*/ function
|
|
4353
|
-
var r = e, i =
|
|
4354
|
-
return new
|
|
4348
|
+
*/ function Jn(t, e, n) {
|
|
4349
|
+
var r = e, i = Wn("where", t);
|
|
4350
|
+
return new Xn(i, r, n);
|
|
4355
4351
|
}
|
|
4356
4352
|
|
|
4357
|
-
var
|
|
4353
|
+
var Zn = /** @class */ function(e) {
|
|
4358
4354
|
function n(t, n) {
|
|
4359
4355
|
var r = this;
|
|
4360
4356
|
return (r = e.call(this) || this).dt = t, r._t = n, r.type = "orderBy", r;
|
|
@@ -4365,20 +4361,20 @@ var tr = /** @class */ function(e) {
|
|
|
4365
4361
|
if (null !== t.endAt) throw new x(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
|
|
4366
4362
|
var r = new ie(e, n);
|
|
4367
4363
|
return function(t, e) {
|
|
4368
|
-
if (null ===
|
|
4364
|
+
if (null === ue(t)) {
|
|
4369
4365
|
// This is the first order by. It must match any inequality.
|
|
4370
|
-
var n =
|
|
4371
|
-
null !== n &&
|
|
4366
|
+
var n = ce(t);
|
|
4367
|
+
null !== n && pr(t, n, e.field);
|
|
4372
4368
|
}
|
|
4373
4369
|
}(t, r), r;
|
|
4374
4370
|
}(t._query, this.dt, this._t);
|
|
4375
|
-
return new
|
|
4371
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4376
4372
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4377
4373
|
var n = t.explicitOrderBy.concat([ e ]);
|
|
4378
4374
|
return new se(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
4379
4375
|
}(t._query, e));
|
|
4380
4376
|
}, n;
|
|
4381
|
-
}(
|
|
4377
|
+
}(Yn);
|
|
4382
4378
|
|
|
4383
4379
|
/**
|
|
4384
4380
|
* Creates a {@link QueryConstraint} that sorts the query result by the
|
|
@@ -4388,31 +4384,31 @@ var tr = /** @class */ function(e) {
|
|
|
4388
4384
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4389
4385
|
* not specified, order will be ascending.
|
|
4390
4386
|
* @returns The created {@link Query}.
|
|
4391
|
-
*/ function
|
|
4387
|
+
*/ function tr(t, e) {
|
|
4392
4388
|
void 0 === e && (e = "asc");
|
|
4393
|
-
var n = e, r =
|
|
4394
|
-
return new
|
|
4389
|
+
var n = e, r = Wn("orderBy", t);
|
|
4390
|
+
return new Zn(r, n);
|
|
4395
4391
|
}
|
|
4396
4392
|
|
|
4397
|
-
var
|
|
4393
|
+
var er = /** @class */ function(e) {
|
|
4398
4394
|
function n(t, n, r) {
|
|
4399
4395
|
var i = this;
|
|
4400
4396
|
return (i = e.call(this) || this).type = t, i.gt = n, i.vt = r, i;
|
|
4401
4397
|
}
|
|
4402
4398
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4403
|
-
return new
|
|
4399
|
+
return new an(t.firestore, t.converter, function(t, e, n) {
|
|
4404
4400
|
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
|
|
4405
4401
|
}(t._query, this.gt, this.vt));
|
|
4406
4402
|
}, n;
|
|
4407
|
-
}(
|
|
4403
|
+
}(Yn);
|
|
4408
4404
|
|
|
4409
4405
|
/**
|
|
4410
4406
|
* Creates a {@link QueryConstraint} that only returns the first matching documents.
|
|
4411
4407
|
*
|
|
4412
4408
|
* @param limit - The maximum number of items to return.
|
|
4413
4409
|
* @returns The created {@link Query}.
|
|
4414
|
-
*/ function
|
|
4415
|
-
return ut("limit", t), new
|
|
4410
|
+
*/ function nr(t) {
|
|
4411
|
+
return ut("limit", t), new er("limit", t, "F" /* First */)
|
|
4416
4412
|
/**
|
|
4417
4413
|
* Creates a {@link QueryConstraint} that only returns the last matching documents.
|
|
4418
4414
|
*
|
|
@@ -4424,61 +4420,61 @@ var nr = /** @class */ function(e) {
|
|
|
4424
4420
|
*/;
|
|
4425
4421
|
}
|
|
4426
4422
|
|
|
4427
|
-
function
|
|
4428
|
-
return ut("limitToLast", t), new
|
|
4423
|
+
function rr(t) {
|
|
4424
|
+
return ut("limitToLast", t), new er("limitToLast", t, "L" /* Last */);
|
|
4429
4425
|
}
|
|
4430
4426
|
|
|
4431
|
-
var
|
|
4427
|
+
var ir = /** @class */ function(e) {
|
|
4432
4428
|
function n(t, n, r) {
|
|
4433
4429
|
var i = this;
|
|
4434
4430
|
return (i = e.call(this) || this).type = t, i.bt = n, i.Et = r, i;
|
|
4435
4431
|
}
|
|
4436
4432
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4437
|
-
var e =
|
|
4438
|
-
return new
|
|
4433
|
+
var e = lr(t, this.type, this.bt, this.Et);
|
|
4434
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4439
4435
|
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
|
|
4440
4436
|
}(t._query, e));
|
|
4441
4437
|
}, n;
|
|
4442
|
-
}(
|
|
4438
|
+
}(Yn);
|
|
4443
4439
|
|
|
4444
|
-
function
|
|
4440
|
+
function or() {
|
|
4445
4441
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4446
|
-
return new
|
|
4442
|
+
return new ir("startAt", t,
|
|
4447
4443
|
/*inclusive=*/ !0);
|
|
4448
4444
|
}
|
|
4449
4445
|
|
|
4450
|
-
function
|
|
4446
|
+
function ar() {
|
|
4451
4447
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4452
|
-
return new
|
|
4448
|
+
return new ir("startAfter", t,
|
|
4453
4449
|
/*inclusive=*/ !1);
|
|
4454
4450
|
}
|
|
4455
4451
|
|
|
4456
|
-
var
|
|
4452
|
+
var sr = /** @class */ function(e) {
|
|
4457
4453
|
function n(t, n, r) {
|
|
4458
4454
|
var i = this;
|
|
4459
4455
|
return (i = e.call(this) || this).type = t, i.bt = n, i.Et = r, i;
|
|
4460
4456
|
}
|
|
4461
4457
|
return t(n, e), n.prototype._apply = function(t) {
|
|
4462
|
-
var e =
|
|
4463
|
-
return new
|
|
4458
|
+
var e = lr(t, this.type, this.bt, this.Et);
|
|
4459
|
+
return new an(t.firestore, t.converter, function(t, e) {
|
|
4464
4460
|
return new se(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
|
|
4465
4461
|
}(t._query, e));
|
|
4466
4462
|
}, n;
|
|
4467
|
-
}(
|
|
4463
|
+
}(Yn);
|
|
4468
4464
|
|
|
4469
|
-
function
|
|
4465
|
+
function ur() {
|
|
4470
4466
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4471
|
-
return new
|
|
4467
|
+
return new sr("endBefore", t,
|
|
4472
4468
|
/*inclusive=*/ !1);
|
|
4473
4469
|
}
|
|
4474
4470
|
|
|
4475
|
-
function
|
|
4471
|
+
function cr() {
|
|
4476
4472
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4477
|
-
return new
|
|
4473
|
+
return new sr("endAt", t, /*inclusive=*/ !0);
|
|
4478
4474
|
}
|
|
4479
4475
|
|
|
4480
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4481
|
-
if (n[0] = p(n[0]), n[0] instanceof
|
|
4476
|
+
/** Helper function to create a bound from a document or fields */ function lr(t, e, n, r) {
|
|
4477
|
+
if (n[0] = p(n[0]), n[0] instanceof zn) return function(t, e, n, r, i) {
|
|
4482
4478
|
if (!r) throw new x(P, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
|
|
4483
4479
|
// Because people expect to continue/end a query at the exact document
|
|
4484
4480
|
// provided, we need to use the implicit sort order rather than the explicit
|
|
@@ -4487,7 +4483,7 @@ function lr() {
|
|
|
4487
4483
|
// the provided document. Without the key (by using the explicit sort
|
|
4488
4484
|
// orders), multiple documents could match the position, yielding duplicate
|
|
4489
4485
|
// results.
|
|
4490
|
-
for (var o = [], a = 0, s =
|
|
4486
|
+
for (var o = [], a = 0, s = fe(t); a < s.length; a++) {
|
|
4491
4487
|
var u = s[a];
|
|
4492
4488
|
if (u.field.isKeyField()) o.push(Rt(e, r.key)); else {
|
|
4493
4489
|
var c = r.data.field(u.field);
|
|
@@ -4501,7 +4497,7 @@ function lr() {
|
|
|
4501
4497
|
}
|
|
4502
4498
|
return new re(o, i);
|
|
4503
4499
|
}(t._query, t.firestore._databaseId, e, n[0]._document, r);
|
|
4504
|
-
var i =
|
|
4500
|
+
var i = En(t.firestore);
|
|
4505
4501
|
return function(t, e, n, r, i, o) {
|
|
4506
4502
|
// Use explicit order by's because it has to match the query the user made
|
|
4507
4503
|
var a = t.explicitOrderBy;
|
|
@@ -4510,13 +4506,13 @@ function lr() {
|
|
|
4510
4506
|
var c = i[u];
|
|
4511
4507
|
if (a[u].field.isKeyField()) {
|
|
4512
4508
|
if ("string" != typeof c) throw new x(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
|
|
4513
|
-
if (!
|
|
4509
|
+
if (!le(t) && -1 !== c.indexOf("/")) throw new x(V, "Invalid query. When querying a collection and ordering by documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
|
|
4514
4510
|
var l = t.path.child(Z.fromString(c));
|
|
4515
4511
|
if (!nt.isDocumentKey(l)) throw new x(V, "Invalid query. When querying a collection group and ordering by 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.");
|
|
4516
4512
|
var f = new nt(l);
|
|
4517
4513
|
s.push(Rt(e, f));
|
|
4518
4514
|
} else {
|
|
4519
|
-
var h =
|
|
4515
|
+
var h = On(n, r, c);
|
|
4520
4516
|
s.push(h);
|
|
4521
4517
|
}
|
|
4522
4518
|
}
|
|
@@ -4524,27 +4520,27 @@ function lr() {
|
|
|
4524
4520
|
}(t._query, t.firestore._databaseId, i, e, n, r);
|
|
4525
4521
|
}
|
|
4526
4522
|
|
|
4527
|
-
function
|
|
4523
|
+
function fr(t, e, n) {
|
|
4528
4524
|
if ("string" == typeof (n = p(n))) {
|
|
4529
4525
|
if ("" === n) throw new x(V, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4530
|
-
if (!
|
|
4526
|
+
if (!le(e) && -1 !== n.indexOf("/")) throw new x(V, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
|
|
4531
4527
|
var r = e.path.child(Z.fromString(n));
|
|
4532
4528
|
if (!nt.isDocumentKey(r)) throw new x(V, "Invalid query. When querying a collection group by 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 + ").");
|
|
4533
4529
|
return Rt(t, new nt(r));
|
|
4534
4530
|
}
|
|
4535
|
-
if (n instanceof
|
|
4531
|
+
if (n instanceof on) return Rt(t, n._key);
|
|
4536
4532
|
throw new x(V, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: " + at(n) + ".");
|
|
4537
4533
|
}
|
|
4538
4534
|
|
|
4539
4535
|
/**
|
|
4540
4536
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4541
4537
|
* array requirements.
|
|
4542
|
-
*/ function
|
|
4538
|
+
*/ function hr(t, e) {
|
|
4543
4539
|
if (!Array.isArray(t) || 0 === t.length) throw new x(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
|
|
4544
4540
|
if (t.length > 10) throw new x(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
|
|
4545
4541
|
}
|
|
4546
4542
|
|
|
4547
|
-
function
|
|
4543
|
+
function pr(t, e, n) {
|
|
4548
4544
|
if (!n.isEqual(e)) throw new x(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.");
|
|
4549
4545
|
}
|
|
4550
4546
|
|
|
@@ -4594,23 +4590,23 @@ function dr(t, e, n) {
|
|
|
4594
4590
|
* because we want to provide the user with a more specific error message if
|
|
4595
4591
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4596
4592
|
* call.
|
|
4597
|
-
*/ function
|
|
4593
|
+
*/ function dr(t, e, n) {
|
|
4598
4594
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4599
4595
|
// toFirestore().
|
|
4600
4596
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4601
4597
|
return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
|
|
4602
4598
|
}
|
|
4603
4599
|
|
|
4604
|
-
var
|
|
4600
|
+
var mr = /** @class */ function(e) {
|
|
4605
4601
|
function n(t) {
|
|
4606
4602
|
var n = this;
|
|
4607
4603
|
return (n = e.call(this) || this).firestore = t, n;
|
|
4608
4604
|
}
|
|
4609
4605
|
return t(n, e), n.prototype.convertBytes = function(t) {
|
|
4610
|
-
return new
|
|
4606
|
+
return new mn(t);
|
|
4611
4607
|
}, n.prototype.convertReference = function(t) {
|
|
4612
4608
|
var e = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
4613
|
-
return new
|
|
4609
|
+
return new on(this.firestore, /* converter= */ null, e);
|
|
4614
4610
|
}, n;
|
|
4615
4611
|
}(/** @class */ function() {
|
|
4616
4612
|
function t() {}
|
|
@@ -4658,7 +4654,7 @@ var yr = /** @class */ function(e) {
|
|
|
4658
4654
|
r[t] = n.convertValue(i, e);
|
|
4659
4655
|
})), r;
|
|
4660
4656
|
}, t.prototype.convertGeoPoint = function(t) {
|
|
4661
|
-
return new
|
|
4657
|
+
return new vn(Vt(t.latitude), Vt(t.longitude));
|
|
4662
4658
|
}, t.prototype.convertArray = function(t, e) {
|
|
4663
4659
|
var n = this;
|
|
4664
4660
|
return (t.values || []).map((function(t) {
|
|
@@ -4681,7 +4677,7 @@ var yr = /** @class */ function(e) {
|
|
|
4681
4677
|
return new bt(e.seconds, e.nanos);
|
|
4682
4678
|
}, t.prototype.convertDocumentKey = function(t, e) {
|
|
4683
4679
|
var n = Z.fromString(t);
|
|
4684
|
-
E(
|
|
4680
|
+
E(Ge(n));
|
|
4685
4681
|
var r = new X(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
|
|
4686
4682
|
return r.isEqual(e) ||
|
|
4687
4683
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -4702,12 +4698,12 @@ var yr = /** @class */ function(e) {
|
|
|
4702
4698
|
* @param reference - The reference of the document to fetch.
|
|
4703
4699
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
4704
4700
|
* document contents.
|
|
4705
|
-
*/ function
|
|
4706
|
-
var e =
|
|
4707
|
-
return
|
|
4701
|
+
*/ function yr(t) {
|
|
4702
|
+
var e = Xe((t = st(t, on)).firestore), n = new mr(t.firestore);
|
|
4703
|
+
return We(e, [ t._key ]).then((function(e) {
|
|
4708
4704
|
E(1 === e.length);
|
|
4709
4705
|
var r = e[0];
|
|
4710
|
-
return new
|
|
4706
|
+
return new zn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
4711
4707
|
}));
|
|
4712
4708
|
}
|
|
4713
4709
|
|
|
@@ -4722,35 +4718,35 @@ var yr = /** @class */ function(e) {
|
|
|
4722
4718
|
*
|
|
4723
4719
|
* @param query - The `Query` to execute.
|
|
4724
4720
|
* @returns A Promise that will be resolved with the results of the query.
|
|
4725
|
-
*/ function
|
|
4721
|
+
*/ function vr(t) {
|
|
4726
4722
|
!function(t) {
|
|
4727
|
-
if (
|
|
4728
|
-
}((t = st(t,
|
|
4729
|
-
var e =
|
|
4730
|
-
return
|
|
4723
|
+
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new x(j, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
4724
|
+
}((t = st(t, an))._query);
|
|
4725
|
+
var e = Xe(t.firestore), n = new mr(t.firestore);
|
|
4726
|
+
return Ye(e, t._query).then((function(e) {
|
|
4731
4727
|
var r = e.map((function(e) {
|
|
4732
|
-
return new
|
|
4728
|
+
return new Qn(t.firestore, n, e.key, e, t.converter);
|
|
4733
4729
|
}));
|
|
4734
|
-
return
|
|
4730
|
+
return "L" /* Last */ === t._query.limitType &&
|
|
4735
4731
|
// Limit to last queries reverse the orderBy constraint that was
|
|
4736
4732
|
// specified by the user. As such, we need to reverse the order of the
|
|
4737
4733
|
// results to return the documents in the expected order.
|
|
4738
|
-
r.reverse(), new
|
|
4734
|
+
r.reverse(), new Kn(t, r);
|
|
4739
4735
|
}));
|
|
4740
4736
|
}
|
|
4741
4737
|
|
|
4742
|
-
function
|
|
4743
|
-
var r =
|
|
4744
|
-
return
|
|
4738
|
+
function gr(t, e, n) {
|
|
4739
|
+
var r = dr((t = st(t, on)).converter, e, n), i = In(En(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
|
|
4740
|
+
return He(Xe(t.firestore), [ i.toMutation(t._key, be.none()) ]);
|
|
4745
4741
|
}
|
|
4746
4742
|
|
|
4747
|
-
function
|
|
4743
|
+
function wr(t, e, n) {
|
|
4748
4744
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4749
|
-
var o, a =
|
|
4745
|
+
var o, a = En((t = st(t, on)).firestore);
|
|
4750
4746
|
// For Compat types, we have to "extract" the underlying types before
|
|
4751
4747
|
// performing validation.
|
|
4752
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
4753
|
-
|
|
4748
|
+
return o = "string" == typeof (e = p(e)) || e instanceof pn ? Fn(a, "updateDoc", t._key, e, n, r) : qn(a, "updateDoc", t._key, e),
|
|
4749
|
+
He(Xe(t.firestore), [ o.toMutation(t._key, be.exists(!0)) ]);
|
|
4754
4750
|
}
|
|
4755
4751
|
|
|
4756
4752
|
/**
|
|
@@ -4764,8 +4760,8 @@ function br(t, e, n) {
|
|
|
4764
4760
|
* @param reference - A reference to the document to delete.
|
|
4765
4761
|
* @returns A `Promise` resolved once the document has been successfully
|
|
4766
4762
|
* deleted from the backend.
|
|
4767
|
-
*/ function
|
|
4768
|
-
return
|
|
4763
|
+
*/ function br(t) {
|
|
4764
|
+
return He(Xe((t = st(t, on)).firestore), [ new Ee(t._key, be.none()) ]);
|
|
4769
4765
|
}
|
|
4770
4766
|
|
|
4771
4767
|
/**
|
|
@@ -4782,9 +4778,9 @@ function br(t, e, n) {
|
|
|
4782
4778
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
4783
4779
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
4784
4780
|
* newly created document after it has been written to the backend.
|
|
4785
|
-
*/ function
|
|
4786
|
-
var n =
|
|
4787
|
-
return
|
|
4781
|
+
*/ function _r(t, e) {
|
|
4782
|
+
var n = ln(t = st(t, sn)), r = dr(t.converter, e), i = In(En(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
|
|
4783
|
+
return He(Xe(t.firestore), [ i.toMutation(n._key, be.exists(!1)) ]).then((function() {
|
|
4788
4784
|
return n;
|
|
4789
4785
|
}));
|
|
4790
4786
|
}
|
|
@@ -4808,15 +4804,15 @@ function br(t, e, n) {
|
|
|
4808
4804
|
/**
|
|
4809
4805
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
4810
4806
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
4811
|
-
*/ function
|
|
4812
|
-
return new
|
|
4807
|
+
*/ function Tr() {
|
|
4808
|
+
return new An("deleteField");
|
|
4813
4809
|
}
|
|
4814
4810
|
|
|
4815
4811
|
/**
|
|
4816
4812
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
4817
4813
|
* include a server-generated timestamp in the written data.
|
|
4818
|
-
*/ function
|
|
4819
|
-
return new
|
|
4814
|
+
*/ function Sr() {
|
|
4815
|
+
return new Vn("serverTimestamp");
|
|
4820
4816
|
}
|
|
4821
4817
|
|
|
4822
4818
|
/**
|
|
@@ -4830,11 +4826,11 @@ function br(t, e, n) {
|
|
|
4830
4826
|
* @param elements - The elements to union into the array.
|
|
4831
4827
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4832
4828
|
* `updateDoc()`.
|
|
4833
|
-
*/ function
|
|
4829
|
+
*/ function Er() {
|
|
4834
4830
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4835
4831
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4836
4832
|
// update() since we'd need the Firestore instance to do this.
|
|
4837
|
-
return new
|
|
4833
|
+
return new Dn("arrayUnion", t);
|
|
4838
4834
|
}
|
|
4839
4835
|
|
|
4840
4836
|
/**
|
|
@@ -4847,11 +4843,11 @@ function br(t, e, n) {
|
|
|
4847
4843
|
* @param elements - The elements to remove from the array.
|
|
4848
4844
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4849
4845
|
* `updateDoc()`
|
|
4850
|
-
*/ function
|
|
4846
|
+
*/ function Ir() {
|
|
4851
4847
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
4852
4848
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
4853
4849
|
// update() since we'd need the Firestore instance to do this.
|
|
4854
|
-
return new
|
|
4850
|
+
return new Pn("arrayRemove", t);
|
|
4855
4851
|
}
|
|
4856
4852
|
|
|
4857
4853
|
/**
|
|
@@ -4872,8 +4868,8 @@ function br(t, e, n) {
|
|
|
4872
4868
|
* @param n - The value to increment by.
|
|
4873
4869
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
4874
4870
|
* `updateDoc()`
|
|
4875
|
-
*/ function
|
|
4876
|
-
return new
|
|
4871
|
+
*/ function Ar(t) {
|
|
4872
|
+
return new Nn("increment", t);
|
|
4877
4873
|
}
|
|
4878
4874
|
|
|
4879
4875
|
/**
|
|
@@ -4899,24 +4895,24 @@ function br(t, e, n) {
|
|
|
4899
4895
|
* provides methods for adding writes to the write batch. None of the writes
|
|
4900
4896
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
4901
4897
|
* called.
|
|
4902
|
-
*/ var
|
|
4898
|
+
*/ var kr = /** @class */ function() {
|
|
4903
4899
|
/** @hideconstructor */
|
|
4904
4900
|
function t(t, e) {
|
|
4905
4901
|
this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
|
|
4906
|
-
this._dataReader =
|
|
4902
|
+
this._dataReader = En(t);
|
|
4907
4903
|
}
|
|
4908
4904
|
return t.prototype.set = function(t, e, n) {
|
|
4909
4905
|
this._verifyNotCommitted();
|
|
4910
|
-
var r =
|
|
4911
|
-
return this._mutations.push(o.toMutation(r._key,
|
|
4906
|
+
var r = Vr(t, this._firestore), i = dr(r.converter, e, n), o = In(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
|
|
4907
|
+
return this._mutations.push(o.toMutation(r._key, be.none())), this;
|
|
4912
4908
|
}, t.prototype.update = function(t, e, n) {
|
|
4913
4909
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
4914
4910
|
this._verifyNotCommitted();
|
|
4915
|
-
var o, a =
|
|
4911
|
+
var o, a = Vr(t, this._firestore);
|
|
4916
4912
|
// For Compat types, we have to "extract" the underlying types before
|
|
4917
4913
|
// performing validation.
|
|
4918
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
4919
|
-
this._mutations.push(o.toMutation(a._key,
|
|
4914
|
+
return o = "string" == typeof (e = p(e)) || e instanceof pn ? Fn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : qn(this._dataReader, "WriteBatch.update", a._key, e),
|
|
4915
|
+
this._mutations.push(o.toMutation(a._key, be.exists(!0))), this;
|
|
4920
4916
|
},
|
|
4921
4917
|
/**
|
|
4922
4918
|
* Deletes the document referred to by the provided {@link DocumentReference}.
|
|
@@ -4926,8 +4922,8 @@ function br(t, e, n) {
|
|
|
4926
4922
|
*/
|
|
4927
4923
|
t.prototype.delete = function(t) {
|
|
4928
4924
|
this._verifyNotCommitted();
|
|
4929
|
-
var e =
|
|
4930
|
-
return this._mutations = this._mutations.concat(new
|
|
4925
|
+
var e = Vr(t, this._firestore);
|
|
4926
|
+
return this._mutations = this._mutations.concat(new Ee(e._key, be.none())), this;
|
|
4931
4927
|
},
|
|
4932
4928
|
/**
|
|
4933
4929
|
* Commits all of the writes in this write batch as a single atomic unit.
|
|
@@ -4948,7 +4944,7 @@ function br(t, e, n) {
|
|
|
4948
4944
|
}, t;
|
|
4949
4945
|
}();
|
|
4950
4946
|
|
|
4951
|
-
function
|
|
4947
|
+
function Vr(t, e) {
|
|
4952
4948
|
if ((t = p(t)).firestore !== e) throw new x(V, "Provided document reference is from a different Firestore instance.");
|
|
4953
4949
|
return t;
|
|
4954
4950
|
}
|
|
@@ -4965,10 +4961,10 @@ function Dr(t, e) {
|
|
|
4965
4961
|
*
|
|
4966
4962
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
4967
4963
|
* writes.
|
|
4968
|
-
*/ function
|
|
4969
|
-
var e =
|
|
4970
|
-
return new
|
|
4971
|
-
return
|
|
4964
|
+
*/ function Dr(t) {
|
|
4965
|
+
var e = Xe(t = st(t, Ze));
|
|
4966
|
+
return new kr(t, (function(t) {
|
|
4967
|
+
return He(e, t);
|
|
4972
4968
|
}));
|
|
4973
4969
|
}
|
|
4974
4970
|
|
|
@@ -4991,7 +4987,7 @@ function Dr(t, e) {
|
|
|
4991
4987
|
/**
|
|
4992
4988
|
* Internal transaction object responsible for accumulating the mutations to
|
|
4993
4989
|
* perform and the base versions for any documents read.
|
|
4994
|
-
*/ var
|
|
4990
|
+
*/ var Pr = /** @class */ function() {
|
|
4995
4991
|
function t(t) {
|
|
4996
4992
|
this.datastore = t,
|
|
4997
4993
|
// The version of each document that was read during this transaction.
|
|
@@ -5016,7 +5012,7 @@ function Dr(t, e) {
|
|
|
5016
5012
|
switch (n.label) {
|
|
5017
5013
|
case 0:
|
|
5018
5014
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new x(V, "Firestore transactions require all reads to be executed before all writes.");
|
|
5019
|
-
return [ 4 /*yield*/ ,
|
|
5015
|
+
return [ 4 /*yield*/ , We(this.datastore, t) ];
|
|
5020
5016
|
|
|
5021
5017
|
case 1:
|
|
5022
5018
|
return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
|
|
@@ -5035,7 +5031,7 @@ function Dr(t, e) {
|
|
|
5035
5031
|
}
|
|
5036
5032
|
this.writtenDocs.add(t.toString());
|
|
5037
5033
|
}, t.prototype.delete = function(t) {
|
|
5038
|
-
this.write(new
|
|
5034
|
+
this.write(new Ee(t, this.precondition(t))), this.writtenDocs.add(t.toString());
|
|
5039
5035
|
}, t.prototype.commit = function() {
|
|
5040
5036
|
return e(this, void 0, void 0, (function() {
|
|
5041
5037
|
var t, e = this;
|
|
@@ -5052,8 +5048,8 @@ function Dr(t, e) {
|
|
|
5052
5048
|
// a `verify` operation.
|
|
5053
5049
|
t.forEach((function(t, n) {
|
|
5054
5050
|
var r = nt.fromPath(n);
|
|
5055
|
-
e.mutations.push(new
|
|
5056
|
-
})), [ 4 /*yield*/ ,
|
|
5051
|
+
e.mutations.push(new Ie(r, e.precondition(r)));
|
|
5052
|
+
})), [ 4 /*yield*/ , He(this.datastore, this.mutations) ];
|
|
5057
5053
|
|
|
5058
5054
|
case 1:
|
|
5059
5055
|
// For each mutation, note that the doc was written.
|
|
@@ -5081,7 +5077,7 @@ function Dr(t, e) {
|
|
|
5081
5077
|
*/
|
|
5082
5078
|
t.prototype.precondition = function(t) {
|
|
5083
5079
|
var e = this.readVersions.get(t.toString());
|
|
5084
|
-
return !this.writtenDocs.has(t.toString()) && e ?
|
|
5080
|
+
return !this.writtenDocs.has(t.toString()) && e ? be.updateTime(e) : be.none();
|
|
5085
5081
|
},
|
|
5086
5082
|
/**
|
|
5087
5083
|
* Returns the precondition for a document if the operation is an update.
|
|
@@ -5103,18 +5099,18 @@ function Dr(t, e) {
|
|
|
5103
5099
|
// transaction.
|
|
5104
5100
|
throw new x(V, "Can't update a document that doesn't exist.");
|
|
5105
5101
|
// Document exists, base precondition on document update time.
|
|
5106
|
-
return
|
|
5102
|
+
return be.updateTime(e);
|
|
5107
5103
|
}
|
|
5108
5104
|
// Document was not read, so we just use the preconditions for a blind
|
|
5109
5105
|
// update.
|
|
5110
|
-
return
|
|
5106
|
+
return be.exists(!0);
|
|
5111
5107
|
}, t.prototype.write = function(t) {
|
|
5112
5108
|
this.ensureCommitNotCalled(), this.mutations.push(t);
|
|
5113
5109
|
}, t.prototype.ensureCommitNotCalled = function() {}, t;
|
|
5114
|
-
}(),
|
|
5110
|
+
}(), Nr = /** @class */ function() {
|
|
5115
5111
|
function t(t, e, n, r) {
|
|
5116
5112
|
this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
|
|
5117
|
-
this.Tt = 5, this.It = new
|
|
5113
|
+
this.Tt = 5, this.It = new Qe(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
|
|
5118
5114
|
/** Runs the transaction and sets the result on deferred. */;
|
|
5119
5115
|
}
|
|
5120
5116
|
return t.prototype.run = function() {
|
|
@@ -5125,7 +5121,7 @@ function Dr(t, e) {
|
|
|
5125
5121
|
return e(t, void 0, void 0, (function() {
|
|
5126
5122
|
var t, e, r = this;
|
|
5127
5123
|
return n(this, (function(n) {
|
|
5128
|
-
return t = new
|
|
5124
|
+
return t = new Pr(this.datastore), (e = this.Rt(t)) && e.then((function(e) {
|
|
5129
5125
|
r.asyncQueue.enqueueAndForget((function() {
|
|
5130
5126
|
return t.commit().then((function() {
|
|
5131
5127
|
r.deferred.resolve(e);
|
|
@@ -5237,7 +5233,7 @@ function Dr(t, e) {
|
|
|
5237
5233
|
* See the License for the specific language governing permissions and
|
|
5238
5234
|
* limitations under the License.
|
|
5239
5235
|
*/
|
|
5240
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5236
|
+
/** The Platform's 'document' implementation or null if not available. */ function qr() {
|
|
5241
5237
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5242
5238
|
// eslint-disable-next-line no-restricted-globals
|
|
5243
5239
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5269,7 +5265,7 @@ function Dr(t, e) {
|
|
|
5269
5265
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5270
5266
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5271
5267
|
* IE.
|
|
5272
|
-
*/ var
|
|
5268
|
+
*/ var Fr = /** @class */ function() {
|
|
5273
5269
|
function t(t, e, n, r, i) {
|
|
5274
5270
|
this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
|
|
5275
5271
|
this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5333,7 +5329,7 @@ function Dr(t, e) {
|
|
|
5333
5329
|
null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
|
|
5334
5330
|
this.timerHandle = null);
|
|
5335
5331
|
}, t;
|
|
5336
|
-
}(),
|
|
5332
|
+
}(), Or = /** @class */ function() {
|
|
5337
5333
|
function t() {
|
|
5338
5334
|
var t = this;
|
|
5339
5335
|
// The last promise in the queue.
|
|
@@ -5357,15 +5353,15 @@ function Dr(t, e) {
|
|
|
5357
5353
|
// List of TimerIds to fast-forward delays for.
|
|
5358
5354
|
this.Ot = [],
|
|
5359
5355
|
// Backoff timer used to schedule retries for retryable operations
|
|
5360
|
-
this.It = new
|
|
5356
|
+
this.It = new Qe(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5361
5357
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5362
5358
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5363
5359
|
// after page comes into foreground.
|
|
5364
5360
|
this.Ct = function() {
|
|
5365
|
-
var e =
|
|
5361
|
+
var e = qr();
|
|
5366
5362
|
e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.It.H();
|
|
5367
5363
|
};
|
|
5368
|
-
var e =
|
|
5364
|
+
var e = qr();
|
|
5369
5365
|
e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ct);
|
|
5370
5366
|
}
|
|
5371
5367
|
return Object.defineProperty(t.prototype, "isShuttingDown", {
|
|
@@ -5389,7 +5385,7 @@ function Dr(t, e) {
|
|
|
5389
5385
|
}, t.prototype.enterRestrictedMode = function(t) {
|
|
5390
5386
|
if (!this.$t) {
|
|
5391
5387
|
this.$t = !0, this.qt = t || !1;
|
|
5392
|
-
var e =
|
|
5388
|
+
var e = qr();
|
|
5393
5389
|
e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
|
|
5394
5390
|
}
|
|
5395
5391
|
}, t.prototype.enqueue = function(t) {
|
|
@@ -5487,7 +5483,7 @@ function Dr(t, e) {
|
|
|
5487
5483
|
this.Lt(),
|
|
5488
5484
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5489
5485
|
this.Ot.indexOf(t) > -1 && (e = 0);
|
|
5490
|
-
var i =
|
|
5486
|
+
var i = Fr.createAndSchedule(this, t, e, n, (function(t) {
|
|
5491
5487
|
return r.jt(t);
|
|
5492
5488
|
}));
|
|
5493
5489
|
return this.St.push(i), i;
|
|
@@ -5562,10 +5558,10 @@ function Dr(t, e) {
|
|
|
5562
5558
|
var e = this.St.indexOf(t);
|
|
5563
5559
|
this.St.splice(e, 1);
|
|
5564
5560
|
}, t;
|
|
5565
|
-
}(),
|
|
5561
|
+
}(), Cr = /** @class */ function() {
|
|
5566
5562
|
/** @hideconstructor */
|
|
5567
5563
|
function t(t, e) {
|
|
5568
|
-
this._firestore = t, this._transaction = e, this._dataReader =
|
|
5564
|
+
this._firestore = t, this._transaction = e, this._dataReader = En(t)
|
|
5569
5565
|
/**
|
|
5570
5566
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
5571
5567
|
*
|
|
@@ -5574,23 +5570,23 @@ function Dr(t, e) {
|
|
|
5574
5570
|
*/;
|
|
5575
5571
|
}
|
|
5576
5572
|
return t.prototype.get = function(t) {
|
|
5577
|
-
var e = this, n =
|
|
5573
|
+
var e = this, n = Vr(t, this._firestore), r = new mr(this._firestore);
|
|
5578
5574
|
return this._transaction.lookup([ n._key ]).then((function(t) {
|
|
5579
5575
|
if (!t || 1 !== t.length) return S();
|
|
5580
5576
|
var i = t[0];
|
|
5581
|
-
if (i.isFoundDocument()) return new
|
|
5582
|
-
if (i.isNoDocument()) return new
|
|
5577
|
+
if (i.isFoundDocument()) return new zn(e._firestore, r, i.key, i, n.converter);
|
|
5578
|
+
if (i.isNoDocument()) return new zn(e._firestore, r, n._key, null, n.converter);
|
|
5583
5579
|
throw S();
|
|
5584
5580
|
}));
|
|
5585
5581
|
}, t.prototype.set = function(t, e, n) {
|
|
5586
|
-
var r =
|
|
5582
|
+
var r = Vr(t, this._firestore), i = dr(r.converter, e, n), o = In(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
|
|
5587
5583
|
return this._transaction.set(r._key, o), this;
|
|
5588
5584
|
}, t.prototype.update = function(t, e, n) {
|
|
5589
5585
|
for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
|
|
5590
|
-
var o, a =
|
|
5586
|
+
var o, a = Vr(t, this._firestore);
|
|
5591
5587
|
// For Compat types, we have to "extract" the underlying types before
|
|
5592
5588
|
// performing validation.
|
|
5593
|
-
return o = "string" == typeof (e = p(e)) || e instanceof
|
|
5589
|
+
return o = "string" == typeof (e = p(e)) || e instanceof pn ? Fn(this._dataReader, "Transaction.update", a._key, e, n, r) : qn(this._dataReader, "Transaction.update", a._key, e),
|
|
5594
5590
|
this._transaction.update(a._key, o), this;
|
|
5595
5591
|
},
|
|
5596
5592
|
/**
|
|
@@ -5600,7 +5596,7 @@ function Dr(t, e) {
|
|
|
5600
5596
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5601
5597
|
*/
|
|
5602
5598
|
t.prototype.delete = function(t) {
|
|
5603
|
-
var e =
|
|
5599
|
+
var e = Vr(t, this._firestore);
|
|
5604
5600
|
return this._transaction.delete(e._key), this;
|
|
5605
5601
|
}, t;
|
|
5606
5602
|
}();
|
|
@@ -5638,10 +5634,10 @@ function Dr(t, e) {
|
|
|
5638
5634
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5639
5635
|
* rejected promise with the corresponding failure error is returned.
|
|
5640
5636
|
*/
|
|
5641
|
-
function
|
|
5642
|
-
var n =
|
|
5643
|
-
return new
|
|
5644
|
-
return e(new
|
|
5637
|
+
function Lr(t, e) {
|
|
5638
|
+
var n = Xe(t = st(t, Ze)), r = new U;
|
|
5639
|
+
return new Nr(new Or, n, (function(n) {
|
|
5640
|
+
return e(new Cr(t, n));
|
|
5645
5641
|
}), r).run(), r.promise
|
|
5646
5642
|
/**
|
|
5647
5643
|
* Firestore Lite
|
|
@@ -5654,11 +5650,11 @@ function jr(t, e) {
|
|
|
5654
5650
|
}
|
|
5655
5651
|
|
|
5656
5652
|
y = i + "_lite", o(new c("firestore/lite", (function(t, e) {
|
|
5657
|
-
var n = e.options, r = t.getProvider("app").getImmediate(), i = new
|
|
5653
|
+
var n = e.options, r = t.getProvider("app").getImmediate(), i = new Ze(r, new Q(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5658
5654
|
return n && i._setSettings(n), i;
|
|
5659
5655
|
}), "PUBLIC")),
|
|
5660
5656
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5661
|
-
a("firestore-lite", "3.4.
|
|
5657
|
+
a("firestore-lite", "3.4.8-canary.44948ac91", ""), a("firestore-lite", "3.4.8-canary.44948ac91", "esm5");
|
|
5662
5658
|
|
|
5663
|
-
export {
|
|
5659
|
+
export { mn as Bytes, sn as CollectionReference, on as DocumentReference, zn as DocumentSnapshot, pn as FieldPath, yn as FieldValue, Ze as Firestore, x as FirestoreError, vn as GeoPoint, an as Query, Yn as QueryConstraint, Qn as QueryDocumentSnapshot, Kn as QuerySnapshot, bt as Timestamp, Cr as Transaction, kr as WriteBatch, _r as addDoc, Ir as arrayRemove, Er as arrayUnion, un as collection, cn as collectionGroup, nn as connectFirestoreEmulator, br as deleteDoc, Tr as deleteField, ln as doc, dn as documentId, cr as endAt, ur as endBefore, yr as getDoc, vr as getDocs, en as getFirestore, Ar as increment, tn as initializeFirestore, nr as limit, rr as limitToLast, tr as orderBy, $n as query, hn as queryEqual, fn as refEqual, Lr as runTransaction, Sr as serverTimestamp, gr as setDoc, g as setLogLevel, Hn as snapshotEqual, ar as startAfter, or as startAt, rn as terminate, wr as updateDoc, Jn as where, Dr as writeBatch };
|
|
5664
5660
|
//# sourceMappingURL=index.browser.esm5.js.map
|