@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.
@@ -14,7 +14,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
14
14
 
15
15
  var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
16
16
 
17
- const version$1 = "3.8.3-canary.d5d78cbcf";
17
+ const version$1 = "3.8.3-canary.e2bf2eca2";
18
18
 
19
19
  /**
20
20
  * @license
@@ -67,7 +67,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
67
67
  User.FIRST_PARTY = new User('first-party-uid');
68
68
  User.MOCK_USER = new User('mock-user');
69
69
 
70
- const version = "9.17.1-canary.d5d78cbcf";
70
+ const version = "9.17.1-canary.e2bf2eca2";
71
71
 
72
72
  /**
73
73
  * @license
@@ -1185,6 +1185,66 @@ function validatePositiveNumber(functionName, n) {
1185
1185
  }
1186
1186
  }
1187
1187
 
1188
+ /**
1189
+ * @license
1190
+ * Copyright 2023 Google LLC
1191
+ *
1192
+ * Licensed under the Apache License, Version 2.0 (the "License");
1193
+ * you may not use this file except in compliance with the License.
1194
+ * You may obtain a copy of the License at
1195
+ *
1196
+ * http://www.apache.org/licenses/LICENSE-2.0
1197
+ *
1198
+ * Unless required by applicable law or agreed to in writing, software
1199
+ * distributed under the License is distributed on an "AS IS" BASIS,
1200
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1201
+ * See the License for the specific language governing permissions and
1202
+ * limitations under the License.
1203
+ */
1204
+ /**
1205
+ * The value returned from the most recent invocation of
1206
+ * `generateUniqueDebugId()`, or null if it has never been invoked.
1207
+ */
1208
+ let lastUniqueDebugId = null;
1209
+ /**
1210
+ * Generates and returns an initial value for `lastUniqueDebugId`.
1211
+ *
1212
+ * The returned value is randomly selected from a range of integers that are
1213
+ * represented as 8 hexadecimal digits. This means that (within reason) any
1214
+ * numbers generated by incrementing the returned number by 1 will also be
1215
+ * represented by 8 hexadecimal digits. This leads to all "IDs" having the same
1216
+ * length when converted to a hexadecimal string, making reading logs containing
1217
+ * these IDs easier to follow. And since the return value is randomly selected
1218
+ * it will help to differentiate between logs from different executions.
1219
+ */
1220
+ function generateInitialUniqueDebugId() {
1221
+ const minResult = 0x10000000;
1222
+ const maxResult = 0x90000000;
1223
+ const resultRange = maxResult - minResult;
1224
+ const resultOffset = Math.round(resultRange * Math.random());
1225
+ return minResult + resultOffset;
1226
+ }
1227
+ /**
1228
+ * Generates and returns a unique ID as a hexadecimal string.
1229
+ *
1230
+ * The returned ID is intended to be used in debug logging messages to help
1231
+ * correlate log messages that may be spatially separated in the logs, but
1232
+ * logically related. For example, a network connection could include the same
1233
+ * "debug ID" string in all of its log messages to help trace a specific
1234
+ * connection over time.
1235
+ *
1236
+ * @return the 10-character generated ID (e.g. "0xa1b2c3d4").
1237
+ */
1238
+ function generateUniqueDebugId() {
1239
+ if (lastUniqueDebugId === null) {
1240
+ lastUniqueDebugId = generateInitialUniqueDebugId();
1241
+ }
1242
+ else {
1243
+ lastUniqueDebugId++;
1244
+ }
1245
+ return '0x' + lastUniqueDebugId.toString(16);
1246
+ }
1247
+
1188
1248
  /**
1189
1249
  * @license
1190
1250
  * Copyright 2020 Google LLC
@@ -1241,15 +1301,16 @@ class RestConnection {
1241
1301
  return false;
1242
1302
  }
1243
1303
  invokeRPC(rpcName, path, req, authToken, appCheckToken) {
1304
+ const streamId = generateUniqueDebugId();
1244
1305
  const url = this.makeUrl(rpcName, path);
1245
- logDebug(LOG_TAG$3, 'Sending: ', url, req);
1306
+ logDebug(LOG_TAG$3, `Sending RPC '${rpcName}' ${streamId}:`, url, req);
1246
1307
  const headers = {};
1247
1308
  this.modifyHeadersForRequest(headers, authToken, appCheckToken);
1248
1309
  return this.performRPCRequest(rpcName, url, headers, req).then(response => {
1249
- logDebug(LOG_TAG$3, 'Received: ', response);
1310
+ logDebug(LOG_TAG$3, `Received RPC '${rpcName}' ${streamId}: `, response);
1250
1311
  return response;
1251
1312
  }, (err) => {
1252
- logWarn(LOG_TAG$3, `${rpcName} failed with error: `, err, 'url: ', url, 'request:', req);
1313
+ logWarn(LOG_TAG$3, `RPC '${rpcName}' ${streamId} failed with error: `, err, 'url: ', url, 'request:', req);
1253
1314
  throw err;
1254
1315
  });
1255
1316
  }