@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.7f959622d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/firestore/src/core/target.d.ts +8 -4
- package/dist/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/firestore/test/util/helpers.d.ts +1 -1
- package/dist/index.esm2017.js +2233 -2144
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2964 -2912
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +199 -90
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +199 -90
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +2183 -2090
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/lite/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/index.browser.esm2017.js +301 -298
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +327 -326
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +36 -29
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +36 -29
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +301 -298
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +2 -2
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +90 -90
- package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/lite/private.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +61 -61
- package/dist/packages/firestore/src/core/target.d.ts +8 -4
- package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
- package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +121 -7
- package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
- package/dist/private.d.ts +2 -2
- package/package.json +9 -9
|
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
|
|
|
63
63
|
* See the License for the specific language governing permissions and
|
|
64
64
|
* limitations under the License.
|
|
65
65
|
*/
|
|
66
|
-
let f = "9.6.5-canary.
|
|
66
|
+
let f = "9.6.5-canary.7f959622d";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -2243,7 +2243,6 @@ function Jt(t, n) {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
}
|
|
2245
2245
|
|
|
2246
|
-
// TODO(indexing): Change Bound.before to "inclusive"
|
|
2247
2246
|
/**
|
|
2248
2247
|
* Represents a bound of a query.
|
|
2249
2248
|
*
|
|
@@ -2259,7 +2258,7 @@ function Jt(t, n) {
|
|
|
2259
2258
|
* just after the provided values.
|
|
2260
2259
|
*/ class en {
|
|
2261
2260
|
constructor(t, n) {
|
|
2262
|
-
this.position = t, this.
|
|
2261
|
+
this.position = t, this.inclusive = n;
|
|
2263
2262
|
}
|
|
2264
2263
|
}
|
|
2265
2264
|
|
|
@@ -2278,7 +2277,7 @@ function sn(t, n) {
|
|
|
2278
2277
|
function on(t, n) {
|
|
2279
2278
|
if (null === t) return null === n;
|
|
2280
2279
|
if (null === n) return !1;
|
|
2281
|
-
if (t.
|
|
2280
|
+
if (t.inclusive !== n.inclusive || t.position.length !== n.position.length) return !1;
|
|
2282
2281
|
for (let e = 0; e < t.position.length; e++) {
|
|
2283
2282
|
if (!Ft(t.position[e], n.position[e])) return !1;
|
|
2284
2283
|
}
|
|
@@ -2384,7 +2383,7 @@ function ln(t) {
|
|
|
2384
2383
|
t.push(new rn(e.field, n));
|
|
2385
2384
|
}
|
|
2386
2385
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
2387
|
-
const e = n.endAt ? new en(n.endAt.position, !n.endAt.
|
|
2386
|
+
const e = n.endAt ? new en(n.endAt.position, !n.endAt.inclusive) : null, r = n.startAt ? new en(n.startAt.position, !n.startAt.inclusive) : null;
|
|
2388
2387
|
// Now return as a LimitType.First query.
|
|
2389
2388
|
n.S = Qt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
|
|
2390
2389
|
}
|
|
@@ -2757,7 +2756,7 @@ function On(t, n) {
|
|
|
2757
2756
|
function Cn(t, n) {
|
|
2758
2757
|
const e = function(t) {
|
|
2759
2758
|
const n = X.fromString(t);
|
|
2760
|
-
return v(
|
|
2759
|
+
return v(Yn(n)), n;
|
|
2761
2760
|
}(n);
|
|
2762
2761
|
if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
|
|
2763
2762
|
if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
|
|
@@ -2804,7 +2803,7 @@ function Mn(t, n) {
|
|
|
2804
2803
|
delete: On(t, n.key)
|
|
2805
2804
|
}; else if (n instanceof An) e = {
|
|
2806
2805
|
update: kn(t, n.key, n.data),
|
|
2807
|
-
updateMask:
|
|
2806
|
+
updateMask: Wn(n.fieldMask)
|
|
2808
2807
|
}; else {
|
|
2809
2808
|
if (!(n instanceof Pn)) return g();
|
|
2810
2809
|
e = {
|
|
@@ -2862,34 +2861,34 @@ function Bn(t, n) {
|
|
|
2862
2861
|
if ("==" /* EQUAL */ === t.op) {
|
|
2863
2862
|
if (kt(t.value)) return {
|
|
2864
2863
|
unaryFilter: {
|
|
2865
|
-
field:
|
|
2864
|
+
field: Qn(t.field),
|
|
2866
2865
|
op: "IS_NAN"
|
|
2867
2866
|
}
|
|
2868
2867
|
};
|
|
2869
2868
|
if (Ut(t.value)) return {
|
|
2870
2869
|
unaryFilter: {
|
|
2871
|
-
field:
|
|
2870
|
+
field: Qn(t.field),
|
|
2872
2871
|
op: "IS_NULL"
|
|
2873
2872
|
}
|
|
2874
2873
|
};
|
|
2875
2874
|
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
2876
2875
|
if (kt(t.value)) return {
|
|
2877
2876
|
unaryFilter: {
|
|
2878
|
-
field:
|
|
2877
|
+
field: Qn(t.field),
|
|
2879
2878
|
op: "IS_NOT_NAN"
|
|
2880
2879
|
}
|
|
2881
2880
|
};
|
|
2882
2881
|
if (Ut(t.value)) return {
|
|
2883
2882
|
unaryFilter: {
|
|
2884
|
-
field:
|
|
2883
|
+
field: Qn(t.field),
|
|
2885
2884
|
op: "IS_NOT_NULL"
|
|
2886
2885
|
}
|
|
2887
2886
|
};
|
|
2888
2887
|
}
|
|
2889
2888
|
return {
|
|
2890
2889
|
fieldFilter: {
|
|
2891
|
-
field:
|
|
2892
|
-
op:
|
|
2890
|
+
field: Qn(t.field),
|
|
2891
|
+
op: Gn(t.op),
|
|
2893
2892
|
value: t.value
|
|
2894
2893
|
}
|
|
2895
2894
|
};
|
|
@@ -2909,8 +2908,8 @@ function Bn(t, n) {
|
|
|
2909
2908
|
// visible for testing
|
|
2910
2909
|
function(t) {
|
|
2911
2910
|
return {
|
|
2912
|
-
field:
|
|
2913
|
-
direction:
|
|
2911
|
+
field: Qn(t.field),
|
|
2912
|
+
direction: zn(t.dir)
|
|
2914
2913
|
};
|
|
2915
2914
|
}(t)));
|
|
2916
2915
|
}(n.orderBy);
|
|
@@ -2920,41 +2919,43 @@ function Bn(t, n) {
|
|
|
2920
2919
|
value: n
|
|
2921
2920
|
};
|
|
2922
2921
|
}(t, n.limit);
|
|
2923
|
-
|
|
2924
|
-
|
|
2922
|
+
var u;
|
|
2923
|
+
return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = {
|
|
2924
|
+
before: (u = n.startAt).inclusive,
|
|
2925
|
+
values: u.position
|
|
2926
|
+
}), n.endAt && (e.structuredQuery.endAt = function(t) {
|
|
2927
|
+
return {
|
|
2928
|
+
before: !t.inclusive,
|
|
2929
|
+
values: t.position
|
|
2930
|
+
};
|
|
2931
|
+
}
|
|
2932
|
+
// visible for testing
|
|
2933
|
+
(n.endAt)), e;
|
|
2925
2934
|
}
|
|
2926
2935
|
|
|
2927
2936
|
function zn(t) {
|
|
2928
|
-
return {
|
|
2929
|
-
before: t.before,
|
|
2930
|
-
values: t.position
|
|
2931
|
-
};
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
// visible for testing
|
|
2935
|
-
function Gn(t) {
|
|
2936
2937
|
return Vn[t];
|
|
2937
2938
|
}
|
|
2938
2939
|
|
|
2939
2940
|
// visible for testing
|
|
2940
|
-
function
|
|
2941
|
+
function Gn(t) {
|
|
2941
2942
|
return Dn[t];
|
|
2942
2943
|
}
|
|
2943
2944
|
|
|
2944
|
-
function
|
|
2945
|
+
function Qn(t) {
|
|
2945
2946
|
return {
|
|
2946
2947
|
fieldPath: t.canonicalString()
|
|
2947
2948
|
};
|
|
2948
2949
|
}
|
|
2949
2950
|
|
|
2950
|
-
function
|
|
2951
|
+
function Wn(t) {
|
|
2951
2952
|
const n = [];
|
|
2952
2953
|
return t.fields.forEach((t => n.push(t.canonicalString()))), {
|
|
2953
2954
|
fieldPaths: n
|
|
2954
2955
|
};
|
|
2955
2956
|
}
|
|
2956
2957
|
|
|
2957
|
-
function
|
|
2958
|
+
function Yn(t) {
|
|
2958
2959
|
// Resource names have at least 4 components (project ID, database ID)
|
|
2959
2960
|
return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
|
|
2960
2961
|
}
|
|
@@ -2974,7 +2975,7 @@ function Hn(t) {
|
|
|
2974
2975
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2975
2976
|
* See the License for the specific language governing permissions and
|
|
2976
2977
|
* limitations under the License.
|
|
2977
|
-
*/ function
|
|
2978
|
+
*/ function Hn(t) {
|
|
2978
2979
|
return new Nn(t, /* useProto3Json= */ !0);
|
|
2979
2980
|
}
|
|
2980
2981
|
|
|
@@ -3003,7 +3004,7 @@ function Hn(t) {
|
|
|
3003
3004
|
* base delay. This prevents clients from accidentally synchronizing their
|
|
3004
3005
|
* delays causing spikes of load to the backend.
|
|
3005
3006
|
*/
|
|
3006
|
-
class
|
|
3007
|
+
class Kn {
|
|
3007
3008
|
constructor(
|
|
3008
3009
|
/**
|
|
3009
3010
|
* The AsyncQueue to run backoff operations on.
|
|
@@ -3101,7 +3102,7 @@ class Jn {
|
|
|
3101
3102
|
* An implementation of Datastore that exposes additional state for internal
|
|
3102
3103
|
* consumption.
|
|
3103
3104
|
*/
|
|
3104
|
-
class
|
|
3105
|
+
class Jn extends class {} {
|
|
3105
3106
|
constructor(t, n, e, r) {
|
|
3106
3107
|
super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
|
|
3107
3108
|
this.J = !1;
|
|
@@ -3128,14 +3129,14 @@ class Xn extends class {} {
|
|
|
3128
3129
|
|
|
3129
3130
|
// TODO(firestorexp): Make sure there is only one Datastore instance per
|
|
3130
3131
|
// firestore-exp client.
|
|
3131
|
-
async function
|
|
3132
|
+
async function Xn(t, n) {
|
|
3132
3133
|
const e = b(t), r = Un(e.q) + "/documents", s = {
|
|
3133
3134
|
writes: n.map((t => Mn(e.q, t)))
|
|
3134
3135
|
};
|
|
3135
3136
|
await e.m("Commit", r, s);
|
|
3136
3137
|
}
|
|
3137
3138
|
|
|
3138
|
-
async function
|
|
3139
|
+
async function Zn(t, n) {
|
|
3139
3140
|
const e = b(t), r = Un(e.q) + "/documents", s = {
|
|
3140
3141
|
documents: n.map((t => On(e.q, t)))
|
|
3141
3142
|
}, i = await e.T("BatchGetDocuments", r, s), o = new Map;
|
|
@@ -3150,7 +3151,7 @@ async function te(t, n) {
|
|
|
3150
3151
|
})), u;
|
|
3151
3152
|
}
|
|
3152
3153
|
|
|
3153
|
-
async function
|
|
3154
|
+
async function te(t, n) {
|
|
3154
3155
|
const e = b(t), r = Bn(e.q, dn(n));
|
|
3155
3156
|
return (await e.T("RunQuery", r.parent, {
|
|
3156
3157
|
structuredQuery: r.structuredQuery
|
|
@@ -3179,7 +3180,7 @@ async function ne(t, n) {
|
|
|
3179
3180
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3180
3181
|
* See the License for the specific language governing permissions and
|
|
3181
3182
|
* limitations under the License.
|
|
3182
|
-
*/ const
|
|
3183
|
+
*/ const ne = new Map;
|
|
3183
3184
|
|
|
3184
3185
|
/**
|
|
3185
3186
|
* An instance map that ensures only one Datastore exists per Firestore
|
|
@@ -3190,17 +3191,17 @@ async function ne(t, n) {
|
|
|
3190
3191
|
* instance. Callers must invoke removeComponents() when the Firestore
|
|
3191
3192
|
* instance is terminated.
|
|
3192
3193
|
*/
|
|
3193
|
-
function
|
|
3194
|
+
function ee(t) {
|
|
3194
3195
|
if (t._terminated) throw new U(S, "The client has already been terminated.");
|
|
3195
|
-
if (!
|
|
3196
|
+
if (!ne.has(t)) {
|
|
3196
3197
|
m("ComponentProvider", "Initializing Datastore");
|
|
3197
3198
|
const i = function(t) {
|
|
3198
3199
|
return new wt(t, fetch.bind(null));
|
|
3199
3200
|
}((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
|
|
3200
|
-
new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o =
|
|
3201
|
-
return new
|
|
3201
|
+
new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Hn(t._databaseId), u = function(t, n, e, r) {
|
|
3202
|
+
return new Jn(t, n, e, r);
|
|
3202
3203
|
}(t._authCredentials, t._appCheckCredentials, i, o);
|
|
3203
|
-
|
|
3204
|
+
ne.set(t, u);
|
|
3204
3205
|
}
|
|
3205
3206
|
var n, e, r, s;
|
|
3206
3207
|
/**
|
|
@@ -3218,7 +3219,7 @@ function re(t) {
|
|
|
3218
3219
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3219
3220
|
* See the License for the specific language governing permissions and
|
|
3220
3221
|
* limitations under the License.
|
|
3221
|
-
*/ return
|
|
3222
|
+
*/ return ne.get(t);
|
|
3222
3223
|
}
|
|
3223
3224
|
|
|
3224
3225
|
/**
|
|
@@ -3230,7 +3231,7 @@ function re(t) {
|
|
|
3230
3231
|
* user-supplied `FirestoreSettings` object. This is a separate type so that
|
|
3231
3232
|
* defaults can be supplied and the value can be checked for equality.
|
|
3232
3233
|
*/
|
|
3233
|
-
class
|
|
3234
|
+
class re {
|
|
3234
3235
|
constructor(t) {
|
|
3235
3236
|
var n;
|
|
3236
3237
|
if (void 0 === t.host) {
|
|
@@ -3272,14 +3273,14 @@ class se {
|
|
|
3272
3273
|
* The Cloud Firestore service interface.
|
|
3273
3274
|
*
|
|
3274
3275
|
* Do not call this constructor directly. Instead, use {@link getFirestore}.
|
|
3275
|
-
*/ class
|
|
3276
|
+
*/ class se {
|
|
3276
3277
|
/** @hideconstructor */
|
|
3277
3278
|
constructor(t, n, e) {
|
|
3278
3279
|
this._authCredentials = n, this._appCheckCredentials = e,
|
|
3279
3280
|
/**
|
|
3280
3281
|
* Whether it's a Firestore or Firestore Lite instance.
|
|
3281
3282
|
*/
|
|
3282
|
-
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new
|
|
3283
|
+
this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new re({}),
|
|
3283
3284
|
this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
|
|
3284
3285
|
this._databaseId = function(t) {
|
|
3285
3286
|
if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
|
|
@@ -3312,7 +3313,7 @@ class se {
|
|
|
3312
3313
|
}
|
|
3313
3314
|
_setSettings(t) {
|
|
3314
3315
|
if (this._settingsFrozen) throw new U(S, "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.");
|
|
3315
|
-
this._settings = new
|
|
3316
|
+
this._settings = new re(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
|
|
3316
3317
|
if (!t) return new M;
|
|
3317
3318
|
switch (t.type) {
|
|
3318
3319
|
case "gapi":
|
|
@@ -3353,13 +3354,13 @@ class se {
|
|
|
3353
3354
|
* Only ever called once.
|
|
3354
3355
|
*/ _terminate() {
|
|
3355
3356
|
return function(t) {
|
|
3356
|
-
const n =
|
|
3357
|
-
n && (m("ComponentProvider", "Removing Datastore"),
|
|
3357
|
+
const n = ne.get(t);
|
|
3358
|
+
n && (m("ComponentProvider", "Removing Datastore"), ne.delete(t), n.terminate());
|
|
3358
3359
|
}(this), Promise.resolve();
|
|
3359
3360
|
}
|
|
3360
3361
|
}
|
|
3361
3362
|
|
|
3362
|
-
function
|
|
3363
|
+
function ie(t, n) {
|
|
3363
3364
|
const e = _getProvider(t, "firestore/lite");
|
|
3364
3365
|
if (e.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
|
|
3365
3366
|
return e.initialize({
|
|
@@ -3375,7 +3376,7 @@ function oe(t, n) {
|
|
|
3375
3376
|
* @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
|
|
3376
3377
|
* instance is associated with.
|
|
3377
3378
|
* @returns The `Firestore` instance of the provided app.
|
|
3378
|
-
*/ function
|
|
3379
|
+
*/ function oe(n = getApp()) {
|
|
3379
3380
|
return _getProvider(n, "firestore/lite").getImmediate();
|
|
3380
3381
|
}
|
|
3381
3382
|
|
|
@@ -3391,9 +3392,9 @@ function oe(t, n) {
|
|
|
3391
3392
|
* @param port - the emulator port (ex: 9000).
|
|
3392
3393
|
* @param options.mockUserToken - the mock auth token to use for unit testing
|
|
3393
3394
|
* Security Rules.
|
|
3394
|
-
*/ function
|
|
3395
|
+
*/ function ue(t, n, e, r = {}) {
|
|
3395
3396
|
var s;
|
|
3396
|
-
const i = (t = ot(t,
|
|
3397
|
+
const i = (t = ot(t, se))._getSettings();
|
|
3397
3398
|
if ("firestore.googleapis.com" !== i.host && i.host !== n && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
|
|
3398
3399
|
t._setSettings(Object.assign(Object.assign({}, i), {
|
|
3399
3400
|
host: `${n}:${e}`,
|
|
@@ -3431,8 +3432,8 @@ function oe(t, n) {
|
|
|
3431
3432
|
* @param firestore - The `Firestore` instance to terminate.
|
|
3432
3433
|
* @returns A `Promise` that is resolved when the instance has been successfully
|
|
3433
3434
|
* terminated.
|
|
3434
|
-
*/ function
|
|
3435
|
-
return t = ot(t,
|
|
3435
|
+
*/ function ce(t) {
|
|
3436
|
+
return t = ot(t, se), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
|
|
3436
3437
|
}
|
|
3437
3438
|
|
|
3438
3439
|
/**
|
|
@@ -3472,7 +3473,7 @@ function oe(t, n) {
|
|
|
3472
3473
|
* and can be used to write, read, or listen to the location. The document at
|
|
3473
3474
|
* the referenced location may or may not exist.
|
|
3474
3475
|
*/
|
|
3475
|
-
class
|
|
3476
|
+
class ae {
|
|
3476
3477
|
/** @hideconstructor */
|
|
3477
3478
|
constructor(t,
|
|
3478
3479
|
/**
|
|
@@ -3500,17 +3501,17 @@ class he {
|
|
|
3500
3501
|
/**
|
|
3501
3502
|
* The collection this `DocumentReference` belongs to.
|
|
3502
3503
|
*/ get parent() {
|
|
3503
|
-
return new
|
|
3504
|
+
return new le(this.firestore, this.converter, this._key.path.popLast());
|
|
3504
3505
|
}
|
|
3505
3506
|
withConverter(t) {
|
|
3506
|
-
return new
|
|
3507
|
+
return new ae(this.firestore, t, this._key);
|
|
3507
3508
|
}
|
|
3508
3509
|
}
|
|
3509
3510
|
|
|
3510
3511
|
/**
|
|
3511
3512
|
* A `Query` refers to a query which you can read or listen to. You can also
|
|
3512
3513
|
* construct refined `Query` objects by adding filters and ordering.
|
|
3513
|
-
*/ class
|
|
3514
|
+
*/ class he {
|
|
3514
3515
|
// This is the lite version of the Query class in the main SDK.
|
|
3515
3516
|
/** @hideconstructor protected */
|
|
3516
3517
|
constructor(t,
|
|
@@ -3523,14 +3524,14 @@ class he {
|
|
|
3523
3524
|
this.type = "query", this.firestore = t;
|
|
3524
3525
|
}
|
|
3525
3526
|
withConverter(t) {
|
|
3526
|
-
return new
|
|
3527
|
+
return new he(this.firestore, t, this._query);
|
|
3527
3528
|
}
|
|
3528
3529
|
}
|
|
3529
3530
|
|
|
3530
3531
|
/**
|
|
3531
3532
|
* A `CollectionReference` object can be used for adding documents, getting
|
|
3532
3533
|
* document references, and querying for documents (using {@link query}).
|
|
3533
|
-
*/ class
|
|
3534
|
+
*/ class le extends he {
|
|
3534
3535
|
/** @hideconstructor */
|
|
3535
3536
|
constructor(t, n, e) {
|
|
3536
3537
|
super(t, n, new un(e)), this._path = e,
|
|
@@ -3551,23 +3552,23 @@ class he {
|
|
|
3551
3552
|
* subcollection. If this isn't a subcollection, the reference is null.
|
|
3552
3553
|
*/ get parent() {
|
|
3553
3554
|
const t = this._path.popLast();
|
|
3554
|
-
return t.isEmpty() ? null : new
|
|
3555
|
+
return t.isEmpty() ? null : new ae(this.firestore,
|
|
3555
3556
|
/* converter= */ null, new nt(t));
|
|
3556
3557
|
}
|
|
3557
3558
|
withConverter(t) {
|
|
3558
|
-
return new
|
|
3559
|
+
return new le(this.firestore, t, this._path);
|
|
3559
3560
|
}
|
|
3560
3561
|
}
|
|
3561
3562
|
|
|
3562
|
-
function
|
|
3563
|
-
if (t = getModularInstance(t), et("collection", "path", n), t instanceof
|
|
3563
|
+
function fe(t, n, ...e) {
|
|
3564
|
+
if (t = getModularInstance(t), et("collection", "path", n), t instanceof se) {
|
|
3564
3565
|
const r = X.fromString(n, ...e);
|
|
3565
|
-
return st(r), new
|
|
3566
|
+
return st(r), new le(t, /* converter= */ null, r);
|
|
3566
3567
|
}
|
|
3567
3568
|
{
|
|
3568
|
-
if (!(t instanceof
|
|
3569
|
+
if (!(t instanceof ae || t instanceof le)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3569
3570
|
const r = t._path.child(X.fromString(n, ...e));
|
|
3570
|
-
return st(r), new
|
|
3571
|
+
return st(r), new le(t.firestore,
|
|
3571
3572
|
/* converter= */ null, r);
|
|
3572
3573
|
}
|
|
3573
3574
|
}
|
|
@@ -3584,9 +3585,9 @@ function de(t, n, ...e) {
|
|
|
3584
3585
|
* collection or subcollection with this ID as the last segment of its path
|
|
3585
3586
|
* will be included. Cannot contain a slash.
|
|
3586
3587
|
* @returns The created `Query`.
|
|
3587
|
-
*/ function
|
|
3588
|
-
if (t = ot(t,
|
|
3589
|
-
return new
|
|
3588
|
+
*/ function de(t, n) {
|
|
3589
|
+
if (t = ot(t, se), et("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
|
|
3590
|
+
return new he(t,
|
|
3590
3591
|
/* converter= */ null,
|
|
3591
3592
|
/**
|
|
3592
3593
|
* Creates a new Query for a collection group query that matches all documents
|
|
@@ -3597,19 +3598,19 @@ function de(t, n, ...e) {
|
|
|
3597
3598
|
}(n));
|
|
3598
3599
|
}
|
|
3599
3600
|
|
|
3600
|
-
function
|
|
3601
|
+
function we(t, n, ...e) {
|
|
3601
3602
|
if (t = getModularInstance(t),
|
|
3602
3603
|
// We allow omission of 'pathString' but explicitly prohibit passing in both
|
|
3603
3604
|
// 'undefined' and 'null'.
|
|
3604
|
-
1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof
|
|
3605
|
+
1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof se) {
|
|
3605
3606
|
const r = X.fromString(n, ...e);
|
|
3606
|
-
return rt(r), new
|
|
3607
|
+
return rt(r), new ae(t,
|
|
3607
3608
|
/* converter= */ null, new nt(r));
|
|
3608
3609
|
}
|
|
3609
3610
|
{
|
|
3610
|
-
if (!(t instanceof
|
|
3611
|
+
if (!(t instanceof ae || t instanceof le)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
|
|
3611
3612
|
const r = t._path.child(X.fromString(n, ...e));
|
|
3612
|
-
return rt(r), new
|
|
3613
|
+
return rt(r), new ae(t.firestore, t instanceof le ? t.converter : null, new nt(r));
|
|
3613
3614
|
}
|
|
3614
3615
|
}
|
|
3615
3616
|
|
|
@@ -3620,8 +3621,8 @@ function me(t, n, ...e) {
|
|
|
3620
3621
|
* @param right - A reference to compare.
|
|
3621
3622
|
* @returns true if the references point to the same location in the same
|
|
3622
3623
|
* Firestore database.
|
|
3623
|
-
*/ function
|
|
3624
|
-
return t = getModularInstance(t), n = getModularInstance(n), (t instanceof
|
|
3624
|
+
*/ function me(t, n) {
|
|
3625
|
+
return t = getModularInstance(t), n = getModularInstance(n), (t instanceof ae || t instanceof le) && (n instanceof ae || n instanceof le) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
|
|
3625
3626
|
}
|
|
3626
3627
|
|
|
3627
3628
|
/**
|
|
@@ -3632,8 +3633,8 @@ function me(t, n, ...e) {
|
|
|
3632
3633
|
* @param right - A `Query` to compare.
|
|
3633
3634
|
* @returns true if the references point to the same location in the same
|
|
3634
3635
|
* Firestore database.
|
|
3635
|
-
*/ function
|
|
3636
|
-
return t = getModularInstance(t), n = getModularInstance(n), t instanceof
|
|
3636
|
+
*/ function pe(t, n) {
|
|
3637
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof he && n instanceof he && (t.firestore === n.firestore && wn(t._query, n._query) && t.converter === n.converter);
|
|
3637
3638
|
}
|
|
3638
3639
|
|
|
3639
3640
|
/**
|
|
@@ -3659,7 +3660,7 @@ function me(t, n, ...e) {
|
|
|
3659
3660
|
*
|
|
3660
3661
|
* Create a `FieldPath` by providing field names. If more than one field
|
|
3661
3662
|
* name is provided, the path will point to a nested field in a document.
|
|
3662
|
-
*/ class
|
|
3663
|
+
*/ class ye {
|
|
3663
3664
|
/**
|
|
3664
3665
|
* Creates a `FieldPath` from the provided field names. If more than one field
|
|
3665
3666
|
* name is provided, the path will point to a nested field in a document.
|
|
@@ -3683,8 +3684,8 @@ function me(t, n, ...e) {
|
|
|
3683
3684
|
/**
|
|
3684
3685
|
* Returns a special sentinel `FieldPath` to refer to the ID of a document.
|
|
3685
3686
|
* It can be used in queries to sort or filter by the document ID.
|
|
3686
|
-
*/ function
|
|
3687
|
-
return new
|
|
3687
|
+
*/ function _e() {
|
|
3688
|
+
return new ye("__name__");
|
|
3688
3689
|
}
|
|
3689
3690
|
|
|
3690
3691
|
/**
|
|
@@ -3705,7 +3706,7 @@ function me(t, n, ...e) {
|
|
|
3705
3706
|
*/
|
|
3706
3707
|
/**
|
|
3707
3708
|
* An immutable object representing an array of bytes.
|
|
3708
|
-
*/ class
|
|
3709
|
+
*/ class ge {
|
|
3709
3710
|
/** @hideconstructor */
|
|
3710
3711
|
constructor(t) {
|
|
3711
3712
|
this._byteString = t;
|
|
@@ -3717,7 +3718,7 @@ function me(t, n, ...e) {
|
|
|
3717
3718
|
* @param base64 - The Base64 string used to create the `Bytes` object.
|
|
3718
3719
|
*/ static fromBase64String(t) {
|
|
3719
3720
|
try {
|
|
3720
|
-
return new
|
|
3721
|
+
return new ge(It.fromBase64String(t));
|
|
3721
3722
|
} catch (t) {
|
|
3722
3723
|
throw new U(A, "Failed to construct data from Base64 string: " + t);
|
|
3723
3724
|
}
|
|
@@ -3727,7 +3728,7 @@ function me(t, n, ...e) {
|
|
|
3727
3728
|
*
|
|
3728
3729
|
* @param array - The Uint8Array used to create the `Bytes` object.
|
|
3729
3730
|
*/ static fromUint8Array(t) {
|
|
3730
|
-
return new
|
|
3731
|
+
return new ge(It.fromUint8Array(t));
|
|
3731
3732
|
}
|
|
3732
3733
|
/**
|
|
3733
3734
|
* Returns the underlying bytes as a Base64-encoded string.
|
|
@@ -3779,7 +3780,7 @@ function me(t, n, ...e) {
|
|
|
3779
3780
|
/**
|
|
3780
3781
|
* Sentinel values that can be used when writing document fields with `set()`
|
|
3781
3782
|
* or `update()`.
|
|
3782
|
-
*/ class
|
|
3783
|
+
*/ class ve {
|
|
3783
3784
|
/**
|
|
3784
3785
|
* @param _methodName - The public API endpoint that returns this class.
|
|
3785
3786
|
* @hideconstructor
|
|
@@ -3811,7 +3812,7 @@ function me(t, n, ...e) {
|
|
|
3811
3812
|
*
|
|
3812
3813
|
* Latitude values are in the range of [-90, 90].
|
|
3813
3814
|
* Longitude values are in the range of [-180, 180].
|
|
3814
|
-
*/ class
|
|
3815
|
+
*/ class be {
|
|
3815
3816
|
/**
|
|
3816
3817
|
* Creates a new immutable `GeoPoint` object with the provided latitude and
|
|
3817
3818
|
* longitude values.
|
|
@@ -3870,9 +3871,9 @@ function me(t, n, ...e) {
|
|
|
3870
3871
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3871
3872
|
* See the License for the specific language governing permissions and
|
|
3872
3873
|
* limitations under the License.
|
|
3873
|
-
*/ const
|
|
3874
|
+
*/ const Ee = /^__.*__$/;
|
|
3874
3875
|
|
|
3875
|
-
/** The result of parsing document data (e.g. for a setData call). */ class
|
|
3876
|
+
/** The result of parsing document data (e.g. for a setData call). */ class Te {
|
|
3876
3877
|
constructor(t, n, e) {
|
|
3877
3878
|
this.data = t, this.fieldMask = n, this.fieldTransforms = e;
|
|
3878
3879
|
}
|
|
@@ -3881,7 +3882,7 @@ function me(t, n, ...e) {
|
|
|
3881
3882
|
}
|
|
3882
3883
|
}
|
|
3883
3884
|
|
|
3884
|
-
/** The result of parsing "update" data (i.e. for an updateData call). */ class
|
|
3885
|
+
/** The result of parsing "update" data (i.e. for an updateData call). */ class Ie {
|
|
3885
3886
|
constructor(t,
|
|
3886
3887
|
// The fieldMask does not include document transforms.
|
|
3887
3888
|
n, e) {
|
|
@@ -3892,7 +3893,7 @@ function me(t, n, ...e) {
|
|
|
3892
3893
|
}
|
|
3893
3894
|
}
|
|
3894
3895
|
|
|
3895
|
-
function
|
|
3896
|
+
function Ae(t) {
|
|
3896
3897
|
switch (t) {
|
|
3897
3898
|
case 0 /* Set */ :
|
|
3898
3899
|
// fall through
|
|
@@ -3910,7 +3911,7 @@ function Re(t) {
|
|
|
3910
3911
|
}
|
|
3911
3912
|
}
|
|
3912
3913
|
|
|
3913
|
-
/** A "context" object passed around while parsing user data. */ class
|
|
3914
|
+
/** A "context" object passed around while parsing user data. */ class Re {
|
|
3914
3915
|
/**
|
|
3915
3916
|
* Initializes a ParseContext with the given source and path.
|
|
3916
3917
|
*
|
|
@@ -3942,7 +3943,7 @@ function Re(t) {
|
|
|
3942
3943
|
return this.settings.tt;
|
|
3943
3944
|
}
|
|
3944
3945
|
/** Returns a new context with the specified settings overwritten. */ nt(t) {
|
|
3945
|
-
return new
|
|
3946
|
+
return new Re(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
|
|
3946
3947
|
}
|
|
3947
3948
|
et(t) {
|
|
3948
3949
|
var n;
|
|
@@ -3969,7 +3970,7 @@ function Re(t) {
|
|
|
3969
3970
|
});
|
|
3970
3971
|
}
|
|
3971
3972
|
ut(t) {
|
|
3972
|
-
return
|
|
3973
|
+
return Qe(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
|
|
3973
3974
|
}
|
|
3974
3975
|
/** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
|
|
3975
3976
|
return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
|
|
@@ -3981,19 +3982,19 @@ function Re(t) {
|
|
|
3981
3982
|
}
|
|
3982
3983
|
st(t) {
|
|
3983
3984
|
if (0 === t.length) throw this.ut("Document fields must not be empty");
|
|
3984
|
-
if (
|
|
3985
|
+
if (Ae(this.tt) && Ee.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
|
|
3985
3986
|
}
|
|
3986
3987
|
}
|
|
3987
3988
|
|
|
3988
3989
|
/**
|
|
3989
3990
|
* Helper for parsing raw user input (provided via the API) into internal model
|
|
3990
3991
|
* classes.
|
|
3991
|
-
*/ class
|
|
3992
|
+
*/ class Pe {
|
|
3992
3993
|
constructor(t, n, e) {
|
|
3993
|
-
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e ||
|
|
3994
|
+
this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Hn(t);
|
|
3994
3995
|
}
|
|
3995
3996
|
/** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
|
|
3996
|
-
return new
|
|
3997
|
+
return new Re({
|
|
3997
3998
|
tt: t,
|
|
3998
3999
|
methodName: n,
|
|
3999
4000
|
at: e,
|
|
@@ -4004,29 +4005,29 @@ function Re(t) {
|
|
|
4004
4005
|
}
|
|
4005
4006
|
}
|
|
4006
4007
|
|
|
4007
|
-
function
|
|
4008
|
-
const n = t._freezeSettings(), e =
|
|
4009
|
-
return new
|
|
4008
|
+
function Ve(t) {
|
|
4009
|
+
const n = t._freezeSettings(), e = Hn(t._databaseId);
|
|
4010
|
+
return new Pe(t._databaseId, !!n.ignoreUndefinedProperties, e);
|
|
4010
4011
|
}
|
|
4011
4012
|
|
|
4012
|
-
/** Parse document data from a set() call. */ function
|
|
4013
|
+
/** Parse document data from a set() call. */ function De(t, n, e, r, s, i = {}) {
|
|
4013
4014
|
const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
|
|
4014
|
-
|
|
4015
|
-
const u =
|
|
4015
|
+
Me("Data must be an object, but it was:", o, r);
|
|
4016
|
+
const u = ke(r, o);
|
|
4016
4017
|
let c, a;
|
|
4017
4018
|
if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
|
|
4018
4019
|
const t = [];
|
|
4019
4020
|
for (const r of i.mergeFields) {
|
|
4020
|
-
const s =
|
|
4021
|
+
const s = Be(n, r, e);
|
|
4021
4022
|
if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
|
|
4022
|
-
|
|
4023
|
+
We(t, s) || t.push(s);
|
|
4023
4024
|
}
|
|
4024
4025
|
c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
|
|
4025
4026
|
} else c = null, a = o.fieldTransforms;
|
|
4026
|
-
return new
|
|
4027
|
+
return new Te(new Bt(u), c, a);
|
|
4027
4028
|
}
|
|
4028
4029
|
|
|
4029
|
-
class
|
|
4030
|
+
class Ne extends ve {
|
|
4030
4031
|
_toFieldTransform(t) {
|
|
4031
4032
|
if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
4032
4033
|
// No transform to add for a delete, but we need to add it to our
|
|
@@ -4034,7 +4035,7 @@ class $e extends be {
|
|
|
4034
4035
|
return t.fieldMask.push(t.path), null;
|
|
4035
4036
|
}
|
|
4036
4037
|
isEqual(t) {
|
|
4037
|
-
return t instanceof
|
|
4038
|
+
return t instanceof Ne;
|
|
4038
4039
|
}
|
|
4039
4040
|
}
|
|
4040
4041
|
|
|
@@ -4053,8 +4054,8 @@ class $e extends be {
|
|
|
4053
4054
|
* context.
|
|
4054
4055
|
* @param context - The parent context.
|
|
4055
4056
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
4056
|
-
*/ function
|
|
4057
|
-
return new
|
|
4057
|
+
*/ function $e(t, n, e) {
|
|
4058
|
+
return new Re({
|
|
4058
4059
|
tt: 3 /* Argument */ ,
|
|
4059
4060
|
at: n.settings.at,
|
|
4060
4061
|
methodName: t._methodName,
|
|
@@ -4062,22 +4063,22 @@ class $e extends be {
|
|
|
4062
4063
|
}, n.databaseId, n.q, n.ignoreUndefinedProperties);
|
|
4063
4064
|
}
|
|
4064
4065
|
|
|
4065
|
-
class
|
|
4066
|
+
class Se extends ve {
|
|
4066
4067
|
_toFieldTransform(t) {
|
|
4067
4068
|
return new bn(t.path, new yn);
|
|
4068
4069
|
}
|
|
4069
4070
|
isEqual(t) {
|
|
4070
|
-
return t instanceof
|
|
4071
|
+
return t instanceof Se;
|
|
4071
4072
|
}
|
|
4072
4073
|
}
|
|
4073
4074
|
|
|
4074
|
-
class
|
|
4075
|
+
class Fe extends ve {
|
|
4075
4076
|
constructor(t, n) {
|
|
4076
4077
|
super(t), this.lt = n;
|
|
4077
4078
|
}
|
|
4078
4079
|
_toFieldTransform(t) {
|
|
4079
|
-
const n =
|
|
4080
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4080
|
+
const n = $e(this, t,
|
|
4081
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new _n(e);
|
|
4081
4082
|
return new bn(t.path, r);
|
|
4082
4083
|
}
|
|
4083
4084
|
isEqual(t) {
|
|
@@ -4086,13 +4087,13 @@ class xe extends be {
|
|
|
4086
4087
|
}
|
|
4087
4088
|
}
|
|
4088
4089
|
|
|
4089
|
-
class
|
|
4090
|
+
class xe extends ve {
|
|
4090
4091
|
constructor(t, n) {
|
|
4091
4092
|
super(t), this.lt = n;
|
|
4092
4093
|
}
|
|
4093
4094
|
_toFieldTransform(t) {
|
|
4094
|
-
const n =
|
|
4095
|
-
/*array=*/ !0), e = this.lt.map((t =>
|
|
4095
|
+
const n = $e(this, t,
|
|
4096
|
+
/*array=*/ !0), e = this.lt.map((t => Ue(t, n))), r = new gn(e);
|
|
4096
4097
|
return new bn(t.path, r);
|
|
4097
4098
|
}
|
|
4098
4099
|
isEqual(t) {
|
|
@@ -4101,7 +4102,7 @@ class qe extends be {
|
|
|
4101
4102
|
}
|
|
4102
4103
|
}
|
|
4103
4104
|
|
|
4104
|
-
class
|
|
4105
|
+
class qe extends ve {
|
|
4105
4106
|
constructor(t, n) {
|
|
4106
4107
|
super(t), this.ft = n;
|
|
4107
4108
|
}
|
|
@@ -4115,50 +4116,50 @@ class Oe extends be {
|
|
|
4115
4116
|
}
|
|
4116
4117
|
}
|
|
4117
4118
|
|
|
4118
|
-
/** Parse update data from an update() call. */ function
|
|
4119
|
+
/** Parse update data from an update() call. */ function Oe(t, n, e, r) {
|
|
4119
4120
|
const s = t.ht(1 /* Update */ , n, e);
|
|
4120
|
-
|
|
4121
|
+
Me("Data must be an object, but it was:", s, r);
|
|
4121
4122
|
const i = [], o = Bt.empty();
|
|
4122
4123
|
Et(r, ((t, r) => {
|
|
4123
|
-
const u =
|
|
4124
|
+
const u = Ge(n, t, e);
|
|
4124
4125
|
// For Compat types, we have to "extract" the underlying types before
|
|
4125
4126
|
// performing validation.
|
|
4126
4127
|
r = getModularInstance(r);
|
|
4127
4128
|
const c = s.it(u);
|
|
4128
|
-
if (r instanceof
|
|
4129
|
+
if (r instanceof Ne)
|
|
4129
4130
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4130
4131
|
i.push(u); else {
|
|
4131
|
-
const t =
|
|
4132
|
+
const t = Ue(r, c);
|
|
4132
4133
|
null != t && (i.push(u), o.set(u, t));
|
|
4133
4134
|
}
|
|
4134
4135
|
}));
|
|
4135
4136
|
const u = new Tt(i);
|
|
4136
|
-
return new
|
|
4137
|
+
return new Ie(o, u, s.fieldTransforms);
|
|
4137
4138
|
}
|
|
4138
4139
|
|
|
4139
|
-
/** Parse update data from a list of field/value arguments. */ function
|
|
4140
|
-
const o = t.ht(1 /* Update */ , n, e), u = [
|
|
4140
|
+
/** Parse update data from a list of field/value arguments. */ function Ce(t, n, e, r, s, i) {
|
|
4141
|
+
const o = t.ht(1 /* Update */ , n, e), u = [ Be(n, r, e) ], c = [ s ];
|
|
4141
4142
|
if (i.length % 2 != 0) throw new U(A, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
4142
|
-
for (let t = 0; t < i.length; t += 2) u.push(
|
|
4143
|
+
for (let t = 0; t < i.length; t += 2) u.push(Be(n, i[t])), c.push(i[t + 1]);
|
|
4143
4144
|
const a = [], l = Bt.empty();
|
|
4144
4145
|
// We iterate in reverse order to pick the last value for a field if the
|
|
4145
4146
|
// user specified the field multiple times.
|
|
4146
|
-
for (let t = u.length - 1; t >= 0; --t) if (!
|
|
4147
|
+
for (let t = u.length - 1; t >= 0; --t) if (!We(a, u[t])) {
|
|
4147
4148
|
const n = u[t];
|
|
4148
4149
|
let e = c[t];
|
|
4149
4150
|
// For Compat types, we have to "extract" the underlying types before
|
|
4150
4151
|
// performing validation.
|
|
4151
4152
|
e = getModularInstance(e);
|
|
4152
4153
|
const r = o.it(n);
|
|
4153
|
-
if (e instanceof
|
|
4154
|
+
if (e instanceof Ne)
|
|
4154
4155
|
// Add it to the field mask, but don't add anything to updateData.
|
|
4155
4156
|
a.push(n); else {
|
|
4156
|
-
const t =
|
|
4157
|
+
const t = Ue(e, r);
|
|
4157
4158
|
null != t && (a.push(n), l.set(n, t));
|
|
4158
4159
|
}
|
|
4159
4160
|
}
|
|
4160
4161
|
const f = new Tt(a);
|
|
4161
|
-
return new
|
|
4162
|
+
return new Ie(l, f, o.fieldTransforms);
|
|
4162
4163
|
}
|
|
4163
4164
|
|
|
4164
4165
|
/**
|
|
@@ -4167,8 +4168,8 @@ class Oe extends be {
|
|
|
4167
4168
|
*
|
|
4168
4169
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
4169
4170
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
4170
|
-
*/ function
|
|
4171
|
-
return
|
|
4171
|
+
*/ function Le(t, n, e, r = !1) {
|
|
4172
|
+
return Ue(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
|
|
4172
4173
|
}
|
|
4173
4174
|
|
|
4174
4175
|
/**
|
|
@@ -4179,12 +4180,12 @@ class Oe extends be {
|
|
|
4179
4180
|
* the source of the data being parsed, etc.
|
|
4180
4181
|
* @returns The parsed value, or null if the value was a FieldValue sentinel
|
|
4181
4182
|
* that should not be included in the resulting parsed data.
|
|
4182
|
-
*/ function
|
|
4183
|
-
if (
|
|
4183
|
+
*/ function Ue(t, n) {
|
|
4184
|
+
if (je(
|
|
4184
4185
|
// Unwrap the API type from the Compat SDK. This will return the API type
|
|
4185
4186
|
// from firestore-exp.
|
|
4186
|
-
t = getModularInstance(t))) return
|
|
4187
|
-
if (t instanceof
|
|
4187
|
+
t = getModularInstance(t))) return Me("Unsupported field value:", n, t), ke(t, n);
|
|
4188
|
+
if (t instanceof ve)
|
|
4188
4189
|
// FieldValues usually parse into transforms (except deleteField())
|
|
4189
4190
|
// in which case we do not want to include this field in our parsed data
|
|
4190
4191
|
// (as doing so will overwrite the field directly prior to the transform
|
|
@@ -4196,7 +4197,7 @@ class Oe extends be {
|
|
|
4196
4197
|
*/
|
|
4197
4198
|
return function(t, n) {
|
|
4198
4199
|
// Sentinels are only supported with writes, and not within arrays.
|
|
4199
|
-
if (!
|
|
4200
|
+
if (!Ae(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
|
|
4200
4201
|
if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
|
|
4201
4202
|
const e = t._toFieldTransform(n);
|
|
4202
4203
|
e && n.fieldTransforms.push(e);
|
|
@@ -4226,7 +4227,7 @@ class Oe extends be {
|
|
|
4226
4227
|
const e = [];
|
|
4227
4228
|
let r = 0;
|
|
4228
4229
|
for (const s of t) {
|
|
4229
|
-
let t =
|
|
4230
|
+
let t = Ue(s, n.ot(r));
|
|
4230
4231
|
null == t && (
|
|
4231
4232
|
// Just include nulls in the array for fields being replaced with a
|
|
4232
4233
|
// sentinel.
|
|
@@ -4267,16 +4268,16 @@ class Oe extends be {
|
|
|
4267
4268
|
timestampValue: $n(n.q, e)
|
|
4268
4269
|
};
|
|
4269
4270
|
}
|
|
4270
|
-
if (t instanceof
|
|
4271
|
+
if (t instanceof be) return {
|
|
4271
4272
|
geoPointValue: {
|
|
4272
4273
|
latitude: t.latitude,
|
|
4273
4274
|
longitude: t.longitude
|
|
4274
4275
|
}
|
|
4275
4276
|
};
|
|
4276
|
-
if (t instanceof
|
|
4277
|
+
if (t instanceof ge) return {
|
|
4277
4278
|
bytesValue: Sn(n.q, t._byteString)
|
|
4278
4279
|
};
|
|
4279
|
-
if (t instanceof
|
|
4280
|
+
if (t instanceof ae) {
|
|
4280
4281
|
const e = n.databaseId, r = t.firestore._databaseId;
|
|
4281
4282
|
if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
|
|
4282
4283
|
return {
|
|
@@ -4294,13 +4295,13 @@ class Oe extends be {
|
|
|
4294
4295
|
*/ (t, n);
|
|
4295
4296
|
}
|
|
4296
4297
|
|
|
4297
|
-
function
|
|
4298
|
+
function ke(t, n) {
|
|
4298
4299
|
const e = {};
|
|
4299
4300
|
return !function(t) {
|
|
4300
4301
|
for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
|
|
4301
4302
|
return !0;
|
|
4302
4303
|
}(t) ? Et(t, ((t, r) => {
|
|
4303
|
-
const s =
|
|
4304
|
+
const s = Ue(r, n.et(t));
|
|
4304
4305
|
null != s && (e[t] = s);
|
|
4305
4306
|
})) :
|
|
4306
4307
|
// If we encounter an empty object, we explicitly add it to the update
|
|
@@ -4312,12 +4313,12 @@ function je(t, n) {
|
|
|
4312
4313
|
};
|
|
4313
4314
|
}
|
|
4314
4315
|
|
|
4315
|
-
function
|
|
4316
|
-
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof
|
|
4316
|
+
function je(t) {
|
|
4317
|
+
return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof be || t instanceof ge || t instanceof ae || t instanceof ve);
|
|
4317
4318
|
}
|
|
4318
4319
|
|
|
4319
|
-
function
|
|
4320
|
-
if (!
|
|
4320
|
+
function Me(t, n, e) {
|
|
4321
|
+
if (!je(e) || !function(t) {
|
|
4321
4322
|
return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
|
|
4322
4323
|
}(e)) {
|
|
4323
4324
|
const r = it(e);
|
|
@@ -4327,20 +4328,20 @@ function Be(t, n, e) {
|
|
|
4327
4328
|
|
|
4328
4329
|
/**
|
|
4329
4330
|
* Helper that calls fromDotSeparatedString() but wraps any error thrown.
|
|
4330
|
-
*/ function
|
|
4331
|
+
*/ function Be(t, n, e) {
|
|
4331
4332
|
if ((
|
|
4332
4333
|
// If required, replace the FieldPath Compat class with with the firestore-exp
|
|
4333
4334
|
// FieldPath.
|
|
4334
|
-
n = getModularInstance(n)) instanceof
|
|
4335
|
-
if ("string" == typeof n) return
|
|
4336
|
-
throw
|
|
4335
|
+
n = getModularInstance(n)) instanceof ye) return n._internalPath;
|
|
4336
|
+
if ("string" == typeof n) return Ge(t, n);
|
|
4337
|
+
throw Qe("Field path arguments must be of type string or ", t,
|
|
4337
4338
|
/* hasConverter= */ !1,
|
|
4338
4339
|
/* path= */ void 0, e);
|
|
4339
4340
|
}
|
|
4340
4341
|
|
|
4341
4342
|
/**
|
|
4342
4343
|
* Matches any characters in a field path string that are reserved.
|
|
4343
|
-
*/ const
|
|
4344
|
+
*/ const ze = new RegExp("[~\\*/\\[\\]]");
|
|
4344
4345
|
|
|
4345
4346
|
/**
|
|
4346
4347
|
* Wraps fromDotSeparatedString with an error message about the method that
|
|
@@ -4350,20 +4351,20 @@ function Be(t, n, e) {
|
|
|
4350
4351
|
* split on dots.
|
|
4351
4352
|
* @param targetDoc - The document against which the field path will be
|
|
4352
4353
|
* evaluated.
|
|
4353
|
-
*/ function
|
|
4354
|
-
if (n.search(
|
|
4354
|
+
*/ function Ge(t, n, e) {
|
|
4355
|
+
if (n.search(ze) >= 0) throw Qe(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
|
|
4355
4356
|
/* hasConverter= */ !1,
|
|
4356
4357
|
/* path= */ void 0, e);
|
|
4357
4358
|
try {
|
|
4358
|
-
return new
|
|
4359
|
+
return new ye(...n.split("."))._internalPath;
|
|
4359
4360
|
} catch (r) {
|
|
4360
|
-
throw
|
|
4361
|
+
throw Qe(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
|
|
4361
4362
|
/* hasConverter= */ !1,
|
|
4362
4363
|
/* path= */ void 0, e);
|
|
4363
4364
|
}
|
|
4364
4365
|
}
|
|
4365
4366
|
|
|
4366
|
-
function
|
|
4367
|
+
function Qe(t, n, e, r, s) {
|
|
4367
4368
|
const i = r && !r.isEmpty(), o = void 0 !== s;
|
|
4368
4369
|
let u = `Function ${n}() called with invalid data`;
|
|
4369
4370
|
e && (u += " (via `toFirestore()`)"), u += ". ";
|
|
@@ -4372,7 +4373,7 @@ function We(t, n, e, r, s) {
|
|
|
4372
4373
|
c += ")"), new U(A, u + t + c);
|
|
4373
4374
|
}
|
|
4374
4375
|
|
|
4375
|
-
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function
|
|
4376
|
+
/** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function We(t, n) {
|
|
4376
4377
|
return t.some((t => t.isEqual(n)));
|
|
4377
4378
|
}
|
|
4378
4379
|
|
|
@@ -4400,7 +4401,7 @@ function We(t, n, e, r, s) {
|
|
|
4400
4401
|
* For a `DocumentSnapshot` that points to a non-existing document, any data
|
|
4401
4402
|
* access will return 'undefined'. You can use the `exists()` method to
|
|
4402
4403
|
* explicitly verify a document's existence.
|
|
4403
|
-
*/ class
|
|
4404
|
+
*/ class Ye {
|
|
4404
4405
|
// Note: This class is stripped down version of the DocumentSnapshot in
|
|
4405
4406
|
// the legacy SDK. The changes are:
|
|
4406
4407
|
// - No support for SnapshotMetadata.
|
|
@@ -4416,7 +4417,7 @@ function We(t, n, e, r, s) {
|
|
|
4416
4417
|
/**
|
|
4417
4418
|
* The `DocumentReference` for the document included in the `DocumentSnapshot`.
|
|
4418
4419
|
*/ get ref() {
|
|
4419
|
-
return new
|
|
4420
|
+
return new ae(this._firestore, this._converter, this._key);
|
|
4420
4421
|
}
|
|
4421
4422
|
/**
|
|
4422
4423
|
* Signals whether or not the document at the snapshot's location exists.
|
|
@@ -4436,7 +4437,7 @@ function We(t, n, e, r, s) {
|
|
|
4436
4437
|
if (this._converter) {
|
|
4437
4438
|
// We only want to use the converter and create a new DocumentSnapshot
|
|
4438
4439
|
// if a converter has been provided.
|
|
4439
|
-
const t = new
|
|
4440
|
+
const t = new He(this._firestore, this._userDataWriter, this._key, this._document,
|
|
4440
4441
|
/* converter= */ null);
|
|
4441
4442
|
return this._converter.fromFirestore(t);
|
|
4442
4443
|
}
|
|
@@ -4456,7 +4457,7 @@ function We(t, n, e, r, s) {
|
|
|
4456
4457
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4457
4458
|
get(t) {
|
|
4458
4459
|
if (this._document) {
|
|
4459
|
-
const n = this._document.data.field(
|
|
4460
|
+
const n = this._document.data.field(Xe("DocumentSnapshot.get", t));
|
|
4460
4461
|
if (null !== n) return this._userDataWriter.convertValue(n);
|
|
4461
4462
|
}
|
|
4462
4463
|
}
|
|
@@ -4472,7 +4473,7 @@ function We(t, n, e, r, s) {
|
|
|
4472
4473
|
* `DocumentSnapshot`. Since query results contain only existing documents, the
|
|
4473
4474
|
* `exists` property will always be true and `data()` will never return
|
|
4474
4475
|
* 'undefined'.
|
|
4475
|
-
*/ class
|
|
4476
|
+
*/ class He extends Ye {
|
|
4476
4477
|
/**
|
|
4477
4478
|
* Retrieves all fields in the document as an `Object`.
|
|
4478
4479
|
*
|
|
@@ -4490,7 +4491,7 @@ function We(t, n, e, r, s) {
|
|
|
4490
4491
|
* array via the `docs` property or enumerated using the `forEach` method. The
|
|
4491
4492
|
* number of documents can be determined via the `empty` and `size`
|
|
4492
4493
|
* properties.
|
|
4493
|
-
*/ class
|
|
4494
|
+
*/ class Ke {
|
|
4494
4495
|
/** @hideconstructor */
|
|
4495
4496
|
constructor(t, n) {
|
|
4496
4497
|
this._docs = n, this.query = t;
|
|
@@ -4521,14 +4522,14 @@ function We(t, n, e, r, s) {
|
|
|
4521
4522
|
* @param left - A snapshot to compare.
|
|
4522
4523
|
* @param right - A snapshot to compare.
|
|
4523
4524
|
* @returns true if the snapshots are equal.
|
|
4524
|
-
*/ function
|
|
4525
|
-
return t = getModularInstance(t), n = getModularInstance(n), t instanceof
|
|
4525
|
+
*/ function Je(t, n) {
|
|
4526
|
+
return t = getModularInstance(t), n = getModularInstance(n), t instanceof Ye && n instanceof Ye ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Ke && n instanceof Ke && (pe(t.query, n.query) && _t(t.docs, n.docs, Je));
|
|
4526
4527
|
}
|
|
4527
4528
|
|
|
4528
4529
|
/**
|
|
4529
4530
|
* Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
|
|
4530
|
-
*/ function
|
|
4531
|
-
return "string" == typeof n ?
|
|
4531
|
+
*/ function Xe(t, n) {
|
|
4532
|
+
return "string" == typeof n ? Ge(t, n) : n instanceof ye ? n._internalPath : n._delegate._internalPath;
|
|
4532
4533
|
}
|
|
4533
4534
|
|
|
4534
4535
|
/**
|
|
@@ -4555,7 +4556,7 @@ function We(t, n, e, r, s) {
|
|
|
4555
4556
|
* can then be passed to {@link query} to create a new query instance that
|
|
4556
4557
|
* also contains this `QueryConstraint`.
|
|
4557
4558
|
*/
|
|
4558
|
-
class
|
|
4559
|
+
class Ze {}
|
|
4559
4560
|
|
|
4560
4561
|
/**
|
|
4561
4562
|
* Creates a new immutable instance of {@link Query} that is extended to also include
|
|
@@ -4565,32 +4566,32 @@ class tr {}
|
|
|
4565
4566
|
* @param queryConstraints - The list of {@link QueryConstraint}s to apply.
|
|
4566
4567
|
* @throws if any of the provided query constraints cannot be combined with the
|
|
4567
4568
|
* existing or new constraints.
|
|
4568
|
-
*/ function
|
|
4569
|
+
*/ function tr(t, ...n) {
|
|
4569
4570
|
for (const e of n) t = e._apply(t);
|
|
4570
4571
|
return t;
|
|
4571
4572
|
}
|
|
4572
4573
|
|
|
4573
|
-
class
|
|
4574
|
+
class nr extends Ze {
|
|
4574
4575
|
constructor(t, n, e) {
|
|
4575
4576
|
super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
|
|
4576
4577
|
}
|
|
4577
4578
|
_apply(t) {
|
|
4578
|
-
const n =
|
|
4579
|
+
const n = Ve(t.firestore), e = function(t, n, e, r, s, i, o) {
|
|
4579
4580
|
let u;
|
|
4580
4581
|
if (s.isKeyField()) {
|
|
4581
4582
|
if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
|
|
4582
4583
|
if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
|
|
4583
|
-
|
|
4584
|
+
pr(o, i);
|
|
4584
4585
|
const n = [];
|
|
4585
|
-
for (const e of o) n.push(
|
|
4586
|
+
for (const e of o) n.push(mr(r, t, e));
|
|
4586
4587
|
u = {
|
|
4587
4588
|
arrayValue: {
|
|
4588
4589
|
values: n
|
|
4589
4590
|
}
|
|
4590
4591
|
};
|
|
4591
|
-
} else u =
|
|
4592
|
-
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i ||
|
|
4593
|
-
u =
|
|
4592
|
+
} else u = mr(r, t, o);
|
|
4593
|
+
} else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
|
|
4594
|
+
u = Le(e, n, o,
|
|
4594
4595
|
/* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
|
|
4595
4596
|
const c = Wt.create(s, i, u);
|
|
4596
4597
|
return function(t, n) {
|
|
@@ -4598,7 +4599,7 @@ class er extends tr {
|
|
|
4598
4599
|
const e = hn(t);
|
|
4599
4600
|
if (null !== e && !e.isEqual(n.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
|
|
4600
4601
|
const r = an(t);
|
|
4601
|
-
null !== r &&
|
|
4602
|
+
null !== r && yr(t, n.field, r);
|
|
4602
4603
|
}
|
|
4603
4604
|
const e = function(t, n) {
|
|
4604
4605
|
for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
|
|
@@ -4642,7 +4643,7 @@ class er extends tr {
|
|
|
4642
4643
|
throw e === n.op ? new U(A, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
|
|
4643
4644
|
}(t, c), c;
|
|
4644
4645
|
}(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
|
|
4645
|
-
return new
|
|
4646
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4646
4647
|
const e = t.filters.concat([ n ]);
|
|
4647
4648
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
|
|
4648
4649
|
}(t._query, e));
|
|
@@ -4659,12 +4660,12 @@ class er extends tr {
|
|
|
4659
4660
|
* "<=", "!=").
|
|
4660
4661
|
* @param value - The value for comparison
|
|
4661
4662
|
* @returns The created {@link Query}.
|
|
4662
|
-
*/ function
|
|
4663
|
-
const r = n, s =
|
|
4664
|
-
return new
|
|
4663
|
+
*/ function er(t, n, e) {
|
|
4664
|
+
const r = n, s = Xe("where", t);
|
|
4665
|
+
return new nr(s, r, e);
|
|
4665
4666
|
}
|
|
4666
4667
|
|
|
4667
|
-
class
|
|
4668
|
+
class rr extends Ze {
|
|
4668
4669
|
constructor(t, n) {
|
|
4669
4670
|
super(), this.dt = t, this._t = n, this.type = "orderBy";
|
|
4670
4671
|
}
|
|
@@ -4677,7 +4678,7 @@ class sr extends tr {
|
|
|
4677
4678
|
if (null === an(t)) {
|
|
4678
4679
|
// This is the first order by. It must match any inequality.
|
|
4679
4680
|
const e = hn(t);
|
|
4680
|
-
null !== e &&
|
|
4681
|
+
null !== e && yr(t, e, n.field);
|
|
4681
4682
|
}
|
|
4682
4683
|
}(t, r), r;
|
|
4683
4684
|
}
|
|
@@ -4692,7 +4693,7 @@ class sr extends tr {
|
|
|
4692
4693
|
* of the query or if any of the fields in the order by are an uncommitted
|
|
4693
4694
|
* server timestamp.
|
|
4694
4695
|
*/ (t._query, this.dt, this._t);
|
|
4695
|
-
return new
|
|
4696
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4696
4697
|
// TODO(dimond): validate that orderBy does not list the same key twice.
|
|
4697
4698
|
const e = t.explicitOrderBy.concat([ n ]);
|
|
4698
4699
|
return new un(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
|
|
@@ -4708,17 +4709,17 @@ class sr extends tr {
|
|
|
4708
4709
|
* @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
|
|
4709
4710
|
* not specified, order will be ascending.
|
|
4710
4711
|
* @returns The created {@link Query}.
|
|
4711
|
-
*/ function
|
|
4712
|
-
const e = n, r =
|
|
4713
|
-
return new
|
|
4712
|
+
*/ function sr(t, n = "asc") {
|
|
4713
|
+
const e = n, r = Xe("orderBy", t);
|
|
4714
|
+
return new rr(r, e);
|
|
4714
4715
|
}
|
|
4715
4716
|
|
|
4716
|
-
class
|
|
4717
|
+
class ir extends Ze {
|
|
4717
4718
|
constructor(t, n, e) {
|
|
4718
4719
|
super(), this.type = t, this.gt = n, this.vt = e;
|
|
4719
4720
|
}
|
|
4720
4721
|
_apply(t) {
|
|
4721
|
-
return new
|
|
4722
|
+
return new he(t.firestore, t.converter, function(t, n, e) {
|
|
4722
4723
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
|
|
4723
4724
|
}(t._query, this.gt, this.vt));
|
|
4724
4725
|
}
|
|
@@ -4729,8 +4730,8 @@ class or extends tr {
|
|
|
4729
4730
|
*
|
|
4730
4731
|
* @param limit - The maximum number of items to return.
|
|
4731
4732
|
* @returns The created {@link Query}.
|
|
4732
|
-
*/ function
|
|
4733
|
-
return ut("limit", t), new
|
|
4733
|
+
*/ function or(t) {
|
|
4734
|
+
return ut("limit", t), new ir("limit", t, "F" /* First */);
|
|
4734
4735
|
}
|
|
4735
4736
|
|
|
4736
4737
|
/**
|
|
@@ -4741,53 +4742,55 @@ class or extends tr {
|
|
|
4741
4742
|
*
|
|
4742
4743
|
* @param limit - The maximum number of items to return.
|
|
4743
4744
|
* @returns The created {@link Query}.
|
|
4744
|
-
*/ function
|
|
4745
|
-
return ut("limitToLast", t), new
|
|
4745
|
+
*/ function ur(t) {
|
|
4746
|
+
return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
|
|
4746
4747
|
}
|
|
4747
4748
|
|
|
4748
|
-
class
|
|
4749
|
+
class cr extends Ze {
|
|
4749
4750
|
constructor(t, n, e) {
|
|
4750
4751
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4751
4752
|
}
|
|
4752
4753
|
_apply(t) {
|
|
4753
|
-
const n =
|
|
4754
|
-
return new
|
|
4754
|
+
const n = wr(t, this.type, this.bt, this.Et);
|
|
4755
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4755
4756
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
|
|
4756
4757
|
}(t._query, n));
|
|
4757
4758
|
}
|
|
4758
4759
|
}
|
|
4759
4760
|
|
|
4760
|
-
function
|
|
4761
|
-
return new
|
|
4761
|
+
function ar(...t) {
|
|
4762
|
+
return new cr("startAt", t,
|
|
4763
|
+
/*inclusive=*/ !0);
|
|
4762
4764
|
}
|
|
4763
4765
|
|
|
4764
|
-
function
|
|
4765
|
-
return new
|
|
4766
|
-
/*
|
|
4766
|
+
function hr(...t) {
|
|
4767
|
+
return new cr("startAfter", t,
|
|
4768
|
+
/*inclusive=*/ !1);
|
|
4767
4769
|
}
|
|
4768
4770
|
|
|
4769
|
-
class
|
|
4771
|
+
class lr extends Ze {
|
|
4770
4772
|
constructor(t, n, e) {
|
|
4771
4773
|
super(), this.type = t, this.bt = n, this.Et = e;
|
|
4772
4774
|
}
|
|
4773
4775
|
_apply(t) {
|
|
4774
|
-
const n =
|
|
4775
|
-
return new
|
|
4776
|
+
const n = wr(t, this.type, this.bt, this.Et);
|
|
4777
|
+
return new he(t.firestore, t.converter, function(t, n) {
|
|
4776
4778
|
return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
|
|
4777
4779
|
}(t._query, n));
|
|
4778
4780
|
}
|
|
4779
4781
|
}
|
|
4780
4782
|
|
|
4781
|
-
function
|
|
4782
|
-
return new
|
|
4783
|
+
function fr(...t) {
|
|
4784
|
+
return new lr("endBefore", t,
|
|
4785
|
+
/*inclusive=*/ !1);
|
|
4783
4786
|
}
|
|
4784
4787
|
|
|
4785
|
-
function
|
|
4786
|
-
return new
|
|
4788
|
+
function dr(...t) {
|
|
4789
|
+
return new lr("endAt", t, /*inclusive=*/ !0);
|
|
4787
4790
|
}
|
|
4788
4791
|
|
|
4789
|
-
/** Helper function to create a bound from a document or fields */ function
|
|
4790
|
-
if (e[0] = getModularInstance(e[0]), e[0] instanceof
|
|
4792
|
+
/** Helper function to create a bound from a document or fields */ function wr(t, n, e, r) {
|
|
4793
|
+
if (e[0] = getModularInstance(e[0]), e[0] instanceof Ye) return function(t, n, e, r, s) {
|
|
4791
4794
|
if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
|
|
4792
4795
|
const i = [];
|
|
4793
4796
|
// Because people expect to continue/end a query at the exact document
|
|
@@ -4812,7 +4815,7 @@ function wr(...t) {
|
|
|
4812
4815
|
* Converts a list of field values to a `Bound` for the given query.
|
|
4813
4816
|
*/ (t._query, t.firestore._databaseId, n, e[0]._document, r);
|
|
4814
4817
|
{
|
|
4815
|
-
const s =
|
|
4818
|
+
const s = Ve(t.firestore);
|
|
4816
4819
|
return function(t, n, e, r, s, i) {
|
|
4817
4820
|
// Use explicit order by's because it has to match the query the user made
|
|
4818
4821
|
const o = t.explicitOrderBy;
|
|
@@ -4828,7 +4831,7 @@ function wr(...t) {
|
|
|
4828
4831
|
const s = new nt(e);
|
|
4829
4832
|
u.push(Ct(n, s));
|
|
4830
4833
|
} else {
|
|
4831
|
-
const t =
|
|
4834
|
+
const t = Le(e, r, c);
|
|
4832
4835
|
u.push(t);
|
|
4833
4836
|
}
|
|
4834
4837
|
}
|
|
@@ -4842,7 +4845,7 @@ function wr(...t) {
|
|
|
4842
4845
|
}
|
|
4843
4846
|
}
|
|
4844
4847
|
|
|
4845
|
-
function
|
|
4848
|
+
function mr(t, n, e) {
|
|
4846
4849
|
if ("string" == typeof (e = getModularInstance(e))) {
|
|
4847
4850
|
if ("" === e) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
|
|
4848
4851
|
if (!ln(n) && -1 !== e.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
|
|
@@ -4850,19 +4853,19 @@ function pr(t, n, e) {
|
|
|
4850
4853
|
if (!nt.isDocumentKey(r)) throw new U(A, `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}).`);
|
|
4851
4854
|
return Ct(t, new nt(r));
|
|
4852
4855
|
}
|
|
4853
|
-
if (e instanceof
|
|
4856
|
+
if (e instanceof ae) return Ct(t, e._key);
|
|
4854
4857
|
throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(e)}.`);
|
|
4855
4858
|
}
|
|
4856
4859
|
|
|
4857
4860
|
/**
|
|
4858
4861
|
* Validates that the value passed into a disjunctive filter satisfies all
|
|
4859
4862
|
* array requirements.
|
|
4860
|
-
*/ function
|
|
4863
|
+
*/ function pr(t, n) {
|
|
4861
4864
|
if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
|
|
4862
4865
|
if (t.length > 10) throw new U(A, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
|
|
4863
4866
|
}
|
|
4864
4867
|
|
|
4865
|
-
function
|
|
4868
|
+
function yr(t, n, e) {
|
|
4866
4869
|
if (!e.isEqual(n)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
|
|
4867
4870
|
}
|
|
4868
4871
|
|
|
@@ -4913,7 +4916,7 @@ function _r(t, n, e) {
|
|
|
4913
4916
|
* their `set()` or fails due to invalid data originating from a `toFirestore()`
|
|
4914
4917
|
* call.
|
|
4915
4918
|
*/
|
|
4916
|
-
function
|
|
4919
|
+
function _r(t, n, e) {
|
|
4917
4920
|
let r;
|
|
4918
4921
|
// Cast to `any` in order to satisfy the union type constraint on
|
|
4919
4922
|
// toFirestore().
|
|
@@ -4922,7 +4925,7 @@ function gr(t, n, e) {
|
|
|
4922
4925
|
r;
|
|
4923
4926
|
}
|
|
4924
4927
|
|
|
4925
|
-
class
|
|
4928
|
+
class gr extends class {
|
|
4926
4929
|
convertValue(t, n = "none") {
|
|
4927
4930
|
switch (St(t)) {
|
|
4928
4931
|
case 0 /* NullValue */ :
|
|
@@ -4969,7 +4972,7 @@ class vr extends class {
|
|
|
4969
4972
|
})), e;
|
|
4970
4973
|
}
|
|
4971
4974
|
convertGeoPoint(t) {
|
|
4972
|
-
return new
|
|
4975
|
+
return new be(Pt(t.latitude), Pt(t.longitude));
|
|
4973
4976
|
}
|
|
4974
4977
|
convertArray(t, n) {
|
|
4975
4978
|
return (t.values || []).map((t => this.convertValue(t, n)));
|
|
@@ -4993,7 +4996,7 @@ class vr extends class {
|
|
|
4993
4996
|
}
|
|
4994
4997
|
convertDocumentKey(t, n) {
|
|
4995
4998
|
const e = X.fromString(t);
|
|
4996
|
-
v(
|
|
4999
|
+
v(Yn(e));
|
|
4997
5000
|
const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
|
|
4998
5001
|
return r.isEqual(n) ||
|
|
4999
5002
|
// TODO(b/64130202): Somehow support foreign references.
|
|
@@ -5005,11 +5008,11 @@ class vr extends class {
|
|
|
5005
5008
|
super(), this.firestore = t;
|
|
5006
5009
|
}
|
|
5007
5010
|
convertBytes(t) {
|
|
5008
|
-
return new
|
|
5011
|
+
return new ge(t);
|
|
5009
5012
|
}
|
|
5010
5013
|
convertReference(t) {
|
|
5011
5014
|
const n = this.convertDocumentKey(t, this.firestore._databaseId);
|
|
5012
|
-
return new
|
|
5015
|
+
return new ae(this.firestore, /* converter= */ null, n);
|
|
5013
5016
|
}
|
|
5014
5017
|
}
|
|
5015
5018
|
|
|
@@ -5025,12 +5028,12 @@ class vr extends class {
|
|
|
5025
5028
|
* @param reference - The reference of the document to fetch.
|
|
5026
5029
|
* @returns A Promise resolved with a `DocumentSnapshot` containing the current
|
|
5027
5030
|
* document contents.
|
|
5028
|
-
*/ function
|
|
5029
|
-
const n =
|
|
5030
|
-
return
|
|
5031
|
+
*/ function vr(t) {
|
|
5032
|
+
const n = ee((t = ot(t, ae)).firestore), e = new gr(t.firestore);
|
|
5033
|
+
return Zn(n, [ t._key ]).then((n => {
|
|
5031
5034
|
v(1 === n.length);
|
|
5032
5035
|
const r = n[0];
|
|
5033
|
-
return new
|
|
5036
|
+
return new Ye(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
|
|
5034
5037
|
}));
|
|
5035
5038
|
}
|
|
5036
5039
|
|
|
@@ -5045,33 +5048,33 @@ class vr extends class {
|
|
|
5045
5048
|
*
|
|
5046
5049
|
* @param query - The `Query` to execute.
|
|
5047
5050
|
* @returns A Promise that will be resolved with the results of the query.
|
|
5048
|
-
*/ function
|
|
5051
|
+
*/ function br(t) {
|
|
5049
5052
|
!function(t) {
|
|
5050
5053
|
if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
5051
|
-
}((t = ot(t,
|
|
5052
|
-
const n =
|
|
5053
|
-
return
|
|
5054
|
-
const r = n.map((n => new
|
|
5054
|
+
}((t = ot(t, he))._query);
|
|
5055
|
+
const n = ee(t.firestore), e = new gr(t.firestore);
|
|
5056
|
+
return te(n, t._query).then((n => {
|
|
5057
|
+
const r = n.map((n => new He(t.firestore, e, n.key, n, t.converter)));
|
|
5055
5058
|
return cn(t._query) &&
|
|
5056
5059
|
// Limit to last queries reverse the orderBy constraint that was
|
|
5057
5060
|
// specified by the user. As such, we need to reverse the order of the
|
|
5058
5061
|
// results to return the documents in the expected order.
|
|
5059
|
-
r.reverse(), new
|
|
5062
|
+
r.reverse(), new Ke(t, r);
|
|
5060
5063
|
}));
|
|
5061
5064
|
}
|
|
5062
5065
|
|
|
5063
|
-
function
|
|
5064
|
-
const r =
|
|
5065
|
-
return
|
|
5066
|
+
function Er(t, n, e) {
|
|
5067
|
+
const r = _r((t = ot(t, ae)).converter, n, e), s = De(Ve(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
|
|
5068
|
+
return Xn(ee(t.firestore), [ s.toMutation(t._key, En.none()) ]);
|
|
5066
5069
|
}
|
|
5067
5070
|
|
|
5068
|
-
function
|
|
5069
|
-
const s =
|
|
5071
|
+
function Tr(t, n, e, ...r) {
|
|
5072
|
+
const s = Ve((t = ot(t, ae)).firestore);
|
|
5070
5073
|
// For Compat types, we have to "extract" the underlying types before
|
|
5071
5074
|
// performing validation.
|
|
5072
5075
|
let i;
|
|
5073
|
-
i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5074
|
-
return
|
|
5076
|
+
i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(s, "updateDoc", t._key, n, e, r) : Oe(s, "updateDoc", t._key, n);
|
|
5077
|
+
return Xn(ee(t.firestore), [ i.toMutation(t._key, En.exists(!0)) ]);
|
|
5075
5078
|
}
|
|
5076
5079
|
|
|
5077
5080
|
/**
|
|
@@ -5085,8 +5088,8 @@ function Ir(t, n, e, ...r) {
|
|
|
5085
5088
|
* @param reference - A reference to the document to delete.
|
|
5086
5089
|
* @returns A `Promise` resolved once the document has been successfully
|
|
5087
5090
|
* deleted from the backend.
|
|
5088
|
-
*/ function
|
|
5089
|
-
return
|
|
5091
|
+
*/ function Ir(t) {
|
|
5092
|
+
return Xn(ee((t = ot(t, ae)).firestore), [ new Rn(t._key, En.none()) ]);
|
|
5090
5093
|
}
|
|
5091
5094
|
|
|
5092
5095
|
/**
|
|
@@ -5103,9 +5106,9 @@ function Ir(t, n, e, ...r) {
|
|
|
5103
5106
|
* @throws Error - If the provided input is not a valid Firestore document.
|
|
5104
5107
|
* @returns A `Promise` resolved with a `DocumentReference` pointing to the
|
|
5105
5108
|
* newly created document after it has been written to the backend.
|
|
5106
|
-
*/ function
|
|
5107
|
-
const e =
|
|
5108
|
-
return
|
|
5109
|
+
*/ function Ar(t, n) {
|
|
5110
|
+
const e = we(t = ot(t, le)), r = _r(t.converter, n), s = De(Ve(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
|
|
5111
|
+
return Xn(ee(t.firestore), [ s.toMutation(e._key, En.exists(!1)) ]).then((() => e));
|
|
5109
5112
|
}
|
|
5110
5113
|
|
|
5111
5114
|
/**
|
|
@@ -5127,15 +5130,15 @@ function Ir(t, n, e, ...r) {
|
|
|
5127
5130
|
/**
|
|
5128
5131
|
* Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
|
|
5129
5132
|
* {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
|
|
5130
|
-
*/ function
|
|
5131
|
-
return new
|
|
5133
|
+
*/ function Rr() {
|
|
5134
|
+
return new Ne("deleteField");
|
|
5132
5135
|
}
|
|
5133
5136
|
|
|
5134
5137
|
/**
|
|
5135
5138
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
5136
5139
|
* include a server-generated timestamp in the written data.
|
|
5137
|
-
*/ function
|
|
5138
|
-
return new
|
|
5140
|
+
*/ function Pr() {
|
|
5141
|
+
return new Se("serverTimestamp");
|
|
5139
5142
|
}
|
|
5140
5143
|
|
|
5141
5144
|
/**
|
|
@@ -5149,10 +5152,10 @@ function Ir(t, n, e, ...r) {
|
|
|
5149
5152
|
* @param elements - The elements to union into the array.
|
|
5150
5153
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5151
5154
|
* `updateDoc()`.
|
|
5152
|
-
*/ function
|
|
5155
|
+
*/ function Vr(...t) {
|
|
5153
5156
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5154
5157
|
// update() since we'd need the Firestore instance to do this.
|
|
5155
|
-
return new
|
|
5158
|
+
return new Fe("arrayUnion", t);
|
|
5156
5159
|
}
|
|
5157
5160
|
|
|
5158
5161
|
/**
|
|
@@ -5165,10 +5168,10 @@ function Ir(t, n, e, ...r) {
|
|
|
5165
5168
|
* @param elements - The elements to remove from the array.
|
|
5166
5169
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5167
5170
|
* `updateDoc()`
|
|
5168
|
-
*/ function
|
|
5171
|
+
*/ function Dr(...t) {
|
|
5169
5172
|
// NOTE: We don't actually parse the data until it's used in set() or
|
|
5170
5173
|
// update() since we'd need the Firestore instance to do this.
|
|
5171
|
-
return new
|
|
5174
|
+
return new xe("arrayRemove", t);
|
|
5172
5175
|
}
|
|
5173
5176
|
|
|
5174
5177
|
/**
|
|
@@ -5189,8 +5192,8 @@ function Ir(t, n, e, ...r) {
|
|
|
5189
5192
|
* @param n - The value to increment by.
|
|
5190
5193
|
* @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
|
|
5191
5194
|
* `updateDoc()`
|
|
5192
|
-
*/ function
|
|
5193
|
-
return new
|
|
5195
|
+
*/ function Nr(t) {
|
|
5196
|
+
return new qe("increment", t);
|
|
5194
5197
|
}
|
|
5195
5198
|
|
|
5196
5199
|
/**
|
|
@@ -5216,24 +5219,24 @@ function Ir(t, n, e, ...r) {
|
|
|
5216
5219
|
* provides methods for adding writes to the write batch. None of the writes
|
|
5217
5220
|
* will be committed (or visible locally) until {@link WriteBatch.commit} is
|
|
5218
5221
|
* called.
|
|
5219
|
-
*/ class
|
|
5222
|
+
*/ class $r {
|
|
5220
5223
|
/** @hideconstructor */
|
|
5221
5224
|
constructor(t, n) {
|
|
5222
5225
|
this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
|
|
5223
|
-
this._dataReader =
|
|
5226
|
+
this._dataReader = Ve(t);
|
|
5224
5227
|
}
|
|
5225
5228
|
set(t, n, e) {
|
|
5226
5229
|
this._verifyNotCommitted();
|
|
5227
|
-
const r =
|
|
5230
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, n, e), i = De(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
|
|
5228
5231
|
return this._mutations.push(i.toMutation(r._key, En.none())), this;
|
|
5229
5232
|
}
|
|
5230
5233
|
update(t, n, e, ...r) {
|
|
5231
5234
|
this._verifyNotCommitted();
|
|
5232
|
-
const s =
|
|
5235
|
+
const s = Sr(t, this._firestore);
|
|
5233
5236
|
// For Compat types, we have to "extract" the underlying types before
|
|
5234
5237
|
// performing validation.
|
|
5235
5238
|
let i;
|
|
5236
|
-
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5239
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Oe(this._dataReader, "WriteBatch.update", s._key, n),
|
|
5237
5240
|
this._mutations.push(i.toMutation(s._key, En.exists(!0))), this;
|
|
5238
5241
|
}
|
|
5239
5242
|
/**
|
|
@@ -5243,7 +5246,7 @@ function Ir(t, n, e, ...r) {
|
|
|
5243
5246
|
* @returns This `WriteBatch` instance. Used for chaining method calls.
|
|
5244
5247
|
*/ delete(t) {
|
|
5245
5248
|
this._verifyNotCommitted();
|
|
5246
|
-
const n =
|
|
5249
|
+
const n = Sr(t, this._firestore);
|
|
5247
5250
|
return this._mutations = this._mutations.concat(new Rn(n._key, En.none())), this;
|
|
5248
5251
|
}
|
|
5249
5252
|
/**
|
|
@@ -5265,7 +5268,7 @@ function Ir(t, n, e, ...r) {
|
|
|
5265
5268
|
}
|
|
5266
5269
|
}
|
|
5267
5270
|
|
|
5268
|
-
function
|
|
5271
|
+
function Sr(t, n) {
|
|
5269
5272
|
if ((t = getModularInstance(t)).firestore !== n) throw new U(A, "Provided document reference is from a different Firestore instance.");
|
|
5270
5273
|
return t;
|
|
5271
5274
|
}
|
|
@@ -5282,9 +5285,9 @@ function Fr(t, n) {
|
|
|
5282
5285
|
*
|
|
5283
5286
|
* @returns A `WriteBatch` that can be used to atomically execute multiple
|
|
5284
5287
|
* writes.
|
|
5285
|
-
*/ function
|
|
5286
|
-
const n =
|
|
5287
|
-
return new
|
|
5288
|
+
*/ function Fr(t) {
|
|
5289
|
+
const n = ee(t = ot(t, se));
|
|
5290
|
+
return new $r(t, (t => Xn(n, t)));
|
|
5288
5291
|
}
|
|
5289
5292
|
|
|
5290
5293
|
/**
|
|
@@ -5306,7 +5309,7 @@ function Fr(t, n) {
|
|
|
5306
5309
|
/**
|
|
5307
5310
|
* Internal transaction object responsible for accumulating the mutations to
|
|
5308
5311
|
* perform and the base versions for any documents read.
|
|
5309
|
-
*/ class
|
|
5312
|
+
*/ class xr {
|
|
5310
5313
|
constructor(t) {
|
|
5311
5314
|
this.datastore = t,
|
|
5312
5315
|
// The version of each document that was read during this transaction.
|
|
@@ -5326,7 +5329,7 @@ function Fr(t, n) {
|
|
|
5326
5329
|
}
|
|
5327
5330
|
async lookup(t) {
|
|
5328
5331
|
if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
|
|
5329
|
-
const n = await
|
|
5332
|
+
const n = await Zn(this.datastore, t);
|
|
5330
5333
|
return n.forEach((t => this.recordVersion(t))), n;
|
|
5331
5334
|
}
|
|
5332
5335
|
set(t, n) {
|
|
@@ -5355,7 +5358,7 @@ function Fr(t, n) {
|
|
|
5355
5358
|
t.forEach(((t, n) => {
|
|
5356
5359
|
const e = nt.fromPath(n);
|
|
5357
5360
|
this.mutations.push(new Pn(e, this.precondition(e)));
|
|
5358
|
-
})), await
|
|
5361
|
+
})), await Xn(this.datastore, this.mutations), this.committed = !0;
|
|
5359
5362
|
}
|
|
5360
5363
|
recordVersion(t) {
|
|
5361
5364
|
let n;
|
|
@@ -5429,17 +5432,17 @@ function Fr(t, n) {
|
|
|
5429
5432
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
5430
5433
|
* with backoff.
|
|
5431
5434
|
*/
|
|
5432
|
-
class
|
|
5435
|
+
class qr {
|
|
5433
5436
|
constructor(t, n, e, r) {
|
|
5434
5437
|
this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
|
|
5435
|
-
this.Tt = 5, this.It = new
|
|
5438
|
+
this.Tt = 5, this.It = new Kn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
5436
5439
|
}
|
|
5437
5440
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
5438
5441
|
this.Tt -= 1, this.At();
|
|
5439
5442
|
}
|
|
5440
5443
|
At() {
|
|
5441
5444
|
this.It.W((async () => {
|
|
5442
|
-
const t = new
|
|
5445
|
+
const t = new xr(this.datastore), n = this.Rt(t);
|
|
5443
5446
|
n && n.then((n => {
|
|
5444
5447
|
this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
|
|
5445
5448
|
this.deferred.resolve(n);
|
|
@@ -5529,7 +5532,7 @@ class Or {
|
|
|
5529
5532
|
* See the License for the specific language governing permissions and
|
|
5530
5533
|
* limitations under the License.
|
|
5531
5534
|
*/
|
|
5532
|
-
/** The Platform's 'document' implementation or null if not available. */ function
|
|
5535
|
+
/** The Platform's 'document' implementation or null if not available. */ function Or() {
|
|
5533
5536
|
// `document` is not always available, e.g. in ReactNative and WebWorkers.
|
|
5534
5537
|
// eslint-disable-next-line no-restricted-globals
|
|
5535
5538
|
return "undefined" != typeof document ? document : null;
|
|
@@ -5561,7 +5564,7 @@ class Or {
|
|
|
5561
5564
|
* Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
|
|
5562
5565
|
* in newer versions of TypeScript defines `finally`, which is not available in
|
|
5563
5566
|
* IE.
|
|
5564
|
-
*/ class
|
|
5567
|
+
*/ class Cr {
|
|
5565
5568
|
constructor(t, n, e, r, s) {
|
|
5566
5569
|
this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
|
|
5567
5570
|
this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
|
|
@@ -5584,7 +5587,7 @@ class Or {
|
|
|
5584
5587
|
* PORTING NOTE: This exists to prevent making removeDelayedOperation() and
|
|
5585
5588
|
* the DelayedOperation class public.
|
|
5586
5589
|
*/ static createAndSchedule(t, n, e, r, s) {
|
|
5587
|
-
const i = Date.now() + e, o = new
|
|
5590
|
+
const i = Date.now() + e, o = new Cr(t, n, i, r, s);
|
|
5588
5591
|
return o.start(e), o;
|
|
5589
5592
|
}
|
|
5590
5593
|
/**
|
|
@@ -5633,7 +5636,7 @@ class Or {
|
|
|
5633
5636
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5634
5637
|
* See the License for the specific language governing permissions and
|
|
5635
5638
|
* limitations under the License.
|
|
5636
|
-
*/ class
|
|
5639
|
+
*/ class Lr {
|
|
5637
5640
|
constructor() {
|
|
5638
5641
|
// The last promise in the queue.
|
|
5639
5642
|
this.Dt = Promise.resolve(),
|
|
@@ -5656,15 +5659,15 @@ class Or {
|
|
|
5656
5659
|
// List of TimerIds to fast-forward delays for.
|
|
5657
5660
|
this.Ot = [],
|
|
5658
5661
|
// Backoff timer used to schedule retries for retryable operations
|
|
5659
|
-
this.It = new
|
|
5662
|
+
this.It = new Kn(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
5660
5663
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
5661
5664
|
// operations. Meant to speed up recovery when we regain file system access
|
|
5662
5665
|
// after page comes into foreground.
|
|
5663
5666
|
this.Ct = () => {
|
|
5664
|
-
const t =
|
|
5667
|
+
const t = Or();
|
|
5665
5668
|
t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
|
|
5666
5669
|
};
|
|
5667
|
-
const t =
|
|
5670
|
+
const t = Or();
|
|
5668
5671
|
t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
|
|
5669
5672
|
}
|
|
5670
5673
|
get isShuttingDown() {
|
|
@@ -5685,7 +5688,7 @@ class Or {
|
|
|
5685
5688
|
enterRestrictedMode(t) {
|
|
5686
5689
|
if (!this.$t) {
|
|
5687
5690
|
this.$t = !0, this.qt = t || !1;
|
|
5688
|
-
const n =
|
|
5691
|
+
const n = Or();
|
|
5689
5692
|
n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
|
|
5690
5693
|
}
|
|
5691
5694
|
}
|
|
@@ -5817,7 +5820,7 @@ class Or {
|
|
|
5817
5820
|
this.Lt(),
|
|
5818
5821
|
// Fast-forward delays for timerIds that have been overriden.
|
|
5819
5822
|
this.Ot.indexOf(t) > -1 && (n = 0);
|
|
5820
|
-
const r =
|
|
5823
|
+
const r = Cr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
|
|
5821
5824
|
return this.St.push(r), r;
|
|
5822
5825
|
}
|
|
5823
5826
|
Lt() {
|
|
@@ -5871,10 +5874,10 @@ class Or {
|
|
|
5871
5874
|
}
|
|
5872
5875
|
}
|
|
5873
5876
|
|
|
5874
|
-
class
|
|
5877
|
+
class Ur {
|
|
5875
5878
|
/** @hideconstructor */
|
|
5876
5879
|
constructor(t, n) {
|
|
5877
|
-
this._firestore = t, this._transaction = n, this._dataReader =
|
|
5880
|
+
this._firestore = t, this._transaction = n, this._dataReader = Ve(t);
|
|
5878
5881
|
}
|
|
5879
5882
|
/**
|
|
5880
5883
|
* Reads the document referenced by the provided {@link DocumentReference}.
|
|
@@ -5882,25 +5885,25 @@ class kr {
|
|
|
5882
5885
|
* @param documentRef - A reference to the document to be read.
|
|
5883
5886
|
* @returns A `DocumentSnapshot` with the read data.
|
|
5884
5887
|
*/ get(t) {
|
|
5885
|
-
const n =
|
|
5888
|
+
const n = Sr(t, this._firestore), e = new gr(this._firestore);
|
|
5886
5889
|
return this._transaction.lookup([ n._key ]).then((t => {
|
|
5887
5890
|
if (!t || 1 !== t.length) return g();
|
|
5888
5891
|
const r = t[0];
|
|
5889
|
-
if (r.isFoundDocument()) return new
|
|
5890
|
-
if (r.isNoDocument()) return new
|
|
5892
|
+
if (r.isFoundDocument()) return new Ye(this._firestore, e, r.key, r, n.converter);
|
|
5893
|
+
if (r.isNoDocument()) return new Ye(this._firestore, e, n._key, null, n.converter);
|
|
5891
5894
|
throw g();
|
|
5892
5895
|
}));
|
|
5893
5896
|
}
|
|
5894
5897
|
set(t, n, e) {
|
|
5895
|
-
const r =
|
|
5898
|
+
const r = Sr(t, this._firestore), s = _r(r.converter, n, e), i = De(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
|
|
5896
5899
|
return this._transaction.set(r._key, i), this;
|
|
5897
5900
|
}
|
|
5898
5901
|
update(t, n, e, ...r) {
|
|
5899
|
-
const s =
|
|
5902
|
+
const s = Sr(t, this._firestore);
|
|
5900
5903
|
// For Compat types, we have to "extract" the underlying types before
|
|
5901
5904
|
// performing validation.
|
|
5902
5905
|
let i;
|
|
5903
|
-
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof
|
|
5906
|
+
return i = "string" == typeof (n = getModularInstance(n)) || n instanceof ye ? Ce(this._dataReader, "Transaction.update", s._key, n, e, r) : Oe(this._dataReader, "Transaction.update", s._key, n),
|
|
5904
5907
|
this._transaction.update(s._key, i), this;
|
|
5905
5908
|
}
|
|
5906
5909
|
/**
|
|
@@ -5909,7 +5912,7 @@ class kr {
|
|
|
5909
5912
|
* @param documentRef - A reference to the document to be deleted.
|
|
5910
5913
|
* @returns This `Transaction` instance. Used for chaining method calls.
|
|
5911
5914
|
*/ delete(t) {
|
|
5912
|
-
const n =
|
|
5915
|
+
const n = Sr(t, this._firestore);
|
|
5913
5916
|
return this._transaction.delete(n._key), this;
|
|
5914
5917
|
}
|
|
5915
5918
|
}
|
|
@@ -5930,9 +5933,9 @@ class kr {
|
|
|
5930
5933
|
* (the `updateFunction` returned a failed promise), the promise returned by the
|
|
5931
5934
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
5932
5935
|
* rejected promise with the corresponding failure error is returned.
|
|
5933
|
-
*/ function
|
|
5934
|
-
const e =
|
|
5935
|
-
return new
|
|
5936
|
+
*/ function kr(t, n) {
|
|
5937
|
+
const e = ee(t = ot(t, se)), r = new k;
|
|
5938
|
+
return new qr(new Lr, e, (e => n(new Ur(t, e))), r).run(), r.promise;
|
|
5936
5939
|
}
|
|
5937
5940
|
|
|
5938
5941
|
/**
|
|
@@ -5945,11 +5948,11 @@ class kr {
|
|
|
5945
5948
|
*/ !function(t) {
|
|
5946
5949
|
f = t;
|
|
5947
5950
|
}(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: n}) => {
|
|
5948
|
-
const e = t.getProvider("app").getImmediate(), r = new
|
|
5951
|
+
const e = t.getProvider("app").getImmediate(), r = new se(e, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
|
|
5949
5952
|
return n && r._setSettings(n), r;
|
|
5950
5953
|
}), "PUBLIC")),
|
|
5951
5954
|
// RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
|
|
5952
|
-
registerVersion("firestore-lite", "3.4.4-canary.
|
|
5955
|
+
registerVersion("firestore-lite", "3.4.4-canary.7f959622d", ""), registerVersion("firestore-lite", "3.4.4-canary.7f959622d", "esm2017");
|
|
5953
5956
|
|
|
5954
|
-
export {
|
|
5957
|
+
export { ge as Bytes, le as CollectionReference, ae as DocumentReference, Ye as DocumentSnapshot, ye as FieldPath, ve as FieldValue, se as Firestore, U as FirestoreError, be as GeoPoint, he as Query, Ze as QueryConstraint, He as QueryDocumentSnapshot, Ke as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fe as collection, de as collectionGroup, ue as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, we as doc, _e as documentId, dr as endAt, fr as endBefore, vr as getDoc, br as getDocs, oe as getFirestore, Nr as increment, ie as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pe as queryEqual, me as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Je as snapshotEqual, hr as startAfter, ar as startAt, ce as terminate, Tr as updateDoc, er as where, Fr as writeBatch };
|
|
5955
5958
|
//# sourceMappingURL=index.browser.esm2017.js.map
|