@firebase/firestore 3.7.1 → 3.7.2-canary.457fc2eeb

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.
@@ -6,7 +6,7 @@ import { FirebaseError, getDefaultEmulatorHostnameAndPort, createMockUserToken,
6
6
  import nodeFetch from 'node-fetch';
7
7
  import { randomBytes as randomBytes$1 } from 'crypto';
8
8
 
9
- const version$1 = "3.7.1";
9
+ const version$1 = "3.7.2-canary.457fc2eeb";
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 = "9.12.1";
62
+ const version = "9.13.0-canary.457fc2eeb";
63
63
 
64
64
  /**
65
65
  * @license
@@ -1460,6 +1460,7 @@ class FetchConnection extends RestConnection {
1460
1460
  throw new Error('Not supported by FetchConnection');
1461
1461
  }
1462
1462
  async performRPCRequest(rpcName, url, headers, body) {
1463
+ var _a;
1463
1464
  const requestJson = JSON.stringify(body);
1464
1465
  let response;
1465
1466
  try {
@@ -1473,7 +1474,12 @@ class FetchConnection extends RestConnection {
1473
1474
  throw new FirestoreError(mapCodeFromHttpStatus(err.status), 'Request failed with error: ' + err.statusText);
1474
1475
  }
1475
1476
  if (!response.ok) {
1476
- throw new FirestoreError(mapCodeFromHttpStatus(response.status), 'Request failed with error: ' + response.statusText);
1477
+ let errorResponse = await response.json();
1478
+ if (Array.isArray(errorResponse)) {
1479
+ errorResponse = errorResponse[0];
1480
+ }
1481
+ const errorMessage = (_a = errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.error) === null || _a === void 0 ? void 0 : _a.message;
1482
+ throw new FirestoreError(mapCodeFromHttpStatus(response.status), `Request failed with error: ${errorMessage !== null && errorMessage !== void 0 ? errorMessage : response.statusText}`);
1477
1483
  }
1478
1484
  return response.json();
1479
1485
  }
@@ -8131,6 +8137,7 @@ class TransactionRunner {
8131
8137
  const code = error.code;
8132
8138
  return (code === 'aborted' ||
8133
8139
  code === 'failed-precondition' ||
8140
+ code === 'already-exists' ||
8134
8141
  !isPermanentError(code));
8135
8142
  }
8136
8143
  return false;