@firebase/firestore 3.4.13 → 3.4.14-canary.47895fe5b

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 (77) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/firestore/src/api/credentials.d.ts +13 -3
  3. package/dist/firestore/src/api/index_configuration.d.ts +7 -8
  4. package/dist/firestore/src/api.d.ts +1 -1
  5. package/dist/firestore/src/local/indexeddb_schema.d.ts +1 -3
  6. package/dist/firestore/src/local/local_store_impl.d.ts +2 -0
  7. package/dist/firestore/src/util/array.d.ts +18 -0
  8. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  9. package/dist/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  10. package/dist/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  11. package/dist/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  12. package/dist/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  13. package/dist/firestore/test/unit/util/array.test.d.ts +17 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.esm2017.js +3737 -3589
  16. package/dist/index.esm2017.js.map +1 -1
  17. package/dist/index.esm5.js +3721 -3604
  18. package/dist/index.esm5.js.map +1 -1
  19. package/dist/index.node.cjs.js +250 -53
  20. package/dist/index.node.cjs.js.map +1 -1
  21. package/dist/index.node.mjs +250 -53
  22. package/dist/index.node.mjs.map +1 -1
  23. package/dist/index.rn.js +3676 -3529
  24. package/dist/index.rn.js.map +1 -1
  25. package/dist/internal.d.ts +13 -13
  26. package/dist/lite/firestore/src/api/credentials.d.ts +13 -3
  27. package/dist/lite/firestore/src/api/index_configuration.d.ts +7 -8
  28. package/dist/lite/firestore/src/api.d.ts +1 -1
  29. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +1 -3
  30. package/dist/lite/firestore/src/local/local_store_impl.d.ts +2 -0
  31. package/dist/lite/firestore/src/util/array.d.ts +18 -0
  32. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  33. package/dist/lite/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  34. package/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  35. package/dist/lite/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  36. package/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  37. package/dist/lite/firestore/test/unit/util/array.test.d.ts +17 -0
  38. package/dist/lite/index.browser.esm2017.js +232 -222
  39. package/dist/lite/index.browser.esm2017.js.map +1 -1
  40. package/dist/lite/index.browser.esm5.js +485 -469
  41. package/dist/lite/index.browser.esm5.js.map +1 -1
  42. package/dist/lite/index.node.cjs.js +36 -18
  43. package/dist/lite/index.node.cjs.js.map +1 -1
  44. package/dist/lite/index.node.mjs +36 -18
  45. package/dist/lite/index.node.mjs.map +1 -1
  46. package/dist/lite/index.rn.esm2017.js +232 -222
  47. package/dist/lite/index.rn.esm2017.js.map +1 -1
  48. package/dist/lite/internal.d.ts +3 -0
  49. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +23 -23
  50. package/dist/lite/packages/firestore/src/api/credentials.d.ts +13 -3
  51. package/dist/lite/packages/firestore/src/api/index_configuration.d.ts +7 -8
  52. package/dist/lite/packages/firestore/src/api.d.ts +1 -1
  53. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  54. package/dist/lite/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  55. package/dist/lite/packages/firestore/src/util/array.d.ts +18 -0
  56. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  57. package/dist/lite/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  58. package/dist/lite/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  59. package/dist/lite/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  60. package/dist/lite/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  61. package/dist/lite/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  62. package/dist/lite/private.d.ts +3 -0
  63. package/dist/packages/firestore/dist/index.esm2017.d.ts +193 -193
  64. package/dist/packages/firestore/src/api/credentials.d.ts +13 -3
  65. package/dist/packages/firestore/src/api/index_configuration.d.ts +7 -8
  66. package/dist/packages/firestore/src/api.d.ts +1 -1
  67. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +1 -3
  68. package/dist/packages/firestore/src/local/local_store_impl.d.ts +2 -0
  69. package/dist/packages/firestore/src/util/array.d.ts +18 -0
  70. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +11 -0
  71. package/dist/packages/firestore/test/unit/local/local_store_indexeddb.test.d.ts +17 -0
  72. package/dist/packages/firestore/test/unit/specs/index_spec.test.d.ts +17 -0
  73. package/dist/packages/firestore/test/unit/specs/spec_builder.d.ts +5 -0
  74. package/dist/packages/firestore/test/unit/specs/spec_test_runner.d.ts +8 -0
  75. package/dist/packages/firestore/test/unit/util/array.test.d.ts +17 -0
  76. package/dist/private.d.ts +4 -1
  77. package/package.json +10 -9
@@ -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.4.13";
17
+ const version$1 = "3.4.14-canary.47895fe5b";
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.9.1";
70
+ const version = "9.9.3-canary.47895fe5b";
71
71
 
72
72
  /**
73
73
  * @license
@@ -514,19 +514,41 @@ class LiteAuthCredentialsProvider {
514
514
  * safer to keep the implementation as-is.
515
515
  */
516
516
  class FirstPartyToken {
517
- constructor(gapi, sessionIndex, iamToken) {
517
+ constructor(gapi, sessionIndex, iamToken, authTokenFactory) {
518
+ this.gapi = gapi;
519
+ this.sessionIndex = sessionIndex;
520
+ this.iamToken = iamToken;
521
+ this.authTokenFactory = authTokenFactory;
518
522
  this.type = 'FirstParty';
519
523
  this.user = User.FIRST_PARTY;
520
- this.headers = new Map();
521
- this.headers.set('X-Goog-AuthUser', sessionIndex);
522
- const authHeader = gapi['auth']['getAuthHeaderValueForFirstParty']([]);
523
- if (authHeader) {
524
- this.headers.set('Authorization', authHeader);
524
+ this._headers = new Map();
525
+ }
526
+ /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */
527
+ getAuthToken() {
528
+ if (this.authTokenFactory) {
529
+ return this.authTokenFactory();
525
530
  }
526
- if (iamToken) {
527
- this.headers.set('X-Goog-Iam-Authorization-Token', iamToken);
531
+ else {
532
+ // Make sure this really is a Gapi client.
533
+ hardAssert(!!(typeof this.gapi === 'object' &&
534
+ this.gapi !== null &&
535
+ this.gapi['auth'] &&
536
+ this.gapi['auth']['getAuthHeaderValueForFirstParty']));
537
+ return this.gapi['auth']['getAuthHeaderValueForFirstParty']([]);
528
538
  }
529
539
  }
540
+ get headers() {
541
+ this._headers.set('X-Goog-AuthUser', this.sessionIndex);
542
+ // Use array notation to prevent minification
543
+ const authHeaderTokenValue = this.getAuthToken();
544
+ if (authHeaderTokenValue) {
545
+ this._headers.set('Authorization', authHeaderTokenValue);
546
+ }
547
+ if (this.iamToken) {
548
+ this._headers.set('X-Goog-Iam-Authorization-Token', this.iamToken);
549
+ }
550
+ return this._headers;
551
+ }
530
552
  }
531
553
  /*
532
554
  * Provides user credentials required for the Firestore JavaScript SDK
@@ -534,13 +556,14 @@ class FirstPartyToken {
534
556
  * to applications hosted by Google.
535
557
  */
536
558
  class FirstPartyAuthCredentialsProvider {
537
- constructor(gapi, sessionIndex, iamToken) {
559
+ constructor(gapi, sessionIndex, iamToken, authTokenFactory) {
538
560
  this.gapi = gapi;
539
561
  this.sessionIndex = sessionIndex;
540
562
  this.iamToken = iamToken;
563
+ this.authTokenFactory = authTokenFactory;
541
564
  }
542
565
  getToken() {
543
- return Promise.resolve(new FirstPartyToken(this.gapi, this.sessionIndex, this.iamToken));
566
+ return Promise.resolve(new FirstPartyToken(this.gapi, this.sessionIndex, this.iamToken, this.authTokenFactory));
544
567
  }
545
568
  start(asyncQueue, changeListener) {
546
569
  // Fire with initial uid.
@@ -597,12 +620,7 @@ function makeAuthCredentialsProvider(credentials) {
597
620
  switch (credentials['type']) {
598
621
  case 'gapi':
599
622
  const client = credentials['client'];
600
- // Make sure this really is a Gapi client.
601
- hardAssert(!!(typeof client === 'object' &&
602
- client !== null &&
603
- client['auth'] &&
604
- client['auth']['getAuthHeaderValueForFirstParty']));
605
- return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null);
623
+ return new FirstPartyAuthCredentialsProvider(client, credentials['sessionIndex'] || '0', credentials['iamToken'] || null, credentials['authTokenFactory'] || null);
606
624
  case 'provider':
607
625
  return credentials['client'];
608
626
  default: