@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
@@ -33,7 +33,7 @@ var grpc__namespace = /*#__PURE__*/_interopNamespace(grpc);
33
33
  var protoLoader__namespace = /*#__PURE__*/_interopNamespace(protoLoader);
34
34
 
35
35
  const name = "@firebase/firestore";
36
- const version$1 = "3.4.10";
36
+ const version$1 = "3.4.11-canary.b60cf76e1";
37
37
 
38
38
  /**
39
39
  * @license
@@ -86,7 +86,7 @@ User.GOOGLE_CREDENTIALS = new User('google-credentials-uid');
86
86
  User.FIRST_PARTY = new User('first-party-uid');
87
87
  User.MOCK_USER = new User('mock-user');
88
88
 
89
- const version = "9.8.3";
89
+ const version = "9.8.4-canary.b60cf76e1";
90
90
 
91
91
  /**
92
92
  * @license
@@ -2250,7 +2250,8 @@ class SimpleDb {
2250
2250
  await transaction.completionPromise;
2251
2251
  return transactionFnResult;
2252
2252
  }
2253
- catch (error) {
2253
+ catch (e) {
2254
+ const error = e;
2254
2255
  // TODO(schmidt-sebastian): We could probably be smarter about this and
2255
2256
  // not retry exceptions that are likely unrecoverable (such as quota
2256
2257
  // exceeded errors).
@@ -17261,7 +17262,7 @@ class GrpcConnection {
17261
17262
  });
17262
17263
  });
17263
17264
  }
17264
- invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken) {
17265
+ invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken, expectedResponseCount) {
17265
17266
  const results = [];
17266
17267
  const responseDeferred = new Deferred();
17267
17268
  logDebug(LOG_TAG$9, `RPC '${rpcName}' invoked (streaming) with request:`, request);
@@ -17269,13 +17270,22 @@ class GrpcConnection {
17269
17270
  const metadata = createMetadata(this.databasePath, authToken, appCheckToken, this.databaseInfo.appId);
17270
17271
  const jsonRequest = Object.assign(Object.assign({}, request), { database: this.databasePath });
17271
17272
  const stream = stub[rpcName](jsonRequest, metadata);
17273
+ let callbackFired = false;
17272
17274
  stream.on('data', (response) => {
17273
17275
  logDebug(LOG_TAG$9, `RPC ${rpcName} received result:`, response);
17274
17276
  results.push(response);
17277
+ if (expectedResponseCount !== undefined &&
17278
+ results.length === expectedResponseCount) {
17279
+ callbackFired = true;
17280
+ responseDeferred.resolve(results);
17281
+ }
17275
17282
  });
17276
17283
  stream.on('end', () => {
17277
17284
  logDebug(LOG_TAG$9, `RPC '${rpcName}' completed.`);
17278
- responseDeferred.resolve(results);
17285
+ if (!callbackFired) {
17286
+ callbackFired = true;
17287
+ responseDeferred.resolve(results);
17288
+ }
17279
17289
  });
17280
17290
  stream.on('error', (grpcError) => {
17281
17291
  logDebug(LOG_TAG$9, `RPC '${rpcName}' failed with error:`, grpcError);
@@ -20828,14 +20838,14 @@ class DatastoreImpl extends Datastore {
20828
20838
  });
20829
20839
  }
20830
20840
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */
20831
- invokeStreamingRPC(rpcName, path, request) {
20841
+ invokeStreamingRPC(rpcName, path, request, expectedResponseCount) {
20832
20842
  this.verifyInitialized();
20833
20843
  return Promise.all([
20834
20844
  this.authCredentials.getToken(),
20835
20845
  this.appCheckCredentials.getToken()
20836
20846
  ])
20837
20847
  .then(([authToken, appCheckToken]) => {
20838
- return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken);
20848
+ return this.connection.invokeStreamingRPC(rpcName, path, request, authToken, appCheckToken, expectedResponseCount);
20839
20849
  })
20840
20850
  .catch((error) => {
20841
20851
  if (error.name === 'FirebaseError') {
@@ -20873,7 +20883,7 @@ async function invokeBatchGetDocumentsRpc(datastore, keys) {
20873
20883
  const request = {
20874
20884
  documents: keys.map(k => toName(datastoreImpl.serializer, k))
20875
20885
  };
20876
- const response = await datastoreImpl.invokeStreamingRPC('BatchGetDocuments', path, request);
20886
+ const response = await datastoreImpl.invokeStreamingRPC('BatchGetDocuments', path, request, keys.length);
20877
20887
  const docs = new Map();
20878
20888
  response.forEach(proto => {
20879
20889
  const doc = fromBatchGetDocumentsResponse(datastoreImpl.serializer, proto);
@@ -26215,13 +26225,14 @@ function setPersistenceProviders(client, onlineComponentProvider, offlineCompone
26215
26225
  persistenceResult.resolve();
26216
26226
  }
26217
26227
  catch (e) {
26218
- if (!canFallbackFromIndexedDbError(e)) {
26219
- throw e;
26228
+ const error = e;
26229
+ if (!canFallbackFromIndexedDbError(error)) {
26230
+ throw error;
26220
26231
  }
26221
26232
  console.warn('Error enabling offline persistence. Falling back to ' +
26222
26233
  'persistence disabled: ' +
26223
- e);
26224
- persistenceResult.reject(e);
26234
+ error);
26235
+ persistenceResult.reject(error);
26225
26236
  }
26226
26237
  })
26227
26238
  .then(() => persistenceResult.promise);
@@ -29166,11 +29177,12 @@ function setIndexConfiguration(firestore, jsonOrConfiguration) {
29166
29177
  return Promise.resolve();
29167
29178
  }
29168
29179
  function tryParseJson(json) {
29180
+ var _a;
29169
29181
  try {
29170
29182
  return JSON.parse(json);
29171
29183
  }
29172
29184
  catch (e) {
29173
- throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + e.message);
29185
+ throw new FirestoreError(Code.INVALID_ARGUMENT, 'Failed to parse JSON:' + ((_a = e) === null || _a === void 0 ? void 0 : _a.message));
29174
29186
  }
29175
29187
  }
29176
29188
  function tryGetString(data, property) {