@firebase/firestore 3.7.3-canary.a9add5e44 → 3.7.3-canary.ab3f16cba
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/util/types.d.ts +1 -1
- package/dist/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
- package/dist/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/index.esm2017.js +309 -306
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1327 -1322
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +375 -376
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +375 -376
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +309 -306
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/util/types.d.ts +1 -1
- package/dist/lite/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
- package/dist/lite/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/lite/index.browser.esm2017.js +123 -119
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +192 -191
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.node.cjs.js +168 -167
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +168 -167
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +123 -119
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +3 -0
- package/dist/lite/packages/firestore/rollup.config.debug.d.ts +1 -1
- package/dist/lite/packages/firestore/src/util/types.d.ts +1 -1
- package/dist/lite/packages/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
- package/dist/lite/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/dist/packages/firestore/dist/index.esm2017.d.ts +36 -0
- package/dist/packages/firestore/rollup.config.debug.d.ts +1 -1
- package/dist/packages/firestore/src/util/types.d.ts +1 -1
- package/dist/packages/firestore/test/lite/helpers.d.ts +1 -1
- package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +1 -1
- package/dist/packages/firestore/test/util/test_platform.d.ts +2 -2
- package/package.json +11 -11
package/dist/index.esm2017.js
CHANGED
|
@@ -66,7 +66,7 @@ P.MOCK_USER = new P("mock-user");
|
|
|
66
66
|
* See the License for the specific language governing permissions and
|
|
67
67
|
* limitations under the License.
|
|
68
68
|
*/
|
|
69
|
-
let v = "9.14.0-canary.
|
|
69
|
+
let v = "9.14.0-canary.ab3f16cba";
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* @license
|
|
@@ -1218,11 +1218,11 @@ class at {
|
|
|
1218
1218
|
/** An ID for an index that has not yet been added to persistence. */
|
|
1219
1219
|
/** Returns the ArrayContains/ArrayContainsAny segment for this index. */
|
|
1220
1220
|
function ht(t) {
|
|
1221
|
-
return t.fields.find((t => 2 /* CONTAINS */ === t.kind));
|
|
1221
|
+
return t.fields.find((t => 2 /* IndexKind.CONTAINS */ === t.kind));
|
|
1222
1222
|
}
|
|
1223
1223
|
|
|
1224
1224
|
/** Returns all directional (ascending/descending) segments for this index. */ function lt(t) {
|
|
1225
|
-
return t.fields.filter((t => 2 /* CONTAINS */ !== t.kind));
|
|
1225
|
+
return t.fields.filter((t => 2 /* IndexKind.CONTAINS */ !== t.kind));
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
1228
|
/**
|
|
@@ -2006,7 +2006,7 @@ class Nt {
|
|
|
2006
2006
|
return null !== this.task;
|
|
2007
2007
|
}
|
|
2008
2008
|
nt(t) {
|
|
2009
|
-
C("IndexBackiller", `Scheduled in ${t}ms`), this.task = this.asyncQueue.enqueueAfterDelay("index_backfill" /* IndexBackfill */ , t, (async () => {
|
|
2009
|
+
C("IndexBackiller", `Scheduled in ${t}ms`), this.task = this.asyncQueue.enqueueAfterDelay("index_backfill" /* TimerId.IndexBackfill */ , t, (async () => {
|
|
2010
2010
|
this.task = null;
|
|
2011
2011
|
try {
|
|
2012
2012
|
C("IndexBackiller", `Documents written: ${await this.et.st()}`);
|
|
@@ -3006,7 +3006,7 @@ function se(t) {
|
|
|
3006
3006
|
|
|
3007
3007
|
/** Extracts the backend's type order for the provided value. */
|
|
3008
3008
|
function ce(t) {
|
|
3009
|
-
return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Xt(t) ? 4 /* ServerTimestampValue */ : Ee(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : O();
|
|
3009
|
+
return "nullValue" in t ? 0 /* TypeOrder.NullValue */ : "booleanValue" in t ? 1 /* TypeOrder.BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* TypeOrder.NumberValue */ : "timestampValue" in t ? 3 /* TypeOrder.TimestampValue */ : "stringValue" in t ? 5 /* TypeOrder.StringValue */ : "bytesValue" in t ? 6 /* TypeOrder.BlobValue */ : "referenceValue" in t ? 7 /* TypeOrder.RefValue */ : "geoPointValue" in t ? 8 /* TypeOrder.GeoPointValue */ : "arrayValue" in t ? 9 /* TypeOrder.ArrayValue */ : "mapValue" in t ? Xt(t) ? 4 /* TypeOrder.ServerTimestampValue */ : Ee(t) ? 9007199254740991 /* TypeOrder.MaxValue */ : 10 /* TypeOrder.ObjectValue */ : O();
|
|
3010
3010
|
}
|
|
3011
3011
|
|
|
3012
3012
|
/** Tests `left` and `right` for equality based on the backend semantics. */ function ae(t, e) {
|
|
@@ -3014,17 +3014,17 @@ function ce(t) {
|
|
|
3014
3014
|
const n = ce(t);
|
|
3015
3015
|
if (n !== ce(e)) return !1;
|
|
3016
3016
|
switch (n) {
|
|
3017
|
-
case 0 /* NullValue */ :
|
|
3018
|
-
case 9007199254740991 /* MaxValue */ :
|
|
3017
|
+
case 0 /* TypeOrder.NullValue */ :
|
|
3018
|
+
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
3019
3019
|
return !0;
|
|
3020
3020
|
|
|
3021
|
-
case 1 /* BooleanValue */ :
|
|
3021
|
+
case 1 /* TypeOrder.BooleanValue */ :
|
|
3022
3022
|
return t.booleanValue === e.booleanValue;
|
|
3023
3023
|
|
|
3024
|
-
case 4 /* ServerTimestampValue */ :
|
|
3024
|
+
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
3025
3025
|
return te(t).isEqual(te(e));
|
|
3026
3026
|
|
|
3027
|
-
case 3 /* TimestampValue */ :
|
|
3027
|
+
case 3 /* TypeOrder.TimestampValue */ :
|
|
3028
3028
|
return function(t, e) {
|
|
3029
3029
|
if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
|
|
3030
3030
|
// Use string equality for ISO 8601 timestamps
|
|
@@ -3033,23 +3033,23 @@ function ce(t) {
|
|
|
3033
3033
|
return n.seconds === s.seconds && n.nanos === s.nanos;
|
|
3034
3034
|
}(t, e);
|
|
3035
3035
|
|
|
3036
|
-
case 5 /* StringValue */ :
|
|
3036
|
+
case 5 /* TypeOrder.StringValue */ :
|
|
3037
3037
|
return t.stringValue === e.stringValue;
|
|
3038
3038
|
|
|
3039
|
-
case 6 /* BlobValue */ :
|
|
3039
|
+
case 6 /* TypeOrder.BlobValue */ :
|
|
3040
3040
|
return function(t, e) {
|
|
3041
3041
|
return Yt(t.bytesValue).isEqual(Yt(e.bytesValue));
|
|
3042
3042
|
}(t, e);
|
|
3043
3043
|
|
|
3044
|
-
case 7 /* RefValue */ :
|
|
3044
|
+
case 7 /* TypeOrder.RefValue */ :
|
|
3045
3045
|
return t.referenceValue === e.referenceValue;
|
|
3046
3046
|
|
|
3047
|
-
case 8 /* GeoPointValue */ :
|
|
3047
|
+
case 8 /* TypeOrder.GeoPointValue */ :
|
|
3048
3048
|
return function(t, e) {
|
|
3049
3049
|
return Jt(t.geoPointValue.latitude) === Jt(e.geoPointValue.latitude) && Jt(t.geoPointValue.longitude) === Jt(e.geoPointValue.longitude);
|
|
3050
3050
|
}(t, e);
|
|
3051
3051
|
|
|
3052
|
-
case 2 /* NumberValue */ :
|
|
3052
|
+
case 2 /* TypeOrder.NumberValue */ :
|
|
3053
3053
|
return function(t, e) {
|
|
3054
3054
|
if ("integerValue" in t && "integerValue" in e) return Jt(t.integerValue) === Jt(e.integerValue);
|
|
3055
3055
|
if ("doubleValue" in t && "doubleValue" in e) {
|
|
@@ -3059,10 +3059,10 @@ function ce(t) {
|
|
|
3059
3059
|
return !1;
|
|
3060
3060
|
}(t, e);
|
|
3061
3061
|
|
|
3062
|
-
case 9 /* ArrayValue */ :
|
|
3062
|
+
case 9 /* TypeOrder.ArrayValue */ :
|
|
3063
3063
|
return tt(t.arrayValue.values || [], e.arrayValue.values || [], ae);
|
|
3064
3064
|
|
|
3065
|
-
case 10 /* ObjectValue */ :
|
|
3065
|
+
case 10 /* TypeOrder.ObjectValue */ :
|
|
3066
3066
|
return function(t, e) {
|
|
3067
3067
|
const n = t.mapValue.fields || {}, s = e.mapValue.fields || {};
|
|
3068
3068
|
if (Mt(n) !== Mt(s)) return !1;
|
|
@@ -3085,14 +3085,14 @@ function le(t, e) {
|
|
|
3085
3085
|
const n = ce(t), s = ce(e);
|
|
3086
3086
|
if (n !== s) return Z(n, s);
|
|
3087
3087
|
switch (n) {
|
|
3088
|
-
case 0 /* NullValue */ :
|
|
3089
|
-
case 9007199254740991 /* MaxValue */ :
|
|
3088
|
+
case 0 /* TypeOrder.NullValue */ :
|
|
3089
|
+
case 9007199254740991 /* TypeOrder.MaxValue */ :
|
|
3090
3090
|
return 0;
|
|
3091
3091
|
|
|
3092
|
-
case 1 /* BooleanValue */ :
|
|
3092
|
+
case 1 /* TypeOrder.BooleanValue */ :
|
|
3093
3093
|
return Z(t.booleanValue, e.booleanValue);
|
|
3094
3094
|
|
|
3095
|
-
case 2 /* NumberValue */ :
|
|
3095
|
+
case 2 /* TypeOrder.NumberValue */ :
|
|
3096
3096
|
return function(t, e) {
|
|
3097
3097
|
const n = Jt(t.integerValue || t.doubleValue), s = Jt(e.integerValue || e.doubleValue);
|
|
3098
3098
|
return n < s ? -1 : n > s ? 1 : n === s ? 0 :
|
|
@@ -3100,22 +3100,22 @@ function le(t, e) {
|
|
|
3100
3100
|
isNaN(n) ? isNaN(s) ? 0 : -1 : 1;
|
|
3101
3101
|
}(t, e);
|
|
3102
3102
|
|
|
3103
|
-
case 3 /* TimestampValue */ :
|
|
3103
|
+
case 3 /* TypeOrder.TimestampValue */ :
|
|
3104
3104
|
return fe(t.timestampValue, e.timestampValue);
|
|
3105
3105
|
|
|
3106
|
-
case 4 /* ServerTimestampValue */ :
|
|
3106
|
+
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
3107
3107
|
return fe(te(t), te(e));
|
|
3108
3108
|
|
|
3109
|
-
case 5 /* StringValue */ :
|
|
3109
|
+
case 5 /* TypeOrder.StringValue */ :
|
|
3110
3110
|
return Z(t.stringValue, e.stringValue);
|
|
3111
3111
|
|
|
3112
|
-
case 6 /* BlobValue */ :
|
|
3112
|
+
case 6 /* TypeOrder.BlobValue */ :
|
|
3113
3113
|
return function(t, e) {
|
|
3114
3114
|
const n = Yt(t), s = Yt(e);
|
|
3115
3115
|
return n.compareTo(s);
|
|
3116
3116
|
}(t.bytesValue, e.bytesValue);
|
|
3117
3117
|
|
|
3118
|
-
case 7 /* RefValue */ :
|
|
3118
|
+
case 7 /* TypeOrder.RefValue */ :
|
|
3119
3119
|
return function(t, e) {
|
|
3120
3120
|
const n = t.split("/"), s = e.split("/");
|
|
3121
3121
|
for (let t = 0; t < n.length && t < s.length; t++) {
|
|
@@ -3125,14 +3125,14 @@ function le(t, e) {
|
|
|
3125
3125
|
return Z(n.length, s.length);
|
|
3126
3126
|
}(t.referenceValue, e.referenceValue);
|
|
3127
3127
|
|
|
3128
|
-
case 8 /* GeoPointValue */ :
|
|
3128
|
+
case 8 /* TypeOrder.GeoPointValue */ :
|
|
3129
3129
|
return function(t, e) {
|
|
3130
3130
|
const n = Z(Jt(t.latitude), Jt(e.latitude));
|
|
3131
3131
|
if (0 !== n) return n;
|
|
3132
3132
|
return Z(Jt(t.longitude), Jt(e.longitude));
|
|
3133
3133
|
}(t.geoPointValue, e.geoPointValue);
|
|
3134
3134
|
|
|
3135
|
-
case 9 /* ArrayValue */ :
|
|
3135
|
+
case 9 /* TypeOrder.ArrayValue */ :
|
|
3136
3136
|
return function(t, e) {
|
|
3137
3137
|
const n = t.values || [], s = e.values || [];
|
|
3138
3138
|
for (let t = 0; t < n.length && t < s.length; ++t) {
|
|
@@ -3142,7 +3142,7 @@ function le(t, e) {
|
|
|
3142
3142
|
return Z(n.length, s.length);
|
|
3143
3143
|
}(t.arrayValue, e.arrayValue);
|
|
3144
3144
|
|
|
3145
|
-
case 10 /* ObjectValue */ :
|
|
3145
|
+
case 10 /* TypeOrder.ObjectValue */ :
|
|
3146
3146
|
return function(t, e) {
|
|
3147
3147
|
if (t === oe.mapValue && e === oe.mapValue) return 0;
|
|
3148
3148
|
if (t === oe.mapValue) return 1;
|
|
@@ -3485,76 +3485,77 @@ function Pe(t, e) {
|
|
|
3485
3485
|
* Creates a document with no known version or data, but which can serve as
|
|
3486
3486
|
* base document for mutations.
|
|
3487
3487
|
*/ static newInvalidDocument(t) {
|
|
3488
|
-
return new Se(t, 0 /* INVALID */ , st.min(), st.min(), ve.empty(), 0 /* SYNCED */);
|
|
3488
|
+
return new Se(t, 0 /* DocumentType.INVALID */ , st.min(), st.min(), ve.empty(), 0 /* DocumentState.SYNCED */);
|
|
3489
3489
|
}
|
|
3490
3490
|
/**
|
|
3491
3491
|
* Creates a new document that is known to exist with the given data at the
|
|
3492
3492
|
* given version.
|
|
3493
3493
|
*/ static newFoundDocument(t, e, n) {
|
|
3494
|
-
return new Se(t, 1 /* FOUND_DOCUMENT */ , e, st.min(), n, 0 /* SYNCED */);
|
|
3494
|
+
return new Se(t, 1 /* DocumentType.FOUND_DOCUMENT */ , e, st.min(), n, 0 /* DocumentState.SYNCED */);
|
|
3495
3495
|
}
|
|
3496
3496
|
/** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
|
|
3497
|
-
return new Se(t, 2 /* NO_DOCUMENT */ , e, st.min(), ve.empty(), 0 /* SYNCED */);
|
|
3497
|
+
return new Se(t, 2 /* DocumentType.NO_DOCUMENT */ , e, st.min(), ve.empty(), 0 /* DocumentState.SYNCED */);
|
|
3498
3498
|
}
|
|
3499
3499
|
/**
|
|
3500
3500
|
* Creates a new document that is known to exist at the given version but
|
|
3501
3501
|
* whose data is not known (e.g. a document that was updated without a known
|
|
3502
3502
|
* base document).
|
|
3503
3503
|
*/ static newUnknownDocument(t, e) {
|
|
3504
|
-
return new Se(t, 3 /* UNKNOWN_DOCUMENT */ , e, st.min(), ve.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
|
|
3504
|
+
return new Se(t, 3 /* DocumentType.UNKNOWN_DOCUMENT */ , e, st.min(), ve.empty(), 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */);
|
|
3505
3505
|
}
|
|
3506
3506
|
/**
|
|
3507
3507
|
* Changes the document type to indicate that it exists and that its version
|
|
3508
3508
|
* and data are known.
|
|
3509
3509
|
*/ convertToFoundDocument(t, e) {
|
|
3510
|
-
return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ ,
|
|
3511
|
-
this.documentState = 0 /* SYNCED */ , this;
|
|
3510
|
+
return this.version = t, this.documentType = 1 /* DocumentType.FOUND_DOCUMENT */ ,
|
|
3511
|
+
this.data = e, this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
3512
3512
|
}
|
|
3513
3513
|
/**
|
|
3514
3514
|
* Changes the document type to indicate that it doesn't exist at the given
|
|
3515
3515
|
* version.
|
|
3516
3516
|
*/ convertToNoDocument(t) {
|
|
3517
|
-
return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ ,
|
|
3518
|
-
this.documentState = 0 /* SYNCED */ , this;
|
|
3517
|
+
return this.version = t, this.documentType = 2 /* DocumentType.NO_DOCUMENT */ ,
|
|
3518
|
+
this.data = ve.empty(), this.documentState = 0 /* DocumentState.SYNCED */ , this;
|
|
3519
3519
|
}
|
|
3520
3520
|
/**
|
|
3521
3521
|
* Changes the document type to indicate that it exists at a given version but
|
|
3522
3522
|
* that its data is not known (e.g. a document that was updated without a known
|
|
3523
3523
|
* base document).
|
|
3524
3524
|
*/ convertToUnknownDocument(t) {
|
|
3525
|
-
return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ ,
|
|
3526
|
-
this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ ,
|
|
3525
|
+
return this.version = t, this.documentType = 3 /* DocumentType.UNKNOWN_DOCUMENT */ ,
|
|
3526
|
+
this.data = ve.empty(), this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ ,
|
|
3527
|
+
this;
|
|
3527
3528
|
}
|
|
3528
3529
|
setHasCommittedMutations() {
|
|
3529
|
-
return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
|
|
3530
|
+
return this.documentState = 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ , this;
|
|
3530
3531
|
}
|
|
3531
3532
|
setHasLocalMutations() {
|
|
3532
|
-
return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = st.min(),
|
|
3533
|
+
return this.documentState = 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ , this.version = st.min(),
|
|
3533
3534
|
this;
|
|
3534
3535
|
}
|
|
3535
3536
|
setReadTime(t) {
|
|
3536
3537
|
return this.readTime = t, this;
|
|
3537
3538
|
}
|
|
3538
3539
|
get hasLocalMutations() {
|
|
3539
|
-
return 1 /* HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
3540
|
+
return 1 /* DocumentState.HAS_LOCAL_MUTATIONS */ === this.documentState;
|
|
3540
3541
|
}
|
|
3541
3542
|
get hasCommittedMutations() {
|
|
3542
|
-
return 2 /* HAS_COMMITTED_MUTATIONS */ === this.documentState;
|
|
3543
|
+
return 2 /* DocumentState.HAS_COMMITTED_MUTATIONS */ === this.documentState;
|
|
3543
3544
|
}
|
|
3544
3545
|
get hasPendingWrites() {
|
|
3545
3546
|
return this.hasLocalMutations || this.hasCommittedMutations;
|
|
3546
3547
|
}
|
|
3547
3548
|
isValidDocument() {
|
|
3548
|
-
return 0 /* INVALID */ !== this.documentType;
|
|
3549
|
+
return 0 /* DocumentType.INVALID */ !== this.documentType;
|
|
3549
3550
|
}
|
|
3550
3551
|
isFoundDocument() {
|
|
3551
|
-
return 1 /* FOUND_DOCUMENT */ === this.documentType;
|
|
3552
|
+
return 1 /* DocumentType.FOUND_DOCUMENT */ === this.documentType;
|
|
3552
3553
|
}
|
|
3553
3554
|
isNoDocument() {
|
|
3554
|
-
return 2 /* NO_DOCUMENT */ === this.documentType;
|
|
3555
|
+
return 2 /* DocumentType.NO_DOCUMENT */ === this.documentType;
|
|
3555
3556
|
}
|
|
3556
3557
|
isUnknownDocument() {
|
|
3557
|
-
return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
|
|
3558
|
+
return 3 /* DocumentType.UNKNOWN_DOCUMENT */ === this.documentType;
|
|
3558
3559
|
}
|
|
3559
3560
|
isEqual(t) {
|
|
3560
3561
|
return t instanceof Se && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
|
|
@@ -3673,23 +3674,23 @@ function Fe(t, e, n) {
|
|
|
3673
3674
|
for (const n of Me(t, e)) {
|
|
3674
3675
|
let t = ue, e = !0;
|
|
3675
3676
|
switch (n.op) {
|
|
3676
|
-
case "<" /* LESS_THAN */ :
|
|
3677
|
-
case "<=" /* LESS_THAN_OR_EQUAL */ :
|
|
3677
|
+
case "<" /* Operator.LESS_THAN */ :
|
|
3678
|
+
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
3678
3679
|
t = Ae(n.value);
|
|
3679
3680
|
break;
|
|
3680
3681
|
|
|
3681
|
-
case "==" /* EQUAL */ :
|
|
3682
|
-
case "in" /* IN */ :
|
|
3683
|
-
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
3682
|
+
case "==" /* Operator.EQUAL */ :
|
|
3683
|
+
case "in" /* Operator.IN */ :
|
|
3684
|
+
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
3684
3685
|
t = n.value;
|
|
3685
3686
|
break;
|
|
3686
3687
|
|
|
3687
|
-
case ">" /* GREATER_THAN */ :
|
|
3688
|
+
case ">" /* Operator.GREATER_THAN */ :
|
|
3688
3689
|
t = n.value, e = !1;
|
|
3689
3690
|
break;
|
|
3690
3691
|
|
|
3691
|
-
case "!=" /* NOT_EQUAL */ :
|
|
3692
|
-
case "not-in" /* NOT_IN */ :
|
|
3692
|
+
case "!=" /* Operator.NOT_EQUAL */ :
|
|
3693
|
+
case "not-in" /* Operator.NOT_IN */ :
|
|
3693
3694
|
t = ue;
|
|
3694
3695
|
// Remaining filters cannot be used as lower bounds.
|
|
3695
3696
|
}
|
|
@@ -3731,23 +3732,23 @@ function Fe(t, e, n) {
|
|
|
3731
3732
|
for (const n of Me(t, e)) {
|
|
3732
3733
|
let t = oe, e = !0;
|
|
3733
3734
|
switch (n.op) {
|
|
3734
|
-
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
3735
|
-
case ">" /* GREATER_THAN */ :
|
|
3735
|
+
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
3736
|
+
case ">" /* Operator.GREATER_THAN */ :
|
|
3736
3737
|
t = Re(n.value), e = !1;
|
|
3737
3738
|
break;
|
|
3738
3739
|
|
|
3739
|
-
case "==" /* EQUAL */ :
|
|
3740
|
-
case "in" /* IN */ :
|
|
3741
|
-
case "<=" /* LESS_THAN_OR_EQUAL */ :
|
|
3740
|
+
case "==" /* Operator.EQUAL */ :
|
|
3741
|
+
case "in" /* Operator.IN */ :
|
|
3742
|
+
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
3742
3743
|
t = n.value;
|
|
3743
3744
|
break;
|
|
3744
3745
|
|
|
3745
|
-
case "<" /* LESS_THAN */ :
|
|
3746
|
+
case "<" /* Operator.LESS_THAN */ :
|
|
3746
3747
|
t = n.value, e = !1;
|
|
3747
3748
|
break;
|
|
3748
3749
|
|
|
3749
|
-
case "!=" /* NOT_EQUAL */ :
|
|
3750
|
-
case "not-in" /* NOT_IN */ :
|
|
3750
|
+
case "!=" /* Operator.NOT_EQUAL */ :
|
|
3751
|
+
case "not-in" /* Operator.NOT_IN */ :
|
|
3751
3752
|
t = oe;
|
|
3752
3753
|
// Remaining filters cannot be used as upper bounds.
|
|
3753
3754
|
}
|
|
@@ -3787,35 +3788,35 @@ function Fe(t, e, n) {
|
|
|
3787
3788
|
/**
|
|
3788
3789
|
* Creates a filter based on the provided arguments.
|
|
3789
3790
|
*/ static create(t, e, n) {
|
|
3790
|
-
return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.lt(t, e, n) : new Le(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Ge(t, n) : "in" /* IN */ === e ? new Qe(t, n) : "not-in" /* NOT_IN */ === e ? new je(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new We(t, n) : new Be(t, e, n);
|
|
3791
|
+
return t.isKeyField() ? "in" /* Operator.IN */ === e || "not-in" /* Operator.NOT_IN */ === e ? this.lt(t, e, n) : new Le(t, e, n) : "array-contains" /* Operator.ARRAY_CONTAINS */ === e ? new Ge(t, n) : "in" /* Operator.IN */ === e ? new Qe(t, n) : "not-in" /* Operator.NOT_IN */ === e ? new je(t, n) : "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === e ? new We(t, n) : new Be(t, e, n);
|
|
3791
3792
|
}
|
|
3792
3793
|
static lt(t, e, n) {
|
|
3793
|
-
return "in" /* IN */ === e ? new Ue(t, n) : new qe(t, n);
|
|
3794
|
+
return "in" /* Operator.IN */ === e ? new Ue(t, n) : new qe(t, n);
|
|
3794
3795
|
}
|
|
3795
3796
|
matches(t) {
|
|
3796
3797
|
const e = t.data.field(this.field);
|
|
3797
3798
|
// Types do not have to match in NOT_EQUAL filters.
|
|
3798
|
-
return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.ft(le(e, this.value)) : null !== e && ce(this.value) === ce(e) && this.ft(le(e, this.value));
|
|
3799
|
+
return "!=" /* Operator.NOT_EQUAL */ === this.op ? null !== e && this.ft(le(e, this.value)) : null !== e && ce(this.value) === ce(e) && this.ft(le(e, this.value));
|
|
3799
3800
|
// Only compare types with matching backend order (such as double and int).
|
|
3800
3801
|
}
|
|
3801
3802
|
ft(t) {
|
|
3802
3803
|
switch (this.op) {
|
|
3803
|
-
case "<" /* LESS_THAN */ :
|
|
3804
|
+
case "<" /* Operator.LESS_THAN */ :
|
|
3804
3805
|
return t < 0;
|
|
3805
3806
|
|
|
3806
|
-
case "<=" /* LESS_THAN_OR_EQUAL */ :
|
|
3807
|
+
case "<=" /* Operator.LESS_THAN_OR_EQUAL */ :
|
|
3807
3808
|
return t <= 0;
|
|
3808
3809
|
|
|
3809
|
-
case "==" /* EQUAL */ :
|
|
3810
|
+
case "==" /* Operator.EQUAL */ :
|
|
3810
3811
|
return 0 === t;
|
|
3811
3812
|
|
|
3812
|
-
case "!=" /* NOT_EQUAL */ :
|
|
3813
|
+
case "!=" /* Operator.NOT_EQUAL */ :
|
|
3813
3814
|
return 0 !== t;
|
|
3814
3815
|
|
|
3815
|
-
case ">" /* GREATER_THAN */ :
|
|
3816
|
+
case ">" /* Operator.GREATER_THAN */ :
|
|
3816
3817
|
return t > 0;
|
|
3817
3818
|
|
|
3818
|
-
case ">=" /* GREATER_THAN_OR_EQUAL */ :
|
|
3819
|
+
case ">=" /* Operator.GREATER_THAN_OR_EQUAL */ :
|
|
3819
3820
|
return t >= 0;
|
|
3820
3821
|
|
|
3821
3822
|
default:
|
|
@@ -3823,7 +3824,7 @@ function Fe(t, e, n) {
|
|
|
3823
3824
|
}
|
|
3824
3825
|
}
|
|
3825
3826
|
dt() {
|
|
3826
|
-
return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
|
|
3827
|
+
return [ "<" /* Operator.LESS_THAN */ , "<=" /* Operator.LESS_THAN_OR_EQUAL */ , ">" /* Operator.GREATER_THAN */ , ">=" /* Operator.GREATER_THAN_OR_EQUAL */ , "!=" /* Operator.NOT_EQUAL */ , "not-in" /* Operator.NOT_IN */ ].indexOf(this.op) >= 0;
|
|
3827
3828
|
}
|
|
3828
3829
|
}
|
|
3829
3830
|
|
|
@@ -3839,7 +3840,7 @@ class Le extends Be {
|
|
|
3839
3840
|
|
|
3840
3841
|
/** Filter that matches on key fields within an array. */ class Ue extends Be {
|
|
3841
3842
|
constructor(t, e) {
|
|
3842
|
-
super(t, "in" /* IN */ , e), this.keys = Ke("in" /* IN */ , e);
|
|
3843
|
+
super(t, "in" /* Operator.IN */ , e), this.keys = Ke("in" /* Operator.IN */ , e);
|
|
3843
3844
|
}
|
|
3844
3845
|
matches(t) {
|
|
3845
3846
|
return this.keys.some((e => e.isEqual(t.key)));
|
|
@@ -3848,7 +3849,7 @@ class Le extends Be {
|
|
|
3848
3849
|
|
|
3849
3850
|
/** Filter that matches on key fields not present within an array. */ class qe extends Be {
|
|
3850
3851
|
constructor(t, e) {
|
|
3851
|
-
super(t, "not-in" /* NOT_IN */ , e), this.keys = Ke("not-in" /* NOT_IN */ , e);
|
|
3852
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e), this.keys = Ke("not-in" /* Operator.NOT_IN */ , e);
|
|
3852
3853
|
}
|
|
3853
3854
|
matches(t) {
|
|
3854
3855
|
return !this.keys.some((e => e.isEqual(t.key)));
|
|
@@ -3862,7 +3863,7 @@ function Ke(t, e) {
|
|
|
3862
3863
|
|
|
3863
3864
|
/** A Filter that implements the array-contains operator. */ class Ge extends Be {
|
|
3864
3865
|
constructor(t, e) {
|
|
3865
|
-
super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
|
|
3866
|
+
super(t, "array-contains" /* Operator.ARRAY_CONTAINS */ , e);
|
|
3866
3867
|
}
|
|
3867
3868
|
matches(t) {
|
|
3868
3869
|
const e = t.data.field(this.field);
|
|
@@ -3872,7 +3873,7 @@ function Ke(t, e) {
|
|
|
3872
3873
|
|
|
3873
3874
|
/** A Filter that implements the IN operator. */ class Qe extends Be {
|
|
3874
3875
|
constructor(t, e) {
|
|
3875
|
-
super(t, "in" /* IN */ , e);
|
|
3876
|
+
super(t, "in" /* Operator.IN */ , e);
|
|
3876
3877
|
}
|
|
3877
3878
|
matches(t) {
|
|
3878
3879
|
const e = t.data.field(this.field);
|
|
@@ -3882,7 +3883,7 @@ function Ke(t, e) {
|
|
|
3882
3883
|
|
|
3883
3884
|
/** A Filter that implements the not-in operator. */ class je extends Be {
|
|
3884
3885
|
constructor(t, e) {
|
|
3885
|
-
super(t, "not-in" /* NOT_IN */ , e);
|
|
3886
|
+
super(t, "not-in" /* Operator.NOT_IN */ , e);
|
|
3886
3887
|
}
|
|
3887
3888
|
matches(t) {
|
|
3888
3889
|
if (he(this.value.arrayValue, {
|
|
@@ -3895,7 +3896,7 @@ function Ke(t, e) {
|
|
|
3895
3896
|
|
|
3896
3897
|
/** A Filter that implements the array-contains-any operator. */ class We extends Be {
|
|
3897
3898
|
constructor(t, e) {
|
|
3898
|
-
super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
|
|
3899
|
+
super(t, "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , e);
|
|
3899
3900
|
}
|
|
3900
3901
|
matches(t) {
|
|
3901
3902
|
const e = t.data.field(this.field);
|
|
@@ -3925,7 +3926,7 @@ function Ke(t, e) {
|
|
|
3925
3926
|
/**
|
|
3926
3927
|
* An ordering on a field, in some Direction. Direction defaults to ASCENDING.
|
|
3927
3928
|
*/ class He {
|
|
3928
|
-
constructor(t, e = "asc" /* ASCENDING */) {
|
|
3929
|
+
constructor(t, e = "asc" /* Direction.ASCENDING */) {
|
|
3929
3930
|
this.field = t, this.dir = e;
|
|
3930
3931
|
}
|
|
3931
3932
|
}
|
|
@@ -3941,7 +3942,7 @@ function Ye(t, e, n) {
|
|
|
3941
3942
|
if (r.field.isKeyField()) s = ct.comparator(ct.fromName(o.referenceValue), n.key); else {
|
|
3942
3943
|
s = le(o, n.data.field(r.field));
|
|
3943
3944
|
}
|
|
3944
|
-
if ("desc" /* DESCENDING */ === r.dir && (s *= -1), 0 !== s) break;
|
|
3945
|
+
if ("desc" /* Direction.DESCENDING */ === r.dir && (s *= -1), 0 !== s) break;
|
|
3945
3946
|
}
|
|
3946
3947
|
return s;
|
|
3947
3948
|
}
|
|
@@ -3986,7 +3987,7 @@ function Ye(t, e, n) {
|
|
|
3986
3987
|
* Initializes a Query with a path and optional additional query constraints.
|
|
3987
3988
|
* Path must currently be empty if this is a collection group query.
|
|
3988
3989
|
*/
|
|
3989
|
-
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, u = null) {
|
|
3990
|
+
constructor(t, e = null, n = [], s = [], i = null, r = "F" /* LimitType.First */ , o = null, u = null) {
|
|
3990
3991
|
this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
|
|
3991
3992
|
this.limit = i, this.limitType = r, this.startAt = o, this.endAt = u, this._t = null,
|
|
3992
3993
|
// The corresponding `Target` of this `Query` instance.
|
|
@@ -4050,13 +4051,13 @@ function on(t) {
|
|
|
4050
4051
|
// In order to implicitly add key ordering, we must also add the
|
|
4051
4052
|
// inequality filter field for it to be a valid query.
|
|
4052
4053
|
// Note that the default inequality field and key ordering is ascending.
|
|
4053
|
-
t.isKeyField() || e._t.push(new He(t)), e._t.push(new He(ut.keyField(), "asc" /* ASCENDING */)); else {
|
|
4054
|
+
t.isKeyField() || e._t.push(new He(t)), e._t.push(new He(ut.keyField(), "asc" /* Direction.ASCENDING */)); else {
|
|
4054
4055
|
let t = !1;
|
|
4055
4056
|
for (const n of e.explicitOrderBy) e._t.push(n), n.field.isKeyField() && (t = !0);
|
|
4056
4057
|
if (!t) {
|
|
4057
4058
|
// The order of the implicit key ordering always matches the last
|
|
4058
4059
|
// explicit order by
|
|
4059
|
-
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
|
|
4060
|
+
const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* Direction.ASCENDING */;
|
|
4060
4061
|
e._t.push(new He(ut.keyField(), t));
|
|
4061
4062
|
}
|
|
4062
4063
|
}
|
|
@@ -4068,11 +4069,11 @@ function on(t) {
|
|
|
4068
4069
|
* Converts this `Query` instance to it's corresponding `Target` representation.
|
|
4069
4070
|
*/ function cn(t) {
|
|
4070
4071
|
const e = $(t);
|
|
4071
|
-
if (!e.wt) if ("F" /* First */ === e.limitType) e.wt = Ce(e.path, e.collectionGroup, un(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
4072
|
+
if (!e.wt) if ("F" /* LimitType.First */ === e.limitType) e.wt = Ce(e.path, e.collectionGroup, un(e), e.filters, e.limit, e.startAt, e.endAt); else {
|
|
4072
4073
|
// Flip the orderBy directions since we want the last results
|
|
4073
4074
|
const t = [];
|
|
4074
4075
|
for (const n of un(e)) {
|
|
4075
|
-
const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
|
|
4076
|
+
const e = "desc" /* Direction.DESCENDING */ === n.dir ? "asc" /* Direction.ASCENDING */ : "desc" /* Direction.DESCENDING */;
|
|
4076
4077
|
t.push(new He(n.field, e));
|
|
4077
4078
|
}
|
|
4078
4079
|
// We need to swap the cursors to match the now-flipped query ordering.
|
|
@@ -4168,10 +4169,10 @@ function mn(t, e, n) {
|
|
|
4168
4169
|
return null !== s && null !== i ? le(s, i) : O();
|
|
4169
4170
|
}(t.field, e, n);
|
|
4170
4171
|
switch (t.dir) {
|
|
4171
|
-
case "asc" /* ASCENDING */ :
|
|
4172
|
+
case "asc" /* Direction.ASCENDING */ :
|
|
4172
4173
|
return s;
|
|
4173
4174
|
|
|
4174
|
-
case "desc" /* DESCENDING */ :
|
|
4175
|
+
case "desc" /* Direction.DESCENDING */ :
|
|
4175
4176
|
return -1 * s;
|
|
4176
4177
|
|
|
4177
4178
|
default:
|
|
@@ -4651,7 +4652,7 @@ class kn {
|
|
|
4651
4652
|
function qn(t, e) {
|
|
4652
4653
|
return t.type === e.type && (!!t.key.isEqual(e.key) && (!!t.precondition.isEqual(e.precondition) && (!!function(t, e) {
|
|
4653
4654
|
return void 0 === t && void 0 === e || !(!t || !e) && tt(t, e, ((t, e) => Nn(t, e)));
|
|
4654
|
-
}(t.fieldTransforms, e.fieldTransforms) && (0 /* Set */ === t.type ? t.value.isEqual(e.value) : 1 /* Patch */ !== t.type || t.data.isEqual(e.data) && t.fieldMask.isEqual(e.fieldMask)))));
|
|
4655
|
+
}(t.fieldTransforms, e.fieldTransforms) && (0 /* MutationType.Set */ === t.type ? t.value.isEqual(e.value) : 1 /* MutationType.Patch */ !== t.type || t.data.isEqual(e.data) && t.fieldMask.isEqual(e.fieldMask)))));
|
|
4655
4656
|
}
|
|
4656
4657
|
|
|
4657
4658
|
/**
|
|
@@ -4660,7 +4661,7 @@ function qn(t, e) {
|
|
|
4660
4661
|
*/ class Kn extends Fn {
|
|
4661
4662
|
constructor(t, e, n, s = []) {
|
|
4662
4663
|
super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = s,
|
|
4663
|
-
this.type = 0 /* Set */;
|
|
4664
|
+
this.type = 0 /* MutationType.Set */;
|
|
4664
4665
|
}
|
|
4665
4666
|
getFieldMask() {
|
|
4666
4667
|
return null;
|
|
@@ -4670,7 +4671,7 @@ function qn(t, e) {
|
|
|
4670
4671
|
class Gn extends Fn {
|
|
4671
4672
|
constructor(t, e, n, s, i = []) {
|
|
4672
4673
|
super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = s,
|
|
4673
|
-
this.fieldTransforms = i, this.type = 1 /* Patch */;
|
|
4674
|
+
this.fieldTransforms = i, this.type = 1 /* MutationType.Patch */;
|
|
4674
4675
|
}
|
|
4675
4676
|
getFieldMask() {
|
|
4676
4677
|
return this.fieldMask;
|
|
@@ -4728,7 +4729,8 @@ function Qn(t) {
|
|
|
4728
4729
|
|
|
4729
4730
|
/** A mutation that deletes the document at the given key. */ class zn extends Fn {
|
|
4730
4731
|
constructor(t, e) {
|
|
4731
|
-
super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ ,
|
|
4732
|
+
super(), this.key = t, this.precondition = e, this.type = 2 /* MutationType.Delete */ ,
|
|
4733
|
+
this.fieldTransforms = [];
|
|
4732
4734
|
}
|
|
4733
4735
|
getFieldMask() {
|
|
4734
4736
|
return null;
|
|
@@ -4737,7 +4739,8 @@ function Qn(t) {
|
|
|
4737
4739
|
|
|
4738
4740
|
class Hn extends Fn {
|
|
4739
4741
|
constructor(t, e) {
|
|
4740
|
-
super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ ,
|
|
4742
|
+
super(), this.key = t, this.precondition = e, this.type = 3 /* MutationType.Verify */ ,
|
|
4743
|
+
this.fieldTransforms = [];
|
|
4741
4744
|
}
|
|
4742
4745
|
getFieldMask() {
|
|
4743
4746
|
return null;
|
|
@@ -5290,15 +5293,15 @@ class ps {
|
|
|
5290
5293
|
let t = fs(), e = fs(), n = fs();
|
|
5291
5294
|
return this.bt.forEach(((s, i) => {
|
|
5292
5295
|
switch (i) {
|
|
5293
|
-
case 0 /* Added */ :
|
|
5296
|
+
case 0 /* ChangeType.Added */ :
|
|
5294
5297
|
t = t.add(s);
|
|
5295
5298
|
break;
|
|
5296
5299
|
|
|
5297
|
-
case 2 /* Modified */ :
|
|
5300
|
+
case 2 /* ChangeType.Modified */ :
|
|
5298
5301
|
e = e.add(s);
|
|
5299
5302
|
break;
|
|
5300
5303
|
|
|
5301
|
-
case 1 /* Removed */ :
|
|
5304
|
+
case 1 /* ChangeType.Removed */ :
|
|
5302
5305
|
n = n.add(s);
|
|
5303
5306
|
break;
|
|
5304
5307
|
|
|
@@ -5358,11 +5361,11 @@ class Ts {
|
|
|
5358
5361
|
this.forEachTarget(t, (e => {
|
|
5359
5362
|
const n = this.zt(e);
|
|
5360
5363
|
switch (t.state) {
|
|
5361
|
-
case 0 /* NoChange */ :
|
|
5364
|
+
case 0 /* WatchTargetChangeState.NoChange */ :
|
|
5362
5365
|
this.Ht(e) && n.Ct(t.resumeToken);
|
|
5363
5366
|
break;
|
|
5364
5367
|
|
|
5365
|
-
case 1 /* Added */ :
|
|
5368
|
+
case 1 /* WatchTargetChangeState.Added */ :
|
|
5366
5369
|
// We need to decrement the number of pending acks needed from watch
|
|
5367
5370
|
// for this targetId.
|
|
5368
5371
|
n.Ft(), n.St ||
|
|
@@ -5372,7 +5375,7 @@ class Ts {
|
|
|
5372
5375
|
n.Nt(), n.Ct(t.resumeToken);
|
|
5373
5376
|
break;
|
|
5374
5377
|
|
|
5375
|
-
case 2 /* Removed */ :
|
|
5378
|
+
case 2 /* WatchTargetChangeState.Removed */ :
|
|
5376
5379
|
// We need to keep track of removed targets to we can post-filter and
|
|
5377
5380
|
// remove any target changes.
|
|
5378
5381
|
// We need to decrement the number of pending acks needed from watch
|
|
@@ -5380,11 +5383,11 @@ class Ts {
|
|
|
5380
5383
|
n.Ft(), n.St || this.removeTarget(e);
|
|
5381
5384
|
break;
|
|
5382
5385
|
|
|
5383
|
-
case 3 /* Current */ :
|
|
5386
|
+
case 3 /* WatchTargetChangeState.Current */ :
|
|
5384
5387
|
this.Ht(e) && (n.$t(), n.Ct(t.resumeToken));
|
|
5385
5388
|
break;
|
|
5386
5389
|
|
|
5387
|
-
case 4 /* Reset */ :
|
|
5390
|
+
case 4 /* WatchTargetChangeState.Reset */ :
|
|
5388
5391
|
this.Ht(e) && (
|
|
5389
5392
|
// Reset the target and synthesizes removes for all existing
|
|
5390
5393
|
// documents. The backend will re-add any documents that still
|
|
@@ -5464,7 +5467,7 @@ class Ts {
|
|
|
5464
5467
|
let s = !0;
|
|
5465
5468
|
e.forEachWhile((t => {
|
|
5466
5469
|
const e = this.Xt(t);
|
|
5467
|
-
return !e || 2 /* LimboResolution */ === e.purpose || (s = !1, !1);
|
|
5470
|
+
return !e || 2 /* TargetPurpose.LimboResolution */ === e.purpose || (s = !1, !1);
|
|
5468
5471
|
})), s && (n = n.add(t));
|
|
5469
5472
|
})), this.Ut.forEach(((e, n) => n.setReadTime(t)));
|
|
5470
5473
|
const s = new ws(t, e, this.Kt, this.Ut, n);
|
|
@@ -5477,7 +5480,7 @@ class Ts {
|
|
|
5477
5480
|
// Visible for testing.
|
|
5478
5481
|
Qt(t, e) {
|
|
5479
5482
|
if (!this.Ht(t)) return;
|
|
5480
|
-
const n = this.ee(t, e.key) ? 2 /* Modified */ : 0 /* Added */;
|
|
5483
|
+
const n = this.ee(t, e.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
|
|
5481
5484
|
this.zt(t).kt(e.key, n), this.Ut = this.Ut.insert(e.key, e), this.qt = this.qt.insert(e.key, this.ne(e.key).add(t));
|
|
5482
5485
|
}
|
|
5483
5486
|
/**
|
|
@@ -5491,7 +5494,7 @@ class Ts {
|
|
|
5491
5494
|
jt(t, e, n) {
|
|
5492
5495
|
if (!this.Ht(t)) return;
|
|
5493
5496
|
const s = this.zt(t);
|
|
5494
|
-
this.ee(t, e) ? s.kt(e, 1 /* Removed */) :
|
|
5497
|
+
this.ee(t, e) ? s.kt(e, 1 /* ChangeType.Removed */) :
|
|
5495
5498
|
// The document may have entered and left the target before we raised a
|
|
5496
5499
|
// snapshot, so we can just ignore the change.
|
|
5497
5500
|
s.Ot(e), this.qt = this.qt.insert(e, this.ne(e).delete(t)), n && (this.Ut = this.Ut.insert(e, n));
|
|
@@ -5736,7 +5739,7 @@ function qs(t, e) {
|
|
|
5736
5739
|
// proto3 default value is unset in JSON (undefined), so use 'NO_CHANGE'
|
|
5737
5740
|
// if unset
|
|
5738
5741
|
const s = function(t) {
|
|
5739
|
-
return "NO_CHANGE" === t ? 0 /* NoChange */ : "ADD" === t ? 1 /* Added */ : "REMOVE" === t ? 2 /* Removed */ : "CURRENT" === t ? 3 /* Current */ : "RESET" === t ? 4 /* Reset */ : O();
|
|
5742
|
+
return "NO_CHANGE" === t ? 0 /* WatchTargetChangeState.NoChange */ : "ADD" === t ? 1 /* WatchTargetChangeState.Added */ : "REMOVE" === t ? 2 /* WatchTargetChangeState.Removed */ : "CURRENT" === t ? 3 /* WatchTargetChangeState.Current */ : "RESET" === t ? 4 /* WatchTargetChangeState.Reset */ : O();
|
|
5740
5743
|
}(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
|
|
5741
5744
|
return t.gt ? (M(void 0 === e || "string" == typeof e), Wt.fromBase64String(e || "")) : (M(void 0 === e || e instanceof Uint8Array),
|
|
5742
5745
|
Wt.fromUint8Array(e || new Uint8Array));
|
|
@@ -5913,7 +5916,7 @@ function Ws(t, e) {
|
|
|
5913
5916
|
const e = t.map((t =>
|
|
5914
5917
|
// visible for testing
|
|
5915
5918
|
function(t) {
|
|
5916
|
-
if ("==" /* EQUAL */ === t.op) {
|
|
5919
|
+
if ("==" /* Operator.EQUAL */ === t.op) {
|
|
5917
5920
|
if (pe(t.value)) return {
|
|
5918
5921
|
unaryFilter: {
|
|
5919
5922
|
field: Zs(t.field),
|
|
@@ -5926,7 +5929,7 @@ function Ws(t, e) {
|
|
|
5926
5929
|
op: "IS_NULL"
|
|
5927
5930
|
}
|
|
5928
5931
|
};
|
|
5929
|
-
} else if ("!=" /* NOT_EQUAL */ === t.op) {
|
|
5932
|
+
} else if ("!=" /* Operator.NOT_EQUAL */ === t.op) {
|
|
5930
5933
|
if (pe(t.value)) return {
|
|
5931
5934
|
unaryFilter: {
|
|
5932
5935
|
field: Zs(t.field),
|
|
@@ -6007,10 +6010,10 @@ function zs(t) {
|
|
|
6007
6010
|
function(t) {
|
|
6008
6011
|
switch (t) {
|
|
6009
6012
|
case "ASCENDING":
|
|
6010
|
-
return "asc" /* ASCENDING */;
|
|
6013
|
+
return "asc" /* Direction.ASCENDING */;
|
|
6011
6014
|
|
|
6012
6015
|
case "DESCENDING":
|
|
6013
|
-
return "desc" /* DESCENDING */;
|
|
6016
|
+
return "desc" /* Direction.DESCENDING */;
|
|
6014
6017
|
|
|
6015
6018
|
default:
|
|
6016
6019
|
return;
|
|
@@ -6035,19 +6038,19 @@ function zs(t) {
|
|
|
6035
6038
|
return new ze(n, e);
|
|
6036
6039
|
}
|
|
6037
6040
|
// visible for testing
|
|
6038
|
-
(n.endAt)), tn(e, i, o, r, u, "F" /* First */ , c, a);
|
|
6041
|
+
(n.endAt)), tn(e, i, o, r, u, "F" /* LimitType.First */ , c, a);
|
|
6039
6042
|
}
|
|
6040
6043
|
|
|
6041
6044
|
function Hs(t, e) {
|
|
6042
6045
|
const n = function(t, e) {
|
|
6043
6046
|
switch (e) {
|
|
6044
|
-
case 0 /* Listen */ :
|
|
6047
|
+
case 0 /* TargetPurpose.Listen */ :
|
|
6045
6048
|
return null;
|
|
6046
6049
|
|
|
6047
|
-
case 1 /* ExistenceFilterMismatch */ :
|
|
6050
|
+
case 1 /* TargetPurpose.ExistenceFilterMismatch */ :
|
|
6048
6051
|
return "existence-filter-mismatch";
|
|
6049
6052
|
|
|
6050
|
-
case 2 /* LimboResolution */ :
|
|
6053
|
+
case 2 /* TargetPurpose.LimboResolution */ :
|
|
6051
6054
|
return "limbo-document";
|
|
6052
6055
|
|
|
6053
6056
|
default:
|
|
@@ -6085,34 +6088,34 @@ function ei(t) {
|
|
|
6085
6088
|
return Be.create(ti(t.fieldFilter.field), function(t) {
|
|
6086
6089
|
switch (t) {
|
|
6087
6090
|
case "EQUAL":
|
|
6088
|
-
return "==" /* EQUAL */;
|
|
6091
|
+
return "==" /* Operator.EQUAL */;
|
|
6089
6092
|
|
|
6090
6093
|
case "NOT_EQUAL":
|
|
6091
|
-
return "!=" /* NOT_EQUAL */;
|
|
6094
|
+
return "!=" /* Operator.NOT_EQUAL */;
|
|
6092
6095
|
|
|
6093
6096
|
case "GREATER_THAN":
|
|
6094
|
-
return ">" /* GREATER_THAN */;
|
|
6097
|
+
return ">" /* Operator.GREATER_THAN */;
|
|
6095
6098
|
|
|
6096
6099
|
case "GREATER_THAN_OR_EQUAL":
|
|
6097
|
-
return ">=" /* GREATER_THAN_OR_EQUAL */;
|
|
6100
|
+
return ">=" /* Operator.GREATER_THAN_OR_EQUAL */;
|
|
6098
6101
|
|
|
6099
6102
|
case "LESS_THAN":
|
|
6100
|
-
return "<" /* LESS_THAN */;
|
|
6103
|
+
return "<" /* Operator.LESS_THAN */;
|
|
6101
6104
|
|
|
6102
6105
|
case "LESS_THAN_OR_EQUAL":
|
|
6103
|
-
return "<=" /* LESS_THAN_OR_EQUAL */;
|
|
6106
|
+
return "<=" /* Operator.LESS_THAN_OR_EQUAL */;
|
|
6104
6107
|
|
|
6105
6108
|
case "ARRAY_CONTAINS":
|
|
6106
|
-
return "array-contains" /* ARRAY_CONTAINS */;
|
|
6109
|
+
return "array-contains" /* Operator.ARRAY_CONTAINS */;
|
|
6107
6110
|
|
|
6108
6111
|
case "IN":
|
|
6109
|
-
return "in" /* IN */;
|
|
6112
|
+
return "in" /* Operator.IN */;
|
|
6110
6113
|
|
|
6111
6114
|
case "NOT_IN":
|
|
6112
|
-
return "not-in" /* NOT_IN */;
|
|
6115
|
+
return "not-in" /* Operator.NOT_IN */;
|
|
6113
6116
|
|
|
6114
6117
|
case "ARRAY_CONTAINS_ANY":
|
|
6115
|
-
return "array-contains-any" /* ARRAY_CONTAINS_ANY */;
|
|
6118
|
+
return "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */;
|
|
6116
6119
|
|
|
6117
6120
|
default:
|
|
6118
6121
|
return O();
|
|
@@ -6124,25 +6127,25 @@ function ni(t) {
|
|
|
6124
6127
|
switch (t.unaryFilter.op) {
|
|
6125
6128
|
case "IS_NAN":
|
|
6126
6129
|
const e = ti(t.unaryFilter.field);
|
|
6127
|
-
return Be.create(e, "==" /* EQUAL */ , {
|
|
6130
|
+
return Be.create(e, "==" /* Operator.EQUAL */ , {
|
|
6128
6131
|
doubleValue: NaN
|
|
6129
6132
|
});
|
|
6130
6133
|
|
|
6131
6134
|
case "IS_NULL":
|
|
6132
6135
|
const n = ti(t.unaryFilter.field);
|
|
6133
|
-
return Be.create(n, "==" /* EQUAL */ , {
|
|
6136
|
+
return Be.create(n, "==" /* Operator.EQUAL */ , {
|
|
6134
6137
|
nullValue: "NULL_VALUE"
|
|
6135
6138
|
});
|
|
6136
6139
|
|
|
6137
6140
|
case "IS_NOT_NAN":
|
|
6138
6141
|
const s = ti(t.unaryFilter.field);
|
|
6139
|
-
return Be.create(s, "!=" /* NOT_EQUAL */ , {
|
|
6142
|
+
return Be.create(s, "!=" /* Operator.NOT_EQUAL */ , {
|
|
6140
6143
|
doubleValue: NaN
|
|
6141
6144
|
});
|
|
6142
6145
|
|
|
6143
6146
|
case "IS_NOT_NULL":
|
|
6144
6147
|
const i = ti(t.unaryFilter.field);
|
|
6145
|
-
return Be.create(i, "!=" /* NOT_EQUAL */ , {
|
|
6148
|
+
return Be.create(i, "!=" /* Operator.NOT_EQUAL */ , {
|
|
6146
6149
|
nullValue: "NULL_VALUE"
|
|
6147
6150
|
});
|
|
6148
6151
|
|
|
@@ -6679,7 +6682,7 @@ function Gi(t, e) {
|
|
|
6679
6682
|
return void 0 !== t.query.documents ? (M(1 === (i = t.query).documents.length),
|
|
6680
6683
|
s = cn(en(Ms(i.documents[0])))) : s = function(t) {
|
|
6681
6684
|
return cn(zs(t));
|
|
6682
|
-
}(t.query), new Fi(s, t.targetId, 0 /* Listen */ , t.lastListenSequenceNumber, e, n, Wt.fromBase64String(t.resumeToken));
|
|
6685
|
+
}(t.query), new Fi(s, t.targetId, 0 /* TargetPurpose.Listen */ , t.lastListenSequenceNumber, e, n, Wt.fromBase64String(t.resumeToken));
|
|
6683
6686
|
}
|
|
6684
6687
|
|
|
6685
6688
|
/** Encodes TargetData into a DbTarget for storage locally. */ function ji(t, e) {
|
|
@@ -6715,7 +6718,7 @@ function Wi(t) {
|
|
|
6715
6718
|
parent: t.parent,
|
|
6716
6719
|
structuredQuery: t.structuredQuery
|
|
6717
6720
|
});
|
|
6718
|
-
return "LAST" === t.limitType ? an(e, e.limit, "L" /* Last */) : e;
|
|
6721
|
+
return "LAST" === t.limitType ? an(e, e.limit, "L" /* LimitType.Last */) : e;
|
|
6719
6722
|
}
|
|
6720
6723
|
|
|
6721
6724
|
/** Encodes a NamedQuery proto object to a NamedQuery model object. */
|
|
@@ -7229,7 +7232,7 @@ class ur {
|
|
|
7229
7232
|
this.Be.seed(t);
|
|
7230
7233
|
}
|
|
7231
7234
|
qe(t) {
|
|
7232
|
-
return 0 /* ASCENDING */ === t ? this.Le : this.Ue;
|
|
7235
|
+
return 0 /* IndexKind.ASCENDING */ === t ? this.Le : this.Ue;
|
|
7233
7236
|
}
|
|
7234
7237
|
$e() {
|
|
7235
7238
|
return this.Be.$e();
|
|
@@ -7380,11 +7383,11 @@ function lr(t, e) {
|
|
|
7380
7383
|
}
|
|
7381
7384
|
He(t, e) {
|
|
7382
7385
|
if (void 0 === t || !t.field.isEqual(e.fieldPath)) return !1;
|
|
7383
|
-
const n = "array-contains" /* ARRAY_CONTAINS */ === t.op || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === t.op;
|
|
7384
|
-
return 2 /* CONTAINS */ === e.kind === n;
|
|
7386
|
+
const n = "array-contains" /* Operator.ARRAY_CONTAINS */ === t.op || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === t.op;
|
|
7387
|
+
return 2 /* IndexKind.CONTAINS */ === e.kind === n;
|
|
7385
7388
|
}
|
|
7386
7389
|
Je(t, e) {
|
|
7387
|
-
return !!t.field.isEqual(e.fieldPath) && (0 /* ASCENDING */ === e.kind && "asc" /* ASCENDING */ === t.dir || 1 /* DESCENDING */ === e.kind && "desc" /* DESCENDING */ === t.dir);
|
|
7390
|
+
return !!t.field.isEqual(e.fieldPath) && (0 /* IndexKind.ASCENDING */ === e.kind && "asc" /* Direction.ASCENDING */ === t.dir || 1 /* IndexKind.DESCENDING */ === e.kind && "desc" /* Direction.DESCENDING */ === t.dir);
|
|
7388
7391
|
}
|
|
7389
7392
|
}
|
|
7390
7393
|
|
|
@@ -7430,7 +7433,7 @@ function lr(t, e) {
|
|
|
7430
7433
|
}
|
|
7431
7434
|
getIndexType(t, e) {
|
|
7432
7435
|
// Field indices are not supported with memory persistence.
|
|
7433
|
-
return At.resolve(0 /* NONE */);
|
|
7436
|
+
return At.resolve(0 /* IndexType.NONE */);
|
|
7434
7437
|
}
|
|
7435
7438
|
getFieldIndexes(t, e) {
|
|
7436
7439
|
// Field indices are not supported with memory persistence.
|
|
@@ -7602,10 +7605,10 @@ class mr {
|
|
|
7602
7605
|
const n = ht(e);
|
|
7603
7606
|
if (void 0 === n) return null;
|
|
7604
7607
|
for (const e of Me(t, n.fieldPath)) switch (e.op) {
|
|
7605
|
-
case "array-contains-any" /* ARRAY_CONTAINS_ANY */ :
|
|
7608
|
+
case "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ :
|
|
7606
7609
|
return e.value.arrayValue.values || [];
|
|
7607
7610
|
|
|
7608
|
-
case "array-contains" /* ARRAY_CONTAINS */ :
|
|
7611
|
+
case "array-contains" /* Operator.ARRAY_CONTAINS */ :
|
|
7609
7612
|
return [ e.value ];
|
|
7610
7613
|
// Remaining filters are not array filters.
|
|
7611
7614
|
}
|
|
@@ -7617,16 +7620,16 @@ class mr {
|
|
|
7617
7620
|
*/ (r, i), c = function(t, e) {
|
|
7618
7621
|
const n = new Map;
|
|
7619
7622
|
for (const s of lt(e)) for (const e of Me(t, s.fieldPath)) switch (e.op) {
|
|
7620
|
-
case "==" /* EQUAL */ :
|
|
7621
|
-
case "in" /* IN */ :
|
|
7623
|
+
case "==" /* Operator.EQUAL */ :
|
|
7624
|
+
case "in" /* Operator.IN */ :
|
|
7622
7625
|
// Encode equality prefix, which is encoded in the index value before
|
|
7623
7626
|
// the inequality (e.g. `a == 'a' && b != 'b'` is encoded to
|
|
7624
7627
|
// `value != 'ab'`).
|
|
7625
7628
|
n.set(s.fieldPath.canonicalString(), e.value);
|
|
7626
7629
|
break;
|
|
7627
7630
|
|
|
7628
|
-
case "not-in" /* NOT_IN */ :
|
|
7629
|
-
case "!=" /* NOT_EQUAL */ :
|
|
7631
|
+
case "not-in" /* Operator.NOT_IN */ :
|
|
7632
|
+
case "!=" /* Operator.NOT_EQUAL */ :
|
|
7630
7633
|
// NotIn/NotEqual is always a suffix. There cannot be any remaining
|
|
7631
7634
|
// segments and hence we can return early here.
|
|
7632
7635
|
return n.set(s.fieldPath.canonicalString(), e.value), Array.from(n.values());
|
|
@@ -7644,7 +7647,7 @@ class mr {
|
|
|
7644
7647
|
// For each segment, retrieve a lower bound if there is a suitable filter or
|
|
7645
7648
|
// startAt.
|
|
7646
7649
|
for (const i of lt(e)) {
|
|
7647
|
-
const e = 0 /* ASCENDING */ === i.kind ? Fe(t, i.fieldPath, t.startAt) : $e(t, i.fieldPath, t.startAt);
|
|
7650
|
+
const e = 0 /* IndexKind.ASCENDING */ === i.kind ? Fe(t, i.fieldPath, t.startAt) : $e(t, i.fieldPath, t.startAt);
|
|
7648
7651
|
n.push(e.value), s && (s = e.inclusive);
|
|
7649
7652
|
}
|
|
7650
7653
|
return new ze(n, s);
|
|
@@ -7659,7 +7662,7 @@ class mr {
|
|
|
7659
7662
|
// For each segment, retrieve an upper bound if there is a suitable filter or
|
|
7660
7663
|
// endAt.
|
|
7661
7664
|
for (const i of lt(e)) {
|
|
7662
|
-
const e = 0 /* ASCENDING */ === i.kind ? $e(t, i.fieldPath, t.endAt) : Fe(t, i.fieldPath, t.endAt);
|
|
7665
|
+
const e = 0 /* IndexKind.ASCENDING */ === i.kind ? $e(t, i.fieldPath, t.endAt) : Fe(t, i.fieldPath, t.endAt);
|
|
7663
7666
|
n.push(e.value), s && (s = e.inclusive);
|
|
7664
7667
|
}
|
|
7665
7668
|
return new ze(n, s);
|
|
@@ -7717,9 +7720,9 @@ class mr {
|
|
|
7717
7720
|
}));
|
|
7718
7721
|
}
|
|
7719
7722
|
getIndexType(t, e) {
|
|
7720
|
-
let n = 2 /* FULL */;
|
|
7723
|
+
let n = 2 /* IndexType.FULL */;
|
|
7721
7724
|
return At.forEach(this.tn(e), (e => this.en(t, e).next((t => {
|
|
7722
|
-
t ? 0 /* NONE */ !== n && t.fields.length < function(t) {
|
|
7725
|
+
t ? 0 /* IndexType.NONE */ !== n && t.fields.length < function(t) {
|
|
7723
7726
|
let e = new qt(ut.comparator), n = !1;
|
|
7724
7727
|
for (const s of t.filters) {
|
|
7725
7728
|
// TODO(orquery): Use the flattened filters here
|
|
@@ -7731,14 +7734,14 @@ class mr {
|
|
|
7731
7734
|
// For instance, it is possible to have an index for "a ARRAY a ASC". Even
|
|
7732
7735
|
// though these are on the same field, they should be counted as two
|
|
7733
7736
|
// separate segments in an index.
|
|
7734
|
-
"array-contains" /* ARRAY_CONTAINS */ === t.op || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === t.op ? n = !0 : e = e.add(t.field));
|
|
7737
|
+
"array-contains" /* Operator.ARRAY_CONTAINS */ === t.op || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === t.op ? n = !0 : e = e.add(t.field));
|
|
7735
7738
|
}
|
|
7736
7739
|
for (const n of t.orderBy)
|
|
7737
7740
|
// __name__ is not an explicit segment of any index, so we don't need to
|
|
7738
7741
|
// count it.
|
|
7739
7742
|
n.field.isKeyField() || (e = e.add(n.field));
|
|
7740
7743
|
return e.size + (n ? 1 : 0);
|
|
7741
|
-
}(e) && (n = 1 /* PARTIAL */) : n = 0 /* NONE */;
|
|
7744
|
+
}(e) && (n = 1 /* IndexType.PARTIAL */) : n = 0 /* IndexType.NONE */;
|
|
7742
7745
|
})))).next((() => n));
|
|
7743
7746
|
}
|
|
7744
7747
|
/**
|
|
@@ -7757,7 +7760,7 @@ class mr {
|
|
|
7757
7760
|
}
|
|
7758
7761
|
/** Encodes a single value to the ascending index format. */ on(t) {
|
|
7759
7762
|
const e = new cr;
|
|
7760
|
-
return nr.Te.ce(t, e.qe(0 /* ASCENDING */)), e.$e();
|
|
7763
|
+
return nr.Te.ce(t, e.qe(0 /* IndexKind.ASCENDING */)), e.$e();
|
|
7761
7764
|
}
|
|
7762
7765
|
/**
|
|
7763
7766
|
* Returns an encoded form of the document key that sorts based on the key
|
|
@@ -7766,7 +7769,7 @@ class mr {
|
|
|
7766
7769
|
const n = new cr;
|
|
7767
7770
|
return nr.Te.ce(we(this.databaseId, e), n.qe(function(t) {
|
|
7768
7771
|
const e = lt(t);
|
|
7769
|
-
return 0 === e.length ? 0 /* ASCENDING */ : e[e.length - 1].kind;
|
|
7772
|
+
return 0 === e.length ? 0 /* IndexKind.ASCENDING */ : e[e.length - 1].kind;
|
|
7770
7773
|
}(t))), n.$e();
|
|
7771
7774
|
}
|
|
7772
7775
|
/**
|
|
@@ -7812,7 +7815,7 @@ class mr {
|
|
|
7812
7815
|
return i;
|
|
7813
7816
|
}
|
|
7814
7817
|
ln(t, e) {
|
|
7815
|
-
return !!t.filters.find((t => t instanceof Be && t.field.isEqual(e) && ("in" /* IN */ === t.op || "not-in" /* NOT_IN */ === t.op)));
|
|
7818
|
+
return !!t.filters.find((t => t instanceof Be && t.field.isEqual(e) && ("in" /* Operator.IN */ === t.op || "not-in" /* Operator.NOT_IN */ === t.op)));
|
|
7816
7819
|
}
|
|
7817
7820
|
getFieldIndexes(t, e) {
|
|
7818
7821
|
const n = pr(t), s = Ir(t);
|
|
@@ -8703,7 +8706,7 @@ class Cr {
|
|
|
8703
8706
|
return null !== this.Mn;
|
|
8704
8707
|
}
|
|
8705
8708
|
Fn(t) {
|
|
8706
|
-
C("LruGarbageCollector", `Garbage collection scheduled in ${t}ms`), this.Mn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* LruGarbageCollection */ , t, (async () => {
|
|
8709
|
+
C("LruGarbageCollector", `Garbage collection scheduled in ${t}ms`), this.Mn = this.asyncQueue.enqueueAfterDelay("lru_garbage_collection" /* TimerId.LruGarbageCollection */ , t, (async () => {
|
|
8707
8710
|
this.Mn = null;
|
|
8708
8711
|
try {
|
|
8709
8712
|
await this.localStore.collectGarbage(this.garbageCollector);
|
|
@@ -9594,7 +9597,7 @@ class Yr {
|
|
|
9594
9597
|
}));
|
|
9595
9598
|
}
|
|
9596
9599
|
/** Returns a base document that can be used to apply `overlay`. */ getBaseDocument(t, e, n) {
|
|
9597
|
-
return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : At.resolve(Se.newInvalidDocument(e));
|
|
9600
|
+
return null === n || 1 /* MutationType.Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : At.resolve(Se.newInvalidDocument(e));
|
|
9598
9601
|
}
|
|
9599
9602
|
}
|
|
9600
9603
|
|
|
@@ -10851,7 +10854,7 @@ class _o {
|
|
|
10851
10854
|
* Schedules a recurring timer to update the client metadata and to either
|
|
10852
10855
|
* extend or acquire the primary lease if the client is eligible.
|
|
10853
10856
|
*/ hi() {
|
|
10854
|
-
this.ei = this.Hs.enqueueAfterDelay("client_metadata_refresh" /* ClientMetadataRefresh */ , 4e3, (() => this.ui().then((() => this.yi())).then((() => this.hi()))));
|
|
10857
|
+
this.ei = this.Hs.enqueueAfterDelay("client_metadata_refresh" /* TimerId.ClientMetadataRefresh */ , 4e3, (() => this.ui().then((() => this.yi())).then((() => this.hi()))));
|
|
10855
10858
|
}
|
|
10856
10859
|
/** Checks whether `client` is the local client. */ mi(t) {
|
|
10857
10860
|
return !!t && t.ownerId === this.clientId;
|
|
@@ -11131,11 +11134,11 @@ class yo {
|
|
|
11131
11134
|
static Ci(t, e) {
|
|
11132
11135
|
let n = fs(), s = fs();
|
|
11133
11136
|
for (const t of e.docChanges) switch (t.type) {
|
|
11134
|
-
case 0 /* Added */ :
|
|
11137
|
+
case 0 /* ChangeType.Added */ :
|
|
11135
11138
|
n = n.add(t.doc.key);
|
|
11136
11139
|
break;
|
|
11137
11140
|
|
|
11138
|
-
case 1 /* Removed */ :
|
|
11141
|
+
case 1 /* ChangeType.Removed */ :
|
|
11139
11142
|
s = s.add(t.doc.key);
|
|
11140
11143
|
// do nothing
|
|
11141
11144
|
}
|
|
@@ -11216,7 +11219,7 @@ class yo {
|
|
|
11216
11219
|
// collection, rather than to perform individual lookups.
|
|
11217
11220
|
return At.resolve(null);
|
|
11218
11221
|
let n = cn(e);
|
|
11219
|
-
return this.indexManager.getIndexType(t, n).next((s => 0 /* NONE */ === s ? null : (null !== e.limit && 1 /* PARTIAL */ === s && (
|
|
11222
|
+
return this.indexManager.getIndexType(t, n).next((s => 0 /* IndexType.NONE */ === s ? null : (null !== e.limit && 1 /* IndexType.PARTIAL */ === s && (
|
|
11220
11223
|
// We cannot apply a limit for targets that are served using a partial
|
|
11221
11224
|
// index. If a partial index will be used to serve the target, the
|
|
11222
11225
|
// query may return a superset of documents that match the target
|
|
@@ -11224,11 +11227,11 @@ class yo {
|
|
|
11224
11227
|
// may return the correct set of documents in the wrong order (e.g. if
|
|
11225
11228
|
// the index doesn't include a segment for one of the orderBys).
|
|
11226
11229
|
// Therefore, a limit should not be applied in such cases.
|
|
11227
|
-
e = an(e, null, "F" /* First */), n = cn(e)), this.indexManager.getDocumentsMatchingTarget(t, n).next((s => {
|
|
11230
|
+
e = an(e, null, "F" /* LimitType.First */), n = cn(e)), this.indexManager.getDocumentsMatchingTarget(t, n).next((s => {
|
|
11228
11231
|
const i = fs(...s);
|
|
11229
11232
|
return this.Ni.getDocuments(t, i).next((s => this.indexManager.getMinOffset(t, n).next((n => {
|
|
11230
11233
|
const r = this.Fi(e, s);
|
|
11231
|
-
return this.$i(e, r, i, n.readTime) ? this.ki(t, an(e, null, "F" /* First */)) : this.Bi(t, r, e, n);
|
|
11234
|
+
return this.$i(e, r, i, n.readTime) ? this.ki(t, an(e, null, "F" /* LimitType.First */)) : this.Bi(t, r, e, n);
|
|
11232
11235
|
}))));
|
|
11233
11236
|
})))));
|
|
11234
11237
|
}
|
|
@@ -11279,7 +11282,7 @@ class yo {
|
|
|
11279
11282
|
// the boundary of the limit itself did not change and documents from cache
|
|
11280
11283
|
// will continue to be "rejected" by this boundary. Therefore, we can ignore
|
|
11281
11284
|
// any modifications that don't affect the last document.
|
|
11282
|
-
const i = "F" /* First */ === t.limitType ? e.last() : e.first();
|
|
11285
|
+
const i = "F" /* LimitType.First */ === t.limitType ? e.last() : e.first();
|
|
11283
11286
|
return !!i && (i.hasPendingWrites || i.version.compareTo(s) > 0);
|
|
11284
11287
|
}
|
|
11285
11288
|
Mi(t, e) {
|
|
@@ -11610,7 +11613,7 @@ function Vo(t, e) {
|
|
|
11610
11613
|
// This target has been listened to previously, so reuse the
|
|
11611
11614
|
// previous targetID.
|
|
11612
11615
|
// TODO(mcg): freshen last accessed date?
|
|
11613
|
-
s = i, At.resolve(s)) : n.Cs.allocateTargetId(t).next((i => (s = new Fi(e, i, 0 /* Listen */ , t.currentSequenceNumber),
|
|
11616
|
+
s = i, At.resolve(s)) : n.Cs.allocateTargetId(t).next((i => (s = new Fi(e, i, 0 /* TargetPurpose.Listen */ , t.currentSequenceNumber),
|
|
11614
11617
|
n.Cs.addTargetData(t, s).next((() => s)))))));
|
|
11615
11618
|
})).then((t => {
|
|
11616
11619
|
// If Multi-Tab is enabled, the existing target data may be newer than
|
|
@@ -12357,11 +12360,11 @@ class Wo {
|
|
|
12357
12360
|
}
|
|
12358
12361
|
Gr() {
|
|
12359
12362
|
C("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
|
|
12360
|
-
for (const t of this.Wr) t(0 /* AVAILABLE */);
|
|
12363
|
+
for (const t of this.Wr) t(0 /* NetworkStatus.AVAILABLE */);
|
|
12361
12364
|
}
|
|
12362
12365
|
jr() {
|
|
12363
12366
|
C("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
|
|
12364
|
-
for (const t of this.Wr) t(1 /* UNAVAILABLE */);
|
|
12367
|
+
for (const t of this.Wr) t(1 /* NetworkStatus.UNAVAILABLE */);
|
|
12365
12368
|
}
|
|
12366
12369
|
// TODO(chenbrian): Consider passing in window either into this component or
|
|
12367
12370
|
// here for testing via FakeWindow.
|
|
@@ -12520,12 +12523,11 @@ class {
|
|
|
12520
12523
|
return new Promise(((i, r) => {
|
|
12521
12524
|
const o = new XhrIo;
|
|
12522
12525
|
o.setWithCredentials(!0), o.listenOnce(EventType.COMPLETE, (() => {
|
|
12523
|
-
var e;
|
|
12524
12526
|
try {
|
|
12525
12527
|
switch (o.getLastErrorCode()) {
|
|
12526
12528
|
case ErrorCode.NO_ERROR:
|
|
12527
|
-
const
|
|
12528
|
-
C("Connection", "XHR received:", JSON.stringify(
|
|
12529
|
+
const e = o.getResponseJson();
|
|
12530
|
+
C("Connection", "XHR received:", JSON.stringify(e)), i(e);
|
|
12529
12531
|
break;
|
|
12530
12532
|
|
|
12531
12533
|
case ErrorCode.TIMEOUT:
|
|
@@ -12533,18 +12535,18 @@ class {
|
|
|
12533
12535
|
break;
|
|
12534
12536
|
|
|
12535
12537
|
case ErrorCode.HTTP_ERROR:
|
|
12536
|
-
const
|
|
12537
|
-
if (C("Connection", 'RPC "' + t + '" failed with status:',
|
|
12538
|
-
|
|
12538
|
+
const n = o.getStatus();
|
|
12539
|
+
if (C("Connection", 'RPC "' + t + '" failed with status:', n, "response text:", o.getResponseText()),
|
|
12540
|
+
n > 0) {
|
|
12539
12541
|
let t = o.getResponseJson();
|
|
12540
12542
|
Array.isArray(t) && (t = t[0]);
|
|
12541
|
-
const
|
|
12542
|
-
if (
|
|
12543
|
+
const e = null == t ? void 0 : t.error;
|
|
12544
|
+
if (e && e.status && e.message) {
|
|
12543
12545
|
const t = function(t) {
|
|
12544
12546
|
const e = t.toLowerCase().replace(/_/g, "-");
|
|
12545
12547
|
return Object.values(B).indexOf(e) >= 0 ? e : B.UNKNOWN;
|
|
12546
|
-
}(
|
|
12547
|
-
r(new L(t,
|
|
12548
|
+
}(e.status);
|
|
12549
|
+
r(new L(t, e.message));
|
|
12548
12550
|
} else r(new L(B.UNKNOWN, "Server responded with status " + o.getStatus()));
|
|
12549
12551
|
} else
|
|
12550
12552
|
// If we received an HTTP_ERROR but there's no status code,
|
|
@@ -12887,7 +12889,7 @@ class tu {
|
|
|
12887
12889
|
class eu {
|
|
12888
12890
|
constructor(t, e, n, s, i, r, o, u) {
|
|
12889
12891
|
this.Hs = t, this.vo = n, this.Vo = s, this.connection = i, this.authCredentialsProvider = r,
|
|
12890
|
-
this.appCheckCredentialsProvider = o, this.listener = u, this.state = 0 /* Initial */ ,
|
|
12892
|
+
this.appCheckCredentialsProvider = o, this.listener = u, this.state = 0 /* PersistentStreamState.Initial */ ,
|
|
12891
12893
|
/**
|
|
12892
12894
|
* A close count that's incremented every time the stream is closed; used by
|
|
12893
12895
|
* getCloseGuardedDispatcher() to invalidate callbacks that happen after
|
|
@@ -12902,13 +12904,13 @@ class eu {
|
|
|
12902
12904
|
* actual RPC). Use isOpen() to determine if the stream is open and ready for
|
|
12903
12905
|
* outbound requests.
|
|
12904
12906
|
*/ No() {
|
|
12905
|
-
return 1 /* Starting */ === this.state || 5 /* Backoff */ === this.state || this.ko();
|
|
12907
|
+
return 1 /* PersistentStreamState.Starting */ === this.state || 5 /* PersistentStreamState.Backoff */ === this.state || this.ko();
|
|
12906
12908
|
}
|
|
12907
12909
|
/**
|
|
12908
12910
|
* Returns true if the underlying RPC is open (the onOpen() listener has been
|
|
12909
12911
|
* called) and the stream is ready for outbound requests.
|
|
12910
12912
|
*/ ko() {
|
|
12911
|
-
return 2 /* Open */ === this.state || 3 /* Healthy */ === this.state;
|
|
12913
|
+
return 2 /* PersistentStreamState.Open */ === this.state || 3 /* PersistentStreamState.Healthy */ === this.state;
|
|
12912
12914
|
}
|
|
12913
12915
|
/**
|
|
12914
12916
|
* Starts the RPC. Only allowed if isStarted() returns false. The stream is
|
|
@@ -12917,7 +12919,7 @@ class eu {
|
|
|
12917
12919
|
*
|
|
12918
12920
|
* When start returns, isStarted() will return true.
|
|
12919
12921
|
*/ start() {
|
|
12920
|
-
4 /* Error */ !== this.state ? this.auth() : this.Oo();
|
|
12922
|
+
4 /* PersistentStreamState.Error */ !== this.state ? this.auth() : this.Oo();
|
|
12921
12923
|
}
|
|
12922
12924
|
/**
|
|
12923
12925
|
* Stops the RPC. This call is idempotent and allowed regardless of the
|
|
@@ -12925,7 +12927,7 @@ class eu {
|
|
|
12925
12927
|
*
|
|
12926
12928
|
* When stop returns, isStarted() and isOpen() will both return false.
|
|
12927
12929
|
*/ async stop() {
|
|
12928
|
-
this.No() && await this.close(0 /* Initial */);
|
|
12930
|
+
this.No() && await this.close(0 /* PersistentStreamState.Initial */);
|
|
12929
12931
|
}
|
|
12930
12932
|
/**
|
|
12931
12933
|
* After an error the stream will usually back off on the next attempt to
|
|
@@ -12935,7 +12937,7 @@ class eu {
|
|
|
12935
12937
|
* Each error will call the onClose() listener. That function can decide to
|
|
12936
12938
|
* inhibit backoff if required.
|
|
12937
12939
|
*/ Mo() {
|
|
12938
|
-
this.state = 0 /* Initial */ , this.xo.reset();
|
|
12940
|
+
this.state = 0 /* PersistentStreamState.Initial */ , this.xo.reset();
|
|
12939
12941
|
}
|
|
12940
12942
|
/**
|
|
12941
12943
|
* Marks this stream as idle. If no further actions are performed on the
|
|
@@ -12958,7 +12960,7 @@ class eu {
|
|
|
12958
12960
|
if (this.ko())
|
|
12959
12961
|
// When timing out an idle stream there's no reason to force the stream into backoff when
|
|
12960
12962
|
// it restarts so set the stream state to Initial instead of Error.
|
|
12961
|
-
return this.close(0 /* Initial */);
|
|
12963
|
+
return this.close(0 /* PersistentStreamState.Initial */);
|
|
12962
12964
|
}
|
|
12963
12965
|
/** Marks the stream as active again. */ Lo() {
|
|
12964
12966
|
this.Do && (this.Do.cancel(), this.Do = null);
|
|
@@ -12983,12 +12985,12 @@ class eu {
|
|
|
12983
12985
|
this.Lo(), this.Uo(), this.xo.cancel(),
|
|
12984
12986
|
// Invalidates any stream-related callbacks (e.g. from auth or the
|
|
12985
12987
|
// underlying stream), guaranteeing they won't execute.
|
|
12986
|
-
this.So++, 4 /* Error */ !== t ?
|
|
12988
|
+
this.So++, 4 /* PersistentStreamState.Error */ !== t ?
|
|
12987
12989
|
// If this is an intentional close ensure we don't delay our next connection attempt.
|
|
12988
12990
|
this.xo.reset() : e && e.code === B.RESOURCE_EXHAUSTED ? (
|
|
12989
12991
|
// Log the error. (Probably either 'quota exceeded' or 'max queue length reached'.)
|
|
12990
12992
|
x(e.toString()), x("Using maximum backoff delay to prevent overloading the backend."),
|
|
12991
|
-
this.xo.Ao()) : e && e.code === B.UNAUTHENTICATED && 3 /* Healthy */ !== this.state && (
|
|
12993
|
+
this.xo.Ao()) : e && e.code === B.UNAUTHENTICATED && 3 /* PersistentStreamState.Healthy */ !== this.state && (
|
|
12992
12994
|
// "unauthenticated" error means the token was rejected. This should rarely
|
|
12993
12995
|
// happen since both Auth and AppCheck ensure a sufficient TTL when we
|
|
12994
12996
|
// request a token. If a user manually resets their system clock this can
|
|
@@ -13009,7 +13011,7 @@ class eu {
|
|
|
13009
13011
|
* Calling super.tearDown() is not required.
|
|
13010
13012
|
*/ qo() {}
|
|
13011
13013
|
auth() {
|
|
13012
|
-
this.state = 1 /* Starting */;
|
|
13014
|
+
this.state = 1 /* PersistentStreamState.Starting */;
|
|
13013
13015
|
const t = this.Ko(this.So), e = this.So;
|
|
13014
13016
|
// TODO(mikelehen): Just use dispatchIfNotClosed, but see TODO below.
|
|
13015
13017
|
Promise.all([ this.authCredentialsProvider.getToken(), this.appCheckCredentialsProvider.getToken() ]).then((([t, n]) => {
|
|
@@ -13032,7 +13034,7 @@ class eu {
|
|
|
13032
13034
|
Go(t, e) {
|
|
13033
13035
|
const n = this.Ko(this.So);
|
|
13034
13036
|
this.stream = this.jo(t, e), this.stream.Yr((() => {
|
|
13035
|
-
n((() => (this.state = 2 /* Open */ , this.Co = this.Hs.enqueueAfterDelay(this.Vo, 1e4, (() => (this.ko() && (this.state = 3 /* Healthy */),
|
|
13037
|
+
n((() => (this.state = 2 /* PersistentStreamState.Open */ , this.Co = this.Hs.enqueueAfterDelay(this.Vo, 1e4, (() => (this.ko() && (this.state = 3 /* PersistentStreamState.Healthy */),
|
|
13036
13038
|
Promise.resolve()))), this.listener.Yr())));
|
|
13037
13039
|
})), this.stream.Zr((t => {
|
|
13038
13040
|
n((() => this.Qo(t)));
|
|
@@ -13041,8 +13043,8 @@ class eu {
|
|
|
13041
13043
|
}));
|
|
13042
13044
|
}
|
|
13043
13045
|
Oo() {
|
|
13044
|
-
this.state = 5 /* Backoff */ , this.xo.Ro((async () => {
|
|
13045
|
-
this.state = 0 /* Initial */ , this.start();
|
|
13046
|
+
this.state = 5 /* PersistentStreamState.Backoff */ , this.xo.Ro((async () => {
|
|
13047
|
+
this.state = 0 /* PersistentStreamState.Initial */ , this.start();
|
|
13046
13048
|
}));
|
|
13047
13049
|
}
|
|
13048
13050
|
// Visible for tests
|
|
@@ -13051,7 +13053,7 @@ class eu {
|
|
|
13051
13053
|
// we never expect this to happen because if we stop a stream ourselves,
|
|
13052
13054
|
// this callback will never be called. To prevent cases where we retry
|
|
13053
13055
|
// without a backoff accidentally, we set the stream to error in all cases.
|
|
13054
|
-
return C("PersistentStream", `close with error: ${t}`), this.stream = null, this.close(4 /* Error */ , t);
|
|
13056
|
+
return C("PersistentStream", `close with error: ${t}`), this.stream = null, this.close(4 /* PersistentStreamState.Error */ , t);
|
|
13055
13057
|
}
|
|
13056
13058
|
/**
|
|
13057
13059
|
* Returns a "dispatcher" function that dispatches operations onto the
|
|
@@ -13074,7 +13076,7 @@ class eu {
|
|
|
13074
13076
|
* sent from the server for ListenResponses.
|
|
13075
13077
|
*/ class nu extends eu {
|
|
13076
13078
|
constructor(t, e, n, s, i, r) {
|
|
13077
|
-
super(t, "listen_stream_connection_backoff" /* ListenStreamConnectionBackoff */ , "listen_stream_idle" /* ListenStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , e, n, s, r),
|
|
13079
|
+
super(t, "listen_stream_connection_backoff" /* TimerId.ListenStreamConnectionBackoff */ , "listen_stream_idle" /* TimerId.ListenStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , e, n, s, r),
|
|
13078
13080
|
this.It = i;
|
|
13079
13081
|
}
|
|
13080
13082
|
jo(t, e) {
|
|
@@ -13143,7 +13145,7 @@ class eu {
|
|
|
13143
13145
|
* TODO(b/33271235): Use proto types
|
|
13144
13146
|
*/ class su extends eu {
|
|
13145
13147
|
constructor(t, e, n, s, i, r) {
|
|
13146
|
-
super(t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , e, n, s, r),
|
|
13148
|
+
super(t, "write_stream_connection_backoff" /* TimerId.WriteStreamConnectionBackoff */ , "write_stream_idle" /* TimerId.WriteStreamIdle */ , "health_check_timeout" /* TimerId.HealthCheckTimeout */ , e, n, s, r),
|
|
13147
13149
|
this.It = i, this.Jo = !1;
|
|
13148
13150
|
}
|
|
13149
13151
|
/**
|
|
@@ -13280,7 +13282,7 @@ class ou {
|
|
|
13280
13282
|
constructor(t, e) {
|
|
13281
13283
|
this.asyncQueue = t, this.onlineStateHandler = e,
|
|
13282
13284
|
/** The current OnlineState. */
|
|
13283
|
-
this.state = "Unknown" /* Unknown */ ,
|
|
13285
|
+
this.state = "Unknown" /* OnlineState.Unknown */ ,
|
|
13284
13286
|
/**
|
|
13285
13287
|
* A count of consecutive failures to open the stream. If it reaches the
|
|
13286
13288
|
* maximum defined by MAX_WATCH_STREAM_FAILURES, we'll set the OnlineState to
|
|
@@ -13307,8 +13309,8 @@ class ou {
|
|
|
13307
13309
|
* If this is the first attempt, it sets the OnlineState to Unknown and starts
|
|
13308
13310
|
* the onlineStateTimer.
|
|
13309
13311
|
*/ uu() {
|
|
13310
|
-
0 === this.iu && (this.cu("Unknown" /* Unknown */), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* OnlineStateTimeout */ , 1e4, (() => (this.ru = null,
|
|
13311
|
-
this.au("Backend didn't respond within 10 seconds."), this.cu("Offline" /* Offline */),
|
|
13312
|
+
0 === this.iu && (this.cu("Unknown" /* OnlineState.Unknown */), this.ru = this.asyncQueue.enqueueAfterDelay("online_state_timeout" /* TimerId.OnlineStateTimeout */ , 1e4, (() => (this.ru = null,
|
|
13313
|
+
this.au("Backend didn't respond within 10 seconds."), this.cu("Offline" /* OnlineState.Offline */),
|
|
13312
13314
|
Promise.resolve()))));
|
|
13313
13315
|
}
|
|
13314
13316
|
/**
|
|
@@ -13317,9 +13319,9 @@ class ou {
|
|
|
13317
13319
|
* allow multiple failures (based on MAX_WATCH_STREAM_FAILURES) before we
|
|
13318
13320
|
* actually transition to the 'Offline' state.
|
|
13319
13321
|
*/ hu(t) {
|
|
13320
|
-
"Online" /* Online */ === this.state ? this.cu("Unknown" /* Unknown */) : (this.iu++,
|
|
13322
|
+
"Online" /* OnlineState.Online */ === this.state ? this.cu("Unknown" /* OnlineState.Unknown */) : (this.iu++,
|
|
13321
13323
|
this.iu >= 1 && (this.lu(), this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),
|
|
13322
|
-
this.cu("Offline" /* Offline */)));
|
|
13324
|
+
this.cu("Offline" /* OnlineState.Offline */)));
|
|
13323
13325
|
}
|
|
13324
13326
|
/**
|
|
13325
13327
|
* Explicitly sets the OnlineState to the specified state.
|
|
@@ -13328,7 +13330,7 @@ class ou {
|
|
|
13328
13330
|
* Offline heuristics, so must not be used in place of
|
|
13329
13331
|
* handleWatchStreamStart() and handleWatchStreamFailure().
|
|
13330
13332
|
*/ set(t) {
|
|
13331
|
-
this.lu(), this.iu = 0, "Online" /* Online */ === t && (
|
|
13333
|
+
this.lu(), this.iu = 0, "Online" /* OnlineState.Online */ === t && (
|
|
13332
13334
|
// We've connected to watch at least once. Don't warn the developer
|
|
13333
13335
|
// about being offline going forward.
|
|
13334
13336
|
this.ou = !1), this.cu(t);
|
|
@@ -13417,8 +13419,8 @@ class ou {
|
|
|
13417
13419
|
mu(this) && (C("RemoteStore", "Restarting streams for network reachability change."),
|
|
13418
13420
|
await async function(t) {
|
|
13419
13421
|
const e = $(t);
|
|
13420
|
-
e._u.add(4 /* ConnectivityChange */), await au(e), e.gu.set("Unknown" /* Unknown */),
|
|
13421
|
-
e._u.delete(4 /* ConnectivityChange */), await cu(e);
|
|
13422
|
+
e._u.add(4 /* OfflineCause.ConnectivityChange */), await au(e), e.gu.set("Unknown" /* OnlineState.Unknown */),
|
|
13423
|
+
e._u.delete(4 /* OfflineCause.ConnectivityChange */), await cu(e);
|
|
13422
13424
|
}(this));
|
|
13423
13425
|
}));
|
|
13424
13426
|
})), this.gu = new ou(n, s);
|
|
@@ -13458,7 +13460,7 @@ function hu(t, e) {
|
|
|
13458
13460
|
// Revert to OnlineState.Unknown if the watch stream is not open and we
|
|
13459
13461
|
// have no listeners, since without any listens to send we cannot
|
|
13460
13462
|
// confirm if the stream is healthy and upgrade to OnlineState.Online.
|
|
13461
|
-
n.gu.set("Unknown" /* Unknown */));
|
|
13463
|
+
n.gu.set("Unknown" /* OnlineState.Unknown */));
|
|
13462
13464
|
}
|
|
13463
13465
|
|
|
13464
13466
|
/**
|
|
@@ -13511,13 +13513,13 @@ async function pu(t, e) {
|
|
|
13511
13513
|
// No need to restart watch stream because there are no active targets.
|
|
13512
13514
|
// The online state is set to unknown because there is no active attempt
|
|
13513
13515
|
// at establishing a connection
|
|
13514
|
-
t.gu.set("Unknown" /* Unknown */);
|
|
13516
|
+
t.gu.set("Unknown" /* OnlineState.Unknown */);
|
|
13515
13517
|
}
|
|
13516
13518
|
|
|
13517
13519
|
async function Iu(t, e, n) {
|
|
13518
13520
|
if (
|
|
13519
13521
|
// Mark the client as online since we got a message from the server
|
|
13520
|
-
t.gu.set("Online" /* Online */), e instanceof ps && 2 /* Removed */ === e.state && e.cause)
|
|
13522
|
+
t.gu.set("Online" /* OnlineState.Online */), e instanceof ps && 2 /* WatchTargetChangeState.Removed */ === e.state && e.cause)
|
|
13521
13523
|
// There was an error on a target, don't wait for a consistent snapshot
|
|
13522
13524
|
// to raise events
|
|
13523
13525
|
try {
|
|
@@ -13580,7 +13582,7 @@ async function Iu(t, e, n) {
|
|
|
13580
13582
|
// mismatch, but don't actually retain that in listenTargets. This ensures
|
|
13581
13583
|
// that we flag the first re-listen this way without impacting future
|
|
13582
13584
|
// listens of this target (that might happen e.g. on reconnect).
|
|
13583
|
-
const s = new Fi(n.target, e, 1 /* ExistenceFilterMismatch */ , n.sequenceNumber);
|
|
13585
|
+
const s = new Fi(n.target, e, 1 /* TargetPurpose.ExistenceFilterMismatch */ , n.sequenceNumber);
|
|
13584
13586
|
fu(t, s);
|
|
13585
13587
|
})), t.remoteSyncer.applyRemoteEvent(n);
|
|
13586
13588
|
}(t, n);
|
|
@@ -13599,16 +13601,16 @@ async function Iu(t, e, n) {
|
|
|
13599
13601
|
* any retry attempt.
|
|
13600
13602
|
*/ async function Tu(t, e, n) {
|
|
13601
13603
|
if (!Vt(e)) throw e;
|
|
13602
|
-
t._u.add(1 /* IndexedDbFailed */),
|
|
13604
|
+
t._u.add(1 /* OfflineCause.IndexedDbFailed */),
|
|
13603
13605
|
// Disable network and raise offline snapshots
|
|
13604
|
-
await au(t), t.gu.set("Offline" /* Offline */), n || (
|
|
13606
|
+
await au(t), t.gu.set("Offline" /* OnlineState.Offline */), n || (
|
|
13605
13607
|
// Use a simple read operation to determine if IndexedDB recovered.
|
|
13606
13608
|
// Ideally, we would expose a health check directly on SimpleDb, but
|
|
13607
13609
|
// RemoteStore only has access to persistence through LocalStore.
|
|
13608
13610
|
n = () => Ro(t.localStore)),
|
|
13609
13611
|
// Probe IndexedDB periodically and re-enable network
|
|
13610
13612
|
t.asyncQueue.enqueueRetryable((async () => {
|
|
13611
|
-
C("RemoteStore", "Retrying IndexedDB access"), await n(), t._u.delete(1 /* IndexedDbFailed */),
|
|
13613
|
+
C("RemoteStore", "Retrying IndexedDB access"), await n(), t._u.delete(1 /* OfflineCause.IndexedDbFailed */),
|
|
13612
13614
|
await cu(t);
|
|
13613
13615
|
}));
|
|
13614
13616
|
}
|
|
@@ -13712,18 +13714,18 @@ async function xu(t, e) {
|
|
|
13712
13714
|
// Tear down and re-create our network streams. This will ensure we get a
|
|
13713
13715
|
// fresh auth token for the new user and re-fill the write pipeline with
|
|
13714
13716
|
// new mutations from the LocalStore (since mutations are per-user).
|
|
13715
|
-
n._u.add(3 /* CredentialChange */), await au(n), s &&
|
|
13717
|
+
n._u.add(3 /* OfflineCause.CredentialChange */), await au(n), s &&
|
|
13716
13718
|
// Don't set the network status to Unknown if we are offline.
|
|
13717
|
-
n.gu.set("Unknown" /* Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
13718
|
-
n._u.delete(3 /* CredentialChange */), await cu(n);
|
|
13719
|
+
n.gu.set("Unknown" /* OnlineState.Unknown */), await n.remoteSyncer.handleCredentialChange(e),
|
|
13720
|
+
n._u.delete(3 /* OfflineCause.CredentialChange */), await cu(n);
|
|
13719
13721
|
}
|
|
13720
13722
|
|
|
13721
13723
|
/**
|
|
13722
13724
|
* Toggles the network state when the client gains or loses its primary lease.
|
|
13723
13725
|
*/ async function Nu(t, e) {
|
|
13724
13726
|
const n = $(t);
|
|
13725
|
-
e ? (n._u.delete(2 /* IsSecondary */), await cu(n)) : e || (n._u.add(2 /* IsSecondary */),
|
|
13726
|
-
await au(n), n.gu.set("Unknown" /* Unknown */));
|
|
13727
|
+
e ? (n._u.delete(2 /* OfflineCause.IsSecondary */), await cu(n)) : e || (n._u.add(2 /* OfflineCause.IsSecondary */),
|
|
13728
|
+
await au(n), n.gu.set("Unknown" /* OnlineState.Unknown */));
|
|
13727
13729
|
}
|
|
13728
13730
|
|
|
13729
13731
|
/**
|
|
@@ -13760,7 +13762,7 @@ async function xu(t, e) {
|
|
|
13760
13762
|
Zr: pu.bind(null, t),
|
|
13761
13763
|
Wo: Iu.bind(null, t)
|
|
13762
13764
|
}), t.wu.push((async e => {
|
|
13763
|
-
e ? (t.pu.Mo(), wu(t) ? _u(t) : t.gu.set("Unknown" /* Unknown */)) : (await t.pu.stop(),
|
|
13765
|
+
e ? (t.pu.Mo(), wu(t) ? _u(t) : t.gu.set("Unknown" /* OnlineState.Unknown */)) : (await t.pu.stop(),
|
|
13764
13766
|
gu(t));
|
|
13765
13767
|
}))), t.pu;
|
|
13766
13768
|
}
|
|
@@ -14004,20 +14006,20 @@ class Mu {
|
|
|
14004
14006
|
const e = t.doc.key, n = this.Tu.get(e);
|
|
14005
14007
|
n ?
|
|
14006
14008
|
// Merge the new change with the existing change.
|
|
14007
|
-
0 /* Added */ !== t.type && 3 /* Metadata */ === n.type ? this.Tu = this.Tu.insert(e, t) : 3 /* Metadata */ === t.type && 1 /* Removed */ !== n.type ? this.Tu = this.Tu.insert(e, {
|
|
14009
|
+
0 /* ChangeType.Added */ !== t.type && 3 /* ChangeType.Metadata */ === n.type ? this.Tu = this.Tu.insert(e, t) : 3 /* ChangeType.Metadata */ === t.type && 1 /* ChangeType.Removed */ !== n.type ? this.Tu = this.Tu.insert(e, {
|
|
14008
14010
|
type: n.type,
|
|
14009
14011
|
doc: t.doc
|
|
14010
|
-
}) : 2 /* Modified */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14011
|
-
type: 2 /* Modified */ ,
|
|
14012
|
+
}) : 2 /* ChangeType.Modified */ === t.type && 2 /* ChangeType.Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14013
|
+
type: 2 /* ChangeType.Modified */ ,
|
|
14012
14014
|
doc: t.doc
|
|
14013
|
-
}) : 2 /* Modified */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14014
|
-
type: 0 /* Added */ ,
|
|
14015
|
+
}) : 2 /* ChangeType.Modified */ === t.type && 0 /* ChangeType.Added */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14016
|
+
type: 0 /* ChangeType.Added */ ,
|
|
14015
14017
|
doc: t.doc
|
|
14016
|
-
}) : 1 /* Removed */ === t.type && 0 /* Added */ === n.type ? this.Tu = this.Tu.remove(e) : 1 /* Removed */ === t.type && 2 /* Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14017
|
-
type: 1 /* Removed */ ,
|
|
14018
|
+
}) : 1 /* ChangeType.Removed */ === t.type && 0 /* ChangeType.Added */ === n.type ? this.Tu = this.Tu.remove(e) : 1 /* ChangeType.Removed */ === t.type && 2 /* ChangeType.Modified */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14019
|
+
type: 1 /* ChangeType.Removed */ ,
|
|
14018
14020
|
doc: n.doc
|
|
14019
|
-
}) : 0 /* Added */ === t.type && 1 /* Removed */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14020
|
-
type: 2 /* Modified */ ,
|
|
14021
|
+
}) : 0 /* ChangeType.Added */ === t.type && 1 /* ChangeType.Removed */ === n.type ? this.Tu = this.Tu.insert(e, {
|
|
14022
|
+
type: 2 /* ChangeType.Modified */ ,
|
|
14021
14023
|
doc: t.doc
|
|
14022
14024
|
}) :
|
|
14023
14025
|
// This includes these cases, which don't make sense:
|
|
@@ -14047,7 +14049,7 @@ class Lu {
|
|
|
14047
14049
|
const r = [];
|
|
14048
14050
|
return e.forEach((t => {
|
|
14049
14051
|
r.push({
|
|
14050
|
-
type: 0 /* Added */ ,
|
|
14052
|
+
type: 0 /* ChangeType.Added */ ,
|
|
14051
14053
|
doc: t
|
|
14052
14054
|
});
|
|
14053
14055
|
})), new Lu(t, e, $u.emptySet(e), r, n, s,
|
|
@@ -14093,7 +14095,7 @@ class Lu {
|
|
|
14093
14095
|
|
|
14094
14096
|
class qu {
|
|
14095
14097
|
constructor() {
|
|
14096
|
-
this.queries = new es((t => ln(t)), hn), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14098
|
+
this.queries = new es((t => ln(t)), hn), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
|
|
14097
14099
|
this.Ru = new Set;
|
|
14098
14100
|
}
|
|
14099
14101
|
}
|
|
@@ -14165,7 +14167,8 @@ function Wu(t) {
|
|
|
14165
14167
|
* Initial snapshots (e.g. from cache) may not be propagated to the wrapped
|
|
14166
14168
|
* observer. This flag is set to true once we've actually raised an event.
|
|
14167
14169
|
*/
|
|
14168
|
-
this.Vu = !1, this.Su = null, this.onlineState = "Unknown" /* Unknown */ ,
|
|
14170
|
+
this.Vu = !1, this.Su = null, this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
|
|
14171
|
+
this.options = n || {};
|
|
14169
14172
|
}
|
|
14170
14173
|
/**
|
|
14171
14174
|
* Applies the new ViewSnapshot to this listener, raising a user-facing event
|
|
@@ -14176,7 +14179,7 @@ function Wu(t) {
|
|
|
14176
14179
|
if (!this.options.includeMetadataChanges) {
|
|
14177
14180
|
// Remove the metadata only changes.
|
|
14178
14181
|
const e = [];
|
|
14179
|
-
for (const n of t.docChanges) 3 /* Metadata */ !== n.type && e.push(n);
|
|
14182
|
+
for (const n of t.docChanges) 3 /* ChangeType.Metadata */ !== n.type && e.push(n);
|
|
14180
14183
|
t = new Lu(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
|
|
14181
14184
|
/* excludesMetadataChanges= */ !0, t.hasCachedResults);
|
|
14182
14185
|
}
|
|
@@ -14198,10 +14201,10 @@ function Wu(t) {
|
|
|
14198
14201
|
if (!t.fromCache) return !0;
|
|
14199
14202
|
// NOTE: We consider OnlineState.Unknown as online (it should become Offline
|
|
14200
14203
|
// or Online if we wait long enough).
|
|
14201
|
-
const n = "Offline" /* Offline */ !== e;
|
|
14204
|
+
const n = "Offline" /* OnlineState.Offline */ !== e;
|
|
14202
14205
|
// Don't raise the event if we're online, aren't synced yet (checked
|
|
14203
14206
|
// above) and are waiting for a sync.
|
|
14204
|
-
return (!this.options.Nu || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
|
|
14207
|
+
return (!this.options.Nu || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* OnlineState.Offline */ === e);
|
|
14205
14208
|
// Raise data from cache if we have any documents, have cached results before,
|
|
14206
14209
|
// or we are offline.
|
|
14207
14210
|
}
|
|
@@ -14436,7 +14439,7 @@ class tc {
|
|
|
14436
14439
|
// deletes. So we keep this doc at the old limit to compare the updates to.
|
|
14437
14440
|
// Note that this should never get used in a refill (when previousChanges is
|
|
14438
14441
|
// set), because there will only be adds -- no deletes or updates.
|
|
14439
|
-
const u = "F" /* First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null, c = "L" /* Last */ === this.query.limitType && s.size === this.query.limit ? s.first() : null;
|
|
14442
|
+
const u = "F" /* LimitType.First */ === this.query.limitType && s.size === this.query.limit ? s.last() : null, c = "L" /* LimitType.Last */ === this.query.limitType && s.size === this.query.limit ? s.first() : null;
|
|
14440
14443
|
// Drop documents out to meet limit/limitToLast requirement.
|
|
14441
14444
|
if (t.inorderTraversal(((t, e) => {
|
|
14442
14445
|
const a = s.get(t), h = dn(this.query, e) ? e : null, l = !!a && this.mutatedKeys.has(a.key), f = !!h && (h.hasLocalMutations ||
|
|
@@ -14447,10 +14450,10 @@ class tc {
|
|
|
14447
14450
|
// Calculate change
|
|
14448
14451
|
if (a && h) {
|
|
14449
14452
|
a.data.isEqual(h.data) ? l !== f && (n.track({
|
|
14450
|
-
type: 3 /* Metadata */ ,
|
|
14453
|
+
type: 3 /* ChangeType.Metadata */ ,
|
|
14451
14454
|
doc: h
|
|
14452
14455
|
}), d = !0) : this.Hu(a, h) || (n.track({
|
|
14453
|
-
type: 2 /* Modified */ ,
|
|
14456
|
+
type: 2 /* ChangeType.Modified */ ,
|
|
14454
14457
|
doc: h
|
|
14455
14458
|
}), d = !0, (u && this.Gu(h, u) > 0 || c && this.Gu(h, c) < 0) && (
|
|
14456
14459
|
// This doc moved from inside the limit to outside the limit.
|
|
@@ -14458,10 +14461,10 @@ class tc {
|
|
|
14458
14461
|
// that should be included instead.
|
|
14459
14462
|
o = !0));
|
|
14460
14463
|
} else !a && h ? (n.track({
|
|
14461
|
-
type: 0 /* Added */ ,
|
|
14464
|
+
type: 0 /* ChangeType.Added */ ,
|
|
14462
14465
|
doc: h
|
|
14463
14466
|
}), d = !0) : a && !h && (n.track({
|
|
14464
|
-
type: 1 /* Removed */ ,
|
|
14467
|
+
type: 1 /* ChangeType.Removed */ ,
|
|
14465
14468
|
doc: a
|
|
14466
14469
|
}), d = !0, (u || c) && (
|
|
14467
14470
|
// A doc was removed from a full limit query. We'll need to
|
|
@@ -14470,9 +14473,9 @@ class tc {
|
|
|
14470
14473
|
o = !0));
|
|
14471
14474
|
d && (h ? (r = r.add(h), i = f ? i.add(t) : i.delete(t)) : (r = r.delete(t), i = i.delete(t)));
|
|
14472
14475
|
})), null !== this.query.limit) for (;r.size > this.query.limit; ) {
|
|
14473
|
-
const t = "F" /* First */ === this.query.limitType ? r.last() : r.first();
|
|
14476
|
+
const t = "F" /* LimitType.First */ === this.query.limitType ? r.last() : r.first();
|
|
14474
14477
|
r = r.delete(t.key), i = i.delete(t.key), n.track({
|
|
14475
|
-
type: 1 /* Removed */ ,
|
|
14478
|
+
type: 1 /* ChangeType.Removed */ ,
|
|
14476
14479
|
doc: t
|
|
14477
14480
|
});
|
|
14478
14481
|
}
|
|
@@ -14512,17 +14515,17 @@ class tc {
|
|
|
14512
14515
|
i.sort(((t, e) => function(t, e) {
|
|
14513
14516
|
const n = t => {
|
|
14514
14517
|
switch (t) {
|
|
14515
|
-
case 0 /* Added */ :
|
|
14518
|
+
case 0 /* ChangeType.Added */ :
|
|
14516
14519
|
return 1;
|
|
14517
14520
|
|
|
14518
|
-
case 2 /* Modified */ :
|
|
14519
|
-
case 3 /* Metadata */ :
|
|
14521
|
+
case 2 /* ChangeType.Modified */ :
|
|
14522
|
+
case 3 /* ChangeType.Metadata */ :
|
|
14520
14523
|
// A metadata change is converted to a modified change at the public
|
|
14521
14524
|
// api layer. Since we sort by document key and then change type,
|
|
14522
14525
|
// metadata and modified changes must be sorted equivalently.
|
|
14523
14526
|
return 2;
|
|
14524
14527
|
|
|
14525
|
-
case 1 /* Removed */ :
|
|
14528
|
+
case 1 /* ChangeType.Removed */ :
|
|
14526
14529
|
return 0;
|
|
14527
14530
|
|
|
14528
14531
|
default:
|
|
@@ -14547,10 +14550,10 @@ class tc {
|
|
|
14547
14550
|
* See the License for the specific language governing permissions and
|
|
14548
14551
|
* limitations under the License.
|
|
14549
14552
|
*/ (t.type, e.type) || this.Gu(t.doc, e.doc))), this.Ju(n);
|
|
14550
|
-
const r = e ? this.Yu() : [], o = 0 === this.Ku.size && this.current ? 1 /* Synced */ : 0 /* Local */ , u = o !== this.qu;
|
|
14553
|
+
const r = e ? this.Yu() : [], o = 0 === this.Ku.size && this.current ? 1 /* SyncState.Synced */ : 0 /* SyncState.Local */ , u = o !== this.qu;
|
|
14551
14554
|
if (this.qu = o, 0 !== i.length || u) {
|
|
14552
14555
|
return {
|
|
14553
|
-
snapshot: new Lu(this.query, t.Qu, s, i, t.mutatedKeys, 0 /* Local */ === o, u,
|
|
14556
|
+
snapshot: new Lu(this.query, t.Qu, s, i, t.mutatedKeys, 0 /* SyncState.Local */ === o, u,
|
|
14554
14557
|
/* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
|
|
14555
14558
|
Xu: r
|
|
14556
14559
|
};
|
|
@@ -14564,7 +14567,7 @@ class tc {
|
|
|
14564
14567
|
* Applies an OnlineState change to the view, potentially generating a
|
|
14565
14568
|
* ViewChange if the view's syncState changes as a result.
|
|
14566
14569
|
*/ bu(t) {
|
|
14567
|
-
return this.current && "Offline" /* Offline */ === t ? (
|
|
14570
|
+
return this.current && "Offline" /* OnlineState.Offline */ === t ? (
|
|
14568
14571
|
// If we're offline, set `current` to false and then call applyChanges()
|
|
14569
14572
|
// to refresh our syncState and generate a ViewChange as appropriate. We
|
|
14570
14573
|
// are guaranteed to get a new TargetChange that sets `current` back to
|
|
@@ -14643,7 +14646,7 @@ class tc {
|
|
|
14643
14646
|
*/
|
|
14644
14647
|
// PORTING NOTE: Multi-tab only.
|
|
14645
14648
|
ec() {
|
|
14646
|
-
return Lu.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* Local */ === this.qu, this.hasCachedResults);
|
|
14649
|
+
return Lu.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* SyncState.Local */ === this.qu, this.hasCachedResults);
|
|
14647
14650
|
}
|
|
14648
14651
|
}
|
|
14649
14652
|
|
|
@@ -14728,7 +14731,7 @@ class nc {
|
|
|
14728
14731
|
/** Stores user completion handlers, indexed by User and BatchId. */
|
|
14729
14732
|
this.hc = {},
|
|
14730
14733
|
/** Stores user callbacks waiting for all pending writes to be acknowledged. */
|
|
14731
|
-
this.lc = new Map, this.fc = Cr.vn(), this.onlineState = "Unknown" /* Unknown */ ,
|
|
14734
|
+
this.lc = new Map, this.fc = Cr.vn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
|
|
14732
14735
|
// The primary state is set to `true` or `false` immediately after Firestore
|
|
14733
14736
|
// startup. In the interim, a client should only be considered primary if
|
|
14734
14737
|
// `isPrimary` is true.
|
|
@@ -14784,7 +14787,7 @@ async function rc(t, e) {
|
|
|
14784
14787
|
return pc(t, e.targetId, o.Xu), o.snapshot;
|
|
14785
14788
|
}(t, e, n, s);
|
|
14786
14789
|
const r = await Do(t.localStore, e,
|
|
14787
|
-
/* usePreviousResults= */ !0), o = new ec(e, r.Hi), u = o.Wu(r.documents), c = ms.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState, i), a = o.applyChanges(u,
|
|
14790
|
+
/* usePreviousResults= */ !0), o = new ec(e, r.Hi), u = o.Wu(r.documents), c = ms.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* OnlineState.Offline */ !== t.onlineState, i), a = o.applyChanges(u,
|
|
14788
14791
|
/* updateLimboDocuments= */ t.isPrimaryClient, c);
|
|
14789
14792
|
pc(t, n, a.Xu);
|
|
14790
14793
|
const h = new nc(e, n, o);
|
|
@@ -14911,7 +14914,7 @@ async function rc(t, e) {
|
|
|
14911
14914
|
// online state (the local client may go offline, even though the primary
|
|
14912
14915
|
// tab remains online) and only apply the primary tab's online state from
|
|
14913
14916
|
// SharedClientState.
|
|
14914
|
-
if (s.isPrimaryClient && 0 /* RemoteStore */ === n || !s.isPrimaryClient && 1 /* SharedClientState */ === n) {
|
|
14917
|
+
if (s.isPrimaryClient && 0 /* OnlineStateSource.RemoteStore */ === n || !s.isPrimaryClient && 1 /* OnlineStateSource.SharedClientState */ === n) {
|
|
14915
14918
|
const t = [];
|
|
14916
14919
|
s.ic.forEach(((n, s) => {
|
|
14917
14920
|
const i = s.view.bu(e);
|
|
@@ -15102,7 +15105,7 @@ function Ic(t, e) {
|
|
|
15102
15105
|
const e = t.oc.values().next().value;
|
|
15103
15106
|
t.oc.delete(e);
|
|
15104
15107
|
const n = new ct(rt.fromString(e)), s = t.fc.next();
|
|
15105
|
-
t.cc.set(s, new sc(n)), t.uc = t.uc.insert(n, s), hu(t.remoteStore, new Fi(cn(en(n.path)), s, 2 /* LimboResolution */ , Ot.at));
|
|
15108
|
+
t.cc.set(s, new sc(n)), t.uc = t.uc.insert(n, s), hu(t.remoteStore, new Fi(cn(en(n.path)), s, 2 /* TargetPurpose.LimboResolution */ , Ot.at));
|
|
15106
15109
|
}
|
|
15107
15110
|
}
|
|
15108
15111
|
|
|
@@ -15311,7 +15314,7 @@ async function Sc(t, e, n) {
|
|
|
15311
15314
|
*/
|
|
15312
15315
|
// PORTING NOTE: Multi-Tab only.
|
|
15313
15316
|
function Dc(t) {
|
|
15314
|
-
return tn(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
|
|
15317
|
+
return tn(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* LimitType.First */ , t.startAt, t.endAt);
|
|
15315
15318
|
}
|
|
15316
15319
|
|
|
15317
15320
|
/** Returns the IDs of the clients that are currently active. */
|
|
@@ -15574,7 +15577,7 @@ class Fc {
|
|
|
15574
15577
|
this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
|
|
15575
15578
|
this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
|
|
15576
15579
|
this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
|
|
15577
|
-
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => hc(this.syncEngine, t, 1 /* SharedClientState */),
|
|
15580
|
+
/* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => hc(this.syncEngine, t, 1 /* OnlineStateSource.SharedClientState */),
|
|
15578
15581
|
this.remoteStore.remoteSyncer.handleCredentialChange = Ac.bind(null, this.syncEngine),
|
|
15579
15582
|
await Nu(this.remoteStore, this.syncEngine.isPrimaryClient));
|
|
15580
15583
|
}
|
|
@@ -15589,7 +15592,7 @@ class Fc {
|
|
|
15589
15592
|
}(t.authCredentials, t.appCheckCredentials, n, e);
|
|
15590
15593
|
}
|
|
15591
15594
|
createRemoteStore(t) {
|
|
15592
|
-
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => hc(this.syncEngine, t, 0 /* RemoteStore */),
|
|
15595
|
+
return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => hc(this.syncEngine, t, 0 /* OnlineStateSource.RemoteStore */),
|
|
15593
15596
|
r = Wo.C() ? new Wo : new jo, new uu(e, n, s, i, r);
|
|
15594
15597
|
var e, n, s, i, r;
|
|
15595
15598
|
/** Re-enables the network. Idempotent. */ }
|
|
@@ -15604,11 +15607,11 @@ class Fc {
|
|
|
15604
15607
|
terminate() {
|
|
15605
15608
|
return async function(t) {
|
|
15606
15609
|
const e = $(t);
|
|
15607
|
-
C("RemoteStore", "RemoteStore shutting down."), e._u.add(5 /* Shutdown */),
|
|
15608
|
-
e.mu.shutdown(),
|
|
15610
|
+
C("RemoteStore", "RemoteStore shutting down."), e._u.add(5 /* OfflineCause.Shutdown */),
|
|
15611
|
+
await au(e), e.mu.shutdown(),
|
|
15609
15612
|
// Set the OnlineState to Unknown (rather than Offline) to avoid potentially
|
|
15610
15613
|
// triggering spurious listener events with cached data, etc.
|
|
15611
|
-
e.gu.set("Unknown" /* Unknown */);
|
|
15614
|
+
e.gu.set("Unknown" /* OnlineState.Unknown */);
|
|
15612
15615
|
}(this.remoteStore);
|
|
15613
15616
|
}
|
|
15614
15617
|
}
|
|
@@ -16548,7 +16551,7 @@ class aa {
|
|
|
16548
16551
|
*/ class da {
|
|
16549
16552
|
constructor(t, e, n, s, i) {
|
|
16550
16553
|
this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = s,
|
|
16551
|
-
this.deferred = i, this.kc = n.maxAttempts, this.xo = new tu(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
|
|
16554
|
+
this.deferred = i, this.kc = n.maxAttempts, this.xo = new tu(this.asyncQueue, "transaction_retry" /* TimerId.TransactionRetry */);
|
|
16552
16555
|
}
|
|
16553
16556
|
/** Runs the transaction and sets the result on deferred. */ run() {
|
|
16554
16557
|
this.kc -= 1, this.Oc();
|
|
@@ -16739,7 +16742,7 @@ async function Ra(t) {
|
|
|
16739
16742
|
const e = await pa(t), n = await Ta(t);
|
|
16740
16743
|
return e.setNetworkEnabled(!0), function(t) {
|
|
16741
16744
|
const e = $(t);
|
|
16742
|
-
return e._u.delete(0 /* UserDisabled */), cu(e);
|
|
16745
|
+
return e._u.delete(0 /* OfflineCause.UserDisabled */), cu(e);
|
|
16743
16746
|
}(n);
|
|
16744
16747
|
}));
|
|
16745
16748
|
}
|
|
@@ -16749,9 +16752,9 @@ async function Ra(t) {
|
|
|
16749
16752
|
const e = await pa(t), n = await Ta(t);
|
|
16750
16753
|
return e.setNetworkEnabled(!1), async function(t) {
|
|
16751
16754
|
const e = $(t);
|
|
16752
|
-
e._u.add(0 /* UserDisabled */), await au(e),
|
|
16755
|
+
e._u.add(0 /* OfflineCause.UserDisabled */), await au(e),
|
|
16753
16756
|
// Set the OnlineState to Offline so get()s return from cache, etc.
|
|
16754
|
-
e.gu.set("Offline" /* Offline */);
|
|
16757
|
+
e.gu.set("Offline" /* OnlineState.Offline */);
|
|
16755
16758
|
}(n);
|
|
16756
16759
|
}));
|
|
16757
16760
|
}
|
|
@@ -16937,7 +16940,7 @@ class ka {
|
|
|
16937
16940
|
// List of TimerIds to fast-forward delays for.
|
|
16938
16941
|
this.jc = [],
|
|
16939
16942
|
// Backoff timer used to schedule retries for retryable operations
|
|
16940
|
-
this.xo = new tu(this, "async_queue_retry" /* AsyncQueueRetry */),
|
|
16943
|
+
this.xo = new tu(this, "async_queue_retry" /* TimerId.AsyncQueueRetry */),
|
|
16941
16944
|
// Visibility handler that triggers an immediate retry of all retryable
|
|
16942
16945
|
// operations. Meant to speed up recovery when we regain file system access
|
|
16943
16946
|
// after page comes into foreground.
|
|
@@ -17089,7 +17092,7 @@ class ka {
|
|
|
17089
17092
|
return this.Xc().then((() => {
|
|
17090
17093
|
// Run ops in the same order they'd run if they ran naturally.
|
|
17091
17094
|
this.qc.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
|
|
17092
|
-
for (const e of this.qc) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
|
|
17095
|
+
for (const e of this.qc) if (e.skipDelay(), "all" /* TimerId.All */ !== t && e.timerId === t) break;
|
|
17093
17096
|
return this.Xc();
|
|
17094
17097
|
}));
|
|
17095
17098
|
}
|
|
@@ -17863,15 +17866,15 @@ class th {
|
|
|
17863
17866
|
|
|
17864
17867
|
function ch(t) {
|
|
17865
17868
|
switch (t) {
|
|
17866
|
-
case 0 /* Set */ :
|
|
17869
|
+
case 0 /* UserDataSource.Set */ :
|
|
17867
17870
|
// fall through
|
|
17868
|
-
case 2 /* MergeSet */ :
|
|
17871
|
+
case 2 /* UserDataSource.MergeSet */ :
|
|
17869
17872
|
// fall through
|
|
17870
|
-
case 1 /* Update */ :
|
|
17873
|
+
case 1 /* UserDataSource.Update */ :
|
|
17871
17874
|
return !0;
|
|
17872
17875
|
|
|
17873
|
-
case 3 /* Argument */ :
|
|
17874
|
-
case 4 /* ArrayArgument */ :
|
|
17876
|
+
case 3 /* UserDataSource.Argument */ :
|
|
17877
|
+
case 4 /* UserDataSource.ArrayArgument */ :
|
|
17875
17878
|
return !1;
|
|
17876
17879
|
|
|
17877
17880
|
default:
|
|
@@ -17979,7 +17982,7 @@ function lh(t) {
|
|
|
17979
17982
|
}
|
|
17980
17983
|
|
|
17981
17984
|
/** Parse document data from a set() call. */ function fh(t, e, n, s, i, r = {}) {
|
|
17982
|
-
const o = t.da(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
|
|
17985
|
+
const o = t.da(r.merge || r.mergeFields ? 2 /* UserDataSource.MergeSet */ : 0 /* UserDataSource.Set */ , e, n, i);
|
|
17983
17986
|
bh("Data must be an object, but it was:", o, s);
|
|
17984
17987
|
const u = Ah(s, o);
|
|
17985
17988
|
let c, a;
|
|
@@ -17997,7 +18000,7 @@ function lh(t) {
|
|
|
17997
18000
|
|
|
17998
18001
|
class dh extends sh {
|
|
17999
18002
|
_toFieldTransform(t) {
|
|
18000
|
-
if (2 /* MergeSet */ !== t.sa) throw 1 /* Update */ === t.sa ? t.ha(`${this._methodName}() can only appear at the top level of your update data`) : t.ha(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
18003
|
+
if (2 /* UserDataSource.MergeSet */ !== t.sa) throw 1 /* UserDataSource.Update */ === t.sa ? t.ha(`${this._methodName}() can only appear at the top level of your update data`) : t.ha(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
|
|
18001
18004
|
// No transform to add for a delete, but we need to add it to our
|
|
18002
18005
|
// fieldMask so it gets deleted.
|
|
18003
18006
|
return t.fieldMask.push(t.path), null;
|
|
@@ -18024,7 +18027,7 @@ class dh extends sh {
|
|
|
18024
18027
|
* @param arrayElement - Whether or not the FieldValue has an array.
|
|
18025
18028
|
*/ function _h(t, e, n) {
|
|
18026
18029
|
return new ah({
|
|
18027
|
-
sa: 3 /* Argument */ ,
|
|
18030
|
+
sa: 3 /* UserDataSource.Argument */ ,
|
|
18028
18031
|
fa: e.settings.fa,
|
|
18029
18032
|
methodName: t._methodName,
|
|
18030
18033
|
oa: n
|
|
@@ -18085,7 +18088,7 @@ class yh extends sh {
|
|
|
18085
18088
|
}
|
|
18086
18089
|
|
|
18087
18090
|
/** Parse update data from an update() call. */ function ph(t, e, n, s) {
|
|
18088
|
-
const i = t.da(1 /* Update */ , e, n);
|
|
18091
|
+
const i = t.da(1 /* UserDataSource.Update */ , e, n);
|
|
18089
18092
|
bh("Data must be an object, but it was:", i, s);
|
|
18090
18093
|
const r = [], o = ve.empty();
|
|
18091
18094
|
Ft(s, ((t, s) => {
|
|
@@ -18106,7 +18109,7 @@ class yh extends sh {
|
|
|
18106
18109
|
}
|
|
18107
18110
|
|
|
18108
18111
|
/** Parse update data from a list of field/value arguments. */ function Ih(t, e, n, s, i, r) {
|
|
18109
|
-
const o = t.da(1 /* Update */ , e, n), u = [ Ph(e, s, n) ], c = [ i ];
|
|
18112
|
+
const o = t.da(1 /* UserDataSource.Update */ , e, n), u = [ Ph(e, s, n) ], c = [ i ];
|
|
18110
18113
|
if (r.length % 2 != 0) throw new L(B.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
|
|
18111
18114
|
for (let t = 0; t < r.length; t += 2) u.push(Ph(e, r[t])), c.push(r[t + 1]);
|
|
18112
18115
|
const a = [], h = ve.empty();
|
|
@@ -18137,7 +18140,7 @@ class yh extends sh {
|
|
|
18137
18140
|
* @param allowArrays - Whether the query value is an array that may directly
|
|
18138
18141
|
* contain additional arrays (e.g. the operand of an `in` query).
|
|
18139
18142
|
*/ function Th(t, e, n, s = !1) {
|
|
18140
|
-
return Eh(n, t.da(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
|
|
18143
|
+
return Eh(n, t.da(s ? 4 /* UserDataSource.ArrayArgument */ : 3 /* UserDataSource.Argument */ , e));
|
|
18141
18144
|
}
|
|
18142
18145
|
|
|
18143
18146
|
/**
|
|
@@ -18190,7 +18193,7 @@ class yh extends sh {
|
|
|
18190
18193
|
// the set of values to be included for the IN query) that may directly
|
|
18191
18194
|
// contain additional arrays (each representing an individual field
|
|
18192
18195
|
// value), so we disable this validation.
|
|
18193
|
-
if (e.settings.oa && 4 /* ArrayArgument */ !== e.sa) throw e.ha("Nested arrays are not supported");
|
|
18196
|
+
if (e.settings.oa && 4 /* UserDataSource.ArrayArgument */ !== e.sa) throw e.ha("Nested arrays are not supported");
|
|
18194
18197
|
return function(t, e) {
|
|
18195
18198
|
const n = [];
|
|
18196
18199
|
let s = 0;
|
|
@@ -18472,7 +18475,7 @@ function Sh(t, e, n, s, i) {
|
|
|
18472
18475
|
* See the License for the specific language governing permissions and
|
|
18473
18476
|
* limitations under the License.
|
|
18474
18477
|
*/ function kh(t) {
|
|
18475
|
-
if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new L(B.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
18478
|
+
if ("L" /* LimitType.Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new L(B.UNIMPLEMENTED, "limitToLast() queries require specifying at least one orderBy() clause");
|
|
18476
18479
|
}
|
|
18477
18480
|
|
|
18478
18481
|
/**
|
|
@@ -18505,8 +18508,8 @@ class Fh extends Oh {
|
|
|
18505
18508
|
const e = lh(t.firestore), n = function(t, e, n, s, i, r, o) {
|
|
18506
18509
|
let u;
|
|
18507
18510
|
if (i.isKeyField()) {
|
|
18508
|
-
if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new L(B.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`);
|
|
18509
|
-
if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
|
|
18511
|
+
if ("array-contains" /* Operator.ARRAY_CONTAINS */ === r || "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ === r) throw new L(B.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on documentId().`);
|
|
18512
|
+
if ("in" /* Operator.IN */ === r || "not-in" /* Operator.NOT_IN */ === r) {
|
|
18510
18513
|
Xh(o, r);
|
|
18511
18514
|
const e = [];
|
|
18512
18515
|
for (const n of o) e.push(Yh(s, t, n));
|
|
@@ -18516,9 +18519,9 @@ class Fh extends Oh {
|
|
|
18516
18519
|
}
|
|
18517
18520
|
};
|
|
18518
18521
|
} else u = Yh(s, t, o);
|
|
18519
|
-
} else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || Xh(o, r),
|
|
18522
|
+
} else "in" /* Operator.IN */ !== r && "not-in" /* Operator.NOT_IN */ !== r && "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ !== r || Xh(o, r),
|
|
18520
18523
|
u = Th(n, e, o,
|
|
18521
|
-
/* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
|
|
18524
|
+
/* allowArrays= */ "in" /* Operator.IN */ === r || "not-in" /* Operator.NOT_IN */ === r);
|
|
18522
18525
|
const c = Be.create(i, r, u);
|
|
18523
18526
|
return function(t, e) {
|
|
18524
18527
|
if (e.dt()) {
|
|
@@ -18545,20 +18548,20 @@ class Fh extends Oh {
|
|
|
18545
18548
|
*/
|
|
18546
18549
|
function(t) {
|
|
18547
18550
|
switch (t) {
|
|
18548
|
-
case "!=" /* NOT_EQUAL */ :
|
|
18549
|
-
return [ "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ];
|
|
18551
|
+
case "!=" /* Operator.NOT_EQUAL */ :
|
|
18552
|
+
return [ "!=" /* Operator.NOT_EQUAL */ , "not-in" /* Operator.NOT_IN */ ];
|
|
18550
18553
|
|
|
18551
|
-
case "array-contains" /* ARRAY_CONTAINS */ :
|
|
18552
|
-
return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "not-in" /* NOT_IN */ ];
|
|
18554
|
+
case "array-contains" /* Operator.ARRAY_CONTAINS */ :
|
|
18555
|
+
return [ "array-contains" /* Operator.ARRAY_CONTAINS */ , "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , "not-in" /* Operator.NOT_IN */ ];
|
|
18553
18556
|
|
|
18554
|
-
case "in" /* IN */ :
|
|
18555
|
-
return [ "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ ];
|
|
18557
|
+
case "in" /* Operator.IN */ :
|
|
18558
|
+
return [ "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , "in" /* Operator.IN */ , "not-in" /* Operator.NOT_IN */ ];
|
|
18556
18559
|
|
|
18557
|
-
case "array-contains-any" /* ARRAY_CONTAINS_ANY */ :
|
|
18558
|
-
return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ ];
|
|
18560
|
+
case "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ :
|
|
18561
|
+
return [ "array-contains" /* Operator.ARRAY_CONTAINS */ , "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , "in" /* Operator.IN */ , "not-in" /* Operator.NOT_IN */ ];
|
|
18559
18562
|
|
|
18560
|
-
case "not-in" /* NOT_IN */ :
|
|
18561
|
-
return [ "array-contains" /* ARRAY_CONTAINS */ , "array-contains-any" /* ARRAY_CONTAINS_ANY */ , "in" /* IN */ , "not-in" /* NOT_IN */ , "!=" /* NOT_EQUAL */ ];
|
|
18563
|
+
case "not-in" /* Operator.NOT_IN */ :
|
|
18564
|
+
return [ "array-contains" /* Operator.ARRAY_CONTAINS */ , "array-contains-any" /* Operator.ARRAY_CONTAINS_ANY */ , "in" /* Operator.IN */ , "not-in" /* Operator.NOT_IN */ , "!=" /* Operator.NOT_EQUAL */ ];
|
|
18562
18565
|
|
|
18563
18566
|
default:
|
|
18564
18567
|
return [];
|
|
@@ -18655,7 +18658,7 @@ class Uh extends Oh {
|
|
|
18655
18658
|
* @param limit - The maximum number of items to return.
|
|
18656
18659
|
* @returns The created {@link Query}.
|
|
18657
18660
|
*/ function qh(t) {
|
|
18658
|
-
return Wc("limit", t), new Uh("limit", t, "F" /* First */);
|
|
18661
|
+
return Wc("limit", t), new Uh("limit", t, "F" /* LimitType.First */);
|
|
18659
18662
|
}
|
|
18660
18663
|
|
|
18661
18664
|
/**
|
|
@@ -18667,7 +18670,7 @@ class Uh extends Oh {
|
|
|
18667
18670
|
* @param limit - The maximum number of items to return.
|
|
18668
18671
|
* @returns The created {@link Query}.
|
|
18669
18672
|
*/ function Kh(t) {
|
|
18670
|
-
return Wc("limitToLast", t), new Uh("limitToLast", t, "L" /* Last */);
|
|
18673
|
+
return Wc("limitToLast", t), new Uh("limitToLast", t, "L" /* LimitType.Last */);
|
|
18671
18674
|
}
|
|
18672
18675
|
|
|
18673
18676
|
class Gh extends Oh {
|
|
@@ -18817,37 +18820,37 @@ function Zh(t, e, n) {
|
|
|
18817
18820
|
*/ class tl {
|
|
18818
18821
|
convertValue(t, e = "none") {
|
|
18819
18822
|
switch (ce(t)) {
|
|
18820
|
-
case 0 /* NullValue */ :
|
|
18823
|
+
case 0 /* TypeOrder.NullValue */ :
|
|
18821
18824
|
return null;
|
|
18822
18825
|
|
|
18823
|
-
case 1 /* BooleanValue */ :
|
|
18826
|
+
case 1 /* TypeOrder.BooleanValue */ :
|
|
18824
18827
|
return t.booleanValue;
|
|
18825
18828
|
|
|
18826
|
-
case 2 /* NumberValue */ :
|
|
18829
|
+
case 2 /* TypeOrder.NumberValue */ :
|
|
18827
18830
|
return Jt(t.integerValue || t.doubleValue);
|
|
18828
18831
|
|
|
18829
|
-
case 3 /* TimestampValue */ :
|
|
18832
|
+
case 3 /* TypeOrder.TimestampValue */ :
|
|
18830
18833
|
return this.convertTimestamp(t.timestampValue);
|
|
18831
18834
|
|
|
18832
|
-
case 4 /* ServerTimestampValue */ :
|
|
18835
|
+
case 4 /* TypeOrder.ServerTimestampValue */ :
|
|
18833
18836
|
return this.convertServerTimestamp(t, e);
|
|
18834
18837
|
|
|
18835
|
-
case 5 /* StringValue */ :
|
|
18838
|
+
case 5 /* TypeOrder.StringValue */ :
|
|
18836
18839
|
return t.stringValue;
|
|
18837
18840
|
|
|
18838
|
-
case 6 /* BlobValue */ :
|
|
18841
|
+
case 6 /* TypeOrder.BlobValue */ :
|
|
18839
18842
|
return this.convertBytes(Yt(t.bytesValue));
|
|
18840
18843
|
|
|
18841
|
-
case 7 /* RefValue */ :
|
|
18844
|
+
case 7 /* TypeOrder.RefValue */ :
|
|
18842
18845
|
return this.convertReference(t.referenceValue);
|
|
18843
18846
|
|
|
18844
|
-
case 8 /* GeoPointValue */ :
|
|
18847
|
+
case 8 /* TypeOrder.GeoPointValue */ :
|
|
18845
18848
|
return this.convertGeoPoint(t.geoPointValue);
|
|
18846
18849
|
|
|
18847
|
-
case 9 /* ArrayValue */ :
|
|
18850
|
+
case 9 /* TypeOrder.ArrayValue */ :
|
|
18848
18851
|
return this.convertArray(t.arrayValue, e);
|
|
18849
18852
|
|
|
18850
|
-
case 10 /* ObjectValue */ :
|
|
18853
|
+
case 10 /* TypeOrder.ObjectValue */ :
|
|
18851
18854
|
return this.convertObject(t.mapValue, e);
|
|
18852
18855
|
|
|
18853
18856
|
default:
|
|
@@ -19134,11 +19137,12 @@ class nl extends tl {
|
|
|
19134
19137
|
// A `DocumentSet` that is updated incrementally as changes are applied to use
|
|
19135
19138
|
// to lookup the index of a document.
|
|
19136
19139
|
let n = t._snapshot.oldDocs;
|
|
19137
|
-
return t._snapshot.docChanges.filter((t => e || 3 /* Metadata */ !== t.type)).map((e => {
|
|
19140
|
+
return t._snapshot.docChanges.filter((t => e || 3 /* ChangeType.Metadata */ !== t.type)).map((e => {
|
|
19138
19141
|
const s = new rl(t._firestore, t._userDataWriter, e.doc.key, e.doc, new sl(t._snapshot.mutatedKeys.has(e.doc.key), t._snapshot.fromCache), t.query.converter);
|
|
19139
19142
|
let i = -1, r = -1;
|
|
19140
|
-
return 0 /* Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
19141
|
-
1 /* Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)),
|
|
19143
|
+
return 0 /* ChangeType.Added */ !== e.type && (i = n.indexOf(e.doc.key), n = n.delete(e.doc.key)),
|
|
19144
|
+
1 /* ChangeType.Removed */ !== e.type && (n = n.add(e.doc), r = n.indexOf(e.doc.key)),
|
|
19145
|
+
{
|
|
19142
19146
|
type: ul(e.type),
|
|
19143
19147
|
doc: s,
|
|
19144
19148
|
oldIndex: i,
|
|
@@ -19152,14 +19156,14 @@ class nl extends tl {
|
|
|
19152
19156
|
|
|
19153
19157
|
function ul(t) {
|
|
19154
19158
|
switch (t) {
|
|
19155
|
-
case 0 /* Added */ :
|
|
19159
|
+
case 0 /* ChangeType.Added */ :
|
|
19156
19160
|
return "added";
|
|
19157
19161
|
|
|
19158
|
-
case 2 /* Modified */ :
|
|
19159
|
-
case 3 /* Metadata */ :
|
|
19162
|
+
case 2 /* ChangeType.Modified */ :
|
|
19163
|
+
case 3 /* ChangeType.Metadata */ :
|
|
19160
19164
|
return "modified";
|
|
19161
19165
|
|
|
19162
|
-
case 1 /* Removed */ :
|
|
19166
|
+
case 1 /* ChangeType.Removed */ :
|
|
19163
19167
|
return "removed";
|
|
19164
19168
|
|
|
19165
19169
|
default:
|
|
@@ -19860,18 +19864,17 @@ class Sl extends class {
|
|
|
19860
19864
|
Promise.resolve();
|
|
19861
19865
|
const i = function(t) {
|
|
19862
19866
|
const e = "string" == typeof t ? function(t) {
|
|
19863
|
-
var e;
|
|
19864
19867
|
try {
|
|
19865
19868
|
return JSON.parse(t);
|
|
19866
19869
|
} catch (t) {
|
|
19867
|
-
throw new L(B.INVALID_ARGUMENT, "Failed to parse JSON: " + (null
|
|
19870
|
+
throw new L(B.INVALID_ARGUMENT, "Failed to parse JSON: " + (null == t ? void 0 : t.message));
|
|
19868
19871
|
}
|
|
19869
19872
|
}(t) : t, n = [];
|
|
19870
19873
|
if (Array.isArray(e.indexes)) for (const t of e.indexes) {
|
|
19871
19874
|
const e = $l(t, "collectionGroup"), s = [];
|
|
19872
19875
|
if (Array.isArray(t.fields)) for (const e of t.fields) {
|
|
19873
19876
|
const t = Vh("setIndexConfiguration", $l(e, "fieldPath"));
|
|
19874
|
-
"CONTAINS" === e.arrayConfig ? s.push(new dt(t, 2 /* CONTAINS */)) : "ASCENDING" === e.order ? s.push(new dt(t, 0 /* ASCENDING */)) : "DESCENDING" === e.order && s.push(new dt(t, 1 /* DESCENDING */));
|
|
19877
|
+
"CONTAINS" === e.arrayConfig ? s.push(new dt(t, 2 /* IndexKind.CONTAINS */)) : "ASCENDING" === e.order ? s.push(new dt(t, 0 /* IndexKind.ASCENDING */)) : "DESCENDING" === e.order && s.push(new dt(t, 1 /* IndexKind.DESCENDING */));
|
|
19875
19878
|
}
|
|
19876
19879
|
n.push(new at(at.UNKNOWN_ID, e, s, wt.empty()));
|
|
19877
19880
|
}
|
|
@@ -19959,9 +19962,9 @@ function $l(t, e) {
|
|
|
19959
19962
|
return s = Object.assign({
|
|
19960
19963
|
useFetchStreams: e
|
|
19961
19964
|
}, s), r._setSettings(s), r;
|
|
19962
|
-
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.7.3-canary.
|
|
19965
|
+
}), "PUBLIC").setMultipleInstances(!0)), registerVersion(b, "3.7.3-canary.ab3f16cba", t),
|
|
19963
19966
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
19964
|
-
registerVersion(b, "3.7.3-canary.
|
|
19967
|
+
registerVersion(b, "3.7.3-canary.ab3f16cba", "esm2017");
|
|
19965
19968
|
}();
|
|
19966
19969
|
|
|
19967
19970
|
export { tl as AbstractUserDataWriter, aa as AggregateField, ha as AggregateQuerySnapshot, th as Bytes, Fa as CACHE_SIZE_UNLIMITED, ta as CollectionReference, Xc as DocumentReference, il as DocumentSnapshot, eh as FieldPath, sh as FieldValue, $a as Firestore, L as FirestoreError, ih as GeoPoint, Ma as LoadBundleTask, Zc as Query, Oh as QueryConstraint, rl as QueryDocumentSnapshot, ol as QuerySnapshot, sl as SnapshotMetadata, nt as Timestamp, Sl as Transaction, vl as WriteBatch, ne as _DatabaseId, ct as _DocumentKey, J as _EmptyAppCheckTokenProvider, K as _EmptyAuthCredentialsProvider, ut as _FieldPath, jc as _cast, F as _debugAssert, jt as _isBase64Available, N as _logWarn, qc as _validateIsNotUsedTogether, pl as addDoc, Rl as aggregateQuerySnapshotEqual, kl as arrayRemove, Nl as arrayUnion, ja as clearIndexedDbPersistence, ea as collection, na as collectionGroup, Yc as connectFirestoreEmulator, yl as deleteDoc, Cl as deleteField, Ha as disableNetwork, sa as doc, nh as documentId, Ka as enableIndexedDbPersistence, Ga as enableMultiTabIndexedDbPersistence, za as enableNetwork, Hh as endAt, zh as endBefore, Ua as ensureFirestoreConfigured, El as executeWrite, bl as getCountFromServer, al as getDoc, ll as getDocFromCache, fl as getDocFromServer, dl as getDocs, _l as getDocsFromCache, wl as getDocsFromServer, La as getFirestore, Ol as increment, Ba as initializeFirestore, qh as limit, Kh as limitToLast, Ya as loadBundle, Xa as namedQuery, Il as onSnapshot, Tl as onSnapshotsInSync, Lh as orderBy, Mh as query, ra as queryEqual, ia as refEqual, Dl as runTransaction, xl as serverTimestamp, ml as setDoc, Fl as setIndexConfiguration, D as setLogLevel, cl as snapshotEqual, jh as startAfter, Qh as startAt, Ja as terminate, gl as updateDoc, Wa as waitForPendingWrites, $h as where, Ml as writeBatch };
|