@firebase/firestore 4.7.7-canary.4e6a5c670 → 4.7.7-canary.604133f8d
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/global_index.d.ts +9 -2
- package/dist/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/firestore/src/lite-api/vector_value.d.ts +2 -2
- package/dist/firestore/src/util/misc.d.ts +0 -2
- package/dist/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/index.cjs.js +245 -243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm2017.js +246 -244
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +56 -55
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +57 -56
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +198 -196
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +9 -2
- package/dist/lite/firestore/src/lite-api/database.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/settings.d.ts +4 -0
- package/dist/lite/firestore/src/lite-api/vector_value.d.ts +2 -2
- package/dist/lite/firestore/src/util/misc.d.ts +0 -2
- package/dist/lite/firestore/test/integration/util/settings.d.ts +1 -0
- package/dist/lite/index.browser.esm2017.js +148 -168
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.cjs.js +148 -168
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.d.ts +2 -2
- package/dist/lite/index.node.cjs.js +112 -130
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +113 -131
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +161 -181
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +9 -2
- package/dist/lite/private.d.ts +6 -2
- package/dist/private.d.ts +6 -2
- package/package.json +9 -9
package/dist/lite/index.node.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { _getProvider, getApp, _removeServiceInstance, _registerComponent, regis
|
|
|
2
2
|
import { Component } from '@firebase/component';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
4
|
import { inspect } from 'util';
|
|
5
|
-
import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken, getModularInstance
|
|
5
|
+
import { FirebaseError, getDefaultEmulatorHostnameAndPort, deepEqual, createMockUserToken, getModularInstance } from '@firebase/util';
|
|
6
6
|
import { Integer } from '@firebase/webchannel-wrapper/bloom-blob';
|
|
7
7
|
import { randomBytes as randomBytes$1 } from 'crypto';
|
|
8
8
|
|
|
9
|
-
const version$1 = "4.7.7-canary.
|
|
9
|
+
const version$1 = "4.7.7-canary.604133f8d";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
@@ -59,7 +59,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
59
59
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
60
60
|
User.MOCK_USER = new User('mock-user');
|
|
61
61
|
|
|
62
|
-
const version = "11.3.0-canary.
|
|
62
|
+
const version = "11.3.0-canary.604133f8d";
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* @license
|
|
@@ -699,127 +699,6 @@ function databaseIdFromApp(app, database) {
|
|
|
699
699
|
return new DatabaseId(app.options.projectId, database);
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
/**
|
|
703
|
-
* @license
|
|
704
|
-
* Copyright 2020 Google LLC
|
|
705
|
-
*
|
|
706
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
707
|
-
* you may not use this file except in compliance with the License.
|
|
708
|
-
* You may obtain a copy of the License at
|
|
709
|
-
*
|
|
710
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
711
|
-
*
|
|
712
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
713
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
714
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
715
|
-
* See the License for the specific language governing permissions and
|
|
716
|
-
* limitations under the License.
|
|
717
|
-
*/
|
|
718
|
-
/**
|
|
719
|
-
* Generates `nBytes` of random bytes.
|
|
720
|
-
*
|
|
721
|
-
* If `nBytes < 0` , an error will be thrown.
|
|
722
|
-
*/
|
|
723
|
-
function randomBytes(nBytes) {
|
|
724
|
-
return randomBytes$1(nBytes);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* @license
|
|
729
|
-
* Copyright 2023 Google LLC
|
|
730
|
-
*
|
|
731
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
732
|
-
* you may not use this file except in compliance with the License.
|
|
733
|
-
* You may obtain a copy of the License at
|
|
734
|
-
*
|
|
735
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
736
|
-
*
|
|
737
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
738
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
739
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
740
|
-
* See the License for the specific language governing permissions and
|
|
741
|
-
* limitations under the License.
|
|
742
|
-
*/
|
|
743
|
-
/**
|
|
744
|
-
* An instance of the Platform's 'TextEncoder' implementation.
|
|
745
|
-
*/
|
|
746
|
-
function newTextEncoder() {
|
|
747
|
-
return new TextEncoder();
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* @license
|
|
752
|
-
* Copyright 2017 Google LLC
|
|
753
|
-
*
|
|
754
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
755
|
-
* you may not use this file except in compliance with the License.
|
|
756
|
-
* You may obtain a copy of the License at
|
|
757
|
-
*
|
|
758
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
759
|
-
*
|
|
760
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
761
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
762
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
763
|
-
* See the License for the specific language governing permissions and
|
|
764
|
-
* limitations under the License.
|
|
765
|
-
*/
|
|
766
|
-
/**
|
|
767
|
-
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
768
|
-
*
|
|
769
|
-
* @internal
|
|
770
|
-
* Exported internally for testing purposes.
|
|
771
|
-
*/
|
|
772
|
-
class AutoId {
|
|
773
|
-
static newId() {
|
|
774
|
-
// Alphanumeric characters
|
|
775
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
776
|
-
// The largest byte value that is a multiple of `char.length`.
|
|
777
|
-
const maxMultiple = Math.floor(256 / chars.length) * chars.length;
|
|
778
|
-
let autoId = '';
|
|
779
|
-
const targetLength = 20;
|
|
780
|
-
while (autoId.length < targetLength) {
|
|
781
|
-
const bytes = randomBytes(40);
|
|
782
|
-
for (let i = 0; i < bytes.length; ++i) {
|
|
783
|
-
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
784
|
-
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
785
|
-
if (autoId.length < targetLength && bytes[i] < maxMultiple) {
|
|
786
|
-
autoId += chars.charAt(bytes[i] % chars.length);
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
return autoId;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
function primitiveComparator(left, right) {
|
|
794
|
-
if (left < right) {
|
|
795
|
-
return -1;
|
|
796
|
-
}
|
|
797
|
-
if (left > right) {
|
|
798
|
-
return 1;
|
|
799
|
-
}
|
|
800
|
-
return 0;
|
|
801
|
-
}
|
|
802
|
-
/** Compare strings in UTF-8 encoded byte order */
|
|
803
|
-
function compareUtf8Strings(left, right) {
|
|
804
|
-
// Convert the string to UTF-8 encoded bytes
|
|
805
|
-
const encodedLeft = newTextEncoder().encode(left);
|
|
806
|
-
const encodedRight = newTextEncoder().encode(right);
|
|
807
|
-
for (let i = 0; i < Math.min(encodedLeft.length, encodedRight.length); i++) {
|
|
808
|
-
const comparison = primitiveComparator(encodedLeft[i], encodedRight[i]);
|
|
809
|
-
if (comparison !== 0) {
|
|
810
|
-
return comparison;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
return primitiveComparator(encodedLeft.length, encodedRight.length);
|
|
814
|
-
}
|
|
815
|
-
/** Helper to compare arrays using isEqual(). */
|
|
816
|
-
function arrayEquals(left, right, comparator) {
|
|
817
|
-
if (left.length !== right.length) {
|
|
818
|
-
return false;
|
|
819
|
-
}
|
|
820
|
-
return left.every((value, index) => comparator(value, right[index]));
|
|
821
|
-
}
|
|
822
|
-
|
|
823
702
|
/**
|
|
824
703
|
* @license
|
|
825
704
|
* Copyright 2017 Google LLC
|
|
@@ -942,7 +821,7 @@ class BasePath {
|
|
|
942
821
|
return comparison;
|
|
943
822
|
}
|
|
944
823
|
}
|
|
945
|
-
return
|
|
824
|
+
return Math.sign(p1.length - p2.length);
|
|
946
825
|
}
|
|
947
826
|
static compareSegments(lhs, rhs) {
|
|
948
827
|
const isLhsNumeric = BasePath.isNumericId(lhs);
|
|
@@ -961,7 +840,13 @@ class BasePath {
|
|
|
961
840
|
}
|
|
962
841
|
else {
|
|
963
842
|
// both non-numeric
|
|
964
|
-
|
|
843
|
+
if (lhs < rhs) {
|
|
844
|
+
return -1;
|
|
845
|
+
}
|
|
846
|
+
if (lhs > rhs) {
|
|
847
|
+
return 1;
|
|
848
|
+
}
|
|
849
|
+
return 0;
|
|
965
850
|
}
|
|
966
851
|
}
|
|
967
852
|
// Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
|
|
@@ -1761,6 +1646,91 @@ function newConnection(databaseInfo) {
|
|
|
1761
1646
|
return new FetchConnection(databaseInfo);
|
|
1762
1647
|
}
|
|
1763
1648
|
|
|
1649
|
+
/**
|
|
1650
|
+
* @license
|
|
1651
|
+
* Copyright 2020 Google LLC
|
|
1652
|
+
*
|
|
1653
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1654
|
+
* you may not use this file except in compliance with the License.
|
|
1655
|
+
* You may obtain a copy of the License at
|
|
1656
|
+
*
|
|
1657
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1658
|
+
*
|
|
1659
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1660
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1661
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1662
|
+
* See the License for the specific language governing permissions and
|
|
1663
|
+
* limitations under the License.
|
|
1664
|
+
*/
|
|
1665
|
+
/**
|
|
1666
|
+
* Generates `nBytes` of random bytes.
|
|
1667
|
+
*
|
|
1668
|
+
* If `nBytes < 0` , an error will be thrown.
|
|
1669
|
+
*/
|
|
1670
|
+
function randomBytes(nBytes) {
|
|
1671
|
+
return randomBytes$1(nBytes);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* @license
|
|
1676
|
+
* Copyright 2017 Google LLC
|
|
1677
|
+
*
|
|
1678
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1679
|
+
* you may not use this file except in compliance with the License.
|
|
1680
|
+
* You may obtain a copy of the License at
|
|
1681
|
+
*
|
|
1682
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1683
|
+
*
|
|
1684
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1685
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1686
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1687
|
+
* See the License for the specific language governing permissions and
|
|
1688
|
+
* limitations under the License.
|
|
1689
|
+
*/
|
|
1690
|
+
/**
|
|
1691
|
+
* A utility class for generating unique alphanumeric IDs of a specified length.
|
|
1692
|
+
*
|
|
1693
|
+
* @internal
|
|
1694
|
+
* Exported internally for testing purposes.
|
|
1695
|
+
*/
|
|
1696
|
+
class AutoId {
|
|
1697
|
+
static newId() {
|
|
1698
|
+
// Alphanumeric characters
|
|
1699
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
1700
|
+
// The largest byte value that is a multiple of `char.length`.
|
|
1701
|
+
const maxMultiple = Math.floor(256 / chars.length) * chars.length;
|
|
1702
|
+
let autoId = '';
|
|
1703
|
+
const targetLength = 20;
|
|
1704
|
+
while (autoId.length < targetLength) {
|
|
1705
|
+
const bytes = randomBytes(40);
|
|
1706
|
+
for (let i = 0; i < bytes.length; ++i) {
|
|
1707
|
+
// Only accept values that are [0, maxMultiple), this ensures they can
|
|
1708
|
+
// be evenly mapped to indices of `chars` via a modulo operation.
|
|
1709
|
+
if (autoId.length < targetLength && bytes[i] < maxMultiple) {
|
|
1710
|
+
autoId += chars.charAt(bytes[i] % chars.length);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return autoId;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
function primitiveComparator(left, right) {
|
|
1718
|
+
if (left < right) {
|
|
1719
|
+
return -1;
|
|
1720
|
+
}
|
|
1721
|
+
if (left > right) {
|
|
1722
|
+
return 1;
|
|
1723
|
+
}
|
|
1724
|
+
return 0;
|
|
1725
|
+
}
|
|
1726
|
+
/** Helper to compare arrays using isEqual(). */
|
|
1727
|
+
function arrayEquals(left, right, comparator) {
|
|
1728
|
+
if (left.length !== right.length) {
|
|
1729
|
+
return false;
|
|
1730
|
+
}
|
|
1731
|
+
return left.every((value, index) => comparator(value, right[index]));
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1764
1734
|
/**
|
|
1765
1735
|
* @license
|
|
1766
1736
|
* Copyright 2017 Google LLC
|
|
@@ -2474,7 +2444,7 @@ function valueCompare(left, right) {
|
|
|
2474
2444
|
case 4 /* TypeOrder.ServerTimestampValue */:
|
|
2475
2445
|
return compareTimestamps(getLocalWriteTime(left), getLocalWriteTime(right));
|
|
2476
2446
|
case 5 /* TypeOrder.StringValue */:
|
|
2477
|
-
return
|
|
2447
|
+
return primitiveComparator(left.stringValue, right.stringValue);
|
|
2478
2448
|
case 6 /* TypeOrder.BlobValue */:
|
|
2479
2449
|
return compareBlobs(left.bytesValue, right.bytesValue);
|
|
2480
2450
|
case 7 /* TypeOrder.RefValue */:
|
|
@@ -2595,7 +2565,7 @@ function compareMaps(left, right) {
|
|
|
2595
2565
|
leftKeys.sort();
|
|
2596
2566
|
rightKeys.sort();
|
|
2597
2567
|
for (let i = 0; i < leftKeys.length && i < rightKeys.length; ++i) {
|
|
2598
|
-
const keyCompare =
|
|
2568
|
+
const keyCompare = primitiveComparator(leftKeys[i], rightKeys[i]);
|
|
2599
2569
|
if (keyCompare !== 0) {
|
|
2600
2570
|
return keyCompare;
|
|
2601
2571
|
}
|
|
@@ -5704,6 +5674,7 @@ class Firestore {
|
|
|
5704
5674
|
this._persistenceKey = '(lite)';
|
|
5705
5675
|
this._settings = new FirestoreSettingsImpl({});
|
|
5706
5676
|
this._settingsFrozen = false;
|
|
5677
|
+
this._emulatorOptions = {};
|
|
5707
5678
|
// A task that is assigned when the terminate() is invoked and resolved when
|
|
5708
5679
|
// all components have shut down. Otherwise, Firestore is not terminated,
|
|
5709
5680
|
// which can mean either the FirestoreClient is in the process of starting,
|
|
@@ -5734,6 +5705,7 @@ class Firestore {
|
|
|
5734
5705
|
'methods on a Firestore object.');
|
|
5735
5706
|
}
|
|
5736
5707
|
this._settings = new FirestoreSettingsImpl(settings);
|
|
5708
|
+
this._emulatorOptions = settings.emulatorOptions || {};
|
|
5737
5709
|
if (settings.credentials !== undefined) {
|
|
5738
5710
|
this._authCredentials = makeAuthCredentialsProvider(settings.credentials);
|
|
5739
5711
|
}
|
|
@@ -5741,6 +5713,9 @@ class Firestore {
|
|
|
5741
5713
|
_getSettings() {
|
|
5742
5714
|
return this._settings;
|
|
5743
5715
|
}
|
|
5716
|
+
_getEmulatorOptions() {
|
|
5717
|
+
return this._emulatorOptions;
|
|
5718
|
+
}
|
|
5744
5719
|
_freezeSettings() {
|
|
5745
5720
|
this._settingsFrozen = true;
|
|
5746
5721
|
return this._settings;
|
|
@@ -5830,12 +5805,19 @@ function connectFirestoreEmulator(firestore, host, port, options = {}) {
|
|
|
5830
5805
|
var _a;
|
|
5831
5806
|
firestore = cast(firestore, Firestore);
|
|
5832
5807
|
const settings = firestore._getSettings();
|
|
5808
|
+
const existingConfig = Object.assign(Object.assign({}, settings), { emulatorOptions: firestore._getEmulatorOptions() });
|
|
5833
5809
|
const newHostSetting = `${host}:${port}`;
|
|
5834
5810
|
if (settings.host !== DEFAULT_HOST && settings.host !== newHostSetting) {
|
|
5835
5811
|
logWarn('Host has been set in both settings() and connectFirestoreEmulator(), emulator host ' +
|
|
5836
5812
|
'will be used.');
|
|
5837
5813
|
}
|
|
5838
|
-
|
|
5814
|
+
const newConfig = Object.assign(Object.assign({}, settings), { host: newHostSetting, ssl: false, emulatorOptions: options });
|
|
5815
|
+
// No-op if the new configuration matches the current configuration. This supports SSR
|
|
5816
|
+
// enviornments which might call `connectFirestoreEmulator` multiple times as a standard practice.
|
|
5817
|
+
if (deepEqual(newConfig, existingConfig)) {
|
|
5818
|
+
return;
|
|
5819
|
+
}
|
|
5820
|
+
firestore._setSettings(newConfig);
|
|
5839
5821
|
if (options.mockUserToken) {
|
|
5840
5822
|
let token;
|
|
5841
5823
|
let user;
|
|
@@ -6532,7 +6514,7 @@ function isPrimitiveArrayEqual(left, right) {
|
|
|
6532
6514
|
*/
|
|
6533
6515
|
/**
|
|
6534
6516
|
* Represents a vector type in Firestore documents.
|
|
6535
|
-
* Create an instance with {@link
|
|
6517
|
+
* Create an instance with <code>{@link vector}</code>.
|
|
6536
6518
|
*
|
|
6537
6519
|
* @class VectorValue
|
|
6538
6520
|
*/
|
|
@@ -6552,7 +6534,7 @@ class VectorValue {
|
|
|
6552
6534
|
return this._values.map(n => n);
|
|
6553
6535
|
}
|
|
6554
6536
|
/**
|
|
6555
|
-
* Returns `true` if the two VectorValue
|
|
6537
|
+
* Returns `true` if the two `VectorValue` values have the same raw number arrays, returns `false` otherwise.
|
|
6556
6538
|
*/
|
|
6557
6539
|
isEqual(other) {
|
|
6558
6540
|
return isPrimitiveArrayEqual(this._values, other._values);
|