@firebase/firestore 3.8.3-canary.d5d78cbcf → 3.8.3-canary.e2bf2eca2
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/debug_uid.d.ts +28 -0
- package/dist/index.cjs.js +1435 -1384
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +1348 -1297
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +1351 -1274
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +82 -17
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +82 -17
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1367 -1316
- package/dist/index.rn.js.map +1 -1
- package/dist/lite/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/lite/index.browser.esm2017.js +765 -717
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +727 -681
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.cjs.js +765 -717
- package/dist/lite/index.cjs.js.map +1 -1
- package/dist/lite/index.node.cjs.js +66 -5
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +66 -5
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +767 -719
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +129 -129
- package/dist/lite/packages/firestore/src/util/debug_uid.d.ts +28 -0
- package/dist/packages/firestore/dist/index.esm2017.d.ts +148 -148
- package/dist/packages/firestore/src/util/debug_uid.d.ts +28 -0
- package/package.json +9 -9
package/dist/index.node.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import * as grpc from '@grpc/grpc-js';
|
|
|
8
8
|
import * as protoLoader from '@grpc/proto-loader';
|
|
9
9
|
|
|
10
10
|
const name = "@firebase/firestore";
|
|
11
|
-
const version$1 = "3.8.3-canary.
|
|
11
|
+
const version$1 = "3.8.3-canary.e2bf2eca2";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -61,7 +61,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
|
|
|
61
61
|
User.FIRST_PARTY = new User('first-party-uid');
|
|
62
62
|
User.MOCK_USER = new User('mock-user');
|
|
63
63
|
|
|
64
|
-
const version = "9.17.1-canary.
|
|
64
|
+
const version = "9.17.1-canary.e2bf2eca2";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
@@ -17912,6 +17912,66 @@ class StreamBridge {
|
|
|
17912
17912
|
}
|
|
17913
17913
|
}
|
|
17914
17914
|
|
|
17915
|
+
/**
|
|
17916
|
+
* @license
|
|
17917
|
+
* Copyright 2023 Google LLC
|
|
17918
|
+
*
|
|
17919
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
17920
|
+
* you may not use this file except in compliance with the License.
|
|
17921
|
+
* You may obtain a copy of the License at
|
|
17922
|
+
*
|
|
17923
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17924
|
+
*
|
|
17925
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17926
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17927
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17928
|
+
* See the License for the specific language governing permissions and
|
|
17929
|
+
* limitations under the License.
|
|
17930
|
+
*/
|
|
17931
|
+
/**
|
|
17932
|
+
* The value returned from the most recent invocation of
|
|
17933
|
+
* `generateUniqueDebugId()`, or null if it has never been invoked.
|
|
17934
|
+
*/
|
|
17935
|
+
let lastUniqueDebugId = null;
|
|
17936
|
+
/**
|
|
17937
|
+
* Generates and returns an initial value for `lastUniqueDebugId`.
|
|
17938
|
+
*
|
|
17939
|
+
* The returned value is randomly selected from a range of integers that are
|
|
17940
|
+
* represented as 8 hexadecimal digits. This means that (within reason) any
|
|
17941
|
+
* numbers generated by incrementing the returned number by 1 will also be
|
|
17942
|
+
* represented by 8 hexadecimal digits. This leads to all "IDs" having the same
|
|
17943
|
+
* length when converted to a hexadecimal string, making reading logs containing
|
|
17944
|
+
* these IDs easier to follow. And since the return value is randomly selected
|
|
17945
|
+
* it will help to differentiate between logs from different executions.
|
|
17946
|
+
*/
|
|
17947
|
+
function generateInitialUniqueDebugId() {
|
|
17948
|
+
const minResult = 0x10000000;
|
|
17949
|
+
const maxResult = 0x90000000;
|
|
17950
|
+
const resultRange = maxResult - minResult;
|
|
17951
|
+
const resultOffset = Math.round(resultRange * Math.random());
|
|
17952
|
+
return minResult + resultOffset;
|
|
17953
|
+
}
|
|
17954
|
+
/**
|
|
17955
|
+
* Generates and returns a unique ID as a hexadecimal string.
|
|
17956
|
+
*
|
|
17957
|
+
* The returned ID is intended to be used in debug logging messages to help
|
|
17958
|
+
* correlate log messages that may be spatially separated in the logs, but
|
|
17959
|
+
* logically related. For example, a network connection could include the same
|
|
17960
|
+
* "debug ID" string in all of its log messages to help trace a specific
|
|
17961
|
+
* connection over time.
|
|
17962
|
+
*
|
|
17963
|
+
* @return the 10-character generated ID (e.g. "0xa1b2c3d4").
|
|
17964
|
+
*/
|
|
17965
|
+
function generateUniqueDebugId() {
|
|
17966
|
+
if (lastUniqueDebugId === null) {
|
|
17967
|
+
lastUniqueDebugId = generateInitialUniqueDebugId();
|
|
17968
|
+
}
|
|
17969
|
+
else {
|
|
17970
|
+
lastUniqueDebugId++;
|
|
17971
|
+
}
|
|
17972
|
+
return '0x' + lastUniqueDebugId.toString(16);
|
|
17973
|
+
}
|
|
17974
|
+
|
|
17915
17975
|
/**
|
|
17916
17976
|
* @license
|
|
17917
17977
|
* Copyright 2017 Google LLC
|
|
@@ -17998,7 +18058,7 @@ function nodePromise(action) {
|
|
|
17998
18058
|
// TODO: Fetch runtime version from grpc-js/package.json instead
|
|
17999
18059
|
// when there's a cleaner way to dynamic require JSON in both Node ESM and CJS
|
|
18000
18060
|
const grpcVersion = '1.7.3';
|
|
18001
|
-
const LOG_TAG$9 = '
|
|
18061
|
+
const LOG_TAG$9 = 'GrpcConnection';
|
|
18002
18062
|
const X_GOOG_API_CLIENT_VALUE = `gl-node/${process.versions.node} fire/${SDK_VERSION} grpc/${grpcVersion}`;
|
|
18003
18063
|
function createMetadata(databasePath, authToken, appCheckToken, appId) {
|
|
18004
18064
|
hardAssert(authToken === null || authToken.type === 'OAuth');
|
|
@@ -18050,34 +18110,36 @@ class GrpcConnection {
|
|
|
18050
18110
|
return this.cachedStub;
|
|
18051
18111
|
}
|
|
18052
18112
|
invokeRPC(rpcName, path, request, authToken, appCheckToken) {
|
|
18113
|
+
const streamId = generateUniqueDebugId();
|
|
18053
18114
|
const stub = this.ensureActiveStub();
|
|
18054
18115
|
const metadata = createMetadata(this.databasePath, authToken, appCheckToken, this.databaseInfo.appId);
|
|
18055
18116
|
const jsonRequest = Object.assign({ database: this.databasePath }, request);
|
|
18056
18117
|
return nodePromise((callback) => {
|
|
18057
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' invoked with request:`, request);
|
|
18118
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} invoked with request:`, request);
|
|
18058
18119
|
return stub[rpcName](jsonRequest, metadata, (grpcError, value) => {
|
|
18059
18120
|
if (grpcError) {
|
|
18060
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' failed with error:`, grpcError);
|
|
18121
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} failed with error:`, grpcError);
|
|
18061
18122
|
callback(new FirestoreError(mapCodeFromRpcCode(grpcError.code), grpcError.message));
|
|
18062
18123
|
}
|
|
18063
18124
|
else {
|
|
18064
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' completed with response:`, value);
|
|
18125
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} completed with response:`, value);
|
|
18065
18126
|
callback(undefined, value);
|
|
18066
18127
|
}
|
|
18067
18128
|
});
|
|
18068
18129
|
});
|
|
18069
18130
|
}
|
|
18070
18131
|
invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken, expectedResponseCount) {
|
|
18132
|
+
const streamId = generateUniqueDebugId();
|
|
18071
18133
|
const results = [];
|
|
18072
18134
|
const responseDeferred = new Deferred();
|
|
18073
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' invoked (streaming) with request:`, request);
|
|
18135
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} invoked (streaming) with request:`, request);
|
|
18074
18136
|
const stub = this.ensureActiveStub();
|
|
18075
18137
|
const metadata = createMetadata(this.databasePath, authToken, appCheckToken, this.databaseInfo.appId);
|
|
18076
18138
|
const jsonRequest = Object.assign(Object.assign({}, request), { database: this.databasePath });
|
|
18077
18139
|
const stream = stub[rpcName](jsonRequest, metadata);
|
|
18078
18140
|
let callbackFired = false;
|
|
18079
18141
|
stream.on('data', (response) => {
|
|
18080
|
-
logDebug(LOG_TAG$9, `RPC ${rpcName} received result:`, response);
|
|
18142
|
+
logDebug(LOG_TAG$9, `RPC ${rpcName} ${streamId} received result:`, response);
|
|
18081
18143
|
results.push(response);
|
|
18082
18144
|
if (expectedResponseCount !== undefined &&
|
|
18083
18145
|
results.length === expectedResponseCount) {
|
|
@@ -18086,14 +18148,14 @@ class GrpcConnection {
|
|
|
18086
18148
|
}
|
|
18087
18149
|
});
|
|
18088
18150
|
stream.on('end', () => {
|
|
18089
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' completed.`);
|
|
18151
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} completed.`);
|
|
18090
18152
|
if (!callbackFired) {
|
|
18091
18153
|
callbackFired = true;
|
|
18092
18154
|
responseDeferred.resolve(results);
|
|
18093
18155
|
}
|
|
18094
18156
|
});
|
|
18095
18157
|
stream.on('error', (grpcError) => {
|
|
18096
|
-
logDebug(LOG_TAG$9, `RPC '${rpcName}' failed with error:`, grpcError);
|
|
18158
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' ${streamId} failed with error:`, grpcError);
|
|
18097
18159
|
const code = mapCodeFromRpcCode(grpcError.code);
|
|
18098
18160
|
responseDeferred.reject(new FirestoreError(code, grpcError.message));
|
|
18099
18161
|
});
|
|
@@ -18101,6 +18163,7 @@ class GrpcConnection {
|
|
|
18101
18163
|
}
|
|
18102
18164
|
// TODO(mikelehen): This "method" is a monster. Should be refactored.
|
|
18103
18165
|
openStream(rpcName, authToken, appCheckToken) {
|
|
18166
|
+
const streamId = generateUniqueDebugId();
|
|
18104
18167
|
const stub = this.ensureActiveStub();
|
|
18105
18168
|
const metadata = createMetadata(this.databasePath, authToken, appCheckToken, this.databaseInfo.appId);
|
|
18106
18169
|
const grpcStream = stub[rpcName](metadata);
|
|
@@ -18115,7 +18178,7 @@ class GrpcConnection {
|
|
|
18115
18178
|
const stream = new StreamBridge({
|
|
18116
18179
|
sendFn: (msg) => {
|
|
18117
18180
|
if (!closed) {
|
|
18118
|
-
logDebug(LOG_TAG$9, '
|
|
18181
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} sending:`, msg);
|
|
18119
18182
|
try {
|
|
18120
18183
|
grpcStream.write(msg);
|
|
18121
18184
|
}
|
|
@@ -18128,32 +18191,34 @@ class GrpcConnection {
|
|
|
18128
18191
|
}
|
|
18129
18192
|
}
|
|
18130
18193
|
else {
|
|
18131
|
-
logDebug(LOG_TAG$9, '
|
|
18194
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} ` +
|
|
18195
|
+
'not sending because gRPC stream is closed:', msg);
|
|
18132
18196
|
}
|
|
18133
18197
|
},
|
|
18134
18198
|
closeFn: () => {
|
|
18135
|
-
logDebug(LOG_TAG$9, '
|
|
18199
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} closed locally via close().`);
|
|
18136
18200
|
close();
|
|
18137
18201
|
}
|
|
18138
18202
|
});
|
|
18139
18203
|
grpcStream.on('data', (msg) => {
|
|
18140
18204
|
if (!closed) {
|
|
18141
|
-
logDebug(LOG_TAG$9, '
|
|
18205
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} received:`, msg);
|
|
18142
18206
|
stream.callOnMessage(msg);
|
|
18143
18207
|
}
|
|
18144
18208
|
});
|
|
18145
18209
|
grpcStream.on('end', () => {
|
|
18146
|
-
logDebug(LOG_TAG$9, '
|
|
18210
|
+
logDebug(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} ended.`);
|
|
18147
18211
|
close();
|
|
18148
18212
|
});
|
|
18149
18213
|
grpcStream.on('error', (grpcError) => {
|
|
18150
18214
|
if (!closed) {
|
|
18151
|
-
logWarn(LOG_TAG$9, '
|
|
18215
|
+
logWarn(LOG_TAG$9, `RPC '${rpcName}' stream ${streamId} error. Code:`, grpcError.code, 'Message:', grpcError.message);
|
|
18152
18216
|
const code = mapCodeFromRpcCode(grpcError.code);
|
|
18153
18217
|
close(new FirestoreError(code, grpcError.message));
|
|
18154
18218
|
}
|
|
18155
18219
|
});
|
|
18156
|
-
logDebug(LOG_TAG$9,
|
|
18220
|
+
logDebug(LOG_TAG$9, `Opening RPC '${rpcName}' stream ${streamId} ` +
|
|
18221
|
+
`to ${this.databaseInfo.host}`);
|
|
18157
18222
|
// TODO(dimond): Since grpc has no explicit open status (or does it?) we
|
|
18158
18223
|
// simulate an onOpen in the next loop after the stream had it's listeners
|
|
18159
18224
|
// registered
|