@firebase/firestore 3.4.8-canary.aa41fd662 → 3.4.8-canary.d8be8bf1c

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.
Files changed (35) hide show
  1. package/dist/firestore/src/core/target.d.ts +4 -4
  2. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  3. package/dist/firestore/src/model/values.d.ts +14 -2
  4. package/dist/index.esm2017.js +1278 -1261
  5. package/dist/index.esm2017.js.map +1 -1
  6. package/dist/index.esm5.js +2298 -2282
  7. package/dist/index.esm5.js.map +1 -1
  8. package/dist/index.node.cjs.js +46 -55
  9. package/dist/index.node.cjs.js.map +1 -1
  10. package/dist/index.node.mjs +46 -55
  11. package/dist/index.node.mjs.map +1 -1
  12. package/dist/index.rn.js +1315 -1298
  13. package/dist/index.rn.js.map +1 -1
  14. package/dist/lite/firestore/src/core/target.d.ts +4 -4
  15. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  16. package/dist/lite/firestore/src/model/values.d.ts +14 -2
  17. package/dist/lite/index.browser.esm2017.js +509 -499
  18. package/dist/lite/index.browser.esm2017.js.map +1 -1
  19. package/dist/lite/index.browser.esm5.js +547 -537
  20. package/dist/lite/index.browser.esm5.js.map +1 -1
  21. package/dist/lite/index.node.cjs.js +21 -5
  22. package/dist/lite/index.node.cjs.js.map +1 -1
  23. package/dist/lite/index.node.mjs +21 -5
  24. package/dist/lite/index.node.mjs.map +1 -1
  25. package/dist/lite/index.rn.esm2017.js +1216 -1206
  26. package/dist/lite/index.rn.esm2017.js.map +1 -1
  27. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +97 -97
  28. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -4
  29. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  30. package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
  31. package/dist/packages/firestore/dist/index.esm2017.d.ts +50 -50
  32. package/dist/packages/firestore/src/core/target.d.ts +4 -4
  33. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  34. package/dist/packages/firestore/src/model/values.d.ts +14 -2
  35. package/package.json +9 -9
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
33
33
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
34
34
 
35
35
  const name = "@firebase/firestore";
36
- const version$1 = "3.4.8-canary.aa41fd662";
36
+ const version$1 = "3.4.8-canary.d8be8bf1c";
37
37
 
38
38
  /**
39
39
  * @license
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
86
86
  User.FIRST_PARTY = new User('first-party-uid');
87
87
  User.MOCK_USER = new User('mock-user');
88
88
 
89
- const version = "9.6.11-canary.aa41fd662";
89
+ const version = "9.6.11-canary.d8be8bf1c";
90
90
 
91
91
  /**
92
92
  * @license
@@ -3346,7 +3346,7 @@ function typeOrder(value) {
3346
3346
  return 4 /* ServerTimestampValue */;
3347
3347
  }
3348
3348
  else if (isMaxValue(value)) {
3349
- return 9 /* ArrayValue */;
3349
+ return 9007199254740991 /* MaxValue */;
3350
3350
  }
3351
3351
  return 10 /* ObjectValue */;
3352
3352
  }
@@ -3558,6 +3558,15 @@ function compareArrays(left, right) {
3558
3558
  return primitiveComparator(leftArray.length, rightArray.length);
3559
3559
  }
3560
3560
  function compareMaps(left, right) {
3561
+ if (left === MAX_VALUE.mapValue && right === MAX_VALUE.mapValue) {
3562
+ return 0;
3563
+ }
3564
+ else if (left === MAX_VALUE.mapValue) {
3565
+ return 1;
3566
+ }
3567
+ else if (right === MAX_VALUE.mapValue) {
3568
+ return -1;
3569
+ }
3561
3570
  const leftMap = left.fields || {};
3562
3571
  const leftKeys = Object.keys(leftMap);
3563
3572
  const rightMap = right.fields || {};
@@ -3805,27 +3814,31 @@ function valuesGetUpperBound(value) {
3805
3814
  return fail();
3806
3815
  }
3807
3816
  }
3808
- function valuesMax(left, right) {
3809
- if (left === undefined) {
3810
- return right;
3817
+ function lowerBoundCompare(left, right) {
3818
+ const cmp = valueCompare(left.value, right.value);
3819
+ if (cmp !== 0) {
3820
+ return cmp;
3811
3821
  }
3812
- else if (right === undefined) {
3813
- return left;
3822
+ if (left.inclusive && !right.inclusive) {
3823
+ return -1;
3814
3824
  }
3815
- else {
3816
- return valueCompare(left, right) > 0 ? left : right;
3825
+ else if (!left.inclusive && right.inclusive) {
3826
+ return 1;
3817
3827
  }
3828
+ return 0;
3818
3829
  }
3819
- function valuesMin(left, right) {
3820
- if (left === undefined) {
3821
- return right;
3830
+ function upperBoundCompare(left, right) {
3831
+ const cmp = valueCompare(left.value, right.value);
3832
+ if (cmp !== 0) {
3833
+ return cmp;
3822
3834
  }
3823
- else if (right === undefined) {
3824
- return left;
3835
+ if (left.inclusive && !right.inclusive) {
3836
+ return 1;
3825
3837
  }
3826
- else {
3827
- return valueCompare(left, right) < 0 ? left : right;
3838
+ else if (!left.inclusive && right.inclusive) {
3839
+ return -1;
3828
3840
  }
3841
+ return 0;
3829
3842
  }
3830
3843
 
3831
3844
  /**
@@ -5209,7 +5222,7 @@ function targetGetNotInValues(target, fieldIndex) {
5209
5222
  }
5210
5223
  /**
5211
5224
  * Returns a lower bound of field values that can be used as a starting point to
5212
- * scan the index defined by `fieldIndex`. Returns `null` if no lower bound
5225
+ * scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound
5213
5226
  * exists.
5214
5227
  */
5215
5228
  function targetGetLowerBound(target, fieldIndex) {
@@ -5221,10 +5234,6 @@ function targetGetLowerBound(target, fieldIndex) {
5221
5234
  const segmentBound = segment.kind === 0 /* ASCENDING */
5222
5235
  ? targetGetAscendingBound(target, segment.fieldPath, target.startAt)
5223
5236
  : targetGetDescendingBound(target, segment.fieldPath, target.startAt);
5224
- if (!segmentBound.value) {
5225
- // No lower bound exists
5226
- return null;
5227
- }
5228
5237
  values.push(segmentBound.value);
5229
5238
  inclusive && (inclusive = segmentBound.inclusive);
5230
5239
  }
@@ -5232,7 +5241,7 @@ function targetGetLowerBound(target, fieldIndex) {
5232
5241
  }
5233
5242
  /**
5234
5243
  * Returns an upper bound of field values that can be used as an ending point
5235
- * when scanning the index defined by `fieldIndex`. Returns `null` if no
5244
+ * when scanning the index defined by `fieldIndex`. Returns `MAX_VALUE` if no
5236
5245
  * upper bound exists.
5237
5246
  */
5238
5247
  function targetGetUpperBound(target, fieldIndex) {
@@ -5244,10 +5253,6 @@ function targetGetUpperBound(target, fieldIndex) {
5244
5253
  const segmentBound = segment.kind === 0 /* ASCENDING */
5245
5254
  ? targetGetDescendingBound(target, segment.fieldPath, target.endAt)
5246
5255
  : targetGetAscendingBound(target, segment.fieldPath, target.endAt);
5247
- if (!segmentBound.value) {
5248
- // No upper bound exists
5249
- return null;
5250
- }
5251
5256
  values.push(segmentBound.value);
5252
5257
  inclusive && (inclusive = segmentBound.inclusive);
5253
5258
  }
@@ -5258,11 +5263,11 @@ function targetGetUpperBound(target, fieldIndex) {
5258
5263
  * the provided `fieldPath` (or the upper bound for an descending segment).
5259
5264
  */
5260
5265
  function targetGetAscendingBound(target, fieldPath, bound) {
5261
- let value = undefined;
5266
+ let value = MIN_VALUE;
5262
5267
  let inclusive = true;
5263
5268
  // Process all filters to find a value for the current field segment
5264
5269
  for (const fieldFilter of targetGetFieldFiltersForPath(target, fieldPath)) {
5265
- let filterValue = undefined;
5270
+ let filterValue = MIN_VALUE;
5266
5271
  let filterInclusive = true;
5267
5272
  switch (fieldFilter.op) {
5268
5273
  case "<" /* LESS_THAN */:
@@ -5284,7 +5289,7 @@ function targetGetAscendingBound(target, fieldPath, bound) {
5284
5289
  break;
5285
5290
  // Remaining filters cannot be used as lower bounds.
5286
5291
  }
5287
- if (valuesMax(value, filterValue) === filterValue) {
5292
+ if (lowerBoundCompare({ value, inclusive }, { value: filterValue, inclusive: filterInclusive }) < 0) {
5288
5293
  value = filterValue;
5289
5294
  inclusive = filterInclusive;
5290
5295
  }
@@ -5296,7 +5301,7 @@ function targetGetAscendingBound(target, fieldPath, bound) {
5296
5301
  const orderBy = target.orderBy[i];
5297
5302
  if (orderBy.field.isEqual(fieldPath)) {
5298
5303
  const cursorValue = bound.position[i];
5299
- if (valuesMax(value, cursorValue) === cursorValue) {
5304
+ if (lowerBoundCompare({ value, inclusive }, { value: cursorValue, inclusive: bound.inclusive }) < 0) {
5300
5305
  value = cursorValue;
5301
5306
  inclusive = bound.inclusive;
5302
5307
  }
@@ -5311,11 +5316,11 @@ function targetGetAscendingBound(target, fieldPath, bound) {
5311
5316
  * the provided `fieldPath` (or the lower bound for a descending segment).
5312
5317
  */
5313
5318
  function targetGetDescendingBound(target, fieldPath, bound) {
5314
- let value = undefined;
5319
+ let value = MAX_VALUE;
5315
5320
  let inclusive = true;
5316
5321
  // Process all filters to find a value for the current field segment
5317
5322
  for (const fieldFilter of targetGetFieldFiltersForPath(target, fieldPath)) {
5318
- let filterValue = undefined;
5323
+ let filterValue = MAX_VALUE;
5319
5324
  let filterInclusive = true;
5320
5325
  switch (fieldFilter.op) {
5321
5326
  case ">=" /* GREATER_THAN_OR_EQUAL */:
@@ -5338,7 +5343,7 @@ function targetGetDescendingBound(target, fieldPath, bound) {
5338
5343
  break;
5339
5344
  // Remaining filters cannot be used as upper bounds.
5340
5345
  }
5341
- if (valuesMin(value, filterValue) === filterValue) {
5346
+ if (upperBoundCompare({ value, inclusive }, { value: filterValue, inclusive: filterInclusive }) > 0) {
5342
5347
  value = filterValue;
5343
5348
  inclusive = filterInclusive;
5344
5349
  }
@@ -5350,7 +5355,7 @@ function targetGetDescendingBound(target, fieldPath, bound) {
5350
5355
  const orderBy = target.orderBy[i];
5351
5356
  if (orderBy.field.isEqual(fieldPath)) {
5352
5357
  const cursorValue = bound.position[i];
5353
- if (valuesMin(value, cursorValue) === cursorValue) {
5358
+ if (upperBoundCompare({ value, inclusive }, { value: cursorValue, inclusive: bound.inclusive }) > 0) {
5354
5359
  value = cursorValue;
5355
5360
  inclusive = bound.inclusive;
5356
5361
  }
@@ -5857,10 +5862,10 @@ function queryToTarget(query) {
5857
5862
  }
5858
5863
  // We need to swap the cursors to match the now-flipped query ordering.
5859
5864
  const startAt = queryImpl.endAt
5860
- ? new Bound(queryImpl.endAt.position, !queryImpl.endAt.inclusive)
5865
+ ? new Bound(queryImpl.endAt.position, queryImpl.endAt.inclusive)
5861
5866
  : null;
5862
5867
  const endAt = queryImpl.startAt
5863
- ? new Bound(queryImpl.startAt.position, !queryImpl.startAt.inclusive)
5868
+ ? new Bound(queryImpl.startAt.position, queryImpl.startAt.inclusive)
5864
5869
  : null;
5865
5870
  // Now return as a LimitType.First query.
5866
5871
  queryImpl.memoizedTarget = newTarget(queryImpl.path, queryImpl.collectionGroup, orderBys, queryImpl.filters, queryImpl.limit, startAt, endAt);
@@ -10219,7 +10224,7 @@ class IndexedDbIndexManager {
10219
10224
  const lowerBoundEncoded = this.encodeBound(index, subTarget, lowerBound);
10220
10225
  const upperBoundEncoded = this.encodeBound(index, subTarget, upperBound);
10221
10226
  const notInEncoded = this.encodeValues(index, subTarget, notInValues);
10222
- const indexRanges = this.generateIndexRanges(index.indexId, arrayValues, lowerBoundEncoded, !!lowerBound && lowerBound.inclusive, upperBoundEncoded, !!upperBound && upperBound.inclusive, notInEncoded);
10227
+ const indexRanges = this.generateIndexRanges(index.indexId, arrayValues, lowerBoundEncoded, lowerBound.inclusive, upperBoundEncoded, upperBound.inclusive, notInEncoded);
10223
10228
  return PersistencePromise.forEach(indexRanges, (indexRange) => {
10224
10229
  return indexEntries
10225
10230
  .loadFirst(indexRange, target.limit)
@@ -10257,19 +10262,15 @@ class IndexedDbIndexManager {
10257
10262
  // index range per value in an ARRAY_CONTAINS or ARRAY_CONTAINS_ANY filter
10258
10263
  // combined with the values from the query bounds.
10259
10264
  const totalScans = (arrayValues != null ? arrayValues.length : 1) *
10260
- Math.max(lowerBounds != null ? lowerBounds.length : 1, upperBounds != null ? upperBounds.length : 1);
10265
+ Math.max(lowerBounds.length, upperBounds.length);
10261
10266
  const scansPerArrayElement = totalScans / (arrayValues != null ? arrayValues.length : 1);
10262
10267
  const indexRanges = [];
10263
10268
  for (let i = 0; i < totalScans; ++i) {
10264
10269
  const arrayValue = arrayValues
10265
10270
  ? this.encodeSingleElement(arrayValues[i / scansPerArrayElement])
10266
10271
  : EMPTY_VALUE;
10267
- const lowerBound = lowerBounds
10268
- ? this.generateLowerBound(indexId, arrayValue, lowerBounds[i % scansPerArrayElement], lowerBoundInclusive)
10269
- : this.generateEmptyBound(indexId);
10270
- const upperBound = upperBounds
10271
- ? this.generateUpperBound(indexId, arrayValue, upperBounds[i % scansPerArrayElement], upperBoundInclusive)
10272
- : this.generateEmptyBound(indexId + 1);
10272
+ const lowerBound = this.generateLowerBound(indexId, arrayValue, lowerBounds[i % scansPerArrayElement], lowerBoundInclusive);
10273
+ const upperBound = this.generateUpperBound(indexId, arrayValue, upperBounds[i % scansPerArrayElement], upperBoundInclusive);
10273
10274
  const notInBound = notInValues.map(notIn => this.generateLowerBound(indexId, arrayValue, notIn,
10274
10275
  /* inclusive= */ true));
10275
10276
  indexRanges.push(...this.createRange(lowerBound, upperBound, notInBound));
@@ -10286,13 +10287,6 @@ class IndexedDbIndexManager {
10286
10287
  const entry = new IndexEntry(indexId, DocumentKey.empty(), arrayValue, directionalValue);
10287
10288
  return inclusive ? entry.successor() : entry;
10288
10289
  }
10289
- /**
10290
- * Generates an empty bound that scopes the index scan to the current index
10291
- * and user.
10292
- */
10293
- generateEmptyBound(indexId) {
10294
- return new IndexEntry(indexId, DocumentKey.empty(), EMPTY_VALUE, EMPTY_VALUE);
10295
- }
10296
10290
  getFieldIndex(transaction, target) {
10297
10291
  const targetIndexMatcher = new TargetIndexMatcher(target);
10298
10292
  const collectionGroup = target.collectionGroup != null
@@ -10387,9 +10381,6 @@ class IndexedDbIndexManager {
10387
10381
  * queries, a list of possible values is returned.
10388
10382
  */
10389
10383
  encodeBound(fieldIndex, target, bound) {
10390
- if (bound == null) {
10391
- return null;
10392
- }
10393
10384
  return this.encodeValues(fieldIndex, target, bound.position);
10394
10385
  }
10395
10386
  /** Returns the byte representation for the provided encoders. */