@firebase/firestore 4.7.7 → 4.7.8
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/misc.d.ts +0 -2
- package/dist/index.cjs.js +145 -153
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +145 -153
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +41 -52
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +41 -52
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +156 -164
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/util/misc.d.ts +0 -2
- package/dist/lite/index.browser.esm2017.js +127 -157
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +127 -157
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +97 -127
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +97 -127
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +120 -150
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/package.json +3 -3
|
@@ -10,7 +10,7 @@ var util = require('@firebase/util');
|
|
|
10
10
|
var bloomBlob = require('@firebase/webchannel-wrapper/bloom-blob');
|
|
11
11
|
var crypto = require('crypto');
|
|
12
12
|
|
|
13
|
-
const version$1 = "4.7.
|
|
13
|
+
const version$1 = "4.7.8";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @license
|
|
@@ -63,7 +63,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
63
63
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
64
64
|
User.MOCK_USER = new User('mock-user');
|
|
65
65
|
|
|
66
|
-
const version = "11.3.
|
|
66
|
+
const version = "11.3.1";
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
@@ -703,127 +703,6 @@ function databaseIdFromApp(app, database) {
|
|
|
703
703
|
return new DatabaseId(app.options.projectId, database);
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
/**
|
|
707
|
-
* @license
|
|
708
|
-
* Copyright 2020 Google LLC
|
|
709
|
-
*
|
|
710
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
711
|
-
* you may not use this file except in compliance with the License.
|
|
712
|
-
* You may obtain a copy of the License at
|
|
713
|
-
*
|
|
714
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
715
|
-
*
|
|
716
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
717
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
718
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
|
-
* See the License for the specific language governing permissions and
|
|
720
|
-
* limitations under the License.
|
|
721
|
-
*/
|
|
722
|
-
/**
|
|
723
|
-
* Generates `nBytes` of random bytes.
|
|
724
|
-
*
|
|
725
|
-
* If `nBytes < 0` , an error will be thrown.
|
|
726
|
-
*/
|
|
727
|
-
function randomBytes(nBytes) {
|
|
728
|
-
return crypto.randomBytes(nBytes);
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* @license
|
|
733
|
-
* Copyright 2023 Google LLC
|
|
734
|
-
*
|
|
735
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
736
|
-
* you may not use this file except in compliance with the License.
|
|
737
|
-
* You may obtain a copy of the License at
|
|
738
|
-
*
|
|
739
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
740
|
-
*
|
|
741
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
742
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
743
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
744
|
-
* See the License for the specific language governing permissions and
|
|
745
|
-
* limitations under the License.
|
|
746
|
-
*/
|
|
747
|
-
/**
|
|
748
|
-
* An instance of the Platform's 'TextEncoder' implementation.
|
|
749
|
-
*/
|
|
750
|
-
function newTextEncoder() {
|
|
751
|
-
return new TextEncoder();
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* @license
|
|
756
|
-
* Copyright 2017 Google LLC
|
|
757
|
-
*
|
|
758
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
759
|
-
* you may not use this file except in compliance with the License.
|
|
760
|
-
* You may obtain a copy of the License at
|
|
761
|
-
*
|
|
762
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
763
|
-
*
|
|
764
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
765
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
766
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
767
|
-
* See the License for the specific language governing permissions and
|
|
768
|
-
* limitations under the License.
|
|
769
|
-
*/
|
|
770
|
-
/**
|
|
771
|
-
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
772
|
-
*
|
|
773
|
-
* @internal
|
|
774
|
-
* Exported internally for testing purposes.
|
|
775
|
-
*/
|
|
776
|
-
class AutoId {
|
|
777
|
-
static newId() {
|
|
778
|
-
// Alphanumeric characters
|
|
779
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
780
|
-
// The largest byte value that is a multiple of `char.length`.
|
|
781
|
-
const maxMultiple = Math.floor(256 / chars.length) * chars.length;
|
|
782
|
-
let autoId = '';
|
|
783
|
-
const targetLength = 20;
|
|
784
|
-
while (autoId.length < targetLength) {
|
|
785
|
-
const bytes = randomBytes(40);
|
|
786
|
-
for (let i = 0; i < bytes.length; ++i) {
|
|
787
|
-
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
788
|
-
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
789
|
-
if (autoId.length < targetLength && bytes[i] < maxMultiple) {
|
|
790
|
-
autoId += chars.charAt(bytes[i] % chars.length);
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
return autoId;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function primitiveComparator(left, right) {
|
|
798
|
-
if (left < right) {
|
|
799
|
-
return -1;
|
|
800
|
-
}
|
|
801
|
-
if (left > right) {
|
|
802
|
-
return 1;
|
|
803
|
-
}
|
|
804
|
-
return 0;
|
|
805
|
-
}
|
|
806
|
-
/** Compare strings in UTF-8 encoded byte order */
|
|
807
|
-
function compareUtf8Strings(left, right) {
|
|
808
|
-
// Convert the string to UTF-8 encoded bytes
|
|
809
|
-
const encodedLeft = newTextEncoder().encode(left);
|
|
810
|
-
const encodedRight = newTextEncoder().encode(right);
|
|
811
|
-
for (let i = 0; i < Math.min(encodedLeft.length, encodedRight.length); i++) {
|
|
812
|
-
const comparison = primitiveComparator(encodedLeft[i], encodedRight[i]);
|
|
813
|
-
if (comparison !== 0) {
|
|
814
|
-
return comparison;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
return primitiveComparator(encodedLeft.length, encodedRight.length);
|
|
818
|
-
}
|
|
819
|
-
/** Helper to compare arrays using isEqual(). */
|
|
820
|
-
function arrayEquals(left, right, comparator) {
|
|
821
|
-
if (left.length !== right.length) {
|
|
822
|
-
return false;
|
|
823
|
-
}
|
|
824
|
-
return left.every((value, index) => comparator(value, right[index]));
|
|
825
|
-
}
|
|
826
|
-
|
|
827
706
|
/**
|
|
828
707
|
* @license
|
|
829
708
|
* Copyright 2017 Google LLC
|
|
@@ -946,7 +825,7 @@ class BasePath {
|
|
|
946
825
|
return comparison;
|
|
947
826
|
}
|
|
948
827
|
}
|
|
949
|
-
return
|
|
828
|
+
return Math.sign(p1.length - p2.length);
|
|
950
829
|
}
|
|
951
830
|
static compareSegments(lhs, rhs) {
|
|
952
831
|
const isLhsNumeric = BasePath.isNumericId(lhs);
|
|
@@ -965,7 +844,13 @@ class BasePath {
|
|
|
965
844
|
}
|
|
966
845
|
else {
|
|
967
846
|
// both non-numeric
|
|
968
|
-
|
|
847
|
+
if (lhs < rhs) {
|
|
848
|
+
return -1;
|
|
849
|
+
}
|
|
850
|
+
if (lhs > rhs) {
|
|
851
|
+
return 1;
|
|
852
|
+
}
|
|
853
|
+
return 0;
|
|
969
854
|
}
|
|
970
855
|
}
|
|
971
856
|
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
@@ -1765,6 +1650,91 @@ function newConnection(databaseInfo) {
|
|
|
1765
1650
|
return new FetchConnection(databaseInfo);
|
|
1766
1651
|
}
|
|
1767
1652
|
|
|
1653
|
+
/**
|
|
1654
|
+
* @license
|
|
1655
|
+
* Copyright 2020 Google LLC
|
|
1656
|
+
*
|
|
1657
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1658
|
+
* you may not use this file except in compliance with the License.
|
|
1659
|
+
* You may obtain a copy of the License at
|
|
1660
|
+
*
|
|
1661
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1662
|
+
*
|
|
1663
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1664
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1665
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1666
|
+
* See the License for the specific language governing permissions and
|
|
1667
|
+
* limitations under the License.
|
|
1668
|
+
*/
|
|
1669
|
+
/**
|
|
1670
|
+
* Generates `nBytes` of random bytes.
|
|
1671
|
+
*
|
|
1672
|
+
* If `nBytes < 0` , an error will be thrown.
|
|
1673
|
+
*/
|
|
1674
|
+
function randomBytes(nBytes) {
|
|
1675
|
+
return crypto.randomBytes(nBytes);
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* @license
|
|
1680
|
+
* Copyright 2017 Google LLC
|
|
1681
|
+
*
|
|
1682
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1683
|
+
* you may not use this file except in compliance with the License.
|
|
1684
|
+
* You may obtain a copy of the License at
|
|
1685
|
+
*
|
|
1686
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1687
|
+
*
|
|
1688
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1689
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1690
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1691
|
+
* See the License for the specific language governing permissions and
|
|
1692
|
+
* limitations under the License.
|
|
1693
|
+
*/
|
|
1694
|
+
/**
|
|
1695
|
+
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
1696
|
+
*
|
|
1697
|
+
* @internal
|
|
1698
|
+
* Exported internally for testing purposes.
|
|
1699
|
+
*/
|
|
1700
|
+
class AutoId {
|
|
1701
|
+
static newId() {
|
|
1702
|
+
// Alphanumeric characters
|
|
1703
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
1704
|
+
// The largest byte value that is a multiple of `char.length`.
|
|
1705
|
+
const maxMultiple = Math.floor(256 / chars.length) * chars.length;
|
|
1706
|
+
let autoId = '';
|
|
1707
|
+
const targetLength = 20;
|
|
1708
|
+
while (autoId.length < targetLength) {
|
|
1709
|
+
const bytes = randomBytes(40);
|
|
1710
|
+
for (let i = 0; i < bytes.length; ++i) {
|
|
1711
|
+
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1712
|
+
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
1713
|
+
if (autoId.length < targetLength && bytes[i] < maxMultiple) {
|
|
1714
|
+
autoId += chars.charAt(bytes[i] % chars.length);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return autoId;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
function primitiveComparator(left, right) {
|
|
1722
|
+
if (left < right) {
|
|
1723
|
+
return -1;
|
|
1724
|
+
}
|
|
1725
|
+
if (left > right) {
|
|
1726
|
+
return 1;
|
|
1727
|
+
}
|
|
1728
|
+
return 0;
|
|
1729
|
+
}
|
|
1730
|
+
/** Helper to compare arrays using isEqual(). */
|
|
1731
|
+
function arrayEquals(left, right, comparator) {
|
|
1732
|
+
if (left.length !== right.length) {
|
|
1733
|
+
return false;
|
|
1734
|
+
}
|
|
1735
|
+
return left.every((value, index) => comparator(value, right[index]));
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1768
1738
|
/**
|
|
1769
1739
|
* @license
|
|
1770
1740
|
* Copyright 2017 Google LLC
|
|
@@ -2478,7 +2448,7 @@ function valueCompare(left, right) {
|
|
|
2478
2448
|
case 4 /* TypeOrder.ServerTimestampValue */:
|
|
2479
2449
|
return compareTimestamps(getLocalWriteTime(left), getLocalWriteTime(right));
|
|
2480
2450
|
case 5 /* TypeOrder.StringValue */:
|
|
2481
|
-
return
|
|
2451
|
+
return primitiveComparator(left.stringValue, right.stringValue);
|
|
2482
2452
|
case 6 /* TypeOrder.BlobValue */:
|
|
2483
2453
|
return compareBlobs(left.bytesValue, right.bytesValue);
|
|
2484
2454
|
case 7 /* TypeOrder.RefValue */:
|
|
@@ -2599,7 +2569,7 @@ function compareMaps(left, right) {
|
|
|
2599
2569
|
leftKeys.sort();
|
|
2600
2570
|
rightKeys.sort();
|
|
2601
2571
|
for (let i = 0; i < leftKeys.length && i < rightKeys.length; ++i) {
|
|
2602
|
-
const keyCompare =
|
|
2572
|
+
const keyCompare = primitiveComparator(leftKeys[i], rightKeys[i]);
|
|
2603
2573
|
if (keyCompare !== 0) {
|
|
2604
2574
|
return keyCompare;
|
|
2605
2575
|
}
|