@firebase/firestore 3.4.10 → 3.4.11-canary.b60cf76e1

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/firestore/src/platform/node/grpc_connection.d.ts +1 -1
  3. package/dist/firestore/src/remote/connection.d.ts +1 -1
  4. package/dist/firestore/src/remote/rest_connection.d.ts +1 -1
  5. package/dist/index.esm2017.js +16 -14
  6. package/dist/index.esm2017.js.map +1 -1
  7. package/dist/index.esm5.js +28 -22
  8. package/dist/index.esm5.js.map +1 -1
  9. package/dist/index.node.cjs.js +25 -13
  10. package/dist/index.node.cjs.js.map +1 -1
  11. package/dist/index.node.mjs +25 -13
  12. package/dist/index.node.mjs.map +1 -1
  13. package/dist/index.rn.js +16 -14
  14. package/dist/index.rn.js.map +1 -1
  15. package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +1 -1
  16. package/dist/lite/firestore/src/remote/connection.d.ts +1 -1
  17. package/dist/lite/firestore/src/remote/rest_connection.d.ts +1 -1
  18. package/dist/lite/index.browser.esm2017.js +6 -6
  19. package/dist/lite/index.browser.esm2017.js.map +1 -1
  20. package/dist/lite/index.browser.esm5.js +11 -11
  21. package/dist/lite/index.browser.esm5.js.map +1 -1
  22. package/dist/lite/index.node.cjs.js +6 -6
  23. package/dist/lite/index.node.cjs.js.map +1 -1
  24. package/dist/lite/index.node.mjs +6 -6
  25. package/dist/lite/index.node.mjs.map +1 -1
  26. package/dist/lite/index.rn.esm2017.js +6 -6
  27. package/dist/lite/index.rn.esm2017.js.map +1 -1
  28. package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +1 -1
  29. package/dist/lite/packages/firestore/src/remote/connection.d.ts +1 -1
  30. package/dist/lite/packages/firestore/src/remote/rest_connection.d.ts +1 -1
  31. package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +1 -1
  32. package/dist/packages/firestore/src/remote/connection.d.ts +1 -1
  33. package/dist/packages/firestore/src/remote/rest_connection.d.ts +1 -1
  34. package/package.json +9 -9
@@ -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.4.10";
11
+ const version$1 = "3.4.11-canary.b60cf76e1";
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.8.3";
64
+ const version = "9.8.4-canary.b60cf76e1";
65
65
 
66
66
  /**
67
67
  * @license
@@ -2225,7 +2225,8 @@ class SimpleDb {
2225
2225
  await transaction.completionPromise;
2226
2226
  return transactionFnResult;
2227
2227
  }
2228
- catch (error) {
2228
+ catch (e) {
2229
+ const error = e;
2229
2230
  // TODO(schmidt-sebastian): We could probably be smarter about this and
2230
2231
  // not retry exceptions that are likely unrecoverable (such as quota
2231
2232
  // exceeded errors).
@@ -17236,7 +17237,7 @@ class GrpcConnection {
17236
17237
  });
17237
17238
  });
17238
17239
  }
17239
- invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken) {
17240
+ invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken, expectedResponseCount) {
17240
17241
  const results = [];
17241
17242
  const responseDeferred = new Deferred();
17242
17243
  logDebug(LOG_TAG$9, `RPC '${rpcName}' invoked (streaming) with request:`, request);
@@ -17244,13 +17245,22 @@ class GrpcConnection {
17244
17245
  const metadata = createMetadata(this.databasePath, authToken, appCheckToken, this.databaseInfo.appId);
17245
17246
  const jsonRequest = Object.assign(Object.assign({}, request), { database: this.databasePath });
17246
17247
  const stream = stub[rpcName](jsonRequest, metadata);
17248
+ let callbackFired = false;
17247
17249
  stream.on('data', (response) => {
17248
17250
  logDebug(LOG_TAG$9, `RPC ${rpcName} received result:`, response);
17249
17251
  results.push(response);
17252
+ if (expectedResponseCount !== undefined &&
17253
+ results.length === expectedResponseCount) {
17254
+ callbackFired = true;
17255
+ responseDeferred.resolve(results);
17256
+ }
17250
17257
  });
17251
17258
  stream.on('end', () => {
17252
17259
  logDebug(LOG_TAG$9, `RPC '${rpcName}' completed.`);
17253
- responseDeferred.resolve(results);
17260
+ if (!callbackFired) {
17261
+ callbackFired = true;
17262
+ responseDeferred.resolve(results);
17263
+ }
17254
17264
  });
17255
17265
  stream.on('error', (grpcError) => {
17256
17266
  logDebug(LOG_TAG$9, `RPC '${rpcName}' failed with error:`, grpcError);
@@ -20803,14 +20813,14 @@ class DatastoreImpl extends Datastore {
20803
20813
  });
20804
20814
  }
20805
20815
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
20806
- invokeStreamingRPC(rpcName, path, request) {
20816
+ invokeStreamingRPC(rpcName, path, request, expectedResponseCount) {
20807
20817
  this.verifyInitialized();
20808
20818
  return Promise.all([
20809
20819
  this.authCredentials.getToken(),
20810
20820
  this.appCheckCredentials.getToken()
20811
20821
  ])
20812
20822
  .then(([authToken, appCheckToken]) => {
20813
- return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken);
20823
+ return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken, expectedResponseCount);
20814
20824
  })
20815
20825
  .catch((error) => {
20816
20826
  if (error.name === 'FirebaseError') {
@@ -20848,7 +20858,7 @@ async function invokeBatchGetDocumentsRpc(datastore, keys) {
20848
20858
  const request = {
20849
20859
  documents: keys.map(k => toName(datastoreImpl.serializer, k))
20850
20860
  };
20851
- const response = await datastoreImpl.invokeStreamingRPC('BatchGetDocuments', path, request);
20861
+ const response = await datastoreImpl.invokeStreamingRPC('BatchGetDocuments', path, request, keys.length);
20852
20862
  const docs = new Map();
20853
20863
  response.forEach(proto => {
20854
20864
  const doc = fromBatchGetDocumentsResponse(datastoreImpl.serializer, proto);
@@ -26190,13 +26200,14 @@ function setPersistenceProviders(client, onlineComponentProvider, offlineCompone
26190
26200
  persistenceResult.resolve();
26191
26201
  }
26192
26202
  catch (e) {
26193
- if (!canFallbackFromIndexedDbError(e)) {
26194
- throw e;
26203
+ const error = e;
26204
+ if (!canFallbackFromIndexedDbError(error)) {
26205
+ throw error;
26195
26206
  }
26196
26207
  console.warn('Error enabling offline persistence. Falling back to ' +
26197
26208
  'persistence disabled: ' +
26198
- e);
26199
- persistenceResult.reject(e);
26209
+ error);
26210
+ persistenceResult.reject(error);
26200
26211
  }
26201
26212
  })
26202
26213
  .then(() => persistenceResult.promise);
@@ -29141,11 +29152,12 @@ function setIndexConfiguration(firestore, jsonOrConfiguration) {
29141
29152
  return Promise.resolve();
29142
29153
  }
29143
29154
  function tryParseJson(json) {
29155
+ var _a;
29144
29156
  try {
29145
29157
  return JSON.parse(json);
29146
29158
  }
29147
29159
  catch (e) {
29148
- throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + e.message);
29160
+ throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + ((_a = e) === null || _a === void 0 ? void 0 : _a.message));
29149
29161
  }
29150
29162
  }
29151
29163
  function tryGetString(data, property) {